| 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/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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) => | 29 static AdjacentStrings adjacentStrings(List<StringLiteral> strings) => |
| 30 new AdjacentStrings(strings); | 30 new AdjacentStrings(strings); |
| 31 | 31 |
| 32 static Annotation annotation(Identifier name) => | 32 static Annotation annotation(Identifier name) => new Annotation( |
| 33 new Annotation( | 33 TokenFactory.tokenFromType(TokenType.AT), name, null, null, null); |
| 34 TokenFactory.tokenFromType(TokenType.AT), | |
| 35 name, | |
| 36 null, | |
| 37 null, | |
| 38 null); | |
| 39 | 34 |
| 40 static Annotation annotation2(Identifier name, | 35 static Annotation annotation2(Identifier name, |
| 41 SimpleIdentifier constructorName, ArgumentList arguments) => | 36 SimpleIdentifier constructorName, ArgumentList arguments) => |
| 42 new Annotation( | 37 new Annotation(TokenFactory.tokenFromType(TokenType.AT), name, |
| 43 TokenFactory.tokenFromType(TokenType.AT), | 38 TokenFactory.tokenFromType(TokenType.PERIOD), constructorName, |
| 44 name, | |
| 45 TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 46 constructorName, | |
| 47 arguments); | 39 arguments); |
| 48 | 40 |
| 49 static ArgumentList argumentList([List<Expression> arguments]) => | 41 static ArgumentList argumentList([List<Expression> arguments]) => |
| 50 new ArgumentList( | 42 new ArgumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 51 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 43 arguments, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); |
| 52 arguments, | |
| 53 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); | |
| 54 | 44 |
| 55 static AsExpression asExpression(Expression expression, TypeName type) => | 45 static AsExpression asExpression(Expression expression, TypeName type) => |
| 56 new AsExpression(expression, TokenFactory.tokenFromKeyword(Keyword.AS), ty
pe); | 46 new AsExpression( |
| 47 expression, TokenFactory.tokenFromKeyword(Keyword.AS), type); |
| 57 | 48 |
| 58 static AssertStatement assertStatement(Expression condition) => | 49 static AssertStatement assertStatement(Expression condition) => |
| 59 new AssertStatement( | 50 new AssertStatement(TokenFactory.tokenFromKeyword(Keyword.ASSERT), |
| 60 TokenFactory.tokenFromKeyword(Keyword.ASSERT), | 51 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condition, |
| 61 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | |
| 62 condition, | |
| 63 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | 52 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), |
| 64 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 53 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 65 | 54 |
| 66 static AssignmentExpression assignmentExpression(Expression leftHandSide, | 55 static AssignmentExpression assignmentExpression(Expression leftHandSide, |
| 67 TokenType operator, Expression rightHandSide) => | 56 TokenType operator, Expression rightHandSide) => new AssignmentExpression( |
| 68 new AssignmentExpression( | 57 leftHandSide, TokenFactory.tokenFromType(operator), rightHandSide); |
| 69 leftHandSide, | |
| 70 TokenFactory.tokenFromType(operator), | |
| 71 rightHandSide); | |
| 72 | 58 |
| 73 static BlockFunctionBody | 59 static BlockFunctionBody asyncBlockFunctionBody( |
| 74 asyncBlockFunctionBody([List<Statement> statements]) => | 60 [List<Statement> statements]) => new BlockFunctionBody( |
| 75 new BlockFunctionBody( | 61 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), null, |
| 76 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), | 62 block(statements)); |
| 77 null, | |
| 78 block(statements)); | |
| 79 | 63 |
| 80 static ExpressionFunctionBody | 64 static ExpressionFunctionBody asyncExpressionFunctionBody( |
| 81 asyncExpressionFunctionBody(Expression expression) => | 65 Expression expression) => new ExpressionFunctionBody( |
| 82 new ExpressionFunctionBody( | 66 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), |
| 83 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), | 67 TokenFactory.tokenFromType(TokenType.FUNCTION), expression, |
| 84 TokenFactory.tokenFromType(TokenType.FUNCTION), | 68 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 85 expression, | |
| 86 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 87 | 69 |
| 88 static BlockFunctionBody | 70 static BlockFunctionBody asyncGeneratorBlockFunctionBody( |
| 89 asyncGeneratorBlockFunctionBody([List<Statement> statements]) => | 71 [List<Statement> statements]) => new BlockFunctionBody( |
| 90 new BlockFunctionBody( | 72 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), |
| 91 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"), | 73 TokenFactory.tokenFromType(TokenType.STAR), block(statements)); |
| 92 TokenFactory.tokenFromType(TokenType.STAR), | |
| 93 block(statements)); | |
| 94 | 74 |
| 95 static AwaitExpression awaitExpression(Expression expression) => | 75 static AwaitExpression awaitExpression(Expression expression) => |
| 96 new AwaitExpression( | 76 new AwaitExpression( |
| 97 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "await"), | 77 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "await"), |
| 98 expression); | 78 expression); |
| 99 | 79 |
| 100 static BinaryExpression binaryExpression(Expression leftOperand, | 80 static BinaryExpression binaryExpression(Expression leftOperand, |
| 101 TokenType operator, Expression rightOperand) => | 81 TokenType operator, Expression rightOperand) => new BinaryExpression( |
| 102 new BinaryExpression( | 82 leftOperand, TokenFactory.tokenFromType(operator), rightOperand); |
| 103 leftOperand, | |
| 104 TokenFactory.tokenFromType(operator), | |
| 105 rightOperand); | |
| 106 | 83 |
| 107 static Block block([List<Statement> statements]) => | 84 static Block block([List<Statement> statements]) => new Block( |
| 108 new Block( | 85 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), statements, |
| 109 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), | 86 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 110 statements, | |
| 111 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); | |
| 112 | 87 |
| 113 static BlockFunctionBody blockFunctionBody(Block block) => | 88 static BlockFunctionBody blockFunctionBody(Block block) => |
| 114 new BlockFunctionBody(null, null, block); | 89 new BlockFunctionBody(null, null, block); |
| 115 | 90 |
| 116 static BlockFunctionBody blockFunctionBody2([List<Statement> statements]) => | 91 static BlockFunctionBody blockFunctionBody2([List<Statement> statements]) => |
| 117 new BlockFunctionBody(null, null, block(statements)); | 92 new BlockFunctionBody(null, null, block(statements)); |
| 118 | 93 |
| 119 static BooleanLiteral booleanLiteral(bool value) => | 94 static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral(value |
| 120 new BooleanLiteral( | 95 ? TokenFactory.tokenFromKeyword(Keyword.TRUE) |
| 121 value ? | 96 : TokenFactory.tokenFromKeyword(Keyword.FALSE), value); |
| 122 TokenFactory.tokenFromKeyword(Keyword.TRUE) : | 97 |
| 123 TokenFactory.tokenFromKeyword(Keyword.FALSE), | 98 static BreakStatement breakStatement() => new BreakStatement( |
| 124 value); | 99 TokenFactory.tokenFromKeyword(Keyword.BREAK), null, |
| 125 | 100 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 126 static BreakStatement breakStatement() => | 101 |
| 127 new BreakStatement( | 102 static BreakStatement breakStatement2(String label) => new BreakStatement( |
| 128 TokenFactory.tokenFromKeyword(Keyword.BREAK), | 103 TokenFactory.tokenFromKeyword(Keyword.BREAK), identifier3(label), |
| 129 null, | 104 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 130 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 131 | |
| 132 static BreakStatement breakStatement2(String label) => | |
| 133 new BreakStatement( | |
| 134 TokenFactory.tokenFromKeyword(Keyword.BREAK), | |
| 135 identifier3(label), | |
| 136 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 137 | 105 |
| 138 static IndexExpression cascadedIndexExpression(Expression index) => | 106 static IndexExpression cascadedIndexExpression(Expression index) => |
| 139 new IndexExpression.forCascade( | 107 new IndexExpression.forCascade( |
| 140 TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), | 108 TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), |
| 141 TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), | 109 TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), index, |
| 142 index, | |
| 143 TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET)); | 110 TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET)); |
| 144 | 111 |
| 145 static MethodInvocation cascadedMethodInvocation(String methodName, | 112 static MethodInvocation cascadedMethodInvocation(String methodName, |
| 146 [List<Expression> arguments]) => | 113 [List<Expression> arguments]) => new MethodInvocation(null, |
| 147 new MethodInvocation( | 114 TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), |
| 148 null, | 115 identifier3(methodName), argumentList(arguments)); |
| 149 TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), | |
| 150 identifier3(methodName), | |
| 151 argumentList(arguments)); | |
| 152 | 116 |
| 153 static PropertyAccess cascadedPropertyAccess(String propertyName) => | 117 static PropertyAccess cascadedPropertyAccess(String propertyName) => |
| 154 new PropertyAccess( | 118 new PropertyAccess(null, |
| 155 null, | |
| 156 TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), | 119 TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD), |
| 157 identifier3(propertyName)); | 120 identifier3(propertyName)); |
| 158 | 121 |
| 159 static CascadeExpression cascadeExpression(Expression target, | 122 static CascadeExpression cascadeExpression(Expression target, |
| 160 [List<Expression> cascadeSections]) => | 123 [List<Expression> cascadeSections]) => |
| 161 new CascadeExpression(target, cascadeSections); | 124 new CascadeExpression(target, cascadeSections); |
| 162 | 125 |
| 163 static CatchClause catchClause(String exceptionParameter, | 126 static CatchClause catchClause(String exceptionParameter, |
| 164 [List<Statement> statements]) => | 127 [List<Statement> statements]) => |
| 165 catchClause5(null, exceptionParameter, null, statements); | 128 catchClause5(null, exceptionParameter, null, statements); |
| 166 | 129 |
| 167 static CatchClause catchClause2(String exceptionParameter, | 130 static CatchClause catchClause2( |
| 168 String stackTraceParameter, [List<Statement> statements]) => | 131 String exceptionParameter, String stackTraceParameter, |
| 132 [List<Statement> statements]) => |
| 169 catchClause5(null, exceptionParameter, stackTraceParameter, statements); | 133 catchClause5(null, exceptionParameter, stackTraceParameter, statements); |
| 170 | 134 |
| 171 static CatchClause catchClause3(TypeName exceptionType, | 135 static CatchClause catchClause3(TypeName exceptionType, |
| 172 [List<Statement> statements]) => | 136 [List<Statement> statements]) => |
| 173 catchClause5(exceptionType, null, null, statements); | 137 catchClause5(exceptionType, null, null, statements); |
| 174 | 138 |
| 175 static CatchClause catchClause4(TypeName exceptionType, | 139 static CatchClause catchClause4( |
| 176 String exceptionParameter, [List<Statement> statements]) => | 140 TypeName exceptionType, String exceptionParameter, |
| 141 [List<Statement> statements]) => |
| 177 catchClause5(exceptionType, exceptionParameter, null, statements); | 142 catchClause5(exceptionType, exceptionParameter, null, statements); |
| 178 | 143 |
| 179 static CatchClause catchClause5(TypeName exceptionType, | 144 static CatchClause catchClause5(TypeName exceptionType, |
| 180 String exceptionParameter, String stackTraceParameter, | 145 String exceptionParameter, String stackTraceParameter, |
| 181 [List<Statement> statements]) => | 146 [List<Statement> statements]) => new CatchClause(exceptionType == null |
| 182 new CatchClause( | 147 ? null |
| 183 exceptionType == null ? | 148 : TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "on"), |
| 184 null : | 149 exceptionType, exceptionParameter == null |
| 185 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "on"), | 150 ? null |
| 186 exceptionType, | 151 : TokenFactory.tokenFromKeyword(Keyword.CATCH), exceptionParameter == |
| 187 exceptionParameter == null ? | 152 null ? null : TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 188 null : | 153 exceptionParameter == null ? null : identifier3(exceptionParameter), |
| 189 TokenFactory.tokenFromKeyword(Keyword.CATCH), | 154 stackTraceParameter == null |
| 190 exceptionParameter == null ? | 155 ? null |
| 191 null : | 156 : TokenFactory.tokenFromType(TokenType.COMMA), |
| 192 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 157 stackTraceParameter == null ? null : identifier3(stackTraceParameter), |
| 193 exceptionParameter == null ? null : identifier3(exceptionParameter), | 158 exceptionParameter == null |
| 194 stackTraceParameter == null ? | 159 ? null |
| 195 null : | 160 : TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), |
| 196 TokenFactory.tokenFromType(TokenType.COMMA), | 161 block(statements)); |
| 197 stackTraceParameter == null ? null : identifier3(stackTraceParameter), | |
| 198 exceptionParameter == null ? | |
| 199 null : | |
| 200 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 201 block(statements)); | |
| 202 | 162 |
| 203 static ClassDeclaration classDeclaration(Keyword abstractKeyword, String name, | 163 static ClassDeclaration classDeclaration(Keyword abstractKeyword, String name, |
| 204 TypeParameterList typeParameters, ExtendsClause extendsClause, | 164 TypeParameterList typeParameters, ExtendsClause extendsClause, |
| 205 WithClause withClause, ImplementsClause implementsClause, | 165 WithClause withClause, ImplementsClause implementsClause, |
| 206 [List<ClassMember> members]) => | 166 [List<ClassMember> members]) => new ClassDeclaration(null, null, |
| 207 new ClassDeclaration( | 167 abstractKeyword == null |
| 208 null, | 168 ? null |
| 209 null, | 169 : TokenFactory.tokenFromKeyword(abstractKeyword), |
| 210 abstractKeyword == null ? null : TokenFactory.tokenFromKeyword(abstrac
tKeyword), | 170 TokenFactory.tokenFromKeyword(Keyword.CLASS), identifier3(name), |
| 211 TokenFactory.tokenFromKeyword(Keyword.CLASS), | 171 typeParameters, extendsClause, withClause, implementsClause, |
| 212 identifier3(name), | 172 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), members, |
| 213 typeParameters, | 173 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 214 extendsClause, | |
| 215 withClause, | |
| 216 implementsClause, | |
| 217 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), | |
| 218 members, | |
| 219 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); | |
| 220 | 174 |
| 221 static ClassTypeAlias classTypeAlias(String name, | 175 static ClassTypeAlias classTypeAlias(String name, |
| 222 TypeParameterList typeParameters, Keyword abstractKeyword, TypeName superc
lass, | 176 TypeParameterList typeParameters, Keyword abstractKeyword, |
| 223 WithClause withClause, ImplementsClause implementsClause) => | 177 TypeName superclass, WithClause withClause, |
| 224 new ClassTypeAlias( | 178 ImplementsClause implementsClause) => new ClassTypeAlias(null, null, |
| 225 null, | 179 TokenFactory.tokenFromKeyword(Keyword.CLASS), identifier3(name), |
| 226 null, | 180 typeParameters, TokenFactory.tokenFromType(TokenType.EQ), |
| 227 TokenFactory.tokenFromKeyword(Keyword.CLASS), | 181 abstractKeyword == null |
| 228 identifier3(name), | 182 ? null |
| 229 typeParameters, | 183 : TokenFactory.tokenFromKeyword(abstractKeyword), superclass, |
| 230 TokenFactory.tokenFromType(TokenType.EQ), | 184 withClause, implementsClause, |
| 231 abstractKeyword == null ? null : TokenFactory.tokenFromKeyword(abstrac
tKeyword), | 185 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 232 superclass, | |
| 233 withClause, | |
| 234 implementsClause, | |
| 235 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 236 | 186 |
| 237 static CompilationUnit compilationUnit() => | 187 static CompilationUnit compilationUnit() => |
| 238 compilationUnit8(null, null, null); | 188 compilationUnit8(null, null, null); |
| 239 | 189 |
| 240 static CompilationUnit | 190 static CompilationUnit compilationUnit2( |
| 241 compilationUnit2(List<CompilationUnitMember> declarations) => | 191 List<CompilationUnitMember> declarations) => |
| 242 compilationUnit8(null, null, declarations); | 192 compilationUnit8(null, null, declarations); |
| 243 | 193 |
| 244 static CompilationUnit compilationUnit3(List<Directive> directives) => | 194 static CompilationUnit compilationUnit3(List<Directive> directives) => |
| 245 compilationUnit8(null, directives, null); | 195 compilationUnit8(null, directives, null); |
| 246 | 196 |
| 247 static CompilationUnit compilationUnit4(List<Directive> directives, | 197 static CompilationUnit compilationUnit4(List<Directive> directives, |
| 248 List<CompilationUnitMember> declarations) => | 198 List<CompilationUnitMember> declarations) => |
| 249 compilationUnit8(null, directives, declarations); | 199 compilationUnit8(null, directives, declarations); |
| 250 | 200 |
| 251 static CompilationUnit compilationUnit5(String scriptTag) => | 201 static CompilationUnit compilationUnit5(String scriptTag) => |
| 252 compilationUnit8(scriptTag, null, null); | 202 compilationUnit8(scriptTag, null, null); |
| 253 | 203 |
| 254 static CompilationUnit compilationUnit6(String scriptTag, | 204 static CompilationUnit compilationUnit6( |
| 255 List<CompilationUnitMember> declarations) => | 205 String scriptTag, List<CompilationUnitMember> declarations) => |
| 256 compilationUnit8(scriptTag, null, declarations); | 206 compilationUnit8(scriptTag, null, declarations); |
| 257 | 207 |
| 258 static CompilationUnit compilationUnit7(String scriptTag, | 208 static CompilationUnit compilationUnit7( |
| 259 List<Directive> directives) => | 209 String scriptTag, List<Directive> directives) => |
| 260 compilationUnit8(scriptTag, directives, null); | 210 compilationUnit8(scriptTag, directives, null); |
| 261 | 211 |
| 262 static CompilationUnit compilationUnit8(String scriptTag, | 212 static CompilationUnit compilationUnit8(String scriptTag, |
| 263 List<Directive> directives, List<CompilationUnitMember> declarations) => | 213 List<Directive> directives, |
| 264 new CompilationUnit( | 214 List<CompilationUnitMember> declarations) => new CompilationUnit( |
| 265 TokenFactory.tokenFromType(TokenType.EOF), | 215 TokenFactory.tokenFromType(TokenType.EOF), |
| 266 scriptTag == null ? null : AstFactory.scriptTag(scriptTag), | 216 scriptTag == null ? null : AstFactory.scriptTag(scriptTag), |
| 267 directives == null ? new List<Directive>() : directives, | 217 directives == null ? new List<Directive>() : directives, |
| 268 declarations == null ? new List<CompilationUnitMember>() : declaration
s, | 218 declarations == null ? new List<CompilationUnitMember>() : declarations, |
| 269 TokenFactory.tokenFromType(TokenType.EOF)); | 219 TokenFactory.tokenFromType(TokenType.EOF)); |
| 270 | 220 |
| 271 static ConditionalExpression conditionalExpression(Expression condition, | 221 static ConditionalExpression conditionalExpression(Expression condition, |
| 272 Expression thenExpression, Expression elseExpression) => | 222 Expression thenExpression, Expression elseExpression) => |
| 273 new ConditionalExpression( | 223 new ConditionalExpression(condition, |
| 274 condition, | 224 TokenFactory.tokenFromType(TokenType.QUESTION), thenExpression, |
| 275 TokenFactory.tokenFromType(TokenType.QUESTION), | 225 TokenFactory.tokenFromType(TokenType.COLON), elseExpression); |
| 276 thenExpression, | |
| 277 TokenFactory.tokenFromType(TokenType.COLON), | |
| 278 elseExpression); | |
| 279 | 226 |
| 280 static ConstructorDeclaration constructorDeclaration(Identifier returnType, | 227 static ConstructorDeclaration constructorDeclaration(Identifier returnType, |
| 281 String name, FormalParameterList parameters, | 228 String name, FormalParameterList parameters, |
| 282 List<ConstructorInitializer> initializers) => | 229 List<ConstructorInitializer> initializers) => new ConstructorDeclaration( |
| 283 new ConstructorDeclaration( | 230 null, null, TokenFactory.tokenFromKeyword(Keyword.EXTERNAL), null, null, |
| 284 null, | 231 returnType, |
| 285 null, | 232 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 286 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL), | 233 name == null ? null : identifier3(name), parameters, |
| 287 null, | 234 initializers == null || initializers.isEmpty |
| 288 null, | 235 ? null |
| 289 returnType, | 236 : TokenFactory.tokenFromType(TokenType.PERIOD), initializers == null |
| 290 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), | 237 ? new List<ConstructorInitializer>() |
| 291 name == null ? null : identifier3(name), | 238 : initializers, null, emptyFunctionBody()); |
| 292 parameters, | |
| 293 initializers == null || initializers.isEmpty ? | |
| 294 null : | |
| 295 TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 296 initializers == null ? new List<ConstructorInitializer>() : initialize
rs, | |
| 297 null, | |
| 298 emptyFunctionBody()); | |
| 299 | 239 |
| 300 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, | 240 static ConstructorDeclaration constructorDeclaration2(Keyword constKeyword, |
| 301 Keyword factoryKeyword, Identifier returnType, String name, | 241 Keyword factoryKeyword, Identifier returnType, String name, |
| 302 FormalParameterList parameters, List<ConstructorInitializer> initializers, | 242 FormalParameterList parameters, List<ConstructorInitializer> initializers, |
| 303 FunctionBody body) => | 243 FunctionBody body) => new ConstructorDeclaration(null, null, null, |
| 304 new ConstructorDeclaration( | 244 constKeyword == null ? null : TokenFactory.tokenFromKeyword(constKeyword), |
| 305 null, | 245 factoryKeyword == null |
| 306 null, | 246 ? null |
| 307 null, | 247 : TokenFactory.tokenFromKeyword(factoryKeyword), returnType, |
| 308 constKeyword == null ? null : TokenFactory.tokenFromKeyword(constKeywo
rd), | 248 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 309 factoryKeyword == null ? null : TokenFactory.tokenFromKeyword(factoryK
eyword), | 249 name == null ? null : identifier3(name), parameters, |
| 310 returnType, | 250 initializers == null || initializers.isEmpty |
| 311 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), | 251 ? null |
| 312 name == null ? null : identifier3(name), | 252 : TokenFactory.tokenFromType(TokenType.PERIOD), initializers == null |
| 313 parameters, | 253 ? new List<ConstructorInitializer>() |
| 314 initializers == null || initializers.isEmpty ? | 254 : initializers, null, body); |
| 315 null : | 255 |
| 316 TokenFactory.tokenFromType(TokenType.PERIOD), | 256 static ConstructorFieldInitializer constructorFieldInitializer( |
| 317 initializers == null ? new List<ConstructorInitializer>() : initialize
rs, | 257 bool prefixedWithThis, String fieldName, Expression expression) => |
| 318 null, | |
| 319 body); | |
| 320 | |
| 321 static ConstructorFieldInitializer | |
| 322 constructorFieldInitializer(bool prefixedWithThis, String fieldName, | |
| 323 Expression expression) => | |
| 324 new ConstructorFieldInitializer( | 258 new ConstructorFieldInitializer( |
| 325 prefixedWithThis ? TokenFactory.tokenFromKeyword(Keyword.THIS) : null, | 259 prefixedWithThis ? TokenFactory.tokenFromKeyword(Keyword.THIS) : null, |
| 326 prefixedWithThis ? TokenFactory.tokenFromType(TokenType.PERIOD) : null
, | 260 prefixedWithThis |
| 327 identifier3(fieldName), | 261 ? TokenFactory.tokenFromType(TokenType.PERIOD) |
| 328 TokenFactory.tokenFromType(TokenType.EQ), | 262 : null, identifier3(fieldName), |
| 329 expression); | 263 TokenFactory.tokenFromType(TokenType.EQ), expression); |
| 330 | 264 |
| 331 static ConstructorName constructorName(TypeName type, String name) => | 265 static ConstructorName constructorName(TypeName type, String name) => |
| 332 new ConstructorName( | 266 new ConstructorName(type, |
| 333 type, | |
| 334 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), | 267 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 335 name == null ? null : identifier3(name)); | 268 name == null ? null : identifier3(name)); |
| 336 | 269 |
| 337 static ContinueStatement continueStatement([String label]) => | 270 static ContinueStatement continueStatement([String label]) => |
| 338 new ContinueStatement( | 271 new ContinueStatement(TokenFactory.tokenFromKeyword(Keyword.CONTINUE), |
| 339 TokenFactory.tokenFromKeyword(Keyword.CONTINUE), | |
| 340 label == null ? null : identifier3(label), | 272 label == null ? null : identifier3(label), |
| 341 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 273 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 342 | 274 |
| 343 static DeclaredIdentifier declaredIdentifier(Keyword keyword, | 275 static DeclaredIdentifier declaredIdentifier( |
| 344 String identifier) => | 276 Keyword keyword, String identifier) => |
| 345 declaredIdentifier2(keyword, null, identifier); | 277 declaredIdentifier2(keyword, null, identifier); |
| 346 | 278 |
| 347 static DeclaredIdentifier declaredIdentifier2(Keyword keyword, TypeName type, | 279 static DeclaredIdentifier declaredIdentifier2( |
| 348 String identifier) => | 280 Keyword keyword, TypeName type, String identifier) => |
| 349 new DeclaredIdentifier( | 281 new DeclaredIdentifier(null, null, |
| 350 null, | 282 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), type, |
| 351 null, | |
| 352 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | |
| 353 type, | |
| 354 identifier3(identifier)); | 283 identifier3(identifier)); |
| 355 | 284 |
| 356 static DeclaredIdentifier declaredIdentifier3(String identifier) => | 285 static DeclaredIdentifier declaredIdentifier3(String identifier) => |
| 357 declaredIdentifier2(null, null, identifier); | 286 declaredIdentifier2(null, null, identifier); |
| 358 | 287 |
| 359 static DeclaredIdentifier declaredIdentifier4(TypeName type, | 288 static DeclaredIdentifier declaredIdentifier4( |
| 360 String identifier) => | 289 TypeName type, String identifier) => |
| 361 declaredIdentifier2(null, type, identifier); | 290 declaredIdentifier2(null, type, identifier); |
| 362 | 291 |
| 363 static DoStatement doStatement(Statement body, Expression condition) => | 292 static DoStatement doStatement(Statement body, Expression condition) => |
| 364 new DoStatement( | 293 new DoStatement(TokenFactory.tokenFromKeyword(Keyword.DO), body, |
| 365 TokenFactory.tokenFromKeyword(Keyword.DO), | |
| 366 body, | |
| 367 TokenFactory.tokenFromKeyword(Keyword.WHILE), | 294 TokenFactory.tokenFromKeyword(Keyword.WHILE), |
| 368 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 295 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condition, |
| 369 condition, | |
| 370 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | 296 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), |
| 371 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 297 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 372 | 298 |
| 373 static DoubleLiteral doubleLiteral(double value) => | 299 static DoubleLiteral doubleLiteral(double value) => |
| 374 new DoubleLiteral(TokenFactory.tokenFromString(value.toString()), value); | 300 new DoubleLiteral(TokenFactory.tokenFromString(value.toString()), value); |
| 375 | 301 |
| 376 static EmptyFunctionBody emptyFunctionBody() => | 302 static EmptyFunctionBody emptyFunctionBody() => |
| 377 new EmptyFunctionBody(TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 303 new EmptyFunctionBody(TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 378 | 304 |
| 379 static EmptyStatement emptyStatement() => | 305 static EmptyStatement emptyStatement() => |
| 380 new EmptyStatement(TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 306 new EmptyStatement(TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 381 | 307 |
| 382 static EnumDeclaration enumDeclaration(SimpleIdentifier name, | 308 static EnumDeclaration enumDeclaration( |
| 383 List<EnumConstantDeclaration> constants) => | 309 SimpleIdentifier name, List<EnumConstantDeclaration> constants) => |
| 384 new EnumDeclaration( | 310 new EnumDeclaration(null, null, |
| 385 null, | 311 TokenFactory.tokenFromKeyword(Keyword.ENUM), name, |
| 386 null, | 312 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), constants, |
| 387 TokenFactory.tokenFromKeyword(Keyword.ENUM), | |
| 388 name, | |
| 389 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), | |
| 390 constants, | |
| 391 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); | 313 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 392 | 314 |
| 393 static EnumDeclaration enumDeclaration2(String name, | 315 static EnumDeclaration enumDeclaration2( |
| 394 List<String> constantNames) { | 316 String name, List<String> constantNames) { |
| 395 int count = constantNames.length; | 317 int count = constantNames.length; |
| 396 List<EnumConstantDeclaration> constants = | 318 List<EnumConstantDeclaration> constants = |
| 397 new List<EnumConstantDeclaration>(count); | 319 new List<EnumConstantDeclaration>(count); |
| 398 for (int i = 0; i < count; i++) { | 320 for (int i = 0; i < count; i++) { |
| 399 constants[i] = | 321 constants[i] = new EnumConstantDeclaration( |
| 400 new EnumConstantDeclaration(null, null, identifier3(constantNames[i]))
; | 322 null, null, identifier3(constantNames[i])); |
| 401 } | 323 } |
| 402 return enumDeclaration(identifier3(name), constants); | 324 return enumDeclaration(identifier3(name), constants); |
| 403 } | 325 } |
| 404 | 326 |
| 405 static ExportDirective exportDirective(List<Annotation> metadata, String uri, | 327 static ExportDirective exportDirective(List<Annotation> metadata, String uri, |
| 406 [List<Combinator> combinators]) => | 328 [List<Combinator> combinators]) => new ExportDirective(null, metadata, |
| 407 new ExportDirective( | 329 TokenFactory.tokenFromKeyword(Keyword.EXPORT), string2(uri), combinators, |
| 408 null, | 330 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 409 metadata, | |
| 410 TokenFactory.tokenFromKeyword(Keyword.EXPORT), | |
| 411 string2(uri), | |
| 412 combinators, | |
| 413 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 414 | 331 |
| 415 static ExportDirective exportDirective2(String uri, | 332 static ExportDirective exportDirective2(String uri, |
| 416 [List<Combinator> combinators]) => | 333 [List<Combinator> combinators]) => |
| 417 exportDirective(null, uri, combinators); | 334 exportDirective(null, uri, combinators); |
| 418 | 335 |
| 419 static ExpressionFunctionBody expressionFunctionBody(Expression expression) => | 336 static ExpressionFunctionBody expressionFunctionBody(Expression expression) => |
| 420 new ExpressionFunctionBody( | 337 new ExpressionFunctionBody(null, |
| 421 null, | 338 TokenFactory.tokenFromType(TokenType.FUNCTION), expression, |
| 422 TokenFactory.tokenFromType(TokenType.FUNCTION), | |
| 423 expression, | |
| 424 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 339 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 425 | 340 |
| 426 static ExpressionStatement expressionStatement(Expression expression) => | 341 static ExpressionStatement expressionStatement(Expression expression) => |
| 427 new ExpressionStatement( | 342 new ExpressionStatement( |
| 428 expression, | 343 expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 429 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 430 | 344 |
| 431 static ExtendsClause extendsClause(TypeName type) => | 345 static ExtendsClause extendsClause(TypeName type) => |
| 432 new ExtendsClause(TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type); | 346 new ExtendsClause(TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type); |
| 433 | 347 |
| 434 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, | 348 static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword, |
| 435 TypeName type, List<VariableDeclaration> variables) => | 349 TypeName type, List<VariableDeclaration> variables) => |
| 436 new FieldDeclaration( | 350 new FieldDeclaration(null, null, |
| 437 null, | |
| 438 null, | |
| 439 isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null, | 351 isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null, |
| 440 variableDeclarationList(keyword, type, variables), | 352 variableDeclarationList(keyword, type, variables), |
| 441 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 353 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 442 | 354 |
| 443 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, | 355 static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword, |
| 444 List<VariableDeclaration> variables) => | 356 List<VariableDeclaration> variables) => |
| 445 fieldDeclaration(isStatic, keyword, null, variables); | 357 fieldDeclaration(isStatic, keyword, null, variables); |
| 446 | 358 |
| 447 static FieldFormalParameter fieldFormalParameter(Keyword keyword, | 359 static FieldFormalParameter fieldFormalParameter( |
| 448 TypeName type, String identifier, [FormalParameterList parameterList]) => | 360 Keyword keyword, TypeName type, String identifier, |
| 449 new FieldFormalParameter( | 361 [FormalParameterList parameterList]) => new FieldFormalParameter(null, |
| 450 null, | 362 null, keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 451 null, | 363 type, TokenFactory.tokenFromKeyword(Keyword.THIS), |
| 452 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 364 TokenFactory.tokenFromType(TokenType.PERIOD), identifier3(identifier), |
| 453 type, | 365 parameterList); |
| 454 TokenFactory.tokenFromKeyword(Keyword.THIS), | |
| 455 TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 456 identifier3(identifier), | |
| 457 parameterList); | |
| 458 | 366 |
| 459 static FieldFormalParameter fieldFormalParameter2(String identifier) => | 367 static FieldFormalParameter fieldFormalParameter2(String identifier) => |
| 460 fieldFormalParameter(null, null, identifier); | 368 fieldFormalParameter(null, null, identifier); |
| 461 | 369 |
| 462 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, | 370 static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable, |
| 463 Expression iterator, Statement body) => | 371 Expression iterator, Statement body) => new ForEachStatement.con1(null, |
| 464 new ForEachStatement.con1( | 372 TokenFactory.tokenFromKeyword(Keyword.FOR), |
| 465 null, | 373 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), loopVariable, |
| 374 TokenFactory.tokenFromKeyword(Keyword.IN), iterator, |
| 375 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), body); |
| 376 |
| 377 static ForEachStatement forEachStatement2( |
| 378 SimpleIdentifier identifier, Expression iterator, Statement body) => |
| 379 new ForEachStatement.con2(null, |
| 466 TokenFactory.tokenFromKeyword(Keyword.FOR), | 380 TokenFactory.tokenFromKeyword(Keyword.FOR), |
| 467 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 381 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), identifier, |
| 468 loopVariable, | 382 TokenFactory.tokenFromKeyword(Keyword.IN), iterator, |
| 469 TokenFactory.tokenFromKeyword(Keyword.IN), | 383 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), body); |
| 470 iterator, | |
| 471 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 472 body); | |
| 473 | 384 |
| 474 static ForEachStatement forEachStatement2(SimpleIdentifier identifier, | 385 static FormalParameterList formalParameterList( |
| 475 Expression iterator, Statement body) => | 386 [List<FormalParameter> parameters]) => new FormalParameterList( |
| 476 new ForEachStatement.con2( | 387 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), parameters, null, null, |
| 477 null, | 388 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); |
| 478 TokenFactory.tokenFromKeyword(Keyword.FOR), | |
| 479 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | |
| 480 identifier, | |
| 481 TokenFactory.tokenFromKeyword(Keyword.IN), | |
| 482 iterator, | |
| 483 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 484 body); | |
| 485 | |
| 486 static FormalParameterList | |
| 487 formalParameterList([List<FormalParameter> parameters]) => | |
| 488 new FormalParameterList( | |
| 489 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | |
| 490 parameters, | |
| 491 null, | |
| 492 null, | |
| 493 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); | |
| 494 | 389 |
| 495 static ForStatement forStatement(Expression initialization, | 390 static ForStatement forStatement(Expression initialization, |
| 496 Expression condition, List<Expression> updaters, Statement body) => | 391 Expression condition, List<Expression> updaters, Statement body) => |
| 497 new ForStatement( | 392 new ForStatement(TokenFactory.tokenFromKeyword(Keyword.FOR), |
| 498 TokenFactory.tokenFromKeyword(Keyword.FOR), | 393 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), null, |
| 499 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 394 initialization, TokenFactory.tokenFromType(TokenType.SEMICOLON), |
| 500 null, | 395 condition, TokenFactory.tokenFromType(TokenType.SEMICOLON), updaters, |
| 501 initialization, | 396 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), body); |
| 502 TokenFactory.tokenFromType(TokenType.SEMICOLON), | |
| 503 condition, | |
| 504 TokenFactory.tokenFromType(TokenType.SEMICOLON), | |
| 505 updaters, | |
| 506 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 507 body); | |
| 508 | 397 |
| 509 static ForStatement forStatement2(VariableDeclarationList variableList, | 398 static ForStatement forStatement2(VariableDeclarationList variableList, |
| 510 Expression condition, List<Expression> updaters, Statement body) => | 399 Expression condition, List<Expression> updaters, Statement body) => |
| 511 new ForStatement( | 400 new ForStatement(TokenFactory.tokenFromKeyword(Keyword.FOR), |
| 512 TokenFactory.tokenFromKeyword(Keyword.FOR), | 401 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), variableList, null, |
| 513 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 402 TokenFactory.tokenFromType(TokenType.SEMICOLON), condition, |
| 514 variableList, | 403 TokenFactory.tokenFromType(TokenType.SEMICOLON), updaters, |
| 515 null, | 404 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), body); |
| 516 TokenFactory.tokenFromType(TokenType.SEMICOLON), | |
| 517 condition, | |
| 518 TokenFactory.tokenFromType(TokenType.SEMICOLON), | |
| 519 updaters, | |
| 520 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 521 body); | |
| 522 | 405 |
| 523 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword, | 406 static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword, |
| 524 String name, FunctionExpression functionExpression) => | 407 String name, FunctionExpression functionExpression) => |
| 525 new FunctionDeclaration( | 408 new FunctionDeclaration(null, null, null, type, |
| 526 null, | |
| 527 null, | |
| 528 null, | |
| 529 type, | |
| 530 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 409 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 531 identifier3(name), | 410 identifier3(name), functionExpression); |
| 532 functionExpression); | |
| 533 | 411 |
| 534 static FunctionDeclarationStatement | 412 static FunctionDeclarationStatement functionDeclarationStatement( |
| 535 functionDeclarationStatement(TypeName type, Keyword keyword, String name, | 413 TypeName type, Keyword keyword, String name, |
| 536 FunctionExpression functionExpression) => | 414 FunctionExpression functionExpression) => |
| 537 new FunctionDeclarationStatement( | 415 new FunctionDeclarationStatement( |
| 538 functionDeclaration(type, keyword, name, functionExpression)); | 416 functionDeclaration(type, keyword, name, functionExpression)); |
| 539 | 417 |
| 540 static FunctionExpression functionExpression() => | 418 static FunctionExpression functionExpression() => |
| 541 new FunctionExpression(formalParameterList(), blockFunctionBody2()); | 419 new FunctionExpression(formalParameterList(), blockFunctionBody2()); |
| 542 | 420 |
| 543 static FunctionExpression functionExpression2(FormalParameterList parameters, | 421 static FunctionExpression functionExpression2( |
| 544 FunctionBody body) => | 422 FormalParameterList parameters, FunctionBody body) => |
| 545 new FunctionExpression(parameters, body); | 423 new FunctionExpression(parameters, body); |
| 546 | 424 |
| 547 static FunctionExpressionInvocation | 425 static FunctionExpressionInvocation functionExpressionInvocation( |
| 548 functionExpressionInvocation(Expression function, | 426 Expression function, [List<Expression> arguments]) => |
| 549 [List<Expression> arguments]) => | |
| 550 new FunctionExpressionInvocation(function, argumentList(arguments)); | 427 new FunctionExpressionInvocation(function, argumentList(arguments)); |
| 551 | 428 |
| 552 static FunctionTypedFormalParameter | 429 static FunctionTypedFormalParameter functionTypedFormalParameter( |
| 553 functionTypedFormalParameter(TypeName returnType, String identifier, | 430 TypeName returnType, String identifier, |
| 554 [List<FormalParameter> parameters]) => | 431 [List<FormalParameter> parameters]) => new FunctionTypedFormalParameter( |
| 555 new FunctionTypedFormalParameter( | 432 null, null, returnType, identifier3(identifier), |
| 556 null, | 433 formalParameterList(parameters)); |
| 557 null, | |
| 558 returnType, | |
| 559 identifier3(identifier), | |
| 560 formalParameterList(parameters)); | |
| 561 | 434 |
| 562 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => | 435 static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) => |
| 563 new HideCombinator(TokenFactory.tokenFromString("hide"), identifiers); | 436 new HideCombinator(TokenFactory.tokenFromString("hide"), identifiers); |
| 564 | 437 |
| 565 static HideCombinator hideCombinator2(List<String> identifiers) => | 438 static HideCombinator hideCombinator2(List<String> identifiers) => |
| 566 new HideCombinator( | 439 new HideCombinator( |
| 567 TokenFactory.tokenFromString("hide"), | 440 TokenFactory.tokenFromString("hide"), identifierList(identifiers)); |
| 568 identifierList(identifiers)); | |
| 569 | 441 |
| 570 static PrefixedIdentifier identifier(SimpleIdentifier prefix, | 442 static PrefixedIdentifier identifier( |
| 571 SimpleIdentifier identifier) => | 443 SimpleIdentifier prefix, SimpleIdentifier identifier) => |
| 572 new PrefixedIdentifier( | 444 new PrefixedIdentifier( |
| 573 prefix, | 445 prefix, TokenFactory.tokenFromType(TokenType.PERIOD), identifier); |
| 574 TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 575 identifier); | |
| 576 | 446 |
| 577 static SimpleIdentifier identifier3(String lexeme) => | 447 static SimpleIdentifier identifier3(String lexeme) => new SimpleIdentifier( |
| 578 new SimpleIdentifier( | 448 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme)); |
| 579 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme)); | |
| 580 | 449 |
| 581 static PrefixedIdentifier identifier4(String prefix, | 450 static PrefixedIdentifier identifier4( |
| 582 SimpleIdentifier identifier) => | 451 String prefix, SimpleIdentifier identifier) => new PrefixedIdentifier( |
| 583 new PrefixedIdentifier( | 452 identifier3(prefix), TokenFactory.tokenFromType(TokenType.PERIOD), |
| 584 identifier3(prefix), | 453 identifier); |
| 585 TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 586 identifier); | |
| 587 | 454 |
| 588 static PrefixedIdentifier identifier5(String prefix, String identifier) => | 455 static PrefixedIdentifier identifier5(String prefix, String identifier) => |
| 589 new PrefixedIdentifier( | 456 new PrefixedIdentifier(identifier3(prefix), |
| 590 identifier3(prefix), | |
| 591 TokenFactory.tokenFromType(TokenType.PERIOD), | 457 TokenFactory.tokenFromType(TokenType.PERIOD), |
| 592 identifier3(identifier)); | 458 identifier3(identifier)); |
| 593 | 459 |
| 594 static List<SimpleIdentifier> identifierList(List<String> identifiers) { | 460 static List<SimpleIdentifier> identifierList(List<String> identifiers) { |
| 595 if (identifiers == null) { | 461 if (identifiers == null) { |
| 596 return null; | 462 return null; |
| 597 } | 463 } |
| 598 return identifiers.map( | 464 return identifiers |
| 599 (String identifier) => identifier3(identifier)).toList(); | 465 .map((String identifier) => identifier3(identifier)) |
| 466 .toList(); |
| 600 } | 467 } |
| 601 | 468 |
| 602 static IfStatement ifStatement(Expression condition, | 469 static IfStatement ifStatement( |
| 603 Statement thenStatement) => | 470 Expression condition, Statement thenStatement) => |
| 604 ifStatement2(condition, thenStatement, null); | 471 ifStatement2(condition, thenStatement, null); |
| 605 | 472 |
| 606 static IfStatement ifStatement2(Expression condition, Statement thenStatement, | 473 static IfStatement ifStatement2(Expression condition, Statement thenStatement, |
| 607 Statement elseStatement) => | 474 Statement elseStatement) => new IfStatement( |
| 608 new IfStatement( | 475 TokenFactory.tokenFromKeyword(Keyword.IF), |
| 609 TokenFactory.tokenFromKeyword(Keyword.IF), | 476 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condition, |
| 610 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 477 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), thenStatement, |
| 611 condition, | 478 elseStatement == null |
| 612 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | 479 ? null |
| 613 thenStatement, | 480 : TokenFactory.tokenFromKeyword(Keyword.ELSE), elseStatement); |
| 614 elseStatement == null ? null : TokenFactory.tokenFromKeyword(Keyword.E
LSE), | |
| 615 elseStatement); | |
| 616 | 481 |
| 617 static ImplementsClause implementsClause(List<TypeName> types) => | 482 static ImplementsClause implementsClause(List<TypeName> types) => |
| 618 new ImplementsClause(TokenFactory.tokenFromKeyword(Keyword.IMPLEMENTS), ty
pes); | 483 new ImplementsClause( |
| 484 TokenFactory.tokenFromKeyword(Keyword.IMPLEMENTS), types); |
| 619 | 485 |
| 620 static ImportDirective importDirective(List<Annotation> metadata, String uri, | 486 static ImportDirective importDirective( |
| 621 bool isDeferred, String prefix, [List<Combinator> combinators]) => | 487 List<Annotation> metadata, String uri, bool isDeferred, String prefix, |
| 622 new ImportDirective( | 488 [List<Combinator> combinators]) => new ImportDirective(null, metadata, |
| 623 null, | 489 TokenFactory.tokenFromKeyword(Keyword.IMPORT), string2(uri), |
| 624 metadata, | 490 !isDeferred ? null : TokenFactory.tokenFromKeyword(Keyword.DEFERRED), |
| 625 TokenFactory.tokenFromKeyword(Keyword.IMPORT), | 491 prefix == null ? null : TokenFactory.tokenFromKeyword(Keyword.AS), |
| 626 string2(uri), | 492 prefix == null ? null : identifier3(prefix), combinators, |
| 627 !isDeferred ? null : TokenFactory.tokenFromKeyword(Keyword.DEFERRED), | 493 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 628 prefix == null ? null : TokenFactory.tokenFromKeyword(Keyword.AS), | |
| 629 prefix == null ? null : identifier3(prefix), | |
| 630 combinators, | |
| 631 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 632 | 494 |
| 633 static ImportDirective importDirective2(String uri, bool isDeferred, | 495 static ImportDirective importDirective2( |
| 634 String prefix, [List<Combinator> combinators]) => | 496 String uri, bool isDeferred, String prefix, |
| 497 [List<Combinator> combinators]) => |
| 635 importDirective(null, uri, isDeferred, prefix, combinators); | 498 importDirective(null, uri, isDeferred, prefix, combinators); |
| 636 | 499 |
| 637 static ImportDirective importDirective3(String uri, String prefix, | 500 static ImportDirective importDirective3(String uri, String prefix, |
| 638 [List<Combinator> combinators]) => | 501 [List<Combinator> combinators]) => |
| 639 importDirective(null, uri, false, prefix, combinators); | 502 importDirective(null, uri, false, prefix, combinators); |
| 640 | 503 |
| 641 static IndexExpression indexExpression(Expression array, Expression index) => | 504 static IndexExpression indexExpression(Expression array, Expression index) => |
| 642 new IndexExpression.forTarget( | 505 new IndexExpression.forTarget(array, |
| 643 array, | 506 TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), index, |
| 644 TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), | |
| 645 index, | |
| 646 TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET)); | 507 TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET)); |
| 647 | 508 |
| 648 static InstanceCreationExpression instanceCreationExpression(Keyword keyword, | 509 static InstanceCreationExpression instanceCreationExpression( |
| 649 ConstructorName name, [List<Expression> arguments]) => | 510 Keyword keyword, ConstructorName name, |
| 650 new InstanceCreationExpression( | 511 [List<Expression> arguments]) => new InstanceCreationExpression( |
| 651 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 512 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), name, |
| 652 name, | 513 argumentList(arguments)); |
| 653 argumentList(arguments)); | |
| 654 | 514 |
| 655 static InstanceCreationExpression instanceCreationExpression2(Keyword keyword, | 515 static InstanceCreationExpression instanceCreationExpression2( |
| 656 TypeName type, [List<Expression> arguments]) => | 516 Keyword keyword, TypeName type, [List<Expression> arguments]) => |
| 657 instanceCreationExpression3(keyword, type, null, arguments); | 517 instanceCreationExpression3(keyword, type, null, arguments); |
| 658 | 518 |
| 659 static InstanceCreationExpression instanceCreationExpression3(Keyword keyword, | 519 static InstanceCreationExpression instanceCreationExpression3( |
| 660 TypeName type, String identifier, [List<Expression> arguments]) => | 520 Keyword keyword, TypeName type, String identifier, |
| 661 instanceCreationExpression( | 521 [List<Expression> arguments]) => instanceCreationExpression(keyword, |
| 662 keyword, | 522 new ConstructorName(type, identifier == null |
| 663 new ConstructorName( | 523 ? null |
| 664 type, | 524 : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 665 identifier == null ? null : TokenFactory.tokenFromType(TokenType.P
ERIOD), | 525 identifier == null ? null : identifier3(identifier)), arguments); |
| 666 identifier == null ? null : identifier3(identifier)), | |
| 667 arguments); | |
| 668 | 526 |
| 669 static IntegerLiteral integer(int value) => | 527 static IntegerLiteral integer(int value) => new IntegerLiteral( |
| 670 new IntegerLiteral( | 528 TokenFactory.tokenFromTypeAndString(TokenType.INT, value.toString()), |
| 671 TokenFactory.tokenFromTypeAndString(TokenType.INT, value.toString()), | 529 value); |
| 672 value); | |
| 673 | 530 |
| 674 static InterpolationExpression | 531 static InterpolationExpression interpolationExpression( |
| 675 interpolationExpression(Expression expression) => | 532 Expression expression) => new InterpolationExpression( |
| 676 new InterpolationExpression( | 533 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION), |
| 677 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION), | 534 expression, TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 678 expression, | |
| 679 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); | |
| 680 | 535 |
| 681 static InterpolationExpression interpolationExpression2(String identifier) => | 536 static InterpolationExpression interpolationExpression2(String identifier) => |
| 682 new InterpolationExpression( | 537 new InterpolationExpression( |
| 683 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_IDENTIFIER), | 538 TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_IDENTIFIER), |
| 684 identifier3(identifier), | 539 identifier3(identifier), null); |
| 685 null); | |
| 686 | 540 |
| 687 static InterpolationString interpolationString(String contents, | 541 static InterpolationString interpolationString( |
| 688 String value) => | 542 String contents, String value) => |
| 689 new InterpolationString(TokenFactory.tokenFromString(contents), value); | 543 new InterpolationString(TokenFactory.tokenFromString(contents), value); |
| 690 | 544 |
| 691 static IsExpression isExpression(Expression expression, bool negated, | 545 static IsExpression isExpression( |
| 692 TypeName type) => | 546 Expression expression, bool negated, TypeName type) => new IsExpression( |
| 693 new IsExpression( | 547 expression, TokenFactory.tokenFromKeyword(Keyword.IS), |
| 694 expression, | 548 negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, type); |
| 695 TokenFactory.tokenFromKeyword(Keyword.IS), | |
| 696 negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, | |
| 697 type); | |
| 698 | 549 |
| 699 static Label label(SimpleIdentifier label) => | 550 static Label label(SimpleIdentifier label) => |
| 700 new Label(label, TokenFactory.tokenFromType(TokenType.COLON)); | 551 new Label(label, TokenFactory.tokenFromType(TokenType.COLON)); |
| 701 | 552 |
| 702 static Label label2(String label) => AstFactory.label(identifier3(label)); | 553 static Label label2(String label) => AstFactory.label(identifier3(label)); |
| 703 | 554 |
| 704 static LabeledStatement labeledStatement(List<Label> labels, | 555 static LabeledStatement labeledStatement( |
| 705 Statement statement) => | 556 List<Label> labels, Statement statement) => |
| 706 new LabeledStatement(labels, statement); | 557 new LabeledStatement(labels, statement); |
| 707 | 558 |
| 708 static LibraryDirective libraryDirective(List<Annotation> metadata, | 559 static LibraryDirective libraryDirective( |
| 709 LibraryIdentifier libraryName) => | 560 List<Annotation> metadata, LibraryIdentifier libraryName) => |
| 710 new LibraryDirective( | 561 new LibraryDirective(null, metadata, |
| 711 null, | 562 TokenFactory.tokenFromKeyword(Keyword.LIBRARY), libraryName, |
| 712 metadata, | |
| 713 TokenFactory.tokenFromKeyword(Keyword.LIBRARY), | |
| 714 libraryName, | |
| 715 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 563 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 716 | 564 |
| 717 static LibraryDirective libraryDirective2(String libraryName) => | 565 static LibraryDirective libraryDirective2(String libraryName) => |
| 718 libraryDirective(new List<Annotation>(), libraryIdentifier2([libraryName])
); | 566 libraryDirective( |
| 567 new List<Annotation>(), libraryIdentifier2([libraryName])); |
| 719 | 568 |
| 720 static LibraryIdentifier | 569 static LibraryIdentifier libraryIdentifier( |
| 721 libraryIdentifier(List<SimpleIdentifier> components) => | 570 List<SimpleIdentifier> components) => new LibraryIdentifier(components); |
| 722 new LibraryIdentifier(components); | |
| 723 | 571 |
| 724 static LibraryIdentifier libraryIdentifier2(List<String> components) { | 572 static LibraryIdentifier libraryIdentifier2(List<String> components) { |
| 725 return new LibraryIdentifier(identifierList(components)); | 573 return new LibraryIdentifier(identifierList(components)); |
| 726 } | 574 } |
| 727 | 575 |
| 728 static List list(List<Object> elements) { | 576 static List list(List<Object> elements) { |
| 729 return elements; | 577 return elements; |
| 730 } | 578 } |
| 731 | 579 |
| 732 static ListLiteral listLiteral([List<Expression> elements]) => | 580 static ListLiteral listLiteral([List<Expression> elements]) => |
| 733 listLiteral2(null, null, elements); | 581 listLiteral2(null, null, elements); |
| 734 | 582 |
| 735 static ListLiteral listLiteral2(Keyword keyword, | 583 static ListLiteral listLiteral2( |
| 736 TypeArgumentList typeArguments, [List<Expression> elements]) => | 584 Keyword keyword, TypeArgumentList typeArguments, |
| 737 new ListLiteral( | 585 [List<Expression> elements]) => new ListLiteral( |
| 738 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 586 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 739 typeArguments, | 587 typeArguments, TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), |
| 740 TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET), | 588 elements, TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET)); |
| 741 elements, | |
| 742 TokenFactory.tokenFromType(TokenType.CLOSE_SQUARE_BRACKET)); | |
| 743 | 589 |
| 744 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments, | 590 static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments, |
| 745 [List<MapLiteralEntry> entries]) => | 591 [List<MapLiteralEntry> entries]) => new MapLiteral( |
| 746 new MapLiteral( | 592 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), |
| 747 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | 593 typeArguments, TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), |
| 748 typeArguments, | 594 entries, TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 749 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), | |
| 750 entries, | |
| 751 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); | |
| 752 | 595 |
| 753 static MapLiteral mapLiteral2([List<MapLiteralEntry> entries]) => | 596 static MapLiteral mapLiteral2([List<MapLiteralEntry> entries]) => |
| 754 mapLiteral(null, null, entries); | 597 mapLiteral(null, null, entries); |
| 755 | 598 |
| 756 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => | 599 static MapLiteralEntry mapLiteralEntry(String key, Expression value) => |
| 757 new MapLiteralEntry( | 600 new MapLiteralEntry( |
| 758 string2(key), | 601 string2(key), TokenFactory.tokenFromType(TokenType.COLON), value); |
| 759 TokenFactory.tokenFromType(TokenType.COLON), | |
| 760 value); | |
| 761 | 602 |
| 762 static MethodDeclaration methodDeclaration(Keyword modifier, | 603 static MethodDeclaration methodDeclaration(Keyword modifier, |
| 763 TypeName returnType, Keyword property, Keyword operator, SimpleIdentifier
name, | 604 TypeName returnType, Keyword property, Keyword operator, |
| 764 FormalParameterList parameters) => | 605 SimpleIdentifier name, |
| 765 new MethodDeclaration( | 606 FormalParameterList parameters) => new MethodDeclaration(null, null, |
| 766 null, | 607 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL), |
| 767 null, | 608 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), |
| 768 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL), | 609 returnType, |
| 769 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), | 610 property == null ? null : TokenFactory.tokenFromKeyword(property), |
| 770 returnType, | 611 operator == null ? null : TokenFactory.tokenFromKeyword(operator), name, |
| 771 property == null ? null : TokenFactory.tokenFromKeyword(property), | 612 parameters, emptyFunctionBody()); |
| 772 operator == null ? null : TokenFactory.tokenFromKeyword(operator), | |
| 773 name, | |
| 774 parameters, | |
| 775 emptyFunctionBody()); | |
| 776 | 613 |
| 777 static MethodDeclaration methodDeclaration2(Keyword modifier, | 614 static MethodDeclaration methodDeclaration2(Keyword modifier, |
| 778 TypeName returnType, Keyword property, Keyword operator, SimpleIdentifier
name, | 615 TypeName returnType, Keyword property, Keyword operator, |
| 779 FormalParameterList parameters, FunctionBody body) => | 616 SimpleIdentifier name, FormalParameterList parameters, |
| 780 new MethodDeclaration( | 617 FunctionBody body) => new MethodDeclaration(null, null, null, |
| 781 null, | 618 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), |
| 782 null, | 619 returnType, |
| 783 null, | 620 property == null ? null : TokenFactory.tokenFromKeyword(property), |
| 784 modifier == null ? null : TokenFactory.tokenFromKeyword(modifier), | 621 operator == null ? null : TokenFactory.tokenFromKeyword(operator), name, |
| 785 returnType, | 622 parameters, body); |
| 786 property == null ? null : TokenFactory.tokenFromKeyword(property), | |
| 787 operator == null ? null : TokenFactory.tokenFromKeyword(operator), | |
| 788 name, | |
| 789 parameters, | |
| 790 body); | |
| 791 | 623 |
| 792 static MethodInvocation methodInvocation(Expression target, String methodName, | 624 static MethodInvocation methodInvocation(Expression target, String methodName, |
| 793 [List<Expression> arguments]) => | 625 [List<Expression> arguments]) => new MethodInvocation(target, |
| 794 new MethodInvocation( | 626 target == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 795 target, | 627 identifier3(methodName), argumentList(arguments)); |
| 796 target == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 797 identifier3(methodName), | |
| 798 argumentList(arguments)); | |
| 799 | 628 |
| 800 static MethodInvocation methodInvocation2(String methodName, | 629 static MethodInvocation methodInvocation2(String methodName, |
| 801 [List<Expression> arguments]) => | 630 [List<Expression> arguments]) => |
| 802 methodInvocation(null, methodName, arguments); | 631 methodInvocation(null, methodName, arguments); |
| 803 | 632 |
| 804 static NamedExpression namedExpression(Label label, Expression expression) => | 633 static NamedExpression namedExpression(Label label, Expression expression) => |
| 805 new NamedExpression(label, expression); | 634 new NamedExpression(label, expression); |
| 806 | 635 |
| 807 static NamedExpression namedExpression2(String label, | 636 static NamedExpression namedExpression2( |
| 808 Expression expression) => | 637 String label, Expression expression) => |
| 809 namedExpression(label2(label), expression); | 638 namedExpression(label2(label), expression); |
| 810 | 639 |
| 811 static DefaultFormalParameter | 640 static DefaultFormalParameter namedFormalParameter( |
| 812 namedFormalParameter(NormalFormalParameter parameter, Expression expressio
n) => | 641 NormalFormalParameter parameter, Expression expression) => |
| 813 new DefaultFormalParameter( | 642 new DefaultFormalParameter(parameter, ParameterKind.NAMED, |
| 814 parameter, | 643 expression == null |
| 815 ParameterKind.NAMED, | 644 ? null |
| 816 expression == null ? null : TokenFactory.tokenFromType(TokenType.COLON
), | 645 : TokenFactory.tokenFromType(TokenType.COLON), expression); |
| 817 expression); | |
| 818 | 646 |
| 819 static NativeClause nativeClause(String nativeCode) => | 647 static NativeClause nativeClause(String nativeCode) => new NativeClause( |
| 820 new NativeClause(TokenFactory.tokenFromString("native"), string2(nativeCod
e)); | 648 TokenFactory.tokenFromString("native"), string2(nativeCode)); |
| 821 | 649 |
| 822 static NativeFunctionBody nativeFunctionBody(String nativeMethodName) => | 650 static NativeFunctionBody nativeFunctionBody(String nativeMethodName) => |
| 823 new NativeFunctionBody( | 651 new NativeFunctionBody(TokenFactory.tokenFromString("native"), |
| 824 TokenFactory.tokenFromString("native"), | |
| 825 string2(nativeMethodName), | 652 string2(nativeMethodName), |
| 826 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 653 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 827 | 654 |
| 828 static NullLiteral nullLiteral() => | 655 static NullLiteral nullLiteral() => |
| 829 new NullLiteral(TokenFactory.tokenFromKeyword(Keyword.NULL)); | 656 new NullLiteral(TokenFactory.tokenFromKeyword(Keyword.NULL)); |
| 830 | 657 |
| 831 static ParenthesizedExpression | 658 static ParenthesizedExpression parenthesizedExpression( |
| 832 parenthesizedExpression(Expression expression) => | 659 Expression expression) => new ParenthesizedExpression( |
| 833 new ParenthesizedExpression( | 660 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), expression, |
| 834 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 661 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); |
| 835 expression, | |
| 836 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); | |
| 837 | 662 |
| 838 static PartDirective partDirective(List<Annotation> metadata, String url) => | 663 static PartDirective partDirective(List<Annotation> metadata, String url) => |
| 839 new PartDirective( | 664 new PartDirective(null, metadata, |
| 840 null, | 665 TokenFactory.tokenFromKeyword(Keyword.PART), string2(url), |
| 841 metadata, | |
| 842 TokenFactory.tokenFromKeyword(Keyword.PART), | |
| 843 string2(url), | |
| 844 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 666 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 845 | 667 |
| 846 static PartDirective partDirective2(String url) => | 668 static PartDirective partDirective2(String url) => |
| 847 partDirective(new List<Annotation>(), url); | 669 partDirective(new List<Annotation>(), url); |
| 848 | 670 |
| 849 static PartOfDirective partOfDirective(LibraryIdentifier libraryName) => | 671 static PartOfDirective partOfDirective(LibraryIdentifier libraryName) => |
| 850 partOfDirective2(new List<Annotation>(), libraryName); | 672 partOfDirective2(new List<Annotation>(), libraryName); |
| 851 | 673 |
| 852 static PartOfDirective partOfDirective2(List<Annotation> metadata, | 674 static PartOfDirective partOfDirective2( |
| 853 LibraryIdentifier libraryName) => | 675 List<Annotation> metadata, LibraryIdentifier libraryName) => |
| 854 new PartOfDirective( | 676 new PartOfDirective(null, metadata, |
| 855 null, | |
| 856 metadata, | |
| 857 TokenFactory.tokenFromKeyword(Keyword.PART), | 677 TokenFactory.tokenFromKeyword(Keyword.PART), |
| 858 TokenFactory.tokenFromString("of"), | 678 TokenFactory.tokenFromString("of"), libraryName, |
| 859 libraryName, | |
| 860 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 679 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 861 | 680 |
| 862 static DefaultFormalParameter | 681 static DefaultFormalParameter positionalFormalParameter( |
| 863 positionalFormalParameter(NormalFormalParameter parameter, | 682 NormalFormalParameter parameter, Expression expression) => |
| 864 Expression expression) => | 683 new DefaultFormalParameter(parameter, ParameterKind.POSITIONAL, |
| 865 new DefaultFormalParameter( | |
| 866 parameter, | |
| 867 ParameterKind.POSITIONAL, | |
| 868 expression == null ? null : TokenFactory.tokenFromType(TokenType.EQ), | 684 expression == null ? null : TokenFactory.tokenFromType(TokenType.EQ), |
| 869 expression); | 685 expression); |
| 870 | 686 |
| 871 static PostfixExpression postfixExpression(Expression expression, | 687 static PostfixExpression postfixExpression( |
| 872 TokenType operator) => | 688 Expression expression, TokenType operator) => |
| 873 new PostfixExpression(expression, TokenFactory.tokenFromType(operator)); | 689 new PostfixExpression(expression, TokenFactory.tokenFromType(operator)); |
| 874 | 690 |
| 875 static PrefixExpression prefixExpression(TokenType operator, | 691 static PrefixExpression prefixExpression( |
| 876 Expression expression) => | 692 TokenType operator, Expression expression) => |
| 877 new PrefixExpression(TokenFactory.tokenFromType(operator), expression); | 693 new PrefixExpression(TokenFactory.tokenFromType(operator), expression); |
| 878 | 694 |
| 879 static PropertyAccess propertyAccess(Expression target, | 695 static PropertyAccess propertyAccess( |
| 880 SimpleIdentifier propertyName) => | 696 Expression target, SimpleIdentifier propertyName) => new PropertyAccess( |
| 881 new PropertyAccess( | 697 target, TokenFactory.tokenFromType(TokenType.PERIOD), propertyName); |
| 882 target, | |
| 883 TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 884 propertyName); | |
| 885 | 698 |
| 886 static PropertyAccess propertyAccess2(Expression target, | 699 static PropertyAccess propertyAccess2( |
| 887 String propertyName) => | 700 Expression target, String propertyName) => new PropertyAccess(target, |
| 888 new PropertyAccess( | 701 TokenFactory.tokenFromType(TokenType.PERIOD), identifier3(propertyName)); |
| 889 target, | |
| 890 TokenFactory.tokenFromType(TokenType.PERIOD), | |
| 891 identifier3(propertyName)); | |
| 892 | 702 |
| 893 static RedirectingConstructorInvocation | 703 static RedirectingConstructorInvocation redirectingConstructorInvocation( |
| 894 redirectingConstructorInvocation([List<Expression> arguments]) => | 704 [List<Expression> arguments]) => |
| 895 redirectingConstructorInvocation2(null, arguments); | 705 redirectingConstructorInvocation2(null, arguments); |
| 896 | 706 |
| 897 static RedirectingConstructorInvocation | 707 static RedirectingConstructorInvocation redirectingConstructorInvocation2( |
| 898 redirectingConstructorInvocation2(String constructorName, | 708 String constructorName, [List<Expression> arguments]) => |
| 899 [List<Expression> arguments]) => | |
| 900 new RedirectingConstructorInvocation( | 709 new RedirectingConstructorInvocation( |
| 901 TokenFactory.tokenFromKeyword(Keyword.THIS), | 710 TokenFactory.tokenFromKeyword(Keyword.THIS), constructorName == null |
| 902 constructorName == null ? null : TokenFactory.tokenFromType(TokenType.
PERIOD), | 711 ? null |
| 712 : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 903 constructorName == null ? null : identifier3(constructorName), | 713 constructorName == null ? null : identifier3(constructorName), |
| 904 argumentList(arguments)); | 714 argumentList(arguments)); |
| 905 | 715 |
| 906 static RethrowExpression rethrowExpression() => | 716 static RethrowExpression rethrowExpression() => |
| 907 new RethrowExpression(TokenFactory.tokenFromKeyword(Keyword.RETHROW)); | 717 new RethrowExpression(TokenFactory.tokenFromKeyword(Keyword.RETHROW)); |
| 908 | 718 |
| 909 static ReturnStatement returnStatement() => returnStatement2(null); | 719 static ReturnStatement returnStatement() => returnStatement2(null); |
| 910 | 720 |
| 911 static ReturnStatement returnStatement2(Expression expression) => | 721 static ReturnStatement returnStatement2(Expression expression) => |
| 912 new ReturnStatement( | 722 new ReturnStatement(TokenFactory.tokenFromKeyword(Keyword.RETURN), |
| 913 TokenFactory.tokenFromKeyword(Keyword.RETURN), | 723 expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 914 expression, | |
| 915 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 916 | 724 |
| 917 static ScriptTag scriptTag(String scriptTag) => | 725 static ScriptTag scriptTag(String scriptTag) => |
| 918 new ScriptTag(TokenFactory.tokenFromString(scriptTag)); | 726 new ScriptTag(TokenFactory.tokenFromString(scriptTag)); |
| 919 | 727 |
| 920 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => | 728 static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) => |
| 921 new ShowCombinator(TokenFactory.tokenFromString("show"), identifiers); | 729 new ShowCombinator(TokenFactory.tokenFromString("show"), identifiers); |
| 922 | 730 |
| 923 static ShowCombinator showCombinator2(List<String> identifiers) => | 731 static ShowCombinator showCombinator2(List<String> identifiers) => |
| 924 new ShowCombinator( | 732 new ShowCombinator( |
| 925 TokenFactory.tokenFromString("show"), | 733 TokenFactory.tokenFromString("show"), identifierList(identifiers)); |
| 926 identifierList(identifiers)); | |
| 927 | 734 |
| 928 static SimpleFormalParameter simpleFormalParameter(Keyword keyword, | 735 static SimpleFormalParameter simpleFormalParameter( |
| 929 String parameterName) => | 736 Keyword keyword, String parameterName) => |
| 930 simpleFormalParameter2(keyword, null, parameterName); | 737 simpleFormalParameter2(keyword, null, parameterName); |
| 931 | 738 |
| 932 static SimpleFormalParameter simpleFormalParameter2(Keyword keyword, | 739 static SimpleFormalParameter simpleFormalParameter2( |
| 933 TypeName type, String parameterName) => | 740 Keyword keyword, TypeName type, String parameterName) => |
| 934 new SimpleFormalParameter( | 741 new SimpleFormalParameter(null, null, |
| 935 null, | 742 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), type, |
| 936 null, | |
| 937 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | |
| 938 type, | |
| 939 identifier3(parameterName)); | 743 identifier3(parameterName)); |
| 940 | 744 |
| 941 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => | 745 static SimpleFormalParameter simpleFormalParameter3(String parameterName) => |
| 942 simpleFormalParameter2(null, null, parameterName); | 746 simpleFormalParameter2(null, null, parameterName); |
| 943 | 747 |
| 944 static SimpleFormalParameter simpleFormalParameter4(TypeName type, | 748 static SimpleFormalParameter simpleFormalParameter4( |
| 945 String parameterName) => | 749 TypeName type, String parameterName) => |
| 946 simpleFormalParameter2(null, type, parameterName); | 750 simpleFormalParameter2(null, type, parameterName); |
| 947 | 751 |
| 948 static StringInterpolation string([List<InterpolationElement> elements]) => | 752 static StringInterpolation string([List<InterpolationElement> elements]) => |
| 949 new StringInterpolation(elements); | 753 new StringInterpolation(elements); |
| 950 | 754 |
| 951 static SimpleStringLiteral string2(String content) => | 755 static SimpleStringLiteral string2(String content) => new SimpleStringLiteral( |
| 952 new SimpleStringLiteral(TokenFactory.tokenFromString("'$content'"), conten
t); | 756 TokenFactory.tokenFromString("'$content'"), content); |
| 953 | 757 |
| 954 static SuperConstructorInvocation | 758 static SuperConstructorInvocation superConstructorInvocation( |
| 955 superConstructorInvocation([List<Expression> arguments]) => | 759 [List<Expression> arguments]) => |
| 956 superConstructorInvocation2(null, arguments); | 760 superConstructorInvocation2(null, arguments); |
| 957 | 761 |
| 958 static SuperConstructorInvocation superConstructorInvocation2(String name, | 762 static SuperConstructorInvocation superConstructorInvocation2(String name, |
| 959 [List<Expression> arguments]) => | 763 [List<Expression> arguments]) => new SuperConstructorInvocation( |
| 960 new SuperConstructorInvocation( | 764 TokenFactory.tokenFromKeyword(Keyword.SUPER), |
| 961 TokenFactory.tokenFromKeyword(Keyword.SUPER), | 765 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), |
| 962 name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD), | 766 name == null ? null : identifier3(name), argumentList(arguments)); |
| 963 name == null ? null : identifier3(name), | |
| 964 argumentList(arguments)); | |
| 965 | 767 |
| 966 static SuperExpression superExpression() => | 768 static SuperExpression superExpression() => |
| 967 new SuperExpression(TokenFactory.tokenFromKeyword(Keyword.SUPER)); | 769 new SuperExpression(TokenFactory.tokenFromKeyword(Keyword.SUPER)); |
| 968 | 770 |
| 969 static SwitchCase switchCase(Expression expression, | 771 static SwitchCase switchCase( |
| 970 List<Statement> statements) => | 772 Expression expression, List<Statement> statements) => |
| 971 switchCase2(new List<Label>(), expression, statements); | 773 switchCase2(new List<Label>(), expression, statements); |
| 972 | 774 |
| 973 static SwitchCase switchCase2(List<Label> labels, Expression expression, | 775 static SwitchCase switchCase2(List<Label> labels, Expression expression, |
| 974 List<Statement> statements) => | 776 List<Statement> statements) => new SwitchCase(labels, |
| 975 new SwitchCase( | 777 TokenFactory.tokenFromKeyword(Keyword.CASE), expression, |
| 976 labels, | 778 TokenFactory.tokenFromType(TokenType.COLON), statements); |
| 977 TokenFactory.tokenFromKeyword(Keyword.CASE), | |
| 978 expression, | |
| 979 TokenFactory.tokenFromType(TokenType.COLON), | |
| 980 statements); | |
| 981 | 779 |
| 982 static SwitchDefault switchDefault(List<Label> labels, | 780 static SwitchDefault switchDefault( |
| 983 List<Statement> statements) => | 781 List<Label> labels, List<Statement> statements) => new SwitchDefault( |
| 984 new SwitchDefault( | 782 labels, TokenFactory.tokenFromKeyword(Keyword.DEFAULT), |
| 985 labels, | 783 TokenFactory.tokenFromType(TokenType.COLON), statements); |
| 986 TokenFactory.tokenFromKeyword(Keyword.DEFAULT), | |
| 987 TokenFactory.tokenFromType(TokenType.COLON), | |
| 988 statements); | |
| 989 | 784 |
| 990 static SwitchDefault switchDefault2(List<Statement> statements) => | 785 static SwitchDefault switchDefault2(List<Statement> statements) => |
| 991 switchDefault(new List<Label>(), statements); | 786 switchDefault(new List<Label>(), statements); |
| 992 | 787 |
| 993 static SwitchStatement switchStatement(Expression expression, | 788 static SwitchStatement switchStatement( |
| 994 List<SwitchMember> members) => | 789 Expression expression, List<SwitchMember> members) => new SwitchStatement( |
| 995 new SwitchStatement( | 790 TokenFactory.tokenFromKeyword(Keyword.SWITCH), |
| 996 TokenFactory.tokenFromKeyword(Keyword.SWITCH), | 791 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), expression, |
| 997 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 792 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), |
| 998 expression, | 793 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), members, |
| 999 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | 794 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); |
| 1000 TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET), | |
| 1001 members, | |
| 1002 TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET)); | |
| 1003 | 795 |
| 1004 static SymbolLiteral symbolLiteral(List<String> components) { | 796 static SymbolLiteral symbolLiteral(List<String> components) { |
| 1005 List<Token> identifierList = new List<Token>(); | 797 List<Token> identifierList = new List<Token>(); |
| 1006 for (String component in components) { | 798 for (String component in components) { |
| 1007 identifierList.add( | 799 identifierList.add( |
| 1008 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, component)); | 800 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, component)); |
| 1009 } | 801 } |
| 1010 return new SymbolLiteral( | 802 return new SymbolLiteral( |
| 1011 TokenFactory.tokenFromType(TokenType.HASH), | 803 TokenFactory.tokenFromType(TokenType.HASH), identifierList); |
| 1012 identifierList); | |
| 1013 } | 804 } |
| 1014 | 805 |
| 1015 static BlockFunctionBody | 806 static BlockFunctionBody syncBlockFunctionBody( |
| 1016 syncBlockFunctionBody([List<Statement> statements]) => | 807 [List<Statement> statements]) => new BlockFunctionBody( |
| 1017 new BlockFunctionBody( | 808 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"), null, |
| 1018 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"), | 809 block(statements)); |
| 1019 null, | |
| 1020 block(statements)); | |
| 1021 | 810 |
| 1022 static BlockFunctionBody | 811 static BlockFunctionBody syncGeneratorBlockFunctionBody( |
| 1023 syncGeneratorBlockFunctionBody([List<Statement> statements]) => | 812 [List<Statement> statements]) => new BlockFunctionBody( |
| 1024 new BlockFunctionBody( | 813 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"), |
| 1025 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"), | 814 TokenFactory.tokenFromType(TokenType.STAR), block(statements)); |
| 1026 TokenFactory.tokenFromType(TokenType.STAR), | |
| 1027 block(statements)); | |
| 1028 | 815 |
| 1029 static ThisExpression thisExpression() => | 816 static ThisExpression thisExpression() => |
| 1030 new ThisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS)); | 817 new ThisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS)); |
| 1031 | 818 |
| 1032 static ThrowExpression throwExpression() => throwExpression2(null); | 819 static ThrowExpression throwExpression() => throwExpression2(null); |
| 1033 | 820 |
| 1034 static ThrowExpression throwExpression2(Expression expression) => | 821 static ThrowExpression throwExpression2(Expression expression) => |
| 1035 new ThrowExpression(TokenFactory.tokenFromKeyword(Keyword.THROW), expressi
on); | 822 new ThrowExpression( |
| 823 TokenFactory.tokenFromKeyword(Keyword.THROW), expression); |
| 1036 | 824 |
| 1037 static TopLevelVariableDeclaration | 825 static TopLevelVariableDeclaration topLevelVariableDeclaration( |
| 1038 topLevelVariableDeclaration(Keyword keyword, TypeName type, | 826 Keyword keyword, TypeName type, |
| 1039 List<VariableDeclaration> variables) => | 827 List<VariableDeclaration> variables) => new TopLevelVariableDeclaration( |
| 1040 new TopLevelVariableDeclaration( | 828 null, null, variableDeclarationList(keyword, type, variables), |
| 1041 null, | 829 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1042 null, | |
| 1043 variableDeclarationList(keyword, type, variables), | |
| 1044 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 1045 | 830 |
| 1046 static TopLevelVariableDeclaration | 831 static TopLevelVariableDeclaration topLevelVariableDeclaration2( |
| 1047 topLevelVariableDeclaration2(Keyword keyword, | 832 Keyword keyword, List<VariableDeclaration> variables) => |
| 1048 List<VariableDeclaration> variables) => | 833 new TopLevelVariableDeclaration(null, null, |
| 1049 new TopLevelVariableDeclaration( | |
| 1050 null, | |
| 1051 null, | |
| 1052 variableDeclarationList(keyword, null, variables), | 834 variableDeclarationList(keyword, null, variables), |
| 1053 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 835 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1054 | 836 |
| 1055 static TryStatement tryStatement(Block body, Block finallyClause) => | 837 static TryStatement tryStatement(Block body, Block finallyClause) => |
| 1056 tryStatement3(body, new List<CatchClause>(), finallyClause); | 838 tryStatement3(body, new List<CatchClause>(), finallyClause); |
| 1057 | 839 |
| 1058 static TryStatement tryStatement2(Block body, | 840 static TryStatement tryStatement2( |
| 1059 List<CatchClause> catchClauses) => | 841 Block body, List<CatchClause> catchClauses) => |
| 1060 tryStatement3(body, catchClauses, null); | 842 tryStatement3(body, catchClauses, null); |
| 1061 | 843 |
| 1062 static TryStatement tryStatement3(Block body, List<CatchClause> catchClauses, | 844 static TryStatement tryStatement3( |
| 1063 Block finallyClause) => | 845 Block body, List<CatchClause> catchClauses, Block finallyClause) => |
| 1064 new TryStatement( | 846 new TryStatement(TokenFactory.tokenFromKeyword(Keyword.TRY), body, |
| 1065 TokenFactory.tokenFromKeyword(Keyword.TRY), | 847 catchClauses, finallyClause == null |
| 1066 body, | 848 ? null |
| 1067 catchClauses, | 849 : TokenFactory.tokenFromKeyword(Keyword.FINALLY), finallyClause); |
| 1068 finallyClause == null ? null : TokenFactory.tokenFromKeyword(Keyword.F
INALLY), | |
| 1069 finallyClause); | |
| 1070 | 850 |
| 1071 static FunctionTypeAlias typeAlias(TypeName returnType, String name, | 851 static FunctionTypeAlias typeAlias(TypeName returnType, String name, |
| 1072 TypeParameterList typeParameters, FormalParameterList parameters) => | 852 TypeParameterList typeParameters, FormalParameterList parameters) => |
| 1073 new FunctionTypeAlias( | 853 new FunctionTypeAlias(null, null, |
| 1074 null, | 854 TokenFactory.tokenFromKeyword(Keyword.TYPEDEF), returnType, |
| 1075 null, | 855 identifier3(name), typeParameters, parameters, |
| 1076 TokenFactory.tokenFromKeyword(Keyword.TYPEDEF), | |
| 1077 returnType, | |
| 1078 identifier3(name), | |
| 1079 typeParameters, | |
| 1080 parameters, | |
| 1081 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 856 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1082 | 857 |
| 1083 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) { | 858 static TypeArgumentList typeArgumentList(List<TypeName> typeNames) { |
| 1084 if (typeNames == null || typeNames.length == 0) { | 859 if (typeNames == null || typeNames.length == 0) { |
| 1085 return null; | 860 return null; |
| 1086 } | 861 } |
| 1087 return new TypeArgumentList( | 862 return new TypeArgumentList(TokenFactory.tokenFromType(TokenType.LT), |
| 1088 TokenFactory.tokenFromType(TokenType.LT), | 863 typeNames, TokenFactory.tokenFromType(TokenType.GT)); |
| 1089 typeNames, | |
| 1090 TokenFactory.tokenFromType(TokenType.GT)); | |
| 1091 } | 864 } |
| 1092 | 865 |
| 1093 /** | 866 /** |
| 1094 * Create a type name whose name has been resolved to the given [element] and | 867 * Create a type name whose name has been resolved to the given [element] and |
| 1095 * whose type has been resolved to the type of the given element. | 868 * whose type has been resolved to the type of the given element. |
| 1096 * | 869 * |
| 1097 * <b>Note:</b> This method does not correctly handle class elements that have | 870 * <b>Note:</b> This method does not correctly handle class elements that have |
| 1098 * type parameters. | 871 * type parameters. |
| 1099 */ | 872 */ |
| 1100 static TypeName typeName(ClassElement element, [List<TypeName> arguments]) { | 873 static TypeName typeName(ClassElement element, [List<TypeName> arguments]) { |
| 1101 SimpleIdentifier name = identifier3(element.name); | 874 SimpleIdentifier name = identifier3(element.name); |
| 1102 name.staticElement = element; | 875 name.staticElement = element; |
| 1103 TypeName typeName = typeName3(name, arguments); | 876 TypeName typeName = typeName3(name, arguments); |
| 1104 typeName.type = element.type; | 877 typeName.type = element.type; |
| 1105 return typeName; | 878 return typeName; |
| 1106 } | 879 } |
| 1107 | 880 |
| 1108 static TypeName typeName3(Identifier name, [List<TypeName> arguments]) => | 881 static TypeName typeName3(Identifier name, [List<TypeName> arguments]) => |
| 1109 new TypeName(name, typeArgumentList(arguments)); | 882 new TypeName(name, typeArgumentList(arguments)); |
| 1110 | 883 |
| 1111 static TypeName typeName4(String name, [List<TypeName> arguments]) => | 884 static TypeName typeName4(String name, [List<TypeName> arguments]) => |
| 1112 new TypeName(identifier3(name), typeArgumentList(arguments)); | 885 new TypeName(identifier3(name), typeArgumentList(arguments)); |
| 1113 | 886 |
| 1114 static TypeParameter typeParameter(String name) => | 887 static TypeParameter typeParameter(String name) => |
| 1115 new TypeParameter(null, null, identifier3(name), null, null); | 888 new TypeParameter(null, null, identifier3(name), null, null); |
| 1116 | 889 |
| 1117 static TypeParameter typeParameter2(String name, TypeName bound) => | 890 static TypeParameter typeParameter2(String name, TypeName bound) => |
| 1118 new TypeParameter( | 891 new TypeParameter(null, null, identifier3(name), |
| 1119 null, | 892 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), bound); |
| 1120 null, | |
| 1121 identifier3(name), | |
| 1122 TokenFactory.tokenFromKeyword(Keyword.EXTENDS), | |
| 1123 bound); | |
| 1124 | 893 |
| 1125 static TypeParameterList typeParameterList([List<String> typeNames]) { | 894 static TypeParameterList typeParameterList([List<String> typeNames]) { |
| 1126 List<TypeParameter> typeParameters = null; | 895 List<TypeParameter> typeParameters = null; |
| 1127 if (typeNames != null && !typeNames.isEmpty) { | 896 if (typeNames != null && !typeNames.isEmpty) { |
| 1128 typeParameters = new List<TypeParameter>(); | 897 typeParameters = new List<TypeParameter>(); |
| 1129 for (String typeName in typeNames) { | 898 for (String typeName in typeNames) { |
| 1130 typeParameters.add(typeParameter(typeName)); | 899 typeParameters.add(typeParameter(typeName)); |
| 1131 } | 900 } |
| 1132 } | 901 } |
| 1133 return new TypeParameterList( | 902 return new TypeParameterList(TokenFactory.tokenFromType(TokenType.LT), |
| 1134 TokenFactory.tokenFromType(TokenType.LT), | 903 typeParameters, TokenFactory.tokenFromType(TokenType.GT)); |
| 1135 typeParameters, | |
| 1136 TokenFactory.tokenFromType(TokenType.GT)); | |
| 1137 } | 904 } |
| 1138 | 905 |
| 1139 static VariableDeclaration variableDeclaration(String name) => | 906 static VariableDeclaration variableDeclaration(String name) => |
| 1140 new VariableDeclaration(null, null, identifier3(name), null, null); | 907 new VariableDeclaration(null, null, identifier3(name), null, null); |
| 1141 | 908 |
| 1142 static VariableDeclaration variableDeclaration2(String name, | 909 static VariableDeclaration variableDeclaration2( |
| 1143 Expression initializer) => | 910 String name, Expression initializer) => new VariableDeclaration(null, |
| 1144 new VariableDeclaration( | 911 null, identifier3(name), TokenFactory.tokenFromType(TokenType.EQ), |
| 1145 null, | 912 initializer); |
| 1146 null, | |
| 1147 identifier3(name), | |
| 1148 TokenFactory.tokenFromType(TokenType.EQ), | |
| 1149 initializer); | |
| 1150 | 913 |
| 1151 static VariableDeclarationList variableDeclarationList(Keyword keyword, | 914 static VariableDeclarationList variableDeclarationList(Keyword keyword, |
| 1152 TypeName type, List<VariableDeclaration> variables) => | 915 TypeName type, List<VariableDeclaration> variables) => |
| 1153 new VariableDeclarationList( | 916 new VariableDeclarationList(null, null, |
| 1154 null, | 917 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), type, |
| 1155 null, | |
| 1156 keyword == null ? null : TokenFactory.tokenFromKeyword(keyword), | |
| 1157 type, | |
| 1158 variables); | 918 variables); |
| 1159 | 919 |
| 1160 static VariableDeclarationList variableDeclarationList2(Keyword keyword, | 920 static VariableDeclarationList variableDeclarationList2( |
| 1161 List<VariableDeclaration> variables) => | 921 Keyword keyword, List<VariableDeclaration> variables) => |
| 1162 variableDeclarationList(keyword, null, variables); | 922 variableDeclarationList(keyword, null, variables); |
| 1163 | 923 |
| 1164 static VariableDeclarationStatement | 924 static VariableDeclarationStatement variableDeclarationStatement( |
| 1165 variableDeclarationStatement(Keyword keyword, TypeName type, | 925 Keyword keyword, TypeName type, |
| 1166 List<VariableDeclaration> variables) => | 926 List<VariableDeclaration> variables) => new VariableDeclarationStatement( |
| 1167 new VariableDeclarationStatement( | 927 variableDeclarationList(keyword, type, variables), |
| 1168 variableDeclarationList(keyword, type, variables), | 928 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1169 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 1170 | 929 |
| 1171 static VariableDeclarationStatement | 930 static VariableDeclarationStatement variableDeclarationStatement2( |
| 1172 variableDeclarationStatement2(Keyword keyword, | 931 Keyword keyword, List<VariableDeclaration> variables) => |
| 1173 List<VariableDeclaration> variables) => | |
| 1174 variableDeclarationStatement(keyword, null, variables); | 932 variableDeclarationStatement(keyword, null, variables); |
| 1175 | 933 |
| 1176 static WhileStatement whileStatement(Expression condition, Statement body) => | 934 static WhileStatement whileStatement(Expression condition, Statement body) => |
| 1177 new WhileStatement( | 935 new WhileStatement(TokenFactory.tokenFromKeyword(Keyword.WHILE), |
| 1178 TokenFactory.tokenFromKeyword(Keyword.WHILE), | 936 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), condition, |
| 1179 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 937 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), body); |
| 1180 condition, | |
| 1181 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | |
| 1182 body); | |
| 1183 | 938 |
| 1184 static WithClause withClause(List<TypeName> types) => | 939 static WithClause withClause(List<TypeName> types) => |
| 1185 new WithClause(TokenFactory.tokenFromKeyword(Keyword.WITH), types); | 940 new WithClause(TokenFactory.tokenFromKeyword(Keyword.WITH), types); |
| 1186 | 941 |
| 1187 static YieldStatement yieldEachStatement(Expression expression) => | 942 static YieldStatement yieldEachStatement(Expression expression) => |
| 1188 new YieldStatement( | 943 new YieldStatement( |
| 1189 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), | 944 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), |
| 1190 TokenFactory.tokenFromType(TokenType.STAR), | 945 TokenFactory.tokenFromType(TokenType.STAR), expression, |
| 1191 expression, | |
| 1192 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 946 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1193 | 947 |
| 1194 static YieldStatement yieldStatement(Expression expression) => | 948 static YieldStatement yieldStatement( |
| 1195 new YieldStatement( | 949 Expression expression) => new YieldStatement( |
| 1196 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), | 950 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), null, |
| 1197 null, | 951 expression, TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1198 expression, | |
| 1199 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | |
| 1200 } | 952 } |
| OLD | NEW |