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

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

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

Powered by Google App Engine
This is Rietveld 408576698