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