| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.ast_test; | 3 library engine.ast_test; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer_experimental/src/generated/source.dart'; | 8 import 'package:analyzer_experimental/src/generated/source.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/error.dart'; | 9 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral.
full(TokenFactory.token2("'${content}'"), content); | 394 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral.
full(TokenFactory.token2("'${content}'"), content); |
| 395 static SuperConstructorInvocation superConstructorInvocation(List<Expression>
arguments) => superConstructorInvocation2(null, arguments); | 395 static SuperConstructorInvocation superConstructorInvocation(List<Expression>
arguments) => superConstructorInvocation2(null, arguments); |
| 396 static SuperConstructorInvocation superConstructorInvocation2(String name, Lis
t<Expression> arguments) => new SuperConstructorInvocation.full(TokenFactory.tok
en(Keyword.SUPER), name == null ? null : TokenFactory.token3(TokenType.PERIOD),
name == null ? null : identifier3(name), argumentList(arguments)); | 396 static SuperConstructorInvocation superConstructorInvocation2(String name, Lis
t<Expression> arguments) => new SuperConstructorInvocation.full(TokenFactory.tok
en(Keyword.SUPER), name == null ? null : TokenFactory.token3(TokenType.PERIOD),
name == null ? null : identifier3(name), argumentList(arguments)); |
| 397 static SuperExpression superExpression() => new SuperExpression.full(TokenFact
ory.token(Keyword.SUPER)); | 397 static SuperExpression superExpression() => new SuperExpression.full(TokenFact
ory.token(Keyword.SUPER)); |
| 398 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); | 398 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); |
| 399 static SwitchCase switchCase2(List<Label> labels, Expression expression, List<
Statement> statements) => new SwitchCase.full(labels, TokenFactory.token(Keyword
.CASE), expression, TokenFactory.token3(TokenType.COLON), list(statements)); | 399 static SwitchCase switchCase2(List<Label> labels, Expression expression, List<
Statement> statements) => new SwitchCase.full(labels, TokenFactory.token(Keyword
.CASE), expression, TokenFactory.token3(TokenType.COLON), list(statements)); |
| 400 static SwitchDefault switchDefault(List<Label> labels, List<Statement> stateme
nts) => new SwitchDefault.full(labels, TokenFactory.token(Keyword.DEFAULT), Toke
nFactory.token3(TokenType.COLON), list(statements)); | 400 static SwitchDefault switchDefault(List<Label> labels, List<Statement> stateme
nts) => new SwitchDefault.full(labels, TokenFactory.token(Keyword.DEFAULT), Toke
nFactory.token3(TokenType.COLON), list(statements)); |
| 401 static SwitchDefault switchDefault2(List<Statement> statements) => switchDefau
lt(new List<Label>(), statements); | 401 static SwitchDefault switchDefault2(List<Statement> statements) => switchDefau
lt(new List<Label>(), statements); |
| 402 static SwitchStatement switchStatement(Expression expression, List<SwitchMembe
r> members) => new SwitchStatement.full(TokenFactory.token(Keyword.SWITCH), Toke
nFactory.token3(TokenType.OPEN_PAREN), expression, TokenFactory.token3(TokenType
.CLOSE_PAREN), TokenFactory.token3(TokenType.OPEN_CURLY_BRACKET), list(members),
TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET)); | 402 static SwitchStatement switchStatement(Expression expression, List<SwitchMembe
r> members) => new SwitchStatement.full(TokenFactory.token(Keyword.SWITCH), Toke
nFactory.token3(TokenType.OPEN_PAREN), expression, TokenFactory.token3(TokenType
.CLOSE_PAREN), TokenFactory.token3(TokenType.OPEN_CURLY_BRACKET), list(members),
TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET)); |
| 403 static SymbolLiteral symbolLiteral(List<String> components) { | 403 static SymbolLiteral symbolLiteral(List<String> components) { |
| 404 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); | 404 List<Token> identifierList = new List<Token>(); |
| 405 for (String component in components) { | 405 for (String component in components) { |
| 406 identifierList.add(identifier3(component)); | 406 identifierList.add(TokenFactory.token4(TokenType.IDENTIFIER, component)); |
| 407 } | 407 } |
| 408 return new SymbolLiteral.full(TokenFactory.token3(TokenType.HASH), identifie
rList); | 408 return new SymbolLiteral.full(TokenFactory.token3(TokenType.HASH), new List.
from(identifierList)); |
| 409 } | 409 } |
| 410 static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory
.token(Keyword.THIS)); | 410 static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory
.token(Keyword.THIS)); |
| 411 static ThrowExpression throwExpression() => throwExpression2(null); | 411 static ThrowExpression throwExpression() => throwExpression2(null); |
| 412 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression.full(TokenFactory.token(Keyword.THROW), expression); | 412 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression.full(TokenFactory.token(Keyword.THROW), expression); |
| 413 static TopLevelVariableDeclaration topLevelVariableDeclaration(Keyword keyword
, TypeName type, List<VariableDeclaration> variables) => new TopLevelVariableDec
laration.full(null, null, variableDeclarationList(keyword, type, variables), Tok
enFactory.token3(TokenType.SEMICOLON)); | 413 static TopLevelVariableDeclaration topLevelVariableDeclaration(Keyword keyword
, TypeName type, List<VariableDeclaration> variables) => new TopLevelVariableDec
laration.full(null, null, variableDeclarationList(keyword, type, variables), Tok
enFactory.token3(TokenType.SEMICOLON)); |
| 414 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full(
null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke
n3(TokenType.SEMICOLON)); | 414 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full(
null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke
n3(TokenType.SEMICOLON)); |
| 415 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); | 415 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); |
| 416 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, list(catchClauses), null); | 416 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, list(catchClauses), null); |
| 417 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses,
Block finallyClause) => new TryStatement.full(TokenFactory.token(Keyword.TRY), b
ody, catchClauses, finallyClause == null ? null : TokenFactory.token(Keyword.FIN
ALLY), finallyClause); | 417 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses,
Block finallyClause) => new TryStatement.full(TokenFactory.token(Keyword.TRY), b
ody, catchClauses, finallyClause == null ? null : TokenFactory.token(Keyword.FIN
ALLY), finallyClause); |
| 418 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier3(
name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); | 418 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier3(
name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON)); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 final __test = new SimpleIdentifierTest(); | 710 final __test = new SimpleIdentifierTest(); |
| 711 runJUnitTest(__test, __test.test_inReferenceContext); | 711 runJUnitTest(__test, __test.test_inReferenceContext); |
| 712 }); | 712 }); |
| 713 _ut.test('test_inSetterContext', () { | 713 _ut.test('test_inSetterContext', () { |
| 714 final __test = new SimpleIdentifierTest(); | 714 final __test = new SimpleIdentifierTest(); |
| 715 runJUnitTest(__test, __test.test_inSetterContext); | 715 runJUnitTest(__test, __test.test_inSetterContext); |
| 716 }); | 716 }); |
| 717 }); | 717 }); |
| 718 } | 718 } |
| 719 } | 719 } |
| 720 class AssignmentKind implements Comparable<AssignmentKind> { | 720 class AssignmentKind implements Enum<AssignmentKind> { |
| 721 static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0); | 721 static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0); |
| 722 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); | 722 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); |
| 723 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); | 723 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); |
| 724 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; | 724 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; |
| 725 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); | 725 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); |
| 726 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); | 726 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); |
| 727 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); | 727 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); |
| 728 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; | 728 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; |
| 729 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); | 729 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); |
| 730 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); | 730 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 743 /// The name of this enum constant, as declared in the enum declaration. | 743 /// The name of this enum constant, as declared in the enum declaration. |
| 744 final String name; | 744 final String name; |
| 745 | 745 |
| 746 /// The position in the enum declaration. | 746 /// The position in the enum declaration. |
| 747 final int ordinal; | 747 final int ordinal; |
| 748 AssignmentKind(this.name, this.ordinal); | 748 AssignmentKind(this.name, this.ordinal); |
| 749 int compareTo(AssignmentKind other) => ordinal - other.ordinal; | 749 int compareTo(AssignmentKind other) => ordinal - other.ordinal; |
| 750 int get hashCode => ordinal; | 750 int get hashCode => ordinal; |
| 751 String toString() => name; | 751 String toString() => name; |
| 752 } | 752 } |
| 753 class WrapperKind implements Comparable<WrapperKind> { | 753 class WrapperKind implements Enum<WrapperKind> { |
| 754 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); | 754 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); |
| 755 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; | 755 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; |
| 756 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); | 756 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); |
| 757 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; | 757 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; |
| 758 static final WrapperKind NONE = new WrapperKind('NONE', 4); | 758 static final WrapperKind NONE = new WrapperKind('NONE', 4); |
| 759 static final List<WrapperKind> values = [ | 759 static final List<WrapperKind> values = [ |
| 760 PREFIXED_LEFT, | 760 PREFIXED_LEFT, |
| 761 PREFIXED_RIGHT, | 761 PREFIXED_RIGHT, |
| 762 PROPERTY_LEFT, | 762 PROPERTY_LEFT, |
| 763 PROPERTY_RIGHT, | 763 PROPERTY_RIGHT, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 789 "}", | 789 "}", |
| 790 "A f(var p) {", | 790 "A f(var p) {", |
| 791 " if ((p as A).g) {", | 791 " if ((p as A).g) {", |
| 792 " return p;", | 792 " return p;", |
| 793 " } else {", | 793 " } else {", |
| 794 " return null;", | 794 " return null;", |
| 795 " }", | 795 " }", |
| 796 "}"]); | 796 "}"]); |
| 797 CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []); | 797 CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []); |
| 798 List<ASTNode> nodes = new List<ASTNode>(); | 798 List<ASTNode> nodes = new List<ASTNode>(); |
| 799 BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_15(nodes); | 799 BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_16(nodes); |
| 800 visitor.visitAllNodes(unit); | 800 visitor.visitAllNodes(unit); |
| 801 EngineTestCase.assertSize(59, nodes); | 801 EngineTestCase.assertSize(59, nodes); |
| 802 EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]); | 802 EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]); |
| 803 EngineTestCase.assertInstanceOf(ClassDeclaration, nodes[2]); | 803 EngineTestCase.assertInstanceOf(ClassDeclaration, nodes[2]); |
| 804 EngineTestCase.assertInstanceOf(FunctionDeclaration, nodes[3]); | 804 EngineTestCase.assertInstanceOf(FunctionDeclaration, nodes[3]); |
| 805 EngineTestCase.assertInstanceOf(FunctionDeclarationStatement, nodes[27]); | 805 EngineTestCase.assertInstanceOf(FunctionDeclarationStatement, nodes[27]); |
| 806 EngineTestCase.assertInstanceOf(IntegerLiteral, nodes[58]); | 806 EngineTestCase.assertInstanceOf(IntegerLiteral, nodes[58]); |
| 807 } | 807 } |
| 808 static dartSuite() { | 808 static dartSuite() { |
| 809 _ut.group('BreadthFirstVisitorTest', () { | 809 _ut.group('BreadthFirstVisitorTest', () { |
| 810 _ut.test('testIt', () { | 810 _ut.test('testIt', () { |
| 811 final __test = new BreadthFirstVisitorTest(); | 811 final __test = new BreadthFirstVisitorTest(); |
| 812 runJUnitTest(__test, __test.testIt); | 812 runJUnitTest(__test, __test.testIt); |
| 813 }); | 813 }); |
| 814 }); | 814 }); |
| 815 } | 815 } |
| 816 } | 816 } |
| 817 class BreadthFirstVisitor_15 extends BreadthFirstVisitor<Object> { | 817 class BreadthFirstVisitor_16 extends BreadthFirstVisitor<Object> { |
| 818 List<ASTNode> nodes; | 818 List<ASTNode> nodes; |
| 819 BreadthFirstVisitor_15(this.nodes) : super(); | 819 BreadthFirstVisitor_16(this.nodes) : super(); |
| 820 Object visitNode(ASTNode node) { | 820 Object visitNode(ASTNode node) { |
| 821 nodes.add(node); | 821 nodes.add(node); |
| 822 return super.visitNode(node); | 822 return super.visitNode(node); |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 class ConstantEvaluatorTest extends ParserTestCase { | 825 class ConstantEvaluatorTest extends ParserTestCase { |
| 826 void fail_constructor() { | 826 void fail_constructor() { |
| 827 Object value = getConstantValue("?"); | 827 Object value = getConstantValue("?"); |
| 828 JUnitTestCase.assertEquals(null, value); | 828 JUnitTestCase.assertEquals(null, value); |
| 829 } | 829 } |
| (...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3118 } | 3118 } |
| 3119 main() { | 3119 main() { |
| 3120 ConstantEvaluatorTest.dartSuite(); | 3120 ConstantEvaluatorTest.dartSuite(); |
| 3121 NodeLocatorTest.dartSuite(); | 3121 NodeLocatorTest.dartSuite(); |
| 3122 ToSourceVisitorTest.dartSuite(); | 3122 ToSourceVisitorTest.dartSuite(); |
| 3123 BreadthFirstVisitorTest.dartSuite(); | 3123 BreadthFirstVisitorTest.dartSuite(); |
| 3124 IndexExpressionTest.dartSuite(); | 3124 IndexExpressionTest.dartSuite(); |
| 3125 SimpleIdentifierTest.dartSuite(); | 3125 SimpleIdentifierTest.dartSuite(); |
| 3126 VariableDeclarationTest.dartSuite(); | 3126 VariableDeclarationTest.dartSuite(); |
| 3127 } | 3127 } |
| OLD | NEW |