| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library analyzer.dart.ast.ast; |
| 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart' show AuxiliaryElements; |
| 11 import 'package:analyzer/src/generated/java_core.dart'; |
| 12 import 'package:analyzer/src/generated/java_engine.dart'; |
| 13 import 'package:analyzer/src/generated/scanner.dart'; |
| 14 import 'package:analyzer/src/generated/source.dart' show LineInfo, Source; |
| 15 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 16 |
| 17 /** |
| 18 * Two or more string literals that are implicitly concatenated because of being |
| 19 * adjacent (separated only by whitespace). |
| 20 * |
| 21 * While the grammar only allows adjacent strings when all of the strings are of |
| 22 * the same kind (single line or multi-line), this class doesn't enforce that |
| 23 * restriction. |
| 24 * |
| 25 * > adjacentStrings ::= |
| 26 * > [StringLiteral] [StringLiteral]+ |
| 27 * |
| 28 * Clients may not extend, implement or mix-in this class. |
| 29 */ |
| 30 abstract class AdjacentStrings extends StringLiteral { |
| 31 /** |
| 32 * Initialize a newly created list of adjacent strings. To be syntactically |
| 33 * valid, the list of [strings] must contain at least two elements. |
| 34 */ |
| 35 factory AdjacentStrings(List<StringLiteral> strings) = AdjacentStringsImpl; |
| 36 |
| 37 /** |
| 38 * Return the strings that are implicitly concatenated. |
| 39 */ |
| 40 NodeList<StringLiteral> get strings; |
| 41 } |
| 42 |
| 43 /** |
| 44 * An AST node that can be annotated with both a documentation comment and a |
| 45 * list of annotations. |
| 46 * |
| 47 * Clients may not extend, implement or mix-in this class. |
| 48 */ |
| 49 abstract class AnnotatedNode extends AstNode { |
| 50 /** |
| 51 * Return the documentation comment associated with this node, or `null` if |
| 52 * this node does not have a documentation comment associated with it. |
| 53 */ |
| 54 Comment get documentationComment; |
| 55 |
| 56 /** |
| 57 * Set the documentation comment associated with this node to the given |
| 58 * [comment]. |
| 59 */ |
| 60 void set documentationComment(Comment comment); |
| 61 |
| 62 /** |
| 63 * Return the first token following the comment and metadata. |
| 64 */ |
| 65 Token get firstTokenAfterCommentAndMetadata; |
| 66 |
| 67 /** |
| 68 * Return the annotations associated with this node. |
| 69 */ |
| 70 NodeList<Annotation> get metadata; |
| 71 |
| 72 /** |
| 73 * Return a list containing the comment and annotations associated with this |
| 74 * node, sorted in lexical order. |
| 75 */ |
| 76 List<AstNode> get sortedCommentAndAnnotations; |
| 77 } |
| 78 |
| 79 /** |
| 80 * An annotation that can be associated with an AST node. |
| 81 * |
| 82 * > metadata ::= |
| 83 * > annotation* |
| 84 * > |
| 85 * > annotation ::= |
| 86 * > '@' [Identifier] ('.' [SimpleIdentifier])? [ArgumentList]? |
| 87 * |
| 88 * Clients may not extend, implement or mix-in this class. |
| 89 */ |
| 90 abstract class Annotation extends AstNode { |
| 91 /** |
| 92 * Initialize a newly created annotation. Both the [period] and the |
| 93 * [constructorName] can be `null` if the annotation is not referencing a |
| 94 * named constructor. The [arguments] can be `null` if the annotation is not |
| 95 * referencing a constructor. |
| 96 */ |
| 97 factory Annotation( |
| 98 Token atSign, |
| 99 Identifier name, |
| 100 Token period, |
| 101 SimpleIdentifier constructorName, |
| 102 ArgumentList arguments) = AnnotationImpl; |
| 103 |
| 104 /** |
| 105 * Return the arguments to the constructor being invoked, or `null` if this |
| 106 * annotation is not the invocation of a constructor. |
| 107 */ |
| 108 ArgumentList get arguments; |
| 109 |
| 110 /** |
| 111 * Set the arguments to the constructor being invoked to the given [arguments]
. |
| 112 */ |
| 113 void set arguments(ArgumentList arguments); |
| 114 |
| 115 /** |
| 116 * Return the at sign that introduced the annotation. |
| 117 */ |
| 118 Token get atSign; |
| 119 |
| 120 /** |
| 121 * Set the at sign that introduced the annotation to the given [token]. |
| 122 */ |
| 123 void set atSign(Token token); |
| 124 |
| 125 /** |
| 126 * Return the name of the constructor being invoked, or `null` if this |
| 127 * annotation is not the invocation of a named constructor. |
| 128 */ |
| 129 SimpleIdentifier get constructorName; |
| 130 |
| 131 /** |
| 132 * Set the name of the constructor being invoked to the given [name]. |
| 133 */ |
| 134 void set constructorName(SimpleIdentifier name); |
| 135 |
| 136 /** |
| 137 * Return the element associated with this annotation, or `null` if the AST |
| 138 * structure has not been resolved or if this annotation could not be |
| 139 * resolved. |
| 140 */ |
| 141 Element get element; |
| 142 |
| 143 /** |
| 144 * Set the element associated with this annotation to the given [element]. |
| 145 */ |
| 146 void set element(Element element); |
| 147 |
| 148 /** |
| 149 * Return the element annotation representing this annotation in the element m
odel. |
| 150 */ |
| 151 ElementAnnotation get elementAnnotation; |
| 152 |
| 153 /** |
| 154 * Set the element annotation representing this annotation in the element |
| 155 * model to the given [annotation]. |
| 156 */ |
| 157 void set elementAnnotation(ElementAnnotation annotation); |
| 158 |
| 159 /** |
| 160 * Return the name of the class defining the constructor that is being invoked |
| 161 * or the name of the field that is being referenced. |
| 162 */ |
| 163 Identifier get name; |
| 164 |
| 165 /** |
| 166 * Set the name of the class defining the constructor that is being invoked or |
| 167 * the name of the field that is being referenced to the given [name]. |
| 168 */ |
| 169 void set name(Identifier name); |
| 170 |
| 171 /** |
| 172 * Return the period before the constructor name, or `null` if this annotation |
| 173 * is not the invocation of a named constructor. |
| 174 */ |
| 175 Token get period; |
| 176 |
| 177 /** |
| 178 * Set the period before the constructor name to the given [token]. |
| 179 */ |
| 180 void set period(Token token); |
| 181 } |
| 182 |
| 183 /** |
| 184 * A list of arguments in the invocation of an executable element (that is, a |
| 185 * function, method, or constructor). |
| 186 * |
| 187 * > argumentList ::= |
| 188 * > '(' arguments? ')' |
| 189 * > |
| 190 * > arguments ::= |
| 191 * > [NamedExpression] (',' [NamedExpression])* |
| 192 * > | [Expression] (',' [Expression])* (',' [NamedExpression])* |
| 193 * |
| 194 * Clients may not extend, implement or mix-in this class. |
| 195 */ |
| 196 abstract class ArgumentList extends AstNode { |
| 197 /** |
| 198 * Initialize a newly created list of arguments. The list of [arguments] can |
| 199 * be `null` if there are no arguments. |
| 200 */ |
| 201 factory ArgumentList(Token leftParenthesis, List<Expression> arguments, |
| 202 Token rightParenthesis) = ArgumentListImpl; |
| 203 |
| 204 /** |
| 205 * Return the expressions producing the values of the arguments. Although the |
| 206 * language requires that positional arguments appear before named arguments, |
| 207 * this class allows them to be intermixed. |
| 208 */ |
| 209 NodeList<Expression> get arguments; |
| 210 |
| 211 /** |
| 212 * Set the parameter elements corresponding to each of the arguments in this |
| 213 * list to the given list of [parameters]. The list of parameters must be the |
| 214 * same length as the number of arguments, but can contain `null` entries if a |
| 215 * given argument does not correspond to a formal parameter. |
| 216 */ |
| 217 void set correspondingPropagatedParameters(List<ParameterElement> parameters); |
| 218 |
| 219 /** |
| 220 * Set the parameter elements corresponding to each of the arguments in this |
| 221 * list to the given list of [parameters]. The list of parameters must be the |
| 222 * same length as the number of arguments, but can contain `null` entries if a |
| 223 * given argument does not correspond to a formal parameter. |
| 224 */ |
| 225 void set correspondingStaticParameters(List<ParameterElement> parameters); |
| 226 |
| 227 /** |
| 228 * Return the left parenthesis. |
| 229 */ |
| 230 Token get leftParenthesis; |
| 231 |
| 232 /** |
| 233 * Set the left parenthesis to the given [token]. |
| 234 */ |
| 235 void set leftParenthesis(Token token); |
| 236 |
| 237 /** |
| 238 * Return the right parenthesis. |
| 239 */ |
| 240 Token get rightParenthesis; |
| 241 |
| 242 /** |
| 243 * Set the right parenthesis to the given [token]. |
| 244 */ |
| 245 void set rightParenthesis(Token token); |
| 246 } |
| 247 |
| 248 /** |
| 249 * An as expression. |
| 250 * |
| 251 * > asExpression ::= |
| 252 * > [Expression] 'as' [TypeName] |
| 253 * |
| 254 * Clients may not extend, implement or mix-in this class. |
| 255 */ |
| 256 abstract class AsExpression extends Expression { |
| 257 /** |
| 258 * Initialize a newly created as expression. |
| 259 */ |
| 260 factory AsExpression(Expression expression, Token asOperator, TypeName type) = |
| 261 AsExpressionImpl; |
| 262 |
| 263 /** |
| 264 * Return the 'as' operator. |
| 265 */ |
| 266 Token get asOperator; |
| 267 |
| 268 /** |
| 269 * Set the 'as' operator to the given [token]. |
| 270 */ |
| 271 void set asOperator(Token token); |
| 272 |
| 273 /** |
| 274 * Return the expression used to compute the value being cast. |
| 275 */ |
| 276 Expression get expression; |
| 277 |
| 278 /** |
| 279 * Set the expression used to compute the value being cast to the given |
| 280 * [expression]. |
| 281 */ |
| 282 void set expression(Expression expression); |
| 283 |
| 284 /** |
| 285 * Return the name of the type being cast to. |
| 286 */ |
| 287 TypeName get type; |
| 288 |
| 289 /** |
| 290 * Set the name of the type being cast to to the given [name]. |
| 291 */ |
| 292 void set type(TypeName name); |
| 293 } |
| 294 |
| 295 /** |
| 296 * An assert statement. |
| 297 * |
| 298 * > assertStatement ::= |
| 299 * > 'assert' '(' [Expression] ')' ';' |
| 300 * |
| 301 * Clients may not extend, implement or mix-in this class. |
| 302 */ |
| 303 abstract class AssertStatement extends Statement { |
| 304 /** |
| 305 * Initialize a newly created assert statement. The [comma] and [message] can |
| 306 * be `null` if there is no message. |
| 307 */ |
| 308 factory AssertStatement( |
| 309 Token assertKeyword, |
| 310 Token leftParenthesis, |
| 311 Expression condition, |
| 312 Token comma, |
| 313 Expression message, |
| 314 Token rightParenthesis, |
| 315 Token semicolon) = AssertStatementImpl; |
| 316 |
| 317 /** |
| 318 * Return the token representing the 'assert' keyword. |
| 319 */ |
| 320 Token get assertKeyword; |
| 321 |
| 322 /** |
| 323 * Set the token representing the 'assert' keyword to the given [token]. |
| 324 */ |
| 325 void set assertKeyword(Token token); |
| 326 |
| 327 /** |
| 328 * Return the comma between the [condition] and the [message], or `null` if no |
| 329 * message was supplied. |
| 330 */ |
| 331 Token get comma; |
| 332 |
| 333 /** |
| 334 * Set the comma between the [condition] and the [message] to the given [token
]. |
| 335 */ |
| 336 void set comma(Token token); |
| 337 |
| 338 /** |
| 339 * Return the condition that is being asserted to be `true`. |
| 340 */ |
| 341 Expression get condition; |
| 342 |
| 343 /** |
| 344 * Set the condition that is being asserted to be `true` to the given |
| 345 * [expression]. |
| 346 */ |
| 347 void set condition(Expression condition); |
| 348 |
| 349 /** |
| 350 * Return the left parenthesis. |
| 351 */ |
| 352 Token get leftParenthesis; |
| 353 |
| 354 /** |
| 355 * Set the left parenthesis to the given [token]. |
| 356 */ |
| 357 void set leftParenthesis(Token token); |
| 358 |
| 359 /** |
| 360 * Return the message to report if the assertion fails, or `null` if no |
| 361 * message was supplied. |
| 362 */ |
| 363 Expression get message; |
| 364 |
| 365 /** |
| 366 * Set the message to report if the assertion fails to the given |
| 367 * [expression]. |
| 368 */ |
| 369 void set message(Expression expression); |
| 370 |
| 371 /** |
| 372 * Return the right parenthesis. |
| 373 */ |
| 374 Token get rightParenthesis; |
| 375 |
| 376 /** |
| 377 * Set the right parenthesis to the given [token]. |
| 378 */ |
| 379 void set rightParenthesis(Token token); |
| 380 |
| 381 /** |
| 382 * Return the semicolon terminating the statement. |
| 383 */ |
| 384 Token get semicolon; |
| 385 |
| 386 /** |
| 387 * Set the semicolon terminating the statement to the given [token]. |
| 388 */ |
| 389 void set semicolon(Token token); |
| 390 } |
| 391 |
| 392 /** |
| 393 * An assignment expression. |
| 394 * |
| 395 * > assignmentExpression ::= |
| 396 * > [Expression] operator [Expression] |
| 397 * |
| 398 * Clients may not extend, implement or mix-in this class. |
| 399 */ |
| 400 abstract class AssignmentExpression extends Expression { |
| 401 /** |
| 402 * Initialize a newly created assignment expression. |
| 403 */ |
| 404 factory AssignmentExpression( |
| 405 Expression leftHandSide, Token operator, Expression rightHandSide) = |
| 406 AssignmentExpressionImpl; |
| 407 |
| 408 /** |
| 409 * Return the best element available for this operator. If resolution was able |
| 410 * to find a better element based on type propagation, that element will be |
| 411 * returned. Otherwise, the element found using the result of static analysis |
| 412 * will be returned. If resolution has not been performed, then `null` will be |
| 413 * returned. |
| 414 */ |
| 415 MethodElement get bestElement; |
| 416 |
| 417 /** |
| 418 * Return the expression used to compute the left hand side. |
| 419 */ |
| 420 Expression get leftHandSide; |
| 421 |
| 422 /** |
| 423 * Return the expression used to compute the left hand side. |
| 424 */ |
| 425 void set leftHandSide(Expression expression); |
| 426 |
| 427 /** |
| 428 * Return the assignment operator being applied. |
| 429 */ |
| 430 Token get operator; |
| 431 |
| 432 /** |
| 433 * Set the assignment operator being applied to the given [token]. |
| 434 */ |
| 435 void set operator(Token token); |
| 436 |
| 437 /** |
| 438 * Return the element associated with the operator based on the propagated |
| 439 * type of the left-hand-side, or `null` if the AST structure has not been |
| 440 * resolved, if the operator is not a compound operator, or if the operator |
| 441 * could not be resolved. |
| 442 */ |
| 443 MethodElement get propagatedElement; |
| 444 |
| 445 /** |
| 446 * Set the element associated with the operator based on the propagated |
| 447 * type of the left-hand-side to the given [element]. |
| 448 */ |
| 449 void set propagatedElement(MethodElement element); |
| 450 |
| 451 /** |
| 452 * Return the expression used to compute the right hand side. |
| 453 */ |
| 454 Expression get rightHandSide; |
| 455 |
| 456 /** |
| 457 * Set the expression used to compute the left hand side to the given |
| 458 * [expression]. |
| 459 */ |
| 460 void set rightHandSide(Expression expression); |
| 461 |
| 462 /** |
| 463 * Return the element associated with the operator based on the static type of |
| 464 * the left-hand-side, or `null` if the AST structure has not been resolved, |
| 465 * if the operator is not a compound operator, or if the operator could not be |
| 466 * resolved. |
| 467 */ |
| 468 MethodElement get staticElement; |
| 469 |
| 470 /** |
| 471 * Set the element associated with the operator based on the static type of |
| 472 * the left-hand-side to the given [element]. |
| 473 */ |
| 474 void set staticElement(MethodElement element); |
| 475 } |
| 476 |
| 477 /** |
| 478 * A node in the AST structure for a Dart program. |
| 479 * |
| 480 * Clients may not extend, implement or mix-in this class. |
| 481 */ |
| 482 abstract class AstNode { |
| 483 /** |
| 484 * An empty list of AST nodes. |
| 485 */ |
| 486 static const List<AstNode> EMPTY_LIST = const <AstNode>[]; |
| 487 |
| 488 /** |
| 489 * A comparator that can be used to sort AST nodes in lexical order. In other |
| 490 * words, `compare` will return a negative value if the offset of the first |
| 491 * node is less than the offset of the second node, zero (0) if the nodes have |
| 492 * the same offset, and a positive value if the offset of the first node is |
| 493 * greater than the offset of the second node. |
| 494 */ |
| 495 static Comparator<AstNode> LEXICAL_ORDER = |
| 496 (AstNode first, AstNode second) => first.offset - second.offset; |
| 497 |
| 498 /** |
| 499 * Return the first token included in this node's source range. |
| 500 */ |
| 501 Token get beginToken; |
| 502 |
| 503 /** |
| 504 * Return an iterator that can be used to iterate through all the entities |
| 505 * (either AST nodes or tokens) that make up the contents of this node, |
| 506 * including doc comments but excluding other comments. |
| 507 */ |
| 508 Iterable/*<AstNode | Token>*/ get childEntities; |
| 509 |
| 510 /** |
| 511 * Return the offset of the character immediately following the last character |
| 512 * of this node's source range. This is equivalent to |
| 513 * `node.getOffset() + node.getLength()`. For a compilation unit this will be |
| 514 * equal to the length of the unit's source. For synthetic nodes this will be |
| 515 * equivalent to the node's offset (because the length is zero (0) by |
| 516 * definition). |
| 517 */ |
| 518 int get end; |
| 519 |
| 520 /** |
| 521 * Return the last token included in this node's source range. |
| 522 */ |
| 523 Token get endToken; |
| 524 |
| 525 /** |
| 526 * Return `true` if this node is a synthetic node. A synthetic node is a node |
| 527 * that was introduced by the parser in order to recover from an error in the |
| 528 * code. Synthetic nodes always have a length of zero (`0`). |
| 529 */ |
| 530 bool get isSynthetic; |
| 531 |
| 532 /** |
| 533 * Return the number of characters in the node's source range. |
| 534 */ |
| 535 int get length; |
| 536 |
| 537 /** |
| 538 * Return the offset from the beginning of the file to the first character in |
| 539 * the node's source range. |
| 540 */ |
| 541 int get offset; |
| 542 |
| 543 /** |
| 544 * Return this node's parent node, or `null` if this node is the root of an |
| 545 * AST structure. |
| 546 * |
| 547 * Note that the relationship between an AST node and its parent node may |
| 548 * change over the lifetime of a node. |
| 549 */ |
| 550 AstNode get parent; |
| 551 |
| 552 /** |
| 553 * Return the node at the root of this node's AST structure. Note that this |
| 554 * method's performance is linear with respect to the depth of the node in the |
| 555 * AST structure (O(depth)). |
| 556 */ |
| 557 AstNode get root; |
| 558 |
| 559 /** |
| 560 * Use the given [visitor] to visit this node. Return the value returned by |
| 561 * the visitor as a result of visiting this node. |
| 562 */ |
| 563 dynamic /* =E */ accept/*<E>*/(AstVisitor/*<E>*/ visitor); |
| 564 |
| 565 /** |
| 566 * Return the most immediate ancestor of this node for which the [predicate] |
| 567 * returns `true`, or `null` if there is no such ancestor. Note that this node |
| 568 * will never be returned. |
| 569 */ |
| 570 AstNode getAncestor(Predicate<AstNode> predicate); |
| 571 |
| 572 /** |
| 573 * Return the value of the property with the given [name], or `null` if this |
| 574 * node does not have a property with the given name. |
| 575 */ |
| 576 Object getProperty(String name); |
| 577 |
| 578 /** |
| 579 * Set the value of the property with the given [name] to the given [value]. |
| 580 * If the value is `null`, the property will effectively be removed. |
| 581 */ |
| 582 void setProperty(String name, Object value); |
| 583 |
| 584 /** |
| 585 * Return a textual description of this node in a form approximating valid |
| 586 * source. The returned string will not be valid source primarily in the case |
| 587 * where the node itself is not well-formed. |
| 588 */ |
| 589 String toSource(); |
| 590 |
| 591 /** |
| 592 * Use the given [visitor] to visit all of the children of this node. The |
| 593 * children will be visited in lexical order. |
| 594 */ |
| 595 void visitChildren(AstVisitor visitor); |
| 596 } |
| 597 |
| 598 /** |
| 599 * An object that can be used to visit an AST structure. |
| 600 * |
| 601 * Clients may extend or implement this class. |
| 602 */ |
| 603 abstract class AstVisitor<R> { |
| 604 R visitAdjacentStrings(AdjacentStrings node); |
| 605 |
| 606 R visitAnnotation(Annotation node); |
| 607 |
| 608 R visitArgumentList(ArgumentList node); |
| 609 |
| 610 R visitAsExpression(AsExpression node); |
| 611 |
| 612 R visitAssertStatement(AssertStatement assertStatement); |
| 613 |
| 614 R visitAssignmentExpression(AssignmentExpression node); |
| 615 |
| 616 R visitAwaitExpression(AwaitExpression node); |
| 617 |
| 618 R visitBinaryExpression(BinaryExpression node); |
| 619 |
| 620 R visitBlock(Block node); |
| 621 |
| 622 R visitBlockFunctionBody(BlockFunctionBody node); |
| 623 |
| 624 R visitBooleanLiteral(BooleanLiteral node); |
| 625 |
| 626 R visitBreakStatement(BreakStatement node); |
| 627 |
| 628 R visitCascadeExpression(CascadeExpression node); |
| 629 |
| 630 R visitCatchClause(CatchClause node); |
| 631 |
| 632 R visitClassDeclaration(ClassDeclaration node); |
| 633 |
| 634 R visitClassTypeAlias(ClassTypeAlias node); |
| 635 |
| 636 R visitComment(Comment node); |
| 637 |
| 638 R visitCommentReference(CommentReference node); |
| 639 |
| 640 R visitCompilationUnit(CompilationUnit node); |
| 641 |
| 642 R visitConditionalExpression(ConditionalExpression node); |
| 643 |
| 644 R visitConfiguration(Configuration node); |
| 645 |
| 646 R visitConstructorDeclaration(ConstructorDeclaration node); |
| 647 |
| 648 R visitConstructorFieldInitializer(ConstructorFieldInitializer node); |
| 649 |
| 650 R visitConstructorName(ConstructorName node); |
| 651 |
| 652 R visitContinueStatement(ContinueStatement node); |
| 653 |
| 654 R visitDeclaredIdentifier(DeclaredIdentifier node); |
| 655 |
| 656 R visitDefaultFormalParameter(DefaultFormalParameter node); |
| 657 |
| 658 R visitDoStatement(DoStatement node); |
| 659 |
| 660 R visitDottedName(DottedName node); |
| 661 |
| 662 R visitDoubleLiteral(DoubleLiteral node); |
| 663 |
| 664 R visitEmptyFunctionBody(EmptyFunctionBody node); |
| 665 |
| 666 R visitEmptyStatement(EmptyStatement node); |
| 667 |
| 668 R visitEnumConstantDeclaration(EnumConstantDeclaration node); |
| 669 |
| 670 R visitEnumDeclaration(EnumDeclaration node); |
| 671 |
| 672 R visitExportDirective(ExportDirective node); |
| 673 |
| 674 R visitExpressionFunctionBody(ExpressionFunctionBody node); |
| 675 |
| 676 R visitExpressionStatement(ExpressionStatement node); |
| 677 |
| 678 R visitExtendsClause(ExtendsClause node); |
| 679 |
| 680 R visitFieldDeclaration(FieldDeclaration node); |
| 681 |
| 682 R visitFieldFormalParameter(FieldFormalParameter node); |
| 683 |
| 684 R visitForEachStatement(ForEachStatement node); |
| 685 |
| 686 R visitFormalParameterList(FormalParameterList node); |
| 687 |
| 688 R visitForStatement(ForStatement node); |
| 689 |
| 690 R visitFunctionDeclaration(FunctionDeclaration node); |
| 691 |
| 692 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node); |
| 693 |
| 694 R visitFunctionExpression(FunctionExpression node); |
| 695 |
| 696 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node); |
| 697 |
| 698 R visitFunctionTypeAlias(FunctionTypeAlias functionTypeAlias); |
| 699 |
| 700 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node); |
| 701 |
| 702 R visitHideCombinator(HideCombinator node); |
| 703 |
| 704 R visitIfStatement(IfStatement node); |
| 705 |
| 706 R visitImplementsClause(ImplementsClause node); |
| 707 |
| 708 R visitImportDirective(ImportDirective node); |
| 709 |
| 710 R visitIndexExpression(IndexExpression node); |
| 711 |
| 712 R visitInstanceCreationExpression(InstanceCreationExpression node); |
| 713 |
| 714 R visitIntegerLiteral(IntegerLiteral node); |
| 715 |
| 716 R visitInterpolationExpression(InterpolationExpression node); |
| 717 |
| 718 R visitInterpolationString(InterpolationString node); |
| 719 |
| 720 R visitIsExpression(IsExpression node); |
| 721 |
| 722 R visitLabel(Label node); |
| 723 |
| 724 R visitLabeledStatement(LabeledStatement node); |
| 725 |
| 726 R visitLibraryDirective(LibraryDirective node); |
| 727 |
| 728 R visitLibraryIdentifier(LibraryIdentifier node); |
| 729 |
| 730 R visitListLiteral(ListLiteral node); |
| 731 |
| 732 R visitMapLiteral(MapLiteral node); |
| 733 |
| 734 R visitMapLiteralEntry(MapLiteralEntry node); |
| 735 |
| 736 R visitMethodDeclaration(MethodDeclaration node); |
| 737 |
| 738 R visitMethodInvocation(MethodInvocation node); |
| 739 |
| 740 R visitNamedExpression(NamedExpression node); |
| 741 |
| 742 R visitNativeClause(NativeClause node); |
| 743 |
| 744 R visitNativeFunctionBody(NativeFunctionBody node); |
| 745 |
| 746 R visitNullLiteral(NullLiteral node); |
| 747 |
| 748 R visitParenthesizedExpression(ParenthesizedExpression node); |
| 749 |
| 750 R visitPartDirective(PartDirective node); |
| 751 |
| 752 R visitPartOfDirective(PartOfDirective node); |
| 753 |
| 754 R visitPostfixExpression(PostfixExpression node); |
| 755 |
| 756 R visitPrefixedIdentifier(PrefixedIdentifier node); |
| 757 |
| 758 R visitPrefixExpression(PrefixExpression node); |
| 759 |
| 760 R visitPropertyAccess(PropertyAccess node); |
| 761 |
| 762 R visitRedirectingConstructorInvocation( |
| 763 RedirectingConstructorInvocation node); |
| 764 |
| 765 R visitRethrowExpression(RethrowExpression node); |
| 766 |
| 767 R visitReturnStatement(ReturnStatement node); |
| 768 |
| 769 R visitScriptTag(ScriptTag node); |
| 770 |
| 771 R visitShowCombinator(ShowCombinator node); |
| 772 |
| 773 R visitSimpleFormalParameter(SimpleFormalParameter node); |
| 774 |
| 775 R visitSimpleIdentifier(SimpleIdentifier node); |
| 776 |
| 777 R visitSimpleStringLiteral(SimpleStringLiteral node); |
| 778 |
| 779 R visitStringInterpolation(StringInterpolation node); |
| 780 |
| 781 R visitSuperConstructorInvocation(SuperConstructorInvocation node); |
| 782 |
| 783 R visitSuperExpression(SuperExpression node); |
| 784 |
| 785 R visitSwitchCase(SwitchCase node); |
| 786 |
| 787 R visitSwitchDefault(SwitchDefault node); |
| 788 |
| 789 R visitSwitchStatement(SwitchStatement node); |
| 790 |
| 791 R visitSymbolLiteral(SymbolLiteral node); |
| 792 |
| 793 R visitThisExpression(ThisExpression node); |
| 794 |
| 795 R visitThrowExpression(ThrowExpression node); |
| 796 |
| 797 R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node); |
| 798 |
| 799 R visitTryStatement(TryStatement node); |
| 800 |
| 801 R visitTypeArgumentList(TypeArgumentList node); |
| 802 |
| 803 R visitTypeName(TypeName node); |
| 804 |
| 805 R visitTypeParameter(TypeParameter node); |
| 806 |
| 807 R visitTypeParameterList(TypeParameterList node); |
| 808 |
| 809 R visitVariableDeclaration(VariableDeclaration node); |
| 810 |
| 811 R visitVariableDeclarationList(VariableDeclarationList node); |
| 812 |
| 813 R visitVariableDeclarationStatement(VariableDeclarationStatement node); |
| 814 |
| 815 R visitWhileStatement(WhileStatement node); |
| 816 |
| 817 R visitWithClause(WithClause node); |
| 818 |
| 819 R visitYieldStatement(YieldStatement node); |
| 820 } |
| 821 |
| 822 /** |
| 823 * An await expression. |
| 824 * |
| 825 * > awaitExpression ::= |
| 826 * > 'await' [Expression] |
| 827 * |
| 828 * Clients may not extend, implement or mix-in this class. |
| 829 */ |
| 830 abstract class AwaitExpression extends Expression { |
| 831 /** |
| 832 * Initialize a newly created await expression. |
| 833 */ |
| 834 factory AwaitExpression(Token awaitKeyword, Expression expression) = |
| 835 AwaitExpressionImpl; |
| 836 |
| 837 /** |
| 838 * Return the 'await' keyword. |
| 839 */ |
| 840 Token get awaitKeyword; |
| 841 |
| 842 /** |
| 843 * Set the 'await' keyword to the given [token]. |
| 844 */ |
| 845 void set awaitKeyword(Token token); |
| 846 |
| 847 /** |
| 848 * Return the expression whose value is being waited on. |
| 849 */ |
| 850 Expression get expression; |
| 851 |
| 852 /** |
| 853 * Set the expression whose value is being waited on to the given [expression]
. |
| 854 */ |
| 855 void set expression(Expression expression); |
| 856 } |
| 857 |
| 858 /** |
| 859 * A binary (infix) expression. |
| 860 * |
| 861 * > binaryExpression ::= |
| 862 * > [Expression] [Token] [Expression] |
| 863 * |
| 864 * Clients may not extend, implement or mix-in this class. |
| 865 */ |
| 866 abstract class BinaryExpression extends Expression { |
| 867 /** |
| 868 * Initialize a newly created binary expression. |
| 869 */ |
| 870 factory BinaryExpression( |
| 871 Expression leftOperand, Token operator, Expression rightOperand) = |
| 872 BinaryExpressionImpl; |
| 873 |
| 874 /** |
| 875 * Return the best element available for this operator. If resolution was able |
| 876 * to find a better element based on type propagation, that element will be |
| 877 * returned. Otherwise, the element found using the result of static analysis |
| 878 * will be returned. If resolution has not been performed, then `null` will be |
| 879 * returned. |
| 880 */ |
| 881 MethodElement get bestElement; |
| 882 |
| 883 /** |
| 884 * Return the expression used to compute the left operand. |
| 885 */ |
| 886 Expression get leftOperand; |
| 887 |
| 888 /** |
| 889 * Set the expression used to compute the left operand to the given |
| 890 * [expression]. |
| 891 */ |
| 892 void set leftOperand(Expression expression); |
| 893 |
| 894 /** |
| 895 * Return the binary operator being applied. |
| 896 */ |
| 897 Token get operator; |
| 898 |
| 899 /** |
| 900 * Set the binary operator being applied to the given [token]. |
| 901 */ |
| 902 void set operator(Token token); |
| 903 |
| 904 /** |
| 905 * Return the element associated with the operator based on the propagated |
| 906 * type of the left operand, or `null` if the AST structure has not been |
| 907 * resolved, if the operator is not user definable, or if the operator could |
| 908 * not be resolved. |
| 909 */ |
| 910 MethodElement get propagatedElement; |
| 911 |
| 912 /** |
| 913 * Set the element associated with the operator based on the propagated |
| 914 * type of the left operand to the given [element]. |
| 915 */ |
| 916 void set propagatedElement(MethodElement element); |
| 917 |
| 918 /** |
| 919 * Return the expression used to compute the right operand. |
| 920 */ |
| 921 Expression get rightOperand; |
| 922 |
| 923 /** |
| 924 * Set the expression used to compute the right operand to the given |
| 925 * [expression]. |
| 926 */ |
| 927 void set rightOperand(Expression expression); |
| 928 |
| 929 /** |
| 930 * Return the element associated with the operator based on the static type of |
| 931 * the left operand, or `null` if the AST structure has not been resolved, if |
| 932 * the operator is not user definable, or if the operator could not be |
| 933 * resolved. |
| 934 */ |
| 935 MethodElement get staticElement; |
| 936 |
| 937 /** |
| 938 * Set the element associated with the operator based on the static type of |
| 939 * the left operand to the given [element]. |
| 940 */ |
| 941 void set staticElement(MethodElement element); |
| 942 } |
| 943 |
| 944 /** |
| 945 * A sequence of statements. |
| 946 * |
| 947 * > block ::= |
| 948 * > '{' statement* '}' |
| 949 * |
| 950 * Clients may not extend, implement or mix-in this class. |
| 951 */ |
| 952 abstract class Block extends Statement { |
| 953 /** |
| 954 * Initialize a newly created block of code. |
| 955 */ |
| 956 factory Block( |
| 957 Token leftBracket, List<Statement> statements, Token rightBracket) = |
| 958 BlockImpl; |
| 959 |
| 960 /** |
| 961 * Return the left curly bracket. |
| 962 */ |
| 963 Token get leftBracket; |
| 964 |
| 965 /** |
| 966 * Set the left curly bracket to the given [token]. |
| 967 */ |
| 968 void set leftBracket(Token token); |
| 969 |
| 970 /** |
| 971 * Return the right curly bracket. |
| 972 */ |
| 973 Token get rightBracket; |
| 974 |
| 975 /** |
| 976 * Set the right curly bracket to the given [token]. |
| 977 */ |
| 978 void set rightBracket(Token token); |
| 979 |
| 980 /** |
| 981 * Return the statements contained in the block. |
| 982 */ |
| 983 NodeList<Statement> get statements; |
| 984 } |
| 985 |
| 986 /** |
| 987 * A function body that consists of a block of statements. |
| 988 * |
| 989 * > blockFunctionBody ::= |
| 990 * > ('async' | 'async' '*' | 'sync' '*')? [Block] |
| 991 * |
| 992 * Clients may not extend, implement or mix-in this class. |
| 993 */ |
| 994 abstract class BlockFunctionBody extends FunctionBody { |
| 995 /** |
| 996 * Initialize a newly created function body consisting of a block of |
| 997 * statements. The [keyword] can be `null` if there is no keyword specified |
| 998 * for the block. The [star] can be `null` if there is no star following the |
| 999 * keyword (and must be `null` if there is no keyword). |
| 1000 */ |
| 1001 factory BlockFunctionBody(Token keyword, Token star, Block block) = |
| 1002 BlockFunctionBodyImpl; |
| 1003 |
| 1004 /** |
| 1005 * Return the block representing the body of the function. |
| 1006 */ |
| 1007 Block get block; |
| 1008 |
| 1009 /** |
| 1010 * Set the block representing the body of the function to the given [block]. |
| 1011 */ |
| 1012 void set block(Block block); |
| 1013 |
| 1014 /** |
| 1015 * Set token representing the 'async' or 'sync' keyword to the given [token]. |
| 1016 */ |
| 1017 void set keyword(Token token); |
| 1018 |
| 1019 /** |
| 1020 * Set the star following the 'async' or 'sync' keyword to the given [token]. |
| 1021 */ |
| 1022 void set star(Token token); |
| 1023 } |
| 1024 |
| 1025 /** |
| 1026 * A boolean literal expression. |
| 1027 * |
| 1028 * > booleanLiteral ::= |
| 1029 * > 'false' | 'true' |
| 1030 * |
| 1031 * Clients may not extend, implement or mix-in this class. |
| 1032 */ |
| 1033 abstract class BooleanLiteral extends Literal { |
| 1034 /** |
| 1035 * Initialize a newly created boolean literal. |
| 1036 */ |
| 1037 factory BooleanLiteral(Token literal, bool value) = BooleanLiteralImpl; |
| 1038 |
| 1039 /** |
| 1040 * Return the token representing the literal. |
| 1041 */ |
| 1042 Token get literal; |
| 1043 |
| 1044 /** |
| 1045 * Set the token representing the literal to the given [token]. |
| 1046 */ |
| 1047 void set literal(Token token); |
| 1048 |
| 1049 /** |
| 1050 * Return the value of the literal. |
| 1051 */ |
| 1052 bool get value; |
| 1053 } |
| 1054 |
| 1055 /** |
| 1056 * A break statement. |
| 1057 * |
| 1058 * > breakStatement ::= |
| 1059 * > 'break' [SimpleIdentifier]? ';' |
| 1060 * |
| 1061 * Clients may not extend, implement or mix-in this class. |
| 1062 */ |
| 1063 abstract class BreakStatement extends Statement { |
| 1064 /** |
| 1065 * Initialize a newly created break statement. The [label] can be `null` if |
| 1066 * there is no label associated with the statement. |
| 1067 */ |
| 1068 factory BreakStatement( |
| 1069 Token breakKeyword, SimpleIdentifier label, Token semicolon) = |
| 1070 BreakStatementImpl; |
| 1071 |
| 1072 /** |
| 1073 * Return the token representing the 'break' keyword. |
| 1074 */ |
| 1075 Token get breakKeyword; |
| 1076 |
| 1077 /** |
| 1078 * Set the token representing the 'break' keyword to the given [token]. |
| 1079 */ |
| 1080 void set breakKeyword(Token token); |
| 1081 |
| 1082 /** |
| 1083 * Return the label associated with the statement, or `null` if there is no |
| 1084 * label. |
| 1085 */ |
| 1086 SimpleIdentifier get label; |
| 1087 |
| 1088 /** |
| 1089 * Set the label associated with the statement to the given [identifier]. |
| 1090 */ |
| 1091 void set label(SimpleIdentifier identifier); |
| 1092 |
| 1093 /** |
| 1094 * Return the semicolon terminating the statement. |
| 1095 */ |
| 1096 Token get semicolon; |
| 1097 |
| 1098 /** |
| 1099 * Set the semicolon terminating the statement to the given [token]. |
| 1100 */ |
| 1101 void set semicolon(Token token); |
| 1102 |
| 1103 /** |
| 1104 * Return the node from which this break statement is breaking. This will be |
| 1105 * either a [Statement] (in the case of breaking out of a loop), a |
| 1106 * [SwitchMember] (in the case of a labeled break statement whose label |
| 1107 * matches a label on a switch case in an enclosing switch statement), or |
| 1108 * `null` if the AST has not yet been resolved or if the target could not be |
| 1109 * resolved. Note that if the source code has errors, the target might be |
| 1110 * invalid (e.g. trying to break to a switch case). |
| 1111 */ |
| 1112 AstNode get target; |
| 1113 |
| 1114 /** |
| 1115 * Set the node from which this break statement is breaking to the given |
| 1116 * [node]. |
| 1117 */ |
| 1118 void set target(AstNode node); |
| 1119 } |
| 1120 |
| 1121 /** |
| 1122 * A sequence of cascaded expressions: expressions that share a common target. |
| 1123 * There are three kinds of expressions that can be used in a cascade |
| 1124 * expression: [IndexExpression], [MethodInvocation] and [PropertyAccess]. |
| 1125 * |
| 1126 * > cascadeExpression ::= |
| 1127 * > [Expression] cascadeSection* |
| 1128 * > |
| 1129 * > cascadeSection ::= |
| 1130 * > '..' (cascadeSelector arguments*) (assignableSelector arguments*)* |
| 1131 * > (assignmentOperator expressionWithoutCascade)? |
| 1132 * > |
| 1133 * > cascadeSelector ::= |
| 1134 * > '[ ' expression '] ' |
| 1135 * > | identifier |
| 1136 * |
| 1137 * Clients may not extend, implement or mix-in this class. |
| 1138 */ |
| 1139 abstract class CascadeExpression extends Expression { |
| 1140 /** |
| 1141 * Initialize a newly created cascade expression. The list of |
| 1142 * [cascadeSections] must contain at least one element. |
| 1143 */ |
| 1144 factory CascadeExpression( |
| 1145 Expression target, List<Expression> cascadeSections) = |
| 1146 CascadeExpressionImpl; |
| 1147 |
| 1148 /** |
| 1149 * Return the cascade sections sharing the common target. |
| 1150 */ |
| 1151 NodeList<Expression> get cascadeSections; |
| 1152 |
| 1153 /** |
| 1154 * Return the target of the cascade sections. |
| 1155 */ |
| 1156 Expression get target; |
| 1157 |
| 1158 /** |
| 1159 * Set the target of the cascade sections to the given [expression]. |
| 1160 */ |
| 1161 void set target(Expression target); |
| 1162 } |
| 1163 |
| 1164 /** |
| 1165 * A catch clause within a try statement. |
| 1166 * |
| 1167 * > onPart ::= |
| 1168 * > catchPart [Block] |
| 1169 * > | 'on' type catchPart? [Block] |
| 1170 * > |
| 1171 * > catchPart ::= |
| 1172 * > 'catch' '(' [SimpleIdentifier] (',' [SimpleIdentifier])? ')' |
| 1173 * |
| 1174 * Clients may not extend, implement or mix-in this class. |
| 1175 */ |
| 1176 abstract class CatchClause extends AstNode { |
| 1177 /** |
| 1178 * Initialize a newly created catch clause. The [onKeyword] and |
| 1179 * [exceptionType] can be `null` if the clause will catch all exceptions. The |
| 1180 * [comma] and [stackTraceParameter] can be `null` if the stack trace |
| 1181 * parameter is not defined. |
| 1182 */ |
| 1183 factory CatchClause( |
| 1184 Token onKeyword, |
| 1185 TypeName exceptionType, |
| 1186 Token catchKeyword, |
| 1187 Token leftParenthesis, |
| 1188 SimpleIdentifier exceptionParameter, |
| 1189 Token comma, |
| 1190 SimpleIdentifier stackTraceParameter, |
| 1191 Token rightParenthesis, |
| 1192 Block body) = CatchClauseImpl; |
| 1193 |
| 1194 /** |
| 1195 * Return the body of the catch block. |
| 1196 */ |
| 1197 Block get body; |
| 1198 |
| 1199 /** |
| 1200 * Set the body of the catch block to the given [block]. |
| 1201 */ |
| 1202 void set body(Block block); |
| 1203 |
| 1204 /** |
| 1205 * Return the token representing the 'catch' keyword, or `null` if there is no |
| 1206 * 'catch' keyword. |
| 1207 */ |
| 1208 Token get catchKeyword; |
| 1209 |
| 1210 /** |
| 1211 * Set the token representing the 'catch' keyword to the given [token]. |
| 1212 */ |
| 1213 void set catchKeyword(Token token); |
| 1214 |
| 1215 /** |
| 1216 * Return the comma separating the exception parameter from the stack trace |
| 1217 * parameter, or `null` if there is no stack trace parameter. |
| 1218 */ |
| 1219 Token get comma; |
| 1220 |
| 1221 /** |
| 1222 * Set the comma separating the exception parameter from the stack trace |
| 1223 * parameter to the given [token]. |
| 1224 */ |
| 1225 void set comma(Token token); |
| 1226 |
| 1227 /** |
| 1228 * Return the parameter whose value will be the exception that was thrown, or |
| 1229 * `null` if there is no 'catch' keyword. |
| 1230 */ |
| 1231 SimpleIdentifier get exceptionParameter; |
| 1232 |
| 1233 /** |
| 1234 * Set the parameter whose value will be the exception that was thrown to the |
| 1235 * given [parameter]. |
| 1236 */ |
| 1237 void set exceptionParameter(SimpleIdentifier parameter); |
| 1238 |
| 1239 /** |
| 1240 * Return the type of exceptions caught by this catch clause, or `null` if |
| 1241 * this catch clause catches every type of exception. |
| 1242 */ |
| 1243 TypeName get exceptionType; |
| 1244 |
| 1245 /** |
| 1246 * Set the type of exceptions caught by this catch clause to the given |
| 1247 * [exceptionType]. |
| 1248 */ |
| 1249 void set exceptionType(TypeName exceptionType); |
| 1250 |
| 1251 /** |
| 1252 * Return the left parenthesis, or `null` if there is no 'catch' keyword. |
| 1253 */ |
| 1254 Token get leftParenthesis; |
| 1255 |
| 1256 /** |
| 1257 * Set the left parenthesis to the given [token]. |
| 1258 */ |
| 1259 void set leftParenthesis(Token token); |
| 1260 |
| 1261 /** |
| 1262 * Return the token representing the 'on' keyword, or `null` if there is no 'o
n' |
| 1263 * keyword. |
| 1264 */ |
| 1265 Token get onKeyword; |
| 1266 |
| 1267 /** |
| 1268 * Set the token representing the 'on' keyword to the given [token]. |
| 1269 */ |
| 1270 void set onKeyword(Token token); |
| 1271 |
| 1272 /** |
| 1273 * Return the right parenthesis, or `null` if there is no 'catch' keyword. |
| 1274 */ |
| 1275 Token get rightParenthesis; |
| 1276 |
| 1277 /** |
| 1278 * Set the right parenthesis to the given [token]. |
| 1279 */ |
| 1280 void set rightParenthesis(Token token); |
| 1281 |
| 1282 /** |
| 1283 * Return the parameter whose value will be the stack trace associated with |
| 1284 * the exception, or `null` if there is no stack trace parameter. |
| 1285 */ |
| 1286 SimpleIdentifier get stackTraceParameter; |
| 1287 |
| 1288 /** |
| 1289 * Set the parameter whose value will be the stack trace associated with the |
| 1290 * exception to the given [parameter]. |
| 1291 */ |
| 1292 void set stackTraceParameter(SimpleIdentifier parameter); |
| 1293 } |
| 1294 |
| 1295 /** |
| 1296 * The declaration of a class. |
| 1297 * |
| 1298 * > classDeclaration ::= |
| 1299 * > 'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]? |
| 1300 * > ([ExtendsClause] [WithClause]?)? |
| 1301 * > [ImplementsClause]? |
| 1302 * > '{' [ClassMember]* '}' |
| 1303 * |
| 1304 * Clients may not extend, implement or mix-in this class. |
| 1305 */ |
| 1306 abstract class ClassDeclaration extends NamedCompilationUnitMember { |
| 1307 /** |
| 1308 * Initialize a newly created class declaration. Either or both of the |
| 1309 * [comment] and [metadata] can be `null` if the class does not have the |
| 1310 * corresponding attribute. The [abstractKeyword] can be `null` if the class |
| 1311 * is not abstract. The [typeParameters] can be `null` if the class does not |
| 1312 * have any type parameters. Any or all of the [extendsClause], [withClause], |
| 1313 * and [implementsClause] can be `null` if the class does not have the |
| 1314 * corresponding clause. The list of [members] can be `null` if the class does |
| 1315 * not have any members. |
| 1316 */ |
| 1317 factory ClassDeclaration( |
| 1318 Comment comment, |
| 1319 List<Annotation> metadata, |
| 1320 Token abstractKeyword, |
| 1321 Token classKeyword, |
| 1322 SimpleIdentifier name, |
| 1323 TypeParameterList typeParameters, |
| 1324 ExtendsClause extendsClause, |
| 1325 WithClause withClause, |
| 1326 ImplementsClause implementsClause, |
| 1327 Token leftBracket, |
| 1328 List<ClassMember> members, |
| 1329 Token rightBracket) = ClassDeclarationImpl; |
| 1330 |
| 1331 /** |
| 1332 * Return the 'abstract' keyword, or `null` if the keyword was absent. |
| 1333 */ |
| 1334 Token get abstractKeyword; |
| 1335 |
| 1336 /** |
| 1337 * Set the 'abstract' keyword to the given [token]. |
| 1338 */ |
| 1339 void set abstractKeyword(Token token); |
| 1340 |
| 1341 /** |
| 1342 * Return the token representing the 'class' keyword to the given [token]. |
| 1343 */ |
| 1344 Token get classKeyword; |
| 1345 |
| 1346 /** |
| 1347 * Set the token representing the 'class' keyword. |
| 1348 */ |
| 1349 void set classKeyword(Token token); |
| 1350 |
| 1351 @override |
| 1352 ClassElement get element; |
| 1353 |
| 1354 /** |
| 1355 * Return the extends clause for this class, or `null` if the class does not |
| 1356 * extend any other class. |
| 1357 */ |
| 1358 ExtendsClause get extendsClause; |
| 1359 |
| 1360 /** |
| 1361 * Set the extends clause for this class to the given [extendsClause]. |
| 1362 */ |
| 1363 void set extendsClause(ExtendsClause extendsClause); |
| 1364 |
| 1365 /** |
| 1366 * Return the implements clause for the class, or `null` if the class does not |
| 1367 * implement any interfaces. |
| 1368 */ |
| 1369 ImplementsClause get implementsClause; |
| 1370 |
| 1371 /** |
| 1372 * Set the implements clause for the class to the given [implementsClause]. |
| 1373 */ |
| 1374 void set implementsClause(ImplementsClause implementsClause); |
| 1375 |
| 1376 /** |
| 1377 * Return `true` if this class is declared to be an abstract class. |
| 1378 */ |
| 1379 bool get isAbstract; |
| 1380 |
| 1381 /** |
| 1382 * Return the left curly bracket. |
| 1383 */ |
| 1384 Token get leftBracket; |
| 1385 |
| 1386 /** |
| 1387 * Set the left curly bracket to the given [token]. |
| 1388 */ |
| 1389 void set leftBracket(Token token); |
| 1390 |
| 1391 /** |
| 1392 * Return the members defined by the class. |
| 1393 */ |
| 1394 NodeList<ClassMember> get members; |
| 1395 |
| 1396 /** |
| 1397 * Return the native clause for this class, or `null` if the class does not |
| 1398 * have a native clause. |
| 1399 */ |
| 1400 NativeClause get nativeClause; |
| 1401 |
| 1402 /** |
| 1403 * Set the native clause for this class to the given [nativeClause]. |
| 1404 */ |
| 1405 void set nativeClause(NativeClause nativeClause); |
| 1406 |
| 1407 /** |
| 1408 * Return the right curly bracket. |
| 1409 */ |
| 1410 Token get rightBracket; |
| 1411 |
| 1412 /** |
| 1413 * Set the right curly bracket to the given [token]. |
| 1414 */ |
| 1415 void set rightBracket(Token token); |
| 1416 |
| 1417 /** |
| 1418 * Return the type parameters for the class, or `null` if the class does not |
| 1419 * have any type parameters. |
| 1420 */ |
| 1421 TypeParameterList get typeParameters; |
| 1422 |
| 1423 /** |
| 1424 * Set the type parameters for the class to the given list of [typeParameters]
. |
| 1425 */ |
| 1426 void set typeParameters(TypeParameterList typeParameters); |
| 1427 |
| 1428 /** |
| 1429 * Return the with clause for the class, or `null` if the class does not have |
| 1430 * a with clause. |
| 1431 */ |
| 1432 WithClause get withClause; |
| 1433 |
| 1434 /** |
| 1435 * Set the with clause for the class to the given [withClause]. |
| 1436 */ |
| 1437 void set withClause(WithClause withClause); |
| 1438 |
| 1439 /** |
| 1440 * Return the constructor declared in the class with the given [name], or |
| 1441 * `null` if there is no such constructor. If the [name] is `null` then the |
| 1442 * default constructor will be searched for. |
| 1443 */ |
| 1444 ConstructorDeclaration getConstructor(String name); |
| 1445 |
| 1446 /** |
| 1447 * Return the field declared in the class with the given [name], or `null` if |
| 1448 * there is no such field. |
| 1449 */ |
| 1450 VariableDeclaration getField(String name); |
| 1451 |
| 1452 /** |
| 1453 * Return the method declared in the class with the given [name], or `null` if |
| 1454 * there is no such method. |
| 1455 */ |
| 1456 MethodDeclaration getMethod(String name); |
| 1457 } |
| 1458 |
| 1459 /** |
| 1460 * A node that declares a name within the scope of a class. |
| 1461 * |
| 1462 * Clients may not extend, implement or mix-in this class. |
| 1463 */ |
| 1464 abstract class ClassMember extends Declaration {} |
| 1465 |
| 1466 /** |
| 1467 * A class type alias. |
| 1468 * |
| 1469 * > classTypeAlias ::= |
| 1470 * > [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplicatio
n |
| 1471 * > |
| 1472 * > mixinApplication ::= |
| 1473 * > [TypeName] [WithClause] [ImplementsClause]? ';' |
| 1474 * |
| 1475 * Clients may not extend, implement or mix-in this class. |
| 1476 */ |
| 1477 abstract class ClassTypeAlias extends TypeAlias { |
| 1478 /** |
| 1479 * Initialize a newly created class type alias. Either or both of the |
| 1480 * [comment] and [metadata] can be `null` if the class type alias does not |
| 1481 * have the corresponding attribute. The [typeParameters] can be `null` if the |
| 1482 * class does not have any type parameters. The [abstractKeyword] can be |
| 1483 * `null` if the class is not abstract. The [implementsClause] can be `null` |
| 1484 * if the class does not implement any interfaces. |
| 1485 */ |
| 1486 factory ClassTypeAlias( |
| 1487 Comment comment, |
| 1488 List<Annotation> metadata, |
| 1489 Token keyword, |
| 1490 SimpleIdentifier name, |
| 1491 TypeParameterList typeParameters, |
| 1492 Token equals, |
| 1493 Token abstractKeyword, |
| 1494 TypeName superclass, |
| 1495 WithClause withClause, |
| 1496 ImplementsClause implementsClause, |
| 1497 Token semicolon) = ClassTypeAliasImpl; |
| 1498 |
| 1499 /** |
| 1500 * Return the token for the 'abstract' keyword, or `null` if this is not |
| 1501 * defining an abstract class. |
| 1502 */ |
| 1503 Token get abstractKeyword; |
| 1504 |
| 1505 /** |
| 1506 * Set the token for the 'abstract' keyword to the given [token]. |
| 1507 */ |
| 1508 void set abstractKeyword(Token token); |
| 1509 |
| 1510 /** |
| 1511 * Return the token for the '=' separating the name from the definition. |
| 1512 */ |
| 1513 Token get equals; |
| 1514 |
| 1515 /** |
| 1516 * Set the token for the '=' separating the name from the definition to the |
| 1517 * given [token]. |
| 1518 */ |
| 1519 void set equals(Token token); |
| 1520 |
| 1521 /** |
| 1522 * Return the implements clause for this class, or `null` if there is no |
| 1523 * implements clause. |
| 1524 */ |
| 1525 ImplementsClause get implementsClause; |
| 1526 |
| 1527 /** |
| 1528 * Set the implements clause for this class to the given [implementsClause]. |
| 1529 */ |
| 1530 void set implementsClause(ImplementsClause implementsClause); |
| 1531 |
| 1532 /** |
| 1533 * Return `true` if this class is declared to be an abstract class. |
| 1534 */ |
| 1535 bool get isAbstract; |
| 1536 |
| 1537 /** |
| 1538 * Return the name of the superclass of the class being declared. |
| 1539 */ |
| 1540 TypeName get superclass; |
| 1541 |
| 1542 /** |
| 1543 * Set the name of the superclass of the class being declared to the given |
| 1544 * [superclass] name. |
| 1545 */ |
| 1546 void set superclass(TypeName superclass); |
| 1547 |
| 1548 /** |
| 1549 * Return the type parameters for the class, or `null` if the class does not |
| 1550 * have any type parameters. |
| 1551 */ |
| 1552 TypeParameterList get typeParameters; |
| 1553 |
| 1554 /** |
| 1555 * Set the type parameters for the class to the given list of [typeParameters]
. |
| 1556 */ |
| 1557 void set typeParameters(TypeParameterList typeParameters); |
| 1558 |
| 1559 /** |
| 1560 * Return the with clause for this class. |
| 1561 */ |
| 1562 WithClause get withClause; |
| 1563 |
| 1564 /** |
| 1565 * Set the with clause for this class to the given with [withClause]. |
| 1566 */ |
| 1567 void set withClause(WithClause withClause); |
| 1568 } |
| 1569 |
| 1570 /** |
| 1571 * A combinator associated with an import or export directive. |
| 1572 * |
| 1573 * > combinator ::= |
| 1574 * > [HideCombinator] |
| 1575 * > | [ShowCombinator] |
| 1576 * |
| 1577 * Clients may not extend, implement or mix-in this class. |
| 1578 */ |
| 1579 abstract class Combinator extends AstNode { |
| 1580 /** |
| 1581 * Return the 'hide' or 'show' keyword specifying what kind of processing is |
| 1582 * to be done on the names. |
| 1583 */ |
| 1584 Token get keyword; |
| 1585 |
| 1586 /** |
| 1587 * Set the 'hide' or 'show' keyword specifying what kind of processing is |
| 1588 * to be done on the names to the given [token]. |
| 1589 */ |
| 1590 void set keyword(Token token); |
| 1591 } |
| 1592 |
| 1593 /** |
| 1594 * A comment within the source code. |
| 1595 * |
| 1596 * > comment ::= |
| 1597 * > endOfLineComment |
| 1598 * > | blockComment |
| 1599 * > | documentationComment |
| 1600 * > |
| 1601 * > endOfLineComment ::= |
| 1602 * > '//' (CHARACTER - EOL)* EOL |
| 1603 * > |
| 1604 * > blockComment ::= |
| 1605 * > '/ *' CHARACTER* '*/' |
| 1606 * > |
| 1607 * > documentationComment ::= |
| 1608 * > '/ **' (CHARACTER | [CommentReference])* '*/' |
| 1609 * > | ('///' (CHARACTER - EOL)* EOL)+ |
| 1610 * |
| 1611 * Clients may not extend, implement or mix-in this class. |
| 1612 */ |
| 1613 abstract class Comment extends AstNode { |
| 1614 /** |
| 1615 * Initialize a newly created comment. The list of [tokens] must contain at |
| 1616 * least one token. The [type] is the type of the comment. The list of |
| 1617 * [references] can be empty if the comment does not contain any embedded |
| 1618 * references. |
| 1619 */ |
| 1620 factory Comment(List<Token> tokens, CommentType type, |
| 1621 List<CommentReference> references) = CommentImpl; |
| 1622 |
| 1623 /** |
| 1624 * Return `true` if this is a block comment. |
| 1625 */ |
| 1626 bool get isBlock; |
| 1627 |
| 1628 /** |
| 1629 * Return `true` if this is a documentation comment. |
| 1630 */ |
| 1631 bool get isDocumentation; |
| 1632 |
| 1633 /** |
| 1634 * Return `true` if this is an end-of-line comment. |
| 1635 */ |
| 1636 bool get isEndOfLine; |
| 1637 |
| 1638 /** |
| 1639 * Return the references embedded within the documentation comment. |
| 1640 */ |
| 1641 NodeList<CommentReference> get references; |
| 1642 |
| 1643 /** |
| 1644 * Return the tokens representing the comment. |
| 1645 */ |
| 1646 List<Token> get tokens; |
| 1647 |
| 1648 /** |
| 1649 * Create a block comment consisting of the given [tokens]. |
| 1650 */ |
| 1651 static Comment createBlockComment(List<Token> tokens) => |
| 1652 CommentImpl.createBlockComment(tokens); |
| 1653 |
| 1654 /** |
| 1655 * Create a documentation comment consisting of the given [tokens]. |
| 1656 */ |
| 1657 static Comment createDocumentationComment(List<Token> tokens) => |
| 1658 CommentImpl.createDocumentationComment(tokens); |
| 1659 |
| 1660 /** |
| 1661 * Create a documentation comment consisting of the given [tokens] and having |
| 1662 * the given [references] embedded within it. |
| 1663 */ |
| 1664 static Comment createDocumentationCommentWithReferences( |
| 1665 List<Token> tokens, List<CommentReference> references) => |
| 1666 CommentImpl.createDocumentationCommentWithReferences(tokens, references); |
| 1667 |
| 1668 /** |
| 1669 * Create an end-of-line comment consisting of the given [tokens]. |
| 1670 */ |
| 1671 static Comment createEndOfLineComment(List<Token> tokens) => |
| 1672 CommentImpl.createEndOfLineComment(tokens); |
| 1673 } |
| 1674 |
| 1675 /** |
| 1676 * A reference to a Dart element that is found within a documentation comment. |
| 1677 * |
| 1678 * > commentReference ::= |
| 1679 * > '[' 'new'? [Identifier] ']' |
| 1680 * |
| 1681 * Clients may not extend, implement or mix-in this class. |
| 1682 */ |
| 1683 abstract class CommentReference extends AstNode { |
| 1684 /** |
| 1685 * Initialize a newly created reference to a Dart element. The [newKeyword] |
| 1686 * can be `null` if the reference is not to a constructor. |
| 1687 */ |
| 1688 factory CommentReference(Token newKeyword, Identifier identifier) = |
| 1689 CommentReferenceImpl; |
| 1690 |
| 1691 /** |
| 1692 * Return the identifier being referenced. |
| 1693 */ |
| 1694 Identifier get identifier; |
| 1695 |
| 1696 /** |
| 1697 * Set the identifier being referenced to the given [identifier]. |
| 1698 */ |
| 1699 void set identifier(Identifier identifier); |
| 1700 |
| 1701 /** |
| 1702 * Return the token representing the 'new' keyword, or `null` if there was no |
| 1703 * 'new' keyword. |
| 1704 */ |
| 1705 Token get newKeyword; |
| 1706 |
| 1707 /** |
| 1708 * Set the token representing the 'new' keyword to the given [token]. |
| 1709 */ |
| 1710 void set newKeyword(Token token); |
| 1711 } |
| 1712 |
| 1713 /** |
| 1714 * A compilation unit. |
| 1715 * |
| 1716 * While the grammar restricts the order of the directives and declarations |
| 1717 * within a compilation unit, this class does not enforce those restrictions. |
| 1718 * In particular, the children of a compilation unit will be visited in lexical |
| 1719 * order even if lexical order does not conform to the restrictions of the |
| 1720 * grammar. |
| 1721 * |
| 1722 * > compilationUnit ::= |
| 1723 * > directives declarations |
| 1724 * > |
| 1725 * > directives ::= |
| 1726 * > [ScriptTag]? [LibraryDirective]? namespaceDirective* [PartDirective]* |
| 1727 * > | [PartOfDirective] |
| 1728 * > |
| 1729 * > namespaceDirective ::= |
| 1730 * > [ImportDirective] |
| 1731 * > | [ExportDirective] |
| 1732 * > |
| 1733 * > declarations ::= |
| 1734 * > [CompilationUnitMember]* |
| 1735 * |
| 1736 * Clients may not extend, implement or mix-in this class. |
| 1737 */ |
| 1738 abstract class CompilationUnit extends AstNode { |
| 1739 /** |
| 1740 * Initialize a newly created compilation unit to have the given directives |
| 1741 * and declarations. The [scriptTag] can be `null` if there is no script tag |
| 1742 * in the compilation unit. The list of [directives] can be `null` if there |
| 1743 * are no directives in the compilation unit. The list of [declarations] can |
| 1744 * be `null` if there are no declarations in the compilation unit. |
| 1745 */ |
| 1746 factory CompilationUnit( |
| 1747 Token beginToken, |
| 1748 ScriptTag scriptTag, |
| 1749 List<Directive> directives, |
| 1750 List<CompilationUnitMember> declarations, |
| 1751 Token endToken) = CompilationUnitImpl; |
| 1752 |
| 1753 /** |
| 1754 * Set the first token included in this node's source range to the given |
| 1755 * [token]. |
| 1756 */ |
| 1757 void set beginToken(Token token); |
| 1758 |
| 1759 /** |
| 1760 * Return the declarations contained in this compilation unit. |
| 1761 */ |
| 1762 NodeList<CompilationUnitMember> get declarations; |
| 1763 |
| 1764 /** |
| 1765 * Return the directives contained in this compilation unit. |
| 1766 */ |
| 1767 NodeList<Directive> get directives; |
| 1768 |
| 1769 /** |
| 1770 * Return the element associated with this compilation unit, or `null` if the |
| 1771 * AST structure has not been resolved. |
| 1772 */ |
| 1773 CompilationUnitElement get element; |
| 1774 |
| 1775 /** |
| 1776 * Set the element associated with this compilation unit to the given |
| 1777 * [element]. |
| 1778 */ |
| 1779 void set element(CompilationUnitElement element); |
| 1780 |
| 1781 /** |
| 1782 * Set the last token included in this node's source range to the given |
| 1783 * [token]. |
| 1784 */ |
| 1785 void set endToken(Token token); |
| 1786 |
| 1787 /** |
| 1788 * Return the line information for this compilation unit. |
| 1789 */ |
| 1790 LineInfo get lineInfo; |
| 1791 |
| 1792 /** |
| 1793 * Set the line information for this compilation unit to the given [info]. |
| 1794 */ |
| 1795 void set lineInfo(LineInfo info); |
| 1796 |
| 1797 /** |
| 1798 * Return the script tag at the beginning of the compilation unit, or `null` |
| 1799 * if there is no script tag in this compilation unit. |
| 1800 */ |
| 1801 ScriptTag get scriptTag; |
| 1802 |
| 1803 /** |
| 1804 * Set the script tag at the beginning of the compilation unit to the given |
| 1805 * [scriptTag]. |
| 1806 */ |
| 1807 void set scriptTag(ScriptTag scriptTag); |
| 1808 |
| 1809 /** |
| 1810 * Return a list containing all of the directives and declarations in this |
| 1811 * compilation unit, sorted in lexical order. |
| 1812 */ |
| 1813 List<AstNode> get sortedDirectivesAndDeclarations; |
| 1814 } |
| 1815 |
| 1816 /** |
| 1817 * A node that declares one or more names within the scope of a compilation |
| 1818 * unit. |
| 1819 * |
| 1820 * > compilationUnitMember ::= |
| 1821 * > [ClassDeclaration] |
| 1822 * > | [TypeAlias] |
| 1823 * > | [FunctionDeclaration] |
| 1824 * > | [MethodDeclaration] |
| 1825 * > | [VariableDeclaration] |
| 1826 * > | [VariableDeclaration] |
| 1827 * |
| 1828 * Clients may not extend, implement or mix-in this class. |
| 1829 */ |
| 1830 abstract class CompilationUnitMember extends Declaration {} |
| 1831 |
| 1832 /** |
| 1833 * A conditional expression. |
| 1834 * |
| 1835 * > conditionalExpression ::= |
| 1836 * > [Expression] '?' [Expression] ':' [Expression] |
| 1837 * |
| 1838 * Clients may not extend, implement or mix-in this class. |
| 1839 */ |
| 1840 abstract class ConditionalExpression extends Expression { |
| 1841 /** |
| 1842 * Initialize a newly created conditional expression. |
| 1843 */ |
| 1844 factory ConditionalExpression( |
| 1845 Expression condition, |
| 1846 Token question, |
| 1847 Expression thenExpression, |
| 1848 Token colon, |
| 1849 Expression elseExpression) = ConditionalExpressionImpl; |
| 1850 |
| 1851 /** |
| 1852 * Return the token used to separate the then expression from the else |
| 1853 * expression. |
| 1854 */ |
| 1855 Token get colon; |
| 1856 |
| 1857 /** |
| 1858 * Set the token used to separate the then expression from the else expression |
| 1859 * to the given [token]. |
| 1860 */ |
| 1861 void set colon(Token token); |
| 1862 |
| 1863 /** |
| 1864 * Return the condition used to determine which of the expressions is executed |
| 1865 * next. |
| 1866 */ |
| 1867 Expression get condition; |
| 1868 |
| 1869 /** |
| 1870 * Set the condition used to determine which of the expressions is executed |
| 1871 * next to the given [expression]. |
| 1872 */ |
| 1873 void set condition(Expression expression); |
| 1874 |
| 1875 /** |
| 1876 * Return the expression that is executed if the condition evaluates to |
| 1877 * `false`. |
| 1878 */ |
| 1879 Expression get elseExpression; |
| 1880 |
| 1881 /** |
| 1882 * Set the expression that is executed if the condition evaluates to `false` |
| 1883 * to the given [expression]. |
| 1884 */ |
| 1885 void set elseExpression(Expression expression); |
| 1886 |
| 1887 /** |
| 1888 * Return the token used to separate the condition from the then expression. |
| 1889 */ |
| 1890 Token get question; |
| 1891 |
| 1892 /** |
| 1893 * Set the token used to separate the condition from the then expression to |
| 1894 * the given [token]. |
| 1895 */ |
| 1896 void set question(Token token); |
| 1897 |
| 1898 /** |
| 1899 * Return the expression that is executed if the condition evaluates to |
| 1900 * `true`. |
| 1901 */ |
| 1902 Expression get thenExpression; |
| 1903 |
| 1904 /** |
| 1905 * Set the expression that is executed if the condition evaluates to `true` to |
| 1906 * the given [expression]. |
| 1907 */ |
| 1908 void set thenExpression(Expression expression); |
| 1909 } |
| 1910 |
| 1911 /** |
| 1912 * A configuration in either an import or export directive. |
| 1913 * |
| 1914 * > configuration ::= |
| 1915 * > 'if' '(' test ')' uri |
| 1916 * > |
| 1917 * > test ::= |
| 1918 * > dottedName ('==' stringLiteral)? |
| 1919 * > |
| 1920 * > dottedName ::= |
| 1921 * > identifier ('.' identifier)* |
| 1922 * |
| 1923 * Clients may not extend, implement or mix-in this class. |
| 1924 */ |
| 1925 abstract class Configuration extends AstNode { |
| 1926 /** |
| 1927 * Initialize a newly created configuration. |
| 1928 */ |
| 1929 factory Configuration( |
| 1930 Token ifKeyword, |
| 1931 Token leftParenthesis, |
| 1932 DottedName name, |
| 1933 Token equalToken, |
| 1934 StringLiteral value, |
| 1935 Token rightParenthesis, |
| 1936 StringLiteral libraryUri) = ConfigurationImpl; |
| 1937 |
| 1938 /** |
| 1939 * Return the token for the equal operator, or `null` if the condition does |
| 1940 * not include an equality test. |
| 1941 */ |
| 1942 Token get equalToken; |
| 1943 |
| 1944 /** |
| 1945 * Set the token for the equal operator to the given [token]. |
| 1946 */ |
| 1947 void set equalToken(Token token); |
| 1948 |
| 1949 /** |
| 1950 * Return the token for the 'if' keyword. |
| 1951 */ |
| 1952 Token get ifKeyword; |
| 1953 |
| 1954 /** |
| 1955 * Set the token for the 'if' keyword to the given [token]. |
| 1956 */ |
| 1957 void set ifKeyword(Token token); |
| 1958 |
| 1959 /** |
| 1960 * Return the token for the left parenthesis. |
| 1961 */ |
| 1962 Token get leftParenthesis; |
| 1963 |
| 1964 /** |
| 1965 * Set the token for the left parenthesis to the given [token]. |
| 1966 */ |
| 1967 void set leftParenthesis(Token token); |
| 1968 |
| 1969 /** |
| 1970 * Return the URI of the implementation library to be used if the condition is |
| 1971 * true. |
| 1972 */ |
| 1973 StringLiteral get libraryUri; |
| 1974 |
| 1975 /** |
| 1976 * Set the URI of the implementation library to be used if the condition is |
| 1977 * true to the given [uri]. |
| 1978 */ |
| 1979 void set libraryUri(StringLiteral uri); |
| 1980 |
| 1981 /** |
| 1982 * Return the name of the declared variable whose value is being used in the |
| 1983 * condition. |
| 1984 */ |
| 1985 DottedName get name; |
| 1986 |
| 1987 /** |
| 1988 * Set the name of the declared variable whose value is being used in the |
| 1989 * condition to the given [name]. |
| 1990 */ |
| 1991 void set name(DottedName name); |
| 1992 |
| 1993 /** |
| 1994 * Return the token for the right parenthesis. |
| 1995 */ |
| 1996 Token get rightParenthesis; |
| 1997 |
| 1998 /** |
| 1999 * Set the token for the right parenthesis to the given [token]. |
| 2000 */ |
| 2001 void set rightParenthesis(Token token); |
| 2002 |
| 2003 /** |
| 2004 * Return the value to which the value of the declared variable will be |
| 2005 * compared, or `null` if the condition does not include an equality test. |
| 2006 */ |
| 2007 StringLiteral get value; |
| 2008 |
| 2009 /** |
| 2010 * Set the value to which the value of the declared variable will be |
| 2011 * compared to the given [value]. |
| 2012 */ |
| 2013 void set value(StringLiteral value); |
| 2014 } |
| 2015 |
| 2016 /** |
| 2017 * A constructor declaration. |
| 2018 * |
| 2019 * > constructorDeclaration ::= |
| 2020 * > constructorSignature [FunctionBody]? |
| 2021 * > | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])
? arguments |
| 2022 * > |
| 2023 * > constructorSignature ::= |
| 2024 * > 'external'? constructorName formalParameterList initializerList? |
| 2025 * > | 'external'? 'factory' factoryName formalParameterList initializerList? |
| 2026 * > | 'external'? 'const' constructorName formalParameterList initializerLis
t? |
| 2027 * > |
| 2028 * > constructorName ::= |
| 2029 * > [SimpleIdentifier] ('.' [SimpleIdentifier])? |
| 2030 * > |
| 2031 * > factoryName ::= |
| 2032 * > [Identifier] ('.' [SimpleIdentifier])? |
| 2033 * > |
| 2034 * > initializerList ::= |
| 2035 * > ':' [ConstructorInitializer] (',' [ConstructorInitializer])* |
| 2036 * |
| 2037 * Clients may not extend, implement or mix-in this class. |
| 2038 */ |
| 2039 abstract class ConstructorDeclaration extends ClassMember { |
| 2040 /** |
| 2041 * Initialize a newly created constructor declaration. The [externalKeyword] |
| 2042 * can be `null` if the constructor is not external. Either or both of the |
| 2043 * [comment] and [metadata] can be `null` if the constructor does not have the |
| 2044 * corresponding attribute. The [constKeyword] can be `null` if the |
| 2045 * constructor cannot be used to create a constant. The [factoryKeyword] can |
| 2046 * be `null` if the constructor is not a factory. The [period] and [name] can |
| 2047 * both be `null` if the constructor is not a named constructor. The |
| 2048 * [separator] can be `null` if the constructor does not have any initializers |
| 2049 * and does not redirect to a different constructor. The list of |
| 2050 * [initializers] can be `null` if the constructor does not have any |
| 2051 * initializers. The [redirectedConstructor] can be `null` if the constructor |
| 2052 * does not redirect to a different constructor. The [body] can be `null` if |
| 2053 * the constructor does not have a body. |
| 2054 */ |
| 2055 factory ConstructorDeclaration( |
| 2056 Comment comment, |
| 2057 List<Annotation> metadata, |
| 2058 Token externalKeyword, |
| 2059 Token constKeyword, |
| 2060 Token factoryKeyword, |
| 2061 Identifier returnType, |
| 2062 Token period, |
| 2063 SimpleIdentifier name, |
| 2064 FormalParameterList parameters, |
| 2065 Token separator, |
| 2066 List<ConstructorInitializer> initializers, |
| 2067 ConstructorName redirectedConstructor, |
| 2068 FunctionBody body) = ConstructorDeclarationImpl; |
| 2069 |
| 2070 /** |
| 2071 * Return the body of the constructor, or `null` if the constructor does not |
| 2072 * have a body. |
| 2073 */ |
| 2074 FunctionBody get body; |
| 2075 |
| 2076 /** |
| 2077 * Set the body of the constructor to the given [functionBody]. |
| 2078 */ |
| 2079 void set body(FunctionBody functionBody); |
| 2080 |
| 2081 /** |
| 2082 * Return the token for the 'const' keyword, or `null` if the constructor is |
| 2083 * not a const constructor. |
| 2084 */ |
| 2085 Token get constKeyword; |
| 2086 |
| 2087 /** |
| 2088 * Set the token for the 'const' keyword to the given [token]. |
| 2089 */ |
| 2090 void set constKeyword(Token token); |
| 2091 |
| 2092 @override |
| 2093 ConstructorElement get element; |
| 2094 |
| 2095 /** |
| 2096 * Set the element associated with this constructor to the given [element]. |
| 2097 */ |
| 2098 void set element(ConstructorElement element); |
| 2099 |
| 2100 /** |
| 2101 * Return the token for the 'external' keyword to the given [token]. |
| 2102 */ |
| 2103 Token get externalKeyword; |
| 2104 |
| 2105 /** |
| 2106 * Set the token for the 'external' keyword, or `null` if the constructor |
| 2107 * is not external. |
| 2108 */ |
| 2109 void set externalKeyword(Token token); |
| 2110 |
| 2111 /** |
| 2112 * Return the token for the 'factory' keyword, or `null` if the constructor is |
| 2113 * not a factory constructor. |
| 2114 */ |
| 2115 Token get factoryKeyword; |
| 2116 |
| 2117 /** |
| 2118 * Set the token for the 'factory' keyword to the given [token]. |
| 2119 */ |
| 2120 void set factoryKeyword(Token token); |
| 2121 |
| 2122 /** |
| 2123 * Return the initializers associated with the constructor. |
| 2124 */ |
| 2125 NodeList<ConstructorInitializer> get initializers; |
| 2126 |
| 2127 /** |
| 2128 * Return the name of the constructor, or `null` if the constructor being |
| 2129 * declared is unnamed. |
| 2130 */ |
| 2131 SimpleIdentifier get name; |
| 2132 |
| 2133 /** |
| 2134 * Set the name of the constructor to the given [identifier]. |
| 2135 */ |
| 2136 void set name(SimpleIdentifier identifier); |
| 2137 |
| 2138 /** |
| 2139 * Return the parameters associated with the constructor. |
| 2140 */ |
| 2141 FormalParameterList get parameters; |
| 2142 |
| 2143 /** |
| 2144 * Set the parameters associated with the constructor to the given list of |
| 2145 * [parameters]. |
| 2146 */ |
| 2147 void set parameters(FormalParameterList parameters); |
| 2148 |
| 2149 /** |
| 2150 * Return the token for the period before the constructor name, or `null` if |
| 2151 * the constructor being declared is unnamed. |
| 2152 */ |
| 2153 Token get period; |
| 2154 |
| 2155 /** |
| 2156 * Set the token for the period before the constructor name to the given |
| 2157 * [token]. |
| 2158 */ |
| 2159 void set period(Token token); |
| 2160 |
| 2161 /** |
| 2162 * Return the name of the constructor to which this constructor will be |
| 2163 * redirected, or `null` if this is not a redirecting factory constructor. |
| 2164 */ |
| 2165 ConstructorName get redirectedConstructor; |
| 2166 |
| 2167 /** |
| 2168 * Set the name of the constructor to which this constructor will be |
| 2169 * redirected to the given [redirectedConstructor] name. |
| 2170 */ |
| 2171 void set redirectedConstructor(ConstructorName redirectedConstructor); |
| 2172 |
| 2173 /** |
| 2174 * Return the type of object being created. This can be different than the |
| 2175 * type in which the constructor is being declared if the constructor is the |
| 2176 * implementation of a factory constructor. |
| 2177 */ |
| 2178 Identifier get returnType; |
| 2179 |
| 2180 /** |
| 2181 * Set the type of object being created to the given [typeName]. |
| 2182 */ |
| 2183 void set returnType(Identifier typeName); |
| 2184 |
| 2185 /** |
| 2186 * Return the token for the separator (colon or equals) before the initializer |
| 2187 * list or redirection, or `null` if there are no initializers. |
| 2188 */ |
| 2189 Token get separator; |
| 2190 |
| 2191 /** |
| 2192 * Set the token for the separator (colon or equals) before the initializer |
| 2193 * list or redirection to the given [token]. |
| 2194 */ |
| 2195 void set separator(Token token); |
| 2196 } |
| 2197 |
| 2198 /** |
| 2199 * The initialization of a field within a constructor's initialization list. |
| 2200 * |
| 2201 * > fieldInitializer ::= |
| 2202 * > ('this' '.')? [SimpleIdentifier] '=' [Expression] |
| 2203 * |
| 2204 * Clients may not extend, implement or mix-in this class. |
| 2205 */ |
| 2206 abstract class ConstructorFieldInitializer extends ConstructorInitializer { |
| 2207 /** |
| 2208 * Initialize a newly created field initializer to initialize the field with |
| 2209 * the given name to the value of the given expression. The [thisKeyword] and |
| 2210 * [period] can be `null` if the 'this' keyword was not specified. |
| 2211 */ |
| 2212 factory ConstructorFieldInitializer( |
| 2213 Token thisKeyword, |
| 2214 Token period, |
| 2215 SimpleIdentifier fieldName, |
| 2216 Token equals, |
| 2217 Expression expression) = ConstructorFieldInitializerImpl; |
| 2218 |
| 2219 /** |
| 2220 * Return the token for the equal sign between the field name and the |
| 2221 * expression. |
| 2222 */ |
| 2223 Token get equals; |
| 2224 |
| 2225 /** |
| 2226 * Set the token for the equal sign between the field name and the |
| 2227 * expression to the given [token]. |
| 2228 */ |
| 2229 void set equals(Token token); |
| 2230 |
| 2231 /** |
| 2232 * Return the expression computing the value to which the field will be |
| 2233 * initialized. |
| 2234 */ |
| 2235 Expression get expression; |
| 2236 |
| 2237 /** |
| 2238 * Set the expression computing the value to which the field will be |
| 2239 * initialized to the given [expression]. |
| 2240 */ |
| 2241 void set expression(Expression expression); |
| 2242 |
| 2243 /** |
| 2244 * Return the name of the field being initialized. |
| 2245 */ |
| 2246 SimpleIdentifier get fieldName; |
| 2247 |
| 2248 /** |
| 2249 * Set the name of the field being initialized to the given [identifier]. |
| 2250 */ |
| 2251 void set fieldName(SimpleIdentifier identifier); |
| 2252 |
| 2253 /** |
| 2254 * Return the token for the period after the 'this' keyword, or `null` if |
| 2255 * there is no 'this' keyword. |
| 2256 */ |
| 2257 Token get period; |
| 2258 |
| 2259 /** |
| 2260 * Set the token for the period after the 'this' keyword to the given [token]. |
| 2261 */ |
| 2262 void set period(Token token); |
| 2263 |
| 2264 /** |
| 2265 * Return the token for the 'this' keyword, or `null` if there is no 'this' |
| 2266 * keyword. |
| 2267 */ |
| 2268 Token get thisKeyword; |
| 2269 |
| 2270 /** |
| 2271 * Set the token for the 'this' keyword to the given [token]. |
| 2272 */ |
| 2273 void set thisKeyword(Token token); |
| 2274 } |
| 2275 |
| 2276 /** |
| 2277 * A node that can occur in the initializer list of a constructor declaration. |
| 2278 * |
| 2279 * > constructorInitializer ::= |
| 2280 * > [SuperConstructorInvocation] |
| 2281 * > | [ConstructorFieldInitializer] |
| 2282 * > | [RedirectingConstructorInvocation] |
| 2283 * |
| 2284 * Clients may not extend, implement or mix-in this class. |
| 2285 */ |
| 2286 abstract class ConstructorInitializer extends AstNode {} |
| 2287 |
| 2288 /** |
| 2289 * The name of a constructor. |
| 2290 * |
| 2291 * > constructorName ::= |
| 2292 * > type ('.' identifier)? |
| 2293 * |
| 2294 * Clients may not extend, implement or mix-in this class. |
| 2295 */ |
| 2296 abstract class ConstructorName extends AstNode { |
| 2297 /** |
| 2298 * Initialize a newly created constructor name. The [period] and [name] can be |
| 2299 * `null` if the constructor being named is the unnamed constructor. |
| 2300 */ |
| 2301 factory ConstructorName(TypeName type, Token period, SimpleIdentifier name) = |
| 2302 ConstructorNameImpl; |
| 2303 |
| 2304 /** |
| 2305 * Return the name of the constructor, or `null` if the specified constructor |
| 2306 * is the unnamed constructor. |
| 2307 */ |
| 2308 SimpleIdentifier get name; |
| 2309 |
| 2310 /** |
| 2311 * Set the name of the constructor to the given [name]. |
| 2312 */ |
| 2313 void set name(SimpleIdentifier name); |
| 2314 |
| 2315 /** |
| 2316 * Return the token for the period before the constructor name, or `null` if |
| 2317 * the specified constructor is the unnamed constructor. |
| 2318 */ |
| 2319 Token get period; |
| 2320 |
| 2321 /** |
| 2322 * Set the token for the period before the constructor name to the given |
| 2323 * [token]. |
| 2324 */ |
| 2325 void set period(Token token); |
| 2326 |
| 2327 /** |
| 2328 * Return the element associated with this constructor name based on static |
| 2329 * type information, or `null` if the AST structure has not been resolved or |
| 2330 * if this constructor name could not be resolved. |
| 2331 */ |
| 2332 ConstructorElement get staticElement; |
| 2333 |
| 2334 /** |
| 2335 * Set the element associated with this constructor name based on static type |
| 2336 * information to the given [element]. |
| 2337 */ |
| 2338 void set staticElement(ConstructorElement element); |
| 2339 |
| 2340 /** |
| 2341 * Return the name of the type defining the constructor. |
| 2342 */ |
| 2343 TypeName get type; |
| 2344 |
| 2345 /** |
| 2346 * Set the name of the type defining the constructor to the given [type] name. |
| 2347 */ |
| 2348 void set type(TypeName type); |
| 2349 } |
| 2350 |
| 2351 /** |
| 2352 * A continue statement. |
| 2353 * |
| 2354 * > continueStatement ::= |
| 2355 * > 'continue' [SimpleIdentifier]? ';' |
| 2356 * |
| 2357 * Clients may not extend, implement or mix-in this class. |
| 2358 */ |
| 2359 abstract class ContinueStatement extends Statement { |
| 2360 /** |
| 2361 * Initialize a newly created continue statement. The [label] can be `null` if |
| 2362 * there is no label associated with the statement. |
| 2363 */ |
| 2364 factory ContinueStatement( |
| 2365 Token continueKeyword, SimpleIdentifier label, Token semicolon) = |
| 2366 ContinueStatementImpl; |
| 2367 |
| 2368 /** |
| 2369 * Return the token representing the 'continue' keyword. |
| 2370 */ |
| 2371 Token get continueKeyword; |
| 2372 |
| 2373 /** |
| 2374 * Set the token representing the 'continue' keyword to the given [token]. |
| 2375 */ |
| 2376 void set continueKeyword(Token token); |
| 2377 |
| 2378 /** |
| 2379 * Return the label associated with the statement, or `null` if there is no |
| 2380 * label. |
| 2381 */ |
| 2382 SimpleIdentifier get label; |
| 2383 |
| 2384 /** |
| 2385 * Set the label associated with the statement to the given [identifier]. |
| 2386 */ |
| 2387 void set label(SimpleIdentifier identifier); |
| 2388 |
| 2389 /** |
| 2390 * Return the semicolon terminating the statement. |
| 2391 */ |
| 2392 Token get semicolon; |
| 2393 |
| 2394 /** |
| 2395 * Set the semicolon terminating the statement to the given [token]. |
| 2396 */ |
| 2397 void set semicolon(Token token); |
| 2398 |
| 2399 /** |
| 2400 * Return the node to which this continue statement is continuing. This will |
| 2401 * be either a [Statement] (in the case of continuing a loop), a |
| 2402 * [SwitchMember] (in the case of continuing from one switch case to another), |
| 2403 * or `null` if the AST has not yet been resolved or if the target could not |
| 2404 * be resolved. Note that if the source code has errors, the target might be |
| 2405 * invalid (e.g. the target may be in an enclosing function). |
| 2406 */ |
| 2407 AstNode get target; |
| 2408 |
| 2409 /** |
| 2410 * Set the node to which this continue statement is continuing to the given |
| 2411 * [node]. |
| 2412 */ |
| 2413 void set target(AstNode node); |
| 2414 } |
| 2415 |
| 2416 /** |
| 2417 * A node that represents the declaration of one or more names. Each declared |
| 2418 * name is visible within a name scope. |
| 2419 * |
| 2420 * Clients may not extend, implement or mix-in this class. |
| 2421 */ |
| 2422 abstract class Declaration extends AnnotatedNode { |
| 2423 /** |
| 2424 * Return the element associated with this declaration, or `null` if either |
| 2425 * this node corresponds to a list of declarations or if the AST structure has |
| 2426 * not been resolved. |
| 2427 */ |
| 2428 Element get element; |
| 2429 } |
| 2430 |
| 2431 /** |
| 2432 * The declaration of a single identifier. |
| 2433 * |
| 2434 * > declaredIdentifier ::= |
| 2435 * > [Annotation] finalConstVarOrType [SimpleIdentifier] |
| 2436 * |
| 2437 * Clients may not extend, implement or mix-in this class. |
| 2438 */ |
| 2439 abstract class DeclaredIdentifier extends Declaration { |
| 2440 /** |
| 2441 * Initialize a newly created formal parameter. Either or both of the |
| 2442 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 2443 * corresponding attribute. The [keyword] can be `null` if a type name is |
| 2444 * given. The [type] must be `null` if the keyword is 'var'. |
| 2445 */ |
| 2446 factory DeclaredIdentifier( |
| 2447 Comment comment, |
| 2448 List<Annotation> metadata, |
| 2449 Token keyword, |
| 2450 TypeName type, |
| 2451 SimpleIdentifier identifier) = DeclaredIdentifierImpl; |
| 2452 |
| 2453 @override |
| 2454 LocalVariableElement get element; |
| 2455 |
| 2456 /** |
| 2457 * Return the name of the variable being declared. |
| 2458 */ |
| 2459 SimpleIdentifier get identifier; |
| 2460 |
| 2461 /** |
| 2462 * Set the name of the variable being declared to the given [identifier]. |
| 2463 */ |
| 2464 void set identifier(SimpleIdentifier identifier); |
| 2465 |
| 2466 /** |
| 2467 * Return `true` if this variable was declared with the 'const' modifier. |
| 2468 */ |
| 2469 bool get isConst; |
| 2470 |
| 2471 /** |
| 2472 * Return `true` if this variable was declared with the 'final' modifier. |
| 2473 * Variables that are declared with the 'const' modifier will return `false` |
| 2474 * even though they are implicitly final. |
| 2475 */ |
| 2476 bool get isFinal; |
| 2477 |
| 2478 /** |
| 2479 * Return the token representing either the 'final', 'const' or 'var' keyword, |
| 2480 * or `null` if no keyword was used. |
| 2481 */ |
| 2482 Token get keyword; |
| 2483 |
| 2484 /** |
| 2485 * Set the token representing either the 'final', 'const' or 'var' keyword to |
| 2486 * the given [token]. |
| 2487 */ |
| 2488 void set keyword(Token token); |
| 2489 |
| 2490 /** |
| 2491 * Return the name of the declared type of the parameter, or `null` if the |
| 2492 * parameter does not have a declared type. |
| 2493 */ |
| 2494 TypeName get type; |
| 2495 |
| 2496 /** |
| 2497 * Set the name of the declared type of the parameter to the given [typeName]. |
| 2498 */ |
| 2499 void set type(TypeName typeName); |
| 2500 } |
| 2501 |
| 2502 /** |
| 2503 * A formal parameter with a default value. There are two kinds of parameters |
| 2504 * that are both represented by this class: named formal parameters and |
| 2505 * positional formal parameters. |
| 2506 * |
| 2507 * > defaultFormalParameter ::= |
| 2508 * > [NormalFormalParameter] ('=' [Expression])? |
| 2509 * > |
| 2510 * > defaultNamedParameter ::= |
| 2511 * > [NormalFormalParameter] (':' [Expression])? |
| 2512 * |
| 2513 * Clients may not extend, implement or mix-in this class. |
| 2514 */ |
| 2515 abstract class DefaultFormalParameter extends FormalParameter { |
| 2516 /** |
| 2517 * Initialize a newly created default formal parameter. The [separator] and |
| 2518 * [defaultValue] can be `null` if there is no default value. |
| 2519 */ |
| 2520 factory DefaultFormalParameter( |
| 2521 NormalFormalParameter parameter, |
| 2522 ParameterKind kind, |
| 2523 Token separator, |
| 2524 Expression defaultValue) = DefaultFormalParameterImpl; |
| 2525 |
| 2526 /** |
| 2527 * Return the expression computing the default value for the parameter, or |
| 2528 * `null` if there is no default value. |
| 2529 */ |
| 2530 Expression get defaultValue; |
| 2531 |
| 2532 /** |
| 2533 * Set the expression computing the default value for the parameter to the |
| 2534 * given [expression]. |
| 2535 */ |
| 2536 void set defaultValue(Expression expression); |
| 2537 |
| 2538 /** |
| 2539 * Set the kind of this parameter to the given [kind]. |
| 2540 */ |
| 2541 void set kind(ParameterKind kind); |
| 2542 |
| 2543 /** |
| 2544 * Return the formal parameter with which the default value is associated. |
| 2545 */ |
| 2546 NormalFormalParameter get parameter; |
| 2547 |
| 2548 /** |
| 2549 * Set the formal parameter with which the default value is associated to the |
| 2550 * given [formalParameter]. |
| 2551 */ |
| 2552 void set parameter(NormalFormalParameter formalParameter); |
| 2553 |
| 2554 /** |
| 2555 * Return the token separating the parameter from the default value, or `null` |
| 2556 * if there is no default value. |
| 2557 */ |
| 2558 Token get separator; |
| 2559 |
| 2560 /** |
| 2561 * Set the token separating the parameter from the default value to the given |
| 2562 * [token]. |
| 2563 */ |
| 2564 void set separator(Token token); |
| 2565 } |
| 2566 |
| 2567 /** |
| 2568 * A node that represents a directive. |
| 2569 * |
| 2570 * > directive ::= |
| 2571 * > [ExportDirective] |
| 2572 * > | [ImportDirective] |
| 2573 * > | [LibraryDirective] |
| 2574 * > | [PartDirective] |
| 2575 * > | [PartOfDirective] |
| 2576 * |
| 2577 * Clients may not extend, implement or mix-in this class. |
| 2578 */ |
| 2579 abstract class Directive extends AnnotatedNode { |
| 2580 /** |
| 2581 * Return the element associated with this directive, or `null` if the AST |
| 2582 * structure has not been resolved or if this directive could not be resolved. |
| 2583 */ |
| 2584 Element get element; |
| 2585 |
| 2586 /** |
| 2587 * Set the element associated with this directive to the given [element]. |
| 2588 */ |
| 2589 void set element(Element element); |
| 2590 |
| 2591 /** |
| 2592 * Return the token representing the keyword that introduces this directive |
| 2593 * ('import', 'export', 'library' or 'part'). |
| 2594 */ |
| 2595 Token get keyword; |
| 2596 } |
| 2597 |
| 2598 /** |
| 2599 * A do statement. |
| 2600 * |
| 2601 * > doStatement ::= |
| 2602 * > 'do' [Statement] 'while' '(' [Expression] ')' ';' |
| 2603 * |
| 2604 * Clients may not extend, implement or mix-in this class. |
| 2605 */ |
| 2606 abstract class DoStatement extends Statement { |
| 2607 /** |
| 2608 * Initialize a newly created do loop. |
| 2609 */ |
| 2610 factory DoStatement( |
| 2611 Token doKeyword, |
| 2612 Statement body, |
| 2613 Token whileKeyword, |
| 2614 Token leftParenthesis, |
| 2615 Expression condition, |
| 2616 Token rightParenthesis, |
| 2617 Token semicolon) = DoStatementImpl; |
| 2618 |
| 2619 /** |
| 2620 * Return the body of the loop. |
| 2621 */ |
| 2622 Statement get body; |
| 2623 |
| 2624 /** |
| 2625 * Set the body of the loop to the given [statement]. |
| 2626 */ |
| 2627 void set body(Statement statement); |
| 2628 |
| 2629 /** |
| 2630 * Return the condition that determines when the loop will terminate. |
| 2631 */ |
| 2632 Expression get condition; |
| 2633 |
| 2634 /** |
| 2635 * Set the condition that determines when the loop will terminate to the given |
| 2636 * [expression]. |
| 2637 */ |
| 2638 void set condition(Expression expression); |
| 2639 |
| 2640 /** |
| 2641 * Return the token representing the 'do' keyword. |
| 2642 */ |
| 2643 Token get doKeyword; |
| 2644 |
| 2645 /** |
| 2646 * Set the token representing the 'do' keyword to the given [token]. |
| 2647 */ |
| 2648 void set doKeyword(Token token); |
| 2649 |
| 2650 /** |
| 2651 * Return the left parenthesis. |
| 2652 */ |
| 2653 Token get leftParenthesis; |
| 2654 |
| 2655 /** |
| 2656 * Set the left parenthesis to the given [token]. |
| 2657 */ |
| 2658 void set leftParenthesis(Token token); |
| 2659 |
| 2660 /** |
| 2661 * Return the right parenthesis. |
| 2662 */ |
| 2663 Token get rightParenthesis; |
| 2664 |
| 2665 /** |
| 2666 * Set the right parenthesis to the given [token]. |
| 2667 */ |
| 2668 void set rightParenthesis(Token token); |
| 2669 |
| 2670 /** |
| 2671 * Return the semicolon terminating the statement. |
| 2672 */ |
| 2673 Token get semicolon; |
| 2674 |
| 2675 /** |
| 2676 * Set the semicolon terminating the statement to the given [token]. |
| 2677 */ |
| 2678 void set semicolon(Token token); |
| 2679 |
| 2680 /** |
| 2681 * Return the token representing the 'while' keyword. |
| 2682 */ |
| 2683 Token get whileKeyword; |
| 2684 |
| 2685 /** |
| 2686 * Set the token representing the 'while' keyword to the given [token]. |
| 2687 */ |
| 2688 void set whileKeyword(Token token); |
| 2689 } |
| 2690 |
| 2691 /** |
| 2692 * A dotted name, used in a configuration within an import or export directive. |
| 2693 * |
| 2694 * > dottedName ::= |
| 2695 * > [SimpleIdentifier] ('.' [SimpleIdentifier])* |
| 2696 * |
| 2697 * Clients may not extend, implement or mix-in this class. |
| 2698 */ |
| 2699 abstract class DottedName extends AstNode { |
| 2700 /** |
| 2701 * Initialize a newly created dotted name. |
| 2702 */ |
| 2703 factory DottedName(List<SimpleIdentifier> components) = DottedNameImpl; |
| 2704 |
| 2705 /** |
| 2706 * Return the components of the identifier. |
| 2707 */ |
| 2708 NodeList<SimpleIdentifier> get components; |
| 2709 } |
| 2710 |
| 2711 /** |
| 2712 * A floating point literal expression. |
| 2713 * |
| 2714 * > doubleLiteral ::= |
| 2715 * > decimalDigit+ ('.' decimalDigit*)? exponent? |
| 2716 * > | '.' decimalDigit+ exponent? |
| 2717 * > |
| 2718 * > exponent ::= |
| 2719 * > ('e' | 'E') ('+' | '-')? decimalDigit+ |
| 2720 * |
| 2721 * Clients may not extend, implement or mix-in this class. |
| 2722 */ |
| 2723 abstract class DoubleLiteral extends Literal { |
| 2724 /** |
| 2725 * Initialize a newly created floating point literal. |
| 2726 */ |
| 2727 factory DoubleLiteral(Token literal, double value) = DoubleLiteralImpl; |
| 2728 |
| 2729 /** |
| 2730 * Return the token representing the literal. |
| 2731 */ |
| 2732 Token get literal; |
| 2733 |
| 2734 /** |
| 2735 * Set the token representing the literal to the given [token]. |
| 2736 */ |
| 2737 void set literal(Token token); |
| 2738 |
| 2739 /** |
| 2740 * Return the value of the literal. |
| 2741 */ |
| 2742 double get value; |
| 2743 |
| 2744 /** |
| 2745 * Set the value of the literal to the given [value]. |
| 2746 */ |
| 2747 void set value(double value); |
| 2748 } |
| 2749 |
| 2750 /** |
| 2751 * An empty function body, which can only appear in constructors or abstract |
| 2752 * methods. |
| 2753 * |
| 2754 * > emptyFunctionBody ::= |
| 2755 * > ';' |
| 2756 * |
| 2757 * Clients may not extend, implement or mix-in this class. |
| 2758 */ |
| 2759 abstract class EmptyFunctionBody extends FunctionBody { |
| 2760 /** |
| 2761 * Initialize a newly created function body. |
| 2762 */ |
| 2763 factory EmptyFunctionBody(Token semicolon) = EmptyFunctionBodyImpl; |
| 2764 |
| 2765 /** |
| 2766 * Return the token representing the semicolon that marks the end of the |
| 2767 * function body. |
| 2768 */ |
| 2769 Token get semicolon; |
| 2770 |
| 2771 /** |
| 2772 * Set the token representing the semicolon that marks the end of the |
| 2773 * function body to the given [token]. |
| 2774 */ |
| 2775 void set semicolon(Token token); |
| 2776 } |
| 2777 |
| 2778 /** |
| 2779 * An empty statement. |
| 2780 * |
| 2781 * > emptyStatement ::= |
| 2782 * > ';' |
| 2783 * |
| 2784 * Clients may not extend, implement or mix-in this class. |
| 2785 */ |
| 2786 abstract class EmptyStatement extends Statement { |
| 2787 /** |
| 2788 * Initialize a newly created empty statement. |
| 2789 */ |
| 2790 factory EmptyStatement(Token semicolon) = EmptyStatementImpl; |
| 2791 |
| 2792 /** |
| 2793 * Return the semicolon terminating the statement. |
| 2794 */ |
| 2795 Token get semicolon; |
| 2796 |
| 2797 /** |
| 2798 * Set the semicolon terminating the statement to the given [token]. |
| 2799 */ |
| 2800 void set semicolon(Token token); |
| 2801 } |
| 2802 |
| 2803 /** |
| 2804 * The declaration of an enum constant. |
| 2805 * |
| 2806 * Clients may not extend, implement or mix-in this class. |
| 2807 */ |
| 2808 abstract class EnumConstantDeclaration extends Declaration { |
| 2809 /** |
| 2810 * Initialize a newly created enum constant declaration. Either or both of the |
| 2811 * [comment] and [metadata] can be `null` if the constant does not have the |
| 2812 * corresponding attribute. (Technically, enum constants cannot have metadata, |
| 2813 * but we allow it for consistency.) |
| 2814 */ |
| 2815 factory EnumConstantDeclaration( |
| 2816 Comment comment, List<Annotation> metadata, SimpleIdentifier name) = |
| 2817 EnumConstantDeclarationImpl; |
| 2818 |
| 2819 /** |
| 2820 * Return the name of the constant. |
| 2821 */ |
| 2822 SimpleIdentifier get name; |
| 2823 |
| 2824 /** |
| 2825 * Set the name of the constant to the given [name]. |
| 2826 */ |
| 2827 void set name(SimpleIdentifier name); |
| 2828 } |
| 2829 |
| 2830 /** |
| 2831 * The declaration of an enumeration. |
| 2832 * |
| 2833 * > enumType ::= |
| 2834 * > metadata 'enum' [SimpleIdentifier] '{' [SimpleIdentifier] (',' [SimpleI
dentifier])* (',')? '}' |
| 2835 * |
| 2836 * Clients may not extend, implement or mix-in this class. |
| 2837 */ |
| 2838 abstract class EnumDeclaration extends NamedCompilationUnitMember { |
| 2839 /** |
| 2840 * Initialize a newly created enumeration declaration. Either or both of the |
| 2841 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 2842 * corresponding attribute. The list of [constants] must contain at least one |
| 2843 * value. |
| 2844 */ |
| 2845 factory EnumDeclaration( |
| 2846 Comment comment, |
| 2847 List<Annotation> metadata, |
| 2848 Token enumKeyword, |
| 2849 SimpleIdentifier name, |
| 2850 Token leftBracket, |
| 2851 List<EnumConstantDeclaration> constants, |
| 2852 Token rightBracket) = EnumDeclarationImpl; |
| 2853 |
| 2854 /** |
| 2855 * Return the enumeration constants being declared. |
| 2856 */ |
| 2857 NodeList<EnumConstantDeclaration> get constants; |
| 2858 |
| 2859 /** |
| 2860 * Return the 'enum' keyword. |
| 2861 */ |
| 2862 Token get enumKeyword; |
| 2863 |
| 2864 /** |
| 2865 * Set the 'enum' keyword to the given [token]. |
| 2866 */ |
| 2867 void set enumKeyword(Token token); |
| 2868 |
| 2869 /** |
| 2870 * Return the left curly bracket. |
| 2871 */ |
| 2872 Token get leftBracket; |
| 2873 |
| 2874 /** |
| 2875 * Set the left curly bracket to the given [token]. |
| 2876 */ |
| 2877 void set leftBracket(Token token); |
| 2878 |
| 2879 /** |
| 2880 * Return the right curly bracket. |
| 2881 */ |
| 2882 Token get rightBracket; |
| 2883 |
| 2884 /** |
| 2885 * Set the right curly bracket to the given [token]. |
| 2886 */ |
| 2887 void set rightBracket(Token token); |
| 2888 } |
| 2889 |
| 2890 /** |
| 2891 * An export directive. |
| 2892 * |
| 2893 * > exportDirective ::= |
| 2894 * > [Annotation] 'export' [StringLiteral] [Combinator]* ';' |
| 2895 * |
| 2896 * Clients may not extend, implement or mix-in this class. |
| 2897 */ |
| 2898 abstract class ExportDirective extends NamespaceDirective { |
| 2899 /** |
| 2900 * Initialize a newly created export directive. Either or both of the |
| 2901 * [comment] and [metadata] can be `null` if the directive does not have the |
| 2902 * corresponding attribute. The list of [combinators] can be `null` if there |
| 2903 * are no combinators. |
| 2904 */ |
| 2905 factory ExportDirective( |
| 2906 Comment comment, |
| 2907 List<Annotation> metadata, |
| 2908 Token keyword, |
| 2909 StringLiteral libraryUri, |
| 2910 List<Configuration> configurations, |
| 2911 List<Combinator> combinators, |
| 2912 Token semicolon) = ExportDirectiveImpl; |
| 2913 } |
| 2914 |
| 2915 /** |
| 2916 * A node that represents an expression. |
| 2917 * |
| 2918 * > expression ::= |
| 2919 * > [AssignmentExpression] |
| 2920 * > | [ConditionalExpression] cascadeSection* |
| 2921 * > | [ThrowExpression] |
| 2922 * |
| 2923 * Clients may not extend, implement or mix-in this class. |
| 2924 */ |
| 2925 abstract class Expression extends AstNode { |
| 2926 /** |
| 2927 * An empty list of expressions. |
| 2928 */ |
| 2929 static const List<Expression> EMPTY_LIST = const <Expression>[]; |
| 2930 |
| 2931 /** |
| 2932 * Return the best parameter element information available for this |
| 2933 * expression. If type propagation was able to find a better parameter element |
| 2934 * than static analysis, that type will be returned. Otherwise, the result of |
| 2935 * static analysis will be returned. |
| 2936 */ |
| 2937 ParameterElement get bestParameterElement; |
| 2938 |
| 2939 /** |
| 2940 * Return the best type information available for this expression. If type |
| 2941 * propagation was able to find a better type than static analysis, that type |
| 2942 * will be returned. Otherwise, the result of static analysis will be |
| 2943 * returned. If no type analysis has been performed, then the type 'dynamic' |
| 2944 * will be returned. |
| 2945 */ |
| 2946 DartType get bestType; |
| 2947 |
| 2948 /** |
| 2949 * Return `true` if this expression is syntactically valid for the LHS of an |
| 2950 * [AssignmentExpression]. |
| 2951 */ |
| 2952 bool get isAssignable; |
| 2953 |
| 2954 /** |
| 2955 * Return the precedence of this expression. The precedence is a positive |
| 2956 * integer value that defines how the source code is parsed into an AST. For |
| 2957 * example `a * b + c` is parsed as `(a * b) + c` because the precedence of |
| 2958 * `*` is greater than the precedence of `+`. |
| 2959 * |
| 2960 * Clients should not assume that returned values will stay the same, they |
| 2961 * might change as result of specification change. Only relative order should |
| 2962 * be used. |
| 2963 */ |
| 2964 int get precedence; |
| 2965 |
| 2966 /** |
| 2967 * If this expression is an argument to an invocation, and the AST structure |
| 2968 * has been resolved, and the function being invoked is known based on |
| 2969 * propagated type information, and this expression corresponds to one of the |
| 2970 * parameters of the function being invoked, then return the parameter element |
| 2971 * representing the parameter to which the value of this expression will be |
| 2972 * bound. Otherwise, return `null`. |
| 2973 */ |
| 2974 ParameterElement get propagatedParameterElement; |
| 2975 |
| 2976 /** |
| 2977 * Return the propagated type of this expression, or `null` if type |
| 2978 * propagation has not been performed on the AST structure. |
| 2979 */ |
| 2980 DartType get propagatedType; |
| 2981 |
| 2982 /** |
| 2983 * Set the propagated type of this expression to the given [type]. |
| 2984 */ |
| 2985 void set propagatedType(DartType type); |
| 2986 |
| 2987 /** |
| 2988 * If this expression is an argument to an invocation, and the AST structure |
| 2989 * has been resolved, and the function being invoked is known based on static |
| 2990 * type information, and this expression corresponds to one of the parameters |
| 2991 * of the function being invoked, then return the parameter element |
| 2992 * representing the parameter to which the value of this expression will be |
| 2993 * bound. Otherwise, return `null`. |
| 2994 */ |
| 2995 ParameterElement get staticParameterElement; |
| 2996 |
| 2997 /** |
| 2998 * Return the static type of this expression, or `null` if the AST structure |
| 2999 * has not been resolved. |
| 3000 */ |
| 3001 DartType get staticType; |
| 3002 |
| 3003 /** |
| 3004 * Set the static type of this expression to the given [type]. |
| 3005 */ |
| 3006 void set staticType(DartType type); |
| 3007 } |
| 3008 |
| 3009 /** |
| 3010 * A function body consisting of a single expression. |
| 3011 * |
| 3012 * > expressionFunctionBody ::= |
| 3013 * > 'async'? '=>' [Expression] ';' |
| 3014 * |
| 3015 * Clients may not extend, implement or mix-in this class. |
| 3016 */ |
| 3017 abstract class ExpressionFunctionBody extends FunctionBody { |
| 3018 /** |
| 3019 * Initialize a newly created function body consisting of a block of |
| 3020 * statements. The [keyword] can be `null` if the function body is not an |
| 3021 * async function body. |
| 3022 */ |
| 3023 factory ExpressionFunctionBody(Token keyword, Token functionDefinition, |
| 3024 Expression expression, Token semicolon) = ExpressionFunctionBodyImpl; |
| 3025 |
| 3026 /** |
| 3027 * Return the expression representing the body of the function. |
| 3028 */ |
| 3029 Expression get expression; |
| 3030 |
| 3031 /** |
| 3032 * Set the expression representing the body of the function to the given |
| 3033 * [expression]. |
| 3034 */ |
| 3035 void set expression(Expression expression); |
| 3036 |
| 3037 /** |
| 3038 * Return the token introducing the expression that represents the body of the |
| 3039 * function. |
| 3040 */ |
| 3041 Token get functionDefinition; |
| 3042 |
| 3043 /** |
| 3044 * Set the token introducing the expression that represents the body of the |
| 3045 * function to the given [token]. |
| 3046 */ |
| 3047 void set functionDefinition(Token token); |
| 3048 |
| 3049 /** |
| 3050 * Set token representing the 'async' or 'sync' keyword to the given [token]. |
| 3051 */ |
| 3052 void set keyword(Token token); |
| 3053 |
| 3054 /** |
| 3055 * Return the semicolon terminating the statement. |
| 3056 */ |
| 3057 Token get semicolon; |
| 3058 |
| 3059 /** |
| 3060 * Set the semicolon terminating the statement to the given [token]. |
| 3061 */ |
| 3062 void set semicolon(Token token); |
| 3063 } |
| 3064 |
| 3065 /** |
| 3066 * An expression used as a statement. |
| 3067 * |
| 3068 * > expressionStatement ::= |
| 3069 * > [Expression]? ';' |
| 3070 * |
| 3071 * Clients may not extend, implement or mix-in this class. |
| 3072 */ |
| 3073 abstract class ExpressionStatement extends Statement { |
| 3074 /** |
| 3075 * Initialize a newly created expression statement. |
| 3076 */ |
| 3077 factory ExpressionStatement(Expression expression, Token semicolon) = |
| 3078 ExpressionStatementImpl; |
| 3079 |
| 3080 /** |
| 3081 * Return the expression that comprises the statement. |
| 3082 */ |
| 3083 Expression get expression; |
| 3084 |
| 3085 /** |
| 3086 * Set the expression that comprises the statement to the given [expression]. |
| 3087 */ |
| 3088 void set expression(Expression expression); |
| 3089 |
| 3090 /** |
| 3091 * Return the semicolon terminating the statement, or `null` if the expression
is a |
| 3092 * function expression and therefore isn't followed by a semicolon. |
| 3093 */ |
| 3094 Token get semicolon; |
| 3095 |
| 3096 /** |
| 3097 * Set the semicolon terminating the statement to the given [token]. |
| 3098 */ |
| 3099 void set semicolon(Token token); |
| 3100 } |
| 3101 |
| 3102 /** |
| 3103 * The "extends" clause in a class declaration. |
| 3104 * |
| 3105 * > extendsClause ::= |
| 3106 * > 'extends' [TypeName] |
| 3107 * |
| 3108 * Clients may not extend, implement or mix-in this class. |
| 3109 */ |
| 3110 abstract class ExtendsClause extends AstNode { |
| 3111 /** |
| 3112 * Initialize a newly created extends clause. |
| 3113 */ |
| 3114 factory ExtendsClause(Token extendsKeyword, TypeName superclass) = |
| 3115 ExtendsClauseImpl; |
| 3116 |
| 3117 /** |
| 3118 * Return the token representing the 'extends' keyword. |
| 3119 */ |
| 3120 Token get extendsKeyword; |
| 3121 |
| 3122 /** |
| 3123 * Set the token representing the 'extends' keyword to the given [token]. |
| 3124 */ |
| 3125 void set extendsKeyword(Token token); |
| 3126 |
| 3127 /** |
| 3128 * Return the name of the class that is being extended. |
| 3129 */ |
| 3130 TypeName get superclass; |
| 3131 |
| 3132 /** |
| 3133 * Set the name of the class that is being extended to the given [name]. |
| 3134 */ |
| 3135 void set superclass(TypeName name); |
| 3136 } |
| 3137 |
| 3138 /** |
| 3139 * The declaration of one or more fields of the same type. |
| 3140 * |
| 3141 * > fieldDeclaration ::= |
| 3142 * > 'static'? [VariableDeclarationList] ';' |
| 3143 * |
| 3144 * Clients may not extend, implement or mix-in this class. |
| 3145 */ |
| 3146 abstract class FieldDeclaration extends ClassMember { |
| 3147 /** |
| 3148 * Initialize a newly created field declaration. Either or both of the |
| 3149 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 3150 * corresponding attribute. The [staticKeyword] can be `null` if the field is |
| 3151 * not a static field. |
| 3152 */ |
| 3153 factory FieldDeclaration( |
| 3154 Comment comment, |
| 3155 List<Annotation> metadata, |
| 3156 Token staticKeyword, |
| 3157 VariableDeclarationList fieldList, |
| 3158 Token semicolon) = FieldDeclarationImpl; |
| 3159 |
| 3160 /** |
| 3161 * Return the fields being declared. |
| 3162 */ |
| 3163 VariableDeclarationList get fields; |
| 3164 |
| 3165 /** |
| 3166 * Set the fields being declared to the given list of [fields]. |
| 3167 */ |
| 3168 void set fields(VariableDeclarationList fields); |
| 3169 |
| 3170 /** |
| 3171 * Return `true` if the fields are declared to be static. |
| 3172 */ |
| 3173 bool get isStatic; |
| 3174 |
| 3175 /** |
| 3176 * Return the semicolon terminating the declaration. |
| 3177 */ |
| 3178 Token get semicolon; |
| 3179 |
| 3180 /** |
| 3181 * Set the semicolon terminating the declaration to the given [token]. |
| 3182 */ |
| 3183 void set semicolon(Token token); |
| 3184 |
| 3185 /** |
| 3186 * Return the token representing the 'static' keyword, or `null` if the fields |
| 3187 * are not static. |
| 3188 */ |
| 3189 Token get staticKeyword; |
| 3190 |
| 3191 /** |
| 3192 * Set the token representing the 'static' keyword to the given [token]. |
| 3193 */ |
| 3194 void set staticKeyword(Token token); |
| 3195 } |
| 3196 |
| 3197 /** |
| 3198 * A field formal parameter. |
| 3199 * |
| 3200 * > fieldFormalParameter ::= |
| 3201 * > ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? |
| 3202 * > 'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterLis
t])? |
| 3203 * |
| 3204 * Clients may not extend, implement or mix-in this class. |
| 3205 */ |
| 3206 abstract class FieldFormalParameter extends NormalFormalParameter { |
| 3207 /** |
| 3208 * Initialize a newly created formal parameter. Either or both of the |
| 3209 * [comment] and [metadata] can be `null` if the parameter does not have the |
| 3210 * corresponding attribute. The [keyword] can be `null` if there is a type. |
| 3211 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and |
| 3212 * [period] can be `null` if the keyword 'this' was not provided. The |
| 3213 * [parameters] can be `null` if this is not a function-typed field formal |
| 3214 * parameter. |
| 3215 */ |
| 3216 factory FieldFormalParameter( |
| 3217 Comment comment, |
| 3218 List<Annotation> metadata, |
| 3219 Token keyword, |
| 3220 TypeName type, |
| 3221 Token thisKeyword, |
| 3222 Token period, |
| 3223 SimpleIdentifier identifier, |
| 3224 TypeParameterList typeParameters, |
| 3225 FormalParameterList parameters) = FieldFormalParameterImpl; |
| 3226 |
| 3227 /** |
| 3228 * Return the token representing either the 'final', 'const' or 'var' keyword, |
| 3229 * or `null` if no keyword was used. |
| 3230 */ |
| 3231 Token get keyword; |
| 3232 |
| 3233 /** |
| 3234 * Set the token representing either the 'final', 'const' or 'var' keyword to |
| 3235 * the given [token]. |
| 3236 */ |
| 3237 void set keyword(Token token); |
| 3238 |
| 3239 /** |
| 3240 * Return the parameters of the function-typed parameter, or `null` if this is |
| 3241 * not a function-typed field formal parameter. |
| 3242 */ |
| 3243 FormalParameterList get parameters; |
| 3244 |
| 3245 /** |
| 3246 * Set the parameters of the function-typed parameter to the given |
| 3247 * [parameters]. |
| 3248 */ |
| 3249 void set parameters(FormalParameterList parameters); |
| 3250 |
| 3251 /** |
| 3252 * Return the token representing the period. |
| 3253 */ |
| 3254 Token get period; |
| 3255 |
| 3256 /** |
| 3257 * Set the token representing the period to the given [token]. |
| 3258 */ |
| 3259 void set period(Token token); |
| 3260 |
| 3261 /** |
| 3262 * Return the token representing the 'this' keyword. |
| 3263 */ |
| 3264 Token get thisKeyword; |
| 3265 |
| 3266 /** |
| 3267 * Set the token representing the 'this' keyword to the given [token]. |
| 3268 */ |
| 3269 void set thisKeyword(Token token); |
| 3270 |
| 3271 /** |
| 3272 * Return the name of the declared type of the parameter, or `null` if the |
| 3273 * parameter does not have a declared type. Note that if this is a |
| 3274 * function-typed field formal parameter this is the return type of the |
| 3275 * function. |
| 3276 */ |
| 3277 TypeName get type; |
| 3278 |
| 3279 /** |
| 3280 * Set the name of the declared type of the parameter to the given [typeName]. |
| 3281 */ |
| 3282 void set type(TypeName typeName); |
| 3283 |
| 3284 /** |
| 3285 * Return the type parameters associated with this method, or `null` if this |
| 3286 * method is not a generic method. |
| 3287 */ |
| 3288 TypeParameterList get typeParameters; |
| 3289 |
| 3290 /** |
| 3291 * Set the type parameters associated with this method to the given |
| 3292 * [typeParameters]. |
| 3293 */ |
| 3294 void set typeParameters(TypeParameterList typeParameters); |
| 3295 } |
| 3296 |
| 3297 /** |
| 3298 * A for-each statement. |
| 3299 * |
| 3300 * > forEachStatement ::= |
| 3301 * > 'await'? 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block] |
| 3302 * > | 'await'? 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block] |
| 3303 * |
| 3304 * Clients may not extend, implement or mix-in this class. |
| 3305 */ |
| 3306 abstract class ForEachStatement extends Statement { |
| 3307 /** |
| 3308 * Initialize a newly created for-each statement whose loop control variable |
| 3309 * is declared internally (in the for-loop part). The [awaitKeyword] can be |
| 3310 * `null` if this is not an asynchronous for loop. |
| 3311 */ |
| 3312 factory ForEachStatement.withDeclaration( |
| 3313 Token awaitKeyword, |
| 3314 Token forKeyword, |
| 3315 Token leftParenthesis, |
| 3316 DeclaredIdentifier loopVariable, |
| 3317 Token inKeyword, |
| 3318 Expression iterator, |
| 3319 Token rightParenthesis, |
| 3320 Statement body) = ForEachStatementImpl.withDeclaration; |
| 3321 |
| 3322 /** |
| 3323 * Initialize a newly created for-each statement whose loop control variable |
| 3324 * is declared outside the for loop. The [awaitKeyword] can be `null` if this |
| 3325 * is not an asynchronous for loop. |
| 3326 */ |
| 3327 factory ForEachStatement.withReference( |
| 3328 Token awaitKeyword, |
| 3329 Token forKeyword, |
| 3330 Token leftParenthesis, |
| 3331 SimpleIdentifier identifier, |
| 3332 Token inKeyword, |
| 3333 Expression iterator, |
| 3334 Token rightParenthesis, |
| 3335 Statement body) = ForEachStatementImpl.withReference; |
| 3336 |
| 3337 /** |
| 3338 * Return the token representing the 'await' keyword, or `null` if there is no |
| 3339 * 'await' keyword. |
| 3340 */ |
| 3341 Token get awaitKeyword; |
| 3342 |
| 3343 /** |
| 3344 * Set the token representing the 'await' keyword to the given [token]. |
| 3345 */ |
| 3346 void set awaitKeyword(Token token); |
| 3347 |
| 3348 /** |
| 3349 * Return the body of the loop. |
| 3350 */ |
| 3351 Statement get body; |
| 3352 |
| 3353 /** |
| 3354 * Set the body of the loop to the given [statement]. |
| 3355 */ |
| 3356 void set body(Statement statement); |
| 3357 |
| 3358 /** |
| 3359 * Return the token representing the 'for' keyword. |
| 3360 */ |
| 3361 Token get forKeyword; |
| 3362 |
| 3363 /** |
| 3364 * Set the token representing the 'for' keyword to the given [token]. |
| 3365 */ |
| 3366 void set forKeyword(Token token); |
| 3367 |
| 3368 /** |
| 3369 * Return the loop variable, or `null` if the loop variable is declared in the |
| 3370 * 'for'. |
| 3371 */ |
| 3372 SimpleIdentifier get identifier; |
| 3373 |
| 3374 /** |
| 3375 * Set the loop variable to the given [identifier]. |
| 3376 */ |
| 3377 void set identifier(SimpleIdentifier identifier); |
| 3378 |
| 3379 /** |
| 3380 * Return the token representing the 'in' keyword. |
| 3381 */ |
| 3382 Token get inKeyword; |
| 3383 |
| 3384 /** |
| 3385 * Set the token representing the 'in' keyword to the given [token]. |
| 3386 */ |
| 3387 void set inKeyword(Token token); |
| 3388 |
| 3389 /** |
| 3390 * Return the expression evaluated to produce the iterator. |
| 3391 */ |
| 3392 Expression get iterable; |
| 3393 |
| 3394 /** |
| 3395 * Set the expression evaluated to produce the iterator to the given |
| 3396 * [expression]. |
| 3397 */ |
| 3398 void set iterable(Expression expression); |
| 3399 |
| 3400 /** |
| 3401 * Return the left parenthesis. |
| 3402 */ |
| 3403 Token get leftParenthesis; |
| 3404 |
| 3405 /** |
| 3406 * Set the left parenthesis to the given [token]. |
| 3407 */ |
| 3408 void set leftParenthesis(Token token); |
| 3409 |
| 3410 /** |
| 3411 * Return the declaration of the loop variable, or `null` if the loop variable |
| 3412 * is a simple identifier. |
| 3413 */ |
| 3414 DeclaredIdentifier get loopVariable; |
| 3415 |
| 3416 /** |
| 3417 * Set the declaration of the loop variable to the given [variable]. |
| 3418 */ |
| 3419 void set loopVariable(DeclaredIdentifier variable); |
| 3420 |
| 3421 /** |
| 3422 * Return the right parenthesis. |
| 3423 */ |
| 3424 Token get rightParenthesis; |
| 3425 |
| 3426 /** |
| 3427 * Set the right parenthesis to the given [token]. |
| 3428 */ |
| 3429 void set rightParenthesis(Token token); |
| 3430 } |
| 3431 |
| 3432 /** |
| 3433 * A node representing a parameter to a function. |
| 3434 * |
| 3435 * > formalParameter ::= |
| 3436 * > [NormalFormalParameter] |
| 3437 * > | [DefaultFormalParameter] |
| 3438 * |
| 3439 * Clients may not extend, implement or mix-in this class. |
| 3440 */ |
| 3441 abstract class FormalParameter extends AstNode { |
| 3442 /** |
| 3443 * Return the element representing this parameter, or `null` if this parameter |
| 3444 * has not been resolved. |
| 3445 */ |
| 3446 ParameterElement get element; |
| 3447 |
| 3448 /** |
| 3449 * Return the name of the parameter being declared. |
| 3450 */ |
| 3451 SimpleIdentifier get identifier; |
| 3452 |
| 3453 /** |
| 3454 * Return `true` if this parameter was declared with the 'const' modifier. |
| 3455 */ |
| 3456 bool get isConst; |
| 3457 |
| 3458 /** |
| 3459 * Return `true` if this parameter was declared with the 'final' modifier. |
| 3460 * Parameters that are declared with the 'const' modifier will return `false` |
| 3461 * even though they are implicitly final. |
| 3462 */ |
| 3463 bool get isFinal; |
| 3464 |
| 3465 /** |
| 3466 * Return the kind of this parameter. |
| 3467 */ |
| 3468 ParameterKind get kind; |
| 3469 |
| 3470 /** |
| 3471 * Return the annotations associated with this parameter. |
| 3472 */ |
| 3473 NodeList<Annotation> get metadata; |
| 3474 } |
| 3475 |
| 3476 /** |
| 3477 * The formal parameter list of a method declaration, function declaration, or |
| 3478 * function type alias. |
| 3479 * |
| 3480 * While the grammar requires all optional formal parameters to follow all of |
| 3481 * the normal formal parameters and at most one grouping of optional formal |
| 3482 * parameters, this class does not enforce those constraints. All parameters are |
| 3483 * flattened into a single list, which can have any or all kinds of parameters |
| 3484 * (normal, named, and positional) in any order. |
| 3485 * |
| 3486 * > formalParameterList ::= |
| 3487 * > '(' ')' |
| 3488 * > | '(' normalFormalParameters (',' optionalFormalParameters)? ')' |
| 3489 * > | '(' optionalFormalParameters ')' |
| 3490 * > |
| 3491 * > normalFormalParameters ::= |
| 3492 * > [NormalFormalParameter] (',' [NormalFormalParameter])* |
| 3493 * > |
| 3494 * > optionalFormalParameters ::= |
| 3495 * > optionalPositionalFormalParameters |
| 3496 * > | namedFormalParameters |
| 3497 * > |
| 3498 * > optionalPositionalFormalParameters ::= |
| 3499 * > '[' [DefaultFormalParameter] (',' [DefaultFormalParameter])* ']' |
| 3500 * > |
| 3501 * > namedFormalParameters ::= |
| 3502 * > '{' [DefaultFormalParameter] (',' [DefaultFormalParameter])* '}' |
| 3503 * |
| 3504 * Clients may not extend, implement or mix-in this class. |
| 3505 */ |
| 3506 abstract class FormalParameterList extends AstNode { |
| 3507 /** |
| 3508 * Initialize a newly created parameter list. The list of [parameters] can be |
| 3509 * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter] |
| 3510 * can be `null` if there are no optional parameters. |
| 3511 */ |
| 3512 factory FormalParameterList( |
| 3513 Token leftParenthesis, |
| 3514 List<FormalParameter> parameters, |
| 3515 Token leftDelimiter, |
| 3516 Token rightDelimiter, |
| 3517 Token rightParenthesis) = FormalParameterListImpl; |
| 3518 |
| 3519 /** |
| 3520 * Return the left square bracket ('[') or left curly brace ('{') introducing |
| 3521 * the optional parameters, or `null` if there are no optional parameters. |
| 3522 */ |
| 3523 Token get leftDelimiter; |
| 3524 |
| 3525 /** |
| 3526 * Set the left square bracket ('[') or left curly brace ('{') introducing |
| 3527 * the optional parameters to the given [token]. |
| 3528 */ |
| 3529 void set leftDelimiter(Token token); |
| 3530 |
| 3531 /** |
| 3532 * Return the left parenthesis. |
| 3533 */ |
| 3534 Token get leftParenthesis; |
| 3535 |
| 3536 /** |
| 3537 * Set the left parenthesis to the given [token]. |
| 3538 */ |
| 3539 void set leftParenthesis(Token token); |
| 3540 |
| 3541 /** |
| 3542 * Return a list containing the elements representing the parameters in this |
| 3543 * list. The list will contain `null`s if the parameters in this list have not |
| 3544 * been resolved. |
| 3545 */ |
| 3546 List<ParameterElement> get parameterElements; |
| 3547 |
| 3548 /** |
| 3549 * Return the parameters associated with the method. |
| 3550 */ |
| 3551 NodeList<FormalParameter> get parameters; |
| 3552 |
| 3553 /** |
| 3554 * Return the right square bracket (']') or right curly brace ('}') terminatin
g the |
| 3555 * optional parameters, or `null` if there are no optional parameters. |
| 3556 */ |
| 3557 Token get rightDelimiter; |
| 3558 |
| 3559 /** |
| 3560 * Set the right square bracket (']') or right curly brace ('}') terminating t
he |
| 3561 * optional parameters to the given [token]. |
| 3562 */ |
| 3563 void set rightDelimiter(Token token); |
| 3564 |
| 3565 /** |
| 3566 * Return the right parenthesis. |
| 3567 */ |
| 3568 Token get rightParenthesis; |
| 3569 |
| 3570 /** |
| 3571 * Set the right parenthesis to the given [token]. |
| 3572 */ |
| 3573 void set rightParenthesis(Token token); |
| 3574 } |
| 3575 |
| 3576 /** |
| 3577 * A for statement. |
| 3578 * |
| 3579 * > forStatement ::= |
| 3580 * > 'for' '(' forLoopParts ')' [Statement] |
| 3581 * > |
| 3582 * > forLoopParts ::= |
| 3583 * > forInitializerStatement ';' [Expression]? ';' [Expression]? |
| 3584 * > |
| 3585 * > forInitializerStatement ::= |
| 3586 * > [DefaultFormalParameter] |
| 3587 * > | [Expression]? |
| 3588 * |
| 3589 * Clients may not extend, implement or mix-in this class. |
| 3590 */ |
| 3591 abstract class ForStatement extends Statement { |
| 3592 /** |
| 3593 * Initialize a newly created for statement. Either the [variableList] or the |
| 3594 * [initialization] must be `null`. Either the [condition] and the list of |
| 3595 * [updaters] can be `null` if the loop does not have the corresponding |
| 3596 * attribute. |
| 3597 */ |
| 3598 factory ForStatement( |
| 3599 Token forKeyword, |
| 3600 Token leftParenthesis, |
| 3601 VariableDeclarationList variableList, |
| 3602 Expression initialization, |
| 3603 Token leftSeparator, |
| 3604 Expression condition, |
| 3605 Token rightSeparator, |
| 3606 List<Expression> updaters, |
| 3607 Token rightParenthesis, |
| 3608 Statement body) = ForStatementImpl; |
| 3609 |
| 3610 /** |
| 3611 * Return the body of the loop. |
| 3612 */ |
| 3613 Statement get body; |
| 3614 |
| 3615 /** |
| 3616 * Set the body of the loop to the given [statement]. |
| 3617 */ |
| 3618 void set body(Statement statement); |
| 3619 |
| 3620 /** |
| 3621 * Return the condition used to determine when to terminate the loop, or |
| 3622 * `null` if there is no condition. |
| 3623 */ |
| 3624 Expression get condition; |
| 3625 |
| 3626 /** |
| 3627 * Set the condition used to determine when to terminate the loop to the given |
| 3628 * [expression]. |
| 3629 */ |
| 3630 void set condition(Expression expression); |
| 3631 |
| 3632 /** |
| 3633 * Return the token representing the 'for' keyword. |
| 3634 */ |
| 3635 Token get forKeyword; |
| 3636 |
| 3637 /** |
| 3638 * Set the token representing the 'for' keyword to the given [token]. |
| 3639 */ |
| 3640 void set forKeyword(Token token); |
| 3641 |
| 3642 /** |
| 3643 * Return the initialization expression, or `null` if there is no |
| 3644 * initialization expression. |
| 3645 */ |
| 3646 Expression get initialization; |
| 3647 |
| 3648 /** |
| 3649 * Set the initialization expression to the given [expression]. |
| 3650 */ |
| 3651 void set initialization(Expression initialization); |
| 3652 |
| 3653 /** |
| 3654 * Return the left parenthesis. |
| 3655 */ |
| 3656 Token get leftParenthesis; |
| 3657 |
| 3658 /** |
| 3659 * Set the left parenthesis to the given [token]. |
| 3660 */ |
| 3661 void set leftParenthesis(Token token); |
| 3662 |
| 3663 /** |
| 3664 * Return the semicolon separating the initializer and the condition. |
| 3665 */ |
| 3666 Token get leftSeparator; |
| 3667 |
| 3668 /** |
| 3669 * Set the semicolon separating the initializer and the condition to the given |
| 3670 * [token]. |
| 3671 */ |
| 3672 void set leftSeparator(Token token); |
| 3673 |
| 3674 /** |
| 3675 * Return the right parenthesis. |
| 3676 */ |
| 3677 Token get rightParenthesis; |
| 3678 |
| 3679 /** |
| 3680 * Set the right parenthesis to the given [token]. |
| 3681 */ |
| 3682 void set rightParenthesis(Token token); |
| 3683 |
| 3684 /** |
| 3685 * Return the semicolon separating the condition and the updater. |
| 3686 */ |
| 3687 Token get rightSeparator; |
| 3688 |
| 3689 /** |
| 3690 * Set the semicolon separating the condition and the updater to the given |
| 3691 * [token]. |
| 3692 */ |
| 3693 void set rightSeparator(Token token); |
| 3694 |
| 3695 /** |
| 3696 * Return the list of expressions run after each execution of the loop body. |
| 3697 */ |
| 3698 NodeList<Expression> get updaters; |
| 3699 |
| 3700 /** |
| 3701 * Return the declaration of the loop variables, or `null` if there are no |
| 3702 * variables. |
| 3703 */ |
| 3704 VariableDeclarationList get variables; |
| 3705 |
| 3706 /** |
| 3707 * Set the declaration of the loop variables to the given [variableList]. |
| 3708 */ |
| 3709 void set variables(VariableDeclarationList variableList); |
| 3710 } |
| 3711 |
| 3712 /** |
| 3713 * A node representing the body of a function or method. |
| 3714 * |
| 3715 * > functionBody ::= |
| 3716 * > [BlockFunctionBody] |
| 3717 * > | [EmptyFunctionBody] |
| 3718 * > | [ExpressionFunctionBody] |
| 3719 * |
| 3720 * Clients may not extend, implement or mix-in this class. |
| 3721 */ |
| 3722 abstract class FunctionBody extends AstNode { |
| 3723 /** |
| 3724 * Return `true` if this function body is asynchronous. |
| 3725 */ |
| 3726 bool get isAsynchronous; |
| 3727 |
| 3728 /** |
| 3729 * Return `true` if this function body is a generator. |
| 3730 */ |
| 3731 bool get isGenerator; |
| 3732 |
| 3733 /** |
| 3734 * Return `true` if this function body is synchronous. |
| 3735 */ |
| 3736 bool get isSynchronous; |
| 3737 |
| 3738 /** |
| 3739 * Return the token representing the 'async' or 'sync' keyword, or `null` if |
| 3740 * there is no such keyword. |
| 3741 */ |
| 3742 Token get keyword; |
| 3743 |
| 3744 /** |
| 3745 * Return the star following the 'async' or 'sync' keyword, or `null` if there |
| 3746 * is no star. |
| 3747 */ |
| 3748 Token get star; |
| 3749 } |
| 3750 |
| 3751 /** |
| 3752 * A top-level declaration. |
| 3753 * |
| 3754 * > functionDeclaration ::= |
| 3755 * > 'external' functionSignature |
| 3756 * > | functionSignature [FunctionBody] |
| 3757 * > |
| 3758 * > functionSignature ::= |
| 3759 * > [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList] |
| 3760 * |
| 3761 * Clients may not extend, implement or mix-in this class. |
| 3762 */ |
| 3763 abstract class FunctionDeclaration extends NamedCompilationUnitMember { |
| 3764 /** |
| 3765 * Initialize a newly created function declaration. Either or both of the |
| 3766 * [comment] and [metadata] can be `null` if the function does not have the |
| 3767 * corresponding attribute. The [externalKeyword] can be `null` if the |
| 3768 * function is not an external function. The [returnType] can be `null` if no |
| 3769 * return type was specified. The [propertyKeyword] can be `null` if the |
| 3770 * function is neither a getter or a setter. |
| 3771 */ |
| 3772 factory FunctionDeclaration( |
| 3773 Comment comment, |
| 3774 List<Annotation> metadata, |
| 3775 Token externalKeyword, |
| 3776 TypeName returnType, |
| 3777 Token propertyKeyword, |
| 3778 SimpleIdentifier name, |
| 3779 FunctionExpression functionExpression) = FunctionDeclarationImpl; |
| 3780 |
| 3781 @override |
| 3782 ExecutableElement get element; |
| 3783 |
| 3784 /** |
| 3785 * Return the token representing the 'external' keyword, or `null` if this is |
| 3786 * not an external function. |
| 3787 */ |
| 3788 Token get externalKeyword; |
| 3789 |
| 3790 /** |
| 3791 * Set the token representing the 'external' keyword to the given [token]. |
| 3792 */ |
| 3793 void set externalKeyword(Token token); |
| 3794 |
| 3795 /** |
| 3796 * Return the function expression being wrapped. |
| 3797 */ |
| 3798 FunctionExpression get functionExpression; |
| 3799 |
| 3800 /** |
| 3801 * Set the function expression being wrapped to the given |
| 3802 * [functionExpression]. |
| 3803 */ |
| 3804 void set functionExpression(FunctionExpression functionExpression); |
| 3805 |
| 3806 /** |
| 3807 * Return `true` if this function declares a getter. |
| 3808 */ |
| 3809 bool get isGetter; |
| 3810 |
| 3811 /** |
| 3812 * Return `true` if this function declares a setter. |
| 3813 */ |
| 3814 bool get isSetter; |
| 3815 |
| 3816 /** |
| 3817 * Return the token representing the 'get' or 'set' keyword, or `null` if this |
| 3818 * is a function declaration rather than a property declaration. |
| 3819 */ |
| 3820 Token get propertyKeyword; |
| 3821 |
| 3822 /** |
| 3823 * Set the token representing the 'get' or 'set' keyword to the given [token]. |
| 3824 */ |
| 3825 void set propertyKeyword(Token token); |
| 3826 |
| 3827 /** |
| 3828 * Return the return type of the function, or `null` if no return type was |
| 3829 * declared. |
| 3830 */ |
| 3831 TypeName get returnType; |
| 3832 |
| 3833 /** |
| 3834 * Set the return type of the function to the given [returnType]. |
| 3835 */ |
| 3836 void set returnType(TypeName returnType); |
| 3837 } |
| 3838 |
| 3839 /** |
| 3840 * A [FunctionDeclaration] used as a statement. |
| 3841 * |
| 3842 * Clients may not extend, implement or mix-in this class. |
| 3843 */ |
| 3844 abstract class FunctionDeclarationStatement extends Statement { |
| 3845 /** |
| 3846 * Initialize a newly created function declaration statement. |
| 3847 */ |
| 3848 factory FunctionDeclarationStatement( |
| 3849 FunctionDeclaration functionDeclaration) = |
| 3850 FunctionDeclarationStatementImpl; |
| 3851 |
| 3852 /** |
| 3853 * Return the function declaration being wrapped. |
| 3854 */ |
| 3855 FunctionDeclaration get functionDeclaration; |
| 3856 |
| 3857 /** |
| 3858 * Set the function declaration being wrapped to the given |
| 3859 * [functionDeclaration]. |
| 3860 */ |
| 3861 void set functionDeclaration(FunctionDeclaration functionDeclaration); |
| 3862 } |
| 3863 |
| 3864 /** |
| 3865 * A function expression. |
| 3866 * |
| 3867 * > functionExpression ::= |
| 3868 * > [TypeParameterList]? [FormalParameterList] [FunctionBody] |
| 3869 * |
| 3870 * Clients may not extend, implement or mix-in this class. |
| 3871 */ |
| 3872 abstract class FunctionExpression extends Expression { |
| 3873 /** |
| 3874 * Initialize a newly created function declaration. |
| 3875 */ |
| 3876 factory FunctionExpression( |
| 3877 TypeParameterList typeParameters, |
| 3878 FormalParameterList parameters, |
| 3879 FunctionBody body) = FunctionExpressionImpl; |
| 3880 |
| 3881 /** |
| 3882 * Return the body of the function, or `null` if this is an external function. |
| 3883 */ |
| 3884 FunctionBody get body; |
| 3885 |
| 3886 /** |
| 3887 * Set the body of the function to the given [functionBody]. |
| 3888 */ |
| 3889 void set body(FunctionBody functionBody); |
| 3890 |
| 3891 /** |
| 3892 * Return the element associated with the function, or `null` if the AST |
| 3893 * structure has not been resolved. |
| 3894 */ |
| 3895 ExecutableElement get element; |
| 3896 |
| 3897 /** |
| 3898 * Set the element associated with the function to the given [element]. |
| 3899 */ |
| 3900 void set element(ExecutableElement element); |
| 3901 |
| 3902 /** |
| 3903 * Return the parameters associated with the function. |
| 3904 */ |
| 3905 FormalParameterList get parameters; |
| 3906 |
| 3907 /** |
| 3908 * Set the parameters associated with the function to the given list of |
| 3909 * [parameters]. |
| 3910 */ |
| 3911 void set parameters(FormalParameterList parameters); |
| 3912 |
| 3913 /** |
| 3914 * Return the type parameters associated with this method, or `null` if this |
| 3915 * method is not a generic method. |
| 3916 */ |
| 3917 TypeParameterList get typeParameters; |
| 3918 |
| 3919 /** |
| 3920 * Set the type parameters associated with this method to the given |
| 3921 * [typeParameters]. |
| 3922 */ |
| 3923 void set typeParameters(TypeParameterList typeParameters); |
| 3924 } |
| 3925 |
| 3926 /** |
| 3927 * The invocation of a function resulting from evaluating an expression. |
| 3928 * Invocations of methods and other forms of functions are represented by |
| 3929 * [MethodInvocation] nodes. Invocations of getters and setters are represented |
| 3930 * by either [PrefixedIdentifier] or [PropertyAccess] nodes. |
| 3931 * |
| 3932 * > functionExpressionInvocation ::= |
| 3933 * > [Expression] [TypeArgumentList]? [ArgumentList] |
| 3934 * |
| 3935 * Clients may not extend, implement or mix-in this class. |
| 3936 */ |
| 3937 abstract class FunctionExpressionInvocation extends Expression { |
| 3938 /** |
| 3939 * Initialize a newly created function expression invocation. |
| 3940 */ |
| 3941 factory FunctionExpressionInvocation( |
| 3942 Expression function, |
| 3943 TypeArgumentList typeArguments, |
| 3944 ArgumentList argumentList) = FunctionExpressionInvocationImpl; |
| 3945 |
| 3946 /** |
| 3947 * Return the list of arguments to the method. |
| 3948 */ |
| 3949 ArgumentList get argumentList; |
| 3950 |
| 3951 /** |
| 3952 * Set the list of arguments to the method to the given [argumentList]. |
| 3953 */ |
| 3954 void set argumentList(ArgumentList argumentList); |
| 3955 |
| 3956 /** |
| 3957 * Return the best element available for the function being invoked. If |
| 3958 * resolution was able to find a better element based on type propagation, |
| 3959 * that element will be returned. Otherwise, the element found using the |
| 3960 * result of static analysis will be returned. If resolution has not been |
| 3961 * performed, then `null` will be returned. |
| 3962 */ |
| 3963 ExecutableElement get bestElement; |
| 3964 |
| 3965 /** |
| 3966 * Return the expression producing the function being invoked. |
| 3967 */ |
| 3968 Expression get function; |
| 3969 |
| 3970 /** |
| 3971 * Set the expression producing the function being invoked to the given |
| 3972 * [expression]. |
| 3973 */ |
| 3974 void set function(Expression expression); |
| 3975 |
| 3976 /** |
| 3977 * Return the element associated with the function being invoked based on |
| 3978 * propagated type information, or `null` if the AST structure has not been |
| 3979 * resolved or the function could not be resolved. |
| 3980 */ |
| 3981 ExecutableElement get propagatedElement; |
| 3982 |
| 3983 /** |
| 3984 * Set the element associated with the function being invoked based on |
| 3985 * propagated type information to the given [element]. |
| 3986 */ |
| 3987 void set propagatedElement(ExecutableElement element); |
| 3988 |
| 3989 /** |
| 3990 * Return the function type of the method invocation based on the propagated |
| 3991 * type information, or `null` if the AST structure has not been resolved, or |
| 3992 * if the invoke could not be resolved. |
| 3993 * |
| 3994 * This will usually be a [FunctionType], but it can also be an |
| 3995 * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy` |
| 3996 * interface type that implements `Function`. |
| 3997 */ |
| 3998 DartType get propagatedInvokeType; |
| 3999 |
| 4000 /** |
| 4001 * Set the function type of the method invocation based on the propagated type |
| 4002 * information to the given [type]. |
| 4003 */ |
| 4004 void set propagatedInvokeType(DartType type); |
| 4005 |
| 4006 /** |
| 4007 * Return the element associated with the function being invoked based on |
| 4008 * static type information, or `null` if the AST structure has not been |
| 4009 * resolved or the function could not be resolved. |
| 4010 */ |
| 4011 ExecutableElement get staticElement; |
| 4012 |
| 4013 /** |
| 4014 * Set the element associated with the function being invoked based on static |
| 4015 * type information to the given [element]. |
| 4016 */ |
| 4017 void set staticElement(ExecutableElement element); |
| 4018 |
| 4019 /** |
| 4020 * Return the function type of the method invocation based on the static type |
| 4021 * information, or `null` if the AST structure has not been resolved, or if |
| 4022 * the invoke could not be resolved. |
| 4023 * |
| 4024 * This will usually be a [FunctionType], but it can also be an |
| 4025 * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy` |
| 4026 * interface type that implements `Function`. |
| 4027 */ |
| 4028 DartType get staticInvokeType; |
| 4029 |
| 4030 /** |
| 4031 * Set the function type of the method invocation based on the static type |
| 4032 * information to the given [type]. |
| 4033 */ |
| 4034 void set staticInvokeType(DartType type); |
| 4035 |
| 4036 /** |
| 4037 * Return the type arguments to be applied to the method being invoked, or |
| 4038 * `null` if no type arguments were provided. |
| 4039 */ |
| 4040 TypeArgumentList get typeArguments; |
| 4041 |
| 4042 /** |
| 4043 * Set the type arguments to be applied to the method being invoked to the |
| 4044 * given [typeArguments]. |
| 4045 */ |
| 4046 void set typeArguments(TypeArgumentList typeArguments); |
| 4047 } |
| 4048 |
| 4049 /** |
| 4050 * A function type alias. |
| 4051 * |
| 4052 * > functionTypeAlias ::= |
| 4053 * > functionPrefix [TypeParameterList]? [FormalParameterList] ';' |
| 4054 * > |
| 4055 * > functionPrefix ::= |
| 4056 * > [TypeName]? [SimpleIdentifier] |
| 4057 * |
| 4058 * Clients may not extend, implement or mix-in this class. |
| 4059 */ |
| 4060 abstract class FunctionTypeAlias extends TypeAlias { |
| 4061 /** |
| 4062 * Initialize a newly created function type alias. Either or both of the |
| 4063 * [comment] and [metadata] can be `null` if the function does not have the |
| 4064 * corresponding attribute. The [returnType] can be `null` if no return type |
| 4065 * was specified. The [typeParameters] can be `null` if the function has no |
| 4066 * type parameters. |
| 4067 */ |
| 4068 factory FunctionTypeAlias( |
| 4069 Comment comment, |
| 4070 List<Annotation> metadata, |
| 4071 Token keyword, |
| 4072 TypeName returnType, |
| 4073 SimpleIdentifier name, |
| 4074 TypeParameterList typeParameters, |
| 4075 FormalParameterList parameters, |
| 4076 Token semicolon) = FunctionTypeAliasImpl; |
| 4077 |
| 4078 /** |
| 4079 * Return the parameters associated with the function type. |
| 4080 */ |
| 4081 FormalParameterList get parameters; |
| 4082 |
| 4083 /** |
| 4084 * Set the parameters associated with the function type to the given list of |
| 4085 * [parameters]. |
| 4086 */ |
| 4087 void set parameters(FormalParameterList parameters); |
| 4088 |
| 4089 /** |
| 4090 * Return the name of the return type of the function type being defined, or |
| 4091 * `null` if no return type was given. |
| 4092 */ |
| 4093 TypeName get returnType; |
| 4094 |
| 4095 /** |
| 4096 * Set the name of the return type of the function type being defined to the |
| 4097 * given [typeName]. |
| 4098 */ |
| 4099 void set returnType(TypeName typeName); |
| 4100 |
| 4101 /** |
| 4102 * Return the type parameters for the function type, or `null` if the function |
| 4103 * type does not have any type parameters. |
| 4104 */ |
| 4105 TypeParameterList get typeParameters; |
| 4106 |
| 4107 /** |
| 4108 * Set the type parameters for the function type to the given list of |
| 4109 * [typeParameters]. |
| 4110 */ |
| 4111 void set typeParameters(TypeParameterList typeParameters); |
| 4112 } |
| 4113 |
| 4114 /** |
| 4115 * A function-typed formal parameter. |
| 4116 * |
| 4117 * > functionSignature ::= |
| 4118 * > [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLis
t] |
| 4119 * |
| 4120 * Clients may not extend, implement or mix-in this class. |
| 4121 */ |
| 4122 abstract class FunctionTypedFormalParameter extends NormalFormalParameter { |
| 4123 /** |
| 4124 * Initialize a newly created formal parameter. Either or both of the |
| 4125 * [comment] and [metadata] can be `null` if the parameter does not have the |
| 4126 * corresponding attribute. The [returnType] can be `null` if no return type |
| 4127 * was specified. |
| 4128 */ |
| 4129 factory FunctionTypedFormalParameter( |
| 4130 Comment comment, |
| 4131 List<Annotation> metadata, |
| 4132 TypeName returnType, |
| 4133 SimpleIdentifier identifier, |
| 4134 TypeParameterList typeParameters, |
| 4135 FormalParameterList parameters) = FunctionTypedFormalParameterImpl; |
| 4136 |
| 4137 /** |
| 4138 * Return the parameters of the function-typed parameter. |
| 4139 */ |
| 4140 FormalParameterList get parameters; |
| 4141 |
| 4142 /** |
| 4143 * Set the parameters of the function-typed parameter to the given |
| 4144 * [parameters]. |
| 4145 */ |
| 4146 void set parameters(FormalParameterList parameters); |
| 4147 |
| 4148 /** |
| 4149 * Return the return type of the function, or `null` if the function does not |
| 4150 * have a return type. |
| 4151 */ |
| 4152 TypeName get returnType; |
| 4153 |
| 4154 /** |
| 4155 * Set the return type of the function to the given [type]. |
| 4156 */ |
| 4157 void set returnType(TypeName type); |
| 4158 |
| 4159 /** |
| 4160 * Return the type parameters associated with this function, or `null` if |
| 4161 * this function is not a generic function. |
| 4162 */ |
| 4163 TypeParameterList get typeParameters; |
| 4164 |
| 4165 /** |
| 4166 * Set the type parameters associated with this method to the given |
| 4167 * [typeParameters]. |
| 4168 */ |
| 4169 void set typeParameters(TypeParameterList typeParameters); |
| 4170 } |
| 4171 |
| 4172 /** |
| 4173 * A combinator that restricts the names being imported to those that are not in |
| 4174 * a given list. |
| 4175 * |
| 4176 * > hideCombinator ::= |
| 4177 * > 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* |
| 4178 * |
| 4179 * Clients may not extend, implement or mix-in this class. |
| 4180 */ |
| 4181 abstract class HideCombinator extends Combinator { |
| 4182 /** |
| 4183 * Initialize a newly created import show combinator. |
| 4184 */ |
| 4185 factory HideCombinator(Token keyword, List<SimpleIdentifier> hiddenNames) = |
| 4186 HideCombinatorImpl; |
| 4187 |
| 4188 /** |
| 4189 * Return the list of names from the library that are hidden by this |
| 4190 * combinator. |
| 4191 */ |
| 4192 NodeList<SimpleIdentifier> get hiddenNames; |
| 4193 } |
| 4194 |
| 4195 /** |
| 4196 * A node that represents an identifier. |
| 4197 * |
| 4198 * > identifier ::= |
| 4199 * > [SimpleIdentifier] |
| 4200 * > | [PrefixedIdentifier] |
| 4201 * |
| 4202 * Clients may not extend, implement or mix-in this class. |
| 4203 */ |
| 4204 abstract class Identifier extends Expression { |
| 4205 /** |
| 4206 * Return the best element available for this operator. If resolution was able |
| 4207 * to find a better element based on type propagation, that element will be |
| 4208 * returned. Otherwise, the element found using the result of static analysis |
| 4209 * will be returned. If resolution has not been performed, then `null` will be |
| 4210 * returned. |
| 4211 */ |
| 4212 Element get bestElement; |
| 4213 |
| 4214 /** |
| 4215 * Return the lexical representation of the identifier. |
| 4216 */ |
| 4217 String get name; |
| 4218 |
| 4219 /** |
| 4220 * Return the element associated with this identifier based on propagated type |
| 4221 * information, or `null` if the AST structure has not been resolved or if |
| 4222 * this identifier could not be resolved. One example of the latter case is an |
| 4223 * identifier that is not defined within the scope in which it appears. |
| 4224 */ |
| 4225 Element get propagatedElement; |
| 4226 |
| 4227 /** |
| 4228 * Return the element associated with this identifier based on static type |
| 4229 * information, or `null` if the AST structure has not been resolved or if |
| 4230 * this identifier could not be resolved. One example of the latter case is an |
| 4231 * identifier that is not defined within the scope in which it appears |
| 4232 */ |
| 4233 Element get staticElement; |
| 4234 |
| 4235 /** |
| 4236 * Return `true` if the given [name] is visible only within the library in |
| 4237 * which it is declared. |
| 4238 */ |
| 4239 static bool isPrivateName(String name) => |
| 4240 StringUtilities.startsWithChar(name, 0x5F); // '_' |
| 4241 } |
| 4242 |
| 4243 /** |
| 4244 * An if statement. |
| 4245 * |
| 4246 * > ifStatement ::= |
| 4247 * > 'if' '(' [Expression] ')' [Statement] ('else' [Statement])? |
| 4248 * |
| 4249 * Clients may not extend, implement or mix-in this class. |
| 4250 */ |
| 4251 abstract class IfStatement extends Statement { |
| 4252 /** |
| 4253 * Initialize a newly created if statement. The [elseKeyword] and |
| 4254 * [elseStatement] can be `null` if there is no else clause. |
| 4255 */ |
| 4256 factory IfStatement( |
| 4257 Token ifKeyword, |
| 4258 Token leftParenthesis, |
| 4259 Expression condition, |
| 4260 Token rightParenthesis, |
| 4261 Statement thenStatement, |
| 4262 Token elseKeyword, |
| 4263 Statement elseStatement) = IfStatementImpl; |
| 4264 |
| 4265 /** |
| 4266 * Return the condition used to determine which of the statements is executed |
| 4267 * next. |
| 4268 */ |
| 4269 Expression get condition; |
| 4270 |
| 4271 /** |
| 4272 * Set the condition used to determine which of the statements is executed |
| 4273 * next to the given [expression]. |
| 4274 */ |
| 4275 void set condition(Expression expression); |
| 4276 |
| 4277 /** |
| 4278 * Return the token representing the 'else' keyword, or `null` if there is no |
| 4279 * else statement. |
| 4280 */ |
| 4281 Token get elseKeyword; |
| 4282 |
| 4283 /** |
| 4284 * Set the token representing the 'else' keyword to the given [token]. |
| 4285 */ |
| 4286 void set elseKeyword(Token token); |
| 4287 |
| 4288 /** |
| 4289 * Return the statement that is executed if the condition evaluates to |
| 4290 * `false`, or `null` if there is no else statement. |
| 4291 */ |
| 4292 Statement get elseStatement; |
| 4293 |
| 4294 /** |
| 4295 * Set the statement that is executed if the condition evaluates to `false` |
| 4296 * to the given [statement]. |
| 4297 */ |
| 4298 void set elseStatement(Statement statement); |
| 4299 |
| 4300 /** |
| 4301 * Return the token representing the 'if' keyword. |
| 4302 */ |
| 4303 Token get ifKeyword; |
| 4304 |
| 4305 /** |
| 4306 * Set the token representing the 'if' keyword to the given [token]. |
| 4307 */ |
| 4308 void set ifKeyword(Token token); |
| 4309 |
| 4310 /** |
| 4311 * Return the left parenthesis. |
| 4312 */ |
| 4313 Token get leftParenthesis; |
| 4314 |
| 4315 /** |
| 4316 * Set the left parenthesis to the given [token]. |
| 4317 */ |
| 4318 void set leftParenthesis(Token token); |
| 4319 |
| 4320 /** |
| 4321 * Return the right parenthesis. |
| 4322 */ |
| 4323 Token get rightParenthesis; |
| 4324 |
| 4325 /** |
| 4326 * Set the right parenthesis to the given [token]. |
| 4327 */ |
| 4328 void set rightParenthesis(Token token); |
| 4329 |
| 4330 /** |
| 4331 * Return the statement that is executed if the condition evaluates to `true`. |
| 4332 */ |
| 4333 Statement get thenStatement; |
| 4334 |
| 4335 /** |
| 4336 * Set the statement that is executed if the condition evaluates to `true` to |
| 4337 * the given [statement]. |
| 4338 */ |
| 4339 void set thenStatement(Statement statement); |
| 4340 } |
| 4341 |
| 4342 /** |
| 4343 * The "implements" clause in an class declaration. |
| 4344 * |
| 4345 * > implementsClause ::= |
| 4346 * > 'implements' [TypeName] (',' [TypeName])* |
| 4347 * |
| 4348 * Clients may not extend, implement or mix-in this class. |
| 4349 */ |
| 4350 abstract class ImplementsClause extends AstNode { |
| 4351 /** |
| 4352 * Initialize a newly created implements clause. |
| 4353 */ |
| 4354 factory ImplementsClause(Token implementsKeyword, List<TypeName> interfaces) = |
| 4355 ImplementsClauseImpl; |
| 4356 |
| 4357 /** |
| 4358 * Return the token representing the 'implements' keyword. |
| 4359 */ |
| 4360 Token get implementsKeyword; |
| 4361 |
| 4362 /** |
| 4363 * Set the token representing the 'implements' keyword to the given [token]. |
| 4364 */ |
| 4365 void set implementsKeyword(Token token); |
| 4366 |
| 4367 /** |
| 4368 * Return the list of the interfaces that are being implemented. |
| 4369 */ |
| 4370 NodeList<TypeName> get interfaces; |
| 4371 } |
| 4372 |
| 4373 /** |
| 4374 * An import directive. |
| 4375 * |
| 4376 * > importDirective ::= |
| 4377 * > [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]*
';' |
| 4378 * > | [Annotation] 'import' [StringLiteral] 'deferred' 'as' identifier [Combi
nator]* ';' |
| 4379 * |
| 4380 * Clients may not extend, implement or mix-in this class. |
| 4381 */ |
| 4382 abstract class ImportDirective extends NamespaceDirective { |
| 4383 static Comparator<ImportDirective> COMPARATOR = |
| 4384 (ImportDirective import1, ImportDirective import2) { |
| 4385 // |
| 4386 // uri |
| 4387 // |
| 4388 StringLiteral uri1 = import1.uri; |
| 4389 StringLiteral uri2 = import2.uri; |
| 4390 String uriStr1 = uri1.stringValue; |
| 4391 String uriStr2 = uri2.stringValue; |
| 4392 if (uriStr1 != null || uriStr2 != null) { |
| 4393 if (uriStr1 == null) { |
| 4394 return -1; |
| 4395 } else if (uriStr2 == null) { |
| 4396 return 1; |
| 4397 } else { |
| 4398 int compare = uriStr1.compareTo(uriStr2); |
| 4399 if (compare != 0) { |
| 4400 return compare; |
| 4401 } |
| 4402 } |
| 4403 } |
| 4404 // |
| 4405 // as |
| 4406 // |
| 4407 SimpleIdentifier prefix1 = import1.prefix; |
| 4408 SimpleIdentifier prefix2 = import2.prefix; |
| 4409 String prefixStr1 = prefix1 != null ? prefix1.name : null; |
| 4410 String prefixStr2 = prefix2 != null ? prefix2.name : null; |
| 4411 if (prefixStr1 != null || prefixStr2 != null) { |
| 4412 if (prefixStr1 == null) { |
| 4413 return -1; |
| 4414 } else if (prefixStr2 == null) { |
| 4415 return 1; |
| 4416 } else { |
| 4417 int compare = prefixStr1.compareTo(prefixStr2); |
| 4418 if (compare != 0) { |
| 4419 return compare; |
| 4420 } |
| 4421 } |
| 4422 } |
| 4423 // |
| 4424 // hides and shows |
| 4425 // |
| 4426 NodeList<Combinator> combinators1 = import1.combinators; |
| 4427 List<String> allHides1 = new List<String>(); |
| 4428 List<String> allShows1 = new List<String>(); |
| 4429 for (Combinator combinator in combinators1) { |
| 4430 if (combinator is HideCombinator) { |
| 4431 NodeList<SimpleIdentifier> hides = combinator.hiddenNames; |
| 4432 for (SimpleIdentifier simpleIdentifier in hides) { |
| 4433 allHides1.add(simpleIdentifier.name); |
| 4434 } |
| 4435 } else { |
| 4436 NodeList<SimpleIdentifier> shows = |
| 4437 (combinator as ShowCombinator).shownNames; |
| 4438 for (SimpleIdentifier simpleIdentifier in shows) { |
| 4439 allShows1.add(simpleIdentifier.name); |
| 4440 } |
| 4441 } |
| 4442 } |
| 4443 NodeList<Combinator> combinators2 = import2.combinators; |
| 4444 List<String> allHides2 = new List<String>(); |
| 4445 List<String> allShows2 = new List<String>(); |
| 4446 for (Combinator combinator in combinators2) { |
| 4447 if (combinator is HideCombinator) { |
| 4448 NodeList<SimpleIdentifier> hides = combinator.hiddenNames; |
| 4449 for (SimpleIdentifier simpleIdentifier in hides) { |
| 4450 allHides2.add(simpleIdentifier.name); |
| 4451 } |
| 4452 } else { |
| 4453 NodeList<SimpleIdentifier> shows = |
| 4454 (combinator as ShowCombinator).shownNames; |
| 4455 for (SimpleIdentifier simpleIdentifier in shows) { |
| 4456 allShows2.add(simpleIdentifier.name); |
| 4457 } |
| 4458 } |
| 4459 } |
| 4460 // test lengths of combinator lists first |
| 4461 if (allHides1.length != allHides2.length) { |
| 4462 return allHides1.length - allHides2.length; |
| 4463 } |
| 4464 if (allShows1.length != allShows2.length) { |
| 4465 return allShows1.length - allShows2.length; |
| 4466 } |
| 4467 // next ensure that the lists are equivalent |
| 4468 if (!javaCollectionContainsAll(allHides1, allHides2)) { |
| 4469 return -1; |
| 4470 } |
| 4471 if (!javaCollectionContainsAll(allShows1, allShows2)) { |
| 4472 return -1; |
| 4473 } |
| 4474 return 0; |
| 4475 }; |
| 4476 |
| 4477 /** |
| 4478 * Initialize a newly created import directive. Either or both of the |
| 4479 * [comment] and [metadata] can be `null` if the function does not have the |
| 4480 * corresponding attribute. The [deferredKeyword] can be `null` if the import |
| 4481 * is not deferred. The [asKeyword] and [prefix] can be `null` if the import |
| 4482 * does not specify a prefix. The list of [combinators] can be `null` if there |
| 4483 * are no combinators. |
| 4484 */ |
| 4485 factory ImportDirective( |
| 4486 Comment comment, |
| 4487 List<Annotation> metadata, |
| 4488 Token keyword, |
| 4489 StringLiteral libraryUri, |
| 4490 List<Configuration> configurations, |
| 4491 Token deferredKeyword, |
| 4492 Token asKeyword, |
| 4493 SimpleIdentifier prefix, |
| 4494 List<Combinator> combinators, |
| 4495 Token semicolon) = ImportDirectiveImpl; |
| 4496 |
| 4497 /** |
| 4498 * Return the token representing the 'as' keyword, or `null` if the imported |
| 4499 * names are not prefixed. |
| 4500 */ |
| 4501 Token get asKeyword; |
| 4502 |
| 4503 /** |
| 4504 * Set the token representing the 'as' keyword to the given [token]. |
| 4505 */ |
| 4506 void set asKeyword(Token token); |
| 4507 |
| 4508 /** |
| 4509 * Return the token representing the 'deferred' keyword, or `null` if the |
| 4510 * imported URI is not deferred. |
| 4511 */ |
| 4512 Token get deferredKeyword; |
| 4513 |
| 4514 /** |
| 4515 * Set the token representing the 'deferred' keyword to the given [token]. |
| 4516 */ |
| 4517 void set deferredKeyword(Token token); |
| 4518 |
| 4519 /** |
| 4520 * Return the prefix to be used with the imported names, or `null` if the |
| 4521 * imported names are not prefixed. |
| 4522 */ |
| 4523 SimpleIdentifier get prefix; |
| 4524 |
| 4525 /** |
| 4526 * Set the prefix to be used with the imported names to the given [identifier]
. |
| 4527 */ |
| 4528 void set prefix(SimpleIdentifier identifier); |
| 4529 } |
| 4530 |
| 4531 /** |
| 4532 * An index expression. |
| 4533 * |
| 4534 * > indexExpression ::= |
| 4535 * > [Expression] '[' [Expression] ']' |
| 4536 * |
| 4537 * Clients may not extend, implement or mix-in this class. |
| 4538 */ |
| 4539 abstract class IndexExpression extends Expression { |
| 4540 /** |
| 4541 * Initialize a newly created index expression. |
| 4542 */ |
| 4543 factory IndexExpression.forCascade(Token period, Token leftBracket, |
| 4544 Expression index, Token rightBracket) = IndexExpressionImpl.forCascade; |
| 4545 |
| 4546 /** |
| 4547 * Initialize a newly created index expression. |
| 4548 */ |
| 4549 factory IndexExpression.forTarget(Expression target, Token leftBracket, |
| 4550 Expression index, Token rightBracket) = IndexExpressionImpl.forTarget; |
| 4551 |
| 4552 /** |
| 4553 * Return the auxiliary elements associated with this identifier, or `null` if |
| 4554 * this identifier is not in both a getter and setter context. The auxiliary |
| 4555 * elements hold the static and propagated elements associated with the getter |
| 4556 * context. |
| 4557 */ |
| 4558 // TODO(brianwilkerson) Replace this API. |
| 4559 AuxiliaryElements get auxiliaryElements; |
| 4560 |
| 4561 /** |
| 4562 * Set the auxiliary elements associated with this identifier to the given |
| 4563 * [elements]. |
| 4564 */ |
| 4565 // TODO(brianwilkerson) Replace this API. |
| 4566 void set auxiliaryElements(AuxiliaryElements elements); |
| 4567 |
| 4568 /** |
| 4569 * Return the best element available for this operator. If resolution was able |
| 4570 * to find a better element based on type propagation, that element will be |
| 4571 * returned. Otherwise, the element found using the result of static analysis |
| 4572 * will be returned. If resolution has not been performed, then `null` will be |
| 4573 * returned. |
| 4574 */ |
| 4575 MethodElement get bestElement; |
| 4576 |
| 4577 /** |
| 4578 * Return the expression used to compute the index. |
| 4579 */ |
| 4580 Expression get index; |
| 4581 |
| 4582 /** |
| 4583 * Set the expression used to compute the index to the given [expression]. |
| 4584 */ |
| 4585 void set index(Expression expression); |
| 4586 |
| 4587 /** |
| 4588 * Return `true` if this expression is cascaded. If it is, then the target of |
| 4589 * this expression is not stored locally but is stored in the nearest ancestor |
| 4590 * that is a [CascadeExpression]. |
| 4591 */ |
| 4592 bool get isCascaded; |
| 4593 |
| 4594 /** |
| 4595 * Return the left square bracket. |
| 4596 */ |
| 4597 Token get leftBracket; |
| 4598 |
| 4599 /** |
| 4600 * Set the left square bracket to the given [token]. |
| 4601 */ |
| 4602 void set leftBracket(Token token); |
| 4603 |
| 4604 /** |
| 4605 * Return the period ("..") before a cascaded index expression, or `null` if |
| 4606 * this index expression is not part of a cascade expression. |
| 4607 */ |
| 4608 Token get period; |
| 4609 |
| 4610 /** |
| 4611 * Set the period ("..") before a cascaded index expression to the given |
| 4612 * [token]. |
| 4613 */ |
| 4614 void set period(Token token); |
| 4615 |
| 4616 /** |
| 4617 * Return the element associated with the operator based on the propagated |
| 4618 * type of the target, or `null` if the AST structure has not been resolved or |
| 4619 * if the operator could not be resolved. |
| 4620 */ |
| 4621 MethodElement get propagatedElement; |
| 4622 |
| 4623 /** |
| 4624 * Set the element associated with the operator based on the propagated |
| 4625 * type of the target to the given [element]. |
| 4626 */ |
| 4627 void set propagatedElement(MethodElement element); |
| 4628 |
| 4629 /** |
| 4630 * Return the expression used to compute the object being indexed. If this |
| 4631 * index expression is not part of a cascade expression, then this is the same |
| 4632 * as [target]. If this index expression is part of a cascade expression, then |
| 4633 * the target expression stored with the cascade expression is returned. |
| 4634 */ |
| 4635 Expression get realTarget; |
| 4636 |
| 4637 /** |
| 4638 * Return the right square bracket. |
| 4639 */ |
| 4640 Token get rightBracket; |
| 4641 |
| 4642 /** |
| 4643 * Return the element associated with the operator based on the static type of |
| 4644 * the target, or `null` if the AST structure has not been resolved or if the |
| 4645 * operator could not be resolved. |
| 4646 */ |
| 4647 MethodElement get staticElement; |
| 4648 |
| 4649 /** |
| 4650 * Set the element associated with the operator based on the static type of |
| 4651 * the target to the given [element]. |
| 4652 */ |
| 4653 void set staticElement(MethodElement element); |
| 4654 |
| 4655 /** |
| 4656 * Return the expression used to compute the object being indexed, or `null` |
| 4657 * if this index expression is part of a cascade expression. |
| 4658 * |
| 4659 * Use [realTarget] to get the target independent of whether this is part of a |
| 4660 * cascade expression. |
| 4661 */ |
| 4662 Expression get target; |
| 4663 |
| 4664 /** |
| 4665 * Set the expression used to compute the object being indexed to the given |
| 4666 * [expression]. |
| 4667 */ |
| 4668 void set target(Expression expression); |
| 4669 |
| 4670 /** |
| 4671 * Return `true` if this expression is computing a right-hand value (that is, |
| 4672 * if this expression is in a context where the operator '[]' will be |
| 4673 * invoked). |
| 4674 * |
| 4675 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor |
| 4676 * are they mutually exclusive. In other words, it is possible for both |
| 4677 * methods to return `true` when invoked on the same node. |
| 4678 */ |
| 4679 // TODO(brianwilkerson) Convert this to a getter. |
| 4680 bool inGetterContext(); |
| 4681 |
| 4682 /** |
| 4683 * Return `true` if this expression is computing a left-hand value (that is, |
| 4684 * if this expression is in a context where the operator '[]=' will be |
| 4685 * invoked). |
| 4686 * |
| 4687 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor |
| 4688 * are they mutually exclusive. In other words, it is possible for both |
| 4689 * methods to return `true` when invoked on the same node. |
| 4690 */ |
| 4691 // TODO(brianwilkerson) Convert this to a getter. |
| 4692 bool inSetterContext(); |
| 4693 } |
| 4694 |
| 4695 /** |
| 4696 * An instance creation expression. |
| 4697 * |
| 4698 * > newExpression ::= |
| 4699 * > ('new' | 'const') [TypeName] ('.' [SimpleIdentifier])? [ArgumentList] |
| 4700 * |
| 4701 * Clients may not extend, implement or mix-in this class. |
| 4702 */ |
| 4703 abstract class InstanceCreationExpression extends Expression { |
| 4704 /** |
| 4705 * Initialize a newly created instance creation expression. |
| 4706 */ |
| 4707 factory InstanceCreationExpression( |
| 4708 Token keyword, |
| 4709 ConstructorName constructorName, |
| 4710 ArgumentList argumentList) = InstanceCreationExpressionImpl; |
| 4711 |
| 4712 /** |
| 4713 * Return the list of arguments to the constructor. |
| 4714 */ |
| 4715 ArgumentList get argumentList; |
| 4716 |
| 4717 /** |
| 4718 * Set the list of arguments to the constructor to the given [argumentList]. |
| 4719 */ |
| 4720 void set argumentList(ArgumentList argumentList); |
| 4721 |
| 4722 /** |
| 4723 * Return the name of the constructor to be invoked. |
| 4724 */ |
| 4725 ConstructorName get constructorName; |
| 4726 |
| 4727 /** |
| 4728 * Set the name of the constructor to be invoked to the given [name]. |
| 4729 */ |
| 4730 void set constructorName(ConstructorName name); |
| 4731 |
| 4732 /** |
| 4733 * Return `true` if this creation expression is used to invoke a constant |
| 4734 * constructor. |
| 4735 */ |
| 4736 bool get isConst; |
| 4737 |
| 4738 /** |
| 4739 * Return the 'new' or 'const' keyword used to indicate how an object should |
| 4740 * be created. |
| 4741 */ |
| 4742 Token get keyword; |
| 4743 |
| 4744 /** |
| 4745 * Set the 'new' or 'const' keyword used to indicate how an object should be |
| 4746 * created to the given [token]. |
| 4747 */ |
| 4748 void set keyword(Token token); |
| 4749 |
| 4750 /** |
| 4751 * Return the element associated with the constructor based on static type |
| 4752 * information, or `null` if the AST structure has not been resolved or if the |
| 4753 * constructor could not be resolved. |
| 4754 */ |
| 4755 ConstructorElement get staticElement; |
| 4756 |
| 4757 /** |
| 4758 * Set the element associated with the constructor based on static type |
| 4759 * information to the given [element]. |
| 4760 */ |
| 4761 void set staticElement(ConstructorElement element); |
| 4762 } |
| 4763 |
| 4764 /** |
| 4765 * An integer literal expression. |
| 4766 * |
| 4767 * > integerLiteral ::= |
| 4768 * > decimalIntegerLiteral |
| 4769 * > | hexadecimalIntegerLiteral |
| 4770 * > |
| 4771 * > decimalIntegerLiteral ::= |
| 4772 * > decimalDigit+ |
| 4773 * > |
| 4774 * > hexadecimalIntegerLiteral ::= |
| 4775 * > '0x' hexadecimalDigit+ |
| 4776 * > | '0X' hexadecimalDigit+ |
| 4777 * |
| 4778 * Clients may not extend, implement or mix-in this class. |
| 4779 */ |
| 4780 abstract class IntegerLiteral extends Literal { |
| 4781 /** |
| 4782 * Initialize a newly created integer literal. |
| 4783 */ |
| 4784 factory IntegerLiteral(Token literal, int value) = IntegerLiteralImpl; |
| 4785 |
| 4786 /** |
| 4787 * Return the token representing the literal. |
| 4788 */ |
| 4789 Token get literal; |
| 4790 |
| 4791 /** |
| 4792 * Set the token representing the literal to the given [token]. |
| 4793 */ |
| 4794 void set literal(Token token); |
| 4795 |
| 4796 /** |
| 4797 * Return the value of the literal. |
| 4798 */ |
| 4799 int get value; |
| 4800 |
| 4801 /** |
| 4802 * Set the value of the literal to the given [value]. |
| 4803 */ |
| 4804 void set value(int value); |
| 4805 } |
| 4806 |
| 4807 /** |
| 4808 * A node within a [StringInterpolation]. |
| 4809 * |
| 4810 * > interpolationElement ::= |
| 4811 * > [InterpolationExpression] |
| 4812 * > | [InterpolationString] |
| 4813 * |
| 4814 * Clients may not extend, implement or mix-in this class. |
| 4815 */ |
| 4816 abstract class InterpolationElement extends AstNode {} |
| 4817 |
| 4818 /** |
| 4819 * An expression embedded in a string interpolation. |
| 4820 * |
| 4821 * > interpolationExpression ::= |
| 4822 * > '$' [SimpleIdentifier] |
| 4823 * > | '$' '{' [Expression] '}' |
| 4824 * |
| 4825 * Clients may not extend, implement or mix-in this class. |
| 4826 */ |
| 4827 abstract class InterpolationExpression extends InterpolationElement { |
| 4828 /** |
| 4829 * Initialize a newly created interpolation expression. |
| 4830 */ |
| 4831 factory InterpolationExpression( |
| 4832 Token leftBracket, Expression expression, Token rightBracket) = |
| 4833 InterpolationExpressionImpl; |
| 4834 |
| 4835 /** |
| 4836 * Return the expression to be evaluated for the value to be converted into a |
| 4837 * string. |
| 4838 */ |
| 4839 Expression get expression; |
| 4840 |
| 4841 /** |
| 4842 * Set the expression to be evaluated for the value to be converted into a |
| 4843 * string to the given [expression]. |
| 4844 */ |
| 4845 void set expression(Expression expression); |
| 4846 |
| 4847 /** |
| 4848 * Return the token used to introduce the interpolation expression; either '$' |
| 4849 * if the expression is a simple identifier or '${' if the expression is a |
| 4850 * full expression. |
| 4851 */ |
| 4852 Token get leftBracket; |
| 4853 |
| 4854 /** |
| 4855 * Set the token used to introduce the interpolation expression; either '$' |
| 4856 * if the expression is a simple identifier or '${' if the expression is a |
| 4857 * full expression to the given [token]. |
| 4858 */ |
| 4859 void set leftBracket(Token token); |
| 4860 |
| 4861 /** |
| 4862 * Return the right curly bracket, or `null` if the expression is an |
| 4863 * identifier without brackets. |
| 4864 */ |
| 4865 Token get rightBracket; |
| 4866 |
| 4867 /** |
| 4868 * Set the right curly bracket to the given [token]. |
| 4869 */ |
| 4870 void set rightBracket(Token token); |
| 4871 } |
| 4872 |
| 4873 /** |
| 4874 * A non-empty substring of an interpolated string. |
| 4875 * |
| 4876 * > interpolationString ::= |
| 4877 * > characters |
| 4878 * |
| 4879 * Clients may not extend, implement or mix-in this class. |
| 4880 */ |
| 4881 abstract class InterpolationString extends InterpolationElement { |
| 4882 /** |
| 4883 * Initialize a newly created string of characters that are part of a string |
| 4884 * interpolation. |
| 4885 */ |
| 4886 factory InterpolationString(Token contents, String value) = |
| 4887 InterpolationStringImpl; |
| 4888 |
| 4889 /** |
| 4890 * Return the characters that will be added to the string. |
| 4891 */ |
| 4892 Token get contents; |
| 4893 |
| 4894 /** |
| 4895 * Set the characters that will be added to the string to the given [token]. |
| 4896 */ |
| 4897 void set contents(Token token); |
| 4898 |
| 4899 /** |
| 4900 * Return the offset of the after-last contents character. |
| 4901 */ |
| 4902 int get contentsEnd; |
| 4903 |
| 4904 /** |
| 4905 * Return the offset of the first contents character. |
| 4906 */ |
| 4907 int get contentsOffset; |
| 4908 |
| 4909 /** |
| 4910 * Return the value of the literal. |
| 4911 */ |
| 4912 String get value; |
| 4913 |
| 4914 /** |
| 4915 * Set the value of the literal to the given [value]. |
| 4916 */ |
| 4917 void set value(String value); |
| 4918 } |
| 4919 |
| 4920 /** |
| 4921 * An is expression. |
| 4922 * |
| 4923 * > isExpression ::= |
| 4924 * > [Expression] 'is' '!'? [TypeName] |
| 4925 * |
| 4926 * Clients may not extend, implement or mix-in this class. |
| 4927 */ |
| 4928 abstract class IsExpression extends Expression { |
| 4929 /** |
| 4930 * Initialize a newly created is expression. The [notOperator] can be `null` |
| 4931 * if the sense of the test is not negated. |
| 4932 */ |
| 4933 factory IsExpression(Expression expression, Token isOperator, |
| 4934 Token notOperator, TypeName type) = IsExpressionImpl; |
| 4935 |
| 4936 /** |
| 4937 * Return the expression used to compute the value whose type is being tested. |
| 4938 */ |
| 4939 Expression get expression; |
| 4940 |
| 4941 /** |
| 4942 * Set the expression used to compute the value whose type is being tested to |
| 4943 * the given [expression]. |
| 4944 */ |
| 4945 void set expression(Expression expression); |
| 4946 |
| 4947 /** |
| 4948 * Return the is operator. |
| 4949 */ |
| 4950 Token get isOperator; |
| 4951 |
| 4952 /** |
| 4953 * Set the is operator to the given [token]. |
| 4954 */ |
| 4955 void set isOperator(Token token); |
| 4956 |
| 4957 /** |
| 4958 * Return the not operator, or `null` if the sense of the test is not negated. |
| 4959 */ |
| 4960 Token get notOperator; |
| 4961 |
| 4962 /** |
| 4963 * Set the not operator to the given [token]. |
| 4964 */ |
| 4965 void set notOperator(Token token); |
| 4966 |
| 4967 /** |
| 4968 * Return the name of the type being tested for. |
| 4969 */ |
| 4970 TypeName get type; |
| 4971 |
| 4972 /** |
| 4973 * Set the name of the type being tested for to the given [name]. |
| 4974 */ |
| 4975 void set type(TypeName name); |
| 4976 } |
| 4977 |
| 4978 /** |
| 4979 * A label on either a [LabeledStatement] or a [NamedExpression]. |
| 4980 * |
| 4981 * > label ::= |
| 4982 * > [SimpleIdentifier] ':' |
| 4983 * |
| 4984 * Clients may not extend, implement or mix-in this class. |
| 4985 */ |
| 4986 abstract class Label extends AstNode { |
| 4987 /** |
| 4988 * Initialize a newly created label. |
| 4989 */ |
| 4990 factory Label(SimpleIdentifier label, Token colon) = LabelImpl; |
| 4991 |
| 4992 /** |
| 4993 * Return the colon that separates the label from the statement. |
| 4994 */ |
| 4995 Token get colon; |
| 4996 |
| 4997 /** |
| 4998 * Set the colon that separates the label from the statement to the given |
| 4999 * [token]. |
| 5000 */ |
| 5001 void set colon(Token token); |
| 5002 |
| 5003 /** |
| 5004 * Return the label being associated with the statement. |
| 5005 */ |
| 5006 SimpleIdentifier get label; |
| 5007 |
| 5008 /** |
| 5009 * Set the label being associated with the statement to the given [label]. |
| 5010 */ |
| 5011 void set label(SimpleIdentifier label); |
| 5012 } |
| 5013 |
| 5014 /** |
| 5015 * A statement that has a label associated with them. |
| 5016 * |
| 5017 * > labeledStatement ::= |
| 5018 * > [Label]+ [Statement] |
| 5019 * |
| 5020 * Clients may not extend, implement or mix-in this class. |
| 5021 */ |
| 5022 abstract class LabeledStatement extends Statement { |
| 5023 /** |
| 5024 * Initialize a newly created labeled statement. |
| 5025 */ |
| 5026 factory LabeledStatement(List<Label> labels, Statement statement) = |
| 5027 LabeledStatementImpl; |
| 5028 |
| 5029 /** |
| 5030 * Return the labels being associated with the statement. |
| 5031 */ |
| 5032 NodeList<Label> get labels; |
| 5033 |
| 5034 /** |
| 5035 * Return the statement with which the labels are being associated. |
| 5036 */ |
| 5037 Statement get statement; |
| 5038 |
| 5039 /** |
| 5040 * Set the statement with which the labels are being associated to the given |
| 5041 * [statement]. |
| 5042 */ |
| 5043 void set statement(Statement statement); |
| 5044 } |
| 5045 |
| 5046 /** |
| 5047 * A library directive. |
| 5048 * |
| 5049 * > libraryDirective ::= |
| 5050 * > [Annotation] 'library' [Identifier] ';' |
| 5051 * |
| 5052 * Clients may not extend, implement or mix-in this class. |
| 5053 */ |
| 5054 abstract class LibraryDirective extends Directive { |
| 5055 /** |
| 5056 * Initialize a newly created library directive. Either or both of the |
| 5057 * [comment] and [metadata] can be `null` if the directive does not have the |
| 5058 * corresponding attribute. |
| 5059 */ |
| 5060 factory LibraryDirective( |
| 5061 Comment comment, |
| 5062 List<Annotation> metadata, |
| 5063 Token libraryKeyword, |
| 5064 LibraryIdentifier name, |
| 5065 Token semicolon) = LibraryDirectiveImpl; |
| 5066 |
| 5067 /** |
| 5068 * Return the token representing the 'library' keyword. |
| 5069 */ |
| 5070 Token get libraryKeyword; |
| 5071 |
| 5072 /** |
| 5073 * Set the token representing the 'library' keyword to the given [token]. |
| 5074 */ |
| 5075 void set libraryKeyword(Token token); |
| 5076 |
| 5077 /** |
| 5078 * Return the name of the library being defined. |
| 5079 */ |
| 5080 LibraryIdentifier get name; |
| 5081 |
| 5082 /** |
| 5083 * Set the name of the library being defined to the given [name]. |
| 5084 */ |
| 5085 void set name(LibraryIdentifier name); |
| 5086 |
| 5087 /** |
| 5088 * Return the semicolon terminating the directive. |
| 5089 */ |
| 5090 Token get semicolon; |
| 5091 |
| 5092 /** |
| 5093 * Set the semicolon terminating the directive to the given [token]. |
| 5094 */ |
| 5095 void set semicolon(Token token); |
| 5096 } |
| 5097 |
| 5098 /** |
| 5099 * The identifier for a library. |
| 5100 * |
| 5101 * > libraryIdentifier ::= |
| 5102 * > [SimpleIdentifier] ('.' [SimpleIdentifier])* |
| 5103 * |
| 5104 * Clients may not extend, implement or mix-in this class. |
| 5105 */ |
| 5106 abstract class LibraryIdentifier extends Identifier { |
| 5107 /** |
| 5108 * Initialize a newly created prefixed identifier. |
| 5109 */ |
| 5110 factory LibraryIdentifier(List<SimpleIdentifier> components) = |
| 5111 LibraryIdentifierImpl; |
| 5112 |
| 5113 /** |
| 5114 * Return the components of the identifier. |
| 5115 */ |
| 5116 NodeList<SimpleIdentifier> get components; |
| 5117 } |
| 5118 |
| 5119 /** |
| 5120 * A list literal. |
| 5121 * |
| 5122 * > listLiteral ::= |
| 5123 * > 'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']' |
| 5124 * |
| 5125 * Clients may not extend, implement or mix-in this class. |
| 5126 */ |
| 5127 abstract class ListLiteral extends TypedLiteral { |
| 5128 /** |
| 5129 * Initialize a newly created list literal. The [constKeyword] can be `null` |
| 5130 * if the literal is not a constant. The [typeArguments] can be `null` if no |
| 5131 * type arguments were declared. The list of [elements] can be `null` if the |
| 5132 * list is empty. |
| 5133 */ |
| 5134 factory ListLiteral( |
| 5135 Token constKeyword, |
| 5136 TypeArgumentList typeArguments, |
| 5137 Token leftBracket, |
| 5138 List<Expression> elements, |
| 5139 Token rightBracket) = ListLiteralImpl; |
| 5140 |
| 5141 /** |
| 5142 * Return the expressions used to compute the elements of the list. |
| 5143 */ |
| 5144 NodeList<Expression> get elements; |
| 5145 |
| 5146 /** |
| 5147 * Return the left square bracket. |
| 5148 */ |
| 5149 Token get leftBracket; |
| 5150 |
| 5151 /** |
| 5152 * Set the left square bracket to the given [token]. |
| 5153 */ |
| 5154 void set leftBracket(Token token); |
| 5155 |
| 5156 /** |
| 5157 * Return the right square bracket. |
| 5158 */ |
| 5159 Token get rightBracket; |
| 5160 |
| 5161 /** |
| 5162 * Set the right square bracket to the given [token]. |
| 5163 */ |
| 5164 void set rightBracket(Token token); |
| 5165 } |
| 5166 |
| 5167 /** |
| 5168 * A node that represents a literal expression. |
| 5169 * |
| 5170 * > literal ::= |
| 5171 * > [BooleanLiteral] |
| 5172 * > | [DoubleLiteral] |
| 5173 * > | [IntegerLiteral] |
| 5174 * > | [ListLiteral] |
| 5175 * > | [MapLiteral] |
| 5176 * > | [NullLiteral] |
| 5177 * > | [StringLiteral] |
| 5178 * |
| 5179 * Clients may not extend, implement or mix-in this class. |
| 5180 */ |
| 5181 abstract class Literal extends Expression {} |
| 5182 |
| 5183 /** |
| 5184 * A literal map. |
| 5185 * |
| 5186 * > mapLiteral ::= |
| 5187 * > 'const'? ('<' [TypeName] (',' [TypeName])* '>')? |
| 5188 * > '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}' |
| 5189 * |
| 5190 * Clients may not extend, implement or mix-in this class. |
| 5191 */ |
| 5192 abstract class MapLiteral extends TypedLiteral { |
| 5193 /** |
| 5194 * Initialize a newly created map literal. The [constKeyword] can be `null` if |
| 5195 * the literal is not a constant. The [typeArguments] can be `null` if no type |
| 5196 * arguments were declared. The [entries] can be `null` if the map is empty. |
| 5197 */ |
| 5198 factory MapLiteral( |
| 5199 Token constKeyword, |
| 5200 TypeArgumentList typeArguments, |
| 5201 Token leftBracket, |
| 5202 List<MapLiteralEntry> entries, |
| 5203 Token rightBracket) = MapLiteralImpl; |
| 5204 |
| 5205 /** |
| 5206 * Return the entries in the map. |
| 5207 */ |
| 5208 NodeList<MapLiteralEntry> get entries; |
| 5209 |
| 5210 /** |
| 5211 * Return the left curly bracket. |
| 5212 */ |
| 5213 Token get leftBracket; |
| 5214 |
| 5215 /** |
| 5216 * Set the left curly bracket to the given [token]. |
| 5217 */ |
| 5218 void set leftBracket(Token token); |
| 5219 |
| 5220 /** |
| 5221 * Return the right curly bracket. |
| 5222 */ |
| 5223 Token get rightBracket; |
| 5224 |
| 5225 /** |
| 5226 * Set the right curly bracket to the given [token]. |
| 5227 */ |
| 5228 void set rightBracket(Token token); |
| 5229 } |
| 5230 |
| 5231 /** |
| 5232 * A single key/value pair in a map literal. |
| 5233 * |
| 5234 * > mapLiteralEntry ::= |
| 5235 * > [Expression] ':' [Expression] |
| 5236 * |
| 5237 * Clients may not extend, implement or mix-in this class. |
| 5238 */ |
| 5239 abstract class MapLiteralEntry extends AstNode { |
| 5240 /** |
| 5241 * Initialize a newly created map literal entry. |
| 5242 */ |
| 5243 factory MapLiteralEntry(Expression key, Token separator, Expression value) = |
| 5244 MapLiteralEntryImpl; |
| 5245 |
| 5246 /** |
| 5247 * Return the expression computing the key with which the value will be |
| 5248 * associated. |
| 5249 */ |
| 5250 Expression get key; |
| 5251 |
| 5252 /** |
| 5253 * Set the expression computing the key with which the value will be |
| 5254 * associated to the given [string]. |
| 5255 */ |
| 5256 void set key(Expression string); |
| 5257 |
| 5258 /** |
| 5259 * Return the colon that separates the key from the value. |
| 5260 */ |
| 5261 Token get separator; |
| 5262 |
| 5263 /** |
| 5264 * Set the colon that separates the key from the value to the given [token]. |
| 5265 */ |
| 5266 void set separator(Token token); |
| 5267 |
| 5268 /** |
| 5269 * Return the expression computing the value that will be associated with the |
| 5270 * key. |
| 5271 */ |
| 5272 Expression get value; |
| 5273 |
| 5274 /** |
| 5275 * Set the expression computing the value that will be associated with the key |
| 5276 * to the given [expression]. |
| 5277 */ |
| 5278 void set value(Expression expression); |
| 5279 } |
| 5280 |
| 5281 /** |
| 5282 * A method declaration. |
| 5283 * |
| 5284 * > methodDeclaration ::= |
| 5285 * > methodSignature [FunctionBody] |
| 5286 * > |
| 5287 * > methodSignature ::= |
| 5288 * > 'external'? ('abstract' | 'static')? [Type]? ('get' | 'set')? |
| 5289 * > methodName [TypeParameterList] [FormalParameterList] |
| 5290 * > |
| 5291 * > methodName ::= |
| 5292 * > [SimpleIdentifier] |
| 5293 * > | 'operator' [SimpleIdentifier] |
| 5294 * |
| 5295 * Clients may not extend, implement or mix-in this class. |
| 5296 */ |
| 5297 abstract class MethodDeclaration extends ClassMember { |
| 5298 /** |
| 5299 * Initialize a newly created method declaration. Either or both of the |
| 5300 * [comment] and [metadata] can be `null` if the declaration does not have the |
| 5301 * corresponding attribute. The [externalKeyword] can be `null` if the method |
| 5302 * is not external. The [modifierKeyword] can be `null` if the method is |
| 5303 * neither abstract nor static. The [returnType] can be `null` if no return |
| 5304 * type was specified. The [propertyKeyword] can be `null` if the method is |
| 5305 * neither a getter or a setter. The [operatorKeyword] can be `null` if the |
| 5306 * method does not implement an operator. The [parameters] must be `null` if |
| 5307 * this method declares a getter. |
| 5308 */ |
| 5309 factory MethodDeclaration( |
| 5310 Comment comment, |
| 5311 List<Annotation> metadata, |
| 5312 Token externalKeyword, |
| 5313 Token modifierKeyword, |
| 5314 TypeName returnType, |
| 5315 Token propertyKeyword, |
| 5316 Token operatorKeyword, |
| 5317 SimpleIdentifier name, |
| 5318 TypeParameterList typeParameters, |
| 5319 FormalParameterList parameters, |
| 5320 FunctionBody body) = MethodDeclarationImpl; |
| 5321 |
| 5322 /** |
| 5323 * Return the body of the method. |
| 5324 */ |
| 5325 FunctionBody get body; |
| 5326 |
| 5327 /** |
| 5328 * Set the body of the method to the given [functionBody]. |
| 5329 */ |
| 5330 void set body(FunctionBody functionBody); |
| 5331 |
| 5332 @override |
| 5333 ExecutableElement get element; |
| 5334 |
| 5335 /** |
| 5336 * Return the token for the 'external' keyword, or `null` if the constructor |
| 5337 * is not external. |
| 5338 */ |
| 5339 Token get externalKeyword; |
| 5340 |
| 5341 /** |
| 5342 * Set the token for the 'external' keyword to the given [token]. |
| 5343 */ |
| 5344 void set externalKeyword(Token token); |
| 5345 |
| 5346 /** |
| 5347 * Return `true` if this method is declared to be an abstract method. |
| 5348 */ |
| 5349 bool get isAbstract; |
| 5350 |
| 5351 /** |
| 5352 * Return `true` if this method declares a getter. |
| 5353 */ |
| 5354 bool get isGetter; |
| 5355 |
| 5356 /** |
| 5357 * Return `true` if this method declares an operator. |
| 5358 */ |
| 5359 bool get isOperator; |
| 5360 |
| 5361 /** |
| 5362 * Return `true` if this method declares a setter. |
| 5363 */ |
| 5364 bool get isSetter; |
| 5365 |
| 5366 /** |
| 5367 * Return `true` if this method is declared to be a static method. |
| 5368 */ |
| 5369 bool get isStatic; |
| 5370 |
| 5371 /** |
| 5372 * Return the token representing the 'abstract' or 'static' keyword, or `null` |
| 5373 * if neither modifier was specified. |
| 5374 */ |
| 5375 Token get modifierKeyword; |
| 5376 |
| 5377 /** |
| 5378 * Set the token representing the 'abstract' or 'static' keyword to the given |
| 5379 * [token]. |
| 5380 */ |
| 5381 void set modifierKeyword(Token token); |
| 5382 |
| 5383 /** |
| 5384 * Return the name of the method. |
| 5385 */ |
| 5386 SimpleIdentifier get name; |
| 5387 |
| 5388 /** |
| 5389 * Set the name of the method to the given [identifier]. |
| 5390 */ |
| 5391 void set name(SimpleIdentifier identifier); |
| 5392 |
| 5393 /** |
| 5394 * Return the token representing the 'operator' keyword, or `null` if this |
| 5395 * method does not declare an operator. |
| 5396 */ |
| 5397 Token get operatorKeyword; |
| 5398 |
| 5399 /** |
| 5400 * Set the token representing the 'operator' keyword to the given [token]. |
| 5401 */ |
| 5402 void set operatorKeyword(Token token); |
| 5403 |
| 5404 /** |
| 5405 * Return the parameters associated with the method, or `null` if this method |
| 5406 * declares a getter. |
| 5407 */ |
| 5408 FormalParameterList get parameters; |
| 5409 |
| 5410 /** |
| 5411 * Set the parameters associated with the method to the given list of |
| 5412 * [parameters]. |
| 5413 */ |
| 5414 void set parameters(FormalParameterList parameters); |
| 5415 |
| 5416 /** |
| 5417 * Return the token representing the 'get' or 'set' keyword, or `null` if this |
| 5418 * is a method declaration rather than a property declaration. |
| 5419 */ |
| 5420 Token get propertyKeyword; |
| 5421 |
| 5422 /** |
| 5423 * Set the token representing the 'get' or 'set' keyword to the given [token]. |
| 5424 */ |
| 5425 void set propertyKeyword(Token token); |
| 5426 |
| 5427 /** |
| 5428 * Return the return type of the method, or `null` if no return type was |
| 5429 * declared. |
| 5430 */ |
| 5431 TypeName get returnType; |
| 5432 |
| 5433 /** |
| 5434 * Set the return type of the method to the given [typeName]. |
| 5435 */ |
| 5436 void set returnType(TypeName typeName); |
| 5437 |
| 5438 /** |
| 5439 * Return the type parameters associated with this method, or `null` if this |
| 5440 * method is not a generic method. |
| 5441 */ |
| 5442 TypeParameterList get typeParameters; |
| 5443 |
| 5444 /** |
| 5445 * Set the type parameters associated with this method to the given |
| 5446 * [typeParameters]. |
| 5447 */ |
| 5448 void set typeParameters(TypeParameterList typeParameters); |
| 5449 } |
| 5450 |
| 5451 /** |
| 5452 * The invocation of either a function or a method. Invocations of functions |
| 5453 * resulting from evaluating an expression are represented by |
| 5454 * [FunctionExpressionInvocation] nodes. Invocations of getters and setters are |
| 5455 * represented by either [PrefixedIdentifier] or [PropertyAccess] nodes. |
| 5456 * |
| 5457 * > methodInvocation ::= |
| 5458 * > ([Expression] '.')? [SimpleIdentifier] [TypeArgumentList]? [ArgumentLis
t] |
| 5459 * |
| 5460 * Clients may not extend, implement or mix-in this class. |
| 5461 */ |
| 5462 abstract class MethodInvocation extends Expression { |
| 5463 /** |
| 5464 * Initialize a newly created method invocation. The [target] and [operator] |
| 5465 * can be `null` if there is no target. |
| 5466 */ |
| 5467 factory MethodInvocation( |
| 5468 Expression target, |
| 5469 Token operator, |
| 5470 SimpleIdentifier methodName, |
| 5471 TypeArgumentList typeArguments, |
| 5472 ArgumentList argumentList) = MethodInvocationImpl; |
| 5473 |
| 5474 /** |
| 5475 * Return the list of arguments to the method. |
| 5476 */ |
| 5477 ArgumentList get argumentList; |
| 5478 |
| 5479 /** |
| 5480 * Set the list of arguments to the method to the given [argumentList]. |
| 5481 */ |
| 5482 void set argumentList(ArgumentList argumentList); |
| 5483 |
| 5484 /** |
| 5485 * Return `true` if this expression is cascaded. If it is, then the target of |
| 5486 * this expression is not stored locally but is stored in the nearest ancestor |
| 5487 * that is a [CascadeExpression]. |
| 5488 */ |
| 5489 bool get isCascaded; |
| 5490 |
| 5491 /** |
| 5492 * Return the name of the method being invoked. |
| 5493 */ |
| 5494 SimpleIdentifier get methodName; |
| 5495 |
| 5496 /** |
| 5497 * Set the name of the method being invoked to the given [identifier]. |
| 5498 */ |
| 5499 void set methodName(SimpleIdentifier identifier); |
| 5500 |
| 5501 /** |
| 5502 * Return the operator that separates the target from the method name, or |
| 5503 * `null` if there is no target. In an ordinary method invocation this will be |
| 5504 * * period ('.'). In a cascade section this will be the cascade operator |
| 5505 * ('..'). |
| 5506 */ |
| 5507 Token get operator; |
| 5508 |
| 5509 /** |
| 5510 * Set the operator that separates the target from the method name to the |
| 5511 * given [token]. |
| 5512 */ |
| 5513 void set operator(Token token); |
| 5514 |
| 5515 /** |
| 5516 * Return the function type of the method invocation based on the propagated |
| 5517 * type information, or `null` if the AST structure has not been resolved, or |
| 5518 * if the invoke could not be resolved. |
| 5519 * |
| 5520 * This will usually be a [FunctionType], but it can also be an |
| 5521 * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy` |
| 5522 * interface type that implements `Function`. |
| 5523 */ |
| 5524 DartType get propagatedInvokeType; |
| 5525 |
| 5526 /** |
| 5527 * Set the function type of the method invocation based on the propagated type |
| 5528 * information to the given [type]. |
| 5529 */ |
| 5530 void set propagatedInvokeType(DartType type); |
| 5531 |
| 5532 /** |
| 5533 * Return the expression used to compute the receiver of the invocation. If |
| 5534 * this invocation is not part of a cascade expression, then this is the same |
| 5535 * as [target]. If this invocation is part of a cascade expression, then the |
| 5536 * target stored with the cascade expression is returned. |
| 5537 */ |
| 5538 Expression get realTarget; |
| 5539 |
| 5540 /** |
| 5541 * Return the function type of the method invocation based on the static type |
| 5542 * information, or `null` if the AST structure has not been resolved, or if |
| 5543 * the invoke could not be resolved. |
| 5544 * |
| 5545 * This will usually be a [FunctionType], but it can also be an |
| 5546 * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy` |
| 5547 * interface type that implements `Function`. |
| 5548 */ |
| 5549 DartType get staticInvokeType; |
| 5550 |
| 5551 /** |
| 5552 * Set the function type of the method invocation based on the static type |
| 5553 * information to the given [type]. |
| 5554 */ |
| 5555 void set staticInvokeType(DartType type); |
| 5556 |
| 5557 /** |
| 5558 * Return the expression producing the object on which the method is defined, |
| 5559 * or `null` if there is no target (that is, the target is implicitly `this`) |
| 5560 * or if this method invocation is part of a cascade expression. |
| 5561 * |
| 5562 * Use [realTarget] to get the target independent of whether this is part of a |
| 5563 * cascade expression. |
| 5564 */ |
| 5565 Expression get target; |
| 5566 |
| 5567 /** |
| 5568 * Set the expression producing the object on which the method is defined to |
| 5569 * the given [expression]. |
| 5570 */ |
| 5571 void set target(Expression expression); |
| 5572 |
| 5573 /** |
| 5574 * Return the type arguments to be applied to the method being invoked, or |
| 5575 * `null` if no type arguments were provided. |
| 5576 */ |
| 5577 TypeArgumentList get typeArguments; |
| 5578 |
| 5579 /** |
| 5580 * Set the type arguments to be applied to the method being invoked to the |
| 5581 * given [typeArguments]. |
| 5582 */ |
| 5583 void set typeArguments(TypeArgumentList typeArguments); |
| 5584 } |
| 5585 |
| 5586 /** |
| 5587 * A node that declares a single name within the scope of a compilation unit. |
| 5588 * |
| 5589 * Clients may not extend, implement or mix-in this class. |
| 5590 */ |
| 5591 abstract class NamedCompilationUnitMember extends CompilationUnitMember { |
| 5592 /** |
| 5593 * Return the name of the member being declared. |
| 5594 */ |
| 5595 SimpleIdentifier get name; |
| 5596 |
| 5597 /** |
| 5598 * Set the name of the member being declared to the given [identifier]. |
| 5599 */ |
| 5600 void set name(SimpleIdentifier identifier); |
| 5601 } |
| 5602 |
| 5603 /** |
| 5604 * An expression that has a name associated with it. They are used in method |
| 5605 * invocations when there are named parameters. |
| 5606 * |
| 5607 * > namedExpression ::= |
| 5608 * > [Label] [Expression] |
| 5609 * |
| 5610 * Clients may not extend, implement or mix-in this class. |
| 5611 */ |
| 5612 abstract class NamedExpression extends Expression { |
| 5613 /** |
| 5614 * Initialize a newly created named expression.. |
| 5615 */ |
| 5616 factory NamedExpression(Label name, Expression expression) = |
| 5617 NamedExpressionImpl; |
| 5618 |
| 5619 /** |
| 5620 * Return the element representing the parameter being named by this |
| 5621 * expression, or `null` if the AST structure has not been resolved or if |
| 5622 * there is no parameter with the same name as this expression. |
| 5623 */ |
| 5624 ParameterElement get element; |
| 5625 |
| 5626 /** |
| 5627 * Return the expression with which the name is associated. |
| 5628 */ |
| 5629 Expression get expression; |
| 5630 |
| 5631 /** |
| 5632 * Set the expression with which the name is associated to the given |
| 5633 * [expression]. |
| 5634 */ |
| 5635 void set expression(Expression expression); |
| 5636 |
| 5637 /** |
| 5638 * Return the name associated with the expression. |
| 5639 */ |
| 5640 Label get name; |
| 5641 |
| 5642 /** |
| 5643 * Set the name associated with the expression to the given [identifier]. |
| 5644 */ |
| 5645 void set name(Label identifier); |
| 5646 } |
| 5647 |
| 5648 /** |
| 5649 * A node that represents a directive that impacts the namespace of a library. |
| 5650 * |
| 5651 * > directive ::= |
| 5652 * > [ExportDirective] |
| 5653 * > | [ImportDirective] |
| 5654 * |
| 5655 * Clients may not extend, implement or mix-in this class. |
| 5656 */ |
| 5657 abstract class NamespaceDirective extends UriBasedDirective { |
| 5658 /** |
| 5659 * Return the combinators used to control how names are imported or exported. |
| 5660 */ |
| 5661 NodeList<Combinator> get combinators; |
| 5662 |
| 5663 /** |
| 5664 * Return the configurations used to control which library will actually be |
| 5665 * loaded at run-time. |
| 5666 */ |
| 5667 NodeList<Configuration> get configurations; |
| 5668 |
| 5669 /** |
| 5670 * Set the token representing the keyword that introduces this directive |
| 5671 * ('import', 'export', 'library' or 'part') to the given [token]. |
| 5672 */ |
| 5673 void set keyword(Token token); |
| 5674 |
| 5675 /** |
| 5676 * Return the semicolon terminating the directive. |
| 5677 */ |
| 5678 Token get semicolon; |
| 5679 |
| 5680 /** |
| 5681 * Set the semicolon terminating the directive to the given [token]. |
| 5682 */ |
| 5683 void set semicolon(Token token); |
| 5684 } |
| 5685 |
| 5686 /** |
| 5687 * The "native" clause in an class declaration. |
| 5688 * |
| 5689 * > nativeClause ::= |
| 5690 * > 'native' [StringLiteral] |
| 5691 * |
| 5692 * Clients may not extend, implement or mix-in this class. |
| 5693 */ |
| 5694 abstract class NativeClause extends AstNode { |
| 5695 /** |
| 5696 * Initialize a newly created native clause. |
| 5697 */ |
| 5698 factory NativeClause(Token nativeKeyword, StringLiteral name) = |
| 5699 NativeClauseImpl; |
| 5700 |
| 5701 /** |
| 5702 * Return the name of the native object that implements the class. |
| 5703 */ |
| 5704 StringLiteral get name; |
| 5705 |
| 5706 /** |
| 5707 * Set the name of the native object that implements the class to the given |
| 5708 * [name]. |
| 5709 */ |
| 5710 void set name(StringLiteral name); |
| 5711 |
| 5712 /** |
| 5713 * Return the token representing the 'native' keyword. |
| 5714 */ |
| 5715 Token get nativeKeyword; |
| 5716 |
| 5717 /** |
| 5718 * Set the token representing the 'native' keyword to the given [token]. |
| 5719 */ |
| 5720 void set nativeKeyword(Token token); |
| 5721 } |
| 5722 |
| 5723 /** |
| 5724 * A function body that consists of a native keyword followed by a string |
| 5725 * literal. |
| 5726 * |
| 5727 * > nativeFunctionBody ::= |
| 5728 * > 'native' [SimpleStringLiteral] ';' |
| 5729 * |
| 5730 * Clients may not extend, implement or mix-in this class. |
| 5731 */ |
| 5732 abstract class NativeFunctionBody extends FunctionBody { |
| 5733 /** |
| 5734 * Initialize a newly created function body consisting of the 'native' token, |
| 5735 * a string literal, and a semicolon. |
| 5736 */ |
| 5737 factory NativeFunctionBody( |
| 5738 Token nativeKeyword, StringLiteral stringLiteral, Token semicolon) = |
| 5739 NativeFunctionBodyImpl; |
| 5740 |
| 5741 /** |
| 5742 * Return the token representing 'native' that marks the start of the function |
| 5743 * body. |
| 5744 */ |
| 5745 Token get nativeKeyword; |
| 5746 |
| 5747 /** |
| 5748 * Set the token representing 'native' that marks the start of the function |
| 5749 * body to the given [token]. |
| 5750 */ |
| 5751 void set nativeKeyword(Token token); |
| 5752 |
| 5753 /** |
| 5754 * Return the token representing the semicolon that marks the end of the |
| 5755 * function body. |
| 5756 */ |
| 5757 Token get semicolon; |
| 5758 |
| 5759 /** |
| 5760 * Set the token representing the semicolon that marks the end of the |
| 5761 * function body to the given [token]. |
| 5762 */ |
| 5763 void set semicolon(Token token); |
| 5764 |
| 5765 /** |
| 5766 * Return the string literal representing the string after the 'native' token. |
| 5767 */ |
| 5768 StringLiteral get stringLiteral; |
| 5769 |
| 5770 /** |
| 5771 * Set the string literal representing the string after the 'native' token to |
| 5772 * the given [stringLiteral]. |
| 5773 */ |
| 5774 void set stringLiteral(StringLiteral stringLiteral); |
| 5775 } |
| 5776 |
| 5777 /** |
| 5778 * A list of AST nodes that have a common parent. |
| 5779 * |
| 5780 * Clients may not extend, implement or mix-in this class. |
| 5781 */ |
| 5782 abstract class NodeList<E extends AstNode> implements List<E> { |
| 5783 /** |
| 5784 * Initialize a newly created list of nodes such that all of the nodes that |
| 5785 * are added to the list will have their parent set to the given [owner]. The |
| 5786 * list will initially be populated with the given [elements]. |
| 5787 */ |
| 5788 factory NodeList(AstNode owner, [List<E> elements]) = NodeListImpl; |
| 5789 |
| 5790 /** |
| 5791 * Return the first token included in this node list's source range, or `null` |
| 5792 * if the list is empty. |
| 5793 */ |
| 5794 Token get beginToken; |
| 5795 |
| 5796 /** |
| 5797 * Return the last token included in this node list's source range, or `null` |
| 5798 * if the list is empty. |
| 5799 */ |
| 5800 Token get endToken; |
| 5801 |
| 5802 /** |
| 5803 * Return the node that is the parent of each of the elements in the list. |
| 5804 */ |
| 5805 AstNode get owner; |
| 5806 |
| 5807 /** |
| 5808 * Set the node that is the parent of each of the elements in the list to the |
| 5809 * given [node]. |
| 5810 */ |
| 5811 @deprecated // Never intended for public use. |
| 5812 void set owner(AstNode node); |
| 5813 |
| 5814 /** |
| 5815 * Return the node at the given [index] in the list or throw a [RangeError] if |
| 5816 * [index] is out of bounds. |
| 5817 */ |
| 5818 E operator [](int index); |
| 5819 |
| 5820 /** |
| 5821 * Set the node at the given [index] in the list to the given [node] or throw |
| 5822 * a [RangeError] if [index] is out of bounds. |
| 5823 */ |
| 5824 void operator []=(int index, E node); |
| 5825 |
| 5826 /** |
| 5827 * Use the given [visitor] to visit each of the nodes in this list. |
| 5828 */ |
| 5829 accept(AstVisitor visitor); |
| 5830 } |
| 5831 |
| 5832 /** |
| 5833 * A formal parameter that is required (is not optional). |
| 5834 * |
| 5835 * > normalFormalParameter ::= |
| 5836 * > [FunctionTypedFormalParameter] |
| 5837 * > | [FieldFormalParameter] |
| 5838 * > | [SimpleFormalParameter] |
| 5839 * |
| 5840 * Clients may not extend, implement or mix-in this class. |
| 5841 */ |
| 5842 abstract class NormalFormalParameter extends FormalParameter { |
| 5843 /** |
| 5844 * Return the documentation comment associated with this parameter, or `null` |
| 5845 * if this parameter does not have a documentation comment associated with it. |
| 5846 */ |
| 5847 Comment get documentationComment; |
| 5848 |
| 5849 /** |
| 5850 * Set the documentation comment associated with this parameter to the given |
| 5851 * [comment]. |
| 5852 */ |
| 5853 void set documentationComment(Comment comment); |
| 5854 |
| 5855 /** |
| 5856 * Set the name of the parameter being declared to the given [identifier]. |
| 5857 */ |
| 5858 void set identifier(SimpleIdentifier identifier); |
| 5859 |
| 5860 /** |
| 5861 * Set the metadata associated with this node to the given [metadata]. |
| 5862 */ |
| 5863 void set metadata(List<Annotation> metadata); |
| 5864 |
| 5865 /** |
| 5866 * Return a list containing the comment and annotations associated with this |
| 5867 * parameter, sorted in lexical order. |
| 5868 */ |
| 5869 List<AstNode> get sortedCommentAndAnnotations; |
| 5870 } |
| 5871 |
| 5872 /** |
| 5873 * A null literal expression. |
| 5874 * |
| 5875 * > nullLiteral ::= |
| 5876 * > 'null' |
| 5877 * |
| 5878 * Clients may not extend, implement or mix-in this class. |
| 5879 */ |
| 5880 abstract class NullLiteral extends Literal { |
| 5881 /** |
| 5882 * Initialize a newly created null literal. |
| 5883 */ |
| 5884 factory NullLiteral(Token literal) = NullLiteralImpl; |
| 5885 |
| 5886 /** |
| 5887 * Return the token representing the literal. |
| 5888 */ |
| 5889 Token get literal; |
| 5890 |
| 5891 /** |
| 5892 * Set the token representing the literal to the given [token]. |
| 5893 */ |
| 5894 void set literal(Token token); |
| 5895 } |
| 5896 |
| 5897 /** |
| 5898 * A parenthesized expression. |
| 5899 * |
| 5900 * > parenthesizedExpression ::= |
| 5901 * > '(' [Expression] ')' |
| 5902 * |
| 5903 * Clients may not extend, implement or mix-in this class. |
| 5904 */ |
| 5905 abstract class ParenthesizedExpression extends Expression { |
| 5906 /** |
| 5907 * Initialize a newly created parenthesized expression. |
| 5908 */ |
| 5909 factory ParenthesizedExpression(Token leftParenthesis, Expression expression, |
| 5910 Token rightParenthesis) = ParenthesizedExpressionImpl; |
| 5911 |
| 5912 /** |
| 5913 * Return the expression within the parentheses. |
| 5914 */ |
| 5915 Expression get expression; |
| 5916 |
| 5917 /** |
| 5918 * Set the expression within the parentheses to the given [expression]. |
| 5919 */ |
| 5920 void set expression(Expression expression); |
| 5921 |
| 5922 /** |
| 5923 * Return the left parenthesis. |
| 5924 */ |
| 5925 Token get leftParenthesis; |
| 5926 |
| 5927 /** |
| 5928 * Set the left parenthesis to the given [token]. |
| 5929 */ |
| 5930 void set leftParenthesis(Token token); |
| 5931 |
| 5932 /** |
| 5933 * Return the right parenthesis. |
| 5934 */ |
| 5935 Token get rightParenthesis; |
| 5936 |
| 5937 /** |
| 5938 * Set the right parenthesis to the given [token]. |
| 5939 */ |
| 5940 void set rightParenthesis(Token token); |
| 5941 } |
| 5942 |
| 5943 /** |
| 5944 * A part directive. |
| 5945 * |
| 5946 * > partDirective ::= |
| 5947 * > [Annotation] 'part' [StringLiteral] ';' |
| 5948 * |
| 5949 * Clients may not extend, implement or mix-in this class. |
| 5950 */ |
| 5951 abstract class PartDirective extends UriBasedDirective { |
| 5952 /** |
| 5953 * Initialize a newly created part directive. Either or both of the [comment] |
| 5954 * and [metadata] can be `null` if the directive does not have the |
| 5955 * corresponding attribute. |
| 5956 */ |
| 5957 factory PartDirective( |
| 5958 Comment comment, |
| 5959 List<Annotation> metadata, |
| 5960 Token partKeyword, |
| 5961 StringLiteral partUri, |
| 5962 Token semicolon) = PartDirectiveImpl; |
| 5963 |
| 5964 /** |
| 5965 * Return the token representing the 'part' keyword. |
| 5966 */ |
| 5967 Token get partKeyword; |
| 5968 |
| 5969 /** |
| 5970 * Set the token representing the 'part' keyword to the given [token]. |
| 5971 */ |
| 5972 void set partKeyword(Token token); |
| 5973 |
| 5974 /** |
| 5975 * Return the semicolon terminating the directive. |
| 5976 */ |
| 5977 Token get semicolon; |
| 5978 |
| 5979 /** |
| 5980 * Set the semicolon terminating the directive to the given [token]. |
| 5981 */ |
| 5982 void set semicolon(Token token); |
| 5983 } |
| 5984 |
| 5985 /** |
| 5986 * A part-of directive. |
| 5987 * |
| 5988 * > partOfDirective ::= |
| 5989 * > [Annotation] 'part' 'of' [Identifier] ';' |
| 5990 * |
| 5991 * Clients may not extend, implement or mix-in this class. |
| 5992 */ |
| 5993 abstract class PartOfDirective extends Directive { |
| 5994 /** |
| 5995 * Initialize a newly created part-of directive. Either or both of the |
| 5996 * [comment] and [metadata] can be `null` if the directive does not have the |
| 5997 * corresponding attribute. |
| 5998 */ |
| 5999 factory PartOfDirective( |
| 6000 Comment comment, |
| 6001 List<Annotation> metadata, |
| 6002 Token partKeyword, |
| 6003 Token ofKeyword, |
| 6004 LibraryIdentifier libraryName, |
| 6005 Token semicolon) = PartOfDirectiveImpl; |
| 6006 |
| 6007 /** |
| 6008 * Return the name of the library that the containing compilation unit is part |
| 6009 * of. |
| 6010 */ |
| 6011 LibraryIdentifier get libraryName; |
| 6012 |
| 6013 /** |
| 6014 * Set the name of the library that the containing compilation unit is part of |
| 6015 * to the given [libraryName]. |
| 6016 */ |
| 6017 void set libraryName(LibraryIdentifier libraryName); |
| 6018 |
| 6019 /** |
| 6020 * Return the token representing the 'of' keyword. |
| 6021 */ |
| 6022 Token get ofKeyword; |
| 6023 |
| 6024 /** |
| 6025 * Set the token representing the 'of' keyword to the given [token]. |
| 6026 */ |
| 6027 void set ofKeyword(Token token); |
| 6028 |
| 6029 /** |
| 6030 * Return the token representing the 'part' keyword. |
| 6031 */ |
| 6032 Token get partKeyword; |
| 6033 |
| 6034 /** |
| 6035 * Set the token representing the 'part' keyword to the given [token]. |
| 6036 */ |
| 6037 void set partKeyword(Token token); |
| 6038 |
| 6039 /** |
| 6040 * Return the semicolon terminating the directive. |
| 6041 */ |
| 6042 Token get semicolon; |
| 6043 |
| 6044 /** |
| 6045 * Set the semicolon terminating the directive to the given [token]. |
| 6046 */ |
| 6047 void set semicolon(Token token); |
| 6048 } |
| 6049 |
| 6050 /** |
| 6051 * A postfix unary expression. |
| 6052 * |
| 6053 * > postfixExpression ::= |
| 6054 * > [Expression] [Token] |
| 6055 * |
| 6056 * Clients may not extend, implement or mix-in this class. |
| 6057 */ |
| 6058 abstract class PostfixExpression extends Expression { |
| 6059 /** |
| 6060 * Initialize a newly created postfix expression. |
| 6061 */ |
| 6062 factory PostfixExpression(Expression operand, Token operator) = |
| 6063 PostfixExpressionImpl; |
| 6064 |
| 6065 /** |
| 6066 * Return the best element available for this operator. If resolution was able |
| 6067 * to find a better element based on type propagation, that element will be |
| 6068 * returned. Otherwise, the element found using the result of static analysis |
| 6069 * will be returned. If resolution has not been performed, then `null` will be |
| 6070 * returned. |
| 6071 */ |
| 6072 MethodElement get bestElement; |
| 6073 |
| 6074 /** |
| 6075 * Return the expression computing the operand for the operator. |
| 6076 */ |
| 6077 Expression get operand; |
| 6078 |
| 6079 /** |
| 6080 * Set the expression computing the operand for the operator to the given |
| 6081 * [expression]. |
| 6082 */ |
| 6083 void set operand(Expression expression); |
| 6084 |
| 6085 /** |
| 6086 * Return the postfix operator being applied to the operand. |
| 6087 */ |
| 6088 Token get operator; |
| 6089 |
| 6090 /** |
| 6091 * Set the postfix operator being applied to the operand to the given [token]. |
| 6092 */ |
| 6093 void set operator(Token token); |
| 6094 |
| 6095 /** |
| 6096 * Return the element associated with this the operator based on the |
| 6097 * propagated type of the operand, or `null` if the AST structure has not been |
| 6098 * resolved, if the operator is not user definable, or if the operator could |
| 6099 * not be resolved. |
| 6100 */ |
| 6101 MethodElement get propagatedElement; |
| 6102 |
| 6103 /** |
| 6104 * Set the element associated with this the operator based on the propagated |
| 6105 * type of the operand to the given [element]. |
| 6106 */ |
| 6107 void set propagatedElement(MethodElement element); |
| 6108 |
| 6109 /** |
| 6110 * Return the element associated with the operator based on the static type of |
| 6111 * the operand, or `null` if the AST structure has not been resolved, if the |
| 6112 * operator is not user definable, or if the operator could not be resolved. |
| 6113 */ |
| 6114 MethodElement get staticElement; |
| 6115 |
| 6116 /** |
| 6117 * Set the element associated with the operator based on the static type of |
| 6118 * the operand to the given [element]. |
| 6119 */ |
| 6120 void set staticElement(MethodElement element); |
| 6121 } |
| 6122 |
| 6123 /** |
| 6124 * An identifier that is prefixed or an access to an object property where the |
| 6125 * target of the property access is a simple identifier. |
| 6126 * |
| 6127 * > prefixedIdentifier ::= |
| 6128 * > [SimpleIdentifier] '.' [SimpleIdentifier] |
| 6129 * |
| 6130 * Clients may not extend, implement or mix-in this class. |
| 6131 */ |
| 6132 abstract class PrefixedIdentifier extends Identifier { |
| 6133 /** |
| 6134 * Initialize a newly created prefixed identifier. |
| 6135 */ |
| 6136 factory PrefixedIdentifier( |
| 6137 SimpleIdentifier prefix, Token period, SimpleIdentifier identifier) = |
| 6138 PrefixedIdentifierImpl; |
| 6139 |
| 6140 /** |
| 6141 * Return the identifier being prefixed. |
| 6142 */ |
| 6143 SimpleIdentifier get identifier; |
| 6144 |
| 6145 /** |
| 6146 * Set the identifier being prefixed to the given [identifier]. |
| 6147 */ |
| 6148 void set identifier(SimpleIdentifier identifier); |
| 6149 |
| 6150 /** |
| 6151 * Return `true` if this type is a deferred type. If the AST structure has not |
| 6152 * been resolved, then return `false`. |
| 6153 * |
| 6154 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form |
| 6155 * </i>p.T</i> where <i>p</i> is a deferred prefix. |
| 6156 */ |
| 6157 bool get isDeferred; |
| 6158 |
| 6159 /** |
| 6160 * Return the period used to separate the prefix from the identifier. |
| 6161 */ |
| 6162 Token get period; |
| 6163 |
| 6164 /** |
| 6165 * Set the period used to separate the prefix from the identifier to the given |
| 6166 * [token]. |
| 6167 */ |
| 6168 void set period(Token token); |
| 6169 |
| 6170 /** |
| 6171 * Return the prefix associated with the library in which the identifier is |
| 6172 * defined. |
| 6173 */ |
| 6174 SimpleIdentifier get prefix; |
| 6175 |
| 6176 /** |
| 6177 * Set the prefix associated with the library in which the identifier is |
| 6178 * defined to the given [identifier]. |
| 6179 */ |
| 6180 void set prefix(SimpleIdentifier identifier); |
| 6181 } |
| 6182 |
| 6183 /** |
| 6184 * A prefix unary expression. |
| 6185 * |
| 6186 * > prefixExpression ::= |
| 6187 * > [Token] [Expression] |
| 6188 * |
| 6189 * Clients may not extend, implement or mix-in this class. |
| 6190 */ |
| 6191 abstract class PrefixExpression extends Expression { |
| 6192 /** |
| 6193 * Initialize a newly created prefix expression. |
| 6194 */ |
| 6195 factory PrefixExpression(Token operator, Expression operand) = |
| 6196 PrefixExpressionImpl; |
| 6197 |
| 6198 /** |
| 6199 * Return the best element available for this operator. If resolution was able |
| 6200 * to find a better element based on type propagation, that element will be |
| 6201 * returned. Otherwise, the element found using the result of static analysis |
| 6202 * will be returned. If resolution has not been performed, then `null` will be |
| 6203 * returned. |
| 6204 */ |
| 6205 MethodElement get bestElement; |
| 6206 |
| 6207 /** |
| 6208 * Return the expression computing the operand for the operator. |
| 6209 */ |
| 6210 Expression get operand; |
| 6211 |
| 6212 /** |
| 6213 * Set the expression computing the operand for the operator to the given |
| 6214 * [expression]. |
| 6215 */ |
| 6216 void set operand(Expression expression); |
| 6217 |
| 6218 /** |
| 6219 * Return the prefix operator being applied to the operand. |
| 6220 */ |
| 6221 Token get operator; |
| 6222 |
| 6223 /** |
| 6224 * Set the prefix operator being applied to the operand to the given [token]. |
| 6225 */ |
| 6226 void set operator(Token token); |
| 6227 |
| 6228 /** |
| 6229 * Return the element associated with the operator based on the propagated |
| 6230 * type of the operand, or `null` if the AST structure has not been resolved, |
| 6231 * if the operator is not user definable, or if the operator could not be |
| 6232 * resolved. |
| 6233 */ |
| 6234 MethodElement get propagatedElement; |
| 6235 |
| 6236 /** |
| 6237 * Set the element associated with the operator based on the propagated type |
| 6238 * of the operand to the given [element]. |
| 6239 */ |
| 6240 void set propagatedElement(MethodElement element); |
| 6241 |
| 6242 /** |
| 6243 * Return the element associated with the operator based on the static type of |
| 6244 * the operand, or `null` if the AST structure has not been resolved, if the |
| 6245 * operator is not user definable, or if the operator could not be resolved. |
| 6246 */ |
| 6247 MethodElement get staticElement; |
| 6248 |
| 6249 /** |
| 6250 * Set the element associated with the operator based on the static type of |
| 6251 * the operand to the given [element]. |
| 6252 */ |
| 6253 void set staticElement(MethodElement element); |
| 6254 } |
| 6255 |
| 6256 /** |
| 6257 * The access of a property of an object. |
| 6258 * |
| 6259 * Note, however, that accesses to properties of objects can also be represented |
| 6260 * as [PrefixedIdentifier] nodes in cases where the target is also a simple |
| 6261 * identifier. |
| 6262 * |
| 6263 * > propertyAccess ::= |
| 6264 * > [Expression] '.' [SimpleIdentifier] |
| 6265 * |
| 6266 * Clients may not extend, implement or mix-in this class. |
| 6267 */ |
| 6268 abstract class PropertyAccess extends Expression { |
| 6269 /** |
| 6270 * Initialize a newly created property access expression. |
| 6271 */ |
| 6272 factory PropertyAccess( |
| 6273 Expression target, Token operator, SimpleIdentifier propertyName) = |
| 6274 PropertyAccessImpl; |
| 6275 |
| 6276 /** |
| 6277 * Return `true` if this expression is cascaded. If it is, then the target of |
| 6278 * this expression is not stored locally but is stored in the nearest ancestor |
| 6279 * that is a [CascadeExpression]. |
| 6280 */ |
| 6281 bool get isCascaded; |
| 6282 |
| 6283 /** |
| 6284 * Return the property access operator. |
| 6285 */ |
| 6286 Token get operator; |
| 6287 |
| 6288 /** |
| 6289 * Set the property access operator to the given [token]. |
| 6290 */ |
| 6291 void set operator(Token token); |
| 6292 |
| 6293 /** |
| 6294 * Return the name of the property being accessed. |
| 6295 */ |
| 6296 SimpleIdentifier get propertyName; |
| 6297 |
| 6298 /** |
| 6299 * Set the name of the property being accessed to the given [identifier]. |
| 6300 */ |
| 6301 void set propertyName(SimpleIdentifier identifier); |
| 6302 |
| 6303 /** |
| 6304 * Return the expression used to compute the receiver of the invocation. If |
| 6305 * this invocation is not part of a cascade expression, then this is the same |
| 6306 * as [target]. If this invocation is part of a cascade expression, then the |
| 6307 * target stored with the cascade expression is returned. |
| 6308 */ |
| 6309 Expression get realTarget; |
| 6310 |
| 6311 /** |
| 6312 * Return the expression computing the object defining the property being |
| 6313 * accessed, or `null` if this property access is part of a cascade expression
. |
| 6314 * |
| 6315 * Use [realTarget] to get the target independent of whether this is part of a |
| 6316 * cascade expression. |
| 6317 */ |
| 6318 Expression get target; |
| 6319 |
| 6320 /** |
| 6321 * Set the expression computing the object defining the property being |
| 6322 * accessed to the given [expression]. |
| 6323 */ |
| 6324 void set target(Expression expression); |
| 6325 } |
| 6326 |
| 6327 /** |
| 6328 * The invocation of a constructor in the same class from within a constructor's |
| 6329 * initialization list. |
| 6330 * |
| 6331 * > redirectingConstructorInvocation ::= |
| 6332 * > 'this' ('.' identifier)? arguments |
| 6333 * |
| 6334 * Clients may not extend, implement or mix-in this class. |
| 6335 */ |
| 6336 abstract class RedirectingConstructorInvocation extends ConstructorInitializer { |
| 6337 /** |
| 6338 * Initialize a newly created redirecting invocation to invoke the constructor |
| 6339 * with the given name with the given arguments. The [constructorName] can be |
| 6340 * `null` if the constructor being invoked is the unnamed constructor. |
| 6341 */ |
| 6342 factory RedirectingConstructorInvocation( |
| 6343 Token thisKeyword, |
| 6344 Token period, |
| 6345 SimpleIdentifier constructorName, |
| 6346 ArgumentList argumentList) = RedirectingConstructorInvocationImpl; |
| 6347 |
| 6348 /** |
| 6349 * Return the list of arguments to the constructor. |
| 6350 */ |
| 6351 ArgumentList get argumentList; |
| 6352 |
| 6353 /** |
| 6354 * Set the list of arguments to the constructor to the given [argumentList]. |
| 6355 */ |
| 6356 void set argumentList(ArgumentList argumentList); |
| 6357 |
| 6358 /** |
| 6359 * Return the name of the constructor that is being invoked, or `null` if the |
| 6360 * unnamed constructor is being invoked. |
| 6361 */ |
| 6362 SimpleIdentifier get constructorName; |
| 6363 |
| 6364 /** |
| 6365 * Set the name of the constructor that is being invoked to the given |
| 6366 * [identifier]. |
| 6367 */ |
| 6368 void set constructorName(SimpleIdentifier identifier); |
| 6369 |
| 6370 /** |
| 6371 * Return the token for the period before the name of the constructor that is |
| 6372 * being invoked, or `null` if the unnamed constructor is being invoked. |
| 6373 */ |
| 6374 Token get period; |
| 6375 |
| 6376 /** |
| 6377 * Set the token for the period before the name of the constructor that is |
| 6378 * being invoked to the given [token]. |
| 6379 */ |
| 6380 void set period(Token token); |
| 6381 |
| 6382 /** |
| 6383 * Return the element associated with the constructor based on static type |
| 6384 * information, or `null` if the AST structure has not been resolved or if the |
| 6385 * constructor could not be resolved. |
| 6386 */ |
| 6387 ConstructorElement get staticElement; |
| 6388 |
| 6389 /** |
| 6390 * Set the element associated with the constructor based on static type |
| 6391 * information to the given [element]. |
| 6392 */ |
| 6393 void set staticElement(ConstructorElement element); |
| 6394 |
| 6395 /** |
| 6396 * Return the token for the 'this' keyword. |
| 6397 */ |
| 6398 Token get thisKeyword; |
| 6399 |
| 6400 /** |
| 6401 * Set the token for the 'this' keyword to the given [token]. |
| 6402 */ |
| 6403 void set thisKeyword(Token token); |
| 6404 } |
| 6405 |
| 6406 /** |
| 6407 * A rethrow expression. |
| 6408 * |
| 6409 * > rethrowExpression ::= |
| 6410 * > 'rethrow' |
| 6411 * |
| 6412 * Clients may not extend, implement or mix-in this class. |
| 6413 */ |
| 6414 abstract class RethrowExpression extends Expression { |
| 6415 /** |
| 6416 * Initialize a newly created rethrow expression. |
| 6417 */ |
| 6418 factory RethrowExpression(Token rethrowKeyword) = RethrowExpressionImpl; |
| 6419 |
| 6420 /** |
| 6421 * Return the token representing the 'rethrow' keyword. |
| 6422 */ |
| 6423 Token get rethrowKeyword; |
| 6424 |
| 6425 /** |
| 6426 * Set the token representing the 'rethrow' keyword to the given [token]. |
| 6427 */ |
| 6428 void set rethrowKeyword(Token token); |
| 6429 } |
| 6430 |
| 6431 /** |
| 6432 * A return statement. |
| 6433 * |
| 6434 * > returnStatement ::= |
| 6435 * > 'return' [Expression]? ';' |
| 6436 * |
| 6437 * Clients may not extend, implement or mix-in this class. |
| 6438 */ |
| 6439 abstract class ReturnStatement extends Statement { |
| 6440 /** |
| 6441 * Initialize a newly created return statement. The [expression] can be `null` |
| 6442 * if no explicit value was provided. |
| 6443 */ |
| 6444 factory ReturnStatement( |
| 6445 Token returnKeyword, Expression expression, Token semicolon) = |
| 6446 ReturnStatementImpl; |
| 6447 |
| 6448 /** |
| 6449 * Return the expression computing the value to be returned, or `null` if no |
| 6450 * explicit value was provided. |
| 6451 */ |
| 6452 Expression get expression; |
| 6453 |
| 6454 /** |
| 6455 * Set the expression computing the value to be returned to the given |
| 6456 * [expression]. |
| 6457 */ |
| 6458 void set expression(Expression expression); |
| 6459 |
| 6460 /** |
| 6461 * Return the token representing the 'return' keyword. |
| 6462 */ |
| 6463 Token get returnKeyword; |
| 6464 |
| 6465 /** |
| 6466 * Set the token representing the 'return' keyword to the given [token]. |
| 6467 */ |
| 6468 void set returnKeyword(Token token); |
| 6469 |
| 6470 /** |
| 6471 * Return the semicolon terminating the statement. |
| 6472 */ |
| 6473 Token get semicolon; |
| 6474 |
| 6475 /** |
| 6476 * Set the semicolon terminating the statement to the given [token]. |
| 6477 */ |
| 6478 void set semicolon(Token token); |
| 6479 } |
| 6480 |
| 6481 /** |
| 6482 * A script tag that can optionally occur at the beginning of a compilation unit
. |
| 6483 * |
| 6484 * > scriptTag ::= |
| 6485 * > '#!' (~NEWLINE)* NEWLINE |
| 6486 * |
| 6487 * Clients may not extend, implement or mix-in this class. |
| 6488 */ |
| 6489 abstract class ScriptTag extends AstNode { |
| 6490 /** |
| 6491 * Initialize a newly created script tag. |
| 6492 */ |
| 6493 factory ScriptTag(Token scriptTag) = ScriptTagImpl; |
| 6494 |
| 6495 /** |
| 6496 * Return the token representing this script tag. |
| 6497 */ |
| 6498 Token get scriptTag; |
| 6499 |
| 6500 /** |
| 6501 * Set the token representing this script tag to the given [token]. |
| 6502 */ |
| 6503 void set scriptTag(Token token); |
| 6504 } |
| 6505 |
| 6506 /** |
| 6507 * A combinator that restricts the names being imported to those in a given list
. |
| 6508 * |
| 6509 * > showCombinator ::= |
| 6510 * > 'show' [SimpleIdentifier] (',' [SimpleIdentifier])* |
| 6511 * |
| 6512 * Clients may not extend, implement or mix-in this class. |
| 6513 */ |
| 6514 abstract class ShowCombinator extends Combinator { |
| 6515 /** |
| 6516 * Initialize a newly created import show combinator. |
| 6517 */ |
| 6518 factory ShowCombinator(Token keyword, List<SimpleIdentifier> shownNames) = |
| 6519 ShowCombinatorImpl; |
| 6520 |
| 6521 /** |
| 6522 * Return the list of names from the library that are made visible by this |
| 6523 * combinator. |
| 6524 */ |
| 6525 NodeList<SimpleIdentifier> get shownNames; |
| 6526 } |
| 6527 |
| 6528 /** |
| 6529 * A simple formal parameter. |
| 6530 * |
| 6531 * > simpleFormalParameter ::= |
| 6532 * > ('final' [TypeName] | 'var' | [TypeName])? [SimpleIdentifier] |
| 6533 * |
| 6534 * Clients may not extend, implement or mix-in this class. |
| 6535 */ |
| 6536 abstract class SimpleFormalParameter extends NormalFormalParameter { |
| 6537 /** |
| 6538 * Initialize a newly created formal parameter. Either or both of the |
| 6539 * [comment] and [metadata] can be `null` if the parameter does not have the |
| 6540 * corresponding attribute. The [keyword] can be `null` if a type was |
| 6541 * specified. The [type] must be `null` if the keyword is 'var'. |
| 6542 */ |
| 6543 factory SimpleFormalParameter( |
| 6544 Comment comment, |
| 6545 List<Annotation> metadata, |
| 6546 Token keyword, |
| 6547 TypeName type, |
| 6548 SimpleIdentifier identifier) = SimpleFormalParameterImpl; |
| 6549 |
| 6550 /** |
| 6551 * Return the token representing either the 'final', 'const' or 'var' keyword, |
| 6552 * or `null` if no keyword was used. |
| 6553 */ |
| 6554 Token get keyword; |
| 6555 |
| 6556 /** |
| 6557 * Set the token representing either the 'final', 'const' or 'var' keyword to |
| 6558 * the given [token]. |
| 6559 */ |
| 6560 void set keyword(Token token); |
| 6561 |
| 6562 /** |
| 6563 * Return the name of the declared type of the parameter, or `null` if the |
| 6564 * parameter does not have a declared type. |
| 6565 */ |
| 6566 TypeName get type; |
| 6567 |
| 6568 /** |
| 6569 * Set the name of the declared type of the parameter to the given [typeName]. |
| 6570 */ |
| 6571 void set type(TypeName typeName); |
| 6572 } |
| 6573 |
| 6574 /** |
| 6575 * A simple identifier. |
| 6576 * |
| 6577 * > simpleIdentifier ::= |
| 6578 * > initialCharacter internalCharacter* |
| 6579 * > |
| 6580 * > initialCharacter ::= '_' | '$' | letter |
| 6581 * > |
| 6582 * > internalCharacter ::= '_' | '$' | letter | digit |
| 6583 * |
| 6584 * Clients may not extend, implement or mix-in this class. |
| 6585 */ |
| 6586 abstract class SimpleIdentifier extends Identifier { |
| 6587 /** |
| 6588 * Initialize a newly created identifier. |
| 6589 */ |
| 6590 factory SimpleIdentifier(Token token) = SimpleIdentifierImpl; |
| 6591 |
| 6592 /** |
| 6593 * Return the auxiliary elements associated with this identifier, or `null` if |
| 6594 * this identifier is not in both a getter and setter context. The auxiliary |
| 6595 * elements hold the static and propagated elements associated with the getter |
| 6596 * context. |
| 6597 */ |
| 6598 // TODO(brianwilkerson) Replace this API. |
| 6599 AuxiliaryElements get auxiliaryElements; |
| 6600 |
| 6601 /** |
| 6602 * Set the auxiliary elements associated with this identifier to the given |
| 6603 * [elements]. |
| 6604 */ |
| 6605 // TODO(brianwilkerson) Replace this API. |
| 6606 void set auxiliaryElements(AuxiliaryElements elements); |
| 6607 |
| 6608 /** |
| 6609 * Return `true` if this identifier is the "name" part of a prefixed |
| 6610 * identifier or a method invocation. |
| 6611 */ |
| 6612 bool get isQualified; |
| 6613 |
| 6614 /** |
| 6615 * Set the element associated with this identifier based on propagated type |
| 6616 * information to the given [element]. |
| 6617 */ |
| 6618 void set propagatedElement(Element element); |
| 6619 |
| 6620 /** |
| 6621 * Set the element associated with this identifier based on static type |
| 6622 * information to the given [element]. |
| 6623 */ |
| 6624 void set staticElement(Element element); |
| 6625 |
| 6626 /** |
| 6627 * Return the token representing the identifier. |
| 6628 */ |
| 6629 Token get token; |
| 6630 |
| 6631 /** |
| 6632 * Set the token representing the identifier to the given [token]. |
| 6633 */ |
| 6634 void set token(Token token); |
| 6635 |
| 6636 /** |
| 6637 * Return `true` if this identifier is the name being declared in a |
| 6638 * declaration. |
| 6639 */ |
| 6640 // TODO(brianwilkerson) Convert this to a getter. |
| 6641 bool inDeclarationContext(); |
| 6642 |
| 6643 /** |
| 6644 * Return `true` if this expression is computing a right-hand value. |
| 6645 * |
| 6646 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor |
| 6647 * are they mutually exclusive. In other words, it is possible for both |
| 6648 * methods to return `true` when invoked on the same node. |
| 6649 */ |
| 6650 // TODO(brianwilkerson) Convert this to a getter. |
| 6651 bool inGetterContext(); |
| 6652 |
| 6653 /** |
| 6654 * Return `true` if this expression is computing a left-hand value. |
| 6655 * |
| 6656 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor |
| 6657 * are they mutually exclusive. In other words, it is possible for both |
| 6658 * methods to return `true` when invoked on the same node. |
| 6659 */ |
| 6660 // TODO(brianwilkerson) Convert this to a getter. |
| 6661 bool inSetterContext(); |
| 6662 } |
| 6663 |
| 6664 /** |
| 6665 * A string literal expression that does not contain any interpolations. |
| 6666 * |
| 6667 * > simpleStringLiteral ::= |
| 6668 * > rawStringLiteral |
| 6669 * > | basicStringLiteral |
| 6670 * > |
| 6671 * > rawStringLiteral ::= |
| 6672 * > 'r' basicStringLiteral |
| 6673 * > |
| 6674 * > simpleStringLiteral ::= |
| 6675 * > multiLineStringLiteral |
| 6676 * > | singleLineStringLiteral |
| 6677 * > |
| 6678 * > multiLineStringLiteral ::= |
| 6679 * > "'''" characters "'''" |
| 6680 * > | '"""' characters '"""' |
| 6681 * > |
| 6682 * > singleLineStringLiteral ::= |
| 6683 * > "'" characters "'" |
| 6684 * > | '"' characters '"' |
| 6685 * |
| 6686 * Clients may not extend, implement or mix-in this class. |
| 6687 */ |
| 6688 abstract class SimpleStringLiteral extends SingleStringLiteral { |
| 6689 /** |
| 6690 * Initialize a newly created simple string literal. |
| 6691 */ |
| 6692 factory SimpleStringLiteral(Token literal, String value) = |
| 6693 SimpleStringLiteralImpl; |
| 6694 |
| 6695 /** |
| 6696 * Return the token representing the literal. |
| 6697 */ |
| 6698 Token get literal; |
| 6699 |
| 6700 /** |
| 6701 * Set the token representing the literal to the given [token]. |
| 6702 */ |
| 6703 void set literal(Token token); |
| 6704 |
| 6705 /** |
| 6706 * Return the value of the literal. |
| 6707 */ |
| 6708 String get value; |
| 6709 |
| 6710 /** |
| 6711 * Set the value of the literal to the given [string]. |
| 6712 */ |
| 6713 void set value(String string); |
| 6714 } |
| 6715 |
| 6716 /** |
| 6717 * A single string literal expression. |
| 6718 * |
| 6719 * > singleStringLiteral ::= |
| 6720 * > [SimpleStringLiteral] |
| 6721 * > | [StringInterpolation] |
| 6722 * |
| 6723 * Clients may not extend, implement or mix-in this class. |
| 6724 */ |
| 6725 abstract class SingleStringLiteral extends StringLiteral { |
| 6726 /** |
| 6727 * Return the offset of the after-last contents character. |
| 6728 */ |
| 6729 int get contentsEnd; |
| 6730 |
| 6731 /** |
| 6732 * Return the offset of the first contents character. |
| 6733 * If the string is multiline, then leading whitespaces are skipped. |
| 6734 */ |
| 6735 int get contentsOffset; |
| 6736 |
| 6737 /** |
| 6738 * Return `true` if this string literal is a multi-line string. |
| 6739 */ |
| 6740 bool get isMultiline; |
| 6741 |
| 6742 /** |
| 6743 * Return `true` if this string literal is a raw string. |
| 6744 */ |
| 6745 bool get isRaw; |
| 6746 |
| 6747 /** |
| 6748 * Return `true` if this string literal uses single quotes (' or '''). |
| 6749 * Return `false` if this string literal uses double quotes (" or """). |
| 6750 */ |
| 6751 bool get isSingleQuoted; |
| 6752 } |
| 6753 |
| 6754 /** |
| 6755 * A node that represents a statement. |
| 6756 * |
| 6757 * > statement ::= |
| 6758 * > [Block] |
| 6759 * > | [VariableDeclarationStatement] |
| 6760 * > | [ForStatement] |
| 6761 * > | [ForEachStatement] |
| 6762 * > | [WhileStatement] |
| 6763 * > | [DoStatement] |
| 6764 * > | [SwitchStatement] |
| 6765 * > | [IfStatement] |
| 6766 * > | [TryStatement] |
| 6767 * > | [BreakStatement] |
| 6768 * > | [ContinueStatement] |
| 6769 * > | [ReturnStatement] |
| 6770 * > | [ExpressionStatement] |
| 6771 * > | [FunctionDeclarationStatement] |
| 6772 * |
| 6773 * Clients may not extend, implement or mix-in this class. |
| 6774 */ |
| 6775 abstract class Statement extends AstNode { |
| 6776 /** |
| 6777 * If this is a labeled statement, return the unlabeled portion of the |
| 6778 * statement, otherwise return the statement itself. |
| 6779 */ |
| 6780 Statement get unlabeled; |
| 6781 } |
| 6782 |
| 6783 /** |
| 6784 * A string interpolation literal. |
| 6785 * |
| 6786 * > stringInterpolation ::= |
| 6787 * > ''' [InterpolationElement]* ''' |
| 6788 * > | '"' [InterpolationElement]* '"' |
| 6789 * |
| 6790 * Clients may not extend, implement or mix-in this class. |
| 6791 */ |
| 6792 abstract class StringInterpolation extends SingleStringLiteral { |
| 6793 /** |
| 6794 * Initialize a newly created string interpolation expression. |
| 6795 */ |
| 6796 factory StringInterpolation(List<InterpolationElement> elements) = |
| 6797 StringInterpolationImpl; |
| 6798 |
| 6799 /** |
| 6800 * Return the elements that will be composed to produce the resulting string. |
| 6801 */ |
| 6802 NodeList<InterpolationElement> get elements; |
| 6803 } |
| 6804 |
| 6805 /** |
| 6806 * A string literal expression. |
| 6807 * |
| 6808 * > stringLiteral ::= |
| 6809 * > [SimpleStringLiteral] |
| 6810 * > | [AdjacentStrings] |
| 6811 * > | [StringInterpolation] |
| 6812 * |
| 6813 * Clients may not extend, implement or mix-in this class. |
| 6814 */ |
| 6815 abstract class StringLiteral extends Literal { |
| 6816 /** |
| 6817 * Return the value of the string literal, or `null` if the string is not a |
| 6818 * constant string without any string interpolation. |
| 6819 */ |
| 6820 String get stringValue; |
| 6821 } |
| 6822 |
| 6823 /** |
| 6824 * The invocation of a superclass' constructor from within a constructor's |
| 6825 * initialization list. |
| 6826 * |
| 6827 * > superInvocation ::= |
| 6828 * > 'super' ('.' [SimpleIdentifier])? [ArgumentList] |
| 6829 * |
| 6830 * Clients may not extend, implement or mix-in this class. |
| 6831 */ |
| 6832 abstract class SuperConstructorInvocation extends ConstructorInitializer { |
| 6833 /** |
| 6834 * Initialize a newly created super invocation to invoke the inherited |
| 6835 * constructor with the given name with the given arguments. The [period] and |
| 6836 * [constructorName] can be `null` if the constructor being invoked is the |
| 6837 * unnamed constructor. |
| 6838 */ |
| 6839 factory SuperConstructorInvocation( |
| 6840 Token superKeyword, |
| 6841 Token period, |
| 6842 SimpleIdentifier constructorName, |
| 6843 ArgumentList argumentList) = SuperConstructorInvocationImpl; |
| 6844 |
| 6845 /** |
| 6846 * Return the list of arguments to the constructor. |
| 6847 */ |
| 6848 ArgumentList get argumentList; |
| 6849 |
| 6850 /** |
| 6851 * Set the list of arguments to the constructor to the given [argumentList]. |
| 6852 */ |
| 6853 void set argumentList(ArgumentList argumentList); |
| 6854 |
| 6855 /** |
| 6856 * Return the name of the constructor that is being invoked, or `null` if the |
| 6857 * unnamed constructor is being invoked. |
| 6858 */ |
| 6859 SimpleIdentifier get constructorName; |
| 6860 |
| 6861 /** |
| 6862 * Set the name of the constructor that is being invoked to the given |
| 6863 * [identifier]. |
| 6864 */ |
| 6865 void set constructorName(SimpleIdentifier identifier); |
| 6866 |
| 6867 /** |
| 6868 * Return the token for the period before the name of the constructor that is |
| 6869 * being invoked, or `null` if the unnamed constructor is being invoked. |
| 6870 */ |
| 6871 Token get period; |
| 6872 |
| 6873 /** |
| 6874 * Set the token for the period before the name of the constructor that is |
| 6875 * being invoked to the given [token]. |
| 6876 */ |
| 6877 void set period(Token token); |
| 6878 |
| 6879 /** |
| 6880 * Return the element associated with the constructor based on static type |
| 6881 * information, or `null` if the AST structure has not been resolved or if the |
| 6882 * constructor could not be resolved. |
| 6883 */ |
| 6884 ConstructorElement get staticElement; |
| 6885 |
| 6886 /** |
| 6887 * Set the element associated with the constructor based on static type |
| 6888 * information to the given [element]. |
| 6889 */ |
| 6890 void set staticElement(ConstructorElement element); |
| 6891 |
| 6892 /** |
| 6893 * Return the token for the 'super' keyword. |
| 6894 */ |
| 6895 Token get superKeyword; |
| 6896 |
| 6897 /** |
| 6898 * Set the token for the 'super' keyword to the given [token]. |
| 6899 */ |
| 6900 void set superKeyword(Token token); |
| 6901 } |
| 6902 |
| 6903 /** |
| 6904 * A super expression. |
| 6905 * |
| 6906 * > superExpression ::= |
| 6907 * > 'super' |
| 6908 * |
| 6909 * Clients may not extend, implement or mix-in this class. |
| 6910 */ |
| 6911 abstract class SuperExpression extends Expression { |
| 6912 /** |
| 6913 * Initialize a newly created super expression. |
| 6914 */ |
| 6915 factory SuperExpression(Token superKeyword) = SuperExpressionImpl; |
| 6916 |
| 6917 /** |
| 6918 * Return the token representing the 'super' keyword. |
| 6919 */ |
| 6920 Token get superKeyword; |
| 6921 |
| 6922 /** |
| 6923 * Set the token representing the 'super' keyword to the given [token]. |
| 6924 */ |
| 6925 void set superKeyword(Token token); |
| 6926 } |
| 6927 |
| 6928 /** |
| 6929 * A case in a switch statement. |
| 6930 * |
| 6931 * > switchCase ::= |
| 6932 * > [SimpleIdentifier]* 'case' [Expression] ':' [Statement]* |
| 6933 * |
| 6934 * Clients may not extend, implement or mix-in this class. |
| 6935 */ |
| 6936 abstract class SwitchCase extends SwitchMember { |
| 6937 /** |
| 6938 * Initialize a newly created switch case. The list of [labels] can be `null` |
| 6939 * if there are no labels. |
| 6940 */ |
| 6941 factory SwitchCase(List<Label> labels, Token keyword, Expression expression, |
| 6942 Token colon, List<Statement> statements) = SwitchCaseImpl; |
| 6943 |
| 6944 /** |
| 6945 * Return the expression controlling whether the statements will be executed. |
| 6946 */ |
| 6947 Expression get expression; |
| 6948 |
| 6949 /** |
| 6950 * Set the expression controlling whether the statements will be executed to |
| 6951 * the given [expression]. |
| 6952 */ |
| 6953 void set expression(Expression expression); |
| 6954 } |
| 6955 |
| 6956 /** |
| 6957 * The default case in a switch statement. |
| 6958 * |
| 6959 * > switchDefault ::= |
| 6960 * > [SimpleIdentifier]* 'default' ':' [Statement]* |
| 6961 * |
| 6962 * Clients may not extend, implement or mix-in this class. |
| 6963 */ |
| 6964 abstract class SwitchDefault extends SwitchMember { |
| 6965 /** |
| 6966 * Initialize a newly created switch default. The list of [labels] can be |
| 6967 * `null` if there are no labels. |
| 6968 */ |
| 6969 factory SwitchDefault(List<Label> labels, Token keyword, Token colon, |
| 6970 List<Statement> statements) = SwitchDefaultImpl; |
| 6971 } |
| 6972 |
| 6973 /** |
| 6974 * An element within a switch statement. |
| 6975 * |
| 6976 * > switchMember ::= |
| 6977 * > switchCase |
| 6978 * > | switchDefault |
| 6979 * |
| 6980 * Clients may not extend, implement or mix-in this class. |
| 6981 */ |
| 6982 abstract class SwitchMember extends AstNode { |
| 6983 /** |
| 6984 * Return the colon separating the keyword or the expression from the |
| 6985 * statements. |
| 6986 */ |
| 6987 Token get colon; |
| 6988 |
| 6989 /** |
| 6990 * Set the colon separating the keyword or the expression from the |
| 6991 * statements to the given [token]. |
| 6992 */ |
| 6993 void set colon(Token token); |
| 6994 |
| 6995 /** |
| 6996 * Return the token representing the 'case' or 'default' keyword. |
| 6997 */ |
| 6998 Token get keyword; |
| 6999 |
| 7000 /** |
| 7001 * Set the token representing the 'case' or 'default' keyword to the given |
| 7002 * [token]. |
| 7003 */ |
| 7004 void set keyword(Token token); |
| 7005 |
| 7006 /** |
| 7007 * Return the labels associated with the switch member. |
| 7008 */ |
| 7009 NodeList<Label> get labels; |
| 7010 |
| 7011 /** |
| 7012 * Return the statements that will be executed if this switch member is |
| 7013 * selected. |
| 7014 */ |
| 7015 NodeList<Statement> get statements; |
| 7016 } |
| 7017 |
| 7018 /** |
| 7019 * A switch statement. |
| 7020 * |
| 7021 * > switchStatement ::= |
| 7022 * > 'switch' '(' [Expression] ')' '{' [SwitchCase]* [SwitchDefault]? '}' |
| 7023 * |
| 7024 * Clients may not extend, implement or mix-in this class. |
| 7025 */ |
| 7026 abstract class SwitchStatement extends Statement { |
| 7027 /** |
| 7028 * Initialize a newly created switch statement. The list of [members] can be |
| 7029 * `null` if there are no switch members. |
| 7030 */ |
| 7031 factory SwitchStatement( |
| 7032 Token switchKeyword, |
| 7033 Token leftParenthesis, |
| 7034 Expression expression, |
| 7035 Token rightParenthesis, |
| 7036 Token leftBracket, |
| 7037 List<SwitchMember> members, |
| 7038 Token rightBracket) = SwitchStatementImpl; |
| 7039 |
| 7040 /** |
| 7041 * Return the expression used to determine which of the switch members will be |
| 7042 * selected. |
| 7043 */ |
| 7044 Expression get expression; |
| 7045 |
| 7046 /** |
| 7047 * Set the expression used to determine which of the switch members will be |
| 7048 * selected to the given [expression]. |
| 7049 */ |
| 7050 void set expression(Expression expression); |
| 7051 |
| 7052 /** |
| 7053 * Return the left curly bracket. |
| 7054 */ |
| 7055 Token get leftBracket; |
| 7056 |
| 7057 /** |
| 7058 * Set the left curly bracket to the given [token]. |
| 7059 */ |
| 7060 void set leftBracket(Token token); |
| 7061 |
| 7062 /** |
| 7063 * Return the left parenthesis. |
| 7064 */ |
| 7065 Token get leftParenthesis; |
| 7066 |
| 7067 /** |
| 7068 * Set the left parenthesis to the given [token]. |
| 7069 */ |
| 7070 void set leftParenthesis(Token token); |
| 7071 |
| 7072 /** |
| 7073 * Return the switch members that can be selected by the expression. |
| 7074 */ |
| 7075 NodeList<SwitchMember> get members; |
| 7076 |
| 7077 /** |
| 7078 * Return the right curly bracket. |
| 7079 */ |
| 7080 Token get rightBracket; |
| 7081 |
| 7082 /** |
| 7083 * Set the right curly bracket to the given [token]. |
| 7084 */ |
| 7085 void set rightBracket(Token token); |
| 7086 |
| 7087 /** |
| 7088 * Return the right parenthesis. |
| 7089 */ |
| 7090 Token get rightParenthesis; |
| 7091 |
| 7092 /** |
| 7093 * Set the right parenthesis to the given [token]. |
| 7094 */ |
| 7095 void set rightParenthesis(Token token); |
| 7096 |
| 7097 /** |
| 7098 * Return the token representing the 'switch' keyword. |
| 7099 */ |
| 7100 Token get switchKeyword; |
| 7101 |
| 7102 /** |
| 7103 * Set the token representing the 'switch' keyword to the given [token]. |
| 7104 */ |
| 7105 void set switchKeyword(Token token); |
| 7106 } |
| 7107 |
| 7108 /** |
| 7109 * A symbol literal expression. |
| 7110 * |
| 7111 * > symbolLiteral ::= |
| 7112 * > '#' (operator | (identifier ('.' identifier)*)) |
| 7113 * |
| 7114 * Clients may not extend, implement or mix-in this class. |
| 7115 */ |
| 7116 abstract class SymbolLiteral extends Literal { |
| 7117 /** |
| 7118 * Initialize a newly created symbol literal. |
| 7119 */ |
| 7120 factory SymbolLiteral(Token poundSign, List<Token> components) = |
| 7121 SymbolLiteralImpl; |
| 7122 |
| 7123 /** |
| 7124 * Return the components of the literal. |
| 7125 */ |
| 7126 List<Token> get components; |
| 7127 |
| 7128 /** |
| 7129 * Return the token introducing the literal. |
| 7130 */ |
| 7131 Token get poundSign; |
| 7132 |
| 7133 /** |
| 7134 * Set the token introducing the literal to the given [token]. |
| 7135 */ |
| 7136 void set poundSign(Token token); |
| 7137 } |
| 7138 |
| 7139 /** |
| 7140 * A this expression. |
| 7141 * |
| 7142 * > thisExpression ::= |
| 7143 * > 'this' |
| 7144 * |
| 7145 * Clients may not extend, implement or mix-in this class. |
| 7146 */ |
| 7147 abstract class ThisExpression extends Expression { |
| 7148 /** |
| 7149 * Initialize a newly created this expression. |
| 7150 */ |
| 7151 factory ThisExpression(Token thisKeyword) = ThisExpressionImpl; |
| 7152 |
| 7153 /** |
| 7154 * Return the token representing the 'this' keyword. |
| 7155 */ |
| 7156 Token get thisKeyword; |
| 7157 |
| 7158 /** |
| 7159 * Set the token representing the 'this' keyword to the given [token]. |
| 7160 */ |
| 7161 void set thisKeyword(Token token); |
| 7162 } |
| 7163 |
| 7164 /** |
| 7165 * A throw expression. |
| 7166 * |
| 7167 * > throwExpression ::= |
| 7168 * > 'throw' [Expression] |
| 7169 * |
| 7170 * Clients may not extend, implement or mix-in this class. |
| 7171 */ |
| 7172 abstract class ThrowExpression extends Expression { |
| 7173 /** |
| 7174 * Initialize a newly created throw expression. |
| 7175 */ |
| 7176 factory ThrowExpression(Token throwKeyword, Expression expression) = |
| 7177 ThrowExpressionImpl; |
| 7178 |
| 7179 /** |
| 7180 * Return the expression computing the exception to be thrown. |
| 7181 */ |
| 7182 Expression get expression; |
| 7183 |
| 7184 /** |
| 7185 * Set the expression computing the exception to be thrown to the given |
| 7186 * [expression]. |
| 7187 */ |
| 7188 void set expression(Expression expression); |
| 7189 |
| 7190 /** |
| 7191 * Return the token representing the 'throw' keyword. |
| 7192 */ |
| 7193 Token get throwKeyword; |
| 7194 |
| 7195 /** |
| 7196 * Set the token representing the 'throw' keyword to the given [token]. |
| 7197 */ |
| 7198 void set throwKeyword(Token token); |
| 7199 } |
| 7200 |
| 7201 /** |
| 7202 * The declaration of one or more top-level variables of the same type. |
| 7203 * |
| 7204 * > topLevelVariableDeclaration ::= |
| 7205 * > ('final' | 'const') type? staticFinalDeclarationList ';' |
| 7206 * > | variableDeclaration ';' |
| 7207 * |
| 7208 * Clients may not extend, implement or mix-in this class. |
| 7209 */ |
| 7210 abstract class TopLevelVariableDeclaration extends CompilationUnitMember { |
| 7211 /** |
| 7212 * Initialize a newly created top-level variable declaration. Either or both |
| 7213 * of the [comment] and [metadata] can be `null` if the variable does not have |
| 7214 * the corresponding attribute. |
| 7215 */ |
| 7216 factory TopLevelVariableDeclaration( |
| 7217 Comment comment, |
| 7218 List<Annotation> metadata, |
| 7219 VariableDeclarationList variableList, |
| 7220 Token semicolon) = TopLevelVariableDeclarationImpl; |
| 7221 |
| 7222 /** |
| 7223 * Return the semicolon terminating the declaration. |
| 7224 */ |
| 7225 Token get semicolon; |
| 7226 |
| 7227 /** |
| 7228 * Set the semicolon terminating the declaration to the given [token]. |
| 7229 */ |
| 7230 void set semicolon(Token token); |
| 7231 |
| 7232 /** |
| 7233 * Return the top-level variables being declared. |
| 7234 */ |
| 7235 VariableDeclarationList get variables; |
| 7236 |
| 7237 /** |
| 7238 * Set the top-level variables being declared to the given list of |
| 7239 * [variables]. |
| 7240 */ |
| 7241 void set variables(VariableDeclarationList variables); |
| 7242 } |
| 7243 |
| 7244 /** |
| 7245 * A try statement. |
| 7246 * |
| 7247 * > tryStatement ::= |
| 7248 * > 'try' [Block] ([CatchClause]+ finallyClause? | finallyClause) |
| 7249 * > |
| 7250 * > finallyClause ::= |
| 7251 * > 'finally' [Block] |
| 7252 * |
| 7253 * Clients may not extend, implement or mix-in this class. |
| 7254 */ |
| 7255 abstract class TryStatement extends Statement { |
| 7256 /** |
| 7257 * Initialize a newly created try statement. The list of [catchClauses] can be |
| 7258 * `null` if there are no catch clauses. The [finallyKeyword] and |
| 7259 * [finallyBlock] can be `null` if there is no finally clause. |
| 7260 */ |
| 7261 factory TryStatement( |
| 7262 Token tryKeyword, |
| 7263 Block body, |
| 7264 List<CatchClause> catchClauses, |
| 7265 Token finallyKeyword, |
| 7266 Block finallyBlock) = TryStatementImpl; |
| 7267 |
| 7268 /** |
| 7269 * Return the body of the statement. |
| 7270 */ |
| 7271 Block get body; |
| 7272 |
| 7273 /** |
| 7274 * Set the body of the statement to the given [block]. |
| 7275 */ |
| 7276 void set body(Block block); |
| 7277 |
| 7278 /** |
| 7279 * Return the catch clauses contained in the try statement. |
| 7280 */ |
| 7281 NodeList<CatchClause> get catchClauses; |
| 7282 |
| 7283 /** |
| 7284 * Return the finally block contained in the try statement, or `null` if the |
| 7285 * statement does not contain a finally clause. |
| 7286 */ |
| 7287 Block get finallyBlock; |
| 7288 |
| 7289 /** |
| 7290 * Set the finally block contained in the try statement to the given [block]. |
| 7291 */ |
| 7292 void set finallyBlock(Block block); |
| 7293 |
| 7294 /** |
| 7295 * Return the token representing the 'finally' keyword, or `null` if the |
| 7296 * statement does not contain a finally clause. |
| 7297 */ |
| 7298 Token get finallyKeyword; |
| 7299 |
| 7300 /** |
| 7301 * Set the token representing the 'finally' keyword to the given [token]. |
| 7302 */ |
| 7303 void set finallyKeyword(Token token); |
| 7304 |
| 7305 /** |
| 7306 * Return the token representing the 'try' keyword. |
| 7307 */ |
| 7308 Token get tryKeyword; |
| 7309 |
| 7310 /** |
| 7311 * Set the token representing the 'try' keyword to the given [token]. |
| 7312 */ |
| 7313 void set tryKeyword(Token token); |
| 7314 } |
| 7315 |
| 7316 /** |
| 7317 * The declaration of a type alias. |
| 7318 * |
| 7319 * > typeAlias ::= |
| 7320 * > 'typedef' typeAliasBody |
| 7321 * > |
| 7322 * > typeAliasBody ::= |
| 7323 * > classTypeAlias |
| 7324 * > | functionTypeAlias |
| 7325 * |
| 7326 * Clients may not extend, implement or mix-in this class. |
| 7327 */ |
| 7328 abstract class TypeAlias extends NamedCompilationUnitMember { |
| 7329 /** |
| 7330 * Return the semicolon terminating the declaration. |
| 7331 */ |
| 7332 Token get semicolon; |
| 7333 |
| 7334 /** |
| 7335 * Set the semicolon terminating the declaration to the given [token]. |
| 7336 */ |
| 7337 void set semicolon(Token token); |
| 7338 |
| 7339 /** |
| 7340 * Return the token representing the 'typedef' keyword. |
| 7341 */ |
| 7342 Token get typedefKeyword; |
| 7343 |
| 7344 /** |
| 7345 * Set the token representing the 'typedef' keyword to the given [token]. |
| 7346 */ |
| 7347 void set typedefKeyword(Token token); |
| 7348 } |
| 7349 |
| 7350 /** |
| 7351 * A list of type arguments. |
| 7352 * |
| 7353 * > typeArguments ::= |
| 7354 * > '<' typeName (',' typeName)* '>' |
| 7355 * |
| 7356 * Clients may not extend, implement or mix-in this class. |
| 7357 */ |
| 7358 abstract class TypeArgumentList extends AstNode { |
| 7359 /** |
| 7360 * Initialize a newly created list of type arguments. |
| 7361 */ |
| 7362 factory TypeArgumentList( |
| 7363 Token leftBracket, List<TypeName> arguments, Token rightBracket) = |
| 7364 TypeArgumentListImpl; |
| 7365 |
| 7366 /** |
| 7367 * Return the type arguments associated with the type. |
| 7368 */ |
| 7369 NodeList<TypeName> get arguments; |
| 7370 |
| 7371 /** |
| 7372 * Return the left bracket. |
| 7373 */ |
| 7374 Token get leftBracket; |
| 7375 |
| 7376 /** |
| 7377 * Set the left bracket to the given [token]. |
| 7378 */ |
| 7379 void set leftBracket(Token token); |
| 7380 |
| 7381 /** |
| 7382 * Return the right bracket. |
| 7383 */ |
| 7384 Token get rightBracket; |
| 7385 |
| 7386 /** |
| 7387 * Set the right bracket to the given [token]. |
| 7388 */ |
| 7389 void set rightBracket(Token token); |
| 7390 } |
| 7391 |
| 7392 /** |
| 7393 * A literal that has a type associated with it. |
| 7394 * |
| 7395 * > typedLiteral ::= |
| 7396 * > [ListLiteral] |
| 7397 * > | [MapLiteral] |
| 7398 * |
| 7399 * Clients may not extend, implement or mix-in this class. |
| 7400 */ |
| 7401 abstract class TypedLiteral extends Literal { |
| 7402 /** |
| 7403 * Return the token representing the 'const' keyword, or `null` if the literal |
| 7404 * is not a constant. |
| 7405 */ |
| 7406 Token get constKeyword; |
| 7407 |
| 7408 /** |
| 7409 * Set the token representing the 'const' keyword to the given [token]. |
| 7410 */ |
| 7411 void set constKeyword(Token token); |
| 7412 |
| 7413 /** |
| 7414 * Return the type argument associated with this literal, or `null` if no type |
| 7415 * arguments were declared. |
| 7416 */ |
| 7417 TypeArgumentList get typeArguments; |
| 7418 |
| 7419 /** |
| 7420 * Set the type argument associated with this literal to the given |
| 7421 * [typeArguments]. |
| 7422 */ |
| 7423 void set typeArguments(TypeArgumentList typeArguments); |
| 7424 } |
| 7425 |
| 7426 /** |
| 7427 * The name of a type, which can optionally include type arguments. |
| 7428 * |
| 7429 * > typeName ::= |
| 7430 * > [Identifier] typeArguments? |
| 7431 * |
| 7432 * Clients may not extend, implement or mix-in this class. |
| 7433 */ |
| 7434 abstract class TypeName extends AstNode { |
| 7435 /** |
| 7436 * Initialize a newly created type name. The [typeArguments] can be `null` if |
| 7437 * there are no type arguments. |
| 7438 */ |
| 7439 factory TypeName(Identifier name, TypeArgumentList typeArguments) = |
| 7440 TypeNameImpl; |
| 7441 |
| 7442 /** |
| 7443 * Return `true` if this type is a deferred type. |
| 7444 * |
| 7445 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form |
| 7446 * </i>p.T</i> where <i>p</i> is a deferred prefix. |
| 7447 */ |
| 7448 bool get isDeferred; |
| 7449 |
| 7450 /** |
| 7451 * Return the name of the type. |
| 7452 */ |
| 7453 Identifier get name; |
| 7454 |
| 7455 /** |
| 7456 * Set the name of the type to the given [identifier]. |
| 7457 */ |
| 7458 void set name(Identifier identifier); |
| 7459 |
| 7460 /** |
| 7461 * Return the type being named, or `null` if the AST structure has not been |
| 7462 * resolved. |
| 7463 */ |
| 7464 DartType get type; |
| 7465 |
| 7466 /** |
| 7467 * Set the type being named to the given [type]. |
| 7468 */ |
| 7469 void set type(DartType type); |
| 7470 |
| 7471 /** |
| 7472 * Return the type arguments associated with the type, or `null` if there are |
| 7473 * no type arguments. |
| 7474 */ |
| 7475 TypeArgumentList get typeArguments; |
| 7476 |
| 7477 /** |
| 7478 * Set the type arguments associated with the type to the given |
| 7479 * [typeArguments]. |
| 7480 */ |
| 7481 void set typeArguments(TypeArgumentList typeArguments); |
| 7482 } |
| 7483 |
| 7484 /** |
| 7485 * A type parameter. |
| 7486 * |
| 7487 * > typeParameter ::= |
| 7488 * > [SimpleIdentifier] ('extends' [TypeName])? |
| 7489 * |
| 7490 * Clients may not extend, implement or mix-in this class. |
| 7491 */ |
| 7492 abstract class TypeParameter extends Declaration { |
| 7493 /** |
| 7494 * Initialize a newly created type parameter. Either or both of the [comment] |
| 7495 * and [metadata] can be `null` if the parameter does not have the |
| 7496 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if |
| 7497 * the parameter does not have an upper bound. |
| 7498 */ |
| 7499 factory TypeParameter( |
| 7500 Comment comment, |
| 7501 List<Annotation> metadata, |
| 7502 SimpleIdentifier name, |
| 7503 Token extendsKeyword, |
| 7504 TypeName bound) = TypeParameterImpl; |
| 7505 |
| 7506 /** |
| 7507 * Return the name of the upper bound for legal arguments, or `null` if there |
| 7508 * is no explicit upper bound. |
| 7509 */ |
| 7510 TypeName get bound; |
| 7511 |
| 7512 /** |
| 7513 * Set the name of the upper bound for legal arguments to the given |
| 7514 * [typeName]. |
| 7515 */ |
| 7516 void set bound(TypeName typeName); |
| 7517 |
| 7518 /** |
| 7519 * Return the token representing the 'extends' keyword, or `null` if there is |
| 7520 * no explicit upper bound. |
| 7521 */ |
| 7522 Token get extendsKeyword; |
| 7523 |
| 7524 /** |
| 7525 * Set the token representing the 'extends' keyword to the given [token]. |
| 7526 */ |
| 7527 void set extendsKeyword(Token token); |
| 7528 |
| 7529 /** |
| 7530 * Return the name of the type parameter. |
| 7531 */ |
| 7532 SimpleIdentifier get name; |
| 7533 |
| 7534 /** |
| 7535 * Set the name of the type parameter to the given [identifier]. |
| 7536 */ |
| 7537 void set name(SimpleIdentifier identifier); |
| 7538 } |
| 7539 |
| 7540 /** |
| 7541 * Type parameters within a declaration. |
| 7542 * |
| 7543 * > typeParameterList ::= |
| 7544 * > '<' [TypeParameter] (',' [TypeParameter])* '>' |
| 7545 * |
| 7546 * Clients may not extend, implement or mix-in this class. |
| 7547 */ |
| 7548 abstract class TypeParameterList extends AstNode { |
| 7549 /** |
| 7550 * Initialize a newly created list of type parameters. |
| 7551 */ |
| 7552 factory TypeParameterList( |
| 7553 Token leftBracket, |
| 7554 List<TypeParameter> typeParameters, |
| 7555 Token rightBracket) = TypeParameterListImpl; |
| 7556 |
| 7557 /** |
| 7558 * Return the left angle bracket. |
| 7559 */ |
| 7560 Token get leftBracket; |
| 7561 |
| 7562 /** |
| 7563 * Return the right angle bracket. |
| 7564 */ |
| 7565 Token get rightBracket; |
| 7566 |
| 7567 /** |
| 7568 * Return the type parameters for the type. |
| 7569 */ |
| 7570 NodeList<TypeParameter> get typeParameters; |
| 7571 } |
| 7572 |
| 7573 /** |
| 7574 * A directive that references a URI. |
| 7575 * |
| 7576 * > uriBasedDirective ::= |
| 7577 * > [ExportDirective] |
| 7578 * > | [ImportDirective] |
| 7579 * > | [PartDirective] |
| 7580 * |
| 7581 * Clients may not extend, implement or mix-in this class. |
| 7582 */ |
| 7583 abstract class UriBasedDirective extends Directive { |
| 7584 /** |
| 7585 * Return the source to which the URI was resolved. |
| 7586 */ |
| 7587 Source get source; |
| 7588 |
| 7589 /** |
| 7590 * Set the source to which the URI was resolved to the given [source]. |
| 7591 */ |
| 7592 void set source(Source source); |
| 7593 |
| 7594 /** |
| 7595 * Return the URI referenced by this directive. |
| 7596 */ |
| 7597 StringLiteral get uri; |
| 7598 |
| 7599 /** |
| 7600 * Set the URI referenced by this directive to the given [uri]. |
| 7601 */ |
| 7602 void set uri(StringLiteral uri); |
| 7603 |
| 7604 /** |
| 7605 * Return the content of the URI. |
| 7606 */ |
| 7607 String get uriContent; |
| 7608 |
| 7609 /** |
| 7610 * Set the content of the URI to the given [content]. |
| 7611 */ |
| 7612 void set uriContent(String content); |
| 7613 |
| 7614 /** |
| 7615 * Return the element associated with the URI of this directive, or `null` if |
| 7616 * the AST structure has not been resolved or if the URI could not be |
| 7617 * resolved. Examples of the latter case include a directive that contains an |
| 7618 * invalid URL or a URL that does not exist. |
| 7619 */ |
| 7620 Element get uriElement; |
| 7621 |
| 7622 /** |
| 7623 * Validate this directive, but do not check for existence. Return a code |
| 7624 * indicating the problem if there is one, or `null` no problem |
| 7625 */ |
| 7626 UriValidationCode validate(); |
| 7627 } |
| 7628 |
| 7629 /** |
| 7630 * Validation codes returned by [UriBasedDirective.validate]. |
| 7631 * |
| 7632 * Clients may not extend, implement or mix-in this class. |
| 7633 */ |
| 7634 abstract class UriValidationCode { |
| 7635 static const UriValidationCode INVALID_URI = |
| 7636 UriValidationCodeImpl.INVALID_URI; |
| 7637 |
| 7638 static const UriValidationCode URI_WITH_INTERPOLATION = |
| 7639 UriValidationCodeImpl.URI_WITH_INTERPOLATION; |
| 7640 |
| 7641 static const UriValidationCode URI_WITH_DART_EXT_SCHEME = |
| 7642 UriValidationCodeImpl.URI_WITH_DART_EXT_SCHEME; |
| 7643 } |
| 7644 |
| 7645 /** |
| 7646 * An identifier that has an initial value associated with it. Instances of this |
| 7647 * class are always children of the class [VariableDeclarationList]. |
| 7648 * |
| 7649 * > variableDeclaration ::= |
| 7650 * > [SimpleIdentifier] ('=' [Expression])? |
| 7651 * |
| 7652 * TODO(paulberry): the grammar does not allow metadata to be associated with |
| 7653 * a VariableDeclaration, and currently we don't record comments for it either. |
| 7654 * Consider changing the class hierarchy so that [VariableDeclaration] does not |
| 7655 * extend [Declaration]. |
| 7656 * |
| 7657 * Clients may not extend, implement or mix-in this class. |
| 7658 */ |
| 7659 abstract class VariableDeclaration extends Declaration { |
| 7660 /** |
| 7661 * Initialize a newly created variable declaration. The [equals] and |
| 7662 * [initializer] can be `null` if there is no initializer. |
| 7663 */ |
| 7664 factory VariableDeclaration( |
| 7665 SimpleIdentifier name, Token equals, Expression initializer) = |
| 7666 VariableDeclarationImpl; |
| 7667 |
| 7668 @override |
| 7669 VariableElement get element; |
| 7670 |
| 7671 /** |
| 7672 * Return the equal sign separating the variable name from the initial value, |
| 7673 * or `null` if the initial value was not specified. |
| 7674 */ |
| 7675 Token get equals; |
| 7676 |
| 7677 /** |
| 7678 * Set the equal sign separating the variable name from the initial value to |
| 7679 * the given [token]. |
| 7680 */ |
| 7681 void set equals(Token token); |
| 7682 |
| 7683 /** |
| 7684 * Return the expression used to compute the initial value for the variable, |
| 7685 * or `null` if the initial value was not specified. |
| 7686 */ |
| 7687 Expression get initializer; |
| 7688 |
| 7689 /** |
| 7690 * Set the expression used to compute the initial value for the variable to |
| 7691 * the given [expression]. |
| 7692 */ |
| 7693 void set initializer(Expression expression); |
| 7694 |
| 7695 /** |
| 7696 * Return `true` if this variable was declared with the 'const' modifier. |
| 7697 */ |
| 7698 bool get isConst; |
| 7699 |
| 7700 /** |
| 7701 * Return `true` if this variable was declared with the 'final' modifier. |
| 7702 * Variables that are declared with the 'const' modifier will return `false` |
| 7703 * even though they are implicitly final. |
| 7704 */ |
| 7705 bool get isFinal; |
| 7706 |
| 7707 /** |
| 7708 * Return the name of the variable being declared. |
| 7709 */ |
| 7710 SimpleIdentifier get name; |
| 7711 |
| 7712 /** |
| 7713 * Set the name of the variable being declared to the given [identifier]. |
| 7714 */ |
| 7715 void set name(SimpleIdentifier identifier); |
| 7716 } |
| 7717 |
| 7718 /** |
| 7719 * The declaration of one or more variables of the same type. |
| 7720 * |
| 7721 * > variableDeclarationList ::= |
| 7722 * > finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])* |
| 7723 * > |
| 7724 * > finalConstVarOrType ::= |
| 7725 * > | 'final' [TypeName]? |
| 7726 * > | 'const' [TypeName]? |
| 7727 * > | 'var' |
| 7728 * > | [TypeName] |
| 7729 * |
| 7730 * Clients may not extend, implement or mix-in this class. |
| 7731 */ |
| 7732 abstract class VariableDeclarationList extends AnnotatedNode { |
| 7733 /** |
| 7734 * Initialize a newly created variable declaration list. Either or both of the |
| 7735 * [comment] and [metadata] can be `null` if the variable list does not have |
| 7736 * the corresponding attribute. The [keyword] can be `null` if a type was |
| 7737 * specified. The [type] must be `null` if the keyword is 'var'. |
| 7738 */ |
| 7739 factory VariableDeclarationList( |
| 7740 Comment comment, |
| 7741 List<Annotation> metadata, |
| 7742 Token keyword, |
| 7743 TypeName type, |
| 7744 List<VariableDeclaration> variables) = VariableDeclarationListImpl; |
| 7745 |
| 7746 /** |
| 7747 * Return `true` if the variables in this list were declared with the 'const' |
| 7748 * modifier. |
| 7749 */ |
| 7750 bool get isConst; |
| 7751 |
| 7752 /** |
| 7753 * Return `true` if the variables in this list were declared with the 'final' |
| 7754 * modifier. Variables that are declared with the 'const' modifier will return |
| 7755 * `false` even though they are implicitly final. (In other words, this is a |
| 7756 * syntactic check rather than a semantic check.) |
| 7757 */ |
| 7758 bool get isFinal; |
| 7759 |
| 7760 /** |
| 7761 * Return the token representing the 'final', 'const' or 'var' keyword, or |
| 7762 * `null` if no keyword was included. |
| 7763 */ |
| 7764 Token get keyword; |
| 7765 |
| 7766 /** |
| 7767 * Set the token representing the 'final', 'const' or 'var' keyword to the |
| 7768 * given [token]. |
| 7769 */ |
| 7770 void set keyword(Token token); |
| 7771 |
| 7772 /** |
| 7773 * Return the type of the variables being declared, or `null` if no type was |
| 7774 * provided. |
| 7775 */ |
| 7776 TypeName get type; |
| 7777 |
| 7778 /** |
| 7779 * Set the type of the variables being declared to the given [typeName]. |
| 7780 */ |
| 7781 void set type(TypeName typeName); |
| 7782 |
| 7783 /** |
| 7784 * Return a list containing the individual variables being declared. |
| 7785 */ |
| 7786 NodeList<VariableDeclaration> get variables; |
| 7787 } |
| 7788 |
| 7789 /** |
| 7790 * A list of variables that are being declared in a context where a statement is |
| 7791 * required. |
| 7792 * |
| 7793 * > variableDeclarationStatement ::= |
| 7794 * > [VariableDeclarationList] ';' |
| 7795 * |
| 7796 * Clients may not extend, implement or mix-in this class. |
| 7797 */ |
| 7798 abstract class VariableDeclarationStatement extends Statement { |
| 7799 /** |
| 7800 * Initialize a newly created variable declaration statement. |
| 7801 */ |
| 7802 factory VariableDeclarationStatement( |
| 7803 VariableDeclarationList variableList, Token semicolon) = |
| 7804 VariableDeclarationStatementImpl; |
| 7805 |
| 7806 /** |
| 7807 * Return the semicolon terminating the statement. |
| 7808 */ |
| 7809 Token get semicolon; |
| 7810 |
| 7811 /** |
| 7812 * Set the semicolon terminating the statement to the given [token]. |
| 7813 */ |
| 7814 void set semicolon(Token token); |
| 7815 |
| 7816 /** |
| 7817 * Return the variables being declared. |
| 7818 */ |
| 7819 VariableDeclarationList get variables; |
| 7820 |
| 7821 /** |
| 7822 * Set the variables being declared to the given list of [variables]. |
| 7823 */ |
| 7824 void set variables(VariableDeclarationList variables); |
| 7825 } |
| 7826 |
| 7827 /** |
| 7828 * A while statement. |
| 7829 * |
| 7830 * > whileStatement ::= |
| 7831 * > 'while' '(' [Expression] ')' [Statement] |
| 7832 * |
| 7833 * Clients may not extend, implement or mix-in this class. |
| 7834 */ |
| 7835 abstract class WhileStatement extends Statement { |
| 7836 /** |
| 7837 * Initialize a newly created while statement. |
| 7838 */ |
| 7839 factory WhileStatement( |
| 7840 Token whileKeyword, |
| 7841 Token leftParenthesis, |
| 7842 Expression condition, |
| 7843 Token rightParenthesis, |
| 7844 Statement body) = WhileStatementImpl; |
| 7845 |
| 7846 /** |
| 7847 * Return the body of the loop. |
| 7848 */ |
| 7849 Statement get body; |
| 7850 |
| 7851 /** |
| 7852 * Set the body of the loop to the given [statement]. |
| 7853 */ |
| 7854 void set body(Statement statement); |
| 7855 |
| 7856 /** |
| 7857 * Return the expression used to determine whether to execute the body of the |
| 7858 * loop. |
| 7859 */ |
| 7860 Expression get condition; |
| 7861 |
| 7862 /** |
| 7863 * Set the expression used to determine whether to execute the body of the |
| 7864 * loop to the given [expression]. |
| 7865 */ |
| 7866 void set condition(Expression expression); |
| 7867 |
| 7868 /** |
| 7869 * Return the left parenthesis. |
| 7870 */ |
| 7871 Token get leftParenthesis; |
| 7872 |
| 7873 /** |
| 7874 * Set the left parenthesis to the given [token]. |
| 7875 */ |
| 7876 void set leftParenthesis(Token token); |
| 7877 |
| 7878 /** |
| 7879 * Return the right parenthesis. |
| 7880 */ |
| 7881 Token get rightParenthesis; |
| 7882 |
| 7883 /** |
| 7884 * Set the right parenthesis to the given [token]. |
| 7885 */ |
| 7886 void set rightParenthesis(Token token); |
| 7887 |
| 7888 /** |
| 7889 * Return the token representing the 'while' keyword. |
| 7890 */ |
| 7891 Token get whileKeyword; |
| 7892 |
| 7893 /** |
| 7894 * Set the token representing the 'while' keyword to the given [token]. |
| 7895 */ |
| 7896 void set whileKeyword(Token token); |
| 7897 } |
| 7898 |
| 7899 /** |
| 7900 * The with clause in a class declaration. |
| 7901 * |
| 7902 * > withClause ::= |
| 7903 * > 'with' [TypeName] (',' [TypeName])* |
| 7904 * |
| 7905 * Clients may not extend, implement or mix-in this class. |
| 7906 */ |
| 7907 abstract class WithClause extends AstNode { |
| 7908 /** |
| 7909 * Initialize a newly created with clause. |
| 7910 */ |
| 7911 factory WithClause(Token withKeyword, List<TypeName> mixinTypes) = |
| 7912 WithClauseImpl; |
| 7913 |
| 7914 /** |
| 7915 * Return the names of the mixins that were specified. |
| 7916 */ |
| 7917 NodeList<TypeName> get mixinTypes; |
| 7918 |
| 7919 /** |
| 7920 * Return the token representing the 'with' keyword. |
| 7921 */ |
| 7922 Token get withKeyword; |
| 7923 |
| 7924 /** |
| 7925 * Set the token representing the 'with' keyword to the given [token]. |
| 7926 */ |
| 7927 void set withKeyword(Token token); |
| 7928 } |
| 7929 |
| 7930 /** |
| 7931 * A yield statement. |
| 7932 * |
| 7933 * > yieldStatement ::= |
| 7934 * > 'yield' '*'? [Expression] ‘;’ |
| 7935 * |
| 7936 * Clients may not extend, implement or mix-in this class. |
| 7937 */ |
| 7938 abstract class YieldStatement extends Statement { |
| 7939 /** |
| 7940 * Initialize a newly created yield expression. The [star] can be `null` if no |
| 7941 * star was provided. |
| 7942 */ |
| 7943 factory YieldStatement(Token yieldKeyword, Token star, Expression expression, |
| 7944 Token semicolon) = YieldStatementImpl; |
| 7945 |
| 7946 /** |
| 7947 * Return the expression whose value will be yielded. |
| 7948 */ |
| 7949 Expression get expression; |
| 7950 |
| 7951 /** |
| 7952 * Set the expression whose value will be yielded to the given [expression]. |
| 7953 */ |
| 7954 void set expression(Expression expression); |
| 7955 |
| 7956 /** |
| 7957 * Return the semicolon following the expression. |
| 7958 */ |
| 7959 Token get semicolon; |
| 7960 |
| 7961 /** |
| 7962 * Return the semicolon following the expression to the given [token]. |
| 7963 */ |
| 7964 void set semicolon(Token token); |
| 7965 |
| 7966 /** |
| 7967 * Return the star optionally following the 'yield' keyword. |
| 7968 */ |
| 7969 Token get star; |
| 7970 |
| 7971 /** |
| 7972 * Return the star optionally following the 'yield' keyword to the given [toke
n]. |
| 7973 */ |
| 7974 void set star(Token token); |
| 7975 |
| 7976 /** |
| 7977 * Return the 'yield' keyword. |
| 7978 */ |
| 7979 Token get yieldKeyword; |
| 7980 |
| 7981 /** |
| 7982 * Return the 'yield' keyword to the given [token]. |
| 7983 */ |
| 7984 void set yieldKeyword(Token token); |
| 7985 } |
| OLD | NEW |