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