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