| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.testing.ast_factory; | 8 library engine.testing.ast_factory; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 11 import 'package:analyzer/src/generated/ast.dart'; | 11 import 'package:analyzer/src/generated/ast.dart'; |
| 12 import 'package:analyzer/src/generated/element.dart'; | 12 import 'package:analyzer/src/generated/element.dart'; |
| 13 import 'package:analyzer/src/generated/scanner.dart'; | 13 import 'package:analyzer/src/generated/scanner.dart'; |
| 14 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 14 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * The class `AstFactory` defines utility methods that can be used to create AST
nodes. The | 17 * The class `AstFactory` defines utility methods that can be used to create AST
nodes. The |
| 18 * nodes that are created are complete in the sense that all of the tokens that
would have been | 18 * nodes that are created are complete in the sense that all of the tokens that
would have been |
| 19 * associated with the nodes by a parser are also created, but the token stream
is not constructed. | 19 * associated with the nodes by a parser are also created, but the token stream
is not constructed. |
| 20 * None of the nodes are resolved. | 20 * None of the nodes are resolved. |
| 21 * | 21 * |
| 22 * The general pattern is for the name of the factory method to be the same as t
he name of the class | 22 * The general pattern is for the name of the factory method to be the same as t
he name of the class |
| 23 * of AST node being created. There are two notable exceptions. The first is for
methods creating | 23 * of AST node being created. There are two notable exceptions. The first is for
methods creating |
| 24 * nodes that are part of a cascade expression. These methods are all prefixed w
ith 'cascaded'. The | 24 * nodes that are part of a cascade expression. These methods are all prefixed w
ith 'cascaded'. The |
| 25 * second is places where a shorter name seemed unambiguous and easier to read,
such as using | 25 * second is places where a shorter name seemed unambiguous and easier to read,
such as using |
| 26 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte
gerLiteral'. | 26 * 'identifier' rather than 'prefixedIdentifier', or 'integer' rather than 'inte
gerLiteral'. |
| 27 */ | 27 */ |
| 28 class AstFactory { | 28 class AstFactory { |
| 29 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj
acentStrings(list(strings)); | 29 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => new Adj
acentStrings(strings); |
| 30 | 30 |
| 31 static Annotation annotation(Identifier name) => new Annotation(TokenFactory.t
okenFromType(TokenType.AT), name, null, null, null); | 31 static Annotation annotation(Identifier name) => new Annotation(TokenFactory.t
okenFromType(TokenType.AT), name, null, null, null); |
| 32 | 32 |
| 33 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam
e, ArgumentList arguments) => new Annotation(TokenFactory.tokenFromType(TokenTyp
e.AT), name, TokenFactory.tokenFromType(TokenType.PERIOD), constructorName, argu
ments); | 33 static Annotation annotation2(Identifier name, SimpleIdentifier constructorNam
e, ArgumentList arguments) => new Annotation(TokenFactory.tokenFromType(TokenTyp
e.AT), name, TokenFactory.tokenFromType(TokenType.PERIOD), constructorName, argu
ments); |
| 34 | 34 |
| 35 static ArgumentList argumentList(List<Expression> arguments) => new ArgumentLi
st(TokenFactory.tokenFromType(TokenType.OPEN_PAREN), list(arguments), TokenFacto
ry.tokenFromType(TokenType.CLOSE_PAREN)); | 35 static ArgumentList argumentList([List<Expression> arguments]) |
| 36 => new ArgumentList( |
| 37 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 38 arguments, |
| 39 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); |
| 36 | 40 |
| 37 static AsExpression asExpression(Expression expression, TypeName type) => new
AsExpression(expression, TokenFactory.tokenFromKeyword(Keyword.AS), type); | 41 static AsExpression asExpression(Expression expression, TypeName type) => new
AsExpression(expression, TokenFactory.tokenFromKeyword(Keyword.AS), type); |
| 38 | 42 |
| 39 static AssertStatement assertStatement(Expression condition) => new AssertStat
ement(TokenFactory.tokenFromKeyword(Keyword.ASSERT), TokenFactory.tokenFromType(
TokenType.OPEN_PAREN), condition, TokenFactory.tokenFromType(TokenType.CLOSE_PAR
EN), TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 43 static AssertStatement assertStatement(Expression condition) => new AssertStat
ement(TokenFactory.tokenFromKeyword(Keyword.ASSERT), TokenFactory.tokenFromType(
TokenType.OPEN_PAREN), condition, TokenFactory.tokenFromType(TokenType.CLOSE_PAR
EN), TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 40 | 44 |
| 41 static AssignmentExpression assignmentExpression(Expression leftHandSide, Toke
nType operator, Expression rightHandSide) => new AssignmentExpression(leftHandSi
de, TokenFactory.tokenFromType(operator), rightHandSide); | 45 static AssignmentExpression assignmentExpression(Expression leftHandSide, Toke
nType operator, Expression rightHandSide) => new AssignmentExpression(leftHandSi
de, TokenFactory.tokenFromType(operator), rightHandSide); |
| 42 | 46 |
| 43 static BlockFunctionBody asyncBlockFunctionBody(List<Statement> statements) =>
new BlockFunctionBody(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER,
"async"), null, block(statements)); | 47 static BlockFunctionBody asyncBlockFunctionBody([List<Statement> statements]) |
| 48 => new BlockFunctionBody( |
| 49 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), |
| 50 null, |
| 51 block(statements)); |
| 44 | 52 |
| 45 static ExpressionFunctionBody asyncExpressionFunctionBody(Expression expressio
n) => new ExpressionFunctionBody(TokenFactory.tokenFromTypeAndString(TokenType.I
DENTIFIER, "async"), TokenFactory.tokenFromType(TokenType.FUNCTION), expression,
TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 53 static ExpressionFunctionBody asyncExpressionFunctionBody(Expression expressio
n) => new ExpressionFunctionBody(TokenFactory.tokenFromTypeAndString(TokenType.I
DENTIFIER, "async"), TokenFactory.tokenFromType(TokenType.FUNCTION), expression,
TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 46 | 54 |
| 47 static BlockFunctionBody asyncGeneratorBlockFunctionBody(List<Statement> state
ments) => new BlockFunctionBody(TokenFactory.tokenFromTypeAndString(TokenType.ID
ENTIFIER, "async"), TokenFactory.tokenFromType(TokenType.STAR), block(statements
)); | 55 static BlockFunctionBody asyncGeneratorBlockFunctionBody([List<Statement> stat
ements]) |
| 56 => new BlockFunctionBody( |
| 57 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), |
| 58 TokenFactory.tokenFromType(TokenType.STAR), |
| 59 block(statements)); |
| 48 | 60 |
| 49 static AwaitExpression awaitExpression(Expression expression) => new AwaitExpr
ession(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "await"), expre
ssion); | 61 static AwaitExpression awaitExpression(Expression expression) => new AwaitExpr
ession(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "await"), expre
ssion); |
| 50 | 62 |
| 51 static BinaryExpression binaryExpression(Expression leftOperand, TokenType ope
rator, Expression rightOperand) => new BinaryExpression(leftOperand, TokenFactor
y.tokenFromType(operator), rightOperand); | 63 static BinaryExpression binaryExpression(Expression leftOperand, TokenType ope
rator, Expression rightOperand) => new BinaryExpression(leftOperand, TokenFactor
y.tokenFromType(operator), rightOperand); |
| 52 | 64 |
| 53 static Block block(List<Statement> statements) => new Block(TokenFactory.token
FromType(TokenType.OPEN_CURLY_BRACKET), list(statements), TokenFactory.tokenFrom
Type(TokenType.CLOSE_CURLY_BRACKET)); | 65 static Block block([List<Statement> statements]) |
| 66 => new Block( |
| 67 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), |
| 68 statements, |
| 69 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 54 | 70 |
| 55 static BlockFunctionBody blockFunctionBody(Block block) => new BlockFunctionBo
dy(null, null, block); | 71 static BlockFunctionBody blockFunctionBody(Block block) |
| 72 => new BlockFunctionBody(null, null, block); |
| 56 | 73 |
| 57 static BlockFunctionBody blockFunctionBody2(List<Statement> statements) => new
BlockFunctionBody(null, null, block(statements)); | 74 static BlockFunctionBody blockFunctionBody2([List<Statement> statements]) |
| 75 => new BlockFunctionBody(null, null, block(statements)); |
| 58 | 76 |
| 59 static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral(value ?
TokenFactory.tokenFromKeyword(Keyword.TRUE) : TokenFactory.tokenFromKeyword(Key
word.FALSE), value); | 77 static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral(value ?
TokenFactory.tokenFromKeyword(Keyword.TRUE) : TokenFactory.tokenFromKeyword(Key
word.FALSE), value); |
| 60 | 78 |
| 61 static BreakStatement breakStatement() => new BreakStatement(TokenFactory.toke
nFromKeyword(Keyword.BREAK), null, TokenFactory.tokenFromType(TokenType.SEMICOLO
N)); | 79 static BreakStatement breakStatement() => new BreakStatement(TokenFactory.toke
nFromKeyword(Keyword.BREAK), null, TokenFactory.tokenFromType(TokenType.SEMICOLO
N)); |
| 62 | 80 |
| 63 static BreakStatement breakStatement2(String label) => new BreakStatement(Toke
nFactory.tokenFromKeyword(Keyword.BREAK), identifier3(label), TokenFactory.token
FromType(TokenType.SEMICOLON)); | 81 static BreakStatement breakStatement2(String label) => new BreakStatement(Toke
nFactory.tokenFromKeyword(Keyword.BREAK), identifier3(label), TokenFactory.token
FromType(TokenType.SEMICOLON)); |
| 64 | 82 |
| 65 static IndexExpression cascadedIndexExpression(Expression index) => new IndexE
xpression.forCascade(TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), TokenF
actory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), index, TokenFactory.tokenFr
omType(TokenType.CLOSE_SQUARE_BRACKET)); | 83 static IndexExpression cascadedIndexExpression(Expression index) => new IndexE
xpression.forCascade(TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), TokenF
actory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), index, TokenFactory.tokenFr
omType(TokenType.CLOSE_SQUARE_BRACKET)); |
| 66 | 84 |
| 67 static MethodInvocation cascadedMethodInvocation(String methodName, List<Expre
ssion> arguments) => new MethodInvocation(null, TokenFactory.tokenFromType(Token
Type.PERIOD_PERIOD), identifier3(methodName), argumentList(arguments)); | 85 static MethodInvocation cascadedMethodInvocation(String methodName, [List<Expr
ession> arguments]) |
| 86 => new MethodInvocation( |
| 87 null, |
| 88 TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), |
| 89 identifier3(methodName), |
| 90 argumentList(arguments)); |
| 68 | 91 |
| 69 static PropertyAccess cascadedPropertyAccess(String propertyName) => new Prope
rtyAccess(null, TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), identifier3
(propertyName)); | 92 static PropertyAccess cascadedPropertyAccess(String propertyName) => new Prope
rtyAccess(null, TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), identifier3
(propertyName)); |
| 70 | 93 |
| 71 static CascadeExpression cascadeExpression(Expression target, List<Expression>
cascadeSections) => new CascadeExpression(target, list(cascadeSections)); | 94 static CascadeExpression cascadeExpression(Expression target, [List<Expression
> cascadeSections]) |
| 95 => new CascadeExpression(target, cascadeSections); |
| 72 | 96 |
| 73 static CatchClause catchClause(String exceptionParameter, List<Statement> stat
ements) => catchClause5(null, exceptionParameter, null, statements); | 97 static CatchClause catchClause(String exceptionParameter, [List<Statement> sta
tements]) |
| 98 => catchClause5(null, exceptionParameter, null, statements); |
| 74 | 99 |
| 75 static CatchClause catchClause2(String exceptionParameter, String stackTracePa
rameter, List<Statement> statements) => catchClause5(null, exceptionParameter, s
tackTraceParameter, statements); | 100 static CatchClause catchClause2(String exceptionParameter, String stackTracePa
rameter, [List<Statement> statements]) |
| 101 => catchClause5(null, exceptionParameter, stackTraceParameter, statements)
; |
| 76 | 102 |
| 77 static CatchClause catchClause3(TypeName exceptionType, List<Statement> statem
ents) => catchClause5(exceptionType, null, null, statements); | 103 static CatchClause catchClause3(TypeName exceptionType, [List<Statement> state
ments]) |
| 104 => catchClause5(exceptionType, null, null, statements); |
| 78 | 105 |
| 79 static CatchClause catchClause4(TypeName exceptionType, String exceptionParame
ter, List<Statement> statements) => catchClause5(exceptionType, exceptionParamet
er, null, statements); | 106 static CatchClause catchClause4(TypeName exceptionType, String exceptionParame
ter, [List<Statement> statements]) |
| 107 => catchClause5(exceptionType, exceptionParameter, null, statements); |
| 80 | 108 |
| 81 static CatchClause catchClause5(TypeName exceptionType, String exceptionParame
ter, String stackTraceParameter, List<Statement> statements) => new CatchClause(
exceptionType == null ? null : TokenFactory.tokenFromTypeAndString(TokenType.IDE
NTIFIER, "on"), exceptionType, exceptionParameter == null ? null : TokenFactory.
tokenFromKeyword(Keyword.CATCH), exceptionParameter == null ? null : TokenFactor
y.tokenFromType(TokenType.OPEN_PAREN), exceptionParameter == null ? null : ident
ifier3(exceptionParameter), stackTraceParameter == null ? null : TokenFactory.to
kenFromType(TokenType.COMMA), stackTraceParameter == null ? null : identifier3(s
tackTraceParameter), exceptionParameter == null ? null : TokenFactory.tokenFromT
ype(TokenType.CLOSE_PAREN), block(statements)); | 109 static CatchClause catchClause5(TypeName exceptionType, String exceptionParame
ter, String stackTraceParameter, [List<Statement> statements]) |
| 110 => new CatchClause( |
| 111 exceptionType == null ? null : TokenFactory.tokenFromTypeAndString(Tok
enType.IDENTIFIER, "on"), |
| 112 exceptionType, |
| 113 exceptionParameter == null ? null : TokenFactory.tokenFromKeyword(Keyw
ord.CATCH), |
| 114 exceptionParameter == null ? null : TokenFactory.tokenFromType(TokenTy
pe.OPEN_PAREN), |
| 115 exceptionParameter == null ? null : identifier3(exceptionParameter), |
| 116 stackTraceParameter == null ? null : TokenFactory.tokenFromType(TokenT
ype.COMMA), |
| 117 stackTraceParameter == null ? null : identifier3(stackTraceParameter), |
| 118 exceptionParameter == null ? null : TokenFactory.tokenFromType(TokenTy
pe.CLOSE_PAREN), |
| 119 block(statements)); |
| 82 | 120 |
| 83 static ClassDeclaration classDeclaration(Keyword abstractKeyword, String name,
TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withC
lause, ImplementsClause implementsClause, List<ClassMember> members) => new Clas
sDeclaration(null, null, abstractKeyword == null ? null : TokenFactory.tokenFrom
Keyword(abstractKeyword), TokenFactory.tokenFromKeyword(Keyword.CLASS), identifi
er3(name), typeParameters, extendsClause, withClause, implementsClause, TokenFac
tory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), list(members), TokenFactory.to
kenFromType(TokenType.CLOSE_CURLY_BRACKET)); | 121 static ClassDeclaration classDeclaration(Keyword abstractKeyword, String name,
TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withC
lause, ImplementsClause implementsClause, [List<ClassMember> members]) |
| 122 => new ClassDeclaration( |
| 123 null, |
| 124 null, |
| 125 abstractKeyword == null ? null : TokenFactory.tokenFromKeyword(abstrac
tKeyword), |
| 126 TokenFactory.tokenFromKeyword(Keyword.CLASS), |
| 127 identifier3(name), |
| 128 typeParameters, |
| 129 extendsClause, |
| 130 withClause, |
| 131 implementsClause, |
| 132 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), |
| 133 members, |
| 134 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 84 | 135 |
| 85 static ClassTypeAlias classTypeAlias(String name, TypeParameterList typeParame
ters, Keyword abstractKeyword, TypeName superclass, WithClause withClause, Imple
mentsClause implementsClause) => new ClassTypeAlias(null, null, TokenFactory.tok
enFromKeyword(Keyword.CLASS), identifier3(name), typeParameters, TokenFactory.to
kenFromType(TokenType.EQ), abstractKeyword == null ? null : TokenFactory.tokenFr
omKeyword(abstractKeyword), superclass, withClause, implementsClause, TokenFacto
ry.tokenFromType(TokenType.SEMICOLON)); | 136 static ClassTypeAlias classTypeAlias(String name, TypeParameterList typeParame
ters, Keyword abstractKeyword, TypeName superclass, WithClause withClause, Imple
mentsClause implementsClause) => new ClassTypeAlias(null, null, TokenFactory.tok
enFromKeyword(Keyword.CLASS), identifier3(name), typeParameters, TokenFactory.to
kenFromType(TokenType.EQ), abstractKeyword == null ? null : TokenFactory.tokenFr
omKeyword(abstractKeyword), superclass, withClause, implementsClause, TokenFacto
ry.tokenFromType(TokenType.SEMICOLON)); |
| 86 | 137 |
| 87 static CompilationUnit compilationUnit() => compilationUnit8(null, null, null)
; | 138 static CompilationUnit compilationUnit() => compilationUnit8(null, null, null)
; |
| 88 | 139 |
| 89 static CompilationUnit compilationUnit2(List<CompilationUnitMember> declaratio
ns) => compilationUnit8(null, null, list(declarations)); | 140 static CompilationUnit compilationUnit2(List<CompilationUnitMember> declaratio
ns) => compilationUnit8(null, null, declarations); |
| 90 | 141 |
| 91 static CompilationUnit compilationUnit3(List<Directive> directives) => compila
tionUnit8(null, list(directives), null); | 142 static CompilationUnit compilationUnit3(List<Directive> directives) => compila
tionUnit8(null, directives, null); |
| 92 | 143 |
| 93 static CompilationUnit compilationUnit4(List<Directive> directives, List<Compi
lationUnitMember> declarations) => compilationUnit8(null, directives, declaratio
ns); | 144 static CompilationUnit compilationUnit4(List<Directive> directives, List<Compi
lationUnitMember> declarations) => compilationUnit8(null, directives, declaratio
ns); |
| 94 | 145 |
| 95 static CompilationUnit compilationUnit5(String scriptTag) => compilationUnit8(
scriptTag, null, null); | 146 static CompilationUnit compilationUnit5(String scriptTag) => compilationUnit8(
scriptTag, null, null); |
| 96 | 147 |
| 97 static CompilationUnit compilationUnit6(String scriptTag, List<CompilationUnit
Member> declarations) => compilationUnit8(scriptTag, null, list(declarations)); | 148 static CompilationUnit compilationUnit6(String scriptTag, List<CompilationUnit
Member> declarations) => compilationUnit8(scriptTag, null, declarations); |
| 98 | 149 |
| 99 static CompilationUnit compilationUnit7(String scriptTag, List<Directive> dire
ctives) => compilationUnit8(scriptTag, list(directives), null); | 150 static CompilationUnit compilationUnit7(String scriptTag, List<Directive> dire
ctives) => compilationUnit8(scriptTag, directives, null); |
| 100 | 151 |
| 101 static CompilationUnit compilationUnit8(String scriptTag, List<Directive> dire
ctives, List<CompilationUnitMember> declarations) => new CompilationUnit(TokenFa
ctory.tokenFromType(TokenType.EOF), scriptTag == null ? null : AstFactory.script
Tag(scriptTag), directives == null ? new List<Directive>() : directives, declara
tions == null ? new List<CompilationUnitMember>() : declarations, TokenFactory.t
okenFromType(TokenType.EOF)); | 152 static CompilationUnit compilationUnit8(String scriptTag, List<Directive> dire
ctives, List<CompilationUnitMember> declarations) => new CompilationUnit(TokenFa
ctory.tokenFromType(TokenType.EOF), scriptTag == null ? null : AstFactory.script
Tag(scriptTag), directives == null ? new List<Directive>() : directives, declara
tions == null ? new List<CompilationUnitMember>() : declarations, TokenFactory.t
okenFromType(TokenType.EOF)); |
| 102 | 153 |
| 103 static ConditionalExpression conditionalExpression(Expression condition, Expre
ssion thenExpression, Expression elseExpression) => new ConditionalExpression(co
ndition, TokenFactory.tokenFromType(TokenType.QUESTION), thenExpression, TokenFa
ctory.tokenFromType(TokenType.COLON), elseExpression); | 154 static ConditionalExpression conditionalExpression(Expression condition, Expre
ssion thenExpression, Expression elseExpression) => new ConditionalExpression(co
ndition, TokenFactory.tokenFromType(TokenType.QUESTION), thenExpression, TokenFa
ctory.tokenFromType(TokenType.COLON), elseExpression); |
| 104 | 155 |
| 105 static ConstructorDeclaration constructorDeclaration(Identifier returnType, St
ring name, FormalParameterList parameters, List<ConstructorInitializer> initiali
zers) => new ConstructorDeclaration(null, null, TokenFactory.tokenFromKeyword(Ke
yword.EXTERNAL), null, null, returnType, name == null ? null : TokenFactory.toke
nFromType(TokenType.PERIOD), name == null ? null : identifier3(name), parameters
, initializers == null || initializers.isEmpty ? null : TokenFactory.tokenFromTy
pe(TokenType.PERIOD), initializers == null ? new List<ConstructorInitializer>()
: initializers, null, emptyFunctionBody()); | 156 static ConstructorDeclaration constructorDeclaration(Identifier returnType, St
ring name, FormalParameterList parameters, List<ConstructorInitializer> initiali
zers) => new ConstructorDeclaration(null, null, TokenFactory.tokenFromKeyword(Ke
yword.EXTERNAL), null, null, returnType, name == null ? null : TokenFactory.toke
nFromType(TokenType.PERIOD), name == null ? null : identifier3(name), parameters
, initializers == null || initializers.isEmpty ? null : TokenFactory.tokenFromTy
pe(TokenType.PERIOD), initializers == null ? new List<ConstructorInitializer>()
: initializers, null, emptyFunctionBody()); |
| 106 | 157 |
| 107 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, Ke
yword factoryKeyword, Identifier returnType, String name, FormalParameterList pa
rameters, List<ConstructorInitializer> initializers, FunctionBody body) => new C
onstructorDeclaration(null, null, null, constKeyword == null ? null : TokenFacto
ry.tokenFromKeyword(constKeyword), factoryKeyword == null ? null : TokenFactory.
tokenFromKeyword(factoryKeyword), returnType, name == null ? null : TokenFactory
.tokenFromType(TokenType.PERIOD), name == null ? null : identifier3(name), param
eters, initializers == null || initializers.isEmpty ? null : TokenFactory.tokenF
romType(TokenType.PERIOD), initializers == null ? new List<ConstructorInitialize
r>() : initializers, null, body); | 158 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, Ke
yword factoryKeyword, Identifier returnType, String name, FormalParameterList pa
rameters, List<ConstructorInitializer> initializers, FunctionBody body) => new C
onstructorDeclaration(null, null, null, constKeyword == null ? null : TokenFacto
ry.tokenFromKeyword(constKeyword), factoryKeyword == null ? null : TokenFactory.
tokenFromKeyword(factoryKeyword), returnType, name == null ? null : TokenFactory
.tokenFromType(TokenType.PERIOD), name == null ? null : identifier3(name), param
eters, initializers == null || initializers.isEmpty ? null : TokenFactory.tokenF
romType(TokenType.PERIOD), initializers == null ? new List<ConstructorInitialize
r>() : initializers, null, body); |
| 108 | 159 |
| 109 static ConstructorFieldInitializer constructorFieldInitializer(bool prefixedWi
thThis, String fieldName, Expression expression) => new ConstructorFieldInitiali
zer(prefixedWithThis ? TokenFactory.tokenFromKeyword(Keyword.THIS) : null, prefi
xedWithThis ? TokenFactory.tokenFromType(TokenType.PERIOD) : null, identifier3(f
ieldName), TokenFactory.tokenFromType(TokenType.EQ), expression); | 160 static ConstructorFieldInitializer constructorFieldInitializer(bool prefixedWi
thThis, String fieldName, Expression expression) => new ConstructorFieldInitiali
zer(prefixedWithThis ? TokenFactory.tokenFromKeyword(Keyword.THIS) : null, prefi
xedWithThis ? TokenFactory.tokenFromType(TokenType.PERIOD) : null, identifier3(f
ieldName), TokenFactory.tokenFromType(TokenType.EQ), expression); |
| 110 | 161 |
| 111 static ConstructorName constructorName(TypeName type, String name) => new Cons
tructorName(type, name == null ? null : TokenFactory.tokenFromType(TokenType.PER
IOD), name == null ? null : identifier3(name)); | 162 static ConstructorName constructorName(TypeName type, String name) => new Cons
tructorName(type, name == null ? null : TokenFactory.tokenFromType(TokenType.PER
IOD), name == null ? null : identifier3(name)); |
| 112 | 163 |
| 113 static ContinueStatement continueStatement([String label]) { | 164 static ContinueStatement continueStatement([String label]) |
| 114 SimpleIdentifier labelNode = label == null ? null : identifier3(label); | 165 => new ContinueStatement( |
| 115 return new ContinueStatement(TokenFactory.tokenFromKeyword(Keyword.CONTINUE)
, labelNode, TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 166 TokenFactory.tokenFromKeyword(Keyword.CONTINUE), |
| 116 } | 167 label == null ? null : identifier3(label), |
| 168 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 117 | 169 |
| 118 static DeclaredIdentifier declaredIdentifier(Keyword keyword, String identifie
r) => declaredIdentifier2(keyword, null, identifier); | 170 static DeclaredIdentifier declaredIdentifier(Keyword keyword, String identifie
r) => declaredIdentifier2(keyword, null, identifier); |
| 119 | 171 |
| 120 static DeclaredIdentifier declaredIdentifier2(Keyword keyword, TypeName type,
String identifier) => new DeclaredIdentifier(null, null, keyword == null ? null
: TokenFactory.tokenFromKeyword(keyword), type, identifier3(identifier)); | 172 static DeclaredIdentifier declaredIdentifier2(Keyword keyword, TypeName type,
String identifier) => new DeclaredIdentifier(null, null, keyword == null ? null
: TokenFactory.tokenFromKeyword(keyword), type, identifier3(identifier)); |
| 121 | 173 |
| 122 static DeclaredIdentifier declaredIdentifier3(String identifier) => declaredId
entifier2(null, null, identifier); | 174 static DeclaredIdentifier declaredIdentifier3(String identifier) => declaredId
entifier2(null, null, identifier); |
| 123 | 175 |
| 124 static DeclaredIdentifier declaredIdentifier4(TypeName type, String identifier
) => declaredIdentifier2(null, type, identifier); | 176 static DeclaredIdentifier declaredIdentifier4(TypeName type, String identifier
) => declaredIdentifier2(null, type, identifier); |
| 125 | 177 |
| 126 static DoStatement doStatement(Statement body, Expression condition) => new Do
Statement(TokenFactory.tokenFromKeyword(Keyword.DO), body, TokenFactory.tokenFro
mKeyword(Keyword.WHILE), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condi
tion, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), TokenFactory.tokenFromT
ype(TokenType.SEMICOLON)); | 178 static DoStatement doStatement(Statement body, Expression condition) => new Do
Statement(TokenFactory.tokenFromKeyword(Keyword.DO), body, TokenFactory.tokenFro
mKeyword(Keyword.WHILE), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condi
tion, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), TokenFactory.tokenFromT
ype(TokenType.SEMICOLON)); |
| 127 | 179 |
| 128 static DoubleLiteral doubleLiteral(double value) => new DoubleLiteral(TokenFac
tory.tokenFromString(value.toString()), value); | 180 static DoubleLiteral doubleLiteral(double value) => new DoubleLiteral(TokenFac
tory.tokenFromString(value.toString()), value); |
| 129 | 181 |
| 130 static EmptyFunctionBody emptyFunctionBody() => new EmptyFunctionBody(TokenFac
tory.tokenFromType(TokenType.SEMICOLON)); | 182 static EmptyFunctionBody emptyFunctionBody() => new EmptyFunctionBody(TokenFac
tory.tokenFromType(TokenType.SEMICOLON)); |
| 131 | 183 |
| 132 static EmptyStatement emptyStatement() => new EmptyStatement(TokenFactory.toke
nFromType(TokenType.SEMICOLON)); | 184 static EmptyStatement emptyStatement() => new EmptyStatement(TokenFactory.toke
nFromType(TokenType.SEMICOLON)); |
| 133 | 185 |
| 134 static EnumDeclaration enumDeclaration(SimpleIdentifier name, List<EnumConstan
tDeclaration> constants) => new EnumDeclaration(null, null, TokenFactory.tokenFr
omKeyword(Keyword.ENUM), name, TokenFactory.tokenFromType(TokenType.OPEN_CURLY_B
RACKET), list(constants), TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACK
ET)); | 186 static EnumDeclaration enumDeclaration(SimpleIdentifier name, List<EnumConstan
tDeclaration> constants) => new EnumDeclaration(null, null, TokenFactory.tokenFr
omKeyword(Keyword.ENUM), name, TokenFactory.tokenFromType(TokenType.OPEN_CURLY_B
RACKET), constants, TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 135 | 187 |
| 136 static EnumDeclaration enumDeclaration2(String name, List<String> constantName
s) { | 188 static EnumDeclaration enumDeclaration2(String name, List<String> constantName
s) { |
| 137 int count = constantNames.length; | 189 int count = constantNames.length; |
| 138 List<EnumConstantDeclaration> constants = new List<EnumConstantDeclaration>(
count); | 190 List<EnumConstantDeclaration> constants = new List<EnumConstantDeclaration>(
count); |
| 139 for (int i = 0; i < count; i++) { | 191 for (int i = 0; i < count; i++) { |
| 140 constants[i] = new EnumConstantDeclaration(null, null, identifier3(constan
tNames[i])); | 192 constants[i] = new EnumConstantDeclaration(null, null, identifier3(constan
tNames[i])); |
| 141 } | 193 } |
| 142 return enumDeclaration(identifier3(name), constants); | 194 return enumDeclaration(identifier3(name), constants); |
| 143 } | 195 } |
| 144 | 196 |
| 145 static ExportDirective exportDirective(List<Annotation> metadata, String uri,
List<Combinator> combinators) => new ExportDirective(null, metadata, TokenFactor
y.tokenFromKeyword(Keyword.EXPORT), string2(uri), list(combinators), TokenFactor
y.tokenFromType(TokenType.SEMICOLON)); | 197 static ExportDirective exportDirective(List<Annotation> metadata, String uri,
[List<Combinator> combinators]) |
| 198 => new ExportDirective( |
| 199 null, |
| 200 metadata, |
| 201 TokenFactory.tokenFromKeyword(Keyword.EXPORT), |
| 202 string2(uri), |
| 203 combinators, |
| 204 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 146 | 205 |
| 147 static ExportDirective exportDirective2(String uri, List<Combinator> combinato
rs) => exportDirective(new List<Annotation>(), uri, combinators); | 206 static ExportDirective exportDirective2(String uri, [List<Combinator> combinat
ors]) |
| 207 => exportDirective(null, uri, combinators); |
| 148 | 208 |
| 149 static ExpressionFunctionBody expressionFunctionBody(Expression expression) =>
new ExpressionFunctionBody(null, TokenFactory.tokenFromType(TokenType.FUNCTION)
, expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 209 static ExpressionFunctionBody expressionFunctionBody(Expression expression) =>
new ExpressionFunctionBody(null, TokenFactory.tokenFromType(TokenType.FUNCTION)
, expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 150 | 210 |
| 151 static ExpressionStatement expressionStatement(Expression expression) => new E
xpressionStatement(expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 211 static ExpressionStatement expressionStatement(Expression expression) => new E
xpressionStatement(expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 152 | 212 |
| 153 static ExtendsClause extendsClause(TypeName type) => new ExtendsClause(TokenFa
ctory.tokenFromKeyword(Keyword.EXTENDS), type); | 213 static ExtendsClause extendsClause(TypeName type) => new ExtendsClause(TokenFa
ctory.tokenFromKeyword(Keyword.EXTENDS), type); |
| 154 | 214 |
| 155 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, TypeN
ame type, List<VariableDeclaration> variables) => new FieldDeclaration(null, nul
l, isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null, variableDecl
arationList(keyword, type, variables), TokenFactory.tokenFromType(TokenType.SEMI
COLON)); | 215 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, TypeN
ame type, List<VariableDeclaration> variables) => new FieldDeclaration(null, nul
l, isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null, variableDecl
arationList(keyword, type, variables), TokenFactory.tokenFromType(TokenType.SEMI
COLON)); |
| 156 | 216 |
| 157 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, List
<VariableDeclaration> variables) => fieldDeclaration(isStatic, keyword, null, va
riables); | 217 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, List
<VariableDeclaration> variables) => fieldDeclaration(isStatic, keyword, null, va
riables); |
| 158 | 218 |
| 159 static FieldFormalParameter fieldFormalParameter(Keyword keyword, TypeName typ
e, String identifier, [FormalParameterList parameterList]) => new FieldFormalPar
ameter(null, null, keyword == null ? null : TokenFactory.tokenFromKeyword(keywor
d), type, TokenFactory.tokenFromKeyword(Keyword.THIS), TokenFactory.tokenFromTyp
e(TokenType.PERIOD), identifier3(identifier), parameterList); | 219 static FieldFormalParameter fieldFormalParameter(Keyword keyword, TypeName typ
e, String identifier, [FormalParameterList parameterList]) => new FieldFormalPar
ameter(null, null, keyword == null ? null : TokenFactory.tokenFromKeyword(keywor
d), type, TokenFactory.tokenFromKeyword(Keyword.THIS), TokenFactory.tokenFromTyp
e(TokenType.PERIOD), identifier3(identifier), parameterList); |
| 160 | 220 |
| 161 static FieldFormalParameter fieldFormalParameter2(String identifier) => fieldF
ormalParameter(null, null, identifier); | 221 static FieldFormalParameter fieldFormalParameter2(String identifier) => fieldF
ormalParameter(null, null, identifier); |
| 162 | 222 |
| 163 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, Expr
ession iterator, Statement body) => new ForEachStatement.con1(null, TokenFactory
.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN)
, loopVariable, TokenFactory.tokenFromKeyword(Keyword.IN), iterator, TokenFactor
y.tokenFromType(TokenType.CLOSE_PAREN), body); | 223 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, Expr
ession iterator, Statement body) => new ForEachStatement.con1(null, TokenFactory
.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN)
, loopVariable, TokenFactory.tokenFromKeyword(Keyword.IN), iterator, TokenFactor
y.tokenFromType(TokenType.CLOSE_PAREN), body); |
| 164 | 224 |
| 165 static ForEachStatement forEachStatement2(SimpleIdentifier identifier, Express
ion iterator, Statement body) => new ForEachStatement.con2(null, TokenFactory.to
kenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), i
dentifier, TokenFactory.tokenFromKeyword(Keyword.IN), iterator, TokenFactory.tok
enFromType(TokenType.CLOSE_PAREN), body); | 225 static ForEachStatement forEachStatement2(SimpleIdentifier identifier, Express
ion iterator, Statement body) => new ForEachStatement.con2(null, TokenFactory.to
kenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), i
dentifier, TokenFactory.tokenFromKeyword(Keyword.IN), iterator, TokenFactory.tok
enFromType(TokenType.CLOSE_PAREN), body); |
| 166 | 226 |
| 167 static FormalParameterList formalParameterList(List<FormalParameter> parameter
s) => new FormalParameterList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
list(parameters), null, null, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN))
; | 227 static FormalParameterList formalParameterList([List<FormalParameter> paramete
rs]) |
| 228 => new FormalParameterList( |
| 229 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 230 parameters, |
| 231 null, |
| 232 null, |
| 233 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); |
| 168 | 234 |
| 169 static ForStatement forStatement(Expression initialization, Expression conditi
on, List<Expression> updaters, Statement body) => new ForStatement(TokenFactory.
tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
null, initialization, TokenFactory.tokenFromType(TokenType.SEMICOLON), conditio
n, TokenFactory.tokenFromType(TokenType.SEMICOLON), updaters, TokenFactory.token
FromType(TokenType.CLOSE_PAREN), body); | 235 static ForStatement forStatement(Expression initialization, Expression conditi
on, List<Expression> updaters, Statement body) => new ForStatement(TokenFactory.
tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
null, initialization, TokenFactory.tokenFromType(TokenType.SEMICOLON), conditio
n, TokenFactory.tokenFromType(TokenType.SEMICOLON), updaters, TokenFactory.token
FromType(TokenType.CLOSE_PAREN), body); |
| 170 | 236 |
| 171 static ForStatement forStatement2(VariableDeclarationList variableList, Expres
sion condition, List<Expression> updaters, Statement body) => new ForStatement(T
okenFactory.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.
OPEN_PAREN), variableList, null, TokenFactory.tokenFromType(TokenType.SEMICOLON)
, condition, TokenFactory.tokenFromType(TokenType.SEMICOLON), updaters, TokenFac
tory.tokenFromType(TokenType.CLOSE_PAREN), body); | 237 static ForStatement forStatement2(VariableDeclarationList variableList, Expres
sion condition, List<Expression> updaters, Statement body) => new ForStatement(T
okenFactory.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.
OPEN_PAREN), variableList, null, TokenFactory.tokenFromType(TokenType.SEMICOLON)
, condition, TokenFactory.tokenFromType(TokenType.SEMICOLON), updaters, TokenFac
tory.tokenFromType(TokenType.CLOSE_PAREN), body); |
| 172 | 238 |
| 173 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
String name, FunctionExpression functionExpression) => new FunctionDeclaration(
null, null, null, type, keyword == null ? null : TokenFactory.tokenFromKeyword(k
eyword), identifier3(name), functionExpression); | 239 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
String name, FunctionExpression functionExpression) => new FunctionDeclaration(
null, null, null, type, keyword == null ? null : TokenFactory.tokenFromKeyword(k
eyword), identifier3(name), functionExpression); |
| 174 | 240 |
| 175 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type
, Keyword keyword, String name, FunctionExpression functionExpression) => new Fu
nctionDeclarationStatement(functionDeclaration(type, keyword, name, functionExpr
ession)); | 241 static FunctionDeclarationStatement functionDeclarationStatement(TypeName type
, Keyword keyword, String name, FunctionExpression functionExpression) => new Fu
nctionDeclarationStatement(functionDeclaration(type, keyword, name, functionExpr
ession)); |
| 176 | 242 |
| 177 static FunctionExpression functionExpression() => new FunctionExpression(forma
lParameterList([]), blockFunctionBody2([])); | 243 static FunctionExpression functionExpression() => new FunctionExpression(forma
lParameterList(), blockFunctionBody2()); |
| 178 | 244 |
| 179 static FunctionExpression functionExpression2(FormalParameterList parameters,
FunctionBody body) => new FunctionExpression(parameters, body); | 245 static FunctionExpression functionExpression2(FormalParameterList parameters,
FunctionBody body) => new FunctionExpression(parameters, body); |
| 180 | 246 |
| 181 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu
nction, List<Expression> arguments) => new FunctionExpressionInvocation(function
, argumentList(arguments)); | 247 static FunctionExpressionInvocation functionExpressionInvocation(Expression fu
nction, [List<Expression> arguments]) |
| 248 => new FunctionExpressionInvocation(function, argumentList(arguments)); |
| 182 | 249 |
| 183 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu
rnType, String identifier, List<FormalParameter> parameters) => new FunctionType
dFormalParameter(null, null, returnType, identifier3(identifier), formalParamete
rList(parameters)); | 250 static FunctionTypedFormalParameter functionTypedFormalParameter(TypeName retu
rnType, String identifier, [List<FormalParameter> parameters]) |
| 251 => new FunctionTypedFormalParameter( |
| 252 null, |
| 253 null, |
| 254 returnType, |
| 255 identifier3(identifier), |
| 256 formalParameterList(parameters)); |
| 184 | 257 |
| 185 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne
w HideCombinator(TokenFactory.tokenFromString("hide"), list(identifiers)); | 258 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => ne
w HideCombinator(TokenFactory.tokenFromString("hide"), identifiers); |
| 186 | 259 |
| 187 static HideCombinator hideCombinator2(List<String> identifiers) { | 260 static HideCombinator hideCombinator2(List<String> identifiers) |
| 188 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); | 261 => new HideCombinator( |
| 189 for (String identifier in identifiers) { | 262 TokenFactory.tokenFromString("hide"), |
| 190 identifierList.add(identifier3(identifier)); | 263 identifierList(identifiers)); |
| 191 } | |
| 192 return new HideCombinator(TokenFactory.tokenFromString("hide"), identifierLi
st); | |
| 193 } | |
| 194 | 264 |
| 195 static PrefixedIdentifier identifier(SimpleIdentifier prefix, SimpleIdentifier
identifier) => new PrefixedIdentifier(prefix, TokenFactory.tokenFromType(TokenT
ype.PERIOD), identifier); | 265 static PrefixedIdentifier identifier(SimpleIdentifier prefix, SimpleIdentifier
identifier) => new PrefixedIdentifier(prefix, TokenFactory.tokenFromType(TokenT
ype.PERIOD), identifier); |
| 196 | 266 |
| 197 static SimpleIdentifier identifier3(String lexeme) => new SimpleIdentifier(Tok
enFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme)); | 267 static SimpleIdentifier identifier3(String lexeme) => new SimpleIdentifier(Tok
enFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme)); |
| 198 | 268 |
| 199 static PrefixedIdentifier identifier4(String prefix, SimpleIdentifier identifi
er) => new PrefixedIdentifier(identifier3(prefix), TokenFactory.tokenFromType(To
kenType.PERIOD), identifier); | 269 static PrefixedIdentifier identifier4(String prefix, SimpleIdentifier identifi
er) => new PrefixedIdentifier(identifier3(prefix), TokenFactory.tokenFromType(To
kenType.PERIOD), identifier); |
| 200 | 270 |
| 201 static PrefixedIdentifier identifier5(String prefix, String identifier) => new
PrefixedIdentifier(identifier3(prefix), TokenFactory.tokenFromType(TokenType.PE
RIOD), identifier3(identifier)); | 271 static PrefixedIdentifier identifier5(String prefix, String identifier) => new
PrefixedIdentifier(identifier3(prefix), TokenFactory.tokenFromType(TokenType.PE
RIOD), identifier3(identifier)); |
| 202 | 272 |
| 273 static List<SimpleIdentifier> identifierList(List<String> identifiers) { |
| 274 if (identifiers == null) { |
| 275 return null; |
| 276 } |
| 277 return identifiers.map((String identifier) => identifier3(identifier)).toLis
t(); |
| 278 } |
| 279 |
| 203 static IfStatement ifStatement(Expression condition, Statement thenStatement)
=> ifStatement2(condition, thenStatement, null); | 280 static IfStatement ifStatement(Expression condition, Statement thenStatement)
=> ifStatement2(condition, thenStatement, null); |
| 204 | 281 |
| 205 static IfStatement ifStatement2(Expression condition, Statement thenStatement,
Statement elseStatement) => new IfStatement(TokenFactory.tokenFromKeyword(Keywo
rd.IF), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condition, TokenFactor
y.tokenFromType(TokenType.CLOSE_PAREN), thenStatement, elseStatement == null ? n
ull : TokenFactory.tokenFromKeyword(Keyword.ELSE), elseStatement); | 282 static IfStatement ifStatement2(Expression condition, Statement thenStatement,
Statement elseStatement) => new IfStatement(TokenFactory.tokenFromKeyword(Keywo
rd.IF), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condition, TokenFactor
y.tokenFromType(TokenType.CLOSE_PAREN), thenStatement, elseStatement == null ? n
ull : TokenFactory.tokenFromKeyword(Keyword.ELSE), elseStatement); |
| 206 | 283 |
| 207 static ImplementsClause implementsClause(List<TypeName> types) => new Implemen
tsClause(TokenFactory.tokenFromKeyword(Keyword.IMPLEMENTS), list(types)); | 284 static ImplementsClause implementsClause(List<TypeName> types) => new Implemen
tsClause(TokenFactory.tokenFromKeyword(Keyword.IMPLEMENTS), types); |
| 208 | 285 |
| 209 static ImportDirective importDirective(List<Annotation> metadata, String uri,
bool isDeferred, String prefix, List<Combinator> combinators) => new ImportDirec
tive(null, metadata, TokenFactory.tokenFromKeyword(Keyword.IMPORT), string2(uri)
, !isDeferred ? null : TokenFactory.tokenFromKeyword(Keyword.DEFERRED), prefix =
= null ? null : TokenFactory.tokenFromKeyword(Keyword.AS), prefix == null ? null
: identifier3(prefix), list(combinators), TokenFactory.tokenFromType(TokenType.
SEMICOLON)); | 286 static ImportDirective importDirective(List<Annotation> metadata, String uri,
bool isDeferred, String prefix, [List<Combinator> combinators]) |
| 287 => new ImportDirective( |
| 288 null, |
| 289 metadata, |
| 290 TokenFactory.tokenFromKeyword(Keyword.IMPORT), |
| 291 string2(uri), |
| 292 !isDeferred ? null : TokenFactory.tokenFromKeyword(Keyword.DEFERRED), |
| 293 prefix == null ? null : TokenFactory.tokenFromKeyword(Keyword.AS), |
| 294 prefix == null ? null : identifier3(prefix), |
| 295 combinators, |
| 296 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 210 | 297 |
| 211 static ImportDirective importDirective2(String uri, bool isDeferred, String pr
efix, List<Combinator> combinators) => importDirective(new List<Annotation>(), u
ri, isDeferred, prefix, combinators); | 298 static ImportDirective importDirective2(String uri, bool isDeferred, String pr
efix, [List<Combinator> combinators]) |
| 299 => importDirective(null, uri, isDeferred, prefix, combinators); |
| 212 | 300 |
| 213 static ImportDirective importDirective3(String uri, String prefix, List<Combin
ator> combinators) => importDirective(new List<Annotation>(), uri, false, prefix
, combinators); | 301 static ImportDirective importDirective3(String uri, String prefix, [List<Combi
nator> combinators]) |
| 302 => importDirective(null, uri, false, prefix, combinators); |
| 214 | 303 |
| 215 static IndexExpression indexExpression(Expression array, Expression index) =>
new IndexExpression.forTarget(array, TokenFactory.tokenFromType(TokenType.OPEN_S
QUARE_BRACKET), index, TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET
)); | 304 static IndexExpression indexExpression(Expression array, Expression index) =>
new IndexExpression.forTarget(array, TokenFactory.tokenFromType(TokenType.OPEN_S
QUARE_BRACKET), index, TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET
)); |
| 216 | 305 |
| 217 static InstanceCreationExpression instanceCreationExpression(Keyword keyword,
ConstructorName name, List<Expression> arguments) => new InstanceCreationExpress
ion(keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), name, argum
entList(arguments)); | 306 static InstanceCreationExpression instanceCreationExpression(Keyword keyword,
ConstructorName name, [List<Expression> arguments]) |
| 307 => new InstanceCreationExpression( |
| 308 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 309 name, |
| 310 argumentList(arguments)); |
| 218 | 311 |
| 219 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword,
TypeName type, List<Expression> arguments) => instanceCreationExpression3(keywo
rd, type, null, arguments); | 312 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword,
TypeName type, [List<Expression> arguments]) |
| 313 => instanceCreationExpression3(keyword, type, null, arguments); |
| 220 | 314 |
| 221 static InstanceCreationExpression instanceCreationExpression3(Keyword keyword,
TypeName type, String identifier, List<Expression> arguments) => instanceCreati
onExpression(keyword, new ConstructorName(type, identifier == null ? null : Toke
nFactory.tokenFromType(TokenType.PERIOD), identifier == null ? null : identifier
3(identifier)), arguments); | 315 static InstanceCreationExpression instanceCreationExpression3(Keyword keyword,
TypeName type, String identifier, [List<Expression> arguments]) |
| 316 => instanceCreationExpression( |
| 317 keyword, |
| 318 new ConstructorName( |
| 319 type, |
| 320 identifier == null ? null : TokenFactory.tokenFromType(TokenType.P
ERIOD), |
| 321 identifier == null ? null : identifier3(identifier)), |
| 322 arguments); |
| 222 | 323 |
| 223 static IntegerLiteral integer(int value) => new IntegerLiteral(TokenFactory.to
kenFromTypeAndString(TokenType.INT, value.toString()), value); | 324 static IntegerLiteral integer(int value) => new IntegerLiteral(TokenFactory.to
kenFromTypeAndString(TokenType.INT, value.toString()), value); |
| 224 | 325 |
| 225 static InterpolationExpression interpolationExpression(Expression expression)
=> new InterpolationExpression(TokenFactory.tokenFromType(TokenType.STRING_INTER
POLATION_EXPRESSION), expression, TokenFactory.tokenFromType(TokenType.CLOSE_CUR
LY_BRACKET)); | 326 static InterpolationExpression interpolationExpression(Expression expression)
=> new InterpolationExpression(TokenFactory.tokenFromType(TokenType.STRING_INTER
POLATION_EXPRESSION), expression, TokenFactory.tokenFromType(TokenType.CLOSE_CUR
LY_BRACKET)); |
| 226 | 327 |
| 227 static InterpolationExpression interpolationExpression2(String identifier) =>
new InterpolationExpression(TokenFactory.tokenFromType(TokenType.STRING_INTERPOL
ATION_IDENTIFIER), identifier3(identifier), null); | 328 static InterpolationExpression interpolationExpression2(String identifier) =>
new InterpolationExpression(TokenFactory.tokenFromType(TokenType.STRING_INTERPOL
ATION_IDENTIFIER), identifier3(identifier), null); |
| 228 | 329 |
| 229 static InterpolationString interpolationString(String contents, String value)
=> new InterpolationString(TokenFactory.tokenFromString(contents), value); | 330 static InterpolationString interpolationString(String contents, String value)
=> new InterpolationString(TokenFactory.tokenFromString(contents), value); |
| 230 | 331 |
| 231 static IsExpression isExpression(Expression expression, bool negated, TypeName
type) => new IsExpression(expression, TokenFactory.tokenFromKeyword(Keyword.IS)
, negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, type); | 332 static IsExpression isExpression(Expression expression, bool negated, TypeName
type) => new IsExpression(expression, TokenFactory.tokenFromKeyword(Keyword.IS)
, negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, type); |
| 232 | 333 |
| 233 static Label label(SimpleIdentifier label) => new Label(label, TokenFactory.to
kenFromType(TokenType.COLON)); | 334 static Label label(SimpleIdentifier label) => new Label(label, TokenFactory.to
kenFromType(TokenType.COLON)); |
| 234 | 335 |
| 235 static Label label2(String label) => AstFactory.label(identifier3(label)); | 336 static Label label2(String label) => AstFactory.label(identifier3(label)); |
| 236 | 337 |
| 237 static LabeledStatement labeledStatement(List<Label> labels, Statement stateme
nt) => new LabeledStatement(labels, statement); | 338 static LabeledStatement labeledStatement(List<Label> labels, Statement stateme
nt) => new LabeledStatement(labels, statement); |
| 238 | 339 |
| 239 static LibraryDirective libraryDirective(List<Annotation> metadata, LibraryIde
ntifier libraryName) => new LibraryDirective(null, metadata, TokenFactory.tokenF
romKeyword(Keyword.LIBRARY), libraryName, TokenFactory.tokenFromType(TokenType.S
EMICOLON)); | 340 static LibraryDirective libraryDirective(List<Annotation> metadata, LibraryIde
ntifier libraryName) => new LibraryDirective(null, metadata, TokenFactory.tokenF
romKeyword(Keyword.LIBRARY), libraryName, TokenFactory.tokenFromType(TokenType.S
EMICOLON)); |
| 240 | 341 |
| 241 static LibraryDirective libraryDirective2(String libraryName) => libraryDirect
ive(new List<Annotation>(), libraryIdentifier2([libraryName])); | 342 static LibraryDirective libraryDirective2(String libraryName) => libraryDirect
ive(new List<Annotation>(), libraryIdentifier2([libraryName])); |
| 242 | 343 |
| 243 static LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components)
=> new LibraryIdentifier(list(components)); | 344 static LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components)
=> new LibraryIdentifier(components); |
| 244 | 345 |
| 245 static LibraryIdentifier libraryIdentifier2(List<String> components) { | 346 static LibraryIdentifier libraryIdentifier2(List<String> components) { |
| 246 List<SimpleIdentifier> componentList = new List<SimpleIdentifier>(); | 347 return new LibraryIdentifier(identifierList(components)); |
| 247 for (String component in components) { | |
| 248 componentList.add(identifier3(component)); | |
| 249 } | |
| 250 return new LibraryIdentifier(componentList); | |
| 251 } | 348 } |
| 252 | 349 |
| 253 static List list(List<Object> elements) { | 350 static List list(List<Object> elements) { |
| 254 List elementList = new List(); | 351 return elements; |
| 255 for (Object element in elements) { | |
| 256 elementList.add(element); | |
| 257 } | |
| 258 return elementList; | |
| 259 } | 352 } |
| 260 | 353 |
| 261 static ListLiteral listLiteral(List<Expression> elements) => listLiteral2(null
, null, elements); | 354 static ListLiteral listLiteral([List<Expression> elements]) |
| 355 => listLiteral2(null, null, elements); |
| 262 | 356 |
| 263 static ListLiteral listLiteral2(Keyword keyword, TypeArgumentList typeArgument
s, List<Expression> elements) => new ListLiteral(keyword == null ? null : TokenF
actory.tokenFromKeyword(keyword), typeArguments, TokenFactory.tokenFromType(Toke
nType.OPEN_SQUARE_BRACKET), list(elements), TokenFactory.tokenFromType(TokenType
.CLOSE_SQUARE_BRACKET)); | 357 static ListLiteral listLiteral2(Keyword keyword, TypeArgumentList typeArgument
s, [List<Expression> elements]) |
| 358 => new ListLiteral( |
| 359 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 360 typeArguments, |
| 361 TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), |
| 362 elements, |
| 363 TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET)); |
| 264 | 364 |
| 265 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
List<MapLiteralEntry> entries) => new MapLiteral(keyword == null ? null : TokenF
actory.tokenFromKeyword(keyword), typeArguments, TokenFactory.tokenFromType(Toke
nType.OPEN_CURLY_BRACKET), list(entries), TokenFactory.tokenFromType(TokenType.C
LOSE_CURLY_BRACKET)); | 365 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
[List<MapLiteralEntry> entries]) |
| 366 => new MapLiteral( |
| 367 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 368 typeArguments, |
| 369 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), |
| 370 entries, |
| 371 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 266 | 372 |
| 267 static MapLiteral mapLiteral2(List<MapLiteralEntry> entries) => mapLiteral(nul
l, null, entries); | 373 static MapLiteral mapLiteral2([List<MapLiteralEntry> entries]) |
| 374 => mapLiteral(null, null, entries); |
| 268 | 375 |
| 269 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => new Ma
pLiteralEntry(string2(key), TokenFactory.tokenFromType(TokenType.COLON), value); | 376 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => new Ma
pLiteralEntry(string2(key), TokenFactory.tokenFromType(TokenType.COLON), value); |
| 270 | 377 |
| 271 static MethodDeclaration methodDeclaration(Keyword modifier, TypeName returnTy
pe, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterLi
st parameters) => new MethodDeclaration(null, null, TokenFactory.tokenFromKeywor
d(Keyword.EXTERNAL), modifier == null ? null : TokenFactory.tokenFromKeyword(mod
ifier), returnType, property == null ? null : TokenFactory.tokenFromKeyword(prop
erty), operator == null ? null : TokenFactory.tokenFromKeyword(operator), name,
parameters, emptyFunctionBody()); | 378 static MethodDeclaration methodDeclaration(Keyword modifier, TypeName returnTy
pe, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterLi
st parameters) => new MethodDeclaration(null, null, TokenFactory.tokenFromKeywor
d(Keyword.EXTERNAL), modifier == null ? null : TokenFactory.tokenFromKeyword(mod
ifier), returnType, property == null ? null : TokenFactory.tokenFromKeyword(prop
erty), operator == null ? null : TokenFactory.tokenFromKeyword(operator), name,
parameters, emptyFunctionBody()); |
| 272 | 379 |
| 273 static MethodDeclaration methodDeclaration2(Keyword modifier, TypeName returnT
ype, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterL
ist parameters, FunctionBody body) => new MethodDeclaration(null, null, null, mo
difier == null ? null : TokenFactory.tokenFromKeyword(modifier), returnType, pro
perty == null ? null : TokenFactory.tokenFromKeyword(property), operator == null
? null : TokenFactory.tokenFromKeyword(operator), name, parameters, body); | 380 static MethodDeclaration methodDeclaration2(Keyword modifier, TypeName returnT
ype, Keyword property, Keyword operator, SimpleIdentifier name, FormalParameterL
ist parameters, FunctionBody body) => new MethodDeclaration(null, null, null, mo
difier == null ? null : TokenFactory.tokenFromKeyword(modifier), returnType, pro
perty == null ? null : TokenFactory.tokenFromKeyword(property), operator == null
? null : TokenFactory.tokenFromKeyword(operator), name, parameters, body); |
| 274 | 381 |
| 275 static MethodInvocation methodInvocation(Expression target, String methodName,
List<Expression> arguments) => new MethodInvocation(target, target == null ? nu
ll : TokenFactory.tokenFromType(TokenType.PERIOD), identifier3(methodName), argu
mentList(arguments)); | 382 static MethodInvocation methodInvocation(Expression target, String methodName,
[List<Expression> arguments]) |
| 383 => new MethodInvocation( |
| 384 target, |
| 385 target == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 386 identifier3(methodName), |
| 387 argumentList(arguments)); |
| 276 | 388 |
| 277 static MethodInvocation methodInvocation2(String methodName, List<Expression>
arguments) => methodInvocation(null, methodName, arguments); | 389 static MethodInvocation methodInvocation2(String methodName, [List<Expression>
arguments]) |
| 390 => methodInvocation(null, methodName, arguments); |
| 278 | 391 |
| 279 static NamedExpression namedExpression(Label label, Expression expression) =>
new NamedExpression(label, expression); | 392 static NamedExpression namedExpression(Label label, Expression expression) =>
new NamedExpression(label, expression); |
| 280 | 393 |
| 281 static NamedExpression namedExpression2(String label, Expression expression) =
> namedExpression(label2(label), expression); | 394 static NamedExpression namedExpression2(String label, Expression expression) =
> namedExpression(label2(label), expression); |
| 282 | 395 |
| 283 static DefaultFormalParameter namedFormalParameter(NormalFormalParameter param
eter, Expression expression) => new DefaultFormalParameter(parameter, ParameterK
ind.NAMED, expression == null ? null : TokenFactory.tokenFromType(TokenType.COLO
N), expression); | 396 static DefaultFormalParameter namedFormalParameter(NormalFormalParameter param
eter, Expression expression) => new DefaultFormalParameter(parameter, ParameterK
ind.NAMED, expression == null ? null : TokenFactory.tokenFromType(TokenType.COLO
N), expression); |
| 284 | 397 |
| 285 static NativeClause nativeClause(String nativeCode) => new NativeClause(TokenF
actory.tokenFromString("native"), string2(nativeCode)); | 398 static NativeClause nativeClause(String nativeCode) => new NativeClause(TokenF
actory.tokenFromString("native"), string2(nativeCode)); |
| 286 | 399 |
| 287 static NativeFunctionBody nativeFunctionBody(String nativeMethodName) => new N
ativeFunctionBody(TokenFactory.tokenFromString("native"), string2(nativeMethodNa
me), TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 400 static NativeFunctionBody nativeFunctionBody(String nativeMethodName) => new N
ativeFunctionBody(TokenFactory.tokenFromString("native"), string2(nativeMethodNa
me), TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 301 static DefaultFormalParameter positionalFormalParameter(NormalFormalParameter
parameter, Expression expression) => new DefaultFormalParameter(parameter, Param
eterKind.POSITIONAL, expression == null ? null : TokenFactory.tokenFromType(Toke
nType.EQ), expression); | 414 static DefaultFormalParameter positionalFormalParameter(NormalFormalParameter
parameter, Expression expression) => new DefaultFormalParameter(parameter, Param
eterKind.POSITIONAL, expression == null ? null : TokenFactory.tokenFromType(Toke
nType.EQ), expression); |
| 302 | 415 |
| 303 static PostfixExpression postfixExpression(Expression expression, TokenType op
erator) => new PostfixExpression(expression, TokenFactory.tokenFromType(operator
)); | 416 static PostfixExpression postfixExpression(Expression expression, TokenType op
erator) => new PostfixExpression(expression, TokenFactory.tokenFromType(operator
)); |
| 304 | 417 |
| 305 static PrefixExpression prefixExpression(TokenType operator, Expression expres
sion) => new PrefixExpression(TokenFactory.tokenFromType(operator), expression); | 418 static PrefixExpression prefixExpression(TokenType operator, Expression expres
sion) => new PrefixExpression(TokenFactory.tokenFromType(operator), expression); |
| 306 | 419 |
| 307 static PropertyAccess propertyAccess(Expression target, SimpleIdentifier prope
rtyName) => new PropertyAccess(target, TokenFactory.tokenFromType(TokenType.PERI
OD), propertyName); | 420 static PropertyAccess propertyAccess(Expression target, SimpleIdentifier prope
rtyName) => new PropertyAccess(target, TokenFactory.tokenFromType(TokenType.PERI
OD), propertyName); |
| 308 | 421 |
| 309 static PropertyAccess propertyAccess2(Expression target, String propertyName)
=> new PropertyAccess(target, TokenFactory.tokenFromType(TokenType.PERIOD), iden
tifier3(propertyName)); | 422 static PropertyAccess propertyAccess2(Expression target, String propertyName)
=> new PropertyAccess(target, TokenFactory.tokenFromType(TokenType.PERIOD), iden
tifier3(propertyName)); |
| 310 | 423 |
| 311 static RedirectingConstructorInvocation redirectingConstructorInvocation(List<
Expression> arguments) => redirectingConstructorInvocation2(null, arguments); | 424 static RedirectingConstructorInvocation redirectingConstructorInvocation([List
<Expression> arguments]) |
| 425 => redirectingConstructorInvocation2(null, arguments); |
| 312 | 426 |
| 313 static RedirectingConstructorInvocation redirectingConstructorInvocation2(Stri
ng constructorName, List<Expression> arguments) => new RedirectingConstructorInv
ocation(TokenFactory.tokenFromKeyword(Keyword.THIS), constructorName == null ? n
ull : TokenFactory.tokenFromType(TokenType.PERIOD), constructorName == null ? nu
ll : identifier3(constructorName), argumentList(arguments)); | 427 static RedirectingConstructorInvocation redirectingConstructorInvocation2(Stri
ng constructorName, [List<Expression> arguments]) |
| 428 => new RedirectingConstructorInvocation( |
| 429 TokenFactory.tokenFromKeyword(Keyword.THIS), |
| 430 constructorName == null ? null : TokenFactory.tokenFromType(TokenType.
PERIOD), |
| 431 constructorName == null ? null : identifier3(constructorName), |
| 432 argumentList(arguments)); |
| 314 | 433 |
| 315 static RethrowExpression rethrowExpression() => new RethrowExpression(TokenFac
tory.tokenFromKeyword(Keyword.RETHROW)); | 434 static RethrowExpression rethrowExpression() => new RethrowExpression(TokenFac
tory.tokenFromKeyword(Keyword.RETHROW)); |
| 316 | 435 |
| 317 static ReturnStatement returnStatement() => returnStatement2(null); | 436 static ReturnStatement returnStatement() => returnStatement2(null); |
| 318 | 437 |
| 319 static ReturnStatement returnStatement2(Expression expression) => new ReturnSt
atement(TokenFactory.tokenFromKeyword(Keyword.RETURN), expression, TokenFactory.
tokenFromType(TokenType.SEMICOLON)); | 438 static ReturnStatement returnStatement2(Expression expression) => new ReturnSt
atement(TokenFactory.tokenFromKeyword(Keyword.RETURN), expression, TokenFactory.
tokenFromType(TokenType.SEMICOLON)); |
| 320 | 439 |
| 321 static ScriptTag scriptTag(String scriptTag) => new ScriptTag(TokenFactory.tok
enFromString(scriptTag)); | 440 static ScriptTag scriptTag(String scriptTag) => new ScriptTag(TokenFactory.tok
enFromString(scriptTag)); |
| 322 | 441 |
| 323 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => ne
w ShowCombinator(TokenFactory.tokenFromString("show"), list(identifiers)); | 442 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => ne
w ShowCombinator(TokenFactory.tokenFromString("show"), identifiers); |
| 324 | 443 |
| 325 static ShowCombinator showCombinator2(List<String> identifiers) { | 444 static ShowCombinator showCombinator2(List<String> identifiers) |
| 326 List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>(); | 445 => new ShowCombinator( |
| 327 for (String identifier in identifiers) { | 446 TokenFactory.tokenFromString("show"), |
| 328 identifierList.add(identifier3(identifier)); | 447 identifierList(identifiers)); |
| 329 } | |
| 330 return new ShowCombinator(TokenFactory.tokenFromString("show"), identifierLi
st); | |
| 331 } | |
| 332 | 448 |
| 333 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, String par
ameterName) => simpleFormalParameter2(keyword, null, parameterName); | 449 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, String par
ameterName) => simpleFormalParameter2(keyword, null, parameterName); |
| 334 | 450 |
| 335 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, TypeName
type, String parameterName) => new SimpleFormalParameter(null, null, keyword ==
null ? null : TokenFactory.tokenFromKeyword(keyword), type, identifier3(paramete
rName)); | 451 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, TypeName
type, String parameterName) => new SimpleFormalParameter(null, null, keyword ==
null ? null : TokenFactory.tokenFromKeyword(keyword), type, identifier3(paramete
rName)); |
| 336 | 452 |
| 337 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => s
impleFormalParameter2(null, null, parameterName); | 453 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => s
impleFormalParameter2(null, null, parameterName); |
| 338 | 454 |
| 339 static SimpleFormalParameter simpleFormalParameter4(TypeName type, String para
meterName) => simpleFormalParameter2(null, type, parameterName); | 455 static SimpleFormalParameter simpleFormalParameter4(TypeName type, String para
meterName) => simpleFormalParameter2(null, type, parameterName); |
| 340 | 456 |
| 341 static StringInterpolation string(List<InterpolationElement> elements) => new
StringInterpolation(list(elements)); | 457 static StringInterpolation string([List<InterpolationElement> elements]) |
| 458 => new StringInterpolation(elements); |
| 342 | 459 |
| 343 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral(
TokenFactory.tokenFromString("'$content'"), content); | 460 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral(
TokenFactory.tokenFromString("'$content'"), content); |
| 344 | 461 |
| 345 static SuperConstructorInvocation superConstructorInvocation(List<Expression>
arguments) => superConstructorInvocation2(null, arguments); | 462 static SuperConstructorInvocation superConstructorInvocation([List<Expression>
arguments]) |
| 463 => superConstructorInvocation2(null, arguments); |
| 346 | 464 |
| 347 static SuperConstructorInvocation superConstructorInvocation2(String name, Lis
t<Expression> arguments) => new SuperConstructorInvocation(TokenFactory.tokenFro
mKeyword(Keyword.SUPER), name == null ? null : TokenFactory.tokenFromType(TokenT
ype.PERIOD), name == null ? null : identifier3(name), argumentList(arguments)); | 465 static SuperConstructorInvocation superConstructorInvocation2(String name, [Li
st<Expression> arguments]) |
| 466 => new SuperConstructorInvocation( |
| 467 TokenFactory.tokenFromKeyword(Keyword.SUPER), |
| 468 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 469 name == null ? null : identifier3(name), |
| 470 argumentList(arguments)); |
| 348 | 471 |
| 349 static SuperExpression superExpression() => new SuperExpression(TokenFactory.t
okenFromKeyword(Keyword.SUPER)); | 472 static SuperExpression superExpression() => new SuperExpression(TokenFactory.t
okenFromKeyword(Keyword.SUPER)); |
| 350 | 473 |
| 351 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); | 474 static SwitchCase switchCase(Expression expression, List<Statement> statements
) => switchCase2(new List<Label>(), expression, statements); |
| 352 | 475 |
| 353 static SwitchCase switchCase2(List<Label> labels, Expression expression, List<
Statement> statements) => new SwitchCase(labels, TokenFactory.tokenFromKeyword(K
eyword.CASE), expression, TokenFactory.tokenFromType(TokenType.COLON), list(stat
ements)); | 476 static SwitchCase switchCase2(List<Label> labels, Expression expression, List<
Statement> statements) => new SwitchCase(labels, TokenFactory.tokenFromKeyword(K
eyword.CASE), expression, TokenFactory.tokenFromType(TokenType.COLON), statement
s); |
| 354 | 477 |
| 355 static SwitchDefault switchDefault(List<Label> labels, List<Statement> stateme
nts) => new SwitchDefault(labels, TokenFactory.tokenFromKeyword(Keyword.DEFAULT)
, TokenFactory.tokenFromType(TokenType.COLON), list(statements)); | 478 static SwitchDefault switchDefault(List<Label> labels, List<Statement> stateme
nts) => new SwitchDefault(labels, TokenFactory.tokenFromKeyword(Keyword.DEFAULT)
, TokenFactory.tokenFromType(TokenType.COLON), statements); |
| 356 | 479 |
| 357 static SwitchDefault switchDefault2(List<Statement> statements) => switchDefau
lt(new List<Label>(), statements); | 480 static SwitchDefault switchDefault2(List<Statement> statements) => switchDefau
lt(new List<Label>(), statements); |
| 358 | 481 |
| 359 static SwitchStatement switchStatement(Expression expression, List<SwitchMembe
r> members) => new SwitchStatement(TokenFactory.tokenFromKeyword(Keyword.SWITCH)
, TokenFactory.tokenFromType(TokenType.OPEN_PAREN), expression, TokenFactory.tok
enFromType(TokenType.CLOSE_PAREN), TokenFactory.tokenFromType(TokenType.OPEN_CUR
LY_BRACKET), list(members), TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRA
CKET)); | 482 static SwitchStatement switchStatement(Expression expression, List<SwitchMembe
r> members) => new SwitchStatement(TokenFactory.tokenFromKeyword(Keyword.SWITCH)
, TokenFactory.tokenFromType(TokenType.OPEN_PAREN), expression, TokenFactory.tok
enFromType(TokenType.CLOSE_PAREN), TokenFactory.tokenFromType(TokenType.OPEN_CUR
LY_BRACKET), members, TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET))
; |
| 360 | 483 |
| 361 static SymbolLiteral symbolLiteral(List<String> components) { | 484 static SymbolLiteral symbolLiteral(List<String> components) { |
| 362 List<Token> identifierList = new List<Token>(); | 485 List<Token> identifierList = new List<Token>(); |
| 363 for (String component in components) { | 486 for (String component in components) { |
| 364 identifierList.add(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIE
R, component)); | 487 identifierList.add(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIE
R, component)); |
| 365 } | 488 } |
| 366 return new SymbolLiteral(TokenFactory.tokenFromType(TokenType.HASH), identif
ierList); | 489 return new SymbolLiteral(TokenFactory.tokenFromType(TokenType.HASH), identif
ierList); |
| 367 } | 490 } |
| 368 | 491 |
| 369 static BlockFunctionBody syncBlockFunctionBody(List<Statement> statements) =>
new BlockFunctionBody(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER,
"sync"), null, block(statements)); | 492 static BlockFunctionBody syncBlockFunctionBody([List<Statement> statements]) |
| 493 => new BlockFunctionBody( |
| 494 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"), |
| 495 null, |
| 496 block(statements)); |
| 370 | 497 |
| 371 static BlockFunctionBody syncGeneratorBlockFunctionBody(List<Statement> statem
ents) => new BlockFunctionBody(TokenFactory.tokenFromTypeAndString(TokenType.IDE
NTIFIER, "sync"), TokenFactory.tokenFromType(TokenType.STAR), block(statements))
; | 498 static BlockFunctionBody syncGeneratorBlockFunctionBody([List<Statement> state
ments]) |
| 499 => new BlockFunctionBody( |
| 500 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"), |
| 501 TokenFactory.tokenFromType(TokenType.STAR), |
| 502 block(statements)); |
| 372 | 503 |
| 373 static ThisExpression thisExpression() => new ThisExpression(TokenFactory.toke
nFromKeyword(Keyword.THIS)); | 504 static ThisExpression thisExpression() => new ThisExpression(TokenFactory.toke
nFromKeyword(Keyword.THIS)); |
| 374 | 505 |
| 375 static ThrowExpression throwExpression() => throwExpression2(null); | 506 static ThrowExpression throwExpression() => throwExpression2(null); |
| 376 | 507 |
| 377 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression(TokenFactory.tokenFromKeyword(Keyword.THROW), expression); | 508 static ThrowExpression throwExpression2(Expression expression) => new ThrowExp
ression(TokenFactory.tokenFromKeyword(Keyword.THROW), expression); |
| 378 | 509 |
| 379 static TopLevelVariableDeclaration topLevelVariableDeclaration(Keyword keyword
, TypeName type, List<VariableDeclaration> variables) => new TopLevelVariableDec
laration(null, null, variableDeclarationList(keyword, type, variables), TokenFac
tory.tokenFromType(TokenType.SEMICOLON)); | 510 static TopLevelVariableDeclaration topLevelVariableDeclaration(Keyword keyword
, TypeName type, List<VariableDeclaration> variables) => new TopLevelVariableDec
laration(null, null, variableDeclarationList(keyword, type, variables), TokenFac
tory.tokenFromType(TokenType.SEMICOLON)); |
| 380 | 511 |
| 381 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration(null,
null, variableDeclarationList(keyword, null, variables), TokenFactory.tokenFrom
Type(TokenType.SEMICOLON)); | 512 static TopLevelVariableDeclaration topLevelVariableDeclaration2(Keyword keywor
d, List<VariableDeclaration> variables) => new TopLevelVariableDeclaration(null,
null, variableDeclarationList(keyword, null, variables), TokenFactory.tokenFrom
Type(TokenType.SEMICOLON)); |
| 382 | 513 |
| 383 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); | 514 static TryStatement tryStatement(Block body, Block finallyClause) => tryStatem
ent3(body, new List<CatchClause>(), finallyClause); |
| 384 | 515 |
| 385 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, list(catchClauses), null); | 516 static TryStatement tryStatement2(Block body, List<CatchClause> catchClauses)
=> tryStatement3(body, catchClauses, null); |
| 386 | 517 |
| 387 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses,
Block finallyClause) => new TryStatement(TokenFactory.tokenFromKeyword(Keyword.T
RY), body, catchClauses, finallyClause == null ? null : TokenFactory.tokenFromKe
yword(Keyword.FINALLY), finallyClause); | 518 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses,
Block finallyClause) => new TryStatement(TokenFactory.tokenFromKeyword(Keyword.T
RY), body, catchClauses, finallyClause == null ? null : TokenFactory.tokenFromKe
yword(Keyword.FINALLY), finallyClause); |
| 388 | 519 |
| 389 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s(null, null, TokenFactory.tokenFromKeyword(Keyword.TYPEDEF), returnType, identi
fier3(name), typeParameters, parameters, TokenFactory.tokenFromType(TokenType.SE
MICOLON)); | 520 static FunctionTypeAlias typeAlias(TypeName returnType, String name, TypeParam
eterList typeParameters, FormalParameterList parameters) => new FunctionTypeAlia
s(null, null, TokenFactory.tokenFromKeyword(Keyword.TYPEDEF), returnType, identi
fier3(name), typeParameters, parameters, TokenFactory.tokenFromType(TokenType.SE
MICOLON)); |
| 390 | 521 |
| 391 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) => new Type
ArgumentList(TokenFactory.tokenFromType(TokenType.LT), list(typeNames), TokenFac
tory.tokenFromType(TokenType.GT)); | 522 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) { |
| 523 if (typeNames == null || typeNames.length == 0) { |
| 524 return null; |
| 525 } |
| 526 return new TypeArgumentList( |
| 527 TokenFactory.tokenFromType(TokenType.LT), |
| 528 typeNames, |
| 529 TokenFactory.tokenFromType(TokenType.GT)); |
| 530 } |
| 392 | 531 |
| 393 /** | 532 /** |
| 394 * Create a type name whose name has been resolved to the given element and wh
ose type has been | 533 * Create a type name whose name has been resolved to the given [element] and |
| 395 * resolved to the type of the given element. | 534 * whose type has been resolved to the type of the given element. |
| 396 * | 535 * |
| 397 * <b>Note:</b> This method does not correctly handle class elements that have
type parameters. | 536 * <b>Note:</b> This method does not correctly handle class elements that have |
| 398 * | 537 * type parameters. |
| 399 * @param element the element defining the type represented by the type name | |
| 400 * @return the type name that was created | |
| 401 */ | 538 */ |
| 402 static TypeName typeName(ClassElement element, List<TypeName> arguments) { | 539 static TypeName typeName(ClassElement element, [List<TypeName> arguments]) { |
| 403 SimpleIdentifier name = identifier3(element.name); | 540 SimpleIdentifier name = identifier3(element.name); |
| 404 name.staticElement = element; | 541 name.staticElement = element; |
| 405 TypeName typeName = typeName3(name, arguments); | 542 TypeName typeName = typeName3(name, arguments); |
| 406 typeName.type = element.type; | 543 typeName.type = element.type; |
| 407 return typeName; | 544 return typeName; |
| 408 } | 545 } |
| 409 | 546 |
| 410 static TypeName typeName3(Identifier name, List<TypeName> arguments) { | 547 static TypeName typeName3(Identifier name, [List<TypeName> arguments]) |
| 411 if (arguments.length == 0) { | 548 => new TypeName(name, typeArgumentList(arguments)); |
| 412 return new TypeName(name, null); | |
| 413 } | |
| 414 return new TypeName(name, typeArgumentList(arguments)); | |
| 415 } | |
| 416 | 549 |
| 417 static TypeName typeName4(String name, List<TypeName> arguments) { | 550 static TypeName typeName4(String name, [List<TypeName> arguments]) |
| 418 if (arguments.length == 0) { | 551 => new TypeName(identifier3(name), typeArgumentList(arguments)); |
| 419 return new TypeName(identifier3(name), null); | |
| 420 } | |
| 421 return new TypeName(identifier3(name), typeArgumentList(arguments)); | |
| 422 } | |
| 423 | 552 |
| 424 static TypeParameter typeParameter(String name) => new TypeParameter(null, nul
l, identifier3(name), null, null); | 553 static TypeParameter typeParameter(String name) => new TypeParameter(null, nul
l, identifier3(name), null, null); |
| 425 | 554 |
| 426 static TypeParameter typeParameter2(String name, TypeName bound) => new TypePa
rameter(null, null, identifier3(name), TokenFactory.tokenFromKeyword(Keyword.EXT
ENDS), bound); | 555 static TypeParameter typeParameter2(String name, TypeName bound) => new TypePa
rameter(null, null, identifier3(name), TokenFactory.tokenFromKeyword(Keyword.EXT
ENDS), bound); |
| 427 | 556 |
| 428 static TypeParameterList typeParameterList(List<String> typeNames) { | 557 static TypeParameterList typeParameterList([List<String> typeNames]) { |
| 429 List<TypeParameter> typeParameters = new List<TypeParameter>(); | 558 List<TypeParameter> typeParameters = null; |
| 430 for (String typeName in typeNames) { | 559 if (typeNames != null && !typeNames.isEmpty) { |
| 431 typeParameters.add(typeParameter(typeName)); | 560 typeParameters = new List<TypeParameter>(); |
| 561 for (String typeName in typeNames) { |
| 562 typeParameters.add(typeParameter(typeName)); |
| 563 } |
| 432 } | 564 } |
| 433 return new TypeParameterList(TokenFactory.tokenFromType(TokenType.LT), typeP
arameters, TokenFactory.tokenFromType(TokenType.GT)); | 565 return new TypeParameterList( |
| 566 TokenFactory.tokenFromType(TokenType.LT), |
| 567 typeParameters, |
| 568 TokenFactory.tokenFromType(TokenType.GT)); |
| 434 } | 569 } |
| 435 | 570 |
| 436 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration(null, null, identifier3(name), null, null); | 571 static VariableDeclaration variableDeclaration(String name) => new VariableDec
laration(null, null, identifier3(name), null, null); |
| 437 | 572 |
| 438 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration(null, null, identifier3(name), TokenFactory.to
kenFromType(TokenType.EQ), initializer); | 573 static VariableDeclaration variableDeclaration2(String name, Expression initia
lizer) => new VariableDeclaration(null, null, identifier3(name), TokenFactory.to
kenFromType(TokenType.EQ), initializer); |
| 439 | 574 |
| 440 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList(nul
l, null, keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), type,
list(variables)); | 575 static VariableDeclarationList variableDeclarationList(Keyword keyword, TypeNa
me type, List<VariableDeclaration> variables) => new VariableDeclarationList(nul
l, null, keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), type,
variables); |
| 441 | 576 |
| 442 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); | 577 static VariableDeclarationList variableDeclarationList2(Keyword keyword, List<
VariableDeclaration> variables) => variableDeclarationList(keyword, null, variab
les); |
| 443 | 578 |
| 444 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement(variableDeclarationList(keyword, type, variables), TokenFactory.toke
nFromType(TokenType.SEMICOLON)); | 579 static VariableDeclarationStatement variableDeclarationStatement(Keyword keywo
rd, TypeName type, List<VariableDeclaration> variables) => new VariableDeclarati
onStatement(variableDeclarationList(keyword, type, variables), TokenFactory.toke
nFromType(TokenType.SEMICOLON)); |
| 445 | 580 |
| 446 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); | 581 static VariableDeclarationStatement variableDeclarationStatement2(Keyword keyw
ord, List<VariableDeclaration> variables) => variableDeclarationStatement(keywor
d, null, variables); |
| 447 | 582 |
| 448 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement(TokenFactory.tokenFromKeyword(Keyword.WHILE), TokenFactory.to
kenFromType(TokenType.OPEN_PAREN), condition, TokenFactory.tokenFromType(TokenTy
pe.CLOSE_PAREN), body); | 583 static WhileStatement whileStatement(Expression condition, Statement body) =>
new WhileStatement(TokenFactory.tokenFromKeyword(Keyword.WHILE), TokenFactory.to
kenFromType(TokenType.OPEN_PAREN), condition, TokenFactory.tokenFromType(TokenTy
pe.CLOSE_PAREN), body); |
| 449 | 584 |
| 450 static WithClause withClause(List<TypeName> types) => new WithClause(TokenFact
ory.tokenFromKeyword(Keyword.WITH), list(types)); | 585 static WithClause withClause(List<TypeName> types) => new WithClause(TokenFact
ory.tokenFromKeyword(Keyword.WITH), types); |
| 451 | 586 |
| 452 static YieldStatement yieldEachStatement(Expression expression) => new YieldSt
atement(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), Toke
nFactory.tokenFromType(TokenType.STAR), expression, TokenFactory.tokenFromType(T
okenType.SEMICOLON)); | 587 static YieldStatement yieldEachStatement(Expression expression) => new YieldSt
atement(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), Toke
nFactory.tokenFromType(TokenType.STAR), expression, TokenFactory.tokenFromType(T
okenType.SEMICOLON)); |
| 453 | 588 |
| 454 static YieldStatement yieldStatement(Expression expression) => new YieldStatem
ent(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), null, ex
pression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 589 static YieldStatement yieldStatement(Expression expression) => new YieldStatem
ent(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), null, ex
pression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 455 } | 590 } |
| OLD | NEW |