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 | 3 |
4 library engine.ast_test; | 4 library engine.ast_test; |
5 | 5 |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
8 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
10 import 'package:analyzer_experimental/src/generated/source.dart'; | 10 import 'package:analyzer_experimental/src/generated/source.dart'; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 final __test = new IndexExpressionTest(); | 178 final __test = new IndexExpressionTest(); |
179 runJUnitTest(__test, __test.test_inSetterContext_prefix_minusMinus); | 179 runJUnitTest(__test, __test.test_inSetterContext_prefix_minusMinus); |
180 }); | 180 }); |
181 _ut.test('test_inSetterContext_prefix_plusPlus', () { | 181 _ut.test('test_inSetterContext_prefix_plusPlus', () { |
182 final __test = new IndexExpressionTest(); | 182 final __test = new IndexExpressionTest(); |
183 runJUnitTest(__test, __test.test_inSetterContext_prefix_plusPlus); | 183 runJUnitTest(__test, __test.test_inSetterContext_prefix_plusPlus); |
184 }); | 184 }); |
185 }); | 185 }); |
186 } | 186 } |
187 } | 187 } |
| 188 |
188 /** | 189 /** |
189 * The class {@code ASTFactory} defines utility methods that can be used to crea
te AST nodes. The | 190 * The class {@code ASTFactory} defines utility methods that can be used to crea
te AST nodes. The |
190 * nodes that are created are complete in the sense that all of the tokens that
would have been | 191 * nodes that are created are complete in the sense that all of the tokens that
would have been |
191 * associated with the nodes by a parser are also created, but the token stream
is not constructed. | 192 * associated with the nodes by a parser are also created, but the token stream
is not constructed. |
192 * None of the nodes are resolved. | 193 * None of the nodes are resolved. |
193 * <p> | 194 * <p> |
194 * The general pattern is for the name of the factory method to be the same as t
he name of the class | 195 * The general pattern is for the name of the factory method to be the same as t
he name of the class |
195 * of AST node being created. There are two notable exceptions. The first is for
methods creating | 196 * of AST node being created. There are two notable exceptions. The first is for
methods creating |
196 * nodes that are part of a cascade expression. These methods are all prefixed w
ith 'cascaded'. The | 197 * nodes that are part of a cascade expression. These methods are all prefixed w
ith 'cascaded'. The |
197 * second is places where a shorter name seemed unambiguous and easier to read,
such as using | 198 * second is places where a shorter name seemed unambiguous and easier to read,
such as using |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory
.token(Keyword.THIS)); | 366 static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory
.token(Keyword.THIS)); |
366 static ThrowExpression throwExpression() => throwExpression2(null); | 367 static ThrowExpression throwExpression() => throwExpression2(null); |
367 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression.full(TokenFactory.token(Keyword.THROW), expression); | 368 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression.full(TokenFactory.token(Keyword.THROW), expression); |
368 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)); | 369 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)); |
369 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full(
null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke
n3(TokenType.SEMICOLON)); | 370 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full(
null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke
n3(TokenType.SEMICOLON)); |
370 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); | 371 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); |
371 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, list(catchClauses), null); | 372 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, list(catchClauses), null); |
372 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); | 373 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); |
373 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)); | 374 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)); |
374 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type
ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto
ry.token3(TokenType.GT)); | 375 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type
ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto
ry.token3(TokenType.GT)); |
| 376 |
375 /** | 377 /** |
376 * Create a type name whose name has been resolved to the given element and wh
ose type has been | 378 * Create a type name whose name has been resolved to the given element and wh
ose type has been |
377 * resolved to the type of the given element. | 379 * resolved to the type of the given element. |
378 * <p> | 380 * <p> |
379 * <b>Note:</b> This method does not correctly handle class elements that have
type parameters. | 381 * <b>Note:</b> This method does not correctly handle class elements that have
type parameters. |
380 * @param element the element defining the type represented by the type name | 382 * @param element the element defining the type represented by the type name |
381 * @return the type name that was created | 383 * @return the type name that was created |
382 */ | 384 */ |
383 static TypeName typeName(ClassElement element2, List<TypeName> arguments) { | 385 static TypeName typeName(ClassElement element2, List<TypeName> arguments) { |
384 SimpleIdentifier name2 = identifier3(element2.name); | 386 SimpleIdentifier name2 = identifier3(element2.name); |
(...skipping 24 matching lines...) Expand all Loading... |
409 return new TypeParameterList.full(TokenFactory.token3(TokenType.LT), typePar
ameters, TokenFactory.token3(TokenType.GT)); | 411 return new TypeParameterList.full(TokenFactory.token3(TokenType.LT), typePar
ameters, TokenFactory.token3(TokenType.GT)); |
410 } | 412 } |
411 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration.full(null, null, identifier3(name), null, null); | 413 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration.full(null, null, identifier3(name), null, null); |
412 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration.full(null, null, identifier3(name), TokenFacto
ry.token3(TokenType.EQ), initializer); | 414 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration.full(null, null, identifier3(name), TokenFacto
ry.token3(TokenType.EQ), initializer); |
413 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList.ful
l(null, null, keyword == null ? null : TokenFactory.token(keyword), type, list(v
ariables)); | 415 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList.ful
l(null, null, keyword == null ? null : TokenFactory.token(keyword), type, list(v
ariables)); |
414 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); | 416 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); |
415 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement.full(variableDeclarationList(keyword, type, variables), TokenFactory
.token3(TokenType.SEMICOLON)); | 417 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement.full(variableDeclarationList(keyword, type, variables), TokenFactory
.token3(TokenType.SEMICOLON)); |
416 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); | 418 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); |
417 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T
okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod
y); | 419 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement.full(TokenFactory.token(Keyword.WHILE), TokenFactory.token3(T
okenType.OPEN_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), bod
y); |
418 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke
nFactory.token(Keyword.WITH), list(types)); | 420 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke
nFactory.token(Keyword.WITH), list(types)); |
419 /** | |
420 * Prevent the creation of instances of this class. | |
421 */ | |
422 ASTFactory() { | |
423 } | |
424 } | 421 } |
425 class SimpleIdentifierTest extends ParserTestCase { | 422 class SimpleIdentifierTest extends ParserTestCase { |
426 void test_inDeclarationContext_argumentDefinition() { | 423 void test_inDeclarationContext_argumentDefinition() { |
427 SimpleIdentifier identifier2 = ASTFactory.argumentDefinitionTest("p").identi
fier; | 424 SimpleIdentifier identifier2 = ASTFactory.argumentDefinitionTest("p").identi
fier; |
428 JUnitTestCase.assertFalse(identifier2.inDeclarationContext()); | 425 JUnitTestCase.assertFalse(identifier2.inDeclarationContext()); |
429 } | 426 } |
430 void test_inDeclarationContext_catch_exception() { | 427 void test_inDeclarationContext_catch_exception() { |
431 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam
eter; | 428 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam
eter; |
432 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); | 429 JUnitTestCase.assertTrue(identifier.inDeclarationContext()); |
433 } | 430 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 ASTFactory.prefixExpression(TokenType.BANG, expression); | 559 ASTFactory.prefixExpression(TokenType.BANG, expression); |
563 } else if (assignment == AssignmentKind.SIMPLE_LEFT) { | 560 } else if (assignment == AssignmentKind.SIMPLE_LEFT) { |
564 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.ide
ntifier3("_")); | 561 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.ide
ntifier3("_")); |
565 } else if (assignment == AssignmentKind.SIMPLE_RIGHT) { | 562 } else if (assignment == AssignmentKind.SIMPLE_RIGHT) { |
566 ASTFactory.assignmentExpression(ASTFactory.identifier3("_"), TokenType.E
Q, expression); | 563 ASTFactory.assignmentExpression(ASTFactory.identifier3("_"), TokenType.E
Q, expression); |
567 } | 564 } |
568 break; | 565 break; |
569 } | 566 } |
570 return identifier; | 567 return identifier; |
571 } | 568 } |
| 569 |
572 /** | 570 /** |
573 * Return the top-most node in the AST structure containing the given identifi
er. | 571 * Return the top-most node in the AST structure containing the given identifi
er. |
574 * @param identifier the identifier in the AST structure being traversed | 572 * @param identifier the identifier in the AST structure being traversed |
575 * @return the root of the AST structure containing the identifier | 573 * @return the root of the AST structure containing the identifier |
576 */ | 574 */ |
577 ASTNode topMostNode(SimpleIdentifier identifier) { | 575 ASTNode topMostNode(SimpleIdentifier identifier) { |
578 ASTNode child = identifier; | 576 ASTNode child = identifier; |
579 ASTNode parent2 = identifier.parent; | 577 ASTNode parent2 = identifier.parent; |
580 while (parent2 != null) { | 578 while (parent2 != null) { |
581 child = parent2; | 579 child = parent2; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); | 667 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT'
, 1); |
670 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); | 668 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH
T', 2); |
671 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; | 669 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3)
; |
672 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); | 670 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4); |
673 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); | 671 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5); |
674 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); | 672 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6); |
675 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; | 673 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7)
; |
676 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); | 674 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT',
8); |
677 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); | 675 static final AssignmentKind NONE = new AssignmentKind('NONE', 9); |
678 static final List<AssignmentKind> values = [BINARY, COMPOUND_LEFT, COMPOUND_RI
GHT, POSTFIX_INC, PREFIX_DEC, PREFIX_INC, PREFIX_NOT, SIMPLE_LEFT, SIMPLE_RIGHT,
NONE]; | 676 static final List<AssignmentKind> values = [BINARY, COMPOUND_LEFT, COMPOUND_RI
GHT, POSTFIX_INC, PREFIX_DEC, PREFIX_INC, PREFIX_NOT, SIMPLE_LEFT, SIMPLE_RIGHT,
NONE]; |
679 final String __name; | 677 |
680 final int __ordinal; | 678 /// The name of this enum constant, as declared in the enum declaration. |
681 int get ordinal => __ordinal; | 679 final String name; |
682 AssignmentKind(this.__name, this.__ordinal) { | 680 |
| 681 /// The position in the enum declaration. |
| 682 final int ordinal; |
| 683 AssignmentKind(this.name, this.ordinal) { |
683 } | 684 } |
684 int compareTo(AssignmentKind other) => __ordinal - other.__ordinal; | 685 int compareTo(AssignmentKind other) => ordinal - other.ordinal; |
685 String toString() => __name; | 686 String toString() => name; |
686 } | 687 } |
687 class WrapperKind implements Comparable<WrapperKind> { | 688 class WrapperKind implements Comparable<WrapperKind> { |
688 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); | 689 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0); |
689 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; | 690 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1)
; |
690 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); | 691 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2); |
691 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; | 692 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3)
; |
692 static final WrapperKind NONE = new WrapperKind('NONE', 4); | 693 static final WrapperKind NONE = new WrapperKind('NONE', 4); |
693 static final List<WrapperKind> values = [PREFIXED_LEFT, PREFIXED_RIGHT, PROPER
TY_LEFT, PROPERTY_RIGHT, NONE]; | 694 static final List<WrapperKind> values = [PREFIXED_LEFT, PREFIXED_RIGHT, PROPER
TY_LEFT, PROPERTY_RIGHT, NONE]; |
694 final String __name; | 695 |
695 final int __ordinal; | 696 /// The name of this enum constant, as declared in the enum declaration. |
696 int get ordinal => __ordinal; | 697 final String name; |
697 WrapperKind(this.__name, this.__ordinal) { | 698 |
| 699 /// The position in the enum declaration. |
| 700 final int ordinal; |
| 701 WrapperKind(this.name, this.ordinal) { |
698 } | 702 } |
699 int compareTo(WrapperKind other) => __ordinal - other.__ordinal; | 703 int compareTo(WrapperKind other) => ordinal - other.ordinal; |
700 String toString() => __name; | 704 String toString() => name; |
| 705 } |
| 706 class BreadthFirstVisitorTest extends ParserTestCase { |
| 707 void testIt() { |
| 708 String source = EngineTestCase.createSource(["class A {", " bool get g => t
rue;", "}", "class B {", " int f() {", " num q() {", " return 3;", "
}", " return q() + 4;", " }", "}", "A f(var p) {", " if ((p as A).g) {", "
return p;", " } else {", " return null;", " }", "}"]); |
| 709 CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []); |
| 710 List<ASTNode> nodes = new List<ASTNode>(); |
| 711 BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_15(nodes); |
| 712 visitor.visitAllNodes(unit); |
| 713 EngineTestCase.assertSize(59, nodes); |
| 714 EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]); |
| 715 EngineTestCase.assertInstanceOf(ClassDeclaration, nodes[2]); |
| 716 EngineTestCase.assertInstanceOf(FunctionDeclaration, nodes[3]); |
| 717 EngineTestCase.assertInstanceOf(FunctionDeclarationStatement, nodes[27]); |
| 718 EngineTestCase.assertInstanceOf(IntegerLiteral, nodes[58]); |
| 719 } |
| 720 static dartSuite() { |
| 721 _ut.group('BreadthFirstVisitorTest', () { |
| 722 _ut.test('testIt', () { |
| 723 final __test = new BreadthFirstVisitorTest(); |
| 724 runJUnitTest(__test, __test.testIt); |
| 725 }); |
| 726 }); |
| 727 } |
| 728 } |
| 729 class BreadthFirstVisitor_15 extends BreadthFirstVisitor<Object> { |
| 730 List<ASTNode> nodes; |
| 731 BreadthFirstVisitor_15(this.nodes) : super(); |
| 732 Object visitNode(ASTNode node) { |
| 733 nodes.add(node); |
| 734 return super.visitNode(node); |
| 735 } |
701 } | 736 } |
702 class ConstantEvaluatorTest extends ParserTestCase { | 737 class ConstantEvaluatorTest extends ParserTestCase { |
703 void fail_constructor() { | 738 void fail_constructor() { |
704 Object value = getConstantValue("?"); | 739 Object value = getConstantValue("?"); |
705 JUnitTestCase.assertEquals(null, value); | 740 JUnitTestCase.assertEquals(null, value); |
706 } | 741 } |
707 void fail_identifier_class() { | 742 void fail_identifier_class() { |
708 Object value = getConstantValue("?"); | 743 Object value = getConstantValue("?"); |
709 JUnitTestCase.assertEquals(null, value); | 744 JUnitTestCase.assertEquals(null, value); |
710 } | 745 } |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 } | 1914 } |
1880 void test_visitWhileStatement() { | 1915 void test_visitWhileStatement() { |
1881 assertSource("while (c) {}", ASTFactory.whileStatement(ASTFactory.identifier
3("c"), ASTFactory.block([]))); | 1916 assertSource("while (c) {}", ASTFactory.whileStatement(ASTFactory.identifier
3("c"), ASTFactory.block([]))); |
1882 } | 1917 } |
1883 void test_visitWithClause_multiple() { | 1918 void test_visitWithClause_multiple() { |
1884 assertSource("with A, B, C", ASTFactory.withClause([ASTFactory.typeName4("A"
, []), ASTFactory.typeName4("B", []), ASTFactory.typeName4("C", [])])); | 1919 assertSource("with A, B, C", ASTFactory.withClause([ASTFactory.typeName4("A"
, []), ASTFactory.typeName4("B", []), ASTFactory.typeName4("C", [])])); |
1885 } | 1920 } |
1886 void test_visitWithClause_single() { | 1921 void test_visitWithClause_single() { |
1887 assertSource("with A", ASTFactory.withClause([ASTFactory.typeName4("A", [])]
)); | 1922 assertSource("with A", ASTFactory.withClause([ASTFactory.typeName4("A", [])]
)); |
1888 } | 1923 } |
| 1924 |
1889 /** | 1925 /** |
1890 * Assert that a {@code ToSourceVisitor} will produce the expected source when
visiting the given | 1926 * Assert that a {@code ToSourceVisitor} will produce the expected source when
visiting the given |
1891 * node. | 1927 * node. |
1892 * @param expectedSource the source string that the visitor is expected to pro
duce | 1928 * @param expectedSource the source string that the visitor is expected to pro
duce |
1893 * @param node the AST node being visited to produce the actual source | 1929 * @param node the AST node being visited to produce the actual source |
1894 * @throws AFE if the visitor does not produce the expected source for the giv
en node | 1930 * @throws AFE if the visitor does not produce the expected source for the giv
en node |
1895 */ | 1931 */ |
1896 void assertSource(String expectedSource, ASTNode node) { | 1932 void assertSource(String expectedSource, ASTNode node) { |
1897 PrintStringWriter writer = new PrintStringWriter(); | 1933 PrintStringWriter writer = new PrintStringWriter(); |
1898 node.accept(new ToSourceVisitor(writer)); | 1934 node.accept(new ToSourceVisitor(writer)); |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2868 final __test = new ToSourceVisitorTest(); | 2904 final __test = new ToSourceVisitorTest(); |
2869 runJUnitTest(__test, __test.test_visitWithClause_single); | 2905 runJUnitTest(__test, __test.test_visitWithClause_single); |
2870 }); | 2906 }); |
2871 }); | 2907 }); |
2872 } | 2908 } |
2873 } | 2909 } |
2874 main() { | 2910 main() { |
2875 ConstantEvaluatorTest.dartSuite(); | 2911 ConstantEvaluatorTest.dartSuite(); |
2876 NodeLocatorTest.dartSuite(); | 2912 NodeLocatorTest.dartSuite(); |
2877 ToSourceVisitorTest.dartSuite(); | 2913 ToSourceVisitorTest.dartSuite(); |
| 2914 BreadthFirstVisitorTest.dartSuite(); |
2878 IndexExpressionTest.dartSuite(); | 2915 IndexExpressionTest.dartSuite(); |
2879 SimpleIdentifierTest.dartSuite(); | 2916 SimpleIdentifierTest.dartSuite(); |
2880 } | 2917 } |
OLD | NEW |