Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: pkg/analyzer-experimental/test/generated/ast_test.dart

Issue 12838003: Rename analyzer-experimental to analyzer_experimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
3
4 library engine.ast_test;
5
6 import 'dart:collection';
7 import 'package:analyzer-experimental/src/generated/java_core.dart';
8 import 'package:analyzer-experimental/src/generated/java_engine.dart';
9 import 'package:analyzer-experimental/src/generated/java_junit.dart';
10 import 'package:analyzer-experimental/src/generated/source.dart';
11 import 'package:analyzer-experimental/src/generated/error.dart';
12 import 'package:analyzer-experimental/src/generated/scanner.dart';
13 import 'package:analyzer-experimental/src/generated/ast.dart';
14 import 'package:analyzer-experimental/src/generated/utilities_dart.dart';
15 import 'package:analyzer-experimental/src/generated/element.dart' show ClassElem ent;
16 import 'package:unittest/unittest.dart' as _ut;
17 import 'parser_test.dart' show ParserTestCase;
18 import 'test_support.dart';
19 import 'scanner_test.dart' show TokenFactory;
20
21 class NodeLocatorTest extends ParserTestCase {
22 void test_offset() {
23 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;", []);
24 assertLocate(unit, 10, SimpleIdentifier);
25 }
26 void test_range() {
27 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;", []);
28 assertLocate2(unit, 4, 10, LibraryDirective);
29 }
30 void assertLocate(CompilationUnit unit, int offset, Type expectedClass) {
31 assertLocate2(unit, offset, offset, expectedClass);
32 }
33 void assertLocate2(CompilationUnit unit, int start, int end, Type expectedClas s) {
34 NodeLocator locator = new NodeLocator.con2(start, end);
35 ASTNode node = locator.searchWithin(unit);
36 JUnitTestCase.assertNotNull(node);
37 JUnitTestCase.assertTrueMsg("Node starts after range", node.offset <= start) ;
38 JUnitTestCase.assertTrueMsg("Node ends before range", node.offset + node.len gth > end);
39 EngineTestCase.assertInstanceOf(expectedClass, node);
40 }
41 static dartSuite() {
42 _ut.group('NodeLocatorTest', () {
43 _ut.test('test_offset', () {
44 final __test = new NodeLocatorTest();
45 runJUnitTest(__test, __test.test_offset);
46 });
47 _ut.test('test_range', () {
48 final __test = new NodeLocatorTest();
49 runJUnitTest(__test, __test.test_range);
50 });
51 });
52 }
53 }
54 class IndexExpressionTest extends EngineTestCase {
55 void test_inGetterContext_assignment_compound_left() {
56 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
57 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null);
58 JUnitTestCase.assertTrue(expression.inGetterContext());
59 }
60 void test_inGetterContext_assignment_simple_left() {
61 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
62 ASTFactory.assignmentExpression(expression, TokenType.EQ, null);
63 JUnitTestCase.assertFalse(expression.inGetterContext());
64 }
65 void test_inGetterContext_nonAssignment() {
66 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
67 ASTFactory.binaryExpression(expression, TokenType.PLUS, null);
68 JUnitTestCase.assertTrue(expression.inGetterContext());
69 }
70 void test_inSetterContext_assignment_compound_left() {
71 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
72 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, null);
73 JUnitTestCase.assertTrue(expression.inSetterContext());
74 }
75 void test_inSetterContext_assignment_compound_right() {
76 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
77 ASTFactory.assignmentExpression(null, TokenType.PLUS_EQ, expression);
78 JUnitTestCase.assertFalse(expression.inSetterContext());
79 }
80 void test_inSetterContext_assignment_simple_left() {
81 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
82 ASTFactory.assignmentExpression(expression, TokenType.EQ, null);
83 JUnitTestCase.assertTrue(expression.inSetterContext());
84 }
85 void test_inSetterContext_assignment_simple_right() {
86 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
87 ASTFactory.assignmentExpression(null, TokenType.EQ, expression);
88 JUnitTestCase.assertFalse(expression.inSetterContext());
89 }
90 void test_inSetterContext_nonAssignment() {
91 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
92 ASTFactory.binaryExpression(expression, TokenType.PLUS, null);
93 JUnitTestCase.assertFalse(expression.inSetterContext());
94 }
95 void test_inSetterContext_postfix() {
96 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
97 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS);
98 JUnitTestCase.assertTrue(expression.inSetterContext());
99 }
100 void test_inSetterContext_prefix_bang() {
101 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
102 ASTFactory.prefixExpression(TokenType.BANG, expression);
103 JUnitTestCase.assertFalse(expression.inSetterContext());
104 }
105 void test_inSetterContext_prefix_minusMinus() {
106 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
107 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression);
108 JUnitTestCase.assertTrue(expression.inSetterContext());
109 }
110 void test_inSetterContext_prefix_plusPlus() {
111 IndexExpression expression = ASTFactory.indexExpression(ASTFactory.identifie r2("a"), ASTFactory.identifier2("b"));
112 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression);
113 JUnitTestCase.assertTrue(expression.inSetterContext());
114 }
115 static dartSuite() {
116 _ut.group('IndexExpressionTest', () {
117 _ut.test('test_inGetterContext_assignment_compound_left', () {
118 final __test = new IndexExpressionTest();
119 runJUnitTest(__test, __test.test_inGetterContext_assignment_compound_lef t);
120 });
121 _ut.test('test_inGetterContext_assignment_simple_left', () {
122 final __test = new IndexExpressionTest();
123 runJUnitTest(__test, __test.test_inGetterContext_assignment_simple_left) ;
124 });
125 _ut.test('test_inGetterContext_nonAssignment', () {
126 final __test = new IndexExpressionTest();
127 runJUnitTest(__test, __test.test_inGetterContext_nonAssignment);
128 });
129 _ut.test('test_inSetterContext_assignment_compound_left', () {
130 final __test = new IndexExpressionTest();
131 runJUnitTest(__test, __test.test_inSetterContext_assignment_compound_lef t);
132 });
133 _ut.test('test_inSetterContext_assignment_compound_right', () {
134 final __test = new IndexExpressionTest();
135 runJUnitTest(__test, __test.test_inSetterContext_assignment_compound_rig ht);
136 });
137 _ut.test('test_inSetterContext_assignment_simple_left', () {
138 final __test = new IndexExpressionTest();
139 runJUnitTest(__test, __test.test_inSetterContext_assignment_simple_left) ;
140 });
141 _ut.test('test_inSetterContext_assignment_simple_right', () {
142 final __test = new IndexExpressionTest();
143 runJUnitTest(__test, __test.test_inSetterContext_assignment_simple_right );
144 });
145 _ut.test('test_inSetterContext_nonAssignment', () {
146 final __test = new IndexExpressionTest();
147 runJUnitTest(__test, __test.test_inSetterContext_nonAssignment);
148 });
149 _ut.test('test_inSetterContext_postfix', () {
150 final __test = new IndexExpressionTest();
151 runJUnitTest(__test, __test.test_inSetterContext_postfix);
152 });
153 _ut.test('test_inSetterContext_prefix_bang', () {
154 final __test = new IndexExpressionTest();
155 runJUnitTest(__test, __test.test_inSetterContext_prefix_bang);
156 });
157 _ut.test('test_inSetterContext_prefix_minusMinus', () {
158 final __test = new IndexExpressionTest();
159 runJUnitTest(__test, __test.test_inSetterContext_prefix_minusMinus);
160 });
161 _ut.test('test_inSetterContext_prefix_plusPlus', () {
162 final __test = new IndexExpressionTest();
163 runJUnitTest(__test, __test.test_inSetterContext_prefix_plusPlus);
164 });
165 });
166 }
167 }
168 /**
169 * The class {@code ASTFactory} defines utility methods that can be used to crea te AST nodes. The
170 * nodes that are created are complete in the sense that all of the tokens that would have been
171 * associated with the nodes by a parser are also created, but the token stream is not constructed.
172 * None of the nodes are resolved.
173 * <p>
174 * The general pattern is for the name of the factory method to be the same as t he name of the class
175 * of AST node being created. There are two notable exceptions. The first is for methods creating
176 * nodes that are part of a cascade expression. These methods are all prefixed w ith 'cascaded'. The
177 * second is places where a shorter name seemed unambiguous and easier to read, such as using
178 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte gerLiteral'.
179 */
180 class ASTFactory {
181 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj acentStrings.full(list(strings));
182 static Annotation annotation(Identifier name) => new Annotation.full(TokenFact ory.token3(TokenType.AT), name, null, null, null);
183 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam e, ArgumentList arguments) => new Annotation.full(TokenFactory.token3(TokenType. AT), name, TokenFactory.token3(TokenType.PERIOD), constructorName, arguments);
184 static ArgumentDefinitionTest argumentDefinitionTest(String identifier) => new ArgumentDefinitionTest.full(TokenFactory.token3(TokenType.QUESTION), identifier 2(identifier));
185 static ArgumentList argumentList(List<Expression> arguments) => new ArgumentLi st.full(TokenFactory.token3(TokenType.OPEN_PAREN), list(arguments), TokenFactory .token3(TokenType.CLOSE_PAREN));
186 static AsExpression asExpression(Expression expression, TypeName type) => new AsExpression.full(expression, TokenFactory.token(Keyword.AS), type);
187 static AssertStatement assertStatement(Expression condition) => new AssertStat ement.full(TokenFactory.token(Keyword.ASSERT), TokenFactory.token3(TokenType.OPE N_PAREN), condition, TokenFactory.token3(TokenType.CLOSE_PAREN), TokenFactory.to ken3(TokenType.SEMICOLON));
188 static AssignmentExpression assignmentExpression(Expression leftHandSide, Toke nType operator, Expression rightHandSide) => new AssignmentExpression.full(leftH andSide, TokenFactory.token3(operator), rightHandSide);
189 static BinaryExpression binaryExpression(Expression leftOperand, TokenType ope rator, Expression rightOperand) => new BinaryExpression.full(leftOperand, TokenF actory.token3(operator), rightOperand);
190 static Block block(List<Statement> statements) => new Block.full(TokenFactory. token3(TokenType.OPEN_CURLY_BRACKET), list(statements), TokenFactory.token3(Toke nType.CLOSE_CURLY_BRACKET));
191 static BlockFunctionBody blockFunctionBody(List<Statement> statements) => new BlockFunctionBody.full(block(statements));
192 static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral.full(va lue ? TokenFactory.token(Keyword.TRUE) : TokenFactory.token(Keyword.FALSE), valu e);
193 static BreakStatement breakStatement() => new BreakStatement.full(TokenFactory .token(Keyword.BREAK), null, TokenFactory.token3(TokenType.SEMICOLON));
194 static BreakStatement breakStatement2(String label) => new BreakStatement.full (TokenFactory.token(Keyword.BREAK), identifier2(label), TokenFactory.token3(Toke nType.SEMICOLON));
195 static IndexExpression cascadedIndexExpression(Expression index) => new IndexE xpression.forCascade_full(TokenFactory.token3(TokenType.PERIOD_PERIOD), TokenFac tory.token3(TokenType.OPEN_SQUARE_BRACKET), index, TokenFactory.token3(TokenType .CLOSE_SQUARE_BRACKET));
196 static MethodInvocation cascadedMethodInvocation(String methodName, List<Expre ssion> arguments) => new MethodInvocation.full(null, TokenFactory.token3(TokenTy pe.PERIOD_PERIOD), identifier2(methodName), argumentList(arguments));
197 static PropertyAccess cascadedPropertyAccess(String propertyName) => new Prope rtyAccess.full(null, TokenFactory.token3(TokenType.PERIOD_PERIOD), identifier2(p ropertyName));
198 static CascadeExpression cascadeExpression(Expression target, List<Expression> cascadeSections) => new CascadeExpression.full(target, list(cascadeSections));
199 static CatchClause catchClause(String exceptionParameter, List<Statement> stat ements) => catchClause5(null, exceptionParameter, null, statements);
200 static CatchClause catchClause2(String exceptionParameter, String stackTracePa rameter, List<Statement> statements) => catchClause5(null, exceptionParameter, s tackTraceParameter, statements);
201 static CatchClause catchClause3(TypeName exceptionType, List<Statement> statem ents) => catchClause5(exceptionType, null, null, statements);
202 static CatchClause catchClause4(TypeName exceptionType, String exceptionParame ter, List<Statement> statements) => catchClause5(exceptionType, exceptionParamet er, null, statements);
203 static CatchClause catchClause5(TypeName exceptionType, String exceptionParame ter, String stackTraceParameter, List<Statement> statements) => new CatchClause. full(exceptionType == null ? null : TokenFactory.token4(TokenType.IDENTIFIER, "o n"), exceptionType, exceptionParameter == null ? null : TokenFactory.token(Keywo rd.CATCH), exceptionParameter == null ? null : TokenFactory.token3(TokenType.OPE N_PAREN), identifier2(exceptionParameter), stackTraceParameter == null ? null : TokenFactory.token3(TokenType.COMMA), stackTraceParameter == null ? null : ident ifier2(stackTraceParameter), exceptionParameter == null ? null : TokenFactory.to ken3(TokenType.CLOSE_PAREN), block(statements));
204 static ClassDeclaration classDeclaration(Keyword abstractKeyword, String name, TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withC lause, ImplementsClause implementsClause, List<ClassMember> members) => new Clas sDeclaration.full(null, null, abstractKeyword == null ? null : TokenFactory.toke n(abstractKeyword), TokenFactory.token(Keyword.CLASS), identifier2(name), typePa rameters, extendsClause, withClause, implementsClause, TokenFactory.token3(Token Type.OPEN_CURLY_BRACKET), list(members), TokenFactory.token3(TokenType.CLOSE_CUR LY_BRACKET));
205 static ClassTypeAlias classTypeAlias(String name, TypeParameterList typeParame ters, Keyword abstractKeyword, TypeName superclass, WithClause withClause, Imple mentsClause implementsClause) => new ClassTypeAlias.full(null, null, TokenFactor y.token(Keyword.TYPEDEF), identifier2(name), typeParameters, TokenFactory.token3 (TokenType.EQ), abstractKeyword == null ? null : TokenFactory.token(abstractKeyw ord), superclass, withClause, implementsClause, TokenFactory.token3(TokenType.SE MICOLON));
206 static CompilationUnit compilationUnit() => compilationUnit8(null, null, null) ;
207 static CompilationUnit compilationUnit2(List<CompilationUnitMember> declaratio ns) => compilationUnit8(null, null, list(declarations));
208 static CompilationUnit compilationUnit3(List<Directive> directives) => compila tionUnit8(null, list(directives), null);
209 static CompilationUnit compilationUnit4(List<Directive> directives, List<Compi lationUnitMember> declarations) => compilationUnit8(null, directives, declaratio ns);
210 static CompilationUnit compilationUnit5(String scriptTag) => compilationUnit8( scriptTag, null, null);
211 static CompilationUnit compilationUnit6(String scriptTag, List<CompilationUnit Member> declarations) => compilationUnit8(scriptTag, null, list(declarations));
212 static CompilationUnit compilationUnit7(String scriptTag, List<Directive> dire ctives) => compilationUnit8(scriptTag, list(directives), null);
213 static CompilationUnit compilationUnit8(String scriptTag4, List<Directive> dir ectives, List<CompilationUnitMember> declarations) => new CompilationUnit.full(T okenFactory.token3(TokenType.EOF), scriptTag4 == null ? null : scriptTag(scriptT ag4), directives == null ? new List<Directive>() : directives, declarations == n ull ? new List<CompilationUnitMember>() : declarations, TokenFactory.token3(Toke nType.EOF));
214 static ConditionalExpression conditionalExpression(Expression condition, Expre ssion thenExpression, Expression elseExpression) => new ConditionalExpression.fu ll(condition, TokenFactory.token3(TokenType.QUESTION), thenExpression, TokenFact ory.token3(TokenType.COLON), elseExpression);
215 static ConstructorDeclaration constructorDeclaration(Identifier returnType, St ring name, FormalParameterList parameters, List<ConstructorInitializer> initiali zers) => new ConstructorDeclaration.full(null, null, TokenFactory.token(Keyword. EXTERNAL), null, null, returnType, name == null ? null : TokenFactory.token3(Tok enType.PERIOD), name == null ? null : identifier2(name), parameters, initializer s == null || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD) , initializers == null ? new List<ConstructorInitializer>() : initializers, null , emptyFunctionBody());
216 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, Ke yword factoryKeyword, Identifier returnType, String name, FormalParameterList pa rameters, List<ConstructorInitializer> initializers, FunctionBody body) => new C onstructorDeclaration.full(null, null, null, constKeyword == null ? null : Token Factory.token(constKeyword), factoryKeyword == null ? null : TokenFactory.token( factoryKeyword), returnType, name == null ? null : TokenFactory.token3(TokenType .PERIOD), name == null ? null : identifier2(name), parameters, initializers == n ull || initializers.isEmpty ? null : TokenFactory.token3(TokenType.PERIOD), init ializers == null ? new List<ConstructorInitializer>() : initializers, null, body );
217 static ConstructorFieldInitializer constructorFieldInitializer(bool prefixedWi thThis, String fieldName, Expression expression) => new ConstructorFieldInitiali zer.full(prefixedWithThis ? TokenFactory.token(Keyword.THIS) : null, prefixedWit hThis ? TokenFactory.token3(TokenType.PERIOD) : null, identifier2(fieldName), To kenFactory.token3(TokenType.EQ), expression);
218 static ConstructorName constructorName(TypeName type, String name) => new Cons tructorName.full(type, name == null ? null : TokenFactory.token3(TokenType.PERIO D), name == null ? null : identifier2(name));
219 static ContinueStatement continueStatement() => new ContinueStatement.full(Tok enFactory.token(Keyword.CONTINUE), null, TokenFactory.token3(TokenType.SEMICOLON ));
220 static ContinueStatement continueStatement2(String label) => new ContinueState ment.full(TokenFactory.token(Keyword.CONTINUE), identifier2(label), TokenFactory .token3(TokenType.SEMICOLON));
221 static DeclaredIdentifier declaredIdentifier(Keyword keyword, String identifie r) => declaredIdentifier2(keyword, null, identifier);
222 static DeclaredIdentifier declaredIdentifier2(Keyword keyword, TypeName type, String identifier) => new DeclaredIdentifier.full(null, null, keyword == null ? null : TokenFactory.token(keyword), type, identifier2(identifier));
223 static DeclaredIdentifier declaredIdentifier3(String identifier) => declaredId entifier2(null, null, identifier);
224 static DeclaredIdentifier declaredIdentifier4(TypeName type, String identifier ) => declaredIdentifier2(null, type, identifier);
225 static DoStatement doStatement(Statement body, Expression condition) => new Do Statement.full(TokenFactory.token(Keyword.DO), body, TokenFactory.token(Keyword. WHILE), TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token 3(TokenType.CLOSE_PAREN), TokenFactory.token3(TokenType.SEMICOLON));
226 static DoubleLiteral doubleLiteral(double value) => new DoubleLiteral.full(Tok enFactory.token2(value.toString()), value);
227 static EmptyFunctionBody emptyFunctionBody() => new EmptyFunctionBody.full(Tok enFactory.token3(TokenType.SEMICOLON));
228 static EmptyStatement emptyStatement() => new EmptyStatement.full(TokenFactory .token3(TokenType.SEMICOLON));
229 static ExportDirective exportDirective(List<Annotation> metadata, String uri, List<Combinator> combinators) => new ExportDirective.full(null, metadata, TokenF actory.token(Keyword.EXPORT), string2(uri), list(combinators), TokenFactory.toke n3(TokenType.SEMICOLON));
230 static ExportDirective exportDirective2(String uri, List<Combinator> combinato rs) => exportDirective(new List<Annotation>(), uri, combinators);
231 static ExpressionFunctionBody expressionFunctionBody(Expression expression) => new ExpressionFunctionBody.full(TokenFactory.token3(TokenType.FUNCTION), expres sion, TokenFactory.token3(TokenType.SEMICOLON));
232 static ExpressionStatement expressionStatement(Expression expression) => new E xpressionStatement.full(expression, TokenFactory.token3(TokenType.SEMICOLON));
233 static ExtendsClause extendsClause(TypeName type) => new ExtendsClause.full(To kenFactory.token(Keyword.EXTENDS), type);
234 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, TypeN ame type, List<VariableDeclaration> variables) => new FieldDeclaration.full(null , null, isStatic ? TokenFactory.token(Keyword.STATIC) : null, variableDeclaratio nList(keyword, type, variables), TokenFactory.token3(TokenType.SEMICOLON));
235 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, List <VariableDeclaration> variables) => fieldDeclaration(isStatic, keyword, null, va riables);
236 static FieldFormalParameter fieldFormalParameter(Keyword keyword, TypeName typ e, String identifier) => new FieldFormalParameter.full(null, null, keyword == nu ll ? null : TokenFactory.token(keyword), type, TokenFactory.token(Keyword.THIS), TokenFactory.token3(TokenType.PERIOD), identifier2(identifier));
237 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, Expr ession iterator, Statement body) => new ForEachStatement.full(TokenFactory.token (Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), loopVariable, TokenFac tory.token(Keyword.IN), iterator, TokenFactory.token3(TokenType.CLOSE_PAREN), bo dy);
238 static FormalParameterList formalParameterList(List<FormalParameter> parameter s) => new FormalParameterList.full(TokenFactory.token3(TokenType.OPEN_PAREN), li st(parameters), null, null, TokenFactory.token3(TokenType.CLOSE_PAREN));
239 static ForStatement forStatement(Expression initialization, Expression conditi on, List<Expression> updaters, Statement body) => new ForStatement.full(TokenFac tory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), null, initia lization, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFactory.toke n3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE_PAREN), b ody);
240 static ForStatement forStatement2(VariableDeclarationList variableList, Expres sion condition, List<Expression> updaters, Statement body) => new ForStatement.f ull(TokenFactory.token(Keyword.FOR), TokenFactory.token3(TokenType.OPEN_PAREN), variableList, null, TokenFactory.token3(TokenType.SEMICOLON), condition, TokenFa ctory.token3(TokenType.SEMICOLON), updaters, TokenFactory.token3(TokenType.CLOSE _PAREN), body);
241 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword, String name, FunctionExpression functionExpression) => new FunctionDeclaration. full(null, null, null, type, keyword == null ? null : TokenFactory.token(keyword ), identifier2(name), functionExpression);
242 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type , Keyword keyword, String name, FunctionExpression functionExpression) => new Fu nctionDeclarationStatement.full(functionDeclaration(type, keyword, name, functio nExpression));
243 static FunctionExpression functionExpression() => new FunctionExpression.full( formalParameterList([]), blockFunctionBody([]));
244 static FunctionExpression functionExpression2(FormalParameterList parameters, FunctionBody body) => new FunctionExpression.full(parameters, body);
245 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu nction, List<Expression> arguments) => new FunctionExpressionInvocation.full(fun ction, argumentList(arguments));
246 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu rnType, String identifier, List<FormalParameter> parameters) => new FunctionType dFormalParameter.full(null, null, returnType, identifier2(identifier), formalPar ameterList(parameters));
247 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne w HideCombinator.full(TokenFactory.token2("hide"), list(identifiers));
248 static HideCombinator hideCombinator2(List<String> identifiers) {
249 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>();
250 for (String identifier in identifiers) {
251 identifierList.add(identifier2(identifier));
252 }
253 return new HideCombinator.full(TokenFactory.token2("hide"), identifierList);
254 }
255 static PrefixedIdentifier identifier(SimpleIdentifier prefix, SimpleIdentifier identifier10) => new PrefixedIdentifier.full(prefix, TokenFactory.token3(TokenT ype.PERIOD), identifier10);
256 static SimpleIdentifier identifier2(String lexeme) => new SimpleIdentifier.ful l(TokenFactory.token4(TokenType.IDENTIFIER, lexeme));
257 static PrefixedIdentifier identifier3(String prefix, SimpleIdentifier identifi er) => new PrefixedIdentifier.full(identifier2(prefix), TokenFactory.token3(Toke nType.PERIOD), identifier);
258 static PrefixedIdentifier identifier4(String prefix, String identifier) => new PrefixedIdentifier.full(identifier2(prefix), TokenFactory.token3(TokenType.PERI OD), identifier2(identifier));
259 static IfStatement ifStatement(Expression condition, Statement thenStatement) => ifStatement2(condition, thenStatement, null);
260 static IfStatement ifStatement2(Expression condition, Statement thenStatement, Statement elseStatement) => new IfStatement.full(TokenFactory.token(Keyword.IF) , TokenFactory.token3(TokenType.OPEN_PAREN), condition, TokenFactory.token3(Toke nType.CLOSE_PAREN), thenStatement, elseStatement == null ? null : TokenFactory.t oken(Keyword.ELSE), elseStatement);
261 static ImplementsClause implementsClause(List<TypeName> types) => new Implemen tsClause.full(TokenFactory.token(Keyword.IMPLEMENTS), list(types));
262 static ImportDirective importDirective(List<Annotation> metadata, String uri, String prefix, List<Combinator> combinators) => new ImportDirective.full(null, m etadata, TokenFactory.token(Keyword.IMPORT), string2(uri), prefix == null ? null : TokenFactory.token(Keyword.AS), prefix == null ? null : identifier2(prefix), list(combinators), TokenFactory.token3(TokenType.SEMICOLON));
263 static ImportDirective importDirective2(String uri, String prefix, List<Combin ator> combinators) => importDirective(new List<Annotation>(), uri, prefix, combi nators);
264 static IndexExpression indexExpression(Expression array, Expression index) => new IndexExpression.forTarget_full(array, TokenFactory.token3(TokenType.OPEN_SQU ARE_BRACKET), index, TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET));
265 static InstanceCreationExpression instanceCreationExpression(Keyword keyword, ConstructorName name, List<Expression> arguments) => new InstanceCreationExpress ion.full(keyword == null ? null : TokenFactory.token(keyword), name, argumentLis t(arguments));
266 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword, TypeName type, List<Expression> arguments) => instanceCreationExpression3(keywo rd, type, null, arguments);
267 static InstanceCreationExpression instanceCreationExpression3(Keyword keyword, TypeName type, String identifier, List<Expression> arguments) => instanceCreati onExpression(keyword, new ConstructorName.full(type, identifier == null ? null : TokenFactory.token3(TokenType.PERIOD), identifier == null ? null : identifier2( identifier)), arguments);
268 static IntegerLiteral integer(int value) => new IntegerLiteral.full(TokenFacto ry.token4(TokenType.INT, value.toString()), value);
269 static InterpolationExpression interpolationExpression(Expression expression) => new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPO LATION_EXPRESSION), expression, TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKE T));
270 static InterpolationExpression interpolationExpression2(String identifier) => new InterpolationExpression.full(TokenFactory.token3(TokenType.STRING_INTERPOLAT ION_IDENTIFIER), identifier2(identifier), null);
271 static InterpolationString interpolationString(String contents, String value) => new InterpolationString.full(TokenFactory.token2(contents), value);
272 static IsExpression isExpression(Expression expression, bool negated, TypeName type) => new IsExpression.full(expression, TokenFactory.token(Keyword.IS), nega ted ? TokenFactory.token3(TokenType.BANG) : null, type);
273 static Label label(String label5) => new Label.full(identifier2(label5), Token Factory.token3(TokenType.COLON));
274 static LabeledStatement labeledStatement(List<Label> labels, Statement stateme nt) => new LabeledStatement.full(labels, statement);
275 static LibraryDirective libraryDirective(List<Annotation> metadata, LibraryIde ntifier libraryName) => new LibraryDirective.full(null, metadata, TokenFactory.t oken(Keyword.LIBRARY), libraryName, TokenFactory.token3(TokenType.SEMICOLON));
276 static LibraryDirective libraryDirective2(String libraryName) => libraryDirect ive(new List<Annotation>(), libraryIdentifier2([libraryName]));
277 static LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components) => new LibraryIdentifier.full(list(components));
278 static LibraryIdentifier libraryIdentifier2(List<String> components) {
279 List<SimpleIdentifier> componentList = new List<SimpleIdentifier>();
280 for (String component in components) {
281 componentList.add(identifier2(component));
282 }
283 return new LibraryIdentifier.full(componentList);
284 }
285 static List<Object> list(List<Object> elements) {
286 List<Object> elementList = new List();
287 for (Object element in elements) {
288 elementList.add(element);
289 }
290 return elementList;
291 }
292 static ListLiteral listLiteral(List<Expression> elements) => listLiteral2(null , null, elements);
293 static ListLiteral listLiteral2(Keyword keyword, TypeArgumentList typeArgument s, List<Expression> elements) => new ListLiteral.full(keyword == null ? null : T okenFactory.token(keyword), null, TokenFactory.token3(TokenType.OPEN_SQUARE_BRAC KET), list(elements), TokenFactory.token3(TokenType.CLOSE_SQUARE_BRACKET));
294 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments, List<MapLiteralEntry> entries) => new MapLiteral.full(keyword == null ? null : T okenFactory.token(keyword), typeArguments, TokenFactory.token3(TokenType.OPEN_CU RLY_BRACKET), list(entries), TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET)) ;
295 static MapLiteral mapLiteral2(List<MapLiteralEntry> entries) => mapLiteral(nul l, null, entries);
296 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => new Ma pLiteralEntry.full(string2(key), TokenFactory.token3(TokenType.COLON), value);
297 static MethodDeclaration methodDeclaration(Keyword modifier, TypeName returnTy pe, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterLi st parameters) => new MethodDeclaration.full(null, null, TokenFactory.token(Keyw ord.EXTERNAL), modifier == null ? null : TokenFactory.token(modifier), returnTyp e, property == null ? null : TokenFactory.token(property), operator == null ? nu ll : TokenFactory.token(operator), name, parameters, emptyFunctionBody());
298 static MethodDeclaration methodDeclaration2(Keyword modifier, TypeName returnT ype, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterL ist parameters, FunctionBody body) => new MethodDeclaration.full(null, null, nul l, modifier == null ? null : TokenFactory.token(modifier), returnType, property == null ? null : TokenFactory.token(property), operator == null ? null : TokenFa ctory.token(operator), name, parameters, body);
299 static MethodInvocation methodInvocation(Expression target, String methodName, List<Expression> arguments) => new MethodInvocation.full(target, target == null ? null : TokenFactory.token3(TokenType.PERIOD), identifier2(methodName), argume ntList(arguments));
300 static MethodInvocation methodInvocation2(String methodName, List<Expression> arguments) => methodInvocation(null, methodName, arguments);
301 static NamedExpression namedExpression(String label6, Expression expression) = > new NamedExpression.full(label(label6), expression);
302 static DefaultFormalParameter namedFormalParameter(NormalFormalParameter param eter, Expression expression) => new DefaultFormalParameter.full(parameter, Param eterKind.NAMED, expression == null ? null : TokenFactory.token3(TokenType.COLON) , expression);
303 static NullLiteral nullLiteral() => new NullLiteral.full(TokenFactory.token(Ke yword.NULL));
304 static ParenthesizedExpression parenthesizedExpression(Expression expression) => new ParenthesizedExpression.full(TokenFactory.token3(TokenType.OPEN_PAREN), e xpression, TokenFactory.token3(TokenType.CLOSE_PAREN));
305 static PartDirective partDirective(List<Annotation> metadata, String url) => n ew PartDirective.full(null, metadata, TokenFactory.token(Keyword.PART), string2( url), TokenFactory.token3(TokenType.SEMICOLON));
306 static PartDirective partDirective2(String url) => partDirective(new List<Anno tation>(), url);
307 static PartOfDirective partOfDirective(LibraryIdentifier libraryName) => partO fDirective2(new List<Annotation>(), libraryName);
308 static PartOfDirective partOfDirective2(List<Annotation> metadata, LibraryIden tifier libraryName) => new PartOfDirective.full(null, metadata, TokenFactory.tok en(Keyword.PART), TokenFactory.token2("of"), libraryName, TokenFactory.token3(To kenType.SEMICOLON));
309 static DefaultFormalParameter positionalFormalParameter(NormalFormalParameter parameter, Expression expression) => new DefaultFormalParameter.full(parameter, ParameterKind.POSITIONAL, expression == null ? null : TokenFactory.token3(TokenT ype.EQ), expression);
310 static PostfixExpression postfixExpression(Expression expression, TokenType op erator) => new PostfixExpression.full(expression, TokenFactory.token3(operator)) ;
311 static PrefixExpression prefixExpression(TokenType operator, Expression expres sion) => new PrefixExpression.full(TokenFactory.token3(operator), expression);
312 static PropertyAccess propertyAccess(Expression target, SimpleIdentifier prope rtyName) => new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD ), propertyName);
313 static PropertyAccess propertyAccess2(Expression target, String propertyName) => new PropertyAccess.full(target, TokenFactory.token3(TokenType.PERIOD), identi fier2(propertyName));
314 static RedirectingConstructorInvocation redirectingConstructorInvocation(List< Expression> arguments) => redirectingConstructorInvocation2(null, arguments);
315 static RedirectingConstructorInvocation redirectingConstructorInvocation2(Stri ng constructorName, List<Expression> arguments) => new RedirectingConstructorInv ocation.full(TokenFactory.token(Keyword.THIS), constructorName == null ? null : TokenFactory.token3(TokenType.PERIOD), constructorName == null ? null : identifi er2(constructorName), argumentList(arguments));
316 static ReturnStatement returnStatement() => returnStatement2(null);
317 static ReturnStatement returnStatement2(Expression expression) => new ReturnSt atement.full(TokenFactory.token(Keyword.RETURN), expression, TokenFactory.token3 (TokenType.SEMICOLON));
318 static ScriptTag scriptTag(String scriptTag5) => new ScriptTag.full(TokenFacto ry.token2(scriptTag5));
319 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => ne w ShowCombinator.full(TokenFactory.token2("show"), list(identifiers));
320 static ShowCombinator showCombinator2(List<String> identifiers) {
321 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>();
322 for (String identifier in identifiers) {
323 identifierList.add(identifier2(identifier));
324 }
325 return new ShowCombinator.full(TokenFactory.token2("show"), identifierList);
326 }
327 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, String par ameterName) => simpleFormalParameter2(keyword, null, parameterName);
328 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, TypeName type, String parameterName) => new SimpleFormalParameter.full(null, null, keywor d == null ? null : TokenFactory.token(keyword), type, identifier2(parameterName) );
329 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => s impleFormalParameter2(null, null, parameterName);
330 static SimpleFormalParameter simpleFormalParameter4(TypeName type, String para meterName) => simpleFormalParameter2(null, type, parameterName);
331 static StringInterpolation string(List<InterpolationElement> elements) => new StringInterpolation.full(list(elements));
332 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral. full(TokenFactory.token2("'${content}'"), content);
333 static SuperConstructorInvocation superConstructorInvocation(List<Expression> arguments) => superConstructorInvocation2(null, arguments);
334 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 : identifier2(name), argumentList(arguments));
335 static SuperExpression superExpression() => new SuperExpression.full(TokenFact ory.token(Keyword.SUPER));
336 static SwitchCase switchCase(Expression expression, List<Statement> statements ) => switchCase2(new List<Label>(), expression, statements);
337 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));
338 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));
339 static SwitchDefault switchDefault2(List<Statement> statements) => switchDefau lt(new List<Label>(), statements);
340 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));
341 static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory .token(Keyword.THIS));
342 static ThrowExpression throwExpression() => throwExpression2(null);
343 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp ression.full(TokenFactory.token(Keyword.THROW), expression);
344 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));
345 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration.full( null, null, variableDeclarationList(keyword, null, variables), TokenFactory.toke n3(TokenType.SEMICOLON));
346 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem ent3(body, new List<CatchClause>(), finallyClause);
347 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses) => tryStatement3(body, list(catchClauses), null);
348 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);
349 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia s.full(null, null, TokenFactory.token(Keyword.TYPEDEF), returnType, identifier2( name), typeParameters, parameters, TokenFactory.token3(TokenType.SEMICOLON));
350 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type ArgumentList.full(TokenFactory.token3(TokenType.LT), list(typeNames), TokenFacto ry.token3(TokenType.GT));
351 /**
352 * Create a type name whose name has been resolved to the given element and wh ose type has been
353 * resolved to the type of the given element.
354 * <p>
355 * <b>Note:</b> This method does not correctly handle class elements that have type parameters.
356 * @param element the element defining the type represented by the type name
357 * @return the type name that was created
358 */
359 static TypeName typeName(ClassElement element52, List<TypeName> arguments) {
360 SimpleIdentifier name21 = identifier2(element52.name);
361 name21.element = element52;
362 TypeName typeName = typeName2(name21, arguments);
363 typeName.type = element52.type;
364 return typeName;
365 }
366 static TypeName typeName2(Identifier name, List<TypeName> arguments) {
367 if (arguments.length == 0) {
368 return new TypeName.full(name, null);
369 }
370 return new TypeName.full(name, typeArgumentList(arguments));
371 }
372 static TypeName typeName3(String name, List<TypeName> arguments) {
373 if (arguments.length == 0) {
374 return new TypeName.full(identifier2(name), null);
375 }
376 return new TypeName.full(identifier2(name), typeArgumentList(arguments));
377 }
378 static TypeParameter typeParameter(String name) => new TypeParameter.full(null , null, identifier2(name), null, null);
379 static TypeParameter typeParameter2(String name, TypeName bound) => new TypePa rameter.full(null, null, identifier2(name), TokenFactory.token(Keyword.EXTENDS), bound);
380 static TypeParameterList typeParameterList(List<String> typeNames) {
381 List<TypeParameter> typeParameters = new List<TypeParameter>();
382 for (String typeName in typeNames) {
383 typeParameters.add(typeParameter(typeName));
384 }
385 return new TypeParameterList.full(TokenFactory.token3(TokenType.LT), typePar ameters, TokenFactory.token3(TokenType.GT));
386 }
387 static VariableDeclaration variableDeclaration(String name) => new VariableDec laration.full(null, null, identifier2(name), null, null);
388 static VariableDeclaration variableDeclaration2(String name, Expression initia lizer) => new VariableDeclaration.full(null, null, identifier2(name), TokenFacto ry.token3(TokenType.EQ), initializer);
389 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa me type, List<VariableDeclaration> variables) => new VariableDeclarationList.ful l(keyword == null ? null : TokenFactory.token(keyword), type, list(variables));
390 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List< VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab les);
391 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati onStatement.full(variableDeclarationList(keyword, type, variables), TokenFactory .token3(TokenType.SEMICOLON));
392 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor d, null, variables);
393 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);
394 static WithClause withClause(List<TypeName> types) => new WithClause.full(Toke nFactory.token(Keyword.WITH), list(types));
395 /**
396 * Prevent the creation of instances of this class.
397 */
398 ASTFactory() {
399 }
400 }
401 class SimpleIdentifierTest extends ParserTestCase {
402 void test_inDeclarationContext_argumentDefinition() {
403 SimpleIdentifier identifier15 = ASTFactory.argumentDefinitionTest("p").ident ifier;
404 JUnitTestCase.assertFalse(identifier15.inDeclarationContext());
405 }
406 void test_inDeclarationContext_catch_exception() {
407 SimpleIdentifier identifier = ASTFactory.catchClause("e", []).exceptionParam eter;
408 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
409 }
410 void test_inDeclarationContext_catch_stack() {
411 SimpleIdentifier identifier = ASTFactory.catchClause2("e", "s", []).stackTra ceParameter;
412 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
413 }
414 void test_inDeclarationContext_classDeclaration() {
415 SimpleIdentifier identifier = ASTFactory.classDeclaration(null, "C", null, n ull, null, null, []).name;
416 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
417 }
418 void test_inDeclarationContext_classTypeAlias() {
419 SimpleIdentifier identifier = ASTFactory.classTypeAlias("C", null, null, nul l, null, null).name;
420 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
421 }
422 void test_inDeclarationContext_constructorDeclaration() {
423 SimpleIdentifier identifier = ASTFactory.constructorDeclaration(ASTFactory.i dentifier2("C"), "c", null, null).name;
424 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
425 }
426 void test_inDeclarationContext_functionDeclaration() {
427 SimpleIdentifier identifier = ASTFactory.functionDeclaration(null, null, "f" , null).name;
428 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
429 }
430 void test_inDeclarationContext_functionTypeAlias() {
431 SimpleIdentifier identifier = ASTFactory.typeAlias(null, "F", null, null).na me;
432 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
433 }
434 void test_inDeclarationContext_label_false() {
435 SimpleIdentifier identifier = ASTFactory.namedExpression("l", ASTFactory.int eger(0)).name.label;
436 JUnitTestCase.assertFalse(identifier.inDeclarationContext());
437 }
438 void test_inDeclarationContext_label_true() {
439 Label label2 = ASTFactory.label("l");
440 SimpleIdentifier identifier = label2.label;
441 ASTFactory.labeledStatement(ASTFactory.list([label2]), ASTFactory.emptyState ment());
442 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
443 }
444 void test_inDeclarationContext_methodDeclaration() {
445 SimpleIdentifier identifier = ASTFactory.identifier2("m");
446 ASTFactory.methodDeclaration2(null, null, null, null, identifier, null, null );
447 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
448 }
449 void test_inDeclarationContext_normalFormalParameter() {
450 SimpleIdentifier identifier16 = ASTFactory.simpleFormalParameter3("p").ident ifier;
451 JUnitTestCase.assertTrue(identifier16.inDeclarationContext());
452 }
453 void test_inDeclarationContext_typeParameter_bound() {
454 TypeName bound = ASTFactory.typeName3("A", []);
455 SimpleIdentifier identifier = bound.name as SimpleIdentifier;
456 ASTFactory.typeParameter2("E", bound);
457 JUnitTestCase.assertFalse(identifier.inDeclarationContext());
458 }
459 void test_inDeclarationContext_typeParameter_name() {
460 SimpleIdentifier identifier = ASTFactory.typeParameter("E").name;
461 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
462 }
463 void test_inDeclarationContext_variableDeclaration() {
464 SimpleIdentifier identifier = ASTFactory.variableDeclaration("v").name;
465 JUnitTestCase.assertTrue(identifier.inDeclarationContext());
466 }
467 void test_inGetterContext() {
468 for (WrapperKind wrapper in WrapperKind.values) {
469 for (AssignmentKind assignment in AssignmentKind.values) {
470 SimpleIdentifier identifier = createIdentifier(wrapper, assignment);
471 if (identical(assignment, AssignmentKind.SIMPLE_LEFT) && wrapper != Wrap perKind.PREFIXED_LEFT && wrapper != WrapperKind.PROPERTY_LEFT) {
472 if (identifier.inGetterContext()) {
473 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t o be false");
474 }
475 } else {
476 if (!identifier.inGetterContext()) {
477 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t o be true");
478 }
479 }
480 }
481 }
482 }
483 void test_inSetterContext() {
484 for (WrapperKind wrapper in WrapperKind.values) {
485 for (AssignmentKind assignment in AssignmentKind.values) {
486 SimpleIdentifier identifier = createIdentifier(wrapper, assignment);
487 if (identical(wrapper, WrapperKind.PREFIXED_LEFT) || identical(wrapper, WrapperKind.PROPERTY_LEFT) || identical(assignment, AssignmentKind.BINARY) || id entical(assignment, AssignmentKind.COMPOUND_RIGHT) || identical(assignment, Assi gnmentKind.PREFIX_NOT) || identical(assignment, AssignmentKind.SIMPLE_RIGHT) || identical(assignment, AssignmentKind.NONE)) {
488 if (identifier.inSetterContext()) {
489 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t o be false");
490 }
491 } else {
492 if (!identifier.inSetterContext()) {
493 JUnitTestCase.fail("Expected ${topMostNode(identifier).toSource()} t o be true");
494 }
495 }
496 }
497 }
498 }
499 SimpleIdentifier createIdentifier(WrapperKind wrapper, AssignmentKind assignme nt) {
500 SimpleIdentifier identifier = ASTFactory.identifier2("a");
501 Expression expression = identifier;
502 while (true) {
503 if (wrapper == WrapperKind.PREFIXED_LEFT) {
504 expression = ASTFactory.identifier(identifier, ASTFactory.identifier2("_ "));
505 } else if (wrapper == WrapperKind.PREFIXED_RIGHT) {
506 expression = ASTFactory.identifier(ASTFactory.identifier2("_"), identifi er);
507 } else if (wrapper == WrapperKind.PROPERTY_LEFT) {
508 expression = ASTFactory.propertyAccess2(expression, "_");
509 } else if (wrapper == WrapperKind.PROPERTY_RIGHT) {
510 expression = ASTFactory.propertyAccess(ASTFactory.identifier2("_"), iden tifier);
511 }
512 break;
513 }
514 while (true) {
515 if (assignment == AssignmentKind.BINARY) {
516 ASTFactory.binaryExpression(expression, TokenType.PLUS, ASTFactory.ident ifier2("_"));
517 } else if (assignment == AssignmentKind.COMPOUND_LEFT) {
518 ASTFactory.assignmentExpression(expression, TokenType.PLUS_EQ, ASTFactor y.identifier2("_"));
519 } else if (assignment == AssignmentKind.COMPOUND_RIGHT) {
520 ASTFactory.assignmentExpression(ASTFactory.identifier2("_"), TokenType.P LUS_EQ, expression);
521 } else if (assignment == AssignmentKind.POSTFIX_INC) {
522 ASTFactory.postfixExpression(expression, TokenType.PLUS_PLUS);
523 } else if (assignment == AssignmentKind.PREFIX_DEC) {
524 ASTFactory.prefixExpression(TokenType.MINUS_MINUS, expression);
525 } else if (assignment == AssignmentKind.PREFIX_INC) {
526 ASTFactory.prefixExpression(TokenType.PLUS_PLUS, expression);
527 } else if (assignment == AssignmentKind.PREFIX_NOT) {
528 ASTFactory.prefixExpression(TokenType.BANG, expression);
529 } else if (assignment == AssignmentKind.SIMPLE_LEFT) {
530 ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.ide ntifier2("_"));
531 } else if (assignment == AssignmentKind.SIMPLE_RIGHT) {
532 ASTFactory.assignmentExpression(ASTFactory.identifier2("_"), TokenType.E Q, expression);
533 }
534 break;
535 }
536 return identifier;
537 }
538 /**
539 * Return the top-most node in the AST structure containing the given identifi er.
540 * @param identifier the identifier in the AST structure being traversed
541 * @return the root of the AST structure containing the identifier
542 */
543 ASTNode topMostNode(SimpleIdentifier identifier) {
544 ASTNode child = identifier;
545 ASTNode parent18 = identifier.parent;
546 while (parent18 != null) {
547 child = parent18;
548 parent18 = parent18.parent;
549 }
550 return child;
551 }
552 static dartSuite() {
553 _ut.group('SimpleIdentifierTest', () {
554 _ut.test('test_inDeclarationContext_argumentDefinition', () {
555 final __test = new SimpleIdentifierTest();
556 runJUnitTest(__test, __test.test_inDeclarationContext_argumentDefinition );
557 });
558 _ut.test('test_inDeclarationContext_catch_exception', () {
559 final __test = new SimpleIdentifierTest();
560 runJUnitTest(__test, __test.test_inDeclarationContext_catch_exception);
561 });
562 _ut.test('test_inDeclarationContext_catch_stack', () {
563 final __test = new SimpleIdentifierTest();
564 runJUnitTest(__test, __test.test_inDeclarationContext_catch_stack);
565 });
566 _ut.test('test_inDeclarationContext_classDeclaration', () {
567 final __test = new SimpleIdentifierTest();
568 runJUnitTest(__test, __test.test_inDeclarationContext_classDeclaration);
569 });
570 _ut.test('test_inDeclarationContext_classTypeAlias', () {
571 final __test = new SimpleIdentifierTest();
572 runJUnitTest(__test, __test.test_inDeclarationContext_classTypeAlias);
573 });
574 _ut.test('test_inDeclarationContext_constructorDeclaration', () {
575 final __test = new SimpleIdentifierTest();
576 runJUnitTest(__test, __test.test_inDeclarationContext_constructorDeclara tion);
577 });
578 _ut.test('test_inDeclarationContext_functionDeclaration', () {
579 final __test = new SimpleIdentifierTest();
580 runJUnitTest(__test, __test.test_inDeclarationContext_functionDeclaratio n);
581 });
582 _ut.test('test_inDeclarationContext_functionTypeAlias', () {
583 final __test = new SimpleIdentifierTest();
584 runJUnitTest(__test, __test.test_inDeclarationContext_functionTypeAlias) ;
585 });
586 _ut.test('test_inDeclarationContext_label_false', () {
587 final __test = new SimpleIdentifierTest();
588 runJUnitTest(__test, __test.test_inDeclarationContext_label_false);
589 });
590 _ut.test('test_inDeclarationContext_label_true', () {
591 final __test = new SimpleIdentifierTest();
592 runJUnitTest(__test, __test.test_inDeclarationContext_label_true);
593 });
594 _ut.test('test_inDeclarationContext_methodDeclaration', () {
595 final __test = new SimpleIdentifierTest();
596 runJUnitTest(__test, __test.test_inDeclarationContext_methodDeclaration) ;
597 });
598 _ut.test('test_inDeclarationContext_normalFormalParameter', () {
599 final __test = new SimpleIdentifierTest();
600 runJUnitTest(__test, __test.test_inDeclarationContext_normalFormalParame ter);
601 });
602 _ut.test('test_inDeclarationContext_typeParameter_bound', () {
603 final __test = new SimpleIdentifierTest();
604 runJUnitTest(__test, __test.test_inDeclarationContext_typeParameter_boun d);
605 });
606 _ut.test('test_inDeclarationContext_typeParameter_name', () {
607 final __test = new SimpleIdentifierTest();
608 runJUnitTest(__test, __test.test_inDeclarationContext_typeParameter_name );
609 });
610 _ut.test('test_inDeclarationContext_variableDeclaration', () {
611 final __test = new SimpleIdentifierTest();
612 runJUnitTest(__test, __test.test_inDeclarationContext_variableDeclaratio n);
613 });
614 _ut.test('test_inGetterContext', () {
615 final __test = new SimpleIdentifierTest();
616 runJUnitTest(__test, __test.test_inGetterContext);
617 });
618 _ut.test('test_inSetterContext', () {
619 final __test = new SimpleIdentifierTest();
620 runJUnitTest(__test, __test.test_inSetterContext);
621 });
622 });
623 }
624 }
625 class AssignmentKind {
626 static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0);
627 static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT' , 1);
628 static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGH T', 2);
629 static final AssignmentKind POSTFIX_INC = new AssignmentKind('POSTFIX_INC', 3) ;
630 static final AssignmentKind PREFIX_DEC = new AssignmentKind('PREFIX_DEC', 4);
631 static final AssignmentKind PREFIX_INC = new AssignmentKind('PREFIX_INC', 5);
632 static final AssignmentKind PREFIX_NOT = new AssignmentKind('PREFIX_NOT', 6);
633 static final AssignmentKind SIMPLE_LEFT = new AssignmentKind('SIMPLE_LEFT', 7) ;
634 static final AssignmentKind SIMPLE_RIGHT = new AssignmentKind('SIMPLE_RIGHT', 8);
635 static final AssignmentKind NONE = new AssignmentKind('NONE', 9);
636 static final List<AssignmentKind> values = [BINARY, COMPOUND_LEFT, COMPOUND_RI GHT, POSTFIX_INC, PREFIX_DEC, PREFIX_INC, PREFIX_NOT, SIMPLE_LEFT, SIMPLE_RIGHT, NONE];
637 final String __name;
638 final int __ordinal;
639 int get ordinal => __ordinal;
640 AssignmentKind(this.__name, this.__ordinal) {
641 }
642 String toString() => __name;
643 }
644 class WrapperKind {
645 static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0);
646 static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1) ;
647 static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2);
648 static final WrapperKind PROPERTY_RIGHT = new WrapperKind('PROPERTY_RIGHT', 3) ;
649 static final WrapperKind NONE = new WrapperKind('NONE', 4);
650 static final List<WrapperKind> values = [PREFIXED_LEFT, PREFIXED_RIGHT, PROPER TY_LEFT, PROPERTY_RIGHT, NONE];
651 final String __name;
652 final int __ordinal;
653 int get ordinal => __ordinal;
654 WrapperKind(this.__name, this.__ordinal) {
655 }
656 String toString() => __name;
657 }
658 class ConstantEvaluatorTest extends ParserTestCase {
659 void fail_constructor() {
660 Object value = getConstantValue("?");
661 JUnitTestCase.assertEquals(null, value);
662 }
663 void fail_identifier_class() {
664 Object value = getConstantValue("?");
665 JUnitTestCase.assertEquals(null, value);
666 }
667 void fail_identifier_function() {
668 Object value = getConstantValue("?");
669 JUnitTestCase.assertEquals(null, value);
670 }
671 void fail_identifier_static() {
672 Object value = getConstantValue("?");
673 JUnitTestCase.assertEquals(null, value);
674 }
675 void fail_identifier_staticMethod() {
676 Object value = getConstantValue("?");
677 JUnitTestCase.assertEquals(null, value);
678 }
679 void fail_identifier_topLevel() {
680 Object value = getConstantValue("?");
681 JUnitTestCase.assertEquals(null, value);
682 }
683 void fail_identifier_typeVariable() {
684 Object value = getConstantValue("?");
685 JUnitTestCase.assertEquals(null, value);
686 }
687 void test_binary_bitAnd() {
688 Object value = getConstantValue("74 & 42");
689 EngineTestCase.assertInstanceOf(int, value);
690 JUnitTestCase.assertEquals(74 & 42, ((value as int)));
691 }
692 void test_binary_bitOr() {
693 Object value = getConstantValue("74 | 42");
694 EngineTestCase.assertInstanceOf(int, value);
695 JUnitTestCase.assertEquals(74 | 42, ((value as int)));
696 }
697 void test_binary_bitXor() {
698 Object value = getConstantValue("74 ^ 42");
699 EngineTestCase.assertInstanceOf(int, value);
700 JUnitTestCase.assertEquals(74 ^ 42, ((value as int)));
701 }
702 void test_binary_divide_double() {
703 Object value = getConstantValue("3.2 / 2.3");
704 EngineTestCase.assertInstanceOf(double, value);
705 JUnitTestCase.assertEquals(3.2 / 2.3, ((value as double)));
706 }
707 void test_binary_divide_integer() {
708 Object value = getConstantValue("3 / 2");
709 EngineTestCase.assertInstanceOf(int, value);
710 JUnitTestCase.assertEquals(1, ((value as int)));
711 }
712 void test_binary_equal_boolean() {
713 Object value = getConstantValue("true == false");
714 JUnitTestCase.assertEquals(false, value);
715 }
716 void test_binary_equal_integer() {
717 Object value = getConstantValue("2 == 3");
718 JUnitTestCase.assertEquals(false, value);
719 }
720 void test_binary_equal_invalidLeft() {
721 Object value = getConstantValue("a == 3");
722 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value);
723 }
724 void test_binary_equal_invalidRight() {
725 Object value = getConstantValue("2 == a");
726 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value);
727 }
728 void test_binary_equal_string() {
729 Object value = getConstantValue("'a' == 'b'");
730 JUnitTestCase.assertEquals(false, value);
731 }
732 void test_binary_greaterThan() {
733 Object value = getConstantValue("2 > 3");
734 JUnitTestCase.assertEquals(false, value);
735 }
736 void test_binary_greaterThanOrEqual() {
737 Object value = getConstantValue("2 >= 3");
738 JUnitTestCase.assertEquals(false, value);
739 }
740 void test_binary_leftShift() {
741 Object value = getConstantValue("16 << 2");
742 EngineTestCase.assertInstanceOf(int, value);
743 JUnitTestCase.assertEquals(64, ((value as int)));
744 }
745 void test_binary_lessThan() {
746 Object value = getConstantValue("2 < 3");
747 JUnitTestCase.assertEquals(true, value);
748 }
749 void test_binary_lessThanOrEqual() {
750 Object value = getConstantValue("2 <= 3");
751 JUnitTestCase.assertEquals(true, value);
752 }
753 void test_binary_logicalAnd() {
754 Object value = getConstantValue("true && false");
755 JUnitTestCase.assertEquals(false, value);
756 }
757 void test_binary_logicalOr() {
758 Object value = getConstantValue("true || false");
759 JUnitTestCase.assertEquals(true, value);
760 }
761 void test_binary_minus_double() {
762 Object value = getConstantValue("3.2 - 2.3");
763 EngineTestCase.assertInstanceOf(double, value);
764 JUnitTestCase.assertEquals(3.2 - 2.3, ((value as double)));
765 }
766 void test_binary_minus_integer() {
767 Object value = getConstantValue("3 - 2");
768 EngineTestCase.assertInstanceOf(int, value);
769 JUnitTestCase.assertEquals(1, ((value as int)));
770 }
771 void test_binary_notEqual_boolean() {
772 Object value = getConstantValue("true != false");
773 JUnitTestCase.assertEquals(true, value);
774 }
775 void test_binary_notEqual_integer() {
776 Object value = getConstantValue("2 != 3");
777 JUnitTestCase.assertEquals(true, value);
778 }
779 void test_binary_notEqual_invalidLeft() {
780 Object value = getConstantValue("a != 3");
781 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value);
782 }
783 void test_binary_notEqual_invalidRight() {
784 Object value = getConstantValue("2 != a");
785 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value);
786 }
787 void test_binary_notEqual_string() {
788 Object value = getConstantValue("'a' != 'b'");
789 JUnitTestCase.assertEquals(true, value);
790 }
791 void test_binary_plus_double() {
792 Object value = getConstantValue("2.3 + 3.2");
793 EngineTestCase.assertInstanceOf(double, value);
794 JUnitTestCase.assertEquals(2.3 + 3.2, ((value as double)));
795 }
796 void test_binary_plus_integer() {
797 Object value = getConstantValue("2 + 3");
798 EngineTestCase.assertInstanceOf(int, value);
799 JUnitTestCase.assertEquals(5, ((value as int)));
800 }
801 void test_binary_remainder_double() {
802 Object value = getConstantValue("3.2 % 2.3");
803 EngineTestCase.assertInstanceOf(double, value);
804 JUnitTestCase.assertEquals(3.2 % 2.3, ((value as double)));
805 }
806 void test_binary_remainder_integer() {
807 Object value = getConstantValue("8 % 3");
808 EngineTestCase.assertInstanceOf(int, value);
809 JUnitTestCase.assertEquals(2, ((value as int)));
810 }
811 void test_binary_rightShift() {
812 Object value = getConstantValue("64 >> 2");
813 EngineTestCase.assertInstanceOf(int, value);
814 JUnitTestCase.assertEquals(16, ((value as int)));
815 }
816 void test_binary_times_double() {
817 Object value = getConstantValue("2.3 * 3.2");
818 EngineTestCase.assertInstanceOf(double, value);
819 JUnitTestCase.assertEquals(2.3 * 3.2, ((value as double)));
820 }
821 void test_binary_times_integer() {
822 Object value = getConstantValue("2 * 3");
823 EngineTestCase.assertInstanceOf(int, value);
824 JUnitTestCase.assertEquals(6, ((value as int)));
825 }
826 void test_binary_truncatingDivide_double() {
827 Object value = getConstantValue("3.2 ~/ 2.3");
828 EngineTestCase.assertInstanceOf(int, value);
829 JUnitTestCase.assertEquals(1, ((value as int)));
830 }
831 void test_binary_truncatingDivide_integer() {
832 Object value = getConstantValue("10 ~/ 3");
833 EngineTestCase.assertInstanceOf(int, value);
834 JUnitTestCase.assertEquals(3, ((value as int)));
835 }
836 void test_literal_boolean_false() {
837 Object value = getConstantValue("false");
838 JUnitTestCase.assertEquals(false, value);
839 }
840 void test_literal_boolean_true() {
841 Object value = getConstantValue("true");
842 JUnitTestCase.assertEquals(true, value);
843 }
844 void test_literal_list() {
845 Object value = getConstantValue("['a', 'b', 'c']");
846 EngineTestCase.assertInstanceOf(List, value);
847 List<Object> list = value as List<Object>;
848 JUnitTestCase.assertEquals(3, list.length);
849 JUnitTestCase.assertEquals("a", list[0]);
850 JUnitTestCase.assertEquals("b", list[1]);
851 JUnitTestCase.assertEquals("c", list[2]);
852 }
853 void test_literal_map() {
854 Object value = getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}");
855 EngineTestCase.assertInstanceOf(Map, value);
856 Map<Object, Object> map = value as Map<Object, Object>;
857 JUnitTestCase.assertEquals(3, map.length);
858 JUnitTestCase.assertEquals("m", map["a"]);
859 JUnitTestCase.assertEquals("n", map["b"]);
860 JUnitTestCase.assertEquals("o", map["c"]);
861 }
862 void test_literal_null() {
863 Object value = getConstantValue("null");
864 JUnitTestCase.assertEquals(null, value);
865 }
866 void test_literal_number_double() {
867 Object value = getConstantValue("3.45");
868 EngineTestCase.assertInstanceOf(double, value);
869 JUnitTestCase.assertEquals(3.45, ((value as double)));
870 }
871 void test_literal_number_integer() {
872 Object value = getConstantValue("42");
873 EngineTestCase.assertInstanceOf(int, value);
874 JUnitTestCase.assertEquals(42, ((value as int)));
875 }
876 void test_literal_string_adjacent() {
877 Object value = getConstantValue("'abc' 'def'");
878 JUnitTestCase.assertEquals("abcdef", value);
879 }
880 void test_literal_string_interpolation_invalid() {
881 Object value = getConstantValue("'a\${f()}c'");
882 JUnitTestCase.assertEquals(ConstantEvaluator.NOT_A_CONSTANT, value);
883 }
884 void test_literal_string_interpolation_valid() {
885 Object value = getConstantValue("'a\${3}c'");
886 JUnitTestCase.assertEquals("a3c", value);
887 }
888 void test_literal_string_simple() {
889 Object value = getConstantValue("'abc'");
890 JUnitTestCase.assertEquals("abc", value);
891 }
892 void test_parenthesizedExpression() {
893 Object value = getConstantValue("('a')");
894 JUnitTestCase.assertEquals("a", value);
895 }
896 void test_unary_bitNot() {
897 Object value = getConstantValue("~42");
898 EngineTestCase.assertInstanceOf(int, value);
899 JUnitTestCase.assertEquals(~42, ((value as int)));
900 }
901 void test_unary_logicalNot() {
902 Object value = getConstantValue("!true");
903 JUnitTestCase.assertEquals(false, value);
904 }
905 void test_unary_negated_double() {
906 Object value = getConstantValue("-42.3");
907 EngineTestCase.assertInstanceOf(double, value);
908 JUnitTestCase.assertEquals(-42.3, ((value as double)));
909 }
910 void test_unary_negated_integer() {
911 Object value = getConstantValue("-42");
912 EngineTestCase.assertInstanceOf(int, value);
913 JUnitTestCase.assertEquals(-42, ((value as int)));
914 }
915 Object getConstantValue(String source) => ParserTestCase.parseExpression(sourc e, []).accept(new ConstantEvaluator(null));
916 static dartSuite() {
917 _ut.group('ConstantEvaluatorTest', () {
918 _ut.test('test_binary_bitAnd', () {
919 final __test = new ConstantEvaluatorTest();
920 runJUnitTest(__test, __test.test_binary_bitAnd);
921 });
922 _ut.test('test_binary_bitOr', () {
923 final __test = new ConstantEvaluatorTest();
924 runJUnitTest(__test, __test.test_binary_bitOr);
925 });
926 _ut.test('test_binary_bitXor', () {
927 final __test = new ConstantEvaluatorTest();
928 runJUnitTest(__test, __test.test_binary_bitXor);
929 });
930 _ut.test('test_binary_divide_double', () {
931 final __test = new ConstantEvaluatorTest();
932 runJUnitTest(__test, __test.test_binary_divide_double);
933 });
934 _ut.test('test_binary_divide_integer', () {
935 final __test = new ConstantEvaluatorTest();
936 runJUnitTest(__test, __test.test_binary_divide_integer);
937 });
938 _ut.test('test_binary_equal_boolean', () {
939 final __test = new ConstantEvaluatorTest();
940 runJUnitTest(__test, __test.test_binary_equal_boolean);
941 });
942 _ut.test('test_binary_equal_integer', () {
943 final __test = new ConstantEvaluatorTest();
944 runJUnitTest(__test, __test.test_binary_equal_integer);
945 });
946 _ut.test('test_binary_equal_invalidLeft', () {
947 final __test = new ConstantEvaluatorTest();
948 runJUnitTest(__test, __test.test_binary_equal_invalidLeft);
949 });
950 _ut.test('test_binary_equal_invalidRight', () {
951 final __test = new ConstantEvaluatorTest();
952 runJUnitTest(__test, __test.test_binary_equal_invalidRight);
953 });
954 _ut.test('test_binary_equal_string', () {
955 final __test = new ConstantEvaluatorTest();
956 runJUnitTest(__test, __test.test_binary_equal_string);
957 });
958 _ut.test('test_binary_greaterThan', () {
959 final __test = new ConstantEvaluatorTest();
960 runJUnitTest(__test, __test.test_binary_greaterThan);
961 });
962 _ut.test('test_binary_greaterThanOrEqual', () {
963 final __test = new ConstantEvaluatorTest();
964 runJUnitTest(__test, __test.test_binary_greaterThanOrEqual);
965 });
966 _ut.test('test_binary_leftShift', () {
967 final __test = new ConstantEvaluatorTest();
968 runJUnitTest(__test, __test.test_binary_leftShift);
969 });
970 _ut.test('test_binary_lessThan', () {
971 final __test = new ConstantEvaluatorTest();
972 runJUnitTest(__test, __test.test_binary_lessThan);
973 });
974 _ut.test('test_binary_lessThanOrEqual', () {
975 final __test = new ConstantEvaluatorTest();
976 runJUnitTest(__test, __test.test_binary_lessThanOrEqual);
977 });
978 _ut.test('test_binary_logicalAnd', () {
979 final __test = new ConstantEvaluatorTest();
980 runJUnitTest(__test, __test.test_binary_logicalAnd);
981 });
982 _ut.test('test_binary_logicalOr', () {
983 final __test = new ConstantEvaluatorTest();
984 runJUnitTest(__test, __test.test_binary_logicalOr);
985 });
986 _ut.test('test_binary_minus_double', () {
987 final __test = new ConstantEvaluatorTest();
988 runJUnitTest(__test, __test.test_binary_minus_double);
989 });
990 _ut.test('test_binary_minus_integer', () {
991 final __test = new ConstantEvaluatorTest();
992 runJUnitTest(__test, __test.test_binary_minus_integer);
993 });
994 _ut.test('test_binary_notEqual_boolean', () {
995 final __test = new ConstantEvaluatorTest();
996 runJUnitTest(__test, __test.test_binary_notEqual_boolean);
997 });
998 _ut.test('test_binary_notEqual_integer', () {
999 final __test = new ConstantEvaluatorTest();
1000 runJUnitTest(__test, __test.test_binary_notEqual_integer);
1001 });
1002 _ut.test('test_binary_notEqual_invalidLeft', () {
1003 final __test = new ConstantEvaluatorTest();
1004 runJUnitTest(__test, __test.test_binary_notEqual_invalidLeft);
1005 });
1006 _ut.test('test_binary_notEqual_invalidRight', () {
1007 final __test = new ConstantEvaluatorTest();
1008 runJUnitTest(__test, __test.test_binary_notEqual_invalidRight);
1009 });
1010 _ut.test('test_binary_notEqual_string', () {
1011 final __test = new ConstantEvaluatorTest();
1012 runJUnitTest(__test, __test.test_binary_notEqual_string);
1013 });
1014 _ut.test('test_binary_plus_double', () {
1015 final __test = new ConstantEvaluatorTest();
1016 runJUnitTest(__test, __test.test_binary_plus_double);
1017 });
1018 _ut.test('test_binary_plus_integer', () {
1019 final __test = new ConstantEvaluatorTest();
1020 runJUnitTest(__test, __test.test_binary_plus_integer);
1021 });
1022 _ut.test('test_binary_remainder_double', () {
1023 final __test = new ConstantEvaluatorTest();
1024 runJUnitTest(__test, __test.test_binary_remainder_double);
1025 });
1026 _ut.test('test_binary_remainder_integer', () {
1027 final __test = new ConstantEvaluatorTest();
1028 runJUnitTest(__test, __test.test_binary_remainder_integer);
1029 });
1030 _ut.test('test_binary_rightShift', () {
1031 final __test = new ConstantEvaluatorTest();
1032 runJUnitTest(__test, __test.test_binary_rightShift);
1033 });
1034 _ut.test('test_binary_times_double', () {
1035 final __test = new ConstantEvaluatorTest();
1036 runJUnitTest(__test, __test.test_binary_times_double);
1037 });
1038 _ut.test('test_binary_times_integer', () {
1039 final __test = new ConstantEvaluatorTest();
1040 runJUnitTest(__test, __test.test_binary_times_integer);
1041 });
1042 _ut.test('test_binary_truncatingDivide_double', () {
1043 final __test = new ConstantEvaluatorTest();
1044 runJUnitTest(__test, __test.test_binary_truncatingDivide_double);
1045 });
1046 _ut.test('test_binary_truncatingDivide_integer', () {
1047 final __test = new ConstantEvaluatorTest();
1048 runJUnitTest(__test, __test.test_binary_truncatingDivide_integer);
1049 });
1050 _ut.test('test_literal_boolean_false', () {
1051 final __test = new ConstantEvaluatorTest();
1052 runJUnitTest(__test, __test.test_literal_boolean_false);
1053 });
1054 _ut.test('test_literal_boolean_true', () {
1055 final __test = new ConstantEvaluatorTest();
1056 runJUnitTest(__test, __test.test_literal_boolean_true);
1057 });
1058 _ut.test('test_literal_list', () {
1059 final __test = new ConstantEvaluatorTest();
1060 runJUnitTest(__test, __test.test_literal_list);
1061 });
1062 _ut.test('test_literal_map', () {
1063 final __test = new ConstantEvaluatorTest();
1064 runJUnitTest(__test, __test.test_literal_map);
1065 });
1066 _ut.test('test_literal_null', () {
1067 final __test = new ConstantEvaluatorTest();
1068 runJUnitTest(__test, __test.test_literal_null);
1069 });
1070 _ut.test('test_literal_number_double', () {
1071 final __test = new ConstantEvaluatorTest();
1072 runJUnitTest(__test, __test.test_literal_number_double);
1073 });
1074 _ut.test('test_literal_number_integer', () {
1075 final __test = new ConstantEvaluatorTest();
1076 runJUnitTest(__test, __test.test_literal_number_integer);
1077 });
1078 _ut.test('test_literal_string_adjacent', () {
1079 final __test = new ConstantEvaluatorTest();
1080 runJUnitTest(__test, __test.test_literal_string_adjacent);
1081 });
1082 _ut.test('test_literal_string_interpolation_invalid', () {
1083 final __test = new ConstantEvaluatorTest();
1084 runJUnitTest(__test, __test.test_literal_string_interpolation_invalid);
1085 });
1086 _ut.test('test_literal_string_interpolation_valid', () {
1087 final __test = new ConstantEvaluatorTest();
1088 runJUnitTest(__test, __test.test_literal_string_interpolation_valid);
1089 });
1090 _ut.test('test_literal_string_simple', () {
1091 final __test = new ConstantEvaluatorTest();
1092 runJUnitTest(__test, __test.test_literal_string_simple);
1093 });
1094 _ut.test('test_parenthesizedExpression', () {
1095 final __test = new ConstantEvaluatorTest();
1096 runJUnitTest(__test, __test.test_parenthesizedExpression);
1097 });
1098 _ut.test('test_unary_bitNot', () {
1099 final __test = new ConstantEvaluatorTest();
1100 runJUnitTest(__test, __test.test_unary_bitNot);
1101 });
1102 _ut.test('test_unary_logicalNot', () {
1103 final __test = new ConstantEvaluatorTest();
1104 runJUnitTest(__test, __test.test_unary_logicalNot);
1105 });
1106 _ut.test('test_unary_negated_double', () {
1107 final __test = new ConstantEvaluatorTest();
1108 runJUnitTest(__test, __test.test_unary_negated_double);
1109 });
1110 _ut.test('test_unary_negated_integer', () {
1111 final __test = new ConstantEvaluatorTest();
1112 runJUnitTest(__test, __test.test_unary_negated_integer);
1113 });
1114 });
1115 }
1116 }
1117 class ToSourceVisitorTest extends EngineTestCase {
1118 void test_visitAdjacentStrings() {
1119 assertSource("'a' 'b'", ASTFactory.adjacentStrings([ASTFactory.string2("a"), ASTFactory.string2("b")]));
1120 }
1121 void test_visitAnnotation_constant() {
1122 assertSource("@A", ASTFactory.annotation(ASTFactory.identifier2("A")));
1123 }
1124 void test_visitAnnotation_constructor() {
1125 assertSource("@A.c()", ASTFactory.annotation2(ASTFactory.identifier2("A"), A STFactory.identifier2("c"), ASTFactory.argumentList([])));
1126 }
1127 void test_visitArgumentDefinitionTest() {
1128 assertSource("?a", ASTFactory.argumentDefinitionTest("a"));
1129 }
1130 void test_visitArgumentList() {
1131 assertSource("(a, b)", ASTFactory.argumentList([ASTFactory.identifier2("a"), ASTFactory.identifier2("b")]));
1132 }
1133 void test_visitAsExpression() {
1134 assertSource("e as T", ASTFactory.asExpression(ASTFactory.identifier2("e"), ASTFactory.typeName3("T", [])));
1135 }
1136 void test_visitAssertStatement() {
1137 assertSource("assert (a);", ASTFactory.assertStatement(ASTFactory.identifier 2("a")));
1138 }
1139 void test_visitAssignmentExpression() {
1140 assertSource("a = b", ASTFactory.assignmentExpression(ASTFactory.identifier2 ("a"), TokenType.EQ, ASTFactory.identifier2("b")));
1141 }
1142 void test_visitBinaryExpression() {
1143 assertSource("a + b", ASTFactory.binaryExpression(ASTFactory.identifier2("a" ), TokenType.PLUS, ASTFactory.identifier2("b")));
1144 }
1145 void test_visitBlock_empty() {
1146 assertSource("{}", ASTFactory.block([]));
1147 }
1148 void test_visitBlock_nonEmpty() {
1149 assertSource("{break; break;}", ASTFactory.block([ASTFactory.breakStatement( ), ASTFactory.breakStatement()]));
1150 }
1151 void test_visitBlockFunctionBody() {
1152 assertSource("{}", ASTFactory.blockFunctionBody([]));
1153 }
1154 void test_visitBooleanLiteral_false() {
1155 assertSource("false", ASTFactory.booleanLiteral(false));
1156 }
1157 void test_visitBooleanLiteral_true() {
1158 assertSource("true", ASTFactory.booleanLiteral(true));
1159 }
1160 void test_visitBreakStatement_label() {
1161 assertSource("break l;", ASTFactory.breakStatement2("l"));
1162 }
1163 void test_visitBreakStatement_noLabel() {
1164 assertSource("break;", ASTFactory.breakStatement());
1165 }
1166 void test_visitCascadeExpression_field() {
1167 assertSource("a..b..c", ASTFactory.cascadeExpression(ASTFactory.identifier2( "a"), [ASTFactory.cascadedPropertyAccess("b"), ASTFactory.cascadedPropertyAccess ("c")]));
1168 }
1169 void test_visitCascadeExpression_index() {
1170 assertSource("a..[0]..[1]", ASTFactory.cascadeExpression(ASTFactory.identifi er2("a"), [ASTFactory.cascadedIndexExpression(ASTFactory.integer(0)), ASTFactory .cascadedIndexExpression(ASTFactory.integer(1))]));
1171 }
1172 void test_visitCascadeExpression_method() {
1173 assertSource("a..b()..c()", ASTFactory.cascadeExpression(ASTFactory.identifi er2("a"), [ASTFactory.cascadedMethodInvocation("b", []), ASTFactory.cascadedMeth odInvocation("c", [])]));
1174 }
1175 void test_visitCatchClause_catch_noStack() {
1176 assertSource("catch (e) {}", ASTFactory.catchClause("e", []));
1177 }
1178 void test_visitCatchClause_catch_stack() {
1179 assertSource("catch (e, s) {}", ASTFactory.catchClause2("e", "s", []));
1180 }
1181 void test_visitCatchClause_on() {
1182 assertSource("on E {}", ASTFactory.catchClause3(ASTFactory.typeName3("E", [] ), []));
1183 }
1184 void test_visitCatchClause_on_catch() {
1185 assertSource("on E catch (e) {}", ASTFactory.catchClause4(ASTFactory.typeNam e3("E", []), "e", []));
1186 }
1187 void test_visitClassDeclaration_abstract() {
1188 assertSource("abstract class C {}", ASTFactory.classDeclaration(Keyword.ABST RACT, "C", null, null, null, null, []));
1189 }
1190 void test_visitClassDeclaration_empty() {
1191 assertSource("class C {}", ASTFactory.classDeclaration(null, "C", null, null , null, null, []));
1192 }
1193 void test_visitClassDeclaration_extends() {
1194 assertSource("class C extends A {}", ASTFactory.classDeclaration(null, "C", null, ASTFactory.extendsClause(ASTFactory.typeName3("A", [])), null, null, []));
1195 }
1196 void test_visitClassDeclaration_extends_implements() {
1197 assertSource("class C extends A implements B {}", ASTFactory.classDeclaratio n(null, "C", null, ASTFactory.extendsClause(ASTFactory.typeName3("A", [])), null , ASTFactory.implementsClause([ASTFactory.typeName3("B", [])]), []));
1198 }
1199 void test_visitClassDeclaration_extends_with() {
1200 assertSource("class C extends A with M {}", ASTFactory.classDeclaration(null , "C", null, ASTFactory.extendsClause(ASTFactory.typeName3("A", [])), ASTFactory .withClause([ASTFactory.typeName3("M", [])]), null, []));
1201 }
1202 void test_visitClassDeclaration_extends_with_implements() {
1203 assertSource("class C extends A with M implements B {}", ASTFactory.classDec laration(null, "C", null, ASTFactory.extendsClause(ASTFactory.typeName3("A", []) ), ASTFactory.withClause([ASTFactory.typeName3("M", [])]), ASTFactory.implements Clause([ASTFactory.typeName3("B", [])]), []));
1204 }
1205 void test_visitClassDeclaration_implements() {
1206 assertSource("class C implements B {}", ASTFactory.classDeclaration(null, "C ", null, null, null, ASTFactory.implementsClause([ASTFactory.typeName3("B", [])] ), []));
1207 }
1208 void test_visitClassDeclaration_multipleMember() {
1209 assertSource("class C {var a; var b;}", ASTFactory.classDeclaration(null, "C ", null, null, null, null, [ASTFactory.fieldDeclaration2(false, Keyword.VAR, [AS TFactory.variableDeclaration("a")]), ASTFactory.fieldDeclaration2(false, Keyword .VAR, [ASTFactory.variableDeclaration("b")])]));
1210 }
1211 void test_visitClassDeclaration_parameters() {
1212 assertSource("class C<E> {}", ASTFactory.classDeclaration(null, "C", ASTFact ory.typeParameterList(["E"]), null, null, null, []));
1213 }
1214 void test_visitClassDeclaration_parameters_extends() {
1215 assertSource("class C<E> extends A {}", ASTFactory.classDeclaration(null, "C ", ASTFactory.typeParameterList(["E"]), ASTFactory.extendsClause(ASTFactory.type Name3("A", [])), null, null, []));
1216 }
1217 void test_visitClassDeclaration_parameters_extends_implements() {
1218 assertSource("class C<E> extends A implements B {}", ASTFactory.classDeclara tion(null, "C", ASTFactory.typeParameterList(["E"]), ASTFactory.extendsClause(AS TFactory.typeName3("A", [])), null, ASTFactory.implementsClause([ASTFactory.type Name3("B", [])]), []));
1219 }
1220 void test_visitClassDeclaration_parameters_extends_with() {
1221 assertSource("class C<E> extends A with M {}", ASTFactory.classDeclaration(n ull, "C", ASTFactory.typeParameterList(["E"]), ASTFactory.extendsClause(ASTFacto ry.typeName3("A", [])), ASTFactory.withClause([ASTFactory.typeName3("M", [])]), null, []));
1222 }
1223 void test_visitClassDeclaration_parameters_extends_with_implements() {
1224 assertSource("class C<E> extends A with M implements B {}", ASTFactory.class Declaration(null, "C", ASTFactory.typeParameterList(["E"]), ASTFactory.extendsCl ause(ASTFactory.typeName3("A", [])), ASTFactory.withClause([ASTFactory.typeName3 ("M", [])]), ASTFactory.implementsClause([ASTFactory.typeName3("B", [])]), []));
1225 }
1226 void test_visitClassDeclaration_parameters_implements() {
1227 assertSource("class C<E> implements B {}", ASTFactory.classDeclaration(null, "C", ASTFactory.typeParameterList(["E"]), null, null, ASTFactory.implementsClau se([ASTFactory.typeName3("B", [])]), []));
1228 }
1229 void test_visitClassDeclaration_singleMember() {
1230 assertSource("class C {var a;}", ASTFactory.classDeclaration(null, "C", null , null, null, null, [ASTFactory.fieldDeclaration2(false, Keyword.VAR, [ASTFactor y.variableDeclaration("a")])]));
1231 }
1232 void test_visitClassTypeAlias_abstract() {
1233 assertSource("typedef C = abstract S with M1;", ASTFactory.classTypeAlias("C ", null, Keyword.ABSTRACT, ASTFactory.typeName3("S", []), ASTFactory.withClause( [ASTFactory.typeName3("M1", [])]), null));
1234 }
1235 void test_visitClassTypeAlias_abstract_implements() {
1236 assertSource("typedef C = abstract S with M1 implements I;", ASTFactory.clas sTypeAlias("C", null, Keyword.ABSTRACT, ASTFactory.typeName3("S", []), ASTFactor y.withClause([ASTFactory.typeName3("M1", [])]), ASTFactory.implementsClause([AST Factory.typeName3("I", [])])));
1237 }
1238 void test_visitClassTypeAlias_generic() {
1239 assertSource("typedef C<E> = S<E> with M1<E>;", ASTFactory.classTypeAlias("C ", ASTFactory.typeParameterList(["E"]), null, ASTFactory.typeName3("S", [ASTFact ory.typeName3("E", [])]), ASTFactory.withClause([ASTFactory.typeName3("M1", [AST Factory.typeName3("E", [])])]), null));
1240 }
1241 void test_visitClassTypeAlias_implements() {
1242 assertSource("typedef C = S with M1 implements I;", ASTFactory.classTypeAlia s("C", null, null, ASTFactory.typeName3("S", []), ASTFactory.withClause([ASTFact ory.typeName3("M1", [])]), ASTFactory.implementsClause([ASTFactory.typeName3("I" , [])])));
1243 }
1244 void test_visitClassTypeAlias_minimal() {
1245 assertSource("typedef C = S with M1;", ASTFactory.classTypeAlias("C", null, null, ASTFactory.typeName3("S", []), ASTFactory.withClause([ASTFactory.typeName3 ("M1", [])]), null));
1246 }
1247 void test_visitClassTypeAlias_parameters_abstract() {
1248 assertSource("typedef C<E> = abstract S with M1;", ASTFactory.classTypeAlias ("C", ASTFactory.typeParameterList(["E"]), Keyword.ABSTRACT, ASTFactory.typeName 3("S", []), ASTFactory.withClause([ASTFactory.typeName3("M1", [])]), null));
1249 }
1250 void test_visitClassTypeAlias_parameters_abstract_implements() {
1251 assertSource("typedef C<E> = abstract S with M1 implements I;", ASTFactory.c lassTypeAlias("C", ASTFactory.typeParameterList(["E"]), Keyword.ABSTRACT, ASTFac tory.typeName3("S", []), ASTFactory.withClause([ASTFactory.typeName3("M1", [])]) , ASTFactory.implementsClause([ASTFactory.typeName3("I", [])])));
1252 }
1253 void test_visitClassTypeAlias_parameters_implements() {
1254 assertSource("typedef C<E> = S with M1 implements I;", ASTFactory.classTypeA lias("C", ASTFactory.typeParameterList(["E"]), null, ASTFactory.typeName3("S", [ ]), ASTFactory.withClause([ASTFactory.typeName3("M1", [])]), ASTFactory.implemen tsClause([ASTFactory.typeName3("I", [])])));
1255 }
1256 void test_visitComment() {
1257 assertSource("", Comment.createBlockComment(<Token> [TokenFactory.token2("/* comment */")]));
1258 }
1259 void test_visitCommentReference() {
1260 assertSource("", new CommentReference.full(null, ASTFactory.identifier2("a") ));
1261 }
1262 void test_visitCompilationUnit_declaration() {
1263 assertSource("var a;", ASTFactory.compilationUnit2([ASTFactory.topLevelVaria bleDeclaration2(Keyword.VAR, [ASTFactory.variableDeclaration("a")])]));
1264 }
1265 void test_visitCompilationUnit_directive() {
1266 assertSource("library l;", ASTFactory.compilationUnit3([ASTFactory.libraryDi rective2("l")]));
1267 }
1268 void test_visitCompilationUnit_directive_declaration() {
1269 assertSource("library l; var a;", ASTFactory.compilationUnit4(ASTFactory.lis t([(ASTFactory.libraryDirective2("l") as Directive)]), ASTFactory.list([(ASTFact ory.topLevelVariableDeclaration2(Keyword.VAR, [ASTFactory.variableDeclaration("a ")]) as CompilationUnitMember)])));
1270 }
1271 void test_visitCompilationUnit_empty() {
1272 assertSource("", ASTFactory.compilationUnit());
1273 }
1274 void test_visitCompilationUnit_script() {
1275 assertSource("!#/bin/dartvm", ASTFactory.compilationUnit5("!#/bin/dartvm"));
1276 }
1277 void test_visitCompilationUnit_script_declaration() {
1278 assertSource("!#/bin/dartvm var a;", ASTFactory.compilationUnit6("!#/bin/dar tvm", [ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [ASTFactory.variable Declaration("a")])]));
1279 }
1280 void test_visitCompilationUnit_script_directive() {
1281 assertSource("!#/bin/dartvm library l;", ASTFactory.compilationUnit7("!#/bin /dartvm", [ASTFactory.libraryDirective2("l")]));
1282 }
1283 void test_visitCompilationUnit_script_directives_declarations() {
1284 assertSource("!#/bin/dartvm library l; var a;", ASTFactory.compilationUnit8( "!#/bin/dartvm", ASTFactory.list([(ASTFactory.libraryDirective2("l") as Directiv e)]), ASTFactory.list([(ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [AS TFactory.variableDeclaration("a")]) as CompilationUnitMember)])));
1285 }
1286 void test_visitConditionalExpression() {
1287 assertSource("a ? b : c", ASTFactory.conditionalExpression(ASTFactory.identi fier2("a"), ASTFactory.identifier2("b"), ASTFactory.identifier2("c")));
1288 }
1289 void test_visitConstructorDeclaration_const() {
1290 assertSource("const C() {}", ASTFactory.constructorDeclaration2(Keyword.CONS T, null, ASTFactory.identifier2("C"), null, ASTFactory.formalParameterList([]), null, ASTFactory.blockFunctionBody([])));
1291 }
1292 void test_visitConstructorDeclaration_external() {
1293 assertSource("external C();", ASTFactory.constructorDeclaration(ASTFactory.i dentifier2("C"), null, ASTFactory.formalParameterList([]), null));
1294 }
1295 void test_visitConstructorDeclaration_minimal() {
1296 assertSource("C() {}", ASTFactory.constructorDeclaration2(null, null, ASTFac tory.identifier2("C"), null, ASTFactory.formalParameterList([]), null, ASTFactor y.blockFunctionBody([])));
1297 }
1298 void test_visitConstructorDeclaration_multipleInitializers() {
1299 assertSource("C() : a = b, c = d {}", ASTFactory.constructorDeclaration2(nul l, null, ASTFactory.identifier2("C"), null, ASTFactory.formalParameterList([]), ASTFactory.list([(ASTFactory.constructorFieldInitializer(false, "a", ASTFactory. identifier2("b")) as ConstructorInitializer), ASTFactory.constructorFieldInitial izer(false, "c", ASTFactory.identifier2("d"))]), ASTFactory.blockFunctionBody([] )));
1300 }
1301 void test_visitConstructorDeclaration_multipleParameters() {
1302 assertSource("C(var a, var b) {}", ASTFactory.constructorDeclaration2(null, null, ASTFactory.identifier2("C"), null, ASTFactory.formalParameterList([ASTFact ory.simpleFormalParameter(Keyword.VAR, "a"), ASTFactory.simpleFormalParameter(Ke yword.VAR, "b")]), null, ASTFactory.blockFunctionBody([])));
1303 }
1304 void test_visitConstructorDeclaration_named() {
1305 assertSource("C.m() {}", ASTFactory.constructorDeclaration2(null, null, ASTF actory.identifier2("C"), "m", ASTFactory.formalParameterList([]), null, ASTFacto ry.blockFunctionBody([])));
1306 }
1307 void test_visitConstructorDeclaration_singleInitializer() {
1308 assertSource("C() : a = b {}", ASTFactory.constructorDeclaration2(null, null , ASTFactory.identifier2("C"), null, ASTFactory.formalParameterList([]), ASTFact ory.list([(ASTFactory.constructorFieldInitializer(false, "a", ASTFactory.identif ier2("b")) as ConstructorInitializer)]), ASTFactory.blockFunctionBody([])));
1309 }
1310 void test_visitConstructorFieldInitializer_withoutThis() {
1311 assertSource("a = b", ASTFactory.constructorFieldInitializer(false, "a", AST Factory.identifier2("b")));
1312 }
1313 void test_visitConstructorFieldInitializer_withThis() {
1314 assertSource("this.a = b", ASTFactory.constructorFieldInitializer(true, "a", ASTFactory.identifier2("b")));
1315 }
1316 void test_visitConstructorName_named_prefix() {
1317 assertSource("p.C.n", ASTFactory.constructorName(ASTFactory.typeName3("p.C.n ", []), null));
1318 }
1319 void test_visitConstructorName_unnamed_noPrefix() {
1320 assertSource("C", ASTFactory.constructorName(ASTFactory.typeName3("C", []), null));
1321 }
1322 void test_visitConstructorName_unnamed_prefix() {
1323 assertSource("p.C", ASTFactory.constructorName(ASTFactory.typeName2(ASTFacto ry.identifier4("p", "C"), []), null));
1324 }
1325 void test_visitContinueStatement_label() {
1326 assertSource("continue l;", ASTFactory.continueStatement2("l"));
1327 }
1328 void test_visitContinueStatement_noLabel() {
1329 assertSource("continue;", ASTFactory.continueStatement());
1330 }
1331 void test_visitDefaultFormalParameter_named_noValue() {
1332 assertSource("p", ASTFactory.namedFormalParameter(ASTFactory.simpleFormalPar ameter3("p"), null));
1333 }
1334 void test_visitDefaultFormalParameter_named_value() {
1335 assertSource("p : 0", ASTFactory.namedFormalParameter(ASTFactory.simpleForma lParameter3("p"), ASTFactory.integer(0)));
1336 }
1337 void test_visitDefaultFormalParameter_positional_noValue() {
1338 assertSource("p", ASTFactory.positionalFormalParameter(ASTFactory.simpleForm alParameter3("p"), null));
1339 }
1340 void test_visitDefaultFormalParameter_positional_value() {
1341 assertSource("p = 0", ASTFactory.positionalFormalParameter(ASTFactory.simple FormalParameter3("p"), ASTFactory.integer(0)));
1342 }
1343 void test_visitDoStatement() {
1344 assertSource("do {} while (c);", ASTFactory.doStatement(ASTFactory.block([]) , ASTFactory.identifier2("c")));
1345 }
1346 void test_visitDoubleLiteral() {
1347 assertSource("4.2", ASTFactory.doubleLiteral(4.2));
1348 }
1349 void test_visitEmptyFunctionBody() {
1350 assertSource(";", ASTFactory.emptyFunctionBody());
1351 }
1352 void test_visitEmptyStatement() {
1353 assertSource(";", ASTFactory.emptyStatement());
1354 }
1355 void test_visitExportDirective_combinator() {
1356 assertSource("export 'a.dart' show A;", ASTFactory.exportDirective2("a.dart" , [(ASTFactory.showCombinator([ASTFactory.identifier2("A")]) as Combinator)]));
1357 }
1358 void test_visitExportDirective_combinators() {
1359 assertSource("export 'a.dart' show A hide B;", ASTFactory.exportDirective2(" a.dart", [ASTFactory.showCombinator([ASTFactory.identifier2("A")]), ASTFactory.h ideCombinator([ASTFactory.identifier2("B")])]));
1360 }
1361 void test_visitExportDirective_minimal() {
1362 assertSource("export 'a.dart';", ASTFactory.exportDirective2("a.dart", []));
1363 }
1364 void test_visitExpressionFunctionBody() {
1365 assertSource("=> a;", ASTFactory.expressionFunctionBody(ASTFactory.identifie r2("a")));
1366 }
1367 void test_visitExpressionStatement() {
1368 assertSource("a;", ASTFactory.expressionStatement(ASTFactory.identifier2("a" )));
1369 }
1370 void test_visitExtendsClause() {
1371 assertSource("extends C", ASTFactory.extendsClause(ASTFactory.typeName3("C", [])));
1372 }
1373 void test_visitFieldDeclaration_instance() {
1374 assertSource("var a;", ASTFactory.fieldDeclaration2(false, Keyword.VAR, [AST Factory.variableDeclaration("a")]));
1375 }
1376 void test_visitFieldDeclaration_static() {
1377 assertSource("static var a;", ASTFactory.fieldDeclaration2(true, Keyword.VAR , [ASTFactory.variableDeclaration("a")]));
1378 }
1379 void test_visitFieldFormalParameter_keyword() {
1380 assertSource("var this.a", ASTFactory.fieldFormalParameter(Keyword.VAR, null , "a"));
1381 }
1382 void test_visitFieldFormalParameter_keywordAndType() {
1383 assertSource("final A this.a", ASTFactory.fieldFormalParameter(Keyword.FINAL , ASTFactory.typeName3("A", []), "a"));
1384 }
1385 void test_visitFieldFormalParameter_type() {
1386 assertSource("A this.a", ASTFactory.fieldFormalParameter(null, ASTFactory.ty peName3("A", []), "a"));
1387 }
1388 void test_visitForEachStatement() {
1389 assertSource("for (a in b) {}", ASTFactory.forEachStatement(ASTFactory.decla redIdentifier3("a"), ASTFactory.identifier2("b"), ASTFactory.block([])));
1390 }
1391 void test_visitFormalParameterList_empty() {
1392 assertSource("()", ASTFactory.formalParameterList([]));
1393 }
1394 void test_visitFormalParameterList_n() {
1395 assertSource("({a : 0})", ASTFactory.formalParameterList([ASTFactory.namedFo rmalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0))]));
1396 }
1397 void test_visitFormalParameterList_nn() {
1398 assertSource("({a : 0, b : 1})", ASTFactory.formalParameterList([ASTFactory. namedFormalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer( 0)), ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("b"), AST Factory.integer(1))]));
1399 }
1400 void test_visitFormalParameterList_p() {
1401 assertSource("([a = 0])", ASTFactory.formalParameterList([ASTFactory.positio nalFormalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.integer(0) )]));
1402 }
1403 void test_visitFormalParameterList_pp() {
1404 assertSource("([a = 0, b = 1])", ASTFactory.formalParameterList([ASTFactory. positionalFormalParameter(ASTFactory.simpleFormalParameter3("a"), ASTFactory.int eger(0)), ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3 ("b"), ASTFactory.integer(1))]));
1405 }
1406 void test_visitFormalParameterList_r() {
1407 assertSource("(a)", ASTFactory.formalParameterList([ASTFactory.simpleFormalP arameter3("a")]));
1408 }
1409 void test_visitFormalParameterList_rn() {
1410 assertSource("(a, {b : 1})", ASTFactory.formalParameterList([ASTFactory.simp leFormalParameter3("a"), ASTFactory.namedFormalParameter(ASTFactory.simpleFormal Parameter3("b"), ASTFactory.integer(1))]));
1411 }
1412 void test_visitFormalParameterList_rnn() {
1413 assertSource("(a, {b : 1, c : 2})", ASTFactory.formalParameterList([ASTFacto ry.simpleFormalParameter3("a"), ASTFactory.namedFormalParameter(ASTFactory.simpl eFormalParameter3("b"), ASTFactory.integer(1)), ASTFactory.namedFormalParameter( ASTFactory.simpleFormalParameter3("c"), ASTFactory.integer(2))]));
1414 }
1415 void test_visitFormalParameterList_rp() {
1416 assertSource("(a, [b = 1])", ASTFactory.formalParameterList([ASTFactory.simp leFormalParameter3("a"), ASTFactory.positionalFormalParameter(ASTFactory.simpleF ormalParameter3("b"), ASTFactory.integer(1))]));
1417 }
1418 void test_visitFormalParameterList_rpp() {
1419 assertSource("(a, [b = 1, c = 2])", ASTFactory.formalParameterList([ASTFacto ry.simpleFormalParameter3("a"), ASTFactory.positionalFormalParameter(ASTFactory. simpleFormalParameter3("b"), ASTFactory.integer(1)), ASTFactory.positionalFormal Parameter(ASTFactory.simpleFormalParameter3("c"), ASTFactory.integer(2))]));
1420 }
1421 void test_visitFormalParameterList_rr() {
1422 assertSource("(a, b)", ASTFactory.formalParameterList([ASTFactory.simpleForm alParameter3("a"), ASTFactory.simpleFormalParameter3("b")]));
1423 }
1424 void test_visitFormalParameterList_rrn() {
1425 assertSource("(a, b, {c : 3})", ASTFactory.formalParameterList([ASTFactory.s impleFormalParameter3("a"), ASTFactory.simpleFormalParameter3("b"), ASTFactory.n amedFormalParameter(ASTFactory.simpleFormalParameter3("c"), ASTFactory.integer(3 ))]));
1426 }
1427 void test_visitFormalParameterList_rrnn() {
1428 assertSource("(a, b, {c : 3, d : 4})", ASTFactory.formalParameterList([ASTFa ctory.simpleFormalParameter3("a"), ASTFactory.simpleFormalParameter3("b"), ASTFa ctory.namedFormalParameter(ASTFactory.simpleFormalParameter3("c"), ASTFactory.in teger(3)), ASTFactory.namedFormalParameter(ASTFactory.simpleFormalParameter3("d" ), ASTFactory.integer(4))]));
1429 }
1430 void test_visitFormalParameterList_rrp() {
1431 assertSource("(a, b, [c = 3])", ASTFactory.formalParameterList([ASTFactory.s impleFormalParameter3("a"), ASTFactory.simpleFormalParameter3("b"), ASTFactory.p ositionalFormalParameter(ASTFactory.simpleFormalParameter3("c"), ASTFactory.inte ger(3))]));
1432 }
1433 void test_visitFormalParameterList_rrpp() {
1434 assertSource("(a, b, [c = 3, d = 4])", ASTFactory.formalParameterList([ASTFa ctory.simpleFormalParameter3("a"), ASTFactory.simpleFormalParameter3("b"), ASTFa ctory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("c"), ASTFacto ry.integer(3)), ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalPara meter3("d"), ASTFactory.integer(4))]));
1435 }
1436 void test_visitForStatement_c() {
1437 assertSource("for (; c;) {}", ASTFactory.forStatement((null as Expression), ASTFactory.identifier2("c"), null, ASTFactory.block([])));
1438 }
1439 void test_visitForStatement_cu() {
1440 assertSource("for (; c; u) {}", ASTFactory.forStatement((null as Expression) , ASTFactory.identifier2("c"), ASTFactory.list([(ASTFactory.identifier2("u") as Expression)]), ASTFactory.block([])));
1441 }
1442 void test_visitForStatement_e() {
1443 assertSource("for (e;;) {}", ASTFactory.forStatement(ASTFactory.identifier2( "e"), null, null, ASTFactory.block([])));
1444 }
1445 void test_visitForStatement_ec() {
1446 assertSource("for (e; c;) {}", ASTFactory.forStatement(ASTFactory.identifier 2("e"), ASTFactory.identifier2("c"), null, ASTFactory.block([])));
1447 }
1448 void test_visitForStatement_ecu() {
1449 assertSource("for (e; c; u) {}", ASTFactory.forStatement(ASTFactory.identifi er2("e"), ASTFactory.identifier2("c"), ASTFactory.list([(ASTFactory.identifier2( "u") as Expression)]), ASTFactory.block([])));
1450 }
1451 void test_visitForStatement_eu() {
1452 assertSource("for (e;; u) {}", ASTFactory.forStatement(ASTFactory.identifier 2("e"), null, ASTFactory.list([(ASTFactory.identifier2("u") as Expression)]), AS TFactory.block([])));
1453 }
1454 void test_visitForStatement_i() {
1455 assertSource("for (var i;;) {}", ASTFactory.forStatement2(ASTFactory.variabl eDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), null, nul l, ASTFactory.block([])));
1456 }
1457 void test_visitForStatement_ic() {
1458 assertSource("for (var i; c;) {}", ASTFactory.forStatement2(ASTFactory.varia bleDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), ASTFact ory.identifier2("c"), null, ASTFactory.block([])));
1459 }
1460 void test_visitForStatement_icu() {
1461 assertSource("for (var i; c; u) {}", ASTFactory.forStatement2(ASTFactory.var iableDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), ASTFa ctory.identifier2("c"), ASTFactory.list([(ASTFactory.identifier2("u") as Express ion)]), ASTFactory.block([])));
1462 }
1463 void test_visitForStatement_iu() {
1464 assertSource("for (var i;; u) {}", ASTFactory.forStatement2(ASTFactory.varia bleDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), null, A STFactory.list([(ASTFactory.identifier2("u") as Expression)]), ASTFactory.block( [])));
1465 }
1466 void test_visitForStatement_u() {
1467 assertSource("for (;; u) {}", ASTFactory.forStatement((null as Expression), null, ASTFactory.list([(ASTFactory.identifier2("u") as Expression)]), ASTFactory .block([])));
1468 }
1469 void test_visitFunctionDeclaration_getter() {
1470 assertSource("get f() {}", ASTFactory.functionDeclaration(null, Keyword.GET, "f", ASTFactory.functionExpression()));
1471 }
1472 void test_visitFunctionDeclaration_normal() {
1473 assertSource("f() {}", ASTFactory.functionDeclaration(null, null, "f", ASTFa ctory.functionExpression()));
1474 }
1475 void test_visitFunctionDeclaration_setter() {
1476 assertSource("set f() {}", ASTFactory.functionDeclaration(null, Keyword.SET, "f", ASTFactory.functionExpression()));
1477 }
1478 void test_visitFunctionDeclarationStatement() {
1479 assertSource("f() {};", ASTFactory.functionDeclarationStatement(null, null, "f", ASTFactory.functionExpression()));
1480 }
1481 void test_visitFunctionExpression() {
1482 assertSource("() {}", ASTFactory.functionExpression());
1483 }
1484 void test_visitFunctionExpressionInvocation() {
1485 assertSource("f()", ASTFactory.functionExpressionInvocation(ASTFactory.ident ifier2("f"), []));
1486 }
1487 void test_visitFunctionTypedFormalParameter_noType() {
1488 assertSource("f()", ASTFactory.functionTypedFormalParameter(null, "f", []));
1489 }
1490 void test_visitFunctionTypedFormalParameter_type() {
1491 assertSource("T f()", ASTFactory.functionTypedFormalParameter(ASTFactory.typ eName3("T", []), "f", []));
1492 }
1493 void test_visitIfStatement_withElse() {
1494 assertSource("if (c) {} else {}", ASTFactory.ifStatement2(ASTFactory.identif ier2("c"), ASTFactory.block([]), ASTFactory.block([])));
1495 }
1496 void test_visitIfStatement_withoutElse() {
1497 assertSource("if (c) {}", ASTFactory.ifStatement(ASTFactory.identifier2("c") , ASTFactory.block([])));
1498 }
1499 void test_visitImplementsClause_multiple() {
1500 assertSource("implements A, B", ASTFactory.implementsClause([ASTFactory.type Name3("A", []), ASTFactory.typeName3("B", [])]));
1501 }
1502 void test_visitImplementsClause_single() {
1503 assertSource("implements A", ASTFactory.implementsClause([ASTFactory.typeNam e3("A", [])]));
1504 }
1505 void test_visitImportDirective_combinator() {
1506 assertSource("import 'a.dart' show A;", ASTFactory.importDirective2("a.dart" , null, [ASTFactory.showCombinator([ASTFactory.identifier2("A")])]));
1507 }
1508 void test_visitImportDirective_combinators() {
1509 assertSource("import 'a.dart' show A hide B;", ASTFactory.importDirective2(" a.dart", null, [ASTFactory.showCombinator([ASTFactory.identifier2("A")]), ASTFac tory.hideCombinator([ASTFactory.identifier2("B")])]));
1510 }
1511 void test_visitImportDirective_minimal() {
1512 assertSource("import 'a.dart';", ASTFactory.importDirective2("a.dart", null, []));
1513 }
1514 void test_visitImportDirective_prefix() {
1515 assertSource("import 'a.dart' as p;", ASTFactory.importDirective2("a.dart", "p", []));
1516 }
1517 void test_visitImportDirective_prefix_combinator() {
1518 assertSource("import 'a.dart' as p show A;", ASTFactory.importDirective2("a. dart", "p", [ASTFactory.showCombinator([ASTFactory.identifier2("A")])]));
1519 }
1520 void test_visitImportDirective_prefix_combinators() {
1521 assertSource("import 'a.dart' as p show A hide B;", ASTFactory.importDirecti ve2("a.dart", "p", [ASTFactory.showCombinator([ASTFactory.identifier2("A")]), AS TFactory.hideCombinator([ASTFactory.identifier2("B")])]));
1522 }
1523 void test_visitImportHideCombinator_multiple() {
1524 assertSource("hide a, b", ASTFactory.hideCombinator([ASTFactory.identifier2( "a"), ASTFactory.identifier2("b")]));
1525 }
1526 void test_visitImportHideCombinator_single() {
1527 assertSource("hide a", ASTFactory.hideCombinator([ASTFactory.identifier2("a" )]));
1528 }
1529 void test_visitImportShowCombinator_multiple() {
1530 assertSource("show a, b", ASTFactory.showCombinator([ASTFactory.identifier2( "a"), ASTFactory.identifier2("b")]));
1531 }
1532 void test_visitImportShowCombinator_single() {
1533 assertSource("show a", ASTFactory.showCombinator([ASTFactory.identifier2("a" )]));
1534 }
1535 void test_visitIndexExpression() {
1536 assertSource("a[i]", ASTFactory.indexExpression(ASTFactory.identifier2("a"), ASTFactory.identifier2("i")));
1537 }
1538 void test_visitInstanceCreationExpression_const() {
1539 assertSource("const C()", ASTFactory.instanceCreationExpression2(Keyword.CON ST, ASTFactory.typeName3("C", []), []));
1540 }
1541 void test_visitInstanceCreationExpression_named() {
1542 assertSource("new C.c()", ASTFactory.instanceCreationExpression3(Keyword.NEW , ASTFactory.typeName3("C", []), "c", []));
1543 }
1544 void test_visitInstanceCreationExpression_unnamed() {
1545 assertSource("new C()", ASTFactory.instanceCreationExpression2(Keyword.NEW, ASTFactory.typeName3("C", []), []));
1546 }
1547 void test_visitIntegerLiteral() {
1548 assertSource("42", ASTFactory.integer(42));
1549 }
1550 void test_visitInterpolationExpression_expression() {
1551 assertSource("\${a}", ASTFactory.interpolationExpression(ASTFactory.identifi er2("a")));
1552 }
1553 void test_visitInterpolationExpression_identifier() {
1554 assertSource("\$a", ASTFactory.interpolationExpression2("a"));
1555 }
1556 void test_visitInterpolationString() {
1557 assertSource("'x", ASTFactory.interpolationString("'x", "x"));
1558 }
1559 void test_visitIsExpression_negated() {
1560 assertSource("a is! C", ASTFactory.isExpression(ASTFactory.identifier2("a"), true, ASTFactory.typeName3("C", [])));
1561 }
1562 void test_visitIsExpression_normal() {
1563 assertSource("a is C", ASTFactory.isExpression(ASTFactory.identifier2("a"), false, ASTFactory.typeName3("C", [])));
1564 }
1565 void test_visitLabel() {
1566 assertSource("a:", ASTFactory.label("a"));
1567 }
1568 void test_visitLabeledStatement_multiple() {
1569 assertSource("a: b: return;", ASTFactory.labeledStatement(ASTFactory.list([A STFactory.label("a"), ASTFactory.label("b")]), ASTFactory.returnStatement()));
1570 }
1571 void test_visitLabeledStatement_single() {
1572 assertSource("a: return;", ASTFactory.labeledStatement(ASTFactory.list([ASTF actory.label("a")]), ASTFactory.returnStatement()));
1573 }
1574 void test_visitLibraryDirective() {
1575 assertSource("library l;", ASTFactory.libraryDirective2("l"));
1576 }
1577 void test_visitLibraryIdentifier_multiple() {
1578 assertSource("a.b.c", ASTFactory.libraryIdentifier([ASTFactory.identifier2(" a"), ASTFactory.identifier2("b"), ASTFactory.identifier2("c")]));
1579 }
1580 void test_visitLibraryIdentifier_single() {
1581 assertSource("a", ASTFactory.libraryIdentifier([ASTFactory.identifier2("a")] ));
1582 }
1583 void test_visitListLiteral_const() {
1584 assertSource("const []", ASTFactory.listLiteral2(Keyword.CONST, null, []));
1585 }
1586 void test_visitListLiteral_empty() {
1587 assertSource("[]", ASTFactory.listLiteral([]));
1588 }
1589 void test_visitListLiteral_nonEmpty() {
1590 assertSource("[a, b, c]", ASTFactory.listLiteral([ASTFactory.identifier2("a" ), ASTFactory.identifier2("b"), ASTFactory.identifier2("c")]));
1591 }
1592 void test_visitMapLiteral_const() {
1593 assertSource("const {}", ASTFactory.mapLiteral(Keyword.CONST, null, []));
1594 }
1595 void test_visitMapLiteral_empty() {
1596 assertSource("{}", ASTFactory.mapLiteral2([]));
1597 }
1598 void test_visitMapLiteral_nonEmpty() {
1599 assertSource("{'a' : a, 'b' : b, 'c' : c}", ASTFactory.mapLiteral2([ASTFacto ry.mapLiteralEntry("a", ASTFactory.identifier2("a")), ASTFactory.mapLiteralEntry ("b", ASTFactory.identifier2("b")), ASTFactory.mapLiteralEntry("c", ASTFactory.i dentifier2("c"))]));
1600 }
1601 void test_visitMapLiteralEntry() {
1602 assertSource("'a' : b", ASTFactory.mapLiteralEntry("a", ASTFactory.identifie r2("b")));
1603 }
1604 void test_visitMethodDeclaration_external() {
1605 assertSource("external m();", ASTFactory.methodDeclaration(null, null, null, null, ASTFactory.identifier2("m"), ASTFactory.formalParameterList([])));
1606 }
1607 void test_visitMethodDeclaration_external_returnType() {
1608 assertSource("external T m();", ASTFactory.methodDeclaration(null, ASTFactor y.typeName3("T", []), null, null, ASTFactory.identifier2("m"), ASTFactory.formal ParameterList([])));
1609 }
1610 void test_visitMethodDeclaration_getter() {
1611 assertSource("get m {}", ASTFactory.methodDeclaration2(null, null, Keyword.G ET, null, ASTFactory.identifier2("m"), null, ASTFactory.blockFunctionBody([])));
1612 }
1613 void test_visitMethodDeclaration_getter_returnType() {
1614 assertSource("T get m {}", ASTFactory.methodDeclaration2(null, ASTFactory.ty peName3("T", []), Keyword.GET, null, ASTFactory.identifier2("m"), null, ASTFacto ry.blockFunctionBody([])));
1615 }
1616 void test_visitMethodDeclaration_getter_seturnType() {
1617 assertSource("T set m(var v) {}", ASTFactory.methodDeclaration2(null, ASTFac tory.typeName3("T", []), Keyword.SET, null, ASTFactory.identifier2("m"), ASTFact ory.formalParameterList([ASTFactory.simpleFormalParameter(Keyword.VAR, "v")]), A STFactory.blockFunctionBody([])));
1618 }
1619 void test_visitMethodDeclaration_minimal() {
1620 assertSource("m() {}", ASTFactory.methodDeclaration2(null, null, null, null, ASTFactory.identifier2("m"), ASTFactory.formalParameterList([]), ASTFactory.blo ckFunctionBody([])));
1621 }
1622 void test_visitMethodDeclaration_multipleParameters() {
1623 assertSource("m(var a, var b) {}", ASTFactory.methodDeclaration2(null, null, null, null, ASTFactory.identifier2("m"), ASTFactory.formalParameterList([ASTFac tory.simpleFormalParameter(Keyword.VAR, "a"), ASTFactory.simpleFormalParameter(K eyword.VAR, "b")]), ASTFactory.blockFunctionBody([])));
1624 }
1625 void test_visitMethodDeclaration_operator() {
1626 assertSource("operator +() {}", ASTFactory.methodDeclaration2(null, null, nu ll, Keyword.OPERATOR, ASTFactory.identifier2("+"), ASTFactory.formalParameterLis t([]), ASTFactory.blockFunctionBody([])));
1627 }
1628 void test_visitMethodDeclaration_operator_returnType() {
1629 assertSource("T operator +() {}", ASTFactory.methodDeclaration2(null, ASTFac tory.typeName3("T", []), null, Keyword.OPERATOR, ASTFactory.identifier2("+"), AS TFactory.formalParameterList([]), ASTFactory.blockFunctionBody([])));
1630 }
1631 void test_visitMethodDeclaration_returnType() {
1632 assertSource("T m() {}", ASTFactory.methodDeclaration2(null, ASTFactory.type Name3("T", []), null, null, ASTFactory.identifier2("m"), ASTFactory.formalParame terList([]), ASTFactory.blockFunctionBody([])));
1633 }
1634 void test_visitMethodDeclaration_setter() {
1635 assertSource("set m(var v) {}", ASTFactory.methodDeclaration2(null, null, Ke yword.SET, null, ASTFactory.identifier2("m"), ASTFactory.formalParameterList([AS TFactory.simpleFormalParameter(Keyword.VAR, "v")]), ASTFactory.blockFunctionBody ([])));
1636 }
1637 void test_visitMethodDeclaration_static() {
1638 assertSource("static m() {}", ASTFactory.methodDeclaration2(Keyword.STATIC, null, null, null, ASTFactory.identifier2("m"), ASTFactory.formalParameterList([] ), ASTFactory.blockFunctionBody([])));
1639 }
1640 void test_visitMethodDeclaration_static_returnType() {
1641 assertSource("static T m() {}", ASTFactory.methodDeclaration2(Keyword.STATIC , ASTFactory.typeName3("T", []), null, null, ASTFactory.identifier2("m"), ASTFac tory.formalParameterList([]), ASTFactory.blockFunctionBody([])));
1642 }
1643 void test_visitMethodInvocation_noTarget() {
1644 assertSource("m()", ASTFactory.methodInvocation2("m", []));
1645 }
1646 void test_visitMethodInvocation_target() {
1647 assertSource("t.m()", ASTFactory.methodInvocation(ASTFactory.identifier2("t" ), "m", []));
1648 }
1649 void test_visitNamedExpression() {
1650 assertSource("a: b", ASTFactory.namedExpression("a", ASTFactory.identifier2( "b")));
1651 }
1652 void test_visitNamedFormalParameter() {
1653 assertSource("var a : 0", ASTFactory.namedFormalParameter(ASTFactory.simpleF ormalParameter(Keyword.VAR, "a"), ASTFactory.integer(0)));
1654 }
1655 void test_visitNullLiteral() {
1656 assertSource("null", ASTFactory.nullLiteral());
1657 }
1658 void test_visitParenthesizedExpression() {
1659 assertSource("(a)", ASTFactory.parenthesizedExpression(ASTFactory.identifier 2("a")));
1660 }
1661 void test_visitPartDirective() {
1662 assertSource("part 'a.dart';", ASTFactory.partDirective2("a.dart"));
1663 }
1664 void test_visitPartOfDirective() {
1665 assertSource("part of l;", ASTFactory.partOfDirective(ASTFactory.libraryIden tifier2(["l"])));
1666 }
1667 void test_visitPositionalFormalParameter() {
1668 assertSource("var a = 0", ASTFactory.positionalFormalParameter(ASTFactory.si mpleFormalParameter(Keyword.VAR, "a"), ASTFactory.integer(0)));
1669 }
1670 void test_visitPostfixExpression() {
1671 assertSource("a++", ASTFactory.postfixExpression(ASTFactory.identifier2("a") , TokenType.PLUS_PLUS));
1672 }
1673 void test_visitPrefixedIdentifier() {
1674 assertSource("a.b", ASTFactory.identifier4("a", "b"));
1675 }
1676 void test_visitPrefixExpression() {
1677 assertSource("-a", ASTFactory.prefixExpression(TokenType.MINUS, ASTFactory.i dentifier2("a")));
1678 }
1679 void test_visitPropertyAccess() {
1680 assertSource("a.b", ASTFactory.propertyAccess2(ASTFactory.identifier2("a"), "b"));
1681 }
1682 void test_visitRedirectingConstructorInvocation_named() {
1683 assertSource("this.c()", ASTFactory.redirectingConstructorInvocation2("c", [ ]));
1684 }
1685 void test_visitRedirectingConstructorInvocation_unnamed() {
1686 assertSource("this()", ASTFactory.redirectingConstructorInvocation([]));
1687 }
1688 void test_visitReturnStatement_expression() {
1689 assertSource("return a;", ASTFactory.returnStatement2(ASTFactory.identifier2 ("a")));
1690 }
1691 void test_visitReturnStatement_noExpression() {
1692 assertSource("return;", ASTFactory.returnStatement());
1693 }
1694 void test_visitScriptTag() {
1695 String scriptTag = "!#/bin/dart.exe";
1696 assertSource(scriptTag, ASTFactory.scriptTag(scriptTag));
1697 }
1698 void test_visitSimpleFormalParameter_keyword() {
1699 assertSource("var a", ASTFactory.simpleFormalParameter(Keyword.VAR, "a"));
1700 }
1701 void test_visitSimpleFormalParameter_keyword_type() {
1702 assertSource("final A a", ASTFactory.simpleFormalParameter2(Keyword.FINAL, A STFactory.typeName3("A", []), "a"));
1703 }
1704 void test_visitSimpleFormalParameter_type() {
1705 assertSource("A a", ASTFactory.simpleFormalParameter4(ASTFactory.typeName3(" A", []), "a"));
1706 }
1707 void test_visitSimpleIdentifier() {
1708 assertSource("a", ASTFactory.identifier2("a"));
1709 }
1710 void test_visitSimpleStringLiteral() {
1711 assertSource("'a'", ASTFactory.string2("a"));
1712 }
1713 void test_visitStringInterpolation() {
1714 assertSource("'a\${e}b'", ASTFactory.string([ASTFactory.interpolationString( "'a", "a"), ASTFactory.interpolationExpression(ASTFactory.identifier2("e")), AST Factory.interpolationString("b'", "b")]));
1715 }
1716 void test_visitSuperConstructorInvocation() {
1717 assertSource("super()", ASTFactory.superConstructorInvocation([]));
1718 }
1719 void test_visitSuperConstructorInvocation_named() {
1720 assertSource("super.c()", ASTFactory.superConstructorInvocation2("c", []));
1721 }
1722 void test_visitSuperExpression() {
1723 assertSource("super", ASTFactory.superExpression());
1724 }
1725 void test_visitSwitchCase_multipleLabels() {
1726 assertSource("l1: l2: case a: {}", ASTFactory.switchCase2(ASTFactory.list([A STFactory.label("l1"), ASTFactory.label("l2")]), ASTFactory.identifier2("a"), [A STFactory.block([])]));
1727 }
1728 void test_visitSwitchCase_multipleStatements() {
1729 assertSource("case a: {} {}", ASTFactory.switchCase(ASTFactory.identifier2(" a"), [ASTFactory.block([]), ASTFactory.block([])]));
1730 }
1731 void test_visitSwitchCase_noLabels() {
1732 assertSource("case a: {}", ASTFactory.switchCase(ASTFactory.identifier2("a") , [ASTFactory.block([])]));
1733 }
1734 void test_visitSwitchCase_singleLabel() {
1735 assertSource("l1: case a: {}", ASTFactory.switchCase2(ASTFactory.list([ASTFa ctory.label("l1")]), ASTFactory.identifier2("a"), [ASTFactory.block([])]));
1736 }
1737 void test_visitSwitchDefault_multipleLabels() {
1738 assertSource("l1: l2: default: {}", ASTFactory.switchDefault(ASTFactory.list ([ASTFactory.label("l1"), ASTFactory.label("l2")]), [ASTFactory.block([])]));
1739 }
1740 void test_visitSwitchDefault_multipleStatements() {
1741 assertSource("default: {} {}", ASTFactory.switchDefault2([ASTFactory.block([ ]), ASTFactory.block([])]));
1742 }
1743 void test_visitSwitchDefault_noLabels() {
1744 assertSource("default: {}", ASTFactory.switchDefault2([ASTFactory.block([])] ));
1745 }
1746 void test_visitSwitchDefault_singleLabel() {
1747 assertSource("l1: default: {}", ASTFactory.switchDefault(ASTFactory.list([AS TFactory.label("l1")]), [ASTFactory.block([])]));
1748 }
1749 void test_visitSwitchStatement() {
1750 assertSource("switch (a) {case 'b': {} default: {}}", ASTFactory.switchState ment(ASTFactory.identifier2("a"), [ASTFactory.switchCase(ASTFactory.string2("b") , [ASTFactory.block([])]), ASTFactory.switchDefault2([ASTFactory.block([])])]));
1751 }
1752 void test_visitThisExpression() {
1753 assertSource("this", ASTFactory.thisExpression());
1754 }
1755 void test_visitThrowStatement() {
1756 assertSource("throw e", ASTFactory.throwExpression2(ASTFactory.identifier2(" e")));
1757 }
1758 void test_visitTopLevelVariableDeclaration_multiple() {
1759 assertSource("var a;", ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [ASTFactory.variableDeclaration("a")]));
1760 }
1761 void test_visitTopLevelVariableDeclaration_single() {
1762 assertSource("var a, b;", ASTFactory.topLevelVariableDeclaration2(Keyword.VA R, [ASTFactory.variableDeclaration("a"), ASTFactory.variableDeclaration("b")]));
1763 }
1764 void test_visitTryStatement_catch() {
1765 assertSource("try {} on E {}", ASTFactory.tryStatement2(ASTFactory.block([]) , [ASTFactory.catchClause3(ASTFactory.typeName3("E", []), [])]));
1766 }
1767 void test_visitTryStatement_catches() {
1768 assertSource("try {} on E {} on F {}", ASTFactory.tryStatement2(ASTFactory.b lock([]), [ASTFactory.catchClause3(ASTFactory.typeName3("E", []), []), ASTFactor y.catchClause3(ASTFactory.typeName3("F", []), [])]));
1769 }
1770 void test_visitTryStatement_catchFinally() {
1771 assertSource("try {} on E {} finally {}", ASTFactory.tryStatement3(ASTFactor y.block([]), ASTFactory.list([ASTFactory.catchClause3(ASTFactory.typeName3("E", []), [])]), ASTFactory.block([])));
1772 }
1773 void test_visitTryStatement_finally() {
1774 assertSource("try {} finally {}", ASTFactory.tryStatement(ASTFactory.block([ ]), ASTFactory.block([])));
1775 }
1776 void test_visitTypeAlias_generic() {
1777 assertSource("typedef A F<B>();", ASTFactory.typeAlias(ASTFactory.typeName3( "A", []), "F", ASTFactory.typeParameterList(["B"]), ASTFactory.formalParameterLi st([])));
1778 }
1779 void test_visitTypeAlias_nonGeneric() {
1780 assertSource("typedef A F();", ASTFactory.typeAlias(ASTFactory.typeName3("A" , []), "F", null, ASTFactory.formalParameterList([])));
1781 }
1782 void test_visitTypeArgumentList_multiple() {
1783 assertSource("<E, F>", ASTFactory.typeArgumentList([ASTFactory.typeName3("E" , []), ASTFactory.typeName3("F", [])]));
1784 }
1785 void test_visitTypeArgumentList_single() {
1786 assertSource("<E>", ASTFactory.typeArgumentList([ASTFactory.typeName3("E", [ ])]));
1787 }
1788 void test_visitTypeName_multipleArgs() {
1789 assertSource("C<D, E>", ASTFactory.typeName3("C", [ASTFactory.typeName3("D", []), ASTFactory.typeName3("E", [])]));
1790 }
1791 void test_visitTypeName_nestedArg() {
1792 assertSource("C<D<E>>", ASTFactory.typeName3("C", [ASTFactory.typeName3("D", [ASTFactory.typeName3("E", [])])]));
1793 }
1794 void test_visitTypeName_noArgs() {
1795 assertSource("C", ASTFactory.typeName3("C", []));
1796 }
1797 void test_visitTypeName_singleArg() {
1798 assertSource("C<D>", ASTFactory.typeName3("C", [ASTFactory.typeName3("D", [] )]));
1799 }
1800 void test_visitTypeParameter_withExtends() {
1801 assertSource("E extends C", ASTFactory.typeParameter2("E", ASTFactory.typeNa me3("C", [])));
1802 }
1803 void test_visitTypeParameter_withoutExtends() {
1804 assertSource("E", ASTFactory.typeParameter("E"));
1805 }
1806 void test_visitTypeParameterList_multiple() {
1807 assertSource("<E, F>", ASTFactory.typeParameterList(["E", "F"]));
1808 }
1809 void test_visitTypeParameterList_single() {
1810 assertSource("<E>", ASTFactory.typeParameterList(["E"]));
1811 }
1812 void test_visitVariableDeclaration_initialized() {
1813 assertSource("a = b", ASTFactory.variableDeclaration2("a", ASTFactory.identi fier2("b")));
1814 }
1815 void test_visitVariableDeclaration_uninitialized() {
1816 assertSource("a", ASTFactory.variableDeclaration("a"));
1817 }
1818 void test_visitVariableDeclarationList_const_type() {
1819 assertSource("const C a, b", ASTFactory.variableDeclarationList(Keyword.CONS T, ASTFactory.typeName3("C", []), [ASTFactory.variableDeclaration("a"), ASTFacto ry.variableDeclaration("b")]));
1820 }
1821 void test_visitVariableDeclarationList_final_noType() {
1822 assertSource("final a, b", ASTFactory.variableDeclarationList2(Keyword.FINAL , [ASTFactory.variableDeclaration("a"), ASTFactory.variableDeclaration("b")]));
1823 }
1824 void test_visitVariableDeclarationList_type() {
1825 assertSource("C a, b", ASTFactory.variableDeclarationList(null, ASTFactory.t ypeName3("C", []), [ASTFactory.variableDeclaration("a"), ASTFactory.variableDecl aration("b")]));
1826 }
1827 void test_visitVariableDeclarationList_var() {
1828 assertSource("var a, b", ASTFactory.variableDeclarationList2(Keyword.VAR, [A STFactory.variableDeclaration("a"), ASTFactory.variableDeclaration("b")]));
1829 }
1830 void test_visitVariableDeclarationStatement() {
1831 assertSource("C c;", ASTFactory.variableDeclarationStatement(null, ASTFactor y.typeName3("C", []), [ASTFactory.variableDeclaration("c")]));
1832 }
1833 void test_visitWhileStatement() {
1834 assertSource("while (c) {}", ASTFactory.whileStatement(ASTFactory.identifier 2("c"), ASTFactory.block([])));
1835 }
1836 void test_visitWithClause_multiple() {
1837 assertSource("with A, B, C", ASTFactory.withClause([ASTFactory.typeName3("A" , []), ASTFactory.typeName3("B", []), ASTFactory.typeName3("C", [])]));
1838 }
1839 void test_visitWithClause_single() {
1840 assertSource("with A", ASTFactory.withClause([ASTFactory.typeName3("A", [])] ));
1841 }
1842 /**
1843 * Assert that a {@code ToSourceVisitor} will produce the expected source when visiting the given
1844 * node.
1845 * @param expectedSource the source string that the visitor is expected to pro duce
1846 * @param node the AST node being visited to produce the actual source
1847 * @throws AFE if the visitor does not produce the expected source for the giv en node
1848 */
1849 void assertSource(String expectedSource, ASTNode node) {
1850 PrintStringWriter writer = new PrintStringWriter();
1851 node.accept(new ToSourceVisitor(writer));
1852 JUnitTestCase.assertEquals(expectedSource, writer.toString());
1853 }
1854 static dartSuite() {
1855 _ut.group('ToSourceVisitorTest', () {
1856 _ut.test('test_visitAdjacentStrings', () {
1857 final __test = new ToSourceVisitorTest();
1858 runJUnitTest(__test, __test.test_visitAdjacentStrings);
1859 });
1860 _ut.test('test_visitAnnotation_constant', () {
1861 final __test = new ToSourceVisitorTest();
1862 runJUnitTest(__test, __test.test_visitAnnotation_constant);
1863 });
1864 _ut.test('test_visitAnnotation_constructor', () {
1865 final __test = new ToSourceVisitorTest();
1866 runJUnitTest(__test, __test.test_visitAnnotation_constructor);
1867 });
1868 _ut.test('test_visitArgumentDefinitionTest', () {
1869 final __test = new ToSourceVisitorTest();
1870 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest);
1871 });
1872 _ut.test('test_visitArgumentList', () {
1873 final __test = new ToSourceVisitorTest();
1874 runJUnitTest(__test, __test.test_visitArgumentList);
1875 });
1876 _ut.test('test_visitAsExpression', () {
1877 final __test = new ToSourceVisitorTest();
1878 runJUnitTest(__test, __test.test_visitAsExpression);
1879 });
1880 _ut.test('test_visitAssertStatement', () {
1881 final __test = new ToSourceVisitorTest();
1882 runJUnitTest(__test, __test.test_visitAssertStatement);
1883 });
1884 _ut.test('test_visitAssignmentExpression', () {
1885 final __test = new ToSourceVisitorTest();
1886 runJUnitTest(__test, __test.test_visitAssignmentExpression);
1887 });
1888 _ut.test('test_visitBinaryExpression', () {
1889 final __test = new ToSourceVisitorTest();
1890 runJUnitTest(__test, __test.test_visitBinaryExpression);
1891 });
1892 _ut.test('test_visitBlockFunctionBody', () {
1893 final __test = new ToSourceVisitorTest();
1894 runJUnitTest(__test, __test.test_visitBlockFunctionBody);
1895 });
1896 _ut.test('test_visitBlock_empty', () {
1897 final __test = new ToSourceVisitorTest();
1898 runJUnitTest(__test, __test.test_visitBlock_empty);
1899 });
1900 _ut.test('test_visitBlock_nonEmpty', () {
1901 final __test = new ToSourceVisitorTest();
1902 runJUnitTest(__test, __test.test_visitBlock_nonEmpty);
1903 });
1904 _ut.test('test_visitBooleanLiteral_false', () {
1905 final __test = new ToSourceVisitorTest();
1906 runJUnitTest(__test, __test.test_visitBooleanLiteral_false);
1907 });
1908 _ut.test('test_visitBooleanLiteral_true', () {
1909 final __test = new ToSourceVisitorTest();
1910 runJUnitTest(__test, __test.test_visitBooleanLiteral_true);
1911 });
1912 _ut.test('test_visitBreakStatement_label', () {
1913 final __test = new ToSourceVisitorTest();
1914 runJUnitTest(__test, __test.test_visitBreakStatement_label);
1915 });
1916 _ut.test('test_visitBreakStatement_noLabel', () {
1917 final __test = new ToSourceVisitorTest();
1918 runJUnitTest(__test, __test.test_visitBreakStatement_noLabel);
1919 });
1920 _ut.test('test_visitCascadeExpression_field', () {
1921 final __test = new ToSourceVisitorTest();
1922 runJUnitTest(__test, __test.test_visitCascadeExpression_field);
1923 });
1924 _ut.test('test_visitCascadeExpression_index', () {
1925 final __test = new ToSourceVisitorTest();
1926 runJUnitTest(__test, __test.test_visitCascadeExpression_index);
1927 });
1928 _ut.test('test_visitCascadeExpression_method', () {
1929 final __test = new ToSourceVisitorTest();
1930 runJUnitTest(__test, __test.test_visitCascadeExpression_method);
1931 });
1932 _ut.test('test_visitCatchClause_catch_noStack', () {
1933 final __test = new ToSourceVisitorTest();
1934 runJUnitTest(__test, __test.test_visitCatchClause_catch_noStack);
1935 });
1936 _ut.test('test_visitCatchClause_catch_stack', () {
1937 final __test = new ToSourceVisitorTest();
1938 runJUnitTest(__test, __test.test_visitCatchClause_catch_stack);
1939 });
1940 _ut.test('test_visitCatchClause_on', () {
1941 final __test = new ToSourceVisitorTest();
1942 runJUnitTest(__test, __test.test_visitCatchClause_on);
1943 });
1944 _ut.test('test_visitCatchClause_on_catch', () {
1945 final __test = new ToSourceVisitorTest();
1946 runJUnitTest(__test, __test.test_visitCatchClause_on_catch);
1947 });
1948 _ut.test('test_visitClassDeclaration_abstract', () {
1949 final __test = new ToSourceVisitorTest();
1950 runJUnitTest(__test, __test.test_visitClassDeclaration_abstract);
1951 });
1952 _ut.test('test_visitClassDeclaration_empty', () {
1953 final __test = new ToSourceVisitorTest();
1954 runJUnitTest(__test, __test.test_visitClassDeclaration_empty);
1955 });
1956 _ut.test('test_visitClassDeclaration_extends', () {
1957 final __test = new ToSourceVisitorTest();
1958 runJUnitTest(__test, __test.test_visitClassDeclaration_extends);
1959 });
1960 _ut.test('test_visitClassDeclaration_extends_implements', () {
1961 final __test = new ToSourceVisitorTest();
1962 runJUnitTest(__test, __test.test_visitClassDeclaration_extends_implement s);
1963 });
1964 _ut.test('test_visitClassDeclaration_extends_with', () {
1965 final __test = new ToSourceVisitorTest();
1966 runJUnitTest(__test, __test.test_visitClassDeclaration_extends_with);
1967 });
1968 _ut.test('test_visitClassDeclaration_extends_with_implements', () {
1969 final __test = new ToSourceVisitorTest();
1970 runJUnitTest(__test, __test.test_visitClassDeclaration_extends_with_impl ements);
1971 });
1972 _ut.test('test_visitClassDeclaration_implements', () {
1973 final __test = new ToSourceVisitorTest();
1974 runJUnitTest(__test, __test.test_visitClassDeclaration_implements);
1975 });
1976 _ut.test('test_visitClassDeclaration_multipleMember', () {
1977 final __test = new ToSourceVisitorTest();
1978 runJUnitTest(__test, __test.test_visitClassDeclaration_multipleMember);
1979 });
1980 _ut.test('test_visitClassDeclaration_parameters', () {
1981 final __test = new ToSourceVisitorTest();
1982 runJUnitTest(__test, __test.test_visitClassDeclaration_parameters);
1983 });
1984 _ut.test('test_visitClassDeclaration_parameters_extends', () {
1985 final __test = new ToSourceVisitorTest();
1986 runJUnitTest(__test, __test.test_visitClassDeclaration_parameters_extend s);
1987 });
1988 _ut.test('test_visitClassDeclaration_parameters_extends_implements', () {
1989 final __test = new ToSourceVisitorTest();
1990 runJUnitTest(__test, __test.test_visitClassDeclaration_parameters_extend s_implements);
1991 });
1992 _ut.test('test_visitClassDeclaration_parameters_extends_with', () {
1993 final __test = new ToSourceVisitorTest();
1994 runJUnitTest(__test, __test.test_visitClassDeclaration_parameters_extend s_with);
1995 });
1996 _ut.test('test_visitClassDeclaration_parameters_extends_with_implements', () {
1997 final __test = new ToSourceVisitorTest();
1998 runJUnitTest(__test, __test.test_visitClassDeclaration_parameters_extend s_with_implements);
1999 });
2000 _ut.test('test_visitClassDeclaration_parameters_implements', () {
2001 final __test = new ToSourceVisitorTest();
2002 runJUnitTest(__test, __test.test_visitClassDeclaration_parameters_implem ents);
2003 });
2004 _ut.test('test_visitClassDeclaration_singleMember', () {
2005 final __test = new ToSourceVisitorTest();
2006 runJUnitTest(__test, __test.test_visitClassDeclaration_singleMember);
2007 });
2008 _ut.test('test_visitClassTypeAlias_abstract', () {
2009 final __test = new ToSourceVisitorTest();
2010 runJUnitTest(__test, __test.test_visitClassTypeAlias_abstract);
2011 });
2012 _ut.test('test_visitClassTypeAlias_abstract_implements', () {
2013 final __test = new ToSourceVisitorTest();
2014 runJUnitTest(__test, __test.test_visitClassTypeAlias_abstract_implements );
2015 });
2016 _ut.test('test_visitClassTypeAlias_generic', () {
2017 final __test = new ToSourceVisitorTest();
2018 runJUnitTest(__test, __test.test_visitClassTypeAlias_generic);
2019 });
2020 _ut.test('test_visitClassTypeAlias_implements', () {
2021 final __test = new ToSourceVisitorTest();
2022 runJUnitTest(__test, __test.test_visitClassTypeAlias_implements);
2023 });
2024 _ut.test('test_visitClassTypeAlias_minimal', () {
2025 final __test = new ToSourceVisitorTest();
2026 runJUnitTest(__test, __test.test_visitClassTypeAlias_minimal);
2027 });
2028 _ut.test('test_visitClassTypeAlias_parameters_abstract', () {
2029 final __test = new ToSourceVisitorTest();
2030 runJUnitTest(__test, __test.test_visitClassTypeAlias_parameters_abstract );
2031 });
2032 _ut.test('test_visitClassTypeAlias_parameters_abstract_implements', () {
2033 final __test = new ToSourceVisitorTest();
2034 runJUnitTest(__test, __test.test_visitClassTypeAlias_parameters_abstract _implements);
2035 });
2036 _ut.test('test_visitClassTypeAlias_parameters_implements', () {
2037 final __test = new ToSourceVisitorTest();
2038 runJUnitTest(__test, __test.test_visitClassTypeAlias_parameters_implemen ts);
2039 });
2040 _ut.test('test_visitComment', () {
2041 final __test = new ToSourceVisitorTest();
2042 runJUnitTest(__test, __test.test_visitComment);
2043 });
2044 _ut.test('test_visitCommentReference', () {
2045 final __test = new ToSourceVisitorTest();
2046 runJUnitTest(__test, __test.test_visitCommentReference);
2047 });
2048 _ut.test('test_visitCompilationUnit_declaration', () {
2049 final __test = new ToSourceVisitorTest();
2050 runJUnitTest(__test, __test.test_visitCompilationUnit_declaration);
2051 });
2052 _ut.test('test_visitCompilationUnit_directive', () {
2053 final __test = new ToSourceVisitorTest();
2054 runJUnitTest(__test, __test.test_visitCompilationUnit_directive);
2055 });
2056 _ut.test('test_visitCompilationUnit_directive_declaration', () {
2057 final __test = new ToSourceVisitorTest();
2058 runJUnitTest(__test, __test.test_visitCompilationUnit_directive_declarat ion);
2059 });
2060 _ut.test('test_visitCompilationUnit_empty', () {
2061 final __test = new ToSourceVisitorTest();
2062 runJUnitTest(__test, __test.test_visitCompilationUnit_empty);
2063 });
2064 _ut.test('test_visitCompilationUnit_script', () {
2065 final __test = new ToSourceVisitorTest();
2066 runJUnitTest(__test, __test.test_visitCompilationUnit_script);
2067 });
2068 _ut.test('test_visitCompilationUnit_script_declaration', () {
2069 final __test = new ToSourceVisitorTest();
2070 runJUnitTest(__test, __test.test_visitCompilationUnit_script_declaration );
2071 });
2072 _ut.test('test_visitCompilationUnit_script_directive', () {
2073 final __test = new ToSourceVisitorTest();
2074 runJUnitTest(__test, __test.test_visitCompilationUnit_script_directive);
2075 });
2076 _ut.test('test_visitCompilationUnit_script_directives_declarations', () {
2077 final __test = new ToSourceVisitorTest();
2078 runJUnitTest(__test, __test.test_visitCompilationUnit_script_directives_ declarations);
2079 });
2080 _ut.test('test_visitConditionalExpression', () {
2081 final __test = new ToSourceVisitorTest();
2082 runJUnitTest(__test, __test.test_visitConditionalExpression);
2083 });
2084 _ut.test('test_visitConstructorDeclaration_const', () {
2085 final __test = new ToSourceVisitorTest();
2086 runJUnitTest(__test, __test.test_visitConstructorDeclaration_const);
2087 });
2088 _ut.test('test_visitConstructorDeclaration_external', () {
2089 final __test = new ToSourceVisitorTest();
2090 runJUnitTest(__test, __test.test_visitConstructorDeclaration_external);
2091 });
2092 _ut.test('test_visitConstructorDeclaration_minimal', () {
2093 final __test = new ToSourceVisitorTest();
2094 runJUnitTest(__test, __test.test_visitConstructorDeclaration_minimal);
2095 });
2096 _ut.test('test_visitConstructorDeclaration_multipleInitializers', () {
2097 final __test = new ToSourceVisitorTest();
2098 runJUnitTest(__test, __test.test_visitConstructorDeclaration_multipleIni tializers);
2099 });
2100 _ut.test('test_visitConstructorDeclaration_multipleParameters', () {
2101 final __test = new ToSourceVisitorTest();
2102 runJUnitTest(__test, __test.test_visitConstructorDeclaration_multiplePar ameters);
2103 });
2104 _ut.test('test_visitConstructorDeclaration_named', () {
2105 final __test = new ToSourceVisitorTest();
2106 runJUnitTest(__test, __test.test_visitConstructorDeclaration_named);
2107 });
2108 _ut.test('test_visitConstructorDeclaration_singleInitializer', () {
2109 final __test = new ToSourceVisitorTest();
2110 runJUnitTest(__test, __test.test_visitConstructorDeclaration_singleIniti alizer);
2111 });
2112 _ut.test('test_visitConstructorFieldInitializer_withThis', () {
2113 final __test = new ToSourceVisitorTest();
2114 runJUnitTest(__test, __test.test_visitConstructorFieldInitializer_withTh is);
2115 });
2116 _ut.test('test_visitConstructorFieldInitializer_withoutThis', () {
2117 final __test = new ToSourceVisitorTest();
2118 runJUnitTest(__test, __test.test_visitConstructorFieldInitializer_withou tThis);
2119 });
2120 _ut.test('test_visitConstructorName_named_prefix', () {
2121 final __test = new ToSourceVisitorTest();
2122 runJUnitTest(__test, __test.test_visitConstructorName_named_prefix);
2123 });
2124 _ut.test('test_visitConstructorName_unnamed_noPrefix', () {
2125 final __test = new ToSourceVisitorTest();
2126 runJUnitTest(__test, __test.test_visitConstructorName_unnamed_noPrefix);
2127 });
2128 _ut.test('test_visitConstructorName_unnamed_prefix', () {
2129 final __test = new ToSourceVisitorTest();
2130 runJUnitTest(__test, __test.test_visitConstructorName_unnamed_prefix);
2131 });
2132 _ut.test('test_visitContinueStatement_label', () {
2133 final __test = new ToSourceVisitorTest();
2134 runJUnitTest(__test, __test.test_visitContinueStatement_label);
2135 });
2136 _ut.test('test_visitContinueStatement_noLabel', () {
2137 final __test = new ToSourceVisitorTest();
2138 runJUnitTest(__test, __test.test_visitContinueStatement_noLabel);
2139 });
2140 _ut.test('test_visitDefaultFormalParameter_named_noValue', () {
2141 final __test = new ToSourceVisitorTest();
2142 runJUnitTest(__test, __test.test_visitDefaultFormalParameter_named_noVal ue);
2143 });
2144 _ut.test('test_visitDefaultFormalParameter_named_value', () {
2145 final __test = new ToSourceVisitorTest();
2146 runJUnitTest(__test, __test.test_visitDefaultFormalParameter_named_value );
2147 });
2148 _ut.test('test_visitDefaultFormalParameter_positional_noValue', () {
2149 final __test = new ToSourceVisitorTest();
2150 runJUnitTest(__test, __test.test_visitDefaultFormalParameter_positional_ noValue);
2151 });
2152 _ut.test('test_visitDefaultFormalParameter_positional_value', () {
2153 final __test = new ToSourceVisitorTest();
2154 runJUnitTest(__test, __test.test_visitDefaultFormalParameter_positional_ value);
2155 });
2156 _ut.test('test_visitDoStatement', () {
2157 final __test = new ToSourceVisitorTest();
2158 runJUnitTest(__test, __test.test_visitDoStatement);
2159 });
2160 _ut.test('test_visitDoubleLiteral', () {
2161 final __test = new ToSourceVisitorTest();
2162 runJUnitTest(__test, __test.test_visitDoubleLiteral);
2163 });
2164 _ut.test('test_visitEmptyFunctionBody', () {
2165 final __test = new ToSourceVisitorTest();
2166 runJUnitTest(__test, __test.test_visitEmptyFunctionBody);
2167 });
2168 _ut.test('test_visitEmptyStatement', () {
2169 final __test = new ToSourceVisitorTest();
2170 runJUnitTest(__test, __test.test_visitEmptyStatement);
2171 });
2172 _ut.test('test_visitExportDirective_combinator', () {
2173 final __test = new ToSourceVisitorTest();
2174 runJUnitTest(__test, __test.test_visitExportDirective_combinator);
2175 });
2176 _ut.test('test_visitExportDirective_combinators', () {
2177 final __test = new ToSourceVisitorTest();
2178 runJUnitTest(__test, __test.test_visitExportDirective_combinators);
2179 });
2180 _ut.test('test_visitExportDirective_minimal', () {
2181 final __test = new ToSourceVisitorTest();
2182 runJUnitTest(__test, __test.test_visitExportDirective_minimal);
2183 });
2184 _ut.test('test_visitExpressionFunctionBody', () {
2185 final __test = new ToSourceVisitorTest();
2186 runJUnitTest(__test, __test.test_visitExpressionFunctionBody);
2187 });
2188 _ut.test('test_visitExpressionStatement', () {
2189 final __test = new ToSourceVisitorTest();
2190 runJUnitTest(__test, __test.test_visitExpressionStatement);
2191 });
2192 _ut.test('test_visitExtendsClause', () {
2193 final __test = new ToSourceVisitorTest();
2194 runJUnitTest(__test, __test.test_visitExtendsClause);
2195 });
2196 _ut.test('test_visitFieldDeclaration_instance', () {
2197 final __test = new ToSourceVisitorTest();
2198 runJUnitTest(__test, __test.test_visitFieldDeclaration_instance);
2199 });
2200 _ut.test('test_visitFieldDeclaration_static', () {
2201 final __test = new ToSourceVisitorTest();
2202 runJUnitTest(__test, __test.test_visitFieldDeclaration_static);
2203 });
2204 _ut.test('test_visitFieldFormalParameter_keyword', () {
2205 final __test = new ToSourceVisitorTest();
2206 runJUnitTest(__test, __test.test_visitFieldFormalParameter_keyword);
2207 });
2208 _ut.test('test_visitFieldFormalParameter_keywordAndType', () {
2209 final __test = new ToSourceVisitorTest();
2210 runJUnitTest(__test, __test.test_visitFieldFormalParameter_keywordAndTyp e);
2211 });
2212 _ut.test('test_visitFieldFormalParameter_type', () {
2213 final __test = new ToSourceVisitorTest();
2214 runJUnitTest(__test, __test.test_visitFieldFormalParameter_type);
2215 });
2216 _ut.test('test_visitForEachStatement', () {
2217 final __test = new ToSourceVisitorTest();
2218 runJUnitTest(__test, __test.test_visitForEachStatement);
2219 });
2220 _ut.test('test_visitForStatement_c', () {
2221 final __test = new ToSourceVisitorTest();
2222 runJUnitTest(__test, __test.test_visitForStatement_c);
2223 });
2224 _ut.test('test_visitForStatement_cu', () {
2225 final __test = new ToSourceVisitorTest();
2226 runJUnitTest(__test, __test.test_visitForStatement_cu);
2227 });
2228 _ut.test('test_visitForStatement_e', () {
2229 final __test = new ToSourceVisitorTest();
2230 runJUnitTest(__test, __test.test_visitForStatement_e);
2231 });
2232 _ut.test('test_visitForStatement_ec', () {
2233 final __test = new ToSourceVisitorTest();
2234 runJUnitTest(__test, __test.test_visitForStatement_ec);
2235 });
2236 _ut.test('test_visitForStatement_ecu', () {
2237 final __test = new ToSourceVisitorTest();
2238 runJUnitTest(__test, __test.test_visitForStatement_ecu);
2239 });
2240 _ut.test('test_visitForStatement_eu', () {
2241 final __test = new ToSourceVisitorTest();
2242 runJUnitTest(__test, __test.test_visitForStatement_eu);
2243 });
2244 _ut.test('test_visitForStatement_i', () {
2245 final __test = new ToSourceVisitorTest();
2246 runJUnitTest(__test, __test.test_visitForStatement_i);
2247 });
2248 _ut.test('test_visitForStatement_ic', () {
2249 final __test = new ToSourceVisitorTest();
2250 runJUnitTest(__test, __test.test_visitForStatement_ic);
2251 });
2252 _ut.test('test_visitForStatement_icu', () {
2253 final __test = new ToSourceVisitorTest();
2254 runJUnitTest(__test, __test.test_visitForStatement_icu);
2255 });
2256 _ut.test('test_visitForStatement_iu', () {
2257 final __test = new ToSourceVisitorTest();
2258 runJUnitTest(__test, __test.test_visitForStatement_iu);
2259 });
2260 _ut.test('test_visitForStatement_u', () {
2261 final __test = new ToSourceVisitorTest();
2262 runJUnitTest(__test, __test.test_visitForStatement_u);
2263 });
2264 _ut.test('test_visitFormalParameterList_empty', () {
2265 final __test = new ToSourceVisitorTest();
2266 runJUnitTest(__test, __test.test_visitFormalParameterList_empty);
2267 });
2268 _ut.test('test_visitFormalParameterList_n', () {
2269 final __test = new ToSourceVisitorTest();
2270 runJUnitTest(__test, __test.test_visitFormalParameterList_n);
2271 });
2272 _ut.test('test_visitFormalParameterList_nn', () {
2273 final __test = new ToSourceVisitorTest();
2274 runJUnitTest(__test, __test.test_visitFormalParameterList_nn);
2275 });
2276 _ut.test('test_visitFormalParameterList_p', () {
2277 final __test = new ToSourceVisitorTest();
2278 runJUnitTest(__test, __test.test_visitFormalParameterList_p);
2279 });
2280 _ut.test('test_visitFormalParameterList_pp', () {
2281 final __test = new ToSourceVisitorTest();
2282 runJUnitTest(__test, __test.test_visitFormalParameterList_pp);
2283 });
2284 _ut.test('test_visitFormalParameterList_r', () {
2285 final __test = new ToSourceVisitorTest();
2286 runJUnitTest(__test, __test.test_visitFormalParameterList_r);
2287 });
2288 _ut.test('test_visitFormalParameterList_rn', () {
2289 final __test = new ToSourceVisitorTest();
2290 runJUnitTest(__test, __test.test_visitFormalParameterList_rn);
2291 });
2292 _ut.test('test_visitFormalParameterList_rnn', () {
2293 final __test = new ToSourceVisitorTest();
2294 runJUnitTest(__test, __test.test_visitFormalParameterList_rnn);
2295 });
2296 _ut.test('test_visitFormalParameterList_rp', () {
2297 final __test = new ToSourceVisitorTest();
2298 runJUnitTest(__test, __test.test_visitFormalParameterList_rp);
2299 });
2300 _ut.test('test_visitFormalParameterList_rpp', () {
2301 final __test = new ToSourceVisitorTest();
2302 runJUnitTest(__test, __test.test_visitFormalParameterList_rpp);
2303 });
2304 _ut.test('test_visitFormalParameterList_rr', () {
2305 final __test = new ToSourceVisitorTest();
2306 runJUnitTest(__test, __test.test_visitFormalParameterList_rr);
2307 });
2308 _ut.test('test_visitFormalParameterList_rrn', () {
2309 final __test = new ToSourceVisitorTest();
2310 runJUnitTest(__test, __test.test_visitFormalParameterList_rrn);
2311 });
2312 _ut.test('test_visitFormalParameterList_rrnn', () {
2313 final __test = new ToSourceVisitorTest();
2314 runJUnitTest(__test, __test.test_visitFormalParameterList_rrnn);
2315 });
2316 _ut.test('test_visitFormalParameterList_rrp', () {
2317 final __test = new ToSourceVisitorTest();
2318 runJUnitTest(__test, __test.test_visitFormalParameterList_rrp);
2319 });
2320 _ut.test('test_visitFormalParameterList_rrpp', () {
2321 final __test = new ToSourceVisitorTest();
2322 runJUnitTest(__test, __test.test_visitFormalParameterList_rrpp);
2323 });
2324 _ut.test('test_visitFunctionDeclarationStatement', () {
2325 final __test = new ToSourceVisitorTest();
2326 runJUnitTest(__test, __test.test_visitFunctionDeclarationStatement);
2327 });
2328 _ut.test('test_visitFunctionDeclaration_getter', () {
2329 final __test = new ToSourceVisitorTest();
2330 runJUnitTest(__test, __test.test_visitFunctionDeclaration_getter);
2331 });
2332 _ut.test('test_visitFunctionDeclaration_normal', () {
2333 final __test = new ToSourceVisitorTest();
2334 runJUnitTest(__test, __test.test_visitFunctionDeclaration_normal);
2335 });
2336 _ut.test('test_visitFunctionDeclaration_setter', () {
2337 final __test = new ToSourceVisitorTest();
2338 runJUnitTest(__test, __test.test_visitFunctionDeclaration_setter);
2339 });
2340 _ut.test('test_visitFunctionExpression', () {
2341 final __test = new ToSourceVisitorTest();
2342 runJUnitTest(__test, __test.test_visitFunctionExpression);
2343 });
2344 _ut.test('test_visitFunctionExpressionInvocation', () {
2345 final __test = new ToSourceVisitorTest();
2346 runJUnitTest(__test, __test.test_visitFunctionExpressionInvocation);
2347 });
2348 _ut.test('test_visitFunctionTypedFormalParameter_noType', () {
2349 final __test = new ToSourceVisitorTest();
2350 runJUnitTest(__test, __test.test_visitFunctionTypedFormalParameter_noTyp e);
2351 });
2352 _ut.test('test_visitFunctionTypedFormalParameter_type', () {
2353 final __test = new ToSourceVisitorTest();
2354 runJUnitTest(__test, __test.test_visitFunctionTypedFormalParameter_type) ;
2355 });
2356 _ut.test('test_visitIfStatement_withElse', () {
2357 final __test = new ToSourceVisitorTest();
2358 runJUnitTest(__test, __test.test_visitIfStatement_withElse);
2359 });
2360 _ut.test('test_visitIfStatement_withoutElse', () {
2361 final __test = new ToSourceVisitorTest();
2362 runJUnitTest(__test, __test.test_visitIfStatement_withoutElse);
2363 });
2364 _ut.test('test_visitImplementsClause_multiple', () {
2365 final __test = new ToSourceVisitorTest();
2366 runJUnitTest(__test, __test.test_visitImplementsClause_multiple);
2367 });
2368 _ut.test('test_visitImplementsClause_single', () {
2369 final __test = new ToSourceVisitorTest();
2370 runJUnitTest(__test, __test.test_visitImplementsClause_single);
2371 });
2372 _ut.test('test_visitImportDirective_combinator', () {
2373 final __test = new ToSourceVisitorTest();
2374 runJUnitTest(__test, __test.test_visitImportDirective_combinator);
2375 });
2376 _ut.test('test_visitImportDirective_combinators', () {
2377 final __test = new ToSourceVisitorTest();
2378 runJUnitTest(__test, __test.test_visitImportDirective_combinators);
2379 });
2380 _ut.test('test_visitImportDirective_minimal', () {
2381 final __test = new ToSourceVisitorTest();
2382 runJUnitTest(__test, __test.test_visitImportDirective_minimal);
2383 });
2384 _ut.test('test_visitImportDirective_prefix', () {
2385 final __test = new ToSourceVisitorTest();
2386 runJUnitTest(__test, __test.test_visitImportDirective_prefix);
2387 });
2388 _ut.test('test_visitImportDirective_prefix_combinator', () {
2389 final __test = new ToSourceVisitorTest();
2390 runJUnitTest(__test, __test.test_visitImportDirective_prefix_combinator) ;
2391 });
2392 _ut.test('test_visitImportDirective_prefix_combinators', () {
2393 final __test = new ToSourceVisitorTest();
2394 runJUnitTest(__test, __test.test_visitImportDirective_prefix_combinators );
2395 });
2396 _ut.test('test_visitImportHideCombinator_multiple', () {
2397 final __test = new ToSourceVisitorTest();
2398 runJUnitTest(__test, __test.test_visitImportHideCombinator_multiple);
2399 });
2400 _ut.test('test_visitImportHideCombinator_single', () {
2401 final __test = new ToSourceVisitorTest();
2402 runJUnitTest(__test, __test.test_visitImportHideCombinator_single);
2403 });
2404 _ut.test('test_visitImportShowCombinator_multiple', () {
2405 final __test = new ToSourceVisitorTest();
2406 runJUnitTest(__test, __test.test_visitImportShowCombinator_multiple);
2407 });
2408 _ut.test('test_visitImportShowCombinator_single', () {
2409 final __test = new ToSourceVisitorTest();
2410 runJUnitTest(__test, __test.test_visitImportShowCombinator_single);
2411 });
2412 _ut.test('test_visitIndexExpression', () {
2413 final __test = new ToSourceVisitorTest();
2414 runJUnitTest(__test, __test.test_visitIndexExpression);
2415 });
2416 _ut.test('test_visitInstanceCreationExpression_const', () {
2417 final __test = new ToSourceVisitorTest();
2418 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_const);
2419 });
2420 _ut.test('test_visitInstanceCreationExpression_named', () {
2421 final __test = new ToSourceVisitorTest();
2422 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_named);
2423 });
2424 _ut.test('test_visitInstanceCreationExpression_unnamed', () {
2425 final __test = new ToSourceVisitorTest();
2426 runJUnitTest(__test, __test.test_visitInstanceCreationExpression_unnamed );
2427 });
2428 _ut.test('test_visitIntegerLiteral', () {
2429 final __test = new ToSourceVisitorTest();
2430 runJUnitTest(__test, __test.test_visitIntegerLiteral);
2431 });
2432 _ut.test('test_visitInterpolationExpression_expression', () {
2433 final __test = new ToSourceVisitorTest();
2434 runJUnitTest(__test, __test.test_visitInterpolationExpression_expression );
2435 });
2436 _ut.test('test_visitInterpolationExpression_identifier', () {
2437 final __test = new ToSourceVisitorTest();
2438 runJUnitTest(__test, __test.test_visitInterpolationExpression_identifier );
2439 });
2440 _ut.test('test_visitInterpolationString', () {
2441 final __test = new ToSourceVisitorTest();
2442 runJUnitTest(__test, __test.test_visitInterpolationString);
2443 });
2444 _ut.test('test_visitIsExpression_negated', () {
2445 final __test = new ToSourceVisitorTest();
2446 runJUnitTest(__test, __test.test_visitIsExpression_negated);
2447 });
2448 _ut.test('test_visitIsExpression_normal', () {
2449 final __test = new ToSourceVisitorTest();
2450 runJUnitTest(__test, __test.test_visitIsExpression_normal);
2451 });
2452 _ut.test('test_visitLabel', () {
2453 final __test = new ToSourceVisitorTest();
2454 runJUnitTest(__test, __test.test_visitLabel);
2455 });
2456 _ut.test('test_visitLabeledStatement_multiple', () {
2457 final __test = new ToSourceVisitorTest();
2458 runJUnitTest(__test, __test.test_visitLabeledStatement_multiple);
2459 });
2460 _ut.test('test_visitLabeledStatement_single', () {
2461 final __test = new ToSourceVisitorTest();
2462 runJUnitTest(__test, __test.test_visitLabeledStatement_single);
2463 });
2464 _ut.test('test_visitLibraryDirective', () {
2465 final __test = new ToSourceVisitorTest();
2466 runJUnitTest(__test, __test.test_visitLibraryDirective);
2467 });
2468 _ut.test('test_visitLibraryIdentifier_multiple', () {
2469 final __test = new ToSourceVisitorTest();
2470 runJUnitTest(__test, __test.test_visitLibraryIdentifier_multiple);
2471 });
2472 _ut.test('test_visitLibraryIdentifier_single', () {
2473 final __test = new ToSourceVisitorTest();
2474 runJUnitTest(__test, __test.test_visitLibraryIdentifier_single);
2475 });
2476 _ut.test('test_visitListLiteral_const', () {
2477 final __test = new ToSourceVisitorTest();
2478 runJUnitTest(__test, __test.test_visitListLiteral_const);
2479 });
2480 _ut.test('test_visitListLiteral_empty', () {
2481 final __test = new ToSourceVisitorTest();
2482 runJUnitTest(__test, __test.test_visitListLiteral_empty);
2483 });
2484 _ut.test('test_visitListLiteral_nonEmpty', () {
2485 final __test = new ToSourceVisitorTest();
2486 runJUnitTest(__test, __test.test_visitListLiteral_nonEmpty);
2487 });
2488 _ut.test('test_visitMapLiteralEntry', () {
2489 final __test = new ToSourceVisitorTest();
2490 runJUnitTest(__test, __test.test_visitMapLiteralEntry);
2491 });
2492 _ut.test('test_visitMapLiteral_const', () {
2493 final __test = new ToSourceVisitorTest();
2494 runJUnitTest(__test, __test.test_visitMapLiteral_const);
2495 });
2496 _ut.test('test_visitMapLiteral_empty', () {
2497 final __test = new ToSourceVisitorTest();
2498 runJUnitTest(__test, __test.test_visitMapLiteral_empty);
2499 });
2500 _ut.test('test_visitMapLiteral_nonEmpty', () {
2501 final __test = new ToSourceVisitorTest();
2502 runJUnitTest(__test, __test.test_visitMapLiteral_nonEmpty);
2503 });
2504 _ut.test('test_visitMethodDeclaration_external', () {
2505 final __test = new ToSourceVisitorTest();
2506 runJUnitTest(__test, __test.test_visitMethodDeclaration_external);
2507 });
2508 _ut.test('test_visitMethodDeclaration_external_returnType', () {
2509 final __test = new ToSourceVisitorTest();
2510 runJUnitTest(__test, __test.test_visitMethodDeclaration_external_returnT ype);
2511 });
2512 _ut.test('test_visitMethodDeclaration_getter', () {
2513 final __test = new ToSourceVisitorTest();
2514 runJUnitTest(__test, __test.test_visitMethodDeclaration_getter);
2515 });
2516 _ut.test('test_visitMethodDeclaration_getter_returnType', () {
2517 final __test = new ToSourceVisitorTest();
2518 runJUnitTest(__test, __test.test_visitMethodDeclaration_getter_returnTyp e);
2519 });
2520 _ut.test('test_visitMethodDeclaration_getter_seturnType', () {
2521 final __test = new ToSourceVisitorTest();
2522 runJUnitTest(__test, __test.test_visitMethodDeclaration_getter_seturnTyp e);
2523 });
2524 _ut.test('test_visitMethodDeclaration_minimal', () {
2525 final __test = new ToSourceVisitorTest();
2526 runJUnitTest(__test, __test.test_visitMethodDeclaration_minimal);
2527 });
2528 _ut.test('test_visitMethodDeclaration_multipleParameters', () {
2529 final __test = new ToSourceVisitorTest();
2530 runJUnitTest(__test, __test.test_visitMethodDeclaration_multipleParamete rs);
2531 });
2532 _ut.test('test_visitMethodDeclaration_operator', () {
2533 final __test = new ToSourceVisitorTest();
2534 runJUnitTest(__test, __test.test_visitMethodDeclaration_operator);
2535 });
2536 _ut.test('test_visitMethodDeclaration_operator_returnType', () {
2537 final __test = new ToSourceVisitorTest();
2538 runJUnitTest(__test, __test.test_visitMethodDeclaration_operator_returnT ype);
2539 });
2540 _ut.test('test_visitMethodDeclaration_returnType', () {
2541 final __test = new ToSourceVisitorTest();
2542 runJUnitTest(__test, __test.test_visitMethodDeclaration_returnType);
2543 });
2544 _ut.test('test_visitMethodDeclaration_setter', () {
2545 final __test = new ToSourceVisitorTest();
2546 runJUnitTest(__test, __test.test_visitMethodDeclaration_setter);
2547 });
2548 _ut.test('test_visitMethodDeclaration_static', () {
2549 final __test = new ToSourceVisitorTest();
2550 runJUnitTest(__test, __test.test_visitMethodDeclaration_static);
2551 });
2552 _ut.test('test_visitMethodDeclaration_static_returnType', () {
2553 final __test = new ToSourceVisitorTest();
2554 runJUnitTest(__test, __test.test_visitMethodDeclaration_static_returnTyp e);
2555 });
2556 _ut.test('test_visitMethodInvocation_noTarget', () {
2557 final __test = new ToSourceVisitorTest();
2558 runJUnitTest(__test, __test.test_visitMethodInvocation_noTarget);
2559 });
2560 _ut.test('test_visitMethodInvocation_target', () {
2561 final __test = new ToSourceVisitorTest();
2562 runJUnitTest(__test, __test.test_visitMethodInvocation_target);
2563 });
2564 _ut.test('test_visitNamedExpression', () {
2565 final __test = new ToSourceVisitorTest();
2566 runJUnitTest(__test, __test.test_visitNamedExpression);
2567 });
2568 _ut.test('test_visitNamedFormalParameter', () {
2569 final __test = new ToSourceVisitorTest();
2570 runJUnitTest(__test, __test.test_visitNamedFormalParameter);
2571 });
2572 _ut.test('test_visitNullLiteral', () {
2573 final __test = new ToSourceVisitorTest();
2574 runJUnitTest(__test, __test.test_visitNullLiteral);
2575 });
2576 _ut.test('test_visitParenthesizedExpression', () {
2577 final __test = new ToSourceVisitorTest();
2578 runJUnitTest(__test, __test.test_visitParenthesizedExpression);
2579 });
2580 _ut.test('test_visitPartDirective', () {
2581 final __test = new ToSourceVisitorTest();
2582 runJUnitTest(__test, __test.test_visitPartDirective);
2583 });
2584 _ut.test('test_visitPartOfDirective', () {
2585 final __test = new ToSourceVisitorTest();
2586 runJUnitTest(__test, __test.test_visitPartOfDirective);
2587 });
2588 _ut.test('test_visitPositionalFormalParameter', () {
2589 final __test = new ToSourceVisitorTest();
2590 runJUnitTest(__test, __test.test_visitPositionalFormalParameter);
2591 });
2592 _ut.test('test_visitPostfixExpression', () {
2593 final __test = new ToSourceVisitorTest();
2594 runJUnitTest(__test, __test.test_visitPostfixExpression);
2595 });
2596 _ut.test('test_visitPrefixExpression', () {
2597 final __test = new ToSourceVisitorTest();
2598 runJUnitTest(__test, __test.test_visitPrefixExpression);
2599 });
2600 _ut.test('test_visitPrefixedIdentifier', () {
2601 final __test = new ToSourceVisitorTest();
2602 runJUnitTest(__test, __test.test_visitPrefixedIdentifier);
2603 });
2604 _ut.test('test_visitPropertyAccess', () {
2605 final __test = new ToSourceVisitorTest();
2606 runJUnitTest(__test, __test.test_visitPropertyAccess);
2607 });
2608 _ut.test('test_visitRedirectingConstructorInvocation_named', () {
2609 final __test = new ToSourceVisitorTest();
2610 runJUnitTest(__test, __test.test_visitRedirectingConstructorInvocation_n amed);
2611 });
2612 _ut.test('test_visitRedirectingConstructorInvocation_unnamed', () {
2613 final __test = new ToSourceVisitorTest();
2614 runJUnitTest(__test, __test.test_visitRedirectingConstructorInvocation_u nnamed);
2615 });
2616 _ut.test('test_visitReturnStatement_expression', () {
2617 final __test = new ToSourceVisitorTest();
2618 runJUnitTest(__test, __test.test_visitReturnStatement_expression);
2619 });
2620 _ut.test('test_visitReturnStatement_noExpression', () {
2621 final __test = new ToSourceVisitorTest();
2622 runJUnitTest(__test, __test.test_visitReturnStatement_noExpression);
2623 });
2624 _ut.test('test_visitScriptTag', () {
2625 final __test = new ToSourceVisitorTest();
2626 runJUnitTest(__test, __test.test_visitScriptTag);
2627 });
2628 _ut.test('test_visitSimpleFormalParameter_keyword', () {
2629 final __test = new ToSourceVisitorTest();
2630 runJUnitTest(__test, __test.test_visitSimpleFormalParameter_keyword);
2631 });
2632 _ut.test('test_visitSimpleFormalParameter_keyword_type', () {
2633 final __test = new ToSourceVisitorTest();
2634 runJUnitTest(__test, __test.test_visitSimpleFormalParameter_keyword_type );
2635 });
2636 _ut.test('test_visitSimpleFormalParameter_type', () {
2637 final __test = new ToSourceVisitorTest();
2638 runJUnitTest(__test, __test.test_visitSimpleFormalParameter_type);
2639 });
2640 _ut.test('test_visitSimpleIdentifier', () {
2641 final __test = new ToSourceVisitorTest();
2642 runJUnitTest(__test, __test.test_visitSimpleIdentifier);
2643 });
2644 _ut.test('test_visitSimpleStringLiteral', () {
2645 final __test = new ToSourceVisitorTest();
2646 runJUnitTest(__test, __test.test_visitSimpleStringLiteral);
2647 });
2648 _ut.test('test_visitStringInterpolation', () {
2649 final __test = new ToSourceVisitorTest();
2650 runJUnitTest(__test, __test.test_visitStringInterpolation);
2651 });
2652 _ut.test('test_visitSuperConstructorInvocation', () {
2653 final __test = new ToSourceVisitorTest();
2654 runJUnitTest(__test, __test.test_visitSuperConstructorInvocation);
2655 });
2656 _ut.test('test_visitSuperConstructorInvocation_named', () {
2657 final __test = new ToSourceVisitorTest();
2658 runJUnitTest(__test, __test.test_visitSuperConstructorInvocation_named);
2659 });
2660 _ut.test('test_visitSuperExpression', () {
2661 final __test = new ToSourceVisitorTest();
2662 runJUnitTest(__test, __test.test_visitSuperExpression);
2663 });
2664 _ut.test('test_visitSwitchCase_multipleLabels', () {
2665 final __test = new ToSourceVisitorTest();
2666 runJUnitTest(__test, __test.test_visitSwitchCase_multipleLabels);
2667 });
2668 _ut.test('test_visitSwitchCase_multipleStatements', () {
2669 final __test = new ToSourceVisitorTest();
2670 runJUnitTest(__test, __test.test_visitSwitchCase_multipleStatements);
2671 });
2672 _ut.test('test_visitSwitchCase_noLabels', () {
2673 final __test = new ToSourceVisitorTest();
2674 runJUnitTest(__test, __test.test_visitSwitchCase_noLabels);
2675 });
2676 _ut.test('test_visitSwitchCase_singleLabel', () {
2677 final __test = new ToSourceVisitorTest();
2678 runJUnitTest(__test, __test.test_visitSwitchCase_singleLabel);
2679 });
2680 _ut.test('test_visitSwitchDefault_multipleLabels', () {
2681 final __test = new ToSourceVisitorTest();
2682 runJUnitTest(__test, __test.test_visitSwitchDefault_multipleLabels);
2683 });
2684 _ut.test('test_visitSwitchDefault_multipleStatements', () {
2685 final __test = new ToSourceVisitorTest();
2686 runJUnitTest(__test, __test.test_visitSwitchDefault_multipleStatements);
2687 });
2688 _ut.test('test_visitSwitchDefault_noLabels', () {
2689 final __test = new ToSourceVisitorTest();
2690 runJUnitTest(__test, __test.test_visitSwitchDefault_noLabels);
2691 });
2692 _ut.test('test_visitSwitchDefault_singleLabel', () {
2693 final __test = new ToSourceVisitorTest();
2694 runJUnitTest(__test, __test.test_visitSwitchDefault_singleLabel);
2695 });
2696 _ut.test('test_visitSwitchStatement', () {
2697 final __test = new ToSourceVisitorTest();
2698 runJUnitTest(__test, __test.test_visitSwitchStatement);
2699 });
2700 _ut.test('test_visitThisExpression', () {
2701 final __test = new ToSourceVisitorTest();
2702 runJUnitTest(__test, __test.test_visitThisExpression);
2703 });
2704 _ut.test('test_visitThrowStatement', () {
2705 final __test = new ToSourceVisitorTest();
2706 runJUnitTest(__test, __test.test_visitThrowStatement);
2707 });
2708 _ut.test('test_visitTopLevelVariableDeclaration_multiple', () {
2709 final __test = new ToSourceVisitorTest();
2710 runJUnitTest(__test, __test.test_visitTopLevelVariableDeclaration_multip le);
2711 });
2712 _ut.test('test_visitTopLevelVariableDeclaration_single', () {
2713 final __test = new ToSourceVisitorTest();
2714 runJUnitTest(__test, __test.test_visitTopLevelVariableDeclaration_single );
2715 });
2716 _ut.test('test_visitTryStatement_catch', () {
2717 final __test = new ToSourceVisitorTest();
2718 runJUnitTest(__test, __test.test_visitTryStatement_catch);
2719 });
2720 _ut.test('test_visitTryStatement_catchFinally', () {
2721 final __test = new ToSourceVisitorTest();
2722 runJUnitTest(__test, __test.test_visitTryStatement_catchFinally);
2723 });
2724 _ut.test('test_visitTryStatement_catches', () {
2725 final __test = new ToSourceVisitorTest();
2726 runJUnitTest(__test, __test.test_visitTryStatement_catches);
2727 });
2728 _ut.test('test_visitTryStatement_finally', () {
2729 final __test = new ToSourceVisitorTest();
2730 runJUnitTest(__test, __test.test_visitTryStatement_finally);
2731 });
2732 _ut.test('test_visitTypeAlias_generic', () {
2733 final __test = new ToSourceVisitorTest();
2734 runJUnitTest(__test, __test.test_visitTypeAlias_generic);
2735 });
2736 _ut.test('test_visitTypeAlias_nonGeneric', () {
2737 final __test = new ToSourceVisitorTest();
2738 runJUnitTest(__test, __test.test_visitTypeAlias_nonGeneric);
2739 });
2740 _ut.test('test_visitTypeArgumentList_multiple', () {
2741 final __test = new ToSourceVisitorTest();
2742 runJUnitTest(__test, __test.test_visitTypeArgumentList_multiple);
2743 });
2744 _ut.test('test_visitTypeArgumentList_single', () {
2745 final __test = new ToSourceVisitorTest();
2746 runJUnitTest(__test, __test.test_visitTypeArgumentList_single);
2747 });
2748 _ut.test('test_visitTypeName_multipleArgs', () {
2749 final __test = new ToSourceVisitorTest();
2750 runJUnitTest(__test, __test.test_visitTypeName_multipleArgs);
2751 });
2752 _ut.test('test_visitTypeName_nestedArg', () {
2753 final __test = new ToSourceVisitorTest();
2754 runJUnitTest(__test, __test.test_visitTypeName_nestedArg);
2755 });
2756 _ut.test('test_visitTypeName_noArgs', () {
2757 final __test = new ToSourceVisitorTest();
2758 runJUnitTest(__test, __test.test_visitTypeName_noArgs);
2759 });
2760 _ut.test('test_visitTypeName_singleArg', () {
2761 final __test = new ToSourceVisitorTest();
2762 runJUnitTest(__test, __test.test_visitTypeName_singleArg);
2763 });
2764 _ut.test('test_visitTypeParameterList_multiple', () {
2765 final __test = new ToSourceVisitorTest();
2766 runJUnitTest(__test, __test.test_visitTypeParameterList_multiple);
2767 });
2768 _ut.test('test_visitTypeParameterList_single', () {
2769 final __test = new ToSourceVisitorTest();
2770 runJUnitTest(__test, __test.test_visitTypeParameterList_single);
2771 });
2772 _ut.test('test_visitTypeParameter_withExtends', () {
2773 final __test = new ToSourceVisitorTest();
2774 runJUnitTest(__test, __test.test_visitTypeParameter_withExtends);
2775 });
2776 _ut.test('test_visitTypeParameter_withoutExtends', () {
2777 final __test = new ToSourceVisitorTest();
2778 runJUnitTest(__test, __test.test_visitTypeParameter_withoutExtends);
2779 });
2780 _ut.test('test_visitVariableDeclarationList_const_type', () {
2781 final __test = new ToSourceVisitorTest();
2782 runJUnitTest(__test, __test.test_visitVariableDeclarationList_const_type );
2783 });
2784 _ut.test('test_visitVariableDeclarationList_final_noType', () {
2785 final __test = new ToSourceVisitorTest();
2786 runJUnitTest(__test, __test.test_visitVariableDeclarationList_final_noTy pe);
2787 });
2788 _ut.test('test_visitVariableDeclarationList_type', () {
2789 final __test = new ToSourceVisitorTest();
2790 runJUnitTest(__test, __test.test_visitVariableDeclarationList_type);
2791 });
2792 _ut.test('test_visitVariableDeclarationList_var', () {
2793 final __test = new ToSourceVisitorTest();
2794 runJUnitTest(__test, __test.test_visitVariableDeclarationList_var);
2795 });
2796 _ut.test('test_visitVariableDeclarationStatement', () {
2797 final __test = new ToSourceVisitorTest();
2798 runJUnitTest(__test, __test.test_visitVariableDeclarationStatement);
2799 });
2800 _ut.test('test_visitVariableDeclaration_initialized', () {
2801 final __test = new ToSourceVisitorTest();
2802 runJUnitTest(__test, __test.test_visitVariableDeclaration_initialized);
2803 });
2804 _ut.test('test_visitVariableDeclaration_uninitialized', () {
2805 final __test = new ToSourceVisitorTest();
2806 runJUnitTest(__test, __test.test_visitVariableDeclaration_uninitialized) ;
2807 });
2808 _ut.test('test_visitWhileStatement', () {
2809 final __test = new ToSourceVisitorTest();
2810 runJUnitTest(__test, __test.test_visitWhileStatement);
2811 });
2812 _ut.test('test_visitWithClause_multiple', () {
2813 final __test = new ToSourceVisitorTest();
2814 runJUnitTest(__test, __test.test_visitWithClause_multiple);
2815 });
2816 _ut.test('test_visitWithClause_single', () {
2817 final __test = new ToSourceVisitorTest();
2818 runJUnitTest(__test, __test.test_visitWithClause_single);
2819 });
2820 });
2821 }
2822 }
2823 main() {
2824 ConstantEvaluatorTest.dartSuite();
2825 NodeLocatorTest.dartSuite();
2826 ToSourceVisitorTest.dartSuite();
2827 IndexExpressionTest.dartSuite();
2828 SimpleIdentifierTest.dartSuite();
2829 }
OLDNEW
« no previous file with comments | « pkg/analyzer-experimental/pubspec.yaml ('k') | pkg/analyzer-experimental/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698