OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import 'package:analyzer/dart/ast/ast.dart'; |
| 6 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 7 import 'package:front_end/src/scanner/token.dart'; |
| 8 |
| 9 /** |
| 10 * A collection of factory methods which may be used to create concrete |
| 11 * instances of the interfaces that constitute the AST. |
| 12 * |
| 13 * Clients should not extend, implement or mix-in this class. |
| 14 */ |
| 15 abstract class AstFactory { |
| 16 /** |
| 17 * Returns a newly created list of adjacent strings. To be syntactically |
| 18 * valid, the list of [strings] must contain at least two elements. |
| 19 */ |
| 20 AdjacentStrings adjacentStrings(List<StringLiteral> strings); |
| 21 |
| 22 /** |
| 23 * Returns a newly created annotation. Both the [period] and the |
| 24 * [constructorName] can be `null` if the annotation is not referencing a |
| 25 * named constructor. The [arguments] can be `null` if the annotation is not |
| 26 * referencing a constructor. |
| 27 */ |
| 28 Annotation annotation(Token atSign, Identifier name, Token period, |
| 29 SimpleIdentifier constructorName, ArgumentList arguments); |
| 30 |
| 31 /** |
| 32 * Returns a newly created list of arguments. The list of [arguments] can |
| 33 * be `null` if there are no arguments. |
| 34 */ |
| 35 ArgumentList argumentList(Token leftParenthesis, List<Expression> arguments, |
| 36 Token rightParenthesis); |
| 37 |
| 38 /** |
| 39 * Returns a newly created as expression. |
| 40 */ |
| 41 AsExpression asExpression( |
| 42 Expression expression, Token asOperator, TypeName type); |
| 43 |
| 44 /** |
| 45 * Returns a newly created assert initializer. The [comma] and [message] |
| 46 * can be `null` if there is no message. |
| 47 */ |
| 48 AssertInitializer assertInitializer( |
| 49 Token assertKeyword, |
| 50 Token leftParenthesis, |
| 51 Expression condition, |
| 52 Token comma, |
| 53 Expression message, |
| 54 Token rightParenthesis); |
| 55 |
| 56 /** |
| 57 * Returns a newly created assert statement. The [comma] and [message] can |
| 58 * be `null` if there is no message. |
| 59 */ |
| 60 AssertStatement assertStatement( |
| 61 Token assertKeyword, |
| 62 Token leftParenthesis, |
| 63 Expression condition, |
| 64 Token comma, |
| 65 Expression message, |
| 66 Token rightParenthesis, |
| 67 Token semicolon); |
| 68 |
| 69 /** |
| 70 * Returns a newly created assignment expression. |
| 71 */ |
| 72 AssignmentExpression assignmentExpression( |
| 73 Expression leftHandSide, Token operator, Expression rightHandSide); |
| 74 |
| 75 /** |
| 76 * Returns a newly created await expression. |
| 77 */ |
| 78 AwaitExpression awaitExpression(Token awaitKeyword, Expression expression); |
| 79 |
| 80 /** |
| 81 * Returns a newly created binary expression. |
| 82 */ |
| 83 BinaryExpression binaryExpression( |
| 84 Expression leftOperand, Token operator, Expression rightOperand); |
| 85 /** |
| 86 * Returns a newly created block of code. |
| 87 */ |
| 88 Block block( |
| 89 Token leftBracket, List<Statement> statements, Token rightBracket); |
| 90 |
| 91 /** |
| 92 * Returns a block comment consisting of the given [tokens]. |
| 93 */ |
| 94 Comment blockComment(List<Token> tokens); |
| 95 |
| 96 /** |
| 97 * Returns a newly created function body consisting of a block of |
| 98 * statements. The [keyword] can be `null` if there is no keyword specified |
| 99 * for the block. The [star] can be `null` if there is no star following the |
| 100 * keyword (and must be `null` if there is no keyword). |
| 101 */ |
| 102 BlockFunctionBody blockFunctionBody(Token keyword, Token star, Block block); |
| 103 |
| 104 /** |
| 105 * Returns a newly created boolean literal. |
| 106 */ |
| 107 BooleanLiteral booleanLiteral(Token literal, bool value); |
| 108 |
| 109 /** |
| 110 * Returns a newly created break statement. The [label] can be `null` if |
| 111 * there is no label associated with the statement. |
| 112 */ |
| 113 BreakStatement breakStatement( |
| 114 Token breakKeyword, SimpleIdentifier label, Token semicolon); |
| 115 |
| 116 /** |
| 117 * Returns a newly created cascade expression. The list of |
| 118 * [cascadeSections] must contain at least one element. |
| 119 */ |
| 120 CascadeExpression cascadeExpression( |
| 121 Expression target, List<Expression> cascadeSections); |
| 122 |
| 123 /** |
| 124 * Returns a newly created catch clause. The [onKeyword] and |
| 125 * [exceptionType] can be `null` if the clause will catch all exceptions. The |
| 126 * [comma] and [stackTraceParameter] can be `null` if the stack trace |
| 127 * parameter is not defined. |
| 128 */ |
| 129 CatchClause catchClause( |
| 130 Token onKeyword, |
| 131 TypeName exceptionType, |
| 132 Token catchKeyword, |
| 133 Token leftParenthesis, |
| 134 SimpleIdentifier exceptionParameter, |
| 135 Token comma, |
| 136 SimpleIdentifier stackTraceParameter, |
| 137 Token rightParenthesis, |
| 138 Block body); |
| 139 |
| 140 /** |
| 141 * Returns a newly created class declaration. Either or both of the |
| 142 * [comment] and [metadata] can be `null` if the class does not have the |
| 143 * corresponding attribute. The [abstractKeyword] can be `null` if the class |
| 144 * is not abstract. The [typeParameters] can be `null` if the class does not |
| 145 * have any type parameters. Any or all of the [extendsClause], [withClause], |
| 146 * and [implementsClause] can be `null` if the class does not have the |
| 147 * corresponding clause. The list of [members] can be `null` if the class does |
| 148 * not have any members. |
| 149 */ |
| 150 ClassDeclaration classDeclaration( |
| 151 Comment comment, |
| 152 List<Annotation> metadata, |
| 153 Token abstractKeyword, |
| 154 Token classKeyword, |
| 155 SimpleIdentifier name, |
| 156 TypeParameterList typeParameters, |
| 157 ExtendsClause extendsClause, |
| 158 WithClause withClause, |
| 159 ImplementsClause implementsClause, |
| 160 Token leftBracket, |
| 161 List<ClassMember> members, |
| 162 Token rightBracket); |
| 163 |
| 164 /** |
| 165 * Returns a newly created class type alias. Either or both of the |
| 166 * [comment] and [metadata] can be `null` if the class type alias does not |
| 167 * have the corresponding attribute. The [typeParameters] can be `null` if the |
| 168 * class does not have any type parameters. The [abstractKeyword] can be |
| 169 * `null` if the class is not abstract. The [implementsClause] can be `null` |
| 170 * if the class does not implement any interfaces. |
| 171 */ |
| 172 ClassTypeAlias classTypeAlias( |
| 173 Comment comment, |
| 174 List<Annotation> metadata, |
| 175 Token keyword, |
| 176 SimpleIdentifier name, |
| 177 TypeParameterList typeParameters, |
| 178 Token equals, |
| 179 Token abstractKeyword, |
| 180 TypeName superclass, |
| 181 WithClause withClause, |
| 182 ImplementsClause implementsClause, |
| 183 Token semicolon); |
| 184 |
| 185 /** |
| 186 * Returns a newly created reference to a Dart element. The [newKeyword] |
| 187 * can be `null` if the reference is not to a constructor. |
| 188 */ |
| 189 CommentReference commentReference(Token newKeyword, Identifier identifier); |
| 190 |
| 191 /** |
| 192 * Returns a newly created compilation unit to have the given directives |
| 193 * and declarations. The [scriptTag] can be `null` if there is no script tag |
| 194 * in the compilation unit. The list of [directives] can be `null` if there |
| 195 * are no directives in the compilation unit. The list of [declarations] can |
| 196 * be `null` if there are no declarations in the compilation unit. |
| 197 */ |
| 198 CompilationUnit compilationUnit( |
| 199 Token beginToken, |
| 200 ScriptTag scriptTag, |
| 201 List<Directive> directives, |
| 202 List<CompilationUnitMember> declarations, |
| 203 Token endToken); |
| 204 |
| 205 /** |
| 206 * Returns a newly created conditional expression. |
| 207 */ |
| 208 ConditionalExpression conditionalExpression( |
| 209 Expression condition, |
| 210 Token question, |
| 211 Expression thenExpression, |
| 212 Token colon, |
| 213 Expression elseExpression); |
| 214 |
| 215 /** |
| 216 * Returns a newly created configuration. |
| 217 */ |
| 218 Configuration configuration( |
| 219 Token ifKeyword, |
| 220 Token leftParenthesis, |
| 221 DottedName name, |
| 222 Token equalToken, |
| 223 StringLiteral value, |
| 224 Token rightParenthesis, |
| 225 StringLiteral libraryUri); |
| 226 |
| 227 /** |
| 228 * Returns a newly created constructor declaration. The [externalKeyword] |
| 229 * can be `null` if the constructor is not external. Either or both of the |
| 230 * [comment] and [metadata] can be `null` if the constructor does not have the |
| 231 * corresponding attribute. The [constKeyword] can be `null` if the |
| 232 * constructor cannot be used to create a constant. The [factoryKeyword] can |
| 233 * be `null` if the constructor is not a factory. The [period] and [name] can |
| 234 * both be `null` if the constructor is not a named constructor. The |
| 235 * [separator] can be `null` if the constructor does not have any initializers |
| 236 * and does not redirect to a different constructor. The list of |
| 237 * [initializers] can be `null` if the constructor does not have any |
| 238 * initializers. The [redirectedConstructor] can be `null` if the constructor |
| 239 * does not redirect to a different constructor. The [body] can be `null` if |
| 240 * the constructor does not have a body. |
| 241 */ |
| 242 ConstructorDeclaration constructorDeclaration( |
| 243 Comment comment, |
| 244 List<Annotation> metadata, |
| 245 Token externalKeyword, |
| 246 Token constKeyword, |
| 247 Token factoryKeyword, |
| 248 Identifier returnType, |
| 249 Token period, |
| 250 SimpleIdentifier name, |
| 251 FormalParameterList parameters, |
| 252 Token separator, |
| 253 List<ConstructorInitializer> initializers, |
| 254 ConstructorName redirectedConstructor, |
| 255 FunctionBody body); |
| 256 |
| 257 /** |
| 258 * Returns a newly created field initializer to initialize the field with |
| 259 * the given name to the value of the given expression. The [thisKeyword] and |
| 260 * [period] can be `null` if the 'this' keyword was not specified. |
| 261 */ |
| 262 ConstructorFieldInitializer constructorFieldInitializer( |
| 263 Token thisKeyword, |
| 264 Token period, |
| 265 SimpleIdentifier fieldName, |
| 266 Token equals, |
| 267 Expression expression); |
| 268 |
| 269 /** |
| 270 * Returns a newly created constructor name. The [period] and [name] can be |
| 271 * `null` if the constructor being named is the unnamed constructor. |
| 272 */ |
| 273 ConstructorName constructorName( |
| 274 TypeName type, Token period, SimpleIdentifier name); |
| 275 |
| 276 /** |
| 277 * Returns a newly created continue statement. The [label] can be `null` if |
| 278 * there is no label associated with the statement. |
| 279 */ |
| 280 ContinueStatement continueStatement( |
| 281 Token continueKeyword, SimpleIdentifier label, Token semicolon); |
| 282 |
| 283 /** |
| 284 * Returns a newly created formal parameter. Either or both of the |
| 285 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 286 * corresponding attribute. The [keyword] can be `null` if a type name is |
| 287 * given. The [type] must be `null` if the keyword is 'var'. |
| 288 */ |
| 289 DeclaredIdentifier declaredIdentifier( |
| 290 Comment comment, |
| 291 List<Annotation> metadata, |
| 292 Token keyword, |
| 293 TypeName type, |
| 294 SimpleIdentifier identifier); |
| 295 |
| 296 /** |
| 297 * Returns a newly created default formal parameter. The [separator] and |
| 298 * [defaultValue] can be `null` if there is no default value. |
| 299 */ |
| 300 DefaultFormalParameter defaultFormalParameter(NormalFormalParameter parameter, |
| 301 ParameterKind kind, Token separator, Expression defaultValue); |
| 302 |
| 303 /** |
| 304 * Returns a documentation comment consisting of the given [tokens] and having |
| 305 * the given [references] (if supplied) embedded within it. |
| 306 */ |
| 307 Comment documentationComment( |
| 308 List<Token> tokens, [List<CommentReference> references]); |
| 309 |
| 310 /** |
| 311 * Returns a newly created do loop. |
| 312 */ |
| 313 DoStatement doStatement( |
| 314 Token doKeyword, |
| 315 Statement body, |
| 316 Token whileKeyword, |
| 317 Token leftParenthesis, |
| 318 Expression condition, |
| 319 Token rightParenthesis, |
| 320 Token semicolon); |
| 321 |
| 322 /** |
| 323 * Returns a newly created dotted name. |
| 324 */ |
| 325 DottedName dottedName(List<SimpleIdentifier> components); |
| 326 |
| 327 /** |
| 328 * Returns a newly created floating point literal. |
| 329 */ |
| 330 DoubleLiteral doubleLiteral(Token literal, double value); |
| 331 |
| 332 /** |
| 333 * Returns a newly created function body. |
| 334 */ |
| 335 EmptyFunctionBody emptyFunctionBody(Token semicolon); |
| 336 |
| 337 /** |
| 338 * Returns a newly created empty statement. |
| 339 */ |
| 340 EmptyStatement emptyStatement(Token semicolon); |
| 341 |
| 342 /** |
| 343 * Returns an end-of-line comment consisting of the given [tokens]. |
| 344 */ |
| 345 Comment endOfLineComment(List<Token> tokens); |
| 346 |
| 347 /** |
| 348 * Returns a newly created enum constant declaration. Either or both of the |
| 349 * [comment] and [metadata] can be `null` if the constant does not have the |
| 350 * corresponding attribute. (Technically, enum constants cannot have metadata, |
| 351 * but we allow it for consistency.) |
| 352 */ |
| 353 EnumConstantDeclaration enumConstantDeclaration( |
| 354 Comment comment, List<Annotation> metadata, SimpleIdentifier name); |
| 355 |
| 356 /** |
| 357 * Returns a newly created enumeration declaration. Either or both of the |
| 358 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 359 * corresponding attribute. The list of [constants] must contain at least one |
| 360 * value. |
| 361 */ |
| 362 EnumDeclaration enumDeclaration( |
| 363 Comment comment, |
| 364 List<Annotation> metadata, |
| 365 Token enumKeyword, |
| 366 SimpleIdentifier name, |
| 367 Token leftBracket, |
| 368 List<EnumConstantDeclaration> constants, |
| 369 Token rightBracket); |
| 370 |
| 371 /** |
| 372 * Returns a newly created export directive. Either or both of the |
| 373 * [comment] and [metadata] can be `null` if the directive does not have the |
| 374 * corresponding attribute. The list of [combinators] can be `null` if there |
| 375 * are no combinators. |
| 376 */ |
| 377 ExportDirective exportDirective( |
| 378 Comment comment, |
| 379 List<Annotation> metadata, |
| 380 Token keyword, |
| 381 StringLiteral libraryUri, |
| 382 List<Configuration> configurations, |
| 383 List<Combinator> combinators, |
| 384 Token semicolon); |
| 385 /** |
| 386 * Returns a newly created function body consisting of a block of |
| 387 * statements. The [keyword] can be `null` if the function body is not an |
| 388 * async function body. |
| 389 */ |
| 390 ExpressionFunctionBody expressionFunctionBody(Token keyword, |
| 391 Token functionDefinition, Expression expression, Token semicolon); |
| 392 |
| 393 /** |
| 394 * Returns a newly created expression statement. |
| 395 */ |
| 396 ExpressionStatement expressionStatement( |
| 397 Expression expression, Token semicolon); |
| 398 |
| 399 /** |
| 400 * Returns a newly created extends clause. |
| 401 */ |
| 402 ExtendsClause extendsClause(Token extendsKeyword, TypeName superclass); |
| 403 |
| 404 /** |
| 405 * Returns a newly created field declaration. Either or both of the |
| 406 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 407 * corresponding attribute. The [staticKeyword] can be `null` if the field is |
| 408 * not a static field. |
| 409 */ |
| 410 FieldDeclaration fieldDeclaration(Comment comment, List<Annotation> metadata, |
| 411 Token staticKeyword, VariableDeclarationList fieldList, Token semicolon); |
| 412 |
| 413 /** |
| 414 * Returns a newly created formal parameter. Either or both of the |
| 415 * [comment] and [metadata] can be `null` if the parameter does not have the |
| 416 * corresponding attribute. The [keyword] can be `null` if there is a type. |
| 417 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and |
| 418 * [period] can be `null` if the keyword 'this' was not provided. The |
| 419 * [parameters] can be `null` if this is not a function-typed field formal |
| 420 * parameter. |
| 421 */ |
| 422 FieldFormalParameter fieldFormalParameter( |
| 423 Comment comment, |
| 424 List<Annotation> metadata, |
| 425 Token keyword, |
| 426 TypeName type, |
| 427 Token thisKeyword, |
| 428 Token period, |
| 429 SimpleIdentifier identifier, |
| 430 TypeParameterList typeParameters, |
| 431 FormalParameterList parameters); |
| 432 |
| 433 /** |
| 434 * Returns a newly created for-each statement whose loop control variable |
| 435 * is declared internally (in the for-loop part). The [awaitKeyword] can be |
| 436 * `null` if this is not an asynchronous for loop. |
| 437 */ |
| 438 ForEachStatement forEachStatementWithDeclaration( |
| 439 Token awaitKeyword, |
| 440 Token forKeyword, |
| 441 Token leftParenthesis, |
| 442 DeclaredIdentifier loopVariable, |
| 443 Token inKeyword, |
| 444 Expression iterator, |
| 445 Token rightParenthesis, |
| 446 Statement body); |
| 447 |
| 448 /** |
| 449 * Returns a newly created for-each statement whose loop control variable |
| 450 * is declared outside the for loop. The [awaitKeyword] can be `null` if this |
| 451 * is not an asynchronous for loop. |
| 452 */ |
| 453 ForEachStatement forEachStatementWithReference( |
| 454 Token awaitKeyword, |
| 455 Token forKeyword, |
| 456 Token leftParenthesis, |
| 457 SimpleIdentifier identifier, |
| 458 Token inKeyword, |
| 459 Expression iterator, |
| 460 Token rightParenthesis, |
| 461 Statement body); |
| 462 |
| 463 /** |
| 464 * Returns a newly created parameter list. The list of [parameters] can be |
| 465 * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter] |
| 466 * can be `null` if there are no optional parameters. |
| 467 */ |
| 468 FormalParameterList formalParameterList( |
| 469 Token leftParenthesis, |
| 470 List<FormalParameter> parameters, |
| 471 Token leftDelimiter, |
| 472 Token rightDelimiter, |
| 473 Token rightParenthesis); |
| 474 |
| 475 /** |
| 476 * Returns a newly created for statement. Either the [variableList] or the |
| 477 * [initialization] must be `null`. Either the [condition] and the list of |
| 478 * [updaters] can be `null` if the loop does not have the corresponding |
| 479 * attribute. |
| 480 */ |
| 481 ForStatement forStatement( |
| 482 Token forKeyword, |
| 483 Token leftParenthesis, |
| 484 VariableDeclarationList variableList, |
| 485 Expression initialization, |
| 486 Token leftSeparator, |
| 487 Expression condition, |
| 488 Token rightSeparator, |
| 489 List<Expression> updaters, |
| 490 Token rightParenthesis, |
| 491 Statement body); |
| 492 |
| 493 /** |
| 494 * Returns a newly created function declaration. Either or both of the |
| 495 * [comment] and [metadata] can be `null` if the function does not have the |
| 496 * corresponding attribute. The [externalKeyword] can be `null` if the |
| 497 * function is not an external function. The [returnType] can be `null` if no |
| 498 * return type was specified. The [propertyKeyword] can be `null` if the |
| 499 * function is neither a getter or a setter. |
| 500 */ |
| 501 FunctionDeclaration functionDeclaration( |
| 502 Comment comment, |
| 503 List<Annotation> metadata, |
| 504 Token externalKeyword, |
| 505 TypeName returnType, |
| 506 Token propertyKeyword, |
| 507 SimpleIdentifier name, |
| 508 FunctionExpression functionExpression); |
| 509 |
| 510 /** |
| 511 * Returns a newly created function declaration statement. |
| 512 */ |
| 513 FunctionDeclarationStatement functionDeclarationStatement( |
| 514 FunctionDeclaration functionDeclaration); |
| 515 |
| 516 /** |
| 517 * Returns a newly created function declaration. |
| 518 */ |
| 519 FunctionExpression functionExpression(TypeParameterList typeParameters, |
| 520 FormalParameterList parameters, FunctionBody body); |
| 521 |
| 522 /** |
| 523 * Returns a newly created function expression invocation. |
| 524 */ |
| 525 FunctionExpressionInvocation functionExpressionInvocation(Expression function, |
| 526 TypeArgumentList typeArguments, ArgumentList argumentList); |
| 527 |
| 528 /** |
| 529 * Returns a newly created function type alias. Either or both of the |
| 530 * [comment] and [metadata] can be `null` if the function does not have the |
| 531 * corresponding attribute. The [returnType] can be `null` if no return type |
| 532 * was specified. The [typeParameters] can be `null` if the function has no |
| 533 * type parameters. |
| 534 */ |
| 535 FunctionTypeAlias functionTypeAlias( |
| 536 Comment comment, |
| 537 List<Annotation> metadata, |
| 538 Token keyword, |
| 539 TypeName returnType, |
| 540 SimpleIdentifier name, |
| 541 TypeParameterList typeParameters, |
| 542 FormalParameterList parameters, |
| 543 Token semicolon); |
| 544 |
| 545 /** |
| 546 * Returns a newly created formal parameter. Either or both of the |
| 547 * [comment] and [metadata] can be `null` if the parameter does not have the |
| 548 * corresponding attribute. The [returnType] can be `null` if no return type |
| 549 * was specified. |
| 550 */ |
| 551 FunctionTypedFormalParameter functionTypedFormalParameter( |
| 552 Comment comment, |
| 553 List<Annotation> metadata, |
| 554 TypeName returnType, |
| 555 SimpleIdentifier identifier, |
| 556 TypeParameterList typeParameters, |
| 557 FormalParameterList parameters, |
| 558 {Token question: null}); |
| 559 |
| 560 /** |
| 561 * Returns a newly created import show combinator. |
| 562 */ |
| 563 HideCombinator hideCombinator( |
| 564 Token keyword, List<SimpleIdentifier> hiddenNames); |
| 565 |
| 566 /** |
| 567 * Returns a newly created if statement. The [elseKeyword] and |
| 568 * [elseStatement] can be `null` if there is no else clause. |
| 569 */ |
| 570 IfStatement ifStatement( |
| 571 Token ifKeyword, |
| 572 Token leftParenthesis, |
| 573 Expression condition, |
| 574 Token rightParenthesis, |
| 575 Statement thenStatement, |
| 576 Token elseKeyword, |
| 577 Statement elseStatement); |
| 578 |
| 579 /** |
| 580 * Returns a newly created implements clause. |
| 581 */ |
| 582 ImplementsClause implementsClause( |
| 583 Token implementsKeyword, List<TypeName> interfaces); |
| 584 |
| 585 /** |
| 586 * Returns a newly created import directive. Either or both of the |
| 587 * [comment] and [metadata] can be `null` if the function does not have the |
| 588 * corresponding attribute. The [deferredKeyword] can be `null` if the import |
| 589 * is not deferred. The [asKeyword] and [prefix] can be `null` if the import |
| 590 * does not specify a prefix. The list of [combinators] can be `null` if there |
| 591 * are no combinators. |
| 592 */ |
| 593 ImportDirective importDirective( |
| 594 Comment comment, |
| 595 List<Annotation> metadata, |
| 596 Token keyword, |
| 597 StringLiteral libraryUri, |
| 598 List<Configuration> configurations, |
| 599 Token deferredKeyword, |
| 600 Token asKeyword, |
| 601 SimpleIdentifier prefix, |
| 602 List<Combinator> combinators, |
| 603 Token semicolon); |
| 604 |
| 605 /** |
| 606 * Returns a newly created index expression. |
| 607 */ |
| 608 IndexExpression indexExpressionForCascade( |
| 609 Token period, Token leftBracket, Expression index, Token rightBracket); |
| 610 |
| 611 /** |
| 612 * Returns a newly created index expression. |
| 613 */ |
| 614 IndexExpression indexExpressionForTarget(Expression target, Token leftBracket, |
| 615 Expression index, Token rightBracket); |
| 616 |
| 617 /** |
| 618 * Returns a newly created instance creation expression. |
| 619 */ |
| 620 InstanceCreationExpression instanceCreationExpression(Token keyword, |
| 621 ConstructorName constructorName, ArgumentList argumentList); |
| 622 |
| 623 /** |
| 624 * Returns a newly created integer literal. |
| 625 */ |
| 626 IntegerLiteral integerLiteral(Token literal, int value); |
| 627 |
| 628 /** |
| 629 * Returns a newly created interpolation expression. |
| 630 */ |
| 631 InterpolationExpression interpolationExpression( |
| 632 Token leftBracket, Expression expression, Token rightBracket); |
| 633 |
| 634 /** |
| 635 * Returns a newly created string of characters that are part of a string |
| 636 * interpolation. |
| 637 */ |
| 638 InterpolationString interpolationString(Token contents, String value); |
| 639 |
| 640 /** |
| 641 * Returns a newly created is expression. The [notOperator] can be `null` |
| 642 * if the sense of the test is not negated. |
| 643 */ |
| 644 IsExpression isExpression(Expression expression, Token isOperator, |
| 645 Token notOperator, TypeName type); |
| 646 |
| 647 /** |
| 648 * Returns a newly created label. |
| 649 */ |
| 650 Label label(SimpleIdentifier label, Token colon); |
| 651 |
| 652 /** |
| 653 * Returns a newly created labeled statement. |
| 654 */ |
| 655 LabeledStatement labeledStatement(List<Label> labels, Statement statement); |
| 656 |
| 657 /** |
| 658 * Returns a newly created library directive. Either or both of the |
| 659 * [comment] and [metadata] can be `null` if the directive does not have the |
| 660 * corresponding attribute. |
| 661 */ |
| 662 LibraryDirective libraryDirective(Comment comment, List<Annotation> metadata, |
| 663 Token libraryKeyword, LibraryIdentifier name, Token semicolon); |
| 664 |
| 665 /** |
| 666 * Returns a newly created prefixed identifier. |
| 667 */ |
| 668 LibraryIdentifier libraryIdentifier(List<SimpleIdentifier> components); |
| 669 |
| 670 /** |
| 671 * Returns a newly created list literal. The [constKeyword] can be `null` |
| 672 * if the literal is not a constant. The [typeArguments] can be `null` if no |
| 673 * type arguments were declared. The list of [elements] can be `null` if the |
| 674 * list is empty. |
| 675 */ |
| 676 ListLiteral listLiteral(Token constKeyword, TypeArgumentList typeArguments, |
| 677 Token leftBracket, List<Expression> elements, Token rightBracket); |
| 678 |
| 679 /** |
| 680 * Returns a newly created map literal. The [constKeyword] can be `null` if |
| 681 * the literal is not a constant. The [typeArguments] can be `null` if no type |
| 682 * arguments were declared. The [entries] can be `null` if the map is empty. |
| 683 */ |
| 684 MapLiteral mapLiteral(Token constKeyword, TypeArgumentList typeArguments, |
| 685 Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket); |
| 686 |
| 687 /** |
| 688 * Returns a newly created map literal entry. |
| 689 */ |
| 690 MapLiteralEntry mapLiteralEntry( |
| 691 Expression key, Token separator, Expression value); |
| 692 |
| 693 /** |
| 694 * Returns a newly created method declaration. Either or both of the |
| 695 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 696 * corresponding attribute. The [externalKeyword] can be `null` if the method |
| 697 * is not external. The [modifierKeyword] can be `null` if the method is |
| 698 * neither abstract nor static. The [returnType] can be `null` if no return |
| 699 * type was specified. The [propertyKeyword] can be `null` if the method is |
| 700 * neither a getter or a setter. The [operatorKeyword] can be `null` if the |
| 701 * method does not implement an operator. The [parameters] must be `null` if |
| 702 * this method declares a getter. |
| 703 */ |
| 704 MethodDeclaration methodDeclaration( |
| 705 Comment comment, |
| 706 List<Annotation> metadata, |
| 707 Token externalKeyword, |
| 708 Token modifierKeyword, |
| 709 TypeName returnType, |
| 710 Token propertyKeyword, |
| 711 Token operatorKeyword, |
| 712 SimpleIdentifier name, |
| 713 TypeParameterList typeParameters, |
| 714 FormalParameterList parameters, |
| 715 FunctionBody body); |
| 716 |
| 717 /** |
| 718 * Returns a newly created method invocation. The [target] and [operator] |
| 719 * can be `null` if there is no target. |
| 720 */ |
| 721 MethodInvocation methodInvocation( |
| 722 Expression target, |
| 723 Token operator, |
| 724 SimpleIdentifier methodName, |
| 725 TypeArgumentList typeArguments, |
| 726 ArgumentList argumentList); |
| 727 |
| 728 /** |
| 729 * Returns a newly created named expression.. |
| 730 */ |
| 731 NamedExpression namedExpression(Label name, Expression expression); |
| 732 |
| 733 /** |
| 734 * Returns a newly created native clause. |
| 735 */ |
| 736 NativeClause nativeClause(Token nativeKeyword, StringLiteral name); |
| 737 |
| 738 /** |
| 739 * Returns a newly created function body consisting of the 'native' token, |
| 740 * a string literal, and a semicolon. |
| 741 */ |
| 742 NativeFunctionBody nativeFunctionBody( |
| 743 Token nativeKeyword, StringLiteral stringLiteral, Token semicolon); |
| 744 |
| 745 /** |
| 746 * Returns a newly created list of nodes such that all of the nodes that |
| 747 * are added to the list will have their parent set to the given [owner]. The |
| 748 * list will initially be populated with the given [elements]. |
| 749 */ |
| 750 NodeList/*<E>*/ nodeList/*<E extends AstNode>*/(AstNode owner, |
| 751 [List/*<E>*/ elements]); |
| 752 |
| 753 /** |
| 754 * Returns a newly created null literal. |
| 755 */ |
| 756 NullLiteral nullLiteral(Token literal); |
| 757 |
| 758 /** |
| 759 * Returns a newly created parenthesized expression. |
| 760 */ |
| 761 ParenthesizedExpression parenthesizedExpression( |
| 762 Token leftParenthesis, Expression expression, Token rightParenthesis); |
| 763 |
| 764 /** |
| 765 * Returns a newly created part directive. Either or both of the [comment] |
| 766 * and [metadata] can be `null` if the directive does not have the |
| 767 * corresponding attribute. |
| 768 */ |
| 769 PartDirective partDirective(Comment comment, List<Annotation> metadata, |
| 770 Token partKeyword, StringLiteral partUri, Token semicolon); |
| 771 |
| 772 /** |
| 773 * Returns a newly created part-of directive. Either or both of the |
| 774 * [comment] and [metadata] can be `null` if the directive does not have the |
| 775 * corresponding attribute. |
| 776 */ |
| 777 PartOfDirective partOfDirective( |
| 778 Comment comment, |
| 779 List<Annotation> metadata, |
| 780 Token partKeyword, |
| 781 Token ofKeyword, |
| 782 LibraryIdentifier libraryName, |
| 783 Token semicolon); |
| 784 |
| 785 /** |
| 786 * Returns a newly created postfix expression. |
| 787 */ |
| 788 PostfixExpression postfixExpression(Expression operand, Token operator); |
| 789 |
| 790 /** |
| 791 * Returns a newly created prefixed identifier. |
| 792 */ |
| 793 PrefixedIdentifier prefixedIdentifier( |
| 794 SimpleIdentifier prefix, Token period, SimpleIdentifier identifier); |
| 795 |
| 796 /** |
| 797 * Returns a newly created prefix expression. |
| 798 */ |
| 799 PrefixExpression prefixExpression(Token operator, Expression operand); |
| 800 |
| 801 /** |
| 802 * Returns a newly created property access expression. |
| 803 */ |
| 804 PropertyAccess propertyAccess( |
| 805 Expression target, Token operator, SimpleIdentifier propertyName); |
| 806 |
| 807 /** |
| 808 * Returns a newly created redirecting invocation to invoke the constructor |
| 809 * with the given name with the given arguments. The [constructorName] can be |
| 810 * `null` if the constructor being invoked is the unnamed constructor. |
| 811 */ |
| 812 RedirectingConstructorInvocation redirectingConstructorInvocation( |
| 813 Token thisKeyword, |
| 814 Token period, |
| 815 SimpleIdentifier constructorName, |
| 816 ArgumentList argumentList); |
| 817 |
| 818 /** |
| 819 * Returns a newly created rethrow expression. |
| 820 */ |
| 821 RethrowExpression rethrowExpression(Token rethrowKeyword); |
| 822 |
| 823 /** |
| 824 * Returns a newly created return statement. The [expression] can be `null` |
| 825 * if no explicit value was provided. |
| 826 */ |
| 827 ReturnStatement returnStatement( |
| 828 Token returnKeyword, Expression expression, Token semicolon); |
| 829 |
| 830 /** |
| 831 * Returns a newly created script tag. |
| 832 */ |
| 833 ScriptTag scriptTag(Token scriptTag); |
| 834 |
| 835 /** |
| 836 * Returns a newly created import show combinator. |
| 837 */ |
| 838 ShowCombinator showCombinator( |
| 839 Token keyword, List<SimpleIdentifier> shownNames); |
| 840 |
| 841 /** |
| 842 * Returns a newly created formal parameter. Either or both of the |
| 843 * [comment] and [metadata] can be `null` if the parameter does not have the |
| 844 * corresponding attribute. The [keyword] can be `null` if a type was |
| 845 * specified. The [type] must be `null` if the keyword is 'var'. |
| 846 */ |
| 847 SimpleFormalParameter simpleFormalParameter( |
| 848 Comment comment, |
| 849 List<Annotation> metadata, |
| 850 Token keyword, |
| 851 TypeName type, |
| 852 SimpleIdentifier identifier); |
| 853 |
| 854 /** |
| 855 * Returns a newly created identifier. |
| 856 */ |
| 857 SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false}); |
| 858 |
| 859 /** |
| 860 * Returns a newly created simple string literal. |
| 861 */ |
| 862 SimpleStringLiteral simpleStringLiteral(Token literal, String value); |
| 863 |
| 864 /** |
| 865 * Returns a newly created string interpolation expression. |
| 866 */ |
| 867 StringInterpolation stringInterpolation(List<InterpolationElement> elements); |
| 868 |
| 869 /** |
| 870 * Returns a newly created super invocation to invoke the inherited |
| 871 * constructor with the given name with the given arguments. The [period] and |
| 872 * [constructorName] can be `null` if the constructor being invoked is the |
| 873 * unnamed constructor. |
| 874 */ |
| 875 SuperConstructorInvocation superConstructorInvocation( |
| 876 Token superKeyword, |
| 877 Token period, |
| 878 SimpleIdentifier constructorName, |
| 879 ArgumentList argumentList); |
| 880 |
| 881 /** |
| 882 * Returns a newly created super expression. |
| 883 */ |
| 884 SuperExpression superExpression(Token superKeyword); |
| 885 |
| 886 /** |
| 887 * Returns a newly created switch case. The list of [labels] can be `null` |
| 888 * if there are no labels. |
| 889 */ |
| 890 SwitchCase switchCase(List<Label> labels, Token keyword, |
| 891 Expression expression, Token colon, List<Statement> statements); |
| 892 |
| 893 /** |
| 894 * Returns a newly created switch default. The list of [labels] can be |
| 895 * `null` if there are no labels. |
| 896 */ |
| 897 SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon, |
| 898 List<Statement> statements); |
| 899 /** |
| 900 * Returns a newly created switch statement. The list of [members] can be |
| 901 * `null` if there are no switch members. |
| 902 */ |
| 903 SwitchStatement switchStatement( |
| 904 Token switchKeyword, |
| 905 Token leftParenthesis, |
| 906 Expression expression, |
| 907 Token rightParenthesis, |
| 908 Token leftBracket, |
| 909 List<SwitchMember> members, |
| 910 Token rightBracket); |
| 911 |
| 912 /** |
| 913 * Returns a newly created symbol literal. |
| 914 */ |
| 915 SymbolLiteral symbolLiteral(Token poundSign, List<Token> components); |
| 916 |
| 917 /** |
| 918 * Returns a newly created this expression. |
| 919 */ |
| 920 ThisExpression thisExpression(Token thisKeyword); |
| 921 |
| 922 /** |
| 923 * Returns a newly created throw expression. |
| 924 */ |
| 925 ThrowExpression throwExpression(Token throwKeyword, Expression expression); |
| 926 |
| 927 /** |
| 928 * Returns a newly created top-level variable declaration. Either or both |
| 929 * of the [comment] and [metadata] can be `null` if the variable does not have |
| 930 * the corresponding attribute. |
| 931 */ |
| 932 TopLevelVariableDeclaration topLevelVariableDeclaration( |
| 933 Comment comment, |
| 934 List<Annotation> metadata, |
| 935 VariableDeclarationList variableList, |
| 936 Token semicolon); |
| 937 |
| 938 /** |
| 939 * Returns a newly created try statement. The list of [catchClauses] can be |
| 940 * `null` if there are no catch clauses. The [finallyKeyword] and |
| 941 * [finallyBlock] can be `null` if there is no finally clause. |
| 942 */ |
| 943 TryStatement tryStatement(Token tryKeyword, Block body, |
| 944 List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock); |
| 945 |
| 946 /** |
| 947 * Returns a newly created list of type arguments. |
| 948 */ |
| 949 TypeArgumentList typeArgumentList( |
| 950 Token leftBracket, List<TypeName> arguments, Token rightBracket); |
| 951 |
| 952 /** |
| 953 * Returns a newly created type name. The [typeArguments] can be `null` if |
| 954 * there are no type arguments. |
| 955 */ |
| 956 TypeName typeName(Identifier name, TypeArgumentList typeArguments, |
| 957 {Token question: null}); |
| 958 |
| 959 /** |
| 960 * Returns a newly created type parameter. Either or both of the [comment] |
| 961 * and [metadata] can be `null` if the parameter does not have the |
| 962 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if |
| 963 * the parameter does not have an upper bound. |
| 964 */ |
| 965 TypeParameter typeParameter(Comment comment, List<Annotation> metadata, |
| 966 SimpleIdentifier name, Token extendsKeyword, TypeName bound); |
| 967 |
| 968 /** |
| 969 * Returns a newly created list of type parameters. |
| 970 */ |
| 971 TypeParameterList typeParameterList(Token leftBracket, |
| 972 List<TypeParameter> typeParameters, Token rightBracket); |
| 973 |
| 974 /** |
| 975 * Returns a newly created variable declaration. The [equals] and |
| 976 * [initializer] can be `null` if there is no initializer. |
| 977 */ |
| 978 VariableDeclaration variableDeclaration( |
| 979 SimpleIdentifier name, Token equals, Expression initializer); |
| 980 |
| 981 /** |
| 982 * Returns a newly created variable declaration list. Either or both of the |
| 983 * [comment] and [metadata] can be `null` if the variable list does not have |
| 984 * the corresponding attribute. The [keyword] can be `null` if a type was |
| 985 * specified. The [type] must be `null` if the keyword is 'var'. |
| 986 */ |
| 987 VariableDeclarationList variableDeclarationList( |
| 988 Comment comment, |
| 989 List<Annotation> metadata, |
| 990 Token keyword, |
| 991 TypeName type, |
| 992 List<VariableDeclaration> variables); |
| 993 |
| 994 /** |
| 995 * Returns a newly created variable declaration statement. |
| 996 */ |
| 997 VariableDeclarationStatement variableDeclarationStatement( |
| 998 VariableDeclarationList variableList, Token semicolon); |
| 999 |
| 1000 /** |
| 1001 * Returns a newly created while statement. |
| 1002 */ |
| 1003 WhileStatement whileStatement(Token whileKeyword, Token leftParenthesis, |
| 1004 Expression condition, Token rightParenthesis, Statement body); |
| 1005 |
| 1006 /** |
| 1007 * Returns a newly created with clause. |
| 1008 */ |
| 1009 WithClause withClause(Token withKeyword, List<TypeName> mixinTypes); |
| 1010 |
| 1011 /** |
| 1012 * Returns a newly created yield expression. The [star] can be `null` if no |
| 1013 * star was provided. |
| 1014 */ |
| 1015 YieldStatement yieldStatement( |
| 1016 Token yieldKeyword, Token star, Expression expression, Token semicolon); |
| 1017 } |
OLD | NEW |