Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: pkg/analyzer/lib/src/generated/ast.dart

Issue 970913002: API clean-up (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Sort ast.dart Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.ast; 8 library engine.ast;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 /** 57 /**
58 * Return the strings that are implicitly concatenated. 58 * Return the strings that are implicitly concatenated.
59 */ 59 */
60 NodeList<StringLiteral> get strings => _strings; 60 NodeList<StringLiteral> get strings => _strings;
61 61
62 @override 62 @override
63 accept(AstVisitor visitor) => visitor.visitAdjacentStrings(this); 63 accept(AstVisitor visitor) => visitor.visitAdjacentStrings(this);
64 64
65 @override 65 @override
66 void appendStringValue(StringBuffer buffer) {
67 for (StringLiteral stringLiteral in strings) {
68 stringLiteral.appendStringValue(buffer);
69 }
70 }
71
72 @override
73 void visitChildren(AstVisitor visitor) { 66 void visitChildren(AstVisitor visitor) {
74 _strings.accept(visitor); 67 _strings.accept(visitor);
75 } 68 }
69
70 @override
71 void _appendStringValue(StringBuffer buffer) {
72 for (StringLiteral stringLiteral in strings) {
73 stringLiteral._appendStringValue(buffer);
74 }
75 }
76 } 76 }
77 77
78 /** 78 /**
79 * An AST node that can be annotated with both a documentation comment and a 79 * An AST node that can be annotated with both a documentation comment and a
80 * list of annotations. 80 * list of annotations.
81 */ 81 */
82 abstract class AnnotatedNode extends AstNode { 82 abstract class AnnotatedNode extends AstNode {
83 /** 83 /**
84 * The documentation comment associated with this node, or `null` if this node 84 * The documentation comment associated with this node, or `null` if this node
85 * does not have a documentation comment associated with it. 85 * does not have a documentation comment associated with it.
86 */ 86 */
87 Comment _comment; 87 Comment _comment;
88 88
89 /** 89 /**
90 * The annotations associated with this node. 90 * The annotations associated with this node.
91 */ 91 */
92 NodeList<Annotation> _metadata; 92 NodeList<Annotation> _metadata;
93 93
94 /** 94 /**
95 * Initialize a newly created annotated node. Either or both of the [comment] 95 * Initialize a newly created annotated node. Either or both of the [comment]
96 * and [metadata] can be `null` if the node does not have the corresponding 96 * and [metadata] can be `null` if the node does not have the corresponding
97 * attribute. 97 * attribute.
98 */ 98 */
99 AnnotatedNode(Comment comment, List<Annotation> metadata) { 99 AnnotatedNode(Comment comment, List<Annotation> metadata) {
100 _comment = becomeParentOf(comment); 100 _comment = _becomeParentOf(comment);
101 _metadata = new NodeList<Annotation>(this, metadata); 101 _metadata = new NodeList<Annotation>(this, metadata);
102 } 102 }
103 103
104 @override 104 @override
105 Token get beginToken { 105 Token get beginToken {
106 if (_comment == null) { 106 if (_comment == null) {
107 if (_metadata.isEmpty) { 107 if (_metadata.isEmpty) {
108 return firstTokenAfterCommentAndMetadata; 108 return firstTokenAfterCommentAndMetadata;
109 } 109 }
110 return _metadata.beginToken; 110 return _metadata.beginToken;
(...skipping 12 matching lines...) Expand all
123 * Return the documentation comment associated with this node, or `null` if 123 * Return the documentation comment associated with this node, or `null` if
124 * this node does not have a documentation comment associated with it. 124 * this node does not have a documentation comment associated with it.
125 */ 125 */
126 Comment get documentationComment => _comment; 126 Comment get documentationComment => _comment;
127 127
128 /** 128 /**
129 * Set the documentation comment associated with this node to the given 129 * Set the documentation comment associated with this node to the given
130 * [comment]. 130 * [comment].
131 */ 131 */
132 void set documentationComment(Comment comment) { 132 void set documentationComment(Comment comment) {
133 _comment = becomeParentOf(comment); 133 _comment = _becomeParentOf(comment);
134 } 134 }
135 135
136 /** 136 /**
137 * Return the first token following the comment and metadata. 137 * Return the first token following the comment and metadata.
138 */ 138 */
139 Token get firstTokenAfterCommentAndMetadata; 139 Token get firstTokenAfterCommentAndMetadata;
140 140
141 /** 141 /**
142 * Return the annotations associated with this node. 142 * Return the annotations associated with this node.
143 */ 143 */
144 NodeList<Annotation> get metadata => _metadata; 144 NodeList<Annotation> get metadata => _metadata;
145 145
146 /** 146 /**
147 * Set the metadata associated with this node to the given [metadata]. 147 * Set the metadata associated with this node to the given [metadata].
148 */ 148 */
149 @deprecated // Directly modify the list returned by "this.metadata"
149 void set metadata(List<Annotation> metadata) { 150 void set metadata(List<Annotation> metadata) {
150 _metadata.clear(); 151 _metadata.clear();
151 _metadata.addAll(metadata); 152 _metadata.addAll(metadata);
152 } 153 }
153 154
154 /** 155 /**
155 * Return a list containing the comment and annotations associated with this 156 * Return a list containing the comment and annotations associated with this
156 * node, sorted in lexical order. 157 * node, sorted in lexical order.
157 */ 158 */
158 List<AstNode> get sortedCommentAndAnnotations { 159 List<AstNode> get sortedCommentAndAnnotations {
159 return <AstNode>[] 160 return <AstNode>[]
160 ..add(_comment) 161 ..add(_comment)
161 ..addAll(_metadata) 162 ..addAll(_metadata)
162 ..sort(AstNode.LEXICAL_ORDER); 163 ..sort(AstNode.LEXICAL_ORDER);
163 } 164 }
164 165
166 /**
167 * Return a holder of child entities that subclasses can add to.
168 */
165 ChildEntities get _childEntities { 169 ChildEntities get _childEntities {
166 ChildEntities result = new ChildEntities(); 170 ChildEntities result = new ChildEntities();
167 if (_commentIsBeforeAnnotations()) { 171 if (_commentIsBeforeAnnotations()) {
168 result 172 result
169 ..add(_comment) 173 ..add(_comment)
170 ..addAll(_metadata); 174 ..addAll(_metadata);
171 } else { 175 } else {
172 result.addAll(sortedCommentAndAnnotations); 176 result.addAll(sortedCommentAndAnnotations);
173 } 177 }
174 return result; 178 return result;
175 } 179 }
176 180
177 @override 181 @override
178 void visitChildren(AstVisitor visitor) { 182 void visitChildren(AstVisitor visitor) {
179 if (_commentIsBeforeAnnotations()) { 183 if (_commentIsBeforeAnnotations()) {
180 _safelyVisitChild(_comment, visitor); 184 _safelyVisitChild(_comment, visitor);
181 _metadata.accept(visitor); 185 _metadata.accept(visitor);
182 } else { 186 } else {
183 for (AstNode child in sortedCommentAndAnnotations) { 187 for (AstNode child in sortedCommentAndAnnotations) {
184 child.accept(visitor); 188 child.accept(visitor);
185 } 189 }
186 } 190 }
187 } 191 }
188 192
189 /** 193 /**
190 * Return `true` if the comment is lexically before any annotations. 194 * Return `true` if there are no annotations before the comment. Note that a
195 * result of `true` does not imply that there is a comment, nor that there are
196 * annotations associated with this node.
191 */ 197 */
192 bool _commentIsBeforeAnnotations() { 198 bool _commentIsBeforeAnnotations() {
199 // TODO(brianwilkerson) Convert this to a getter.
193 if (_comment == null || _metadata.isEmpty) { 200 if (_comment == null || _metadata.isEmpty) {
194 return true; 201 return true;
195 } 202 }
196 Annotation firstAnnotation = _metadata[0]; 203 Annotation firstAnnotation = _metadata[0];
197 return _comment.offset < firstAnnotation.offset; 204 return _comment.offset < firstAnnotation.offset;
198 } 205 }
199 } 206 }
200 207
201 /** 208 /**
202 * An annotation that can be associated with an AST node. 209 * An annotation that can be associated with an AST node.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ElementAnnotation elementAnnotation; 256 ElementAnnotation elementAnnotation;
250 257
251 /** 258 /**
252 * Initialize a newly created annotation. Both the [period] and the 259 * Initialize a newly created annotation. Both the [period] and the
253 * [constructorName] can be `null` if the annotation is not referencing a 260 * [constructorName] can be `null` if the annotation is not referencing a
254 * named constructor. The [arguments] can be `null` if the annotation is not 261 * named constructor. The [arguments] can be `null` if the annotation is not
255 * referencing a constructor. 262 * referencing a constructor.
256 */ 263 */
257 Annotation(this.atSign, Identifier name, this.period, 264 Annotation(this.atSign, Identifier name, this.period,
258 SimpleIdentifier constructorName, ArgumentList arguments) { 265 SimpleIdentifier constructorName, ArgumentList arguments) {
259 _name = becomeParentOf(name); 266 _name = _becomeParentOf(name);
260 _constructorName = becomeParentOf(constructorName); 267 _constructorName = _becomeParentOf(constructorName);
261 _arguments = becomeParentOf(arguments); 268 _arguments = _becomeParentOf(arguments);
262 } 269 }
263 270
264 /** 271 /**
265 * Return the arguments to the constructor being invoked, or `null` if this 272 * Return the arguments to the constructor being invoked, or `null` if this
266 * annotation is not the invocation of a constructor. 273 * annotation is not the invocation of a constructor.
267 */ 274 */
268 ArgumentList get arguments => _arguments; 275 ArgumentList get arguments => _arguments;
269 276
270 /** 277 /**
271 * Set the arguments to the constructor being invoked to the given arguments. 278 * Set the arguments to the constructor being invoked to the given arguments.
272 */ 279 */
273 void set arguments(ArgumentList arguments) { 280 void set arguments(ArgumentList arguments) {
274 _arguments = becomeParentOf(arguments); 281 _arguments = _becomeParentOf(arguments);
275 } 282 }
276 283
277 @override 284 @override
278 Token get beginToken => atSign; 285 Token get beginToken => atSign;
279 286
280 @override 287 @override
281 Iterable get childEntities => new ChildEntities() 288 Iterable get childEntities => new ChildEntities()
282 ..add(atSign) 289 ..add(atSign)
283 ..add(_name) 290 ..add(_name)
284 ..add(period) 291 ..add(period)
285 ..add(_constructorName) 292 ..add(_constructorName)
286 ..add(_arguments); 293 ..add(_arguments);
287 294
288 /** 295 /**
289 * Return the name of the constructor being invoked, or `null` if this 296 * Return the name of the constructor being invoked, or `null` if this
290 * annotation is not the invocation of a named constructor. 297 * annotation is not the invocation of a named constructor.
291 */ 298 */
292 SimpleIdentifier get constructorName => _constructorName; 299 SimpleIdentifier get constructorName => _constructorName;
293 300
294 /** 301 /**
295 * Set the name of the constructor being invoked to the given [name]. 302 * Set the name of the constructor being invoked to the given [name].
296 */ 303 */
297 void set constructorName(SimpleIdentifier name) { 304 void set constructorName(SimpleIdentifier name) {
298 _constructorName = becomeParentOf(name); 305 _constructorName = _becomeParentOf(name);
299 } 306 }
300 307
301 /** 308 /**
302 * Return the element associated with this annotation, or `null` if the AST 309 * Return the element associated with this annotation, or `null` if the AST
303 * structure has not been resolved or if this annotation could not be 310 * structure has not been resolved or if this annotation could not be
304 * resolved. 311 * resolved.
305 */ 312 */
306 Element get element { 313 Element get element {
307 if (_element != null) { 314 if (_element != null) {
308 return _element; 315 return _element;
(...skipping 24 matching lines...) Expand all
333 * Return the name of the class defining the constructor that is being invoked 340 * Return the name of the class defining the constructor that is being invoked
334 * or the name of the field that is being referenced. 341 * or the name of the field that is being referenced.
335 */ 342 */
336 Identifier get name => _name; 343 Identifier get name => _name;
337 344
338 /** 345 /**
339 * Set the name of the class defining the constructor that is being invoked or 346 * Set the name of the class defining the constructor that is being invoked or
340 * the name of the field that is being referenced to the given [name]. 347 * the name of the field that is being referenced to the given [name].
341 */ 348 */
342 void set name(Identifier name) { 349 void set name(Identifier name) {
343 _name = becomeParentOf(name); 350 _name = _becomeParentOf(name);
344 } 351 }
345 352
346 @override 353 @override
347 accept(AstVisitor visitor) => visitor.visitAnnotation(this); 354 accept(AstVisitor visitor) => visitor.visitAnnotation(this);
348 355
349 @override 356 @override
350 void visitChildren(AstVisitor visitor) { 357 void visitChildren(AstVisitor visitor) {
351 _safelyVisitChild(_name, visitor); 358 _safelyVisitChild(_name, visitor);
352 _safelyVisitChild(_constructorName, visitor); 359 _safelyVisitChild(_constructorName, visitor);
353 _safelyVisitChild(_arguments, visitor); 360 _safelyVisitChild(_arguments, visitor);
354 } 361 }
355 } 362 }
356 363
357 /** 364 /**
358 * A list of arguments in the invocation of an executable element: a function, 365 * A list of arguments in the invocation of an executable element (that is, a
359 * method, or constructor. 366 * function, method, or constructor).
360 * 367 *
361 * > argumentList ::= 368 * > argumentList ::=
362 * > '(' arguments? ')' 369 * > '(' arguments? ')'
363 * > 370 * >
364 * > arguments ::= 371 * > arguments ::=
365 * > [NamedExpression] (',' [NamedExpression])* 372 * > [NamedExpression] (',' [NamedExpression])*
366 * > | [Expression] (',' [Expression])* (',' [NamedExpression])* 373 * > | [Expression] (',' [Expression])* (',' [NamedExpression])*
367 */ 374 */
368 class ArgumentList extends AstNode { 375 class ArgumentList extends AstNode {
369 /** 376 /**
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 /** 474 /**
468 * If 475 * If
469 * * the given [expression] is a child of this list, 476 * * the given [expression] is a child of this list,
470 * * the AST structure has been resolved, 477 * * the AST structure has been resolved,
471 * * the function being invoked is known based on propagated type information, 478 * * the function being invoked is known based on propagated type information,
472 * and 479 * and
473 * * the expression corresponds to one of the parameters of the function being 480 * * the expression corresponds to one of the parameters of the function being
474 * invoked, 481 * invoked,
475 * then return the parameter element representing the parameter to which the 482 * then return the parameter element representing the parameter to which the
476 * value of the given expression will be bound. Otherwise, return `null`. 483 * value of the given expression will be bound. Otherwise, return `null`.
477 *
478 * This method is only intended to be used by
479 * [Expression.propagatedParameterElement].
480 */ 484 */
485 @deprecated // Use "expression.propagatedParameterElement"
481 ParameterElement getPropagatedParameterElementFor(Expression expression) { 486 ParameterElement getPropagatedParameterElementFor(Expression expression) {
482 if (_correspondingPropagatedParameters == null) { 487 return _getPropagatedParameterElementFor(expression);
483 // Either the AST structure has not been resolved or the invocation 488 }
484 // of which this list is a part could not be resolved. 489
490 /**
491 * If
492 * * the given [expression] is a child of this list,
493 * * the AST structure has been resolved,
494 * * the function being invoked is known based on static type information, and
495 * * the expression corresponds to one of the parameters of the function being
496 * invoked,
497 * then return the parameter element representing the parameter to which the
498 * value of the given expression will be bound. Otherwise, return `null`.
499 */
500 @deprecated // Use "expression.propagatedParameterElement"
501 ParameterElement getStaticParameterElementFor(Expression expression) {
502 return _getStaticParameterElementFor(expression);
503 }
504
505 @override
506 void visitChildren(AstVisitor visitor) {
507 _arguments.accept(visitor);
508 }
509
510 /**
511 * If
512 * * the given [expression] is a child of this list,
513 * * the AST structure has been resolved,
514 * * the function being invoked is known based on propagated type information,
515 * and
516 * * the expression corresponds to one of the parameters of the function being
517 * invoked,
518 * then return the parameter element representing the parameter to which the
519 * value of the given expression will be bound. Otherwise, return `null`.
520 */
521 ParameterElement _getPropagatedParameterElementFor(Expression expression) {
522 if (_correspondingPropagatedParameters == null ||
523 _correspondingPropagatedParameters.length != _arguments.length) {
524 // Either the AST structure has not been resolved, the invocation of which
525 // this list is a part could not be resolved, or the argument list was
526 // modified after the parameters were set.
485 return null; 527 return null;
486 } 528 }
487 int index = _arguments.indexOf(expression); 529 int index = _arguments.indexOf(expression);
488 if (index < 0) { 530 if (index < 0) {
489 // The expression isn't a child of this node. 531 // The expression isn't a child of this node.
490 return null; 532 return null;
491 } 533 }
492 return _correspondingPropagatedParameters[index]; 534 return _correspondingPropagatedParameters[index];
493 } 535 }
494 536
495 /** 537 /**
496 * If 538 * If
497 * * the given [expression] is a child of this list, 539 * * the given [expression] is a child of this list,
498 * * the AST structure has been resolved, 540 * * the AST structure has been resolved,
499 * * the function being invoked is known based on static type information, and 541 * * the function being invoked is known based on static type information, and
500 * * the expression corresponds to one of the parameters of the function being 542 * * the expression corresponds to one of the parameters of the function being
501 * invoked, 543 * invoked,
502 * then return the parameter element representing the parameter to which the 544 * then return the parameter element representing the parameter to which the
503 * value of the given expression will be bound. Otherwise, return `null`. 545 * value of the given expression will be bound. Otherwise, return `null`.
504 *
505 * This method is only intended to be used by
506 * [Expression.staticParameterElement].
507 */ 546 */
508 ParameterElement getStaticParameterElementFor(Expression expression) { 547 ParameterElement _getStaticParameterElementFor(Expression expression) {
509 if (_correspondingStaticParameters == null) { 548 if (_correspondingStaticParameters == null ||
510 // Either the AST structure has not been resolved or the invocation 549 _correspondingStaticParameters.length != _arguments.length) {
511 // of which this list is a part could not be resolved. 550 // Either the AST structure has not been resolved, the invocation of which
551 // this list is a part could not be resolved, or the argument list was
552 // modified after the parameters were set.
512 return null; 553 return null;
513 } 554 }
514 int index = _arguments.indexOf(expression); 555 int index = _arguments.indexOf(expression);
515 if (index < 0) { 556 if (index < 0) {
516 // The expression isn't a child of this node. 557 // The expression isn't a child of this node.
517 return null; 558 return null;
518 } 559 }
519 return _correspondingStaticParameters[index]; 560 return _correspondingStaticParameters[index];
520 } 561 }
521
522 @override
523 void visitChildren(AstVisitor visitor) {
524 _arguments.accept(visitor);
525 }
526 } 562 }
527 563
528 /** 564 /**
529 * An as expression. 565 * An as expression.
530 * 566 *
531 * > asExpression ::= 567 * > asExpression ::=
532 * > [Expression] 'as' [TypeName] 568 * > [Expression] 'as' [TypeName]
533 */ 569 */
534 class AsExpression extends Expression { 570 class AsExpression extends Expression {
535 /** 571 /**
536 * The expression used to compute the value being cast. 572 * The expression used to compute the value being cast.
537 */ 573 */
538 Expression _expression; 574 Expression _expression;
539 575
540 /** 576 /**
541 * The as operator. 577 * The 'as' operator.
542 */ 578 */
543 Token asOperator; 579 Token asOperator;
544 580
545 /** 581 /**
546 * The name of the type being cast to. 582 * The name of the type being cast to.
547 */ 583 */
548 TypeName _type; 584 TypeName _type;
549 585
550 /** 586 /**
551 * Initialize a newly created as expression. 587 * Initialize a newly created as expression.
552 */ 588 */
553 AsExpression(Expression expression, this.asOperator, TypeName type) { 589 AsExpression(Expression expression, this.asOperator, TypeName type) {
554 _expression = becomeParentOf(expression); 590 _expression = _becomeParentOf(expression);
555 _type = becomeParentOf(type); 591 _type = _becomeParentOf(type);
556 } 592 }
557 593
558 @override 594 @override
559 Token get beginToken => _expression.beginToken; 595 Token get beginToken => _expression.beginToken;
560 596
561 @override 597 @override
562 Iterable get childEntities => new ChildEntities() 598 Iterable get childEntities => new ChildEntities()
563 ..add(_expression) 599 ..add(_expression)
564 ..add(asOperator) 600 ..add(asOperator)
565 ..add(_type); 601 ..add(_type);
566 602
567 @override 603 @override
568 Token get endToken => _type.endToken; 604 Token get endToken => _type.endToken;
569 605
570 /** 606 /**
571 * Return the expression used to compute the value being cast. 607 * Return the expression used to compute the value being cast.
572 */ 608 */
573 Expression get expression => _expression; 609 Expression get expression => _expression;
574 610
575 /** 611 /**
576 * Set the expression used to compute the value being cast to the given 612 * Set the expression used to compute the value being cast to the given
577 * [expression]. 613 * [expression].
578 */ 614 */
579 void set expression(Expression expression) { 615 void set expression(Expression expression) {
580 _expression = becomeParentOf(expression); 616 _expression = _becomeParentOf(expression);
581 } 617 }
582 618
583 @override 619 @override
584 int get precedence => 7; 620 int get precedence => 7;
585 621
586 /** 622 /**
587 * Return the name of the type being cast to. 623 * Return the name of the type being cast to.
588 */ 624 */
589 TypeName get type => _type; 625 TypeName get type => _type;
590 626
591 /** 627 /**
592 * Set the name of the type being cast to to the given [name]. 628 * Set the name of the type being cast to to the given [name].
593 */ 629 */
594 void set type(TypeName name) { 630 void set type(TypeName name) {
595 _type = becomeParentOf(name); 631 _type = _becomeParentOf(name);
596 } 632 }
597 633
598 @override 634 @override
599 accept(AstVisitor visitor) => visitor.visitAsExpression(this); 635 accept(AstVisitor visitor) => visitor.visitAsExpression(this);
600 636
601 @override 637 @override
602 void visitChildren(AstVisitor visitor) { 638 void visitChildren(AstVisitor visitor) {
603 _safelyVisitChild(_expression, visitor); 639 _safelyVisitChild(_expression, visitor);
604 _safelyVisitChild(_type, visitor); 640 _safelyVisitChild(_type, visitor);
605 } 641 }
606 } 642 }
607 643
608 /** 644 /**
609 * An assert statement. 645 * An assert statement.
610 * 646 *
611 * > assertStatement ::= 647 * > assertStatement ::=
612 * > 'assert' '(' [Expression] ')' ';' 648 * > 'assert' '(' [Expression] ')' ';'
613 */ 649 */
614 class AssertStatement extends Statement { 650 class AssertStatement extends Statement {
615 /** 651 /**
616 * The token representing the 'assert' keyword. 652 * The token representing the 'assert' keyword.
617 */ 653 */
618 Token keyword; 654 Token assertKeyword;
619 655
620 /** 656 /**
621 * The left parenthesis. 657 * The left parenthesis.
622 */ 658 */
623 Token leftParenthesis; 659 Token leftParenthesis;
624 660
625 /** 661 /**
626 * The condition that is being asserted to be `true`. 662 * The condition that is being asserted to be `true`.
627 */ 663 */
628 Expression _condition; 664 Expression _condition;
629 665
630 /** 666 /**
631 * The right parenthesis. 667 * The right parenthesis.
632 */ 668 */
633 Token rightParenthesis; 669 Token rightParenthesis;
634 670
635 /** 671 /**
636 * The semicolon terminating the statement. 672 * The semicolon terminating the statement.
637 */ 673 */
638 Token semicolon; 674 Token semicolon;
639 675
640 /** 676 /**
641 * Initialize a newly created assert statement. 677 * Initialize a newly created assert statement.
642 */ 678 */
643 AssertStatement(this.keyword, this.leftParenthesis, Expression condition, 679 AssertStatement(this.assertKeyword, this.leftParenthesis, Expression condition ,
644 this.rightParenthesis, this.semicolon) { 680 this.rightParenthesis, this.semicolon) {
645 _condition = becomeParentOf(condition); 681 _condition = _becomeParentOf(condition);
646 } 682 }
647 683
648 @override 684 @override
649 Token get beginToken => keyword; 685 Token get beginToken => assertKeyword;
650 686
651 /**
652 * TODO(paulberry): untested.
653 */
654 @override 687 @override
655 Iterable get childEntities => new ChildEntities() 688 Iterable get childEntities => new ChildEntities()
656 ..add(keyword) 689 ..add(assertKeyword)
657 ..add(leftParenthesis) 690 ..add(leftParenthesis)
658 ..add(_condition) 691 ..add(_condition)
659 ..add(rightParenthesis) 692 ..add(rightParenthesis)
660 ..add(semicolon); 693 ..add(semicolon);
661 694
662 /** 695 /**
663 * Return the condition that is being asserted to be `true`. 696 * Return the condition that is being asserted to be `true`.
664 */ 697 */
665 Expression get condition => _condition; 698 Expression get condition => _condition;
666 699
667 /** 700 /**
668 * Set the condition that is being asserted to be `true` to the given 701 * Set the condition that is being asserted to be `true` to the given
669 * [expression]. 702 * [expression].
670 */ 703 */
671 void set condition(Expression condition) { 704 void set condition(Expression condition) {
672 _condition = becomeParentOf(condition); 705 _condition = _becomeParentOf(condition);
673 } 706 }
674 707
675 @override 708 @override
676 Token get endToken => semicolon; 709 Token get endToken => semicolon;
677 710
711 /**
712 * Return the token representing the 'assert' keyword.
713 */
714 @deprecated // Use "this.assertKeyword"
715 Token get keyword => assertKeyword;
716
717 /**
718 * Set the token representing the 'assert' keyword to the given [token].
719 */
720 @deprecated // Use "this.assertKeyword"
721 set keyword(Token token) {
722 assertKeyword = token;
723 }
724
678 @override 725 @override
679 accept(AstVisitor visitor) => visitor.visitAssertStatement(this); 726 accept(AstVisitor visitor) => visitor.visitAssertStatement(this);
680 727
681 @override 728 @override
682 void visitChildren(AstVisitor visitor) { 729 void visitChildren(AstVisitor visitor) {
683 _safelyVisitChild(_condition, visitor); 730 _safelyVisitChild(_condition, visitor);
684 } 731 }
685 } 732 }
686 733
687 /** 734 /**
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } else { 782 } else {
736 message = "The left-hand size is null"; 783 message = "The left-hand size is null";
737 } 784 }
738 } else { 785 } else {
739 message = "The right-hand size is null"; 786 message = "The right-hand size is null";
740 } 787 }
741 AnalysisEngine.instance.logger.logError( 788 AnalysisEngine.instance.logger.logError(
742 message, 789 message,
743 new CaughtException(new AnalysisException(message), null)); 790 new CaughtException(new AnalysisException(message), null));
744 } 791 }
745 _leftHandSide = becomeParentOf(leftHandSide); 792 _leftHandSide = _becomeParentOf(leftHandSide);
746 _rightHandSide = becomeParentOf(rightHandSide); 793 _rightHandSide = _becomeParentOf(rightHandSide);
747 } 794 }
748 795
749 @override 796 @override
750 Token get beginToken => _leftHandSide.beginToken; 797 Token get beginToken => _leftHandSide.beginToken;
751 798
752 /** 799 /**
753 * Return the best element available for this operator. If resolution was able 800 * Return the best element available for this operator. If resolution was able
754 * to find a better element based on type propagation, that element will be 801 * to find a better element based on type propagation, that element will be
755 * returned. Otherwise, the element found using the result of static analysis 802 * returned. Otherwise, the element found using the result of static analysis
756 * will be returned. If resolution has not been performed, then `null` will be 803 * will be returned. If resolution has not been performed, then `null` will be
(...skipping 19 matching lines...) Expand all
776 /** 823 /**
777 * Set the expression used to compute the left hand side to the given 824 * Set the expression used to compute the left hand side to the given
778 * [expression]. 825 * [expression].
779 */ 826 */
780 Expression get leftHandSide => _leftHandSide; 827 Expression get leftHandSide => _leftHandSide;
781 828
782 /** 829 /**
783 * Return the expression used to compute the left hand side. 830 * Return the expression used to compute the left hand side.
784 */ 831 */
785 void set leftHandSide(Expression expression) { 832 void set leftHandSide(Expression expression) {
786 _leftHandSide = becomeParentOf(expression); 833 _leftHandSide = _becomeParentOf(expression);
787 } 834 }
788 835
789 @override 836 @override
790 int get precedence => 1; 837 int get precedence => 1;
791 838
792 /** 839 /**
793 * If the AST structure has been resolved, and the function being invoked is 840 * If the AST structure has been resolved, and the function being invoked is
794 * known based on propagated type information, then return the parameter 841 * known based on propagated type information, then return the parameter
795 * element representing the parameter to which the value of the right operand 842 * element representing the parameter to which the value of the right operand
796 * will be bound. Otherwise, return `null`. 843 * will be bound. Otherwise, return `null`.
797 *
798 * This method is only intended to be used by
799 * [Expression.propagatedParameterElement].
800 */ 844 */
845 @deprecated // Use "expression.propagatedParameterElement"
801 ParameterElement get propagatedParameterElementForRightHandSide { 846 ParameterElement get propagatedParameterElementForRightHandSide {
847 return _propagatedParameterElementForRightHandSide;
848 }
849
850 /**
851 * Return the expression used to compute the right hand side.
852 */
853 Expression get rightHandSide => _rightHandSide;
854
855 /**
856 * Set the expression used to compute the left hand side to the given
857 * [expression].
858 */
859 void set rightHandSide(Expression expression) {
860 _rightHandSide = _becomeParentOf(expression);
861 }
862
863 /**
864 * If the AST structure has been resolved, and the function being invoked is
865 * known based on static type information, then return the parameter element
866 * representing the parameter to which the value of the right operand will be
867 * bound. Otherwise, return `null`.
868 */
869 @deprecated // Use "expression.propagatedParameterElement"
870 ParameterElement get staticParameterElementForRightHandSide {
871 return _staticParameterElementForRightHandSide;
872 }
873
874 /**
875 * If the AST structure has been resolved, and the function being invoked is
876 * known based on propagated type information, then return the parameter
877 * element representing the parameter to which the value of the right operand
878 * will be bound. Otherwise, return `null`.
879 */
880 ParameterElement get _propagatedParameterElementForRightHandSide {
802 ExecutableElement executableElement = null; 881 ExecutableElement executableElement = null;
803 if (propagatedElement != null) { 882 if (propagatedElement != null) {
804 executableElement = propagatedElement; 883 executableElement = propagatedElement;
805 } else { 884 } else {
806 if (_leftHandSide is Identifier) { 885 if (_leftHandSide is Identifier) {
807 Identifier identifier = _leftHandSide as Identifier; 886 Identifier identifier = _leftHandSide as Identifier;
808 Element leftElement = identifier.propagatedElement; 887 Element leftElement = identifier.propagatedElement;
809 if (leftElement is ExecutableElement) { 888 if (leftElement is ExecutableElement) {
810 executableElement = leftElement; 889 executableElement = leftElement;
811 } 890 }
(...skipping 11 matching lines...) Expand all
823 return null; 902 return null;
824 } 903 }
825 List<ParameterElement> parameters = executableElement.parameters; 904 List<ParameterElement> parameters = executableElement.parameters;
826 if (parameters.length < 1) { 905 if (parameters.length < 1) {
827 return null; 906 return null;
828 } 907 }
829 return parameters[0]; 908 return parameters[0];
830 } 909 }
831 910
832 /** 911 /**
833 * Return the expression used to compute the right hand side.
834 */
835 Expression get rightHandSide => _rightHandSide;
836
837 /**
838 * Set the expression used to compute the left hand side to the given
839 * [expression].
840 */
841 void set rightHandSide(Expression expression) {
842 _rightHandSide = becomeParentOf(expression);
843 }
844
845 /**
846 * If the AST structure has been resolved, and the function being invoked is 912 * If the AST structure has been resolved, and the function being invoked is
847 * known based on static type information, then return the parameter element 913 * known based on static type information, then return the parameter element
848 * representing the parameter to which the value of the right operand will be 914 * representing the parameter to which the value of the right operand will be
849 * bound. Otherwise, return `null`. 915 * bound. Otherwise, return `null`.
850 *
851 * This method is only intended to be used by
852 * [Expression.staticParameterElement].
853 */ 916 */
854 ParameterElement get staticParameterElementForRightHandSide { 917 ParameterElement get _staticParameterElementForRightHandSide {
855 ExecutableElement executableElement = null; 918 ExecutableElement executableElement = null;
856 if (staticElement != null) { 919 if (staticElement != null) {
857 executableElement = staticElement; 920 executableElement = staticElement;
858 } else { 921 } else {
859 if (_leftHandSide is Identifier) { 922 if (_leftHandSide is Identifier) {
860 Element leftElement = (_leftHandSide as Identifier).staticElement; 923 Element leftElement = (_leftHandSide as Identifier).staticElement;
861 if (leftElement is ExecutableElement) { 924 if (leftElement is ExecutableElement) {
862 executableElement = leftElement; 925 executableElement = leftElement;
863 } 926 }
864 } 927 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 /** 962 /**
900 * A flag indicating whether tokens should be cloned while cloning an AST 963 * A flag indicating whether tokens should be cloned while cloning an AST
901 * structure. 964 * structure.
902 */ 965 */
903 final bool cloneTokens; 966 final bool cloneTokens;
904 967
905 /** 968 /**
906 * Initialize a newly created AST cloner to optionally clone tokens while 969 * Initialize a newly created AST cloner to optionally clone tokens while
907 * cloning AST nodes if [cloneTokens] is `true`. 970 * cloning AST nodes if [cloneTokens] is `true`.
908 */ 971 */
909 // TODO(brianwilkerson) Change this to be a named parameter. 972 AstCloner([this.cloneTokens = false]); // TODO(brianwilkerson) Change this to be a named parameter.
910 AstCloner([this.cloneTokens = false]);
911 973
912 /** 974 /**
913 * Return a clone of the given [node]. 975 * Return a clone of the given [node].
914 */ 976 */
915 AstNode cloneNode(AstNode node) { 977 AstNode cloneNode(AstNode node) {
916 if (node == null) { 978 if (node == null) {
917 return null; 979 return null;
918 } 980 }
919 return node.accept(this) as AstNode; 981 return node.accept(this) as AstNode;
920 } 982 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 @override 1038 @override
977 AsExpression visitAsExpression(AsExpression node) => 1039 AsExpression visitAsExpression(AsExpression node) =>
978 new AsExpression( 1040 new AsExpression(
979 cloneNode(node.expression), 1041 cloneNode(node.expression),
980 cloneToken(node.asOperator), 1042 cloneToken(node.asOperator),
981 cloneNode(node.type)); 1043 cloneNode(node.type));
982 1044
983 @override 1045 @override
984 AstNode visitAssertStatement(AssertStatement node) => 1046 AstNode visitAssertStatement(AssertStatement node) =>
985 new AssertStatement( 1047 new AssertStatement(
986 cloneToken(node.keyword), 1048 cloneToken(node.assertKeyword),
987 cloneToken(node.leftParenthesis), 1049 cloneToken(node.leftParenthesis),
988 cloneNode(node.condition), 1050 cloneNode(node.condition),
989 cloneToken(node.rightParenthesis), 1051 cloneToken(node.rightParenthesis),
990 cloneToken(node.semicolon)); 1052 cloneToken(node.semicolon));
991 1053
992 @override 1054 @override
993 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) => 1055 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) =>
994 new AssignmentExpression( 1056 new AssignmentExpression(
995 cloneNode(node.leftHandSide), 1057 cloneNode(node.leftHandSide),
996 cloneToken(node.operator), 1058 cloneToken(node.operator),
(...skipping 24 matching lines...) Expand all
1021 cloneToken(node.star), 1083 cloneToken(node.star),
1022 cloneNode(node.block)); 1084 cloneNode(node.block));
1023 1085
1024 @override 1086 @override
1025 BooleanLiteral visitBooleanLiteral(BooleanLiteral node) => 1087 BooleanLiteral visitBooleanLiteral(BooleanLiteral node) =>
1026 new BooleanLiteral(cloneToken(node.literal), node.value); 1088 new BooleanLiteral(cloneToken(node.literal), node.value);
1027 1089
1028 @override 1090 @override
1029 BreakStatement visitBreakStatement(BreakStatement node) => 1091 BreakStatement visitBreakStatement(BreakStatement node) =>
1030 new BreakStatement( 1092 new BreakStatement(
1031 cloneToken(node.keyword), 1093 cloneToken(node.breakKeyword),
1032 cloneNode(node.label), 1094 cloneNode(node.label),
1033 cloneToken(node.semicolon)); 1095 cloneToken(node.semicolon));
1034 1096
1035 @override 1097 @override
1036 CascadeExpression visitCascadeExpression(CascadeExpression node) => 1098 CascadeExpression visitCascadeExpression(CascadeExpression node) =>
1037 new CascadeExpression( 1099 new CascadeExpression(
1038 cloneNode(node.target), 1100 cloneNode(node.target),
1039 cloneNodeList(node.cascadeSections)); 1101 cloneNodeList(node.cascadeSections));
1040 1102
1041 @override 1103 @override
(...skipping 26 matching lines...) Expand all
1068 cloneToken(node.rightBracket)); 1130 cloneToken(node.rightBracket));
1069 copy.nativeClause = cloneNode(node.nativeClause); 1131 copy.nativeClause = cloneNode(node.nativeClause);
1070 return copy; 1132 return copy;
1071 } 1133 }
1072 1134
1073 @override 1135 @override
1074 ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) => 1136 ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) =>
1075 new ClassTypeAlias( 1137 new ClassTypeAlias(
1076 cloneNode(node.documentationComment), 1138 cloneNode(node.documentationComment),
1077 cloneNodeList(node.metadata), 1139 cloneNodeList(node.metadata),
1078 cloneToken(node.keyword), 1140 cloneToken(node.typedefKeyword),
1079 cloneNode(node.name), 1141 cloneNode(node.name),
1080 cloneNode(node.typeParameters), 1142 cloneNode(node.typeParameters),
1081 cloneToken(node.equals), 1143 cloneToken(node.equals),
1082 cloneToken(node.abstractKeyword), 1144 cloneToken(node.abstractKeyword),
1083 cloneNode(node.superclass), 1145 cloneNode(node.superclass),
1084 cloneNode(node.withClause), 1146 cloneNode(node.withClause),
1085 cloneNode(node.implementsClause), 1147 cloneNode(node.implementsClause),
1086 cloneToken(node.semicolon)); 1148 cloneToken(node.semicolon));
1087 1149
1088 @override 1150 @override
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 cloneNode(node.parameters), 1200 cloneNode(node.parameters),
1139 cloneToken(node.separator), 1201 cloneToken(node.separator),
1140 cloneNodeList(node.initializers), 1202 cloneNodeList(node.initializers),
1141 cloneNode(node.redirectedConstructor), 1203 cloneNode(node.redirectedConstructor),
1142 cloneNode(node.body)); 1204 cloneNode(node.body));
1143 1205
1144 @override 1206 @override
1145 ConstructorFieldInitializer 1207 ConstructorFieldInitializer
1146 visitConstructorFieldInitializer(ConstructorFieldInitializer node) => 1208 visitConstructorFieldInitializer(ConstructorFieldInitializer node) =>
1147 new ConstructorFieldInitializer( 1209 new ConstructorFieldInitializer(
1148 cloneToken(node.keyword), 1210 cloneToken(node.thisKeyword),
1149 cloneToken(node.period), 1211 cloneToken(node.period),
1150 cloneNode(node.fieldName), 1212 cloneNode(node.fieldName),
1151 cloneToken(node.equals), 1213 cloneToken(node.equals),
1152 cloneNode(node.expression)); 1214 cloneNode(node.expression));
1153 1215
1154 @override 1216 @override
1155 ConstructorName visitConstructorName(ConstructorName node) => 1217 ConstructorName visitConstructorName(ConstructorName node) =>
1156 new ConstructorName( 1218 new ConstructorName(
1157 cloneNode(node.type), 1219 cloneNode(node.type),
1158 cloneToken(node.period), 1220 cloneToken(node.period),
1159 cloneNode(node.name)); 1221 cloneNode(node.name));
1160 1222
1161 @override 1223 @override
1162 ContinueStatement visitContinueStatement(ContinueStatement node) => 1224 ContinueStatement visitContinueStatement(ContinueStatement node) =>
1163 new ContinueStatement( 1225 new ContinueStatement(
1164 cloneToken(node.keyword), 1226 cloneToken(node.continueKeyword),
1165 cloneNode(node.label), 1227 cloneNode(node.label),
1166 cloneToken(node.semicolon)); 1228 cloneToken(node.semicolon));
1167 1229
1168 @override 1230 @override
1169 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => 1231 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) =>
1170 new DeclaredIdentifier( 1232 new DeclaredIdentifier(
1171 cloneNode(node.documentationComment), 1233 cloneNode(node.documentationComment),
1172 cloneNodeList(node.metadata), 1234 cloneNodeList(node.metadata),
1173 cloneToken(node.keyword), 1235 cloneToken(node.keyword),
1174 cloneNode(node.type), 1236 cloneNode(node.type),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 new EnumConstantDeclaration( 1273 new EnumConstantDeclaration(
1212 cloneNode(node.documentationComment), 1274 cloneNode(node.documentationComment),
1213 cloneNodeList(node.metadata), 1275 cloneNodeList(node.metadata),
1214 cloneNode(node.name)); 1276 cloneNode(node.name));
1215 1277
1216 @override 1278 @override
1217 EnumDeclaration visitEnumDeclaration(EnumDeclaration node) => 1279 EnumDeclaration visitEnumDeclaration(EnumDeclaration node) =>
1218 new EnumDeclaration( 1280 new EnumDeclaration(
1219 cloneNode(node.documentationComment), 1281 cloneNode(node.documentationComment),
1220 cloneNodeList(node.metadata), 1282 cloneNodeList(node.metadata),
1221 cloneToken(node.keyword), 1283 cloneToken(node.enumKeyword),
1222 cloneNode(node.name), 1284 cloneNode(node.name),
1223 cloneToken(node.leftBracket), 1285 cloneToken(node.leftBracket),
1224 cloneNodeList(node.constants), 1286 cloneNodeList(node.constants),
1225 cloneToken(node.rightBracket)); 1287 cloneToken(node.rightBracket));
1226 1288
1227 @override 1289 @override
1228 ExportDirective visitExportDirective(ExportDirective node) { 1290 ExportDirective visitExportDirective(ExportDirective node) {
1229 ExportDirective directive = new ExportDirective( 1291 ExportDirective directive = new ExportDirective(
1230 cloneNode(node.documentationComment), 1292 cloneNode(node.documentationComment),
1231 cloneNodeList(node.metadata), 1293 cloneNodeList(node.metadata),
(...skipping 14 matching lines...) Expand all
1246 cloneToken(node.functionDefinition), 1308 cloneToken(node.functionDefinition),
1247 cloneNode(node.expression), 1309 cloneNode(node.expression),
1248 cloneToken(node.semicolon)); 1310 cloneToken(node.semicolon));
1249 1311
1250 @override 1312 @override
1251 ExpressionStatement visitExpressionStatement(ExpressionStatement node) => 1313 ExpressionStatement visitExpressionStatement(ExpressionStatement node) =>
1252 new ExpressionStatement(cloneNode(node.expression), cloneToken(node.semico lon)); 1314 new ExpressionStatement(cloneNode(node.expression), cloneToken(node.semico lon));
1253 1315
1254 @override 1316 @override
1255 ExtendsClause visitExtendsClause(ExtendsClause node) => 1317 ExtendsClause visitExtendsClause(ExtendsClause node) =>
1256 new ExtendsClause(cloneToken(node.keyword), cloneNode(node.superclass)); 1318 new ExtendsClause(cloneToken(node.extendsKeyword), cloneNode(node.supercla ss));
1257 1319
1258 @override 1320 @override
1259 FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => 1321 FieldDeclaration visitFieldDeclaration(FieldDeclaration node) =>
1260 new FieldDeclaration( 1322 new FieldDeclaration(
1261 cloneNode(node.documentationComment), 1323 cloneNode(node.documentationComment),
1262 cloneNodeList(node.metadata), 1324 cloneNodeList(node.metadata),
1263 cloneToken(node.staticKeyword), 1325 cloneToken(node.staticKeyword),
1264 cloneNode(node.fields), 1326 cloneNode(node.fields),
1265 cloneToken(node.semicolon)); 1327 cloneToken(node.semicolon));
1266 1328
1267 @override 1329 @override
1268 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => 1330 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) =>
1269 new FieldFormalParameter( 1331 new FieldFormalParameter(
1270 cloneNode(node.documentationComment), 1332 cloneNode(node.documentationComment),
1271 cloneNodeList(node.metadata), 1333 cloneNodeList(node.metadata),
1272 cloneToken(node.keyword), 1334 cloneToken(node.keyword),
1273 cloneNode(node.type), 1335 cloneNode(node.type),
1274 cloneToken(node.thisToken), 1336 cloneToken(node.thisKeyword),
1275 cloneToken(node.period), 1337 cloneToken(node.period),
1276 cloneNode(node.identifier), 1338 cloneNode(node.identifier),
1277 cloneNode(node.parameters)); 1339 cloneNode(node.parameters));
1278 1340
1279 @override 1341 @override
1280 ForEachStatement visitForEachStatement(ForEachStatement node) { 1342 ForEachStatement visitForEachStatement(ForEachStatement node) {
1281 DeclaredIdentifier loopVariable = node.loopVariable; 1343 DeclaredIdentifier loopVariable = node.loopVariable;
1282 if (loopVariable == null) { 1344 if (loopVariable == null) {
1283 return new ForEachStatement.con2( 1345 return new ForEachStatement.con2(
1284 cloneToken(node.awaitKeyword), 1346 cloneToken(node.awaitKeyword),
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => 1411 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
1350 new FunctionExpressionInvocation( 1412 new FunctionExpressionInvocation(
1351 cloneNode(node.function), 1413 cloneNode(node.function),
1352 cloneNode(node.argumentList)); 1414 cloneNode(node.argumentList));
1353 1415
1354 @override 1416 @override
1355 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => 1417 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) =>
1356 new FunctionTypeAlias( 1418 new FunctionTypeAlias(
1357 cloneNode(node.documentationComment), 1419 cloneNode(node.documentationComment),
1358 cloneNodeList(node.metadata), 1420 cloneNodeList(node.metadata),
1359 cloneToken(node.keyword), 1421 cloneToken(node.typedefKeyword),
1360 cloneNode(node.returnType), 1422 cloneNode(node.returnType),
1361 cloneNode(node.name), 1423 cloneNode(node.name),
1362 cloneNode(node.typeParameters), 1424 cloneNode(node.typeParameters),
1363 cloneNode(node.parameters), 1425 cloneNode(node.parameters),
1364 cloneToken(node.semicolon)); 1426 cloneToken(node.semicolon));
1365 1427
1366 @override 1428 @override
1367 FunctionTypedFormalParameter 1429 FunctionTypedFormalParameter
1368 visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) => 1430 visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) =>
1369 new FunctionTypedFormalParameter( 1431 new FunctionTypedFormalParameter(
(...skipping 13 matching lines...) Expand all
1383 cloneToken(node.ifKeyword), 1445 cloneToken(node.ifKeyword),
1384 cloneToken(node.leftParenthesis), 1446 cloneToken(node.leftParenthesis),
1385 cloneNode(node.condition), 1447 cloneNode(node.condition),
1386 cloneToken(node.rightParenthesis), 1448 cloneToken(node.rightParenthesis),
1387 cloneNode(node.thenStatement), 1449 cloneNode(node.thenStatement),
1388 cloneToken(node.elseKeyword), 1450 cloneToken(node.elseKeyword),
1389 cloneNode(node.elseStatement)); 1451 cloneNode(node.elseStatement));
1390 1452
1391 @override 1453 @override
1392 ImplementsClause visitImplementsClause(ImplementsClause node) => 1454 ImplementsClause visitImplementsClause(ImplementsClause node) =>
1393 new ImplementsClause(cloneToken(node.keyword), cloneNodeList(node.interfac es)); 1455 new ImplementsClause(cloneToken(node.implementsKeyword), cloneNodeList(nod e.interfaces));
1394 1456
1395 @override 1457 @override
1396 ImportDirective visitImportDirective(ImportDirective node) { 1458 ImportDirective visitImportDirective(ImportDirective node) {
1397 ImportDirective directive = new ImportDirective( 1459 ImportDirective directive = new ImportDirective(
1398 cloneNode(node.documentationComment), 1460 cloneNode(node.documentationComment),
1399 cloneNodeList(node.metadata), 1461 cloneNodeList(node.metadata),
1400 cloneToken(node.keyword), 1462 cloneToken(node.keyword),
1401 cloneNode(node.uri), 1463 cloneNode(node.uri),
1402 cloneToken(node.deferredToken), 1464 cloneToken(node.deferredKeyword),
1403 cloneToken(node.asToken), 1465 cloneToken(node.asKeyword),
1404 cloneNode(node.prefix), 1466 cloneNode(node.prefix),
1405 cloneNodeList(node.combinators), 1467 cloneNodeList(node.combinators),
1406 cloneToken(node.semicolon)); 1468 cloneToken(node.semicolon));
1407 directive.source = node.source; 1469 directive.source = node.source;
1408 directive.uriContent = node.uriContent; 1470 directive.uriContent = node.uriContent;
1409 return directive; 1471 return directive;
1410 } 1472 }
1411 1473
1412 @override 1474 @override
1413 IndexExpression visitIndexExpression(IndexExpression node) { 1475 IndexExpression visitIndexExpression(IndexExpression node) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 1527
1466 @override 1528 @override
1467 LabeledStatement visitLabeledStatement(LabeledStatement node) => 1529 LabeledStatement visitLabeledStatement(LabeledStatement node) =>
1468 new LabeledStatement(cloneNodeList(node.labels), cloneNode(node.statement) ); 1530 new LabeledStatement(cloneNodeList(node.labels), cloneNode(node.statement) );
1469 1531
1470 @override 1532 @override
1471 LibraryDirective visitLibraryDirective(LibraryDirective node) => 1533 LibraryDirective visitLibraryDirective(LibraryDirective node) =>
1472 new LibraryDirective( 1534 new LibraryDirective(
1473 cloneNode(node.documentationComment), 1535 cloneNode(node.documentationComment),
1474 cloneNodeList(node.metadata), 1536 cloneNodeList(node.metadata),
1475 cloneToken(node.libraryToken), 1537 cloneToken(node.libraryKeyword),
1476 cloneNode(node.name), 1538 cloneNode(node.name),
1477 cloneToken(node.semicolon)); 1539 cloneToken(node.semicolon));
1478 1540
1479 @override 1541 @override
1480 LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) => 1542 LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) =>
1481 new LibraryIdentifier(cloneNodeList(node.components)); 1543 new LibraryIdentifier(cloneNodeList(node.components));
1482 1544
1483 @override 1545 @override
1484 ListLiteral visitListLiteral(ListLiteral node) => 1546 ListLiteral visitListLiteral(ListLiteral node) =>
1485 new ListLiteral( 1547 new ListLiteral(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 cloneToken(node.period), 1588 cloneToken(node.period),
1527 cloneNode(node.methodName), 1589 cloneNode(node.methodName),
1528 cloneNode(node.argumentList)); 1590 cloneNode(node.argumentList));
1529 1591
1530 @override 1592 @override
1531 NamedExpression visitNamedExpression(NamedExpression node) => 1593 NamedExpression visitNamedExpression(NamedExpression node) =>
1532 new NamedExpression(cloneNode(node.name), cloneNode(node.expression)); 1594 new NamedExpression(cloneNode(node.name), cloneNode(node.expression));
1533 1595
1534 @override 1596 @override
1535 AstNode visitNativeClause(NativeClause node) => 1597 AstNode visitNativeClause(NativeClause node) =>
1536 new NativeClause(cloneToken(node.keyword), cloneNode(node.name)); 1598 new NativeClause(cloneToken(node.nativeKeyword), cloneNode(node.name));
1537 1599
1538 @override 1600 @override
1539 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => 1601 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) =>
1540 new NativeFunctionBody( 1602 new NativeFunctionBody(
1541 cloneToken(node.nativeToken), 1603 cloneToken(node.nativeKeyword),
1542 cloneNode(node.stringLiteral), 1604 cloneNode(node.stringLiteral),
1543 cloneToken(node.semicolon)); 1605 cloneToken(node.semicolon));
1544 1606
1545 @override 1607 @override
1546 NullLiteral visitNullLiteral(NullLiteral node) => 1608 NullLiteral visitNullLiteral(NullLiteral node) =>
1547 new NullLiteral(cloneToken(node.literal)); 1609 new NullLiteral(cloneToken(node.literal));
1548 1610
1549 @override 1611 @override
1550 ParenthesizedExpression 1612 ParenthesizedExpression
1551 visitParenthesizedExpression(ParenthesizedExpression node) => 1613 visitParenthesizedExpression(ParenthesizedExpression node) =>
1552 new ParenthesizedExpression( 1614 new ParenthesizedExpression(
1553 cloneToken(node.leftParenthesis), 1615 cloneToken(node.leftParenthesis),
1554 cloneNode(node.expression), 1616 cloneNode(node.expression),
1555 cloneToken(node.rightParenthesis)); 1617 cloneToken(node.rightParenthesis));
1556 1618
1557 @override 1619 @override
1558 PartDirective visitPartDirective(PartDirective node) { 1620 PartDirective visitPartDirective(PartDirective node) {
1559 PartDirective directive = new PartDirective( 1621 PartDirective directive = new PartDirective(
1560 cloneNode(node.documentationComment), 1622 cloneNode(node.documentationComment),
1561 cloneNodeList(node.metadata), 1623 cloneNodeList(node.metadata),
1562 cloneToken(node.partToken), 1624 cloneToken(node.partKeyword),
1563 cloneNode(node.uri), 1625 cloneNode(node.uri),
1564 cloneToken(node.semicolon)); 1626 cloneToken(node.semicolon));
1565 directive.source = node.source; 1627 directive.source = node.source;
1566 directive.uriContent = node.uriContent; 1628 directive.uriContent = node.uriContent;
1567 return directive; 1629 return directive;
1568 } 1630 }
1569 1631
1570 @override 1632 @override
1571 PartOfDirective visitPartOfDirective(PartOfDirective node) => 1633 PartOfDirective visitPartOfDirective(PartOfDirective node) =>
1572 new PartOfDirective( 1634 new PartOfDirective(
1573 cloneNode(node.documentationComment), 1635 cloneNode(node.documentationComment),
1574 cloneNodeList(node.metadata), 1636 cloneNodeList(node.metadata),
1575 cloneToken(node.partToken), 1637 cloneToken(node.partKeyword),
1576 cloneToken(node.ofToken), 1638 cloneToken(node.ofKeyword),
1577 cloneNode(node.libraryName), 1639 cloneNode(node.libraryName),
1578 cloneToken(node.semicolon)); 1640 cloneToken(node.semicolon));
1579 1641
1580 @override 1642 @override
1581 PostfixExpression visitPostfixExpression(PostfixExpression node) => 1643 PostfixExpression visitPostfixExpression(PostfixExpression node) =>
1582 new PostfixExpression(cloneNode(node.operand), cloneToken(node.operator)); 1644 new PostfixExpression(cloneNode(node.operand), cloneToken(node.operator));
1583 1645
1584 @override 1646 @override
1585 PrefixedIdentifier visitPrefixedIdentifier(PrefixedIdentifier node) => 1647 PrefixedIdentifier visitPrefixedIdentifier(PrefixedIdentifier node) =>
1586 new PrefixedIdentifier( 1648 new PrefixedIdentifier(
1587 cloneNode(node.prefix), 1649 cloneNode(node.prefix),
1588 cloneToken(node.period), 1650 cloneToken(node.period),
1589 cloneNode(node.identifier)); 1651 cloneNode(node.identifier));
1590 1652
1591 @override 1653 @override
1592 PrefixExpression visitPrefixExpression(PrefixExpression node) => 1654 PrefixExpression visitPrefixExpression(PrefixExpression node) =>
1593 new PrefixExpression(cloneToken(node.operator), cloneNode(node.operand)); 1655 new PrefixExpression(cloneToken(node.operator), cloneNode(node.operand));
1594 1656
1595 @override 1657 @override
1596 PropertyAccess visitPropertyAccess(PropertyAccess node) => 1658 PropertyAccess visitPropertyAccess(PropertyAccess node) =>
1597 new PropertyAccess( 1659 new PropertyAccess(
1598 cloneNode(node.target), 1660 cloneNode(node.target),
1599 cloneToken(node.operator), 1661 cloneToken(node.operator),
1600 cloneNode(node.propertyName)); 1662 cloneNode(node.propertyName));
1601 1663
1602 @override 1664 @override
1603 RedirectingConstructorInvocation 1665 RedirectingConstructorInvocation
1604 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) => 1666 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) =>
1605 new RedirectingConstructorInvocation( 1667 new RedirectingConstructorInvocation(
1606 cloneToken(node.keyword), 1668 cloneToken(node.thisKeyword),
1607 cloneToken(node.period), 1669 cloneToken(node.period),
1608 cloneNode(node.constructorName), 1670 cloneNode(node.constructorName),
1609 cloneNode(node.argumentList)); 1671 cloneNode(node.argumentList));
1610 1672
1611 @override 1673 @override
1612 RethrowExpression visitRethrowExpression(RethrowExpression node) => 1674 RethrowExpression visitRethrowExpression(RethrowExpression node) =>
1613 new RethrowExpression(cloneToken(node.keyword)); 1675 new RethrowExpression(cloneToken(node.rethrowKeyword));
1614 1676
1615 @override 1677 @override
1616 ReturnStatement visitReturnStatement(ReturnStatement node) => 1678 ReturnStatement visitReturnStatement(ReturnStatement node) =>
1617 new ReturnStatement( 1679 new ReturnStatement(
1618 cloneToken(node.keyword), 1680 cloneToken(node.returnKeyword),
1619 cloneNode(node.expression), 1681 cloneNode(node.expression),
1620 cloneToken(node.semicolon)); 1682 cloneToken(node.semicolon));
1621 1683
1622 @override 1684 @override
1623 ScriptTag visitScriptTag(ScriptTag node) => 1685 ScriptTag visitScriptTag(ScriptTag node) =>
1624 new ScriptTag(cloneToken(node.scriptTag)); 1686 new ScriptTag(cloneToken(node.scriptTag));
1625 1687
1626 @override 1688 @override
1627 ShowCombinator visitShowCombinator(ShowCombinator node) => 1689 ShowCombinator visitShowCombinator(ShowCombinator node) =>
1628 new ShowCombinator(cloneToken(node.keyword), cloneNodeList(node.shownNames )); 1690 new ShowCombinator(cloneToken(node.keyword), cloneNodeList(node.shownNames ));
(...skipping 17 matching lines...) Expand all
1646 new SimpleStringLiteral(cloneToken(node.literal), node.value); 1708 new SimpleStringLiteral(cloneToken(node.literal), node.value);
1647 1709
1648 @override 1710 @override
1649 StringInterpolation visitStringInterpolation(StringInterpolation node) => 1711 StringInterpolation visitStringInterpolation(StringInterpolation node) =>
1650 new StringInterpolation(cloneNodeList(node.elements)); 1712 new StringInterpolation(cloneNodeList(node.elements));
1651 1713
1652 @override 1714 @override
1653 SuperConstructorInvocation 1715 SuperConstructorInvocation
1654 visitSuperConstructorInvocation(SuperConstructorInvocation node) => 1716 visitSuperConstructorInvocation(SuperConstructorInvocation node) =>
1655 new SuperConstructorInvocation( 1717 new SuperConstructorInvocation(
1656 cloneToken(node.keyword), 1718 cloneToken(node.superKeyword),
1657 cloneToken(node.period), 1719 cloneToken(node.period),
1658 cloneNode(node.constructorName), 1720 cloneNode(node.constructorName),
1659 cloneNode(node.argumentList)); 1721 cloneNode(node.argumentList));
1660 1722
1661 @override 1723 @override
1662 SuperExpression visitSuperExpression(SuperExpression node) => 1724 SuperExpression visitSuperExpression(SuperExpression node) =>
1663 new SuperExpression(cloneToken(node.keyword)); 1725 new SuperExpression(cloneToken(node.superKeyword));
1664 1726
1665 @override 1727 @override
1666 SwitchCase visitSwitchCase(SwitchCase node) => 1728 SwitchCase visitSwitchCase(SwitchCase node) =>
1667 new SwitchCase( 1729 new SwitchCase(
1668 cloneNodeList(node.labels), 1730 cloneNodeList(node.labels),
1669 cloneToken(node.keyword), 1731 cloneToken(node.keyword),
1670 cloneNode(node.expression), 1732 cloneNode(node.expression),
1671 cloneToken(node.colon), 1733 cloneToken(node.colon),
1672 cloneNodeList(node.statements)); 1734 cloneNodeList(node.statements));
1673 1735
1674 @override 1736 @override
1675 SwitchDefault visitSwitchDefault(SwitchDefault node) => 1737 SwitchDefault visitSwitchDefault(SwitchDefault node) =>
1676 new SwitchDefault( 1738 new SwitchDefault(
1677 cloneNodeList(node.labels), 1739 cloneNodeList(node.labels),
1678 cloneToken(node.keyword), 1740 cloneToken(node.keyword),
1679 cloneToken(node.colon), 1741 cloneToken(node.colon),
1680 cloneNodeList(node.statements)); 1742 cloneNodeList(node.statements));
1681 1743
1682 @override 1744 @override
1683 SwitchStatement visitSwitchStatement(SwitchStatement node) => 1745 SwitchStatement visitSwitchStatement(SwitchStatement node) =>
1684 new SwitchStatement( 1746 new SwitchStatement(
1685 cloneToken(node.keyword), 1747 cloneToken(node.switchKeyword),
1686 cloneToken(node.leftParenthesis), 1748 cloneToken(node.leftParenthesis),
1687 cloneNode(node.expression), 1749 cloneNode(node.expression),
1688 cloneToken(node.rightParenthesis), 1750 cloneToken(node.rightParenthesis),
1689 cloneToken(node.leftBracket), 1751 cloneToken(node.leftBracket),
1690 cloneNodeList(node.members), 1752 cloneNodeList(node.members),
1691 cloneToken(node.rightBracket)); 1753 cloneToken(node.rightBracket));
1692 1754
1693 @override 1755 @override
1694 SymbolLiteral visitSymbolLiteral(SymbolLiteral node) => 1756 SymbolLiteral visitSymbolLiteral(SymbolLiteral node) =>
1695 new SymbolLiteral(cloneToken(node.poundSign), cloneTokenList(node.componen ts)); 1757 new SymbolLiteral(cloneToken(node.poundSign), cloneTokenList(node.componen ts));
1696 1758
1697 @override 1759 @override
1698 ThisExpression visitThisExpression(ThisExpression node) => 1760 ThisExpression visitThisExpression(ThisExpression node) =>
1699 new ThisExpression(cloneToken(node.keyword)); 1761 new ThisExpression(cloneToken(node.thisKeyword));
1700 1762
1701 @override 1763 @override
1702 ThrowExpression visitThrowExpression(ThrowExpression node) => 1764 ThrowExpression visitThrowExpression(ThrowExpression node) =>
1703 new ThrowExpression(cloneToken(node.keyword), cloneNode(node.expression)); 1765 new ThrowExpression(cloneToken(node.throwKeyword), cloneNode(node.expressi on));
1704 1766
1705 @override 1767 @override
1706 TopLevelVariableDeclaration 1768 TopLevelVariableDeclaration
1707 visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => 1769 visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) =>
1708 new TopLevelVariableDeclaration( 1770 new TopLevelVariableDeclaration(
1709 cloneNode(node.documentationComment), 1771 cloneNode(node.documentationComment),
1710 cloneNodeList(node.metadata), 1772 cloneNodeList(node.metadata),
1711 cloneNode(node.variables), 1773 cloneNode(node.variables),
1712 cloneToken(node.semicolon)); 1774 cloneToken(node.semicolon));
1713 1775
(...skipping 16 matching lines...) Expand all
1730 @override 1792 @override
1731 TypeName visitTypeName(TypeName node) => 1793 TypeName visitTypeName(TypeName node) =>
1732 new TypeName(cloneNode(node.name), cloneNode(node.typeArguments)); 1794 new TypeName(cloneNode(node.name), cloneNode(node.typeArguments));
1733 1795
1734 @override 1796 @override
1735 TypeParameter visitTypeParameter(TypeParameter node) => 1797 TypeParameter visitTypeParameter(TypeParameter node) =>
1736 new TypeParameter( 1798 new TypeParameter(
1737 cloneNode(node.documentationComment), 1799 cloneNode(node.documentationComment),
1738 cloneNodeList(node.metadata), 1800 cloneNodeList(node.metadata),
1739 cloneNode(node.name), 1801 cloneNode(node.name),
1740 cloneToken(node.keyword), 1802 cloneToken(node.extendsKeyword),
1741 cloneNode(node.bound)); 1803 cloneNode(node.bound));
1742 1804
1743 @override 1805 @override
1744 TypeParameterList visitTypeParameterList(TypeParameterList node) => 1806 TypeParameterList visitTypeParameterList(TypeParameterList node) =>
1745 new TypeParameterList( 1807 new TypeParameterList(
1746 cloneToken(node.leftBracket), 1808 cloneToken(node.leftBracket),
1747 cloneNodeList(node.typeParameters), 1809 cloneNodeList(node.typeParameters),
1748 cloneToken(node.rightBracket)); 1810 cloneToken(node.rightBracket));
1749 1811
1750 @override 1812 @override
(...skipping 18 matching lines...) Expand all
1769 @override 1831 @override
1770 VariableDeclarationStatement 1832 VariableDeclarationStatement
1771 visitVariableDeclarationStatement(VariableDeclarationStatement node) => 1833 visitVariableDeclarationStatement(VariableDeclarationStatement node) =>
1772 new VariableDeclarationStatement( 1834 new VariableDeclarationStatement(
1773 cloneNode(node.variables), 1835 cloneNode(node.variables),
1774 cloneToken(node.semicolon)); 1836 cloneToken(node.semicolon));
1775 1837
1776 @override 1838 @override
1777 WhileStatement visitWhileStatement(WhileStatement node) => 1839 WhileStatement visitWhileStatement(WhileStatement node) =>
1778 new WhileStatement( 1840 new WhileStatement(
1779 cloneToken(node.keyword), 1841 cloneToken(node.whileKeyword),
1780 cloneToken(node.leftParenthesis), 1842 cloneToken(node.leftParenthesis),
1781 cloneNode(node.condition), 1843 cloneNode(node.condition),
1782 cloneToken(node.rightParenthesis), 1844 cloneToken(node.rightParenthesis),
1783 cloneNode(node.body)); 1845 cloneNode(node.body));
1784 1846
1785 @override 1847 @override
1786 WithClause visitWithClause(WithClause node) => 1848 WithClause visitWithClause(WithClause node) =>
1787 new WithClause(cloneToken(node.withKeyword), cloneNodeList(node.mixinTypes )); 1849 new WithClause(cloneToken(node.withKeyword), cloneNodeList(node.mixinTypes ));
1788 1850
1789 @override 1851 @override
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 bool visitAsExpression(AsExpression node) { 1936 bool visitAsExpression(AsExpression node) {
1875 AsExpression other = _other as AsExpression; 1937 AsExpression other = _other as AsExpression;
1876 return isEqualNodes(node.expression, other.expression) && 1938 return isEqualNodes(node.expression, other.expression) &&
1877 isEqualTokens(node.asOperator, other.asOperator) && 1939 isEqualTokens(node.asOperator, other.asOperator) &&
1878 isEqualNodes(node.type, other.type); 1940 isEqualNodes(node.type, other.type);
1879 } 1941 }
1880 1942
1881 @override 1943 @override
1882 bool visitAssertStatement(AssertStatement node) { 1944 bool visitAssertStatement(AssertStatement node) {
1883 AssertStatement other = _other as AssertStatement; 1945 AssertStatement other = _other as AssertStatement;
1884 return isEqualTokens(node.keyword, other.keyword) && 1946 return isEqualTokens(node.assertKeyword, other.assertKeyword) &&
1885 isEqualTokens(node.leftParenthesis, other.leftParenthesis) && 1947 isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
1886 isEqualNodes(node.condition, other.condition) && 1948 isEqualNodes(node.condition, other.condition) &&
1887 isEqualTokens(node.rightParenthesis, other.rightParenthesis) && 1949 isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
1888 isEqualTokens(node.semicolon, other.semicolon); 1950 isEqualTokens(node.semicolon, other.semicolon);
1889 } 1951 }
1890 1952
1891 @override 1953 @override
1892 bool visitAssignmentExpression(AssignmentExpression node) { 1954 bool visitAssignmentExpression(AssignmentExpression node) {
1893 AssignmentExpression other = _other as AssignmentExpression; 1955 AssignmentExpression other = _other as AssignmentExpression;
1894 return isEqualNodes(node.leftHandSide, other.leftHandSide) && 1956 return isEqualNodes(node.leftHandSide, other.leftHandSide) &&
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 @override 1990 @override
1929 bool visitBooleanLiteral(BooleanLiteral node) { 1991 bool visitBooleanLiteral(BooleanLiteral node) {
1930 BooleanLiteral other = _other as BooleanLiteral; 1992 BooleanLiteral other = _other as BooleanLiteral;
1931 return isEqualTokens(node.literal, other.literal) && 1993 return isEqualTokens(node.literal, other.literal) &&
1932 node.value == other.value; 1994 node.value == other.value;
1933 } 1995 }
1934 1996
1935 @override 1997 @override
1936 bool visitBreakStatement(BreakStatement node) { 1998 bool visitBreakStatement(BreakStatement node) {
1937 BreakStatement other = _other as BreakStatement; 1999 BreakStatement other = _other as BreakStatement;
1938 return isEqualTokens(node.keyword, other.keyword) && 2000 return isEqualTokens(node.breakKeyword, other.breakKeyword) &&
1939 isEqualNodes(node.label, other.label) && 2001 isEqualNodes(node.label, other.label) &&
1940 isEqualTokens(node.semicolon, other.semicolon); 2002 isEqualTokens(node.semicolon, other.semicolon);
1941 } 2003 }
1942 2004
1943 @override 2005 @override
1944 bool visitCascadeExpression(CascadeExpression node) { 2006 bool visitCascadeExpression(CascadeExpression node) {
1945 CascadeExpression other = _other as CascadeExpression; 2007 CascadeExpression other = _other as CascadeExpression;
1946 return isEqualNodes(node.target, other.target) && 2008 return isEqualNodes(node.target, other.target) &&
1947 _isEqualNodeLists(node.cascadeSections, other.cascadeSections); 2009 _isEqualNodeLists(node.cascadeSections, other.cascadeSections);
1948 } 2010 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 isEqualTokens(node.rightBracket, other.rightBracket); 2042 isEqualTokens(node.rightBracket, other.rightBracket);
1981 } 2043 }
1982 2044
1983 @override 2045 @override
1984 bool visitClassTypeAlias(ClassTypeAlias node) { 2046 bool visitClassTypeAlias(ClassTypeAlias node) {
1985 ClassTypeAlias other = _other as ClassTypeAlias; 2047 ClassTypeAlias other = _other as ClassTypeAlias;
1986 return isEqualNodes( 2048 return isEqualNodes(
1987 node.documentationComment, 2049 node.documentationComment,
1988 other.documentationComment) && 2050 other.documentationComment) &&
1989 _isEqualNodeLists(node.metadata, other.metadata) && 2051 _isEqualNodeLists(node.metadata, other.metadata) &&
1990 isEqualTokens(node.keyword, other.keyword) && 2052 isEqualTokens(node.typedefKeyword, other.typedefKeyword) &&
1991 isEqualNodes(node.name, other.name) && 2053 isEqualNodes(node.name, other.name) &&
1992 isEqualNodes(node.typeParameters, other.typeParameters) && 2054 isEqualNodes(node.typeParameters, other.typeParameters) &&
1993 isEqualTokens(node.equals, other.equals) && 2055 isEqualTokens(node.equals, other.equals) &&
1994 isEqualTokens(node.abstractKeyword, other.abstractKeyword) && 2056 isEqualTokens(node.abstractKeyword, other.abstractKeyword) &&
1995 isEqualNodes(node.superclass, other.superclass) && 2057 isEqualNodes(node.superclass, other.superclass) &&
1996 isEqualNodes(node.withClause, other.withClause) && 2058 isEqualNodes(node.withClause, other.withClause) &&
1997 isEqualNodes(node.implementsClause, other.implementsClause) && 2059 isEqualNodes(node.implementsClause, other.implementsClause) &&
1998 isEqualTokens(node.semicolon, other.semicolon); 2060 isEqualTokens(node.semicolon, other.semicolon);
1999 } 2061 }
2000 2062
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 isEqualNodes(node.parameters, other.parameters) && 2109 isEqualNodes(node.parameters, other.parameters) &&
2048 isEqualTokens(node.separator, other.separator) && 2110 isEqualTokens(node.separator, other.separator) &&
2049 _isEqualNodeLists(node.initializers, other.initializers) && 2111 _isEqualNodeLists(node.initializers, other.initializers) &&
2050 isEqualNodes(node.redirectedConstructor, other.redirectedConstructor) && 2112 isEqualNodes(node.redirectedConstructor, other.redirectedConstructor) &&
2051 isEqualNodes(node.body, other.body); 2113 isEqualNodes(node.body, other.body);
2052 } 2114 }
2053 2115
2054 @override 2116 @override
2055 bool visitConstructorFieldInitializer(ConstructorFieldInitializer node) { 2117 bool visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
2056 ConstructorFieldInitializer other = _other as ConstructorFieldInitializer; 2118 ConstructorFieldInitializer other = _other as ConstructorFieldInitializer;
2057 return isEqualTokens(node.keyword, other.keyword) && 2119 return isEqualTokens(node.thisKeyword, other.thisKeyword) &&
2058 isEqualTokens(node.period, other.period) && 2120 isEqualTokens(node.period, other.period) &&
2059 isEqualNodes(node.fieldName, other.fieldName) && 2121 isEqualNodes(node.fieldName, other.fieldName) &&
2060 isEqualTokens(node.equals, other.equals) && 2122 isEqualTokens(node.equals, other.equals) &&
2061 isEqualNodes(node.expression, other.expression); 2123 isEqualNodes(node.expression, other.expression);
2062 } 2124 }
2063 2125
2064 @override 2126 @override
2065 bool visitConstructorName(ConstructorName node) { 2127 bool visitConstructorName(ConstructorName node) {
2066 ConstructorName other = _other as ConstructorName; 2128 ConstructorName other = _other as ConstructorName;
2067 return isEqualNodes(node.type, other.type) && 2129 return isEqualNodes(node.type, other.type) &&
2068 isEqualTokens(node.period, other.period) && 2130 isEqualTokens(node.period, other.period) &&
2069 isEqualNodes(node.name, other.name); 2131 isEqualNodes(node.name, other.name);
2070 } 2132 }
2071 2133
2072 @override 2134 @override
2073 bool visitContinueStatement(ContinueStatement node) { 2135 bool visitContinueStatement(ContinueStatement node) {
2074 ContinueStatement other = _other as ContinueStatement; 2136 ContinueStatement other = _other as ContinueStatement;
2075 return isEqualTokens(node.keyword, other.keyword) && 2137 return isEqualTokens(node.continueKeyword, other.continueKeyword) &&
2076 isEqualNodes(node.label, other.label) && 2138 isEqualNodes(node.label, other.label) &&
2077 isEqualTokens(node.semicolon, other.semicolon); 2139 isEqualTokens(node.semicolon, other.semicolon);
2078 } 2140 }
2079 2141
2080 @override 2142 @override
2081 bool visitDeclaredIdentifier(DeclaredIdentifier node) { 2143 bool visitDeclaredIdentifier(DeclaredIdentifier node) {
2082 DeclaredIdentifier other = _other as DeclaredIdentifier; 2144 DeclaredIdentifier other = _other as DeclaredIdentifier;
2083 return isEqualNodes( 2145 return isEqualNodes(
2084 node.documentationComment, 2146 node.documentationComment,
2085 other.documentationComment) && 2147 other.documentationComment) &&
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 isEqualNodes(node.name, other.name); 2201 isEqualNodes(node.name, other.name);
2140 } 2202 }
2141 2203
2142 @override 2204 @override
2143 bool visitEnumDeclaration(EnumDeclaration node) { 2205 bool visitEnumDeclaration(EnumDeclaration node) {
2144 EnumDeclaration other = _other as EnumDeclaration; 2206 EnumDeclaration other = _other as EnumDeclaration;
2145 return isEqualNodes( 2207 return isEqualNodes(
2146 node.documentationComment, 2208 node.documentationComment,
2147 other.documentationComment) && 2209 other.documentationComment) &&
2148 _isEqualNodeLists(node.metadata, other.metadata) && 2210 _isEqualNodeLists(node.metadata, other.metadata) &&
2149 isEqualTokens(node.keyword, other.keyword) && 2211 isEqualTokens(node.enumKeyword, other.enumKeyword) &&
2150 isEqualNodes(node.name, other.name) && 2212 isEqualNodes(node.name, other.name) &&
2151 isEqualTokens(node.leftBracket, other.leftBracket) && 2213 isEqualTokens(node.leftBracket, other.leftBracket) &&
2152 _isEqualNodeLists(node.constants, other.constants) && 2214 _isEqualNodeLists(node.constants, other.constants) &&
2153 isEqualTokens(node.rightBracket, other.rightBracket); 2215 isEqualTokens(node.rightBracket, other.rightBracket);
2154 } 2216 }
2155 2217
2156 @override 2218 @override
2157 bool visitExportDirective(ExportDirective node) { 2219 bool visitExportDirective(ExportDirective node) {
2158 ExportDirective other = _other as ExportDirective; 2220 ExportDirective other = _other as ExportDirective;
2159 return isEqualNodes( 2221 return isEqualNodes(
(...skipping 17 matching lines...) Expand all
2177 @override 2239 @override
2178 bool visitExpressionStatement(ExpressionStatement node) { 2240 bool visitExpressionStatement(ExpressionStatement node) {
2179 ExpressionStatement other = _other as ExpressionStatement; 2241 ExpressionStatement other = _other as ExpressionStatement;
2180 return isEqualNodes(node.expression, other.expression) && 2242 return isEqualNodes(node.expression, other.expression) &&
2181 isEqualTokens(node.semicolon, other.semicolon); 2243 isEqualTokens(node.semicolon, other.semicolon);
2182 } 2244 }
2183 2245
2184 @override 2246 @override
2185 bool visitExtendsClause(ExtendsClause node) { 2247 bool visitExtendsClause(ExtendsClause node) {
2186 ExtendsClause other = _other as ExtendsClause; 2248 ExtendsClause other = _other as ExtendsClause;
2187 return isEqualTokens(node.keyword, other.keyword) && 2249 return isEqualTokens(node.extendsKeyword, other.extendsKeyword) &&
2188 isEqualNodes(node.superclass, other.superclass); 2250 isEqualNodes(node.superclass, other.superclass);
2189 } 2251 }
2190 2252
2191 @override 2253 @override
2192 bool visitFieldDeclaration(FieldDeclaration node) { 2254 bool visitFieldDeclaration(FieldDeclaration node) {
2193 FieldDeclaration other = _other as FieldDeclaration; 2255 FieldDeclaration other = _other as FieldDeclaration;
2194 return isEqualNodes( 2256 return isEqualNodes(
2195 node.documentationComment, 2257 node.documentationComment,
2196 other.documentationComment) && 2258 other.documentationComment) &&
2197 _isEqualNodeLists(node.metadata, other.metadata) && 2259 _isEqualNodeLists(node.metadata, other.metadata) &&
2198 isEqualTokens(node.staticKeyword, other.staticKeyword) && 2260 isEqualTokens(node.staticKeyword, other.staticKeyword) &&
2199 isEqualNodes(node.fields, other.fields) && 2261 isEqualNodes(node.fields, other.fields) &&
2200 isEqualTokens(node.semicolon, other.semicolon); 2262 isEqualTokens(node.semicolon, other.semicolon);
2201 } 2263 }
2202 2264
2203 @override 2265 @override
2204 bool visitFieldFormalParameter(FieldFormalParameter node) { 2266 bool visitFieldFormalParameter(FieldFormalParameter node) {
2205 FieldFormalParameter other = _other as FieldFormalParameter; 2267 FieldFormalParameter other = _other as FieldFormalParameter;
2206 return isEqualNodes( 2268 return isEqualNodes(
2207 node.documentationComment, 2269 node.documentationComment,
2208 other.documentationComment) && 2270 other.documentationComment) &&
2209 _isEqualNodeLists(node.metadata, other.metadata) && 2271 _isEqualNodeLists(node.metadata, other.metadata) &&
2210 isEqualTokens(node.keyword, other.keyword) && 2272 isEqualTokens(node.keyword, other.keyword) &&
2211 isEqualNodes(node.type, other.type) && 2273 isEqualNodes(node.type, other.type) &&
2212 isEqualTokens(node.thisToken, other.thisToken) && 2274 isEqualTokens(node.thisKeyword, other.thisKeyword) &&
2213 isEqualTokens(node.period, other.period) && 2275 isEqualTokens(node.period, other.period) &&
2214 isEqualNodes(node.identifier, other.identifier); 2276 isEqualNodes(node.identifier, other.identifier);
2215 } 2277 }
2216 2278
2217 @override 2279 @override
2218 bool visitForEachStatement(ForEachStatement node) { 2280 bool visitForEachStatement(ForEachStatement node) {
2219 ForEachStatement other = _other as ForEachStatement; 2281 ForEachStatement other = _other as ForEachStatement;
2220 return isEqualTokens(node.forKeyword, other.forKeyword) && 2282 return isEqualTokens(node.forKeyword, other.forKeyword) &&
2221 isEqualTokens(node.leftParenthesis, other.leftParenthesis) && 2283 isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
2222 isEqualNodes(node.loopVariable, other.loopVariable) && 2284 isEqualNodes(node.loopVariable, other.loopVariable) &&
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 isEqualNodes(node.argumentList, other.argumentList); 2347 isEqualNodes(node.argumentList, other.argumentList);
2286 } 2348 }
2287 2349
2288 @override 2350 @override
2289 bool visitFunctionTypeAlias(FunctionTypeAlias node) { 2351 bool visitFunctionTypeAlias(FunctionTypeAlias node) {
2290 FunctionTypeAlias other = _other as FunctionTypeAlias; 2352 FunctionTypeAlias other = _other as FunctionTypeAlias;
2291 return isEqualNodes( 2353 return isEqualNodes(
2292 node.documentationComment, 2354 node.documentationComment,
2293 other.documentationComment) && 2355 other.documentationComment) &&
2294 _isEqualNodeLists(node.metadata, other.metadata) && 2356 _isEqualNodeLists(node.metadata, other.metadata) &&
2295 isEqualTokens(node.keyword, other.keyword) && 2357 isEqualTokens(node.typedefKeyword, other.typedefKeyword) &&
2296 isEqualNodes(node.returnType, other.returnType) && 2358 isEqualNodes(node.returnType, other.returnType) &&
2297 isEqualNodes(node.name, other.name) && 2359 isEqualNodes(node.name, other.name) &&
2298 isEqualNodes(node.typeParameters, other.typeParameters) && 2360 isEqualNodes(node.typeParameters, other.typeParameters) &&
2299 isEqualNodes(node.parameters, other.parameters) && 2361 isEqualNodes(node.parameters, other.parameters) &&
2300 isEqualTokens(node.semicolon, other.semicolon); 2362 isEqualTokens(node.semicolon, other.semicolon);
2301 } 2363 }
2302 2364
2303 @override 2365 @override
2304 bool visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { 2366 bool visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
2305 FunctionTypedFormalParameter other = _other as FunctionTypedFormalParameter; 2367 FunctionTypedFormalParameter other = _other as FunctionTypedFormalParameter;
(...skipping 21 matching lines...) Expand all
2327 isEqualNodes(node.condition, other.condition) && 2389 isEqualNodes(node.condition, other.condition) &&
2328 isEqualTokens(node.rightParenthesis, other.rightParenthesis) && 2390 isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
2329 isEqualNodes(node.thenStatement, other.thenStatement) && 2391 isEqualNodes(node.thenStatement, other.thenStatement) &&
2330 isEqualTokens(node.elseKeyword, other.elseKeyword) && 2392 isEqualTokens(node.elseKeyword, other.elseKeyword) &&
2331 isEqualNodes(node.elseStatement, other.elseStatement); 2393 isEqualNodes(node.elseStatement, other.elseStatement);
2332 } 2394 }
2333 2395
2334 @override 2396 @override
2335 bool visitImplementsClause(ImplementsClause node) { 2397 bool visitImplementsClause(ImplementsClause node) {
2336 ImplementsClause other = _other as ImplementsClause; 2398 ImplementsClause other = _other as ImplementsClause;
2337 return isEqualTokens(node.keyword, other.keyword) && 2399 return isEqualTokens(node.implementsKeyword, other.implementsKeyword) &&
2338 _isEqualNodeLists(node.interfaces, other.interfaces); 2400 _isEqualNodeLists(node.interfaces, other.interfaces);
2339 } 2401 }
2340 2402
2341 @override 2403 @override
2342 bool visitImportDirective(ImportDirective node) { 2404 bool visitImportDirective(ImportDirective node) {
2343 ImportDirective other = _other as ImportDirective; 2405 ImportDirective other = _other as ImportDirective;
2344 return isEqualNodes( 2406 return isEqualNodes(
2345 node.documentationComment, 2407 node.documentationComment,
2346 other.documentationComment) && 2408 other.documentationComment) &&
2347 _isEqualNodeLists(node.metadata, other.metadata) && 2409 _isEqualNodeLists(node.metadata, other.metadata) &&
2348 isEqualTokens(node.keyword, other.keyword) && 2410 isEqualTokens(node.keyword, other.keyword) &&
2349 isEqualNodes(node.uri, other.uri) && 2411 isEqualNodes(node.uri, other.uri) &&
2350 isEqualTokens(node.asToken, other.asToken) && 2412 isEqualTokens(node.deferredKeyword, other.deferredKeyword) &&
2413 isEqualTokens(node.asKeyword, other.asKeyword) &&
2351 isEqualNodes(node.prefix, other.prefix) && 2414 isEqualNodes(node.prefix, other.prefix) &&
2352 _isEqualNodeLists(node.combinators, other.combinators) && 2415 _isEqualNodeLists(node.combinators, other.combinators) &&
2353 isEqualTokens(node.semicolon, other.semicolon); 2416 isEqualTokens(node.semicolon, other.semicolon);
2354 } 2417 }
2355 2418
2356 @override 2419 @override
2357 bool visitIndexExpression(IndexExpression node) { 2420 bool visitIndexExpression(IndexExpression node) {
2358 IndexExpression other = _other as IndexExpression; 2421 IndexExpression other = _other as IndexExpression;
2359 return isEqualNodes(node.target, other.target) && 2422 return isEqualNodes(node.target, other.target) &&
2360 isEqualTokens(node.leftBracket, other.leftBracket) && 2423 isEqualTokens(node.leftBracket, other.leftBracket) &&
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 isEqualNodes(node.statement, other.statement); 2478 isEqualNodes(node.statement, other.statement);
2416 } 2479 }
2417 2480
2418 @override 2481 @override
2419 bool visitLibraryDirective(LibraryDirective node) { 2482 bool visitLibraryDirective(LibraryDirective node) {
2420 LibraryDirective other = _other as LibraryDirective; 2483 LibraryDirective other = _other as LibraryDirective;
2421 return isEqualNodes( 2484 return isEqualNodes(
2422 node.documentationComment, 2485 node.documentationComment,
2423 other.documentationComment) && 2486 other.documentationComment) &&
2424 _isEqualNodeLists(node.metadata, other.metadata) && 2487 _isEqualNodeLists(node.metadata, other.metadata) &&
2425 isEqualTokens(node.libraryToken, other.libraryToken) && 2488 isEqualTokens(node.libraryKeyword, other.libraryKeyword) &&
2426 isEqualNodes(node.name, other.name) && 2489 isEqualNodes(node.name, other.name) &&
2427 isEqualTokens(node.semicolon, other.semicolon); 2490 isEqualTokens(node.semicolon, other.semicolon);
2428 } 2491 }
2429 2492
2430 @override 2493 @override
2431 bool visitLibraryIdentifier(LibraryIdentifier node) { 2494 bool visitLibraryIdentifier(LibraryIdentifier node) {
2432 LibraryIdentifier other = _other as LibraryIdentifier; 2495 LibraryIdentifier other = _other as LibraryIdentifier;
2433 return _isEqualNodeLists(node.components, other.components); 2496 return _isEqualNodeLists(node.components, other.components);
2434 } 2497 }
2435 2498
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 @override 2553 @override
2491 bool visitNamedExpression(NamedExpression node) { 2554 bool visitNamedExpression(NamedExpression node) {
2492 NamedExpression other = _other as NamedExpression; 2555 NamedExpression other = _other as NamedExpression;
2493 return isEqualNodes(node.name, other.name) && 2556 return isEqualNodes(node.name, other.name) &&
2494 isEqualNodes(node.expression, other.expression); 2557 isEqualNodes(node.expression, other.expression);
2495 } 2558 }
2496 2559
2497 @override 2560 @override
2498 bool visitNativeClause(NativeClause node) { 2561 bool visitNativeClause(NativeClause node) {
2499 NativeClause other = _other as NativeClause; 2562 NativeClause other = _other as NativeClause;
2500 return isEqualTokens(node.keyword, other.keyword) && 2563 return isEqualTokens(node.nativeKeyword, other.nativeKeyword) &&
2501 isEqualNodes(node.name, other.name); 2564 isEqualNodes(node.name, other.name);
2502 } 2565 }
2503 2566
2504 @override 2567 @override
2505 bool visitNativeFunctionBody(NativeFunctionBody node) { 2568 bool visitNativeFunctionBody(NativeFunctionBody node) {
2506 NativeFunctionBody other = _other as NativeFunctionBody; 2569 NativeFunctionBody other = _other as NativeFunctionBody;
2507 return isEqualTokens(node.nativeToken, other.nativeToken) && 2570 return isEqualTokens(node.nativeKeyword, other.nativeKeyword) &&
2508 isEqualNodes(node.stringLiteral, other.stringLiteral) && 2571 isEqualNodes(node.stringLiteral, other.stringLiteral) &&
2509 isEqualTokens(node.semicolon, other.semicolon); 2572 isEqualTokens(node.semicolon, other.semicolon);
2510 } 2573 }
2511 2574
2512 @override 2575 @override
2513 bool visitNullLiteral(NullLiteral node) { 2576 bool visitNullLiteral(NullLiteral node) {
2514 NullLiteral other = _other as NullLiteral; 2577 NullLiteral other = _other as NullLiteral;
2515 return isEqualTokens(node.literal, other.literal); 2578 return isEqualTokens(node.literal, other.literal);
2516 } 2579 }
2517 2580
2518 @override 2581 @override
2519 bool visitParenthesizedExpression(ParenthesizedExpression node) { 2582 bool visitParenthesizedExpression(ParenthesizedExpression node) {
2520 ParenthesizedExpression other = _other as ParenthesizedExpression; 2583 ParenthesizedExpression other = _other as ParenthesizedExpression;
2521 return isEqualTokens(node.leftParenthesis, other.leftParenthesis) && 2584 return isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
2522 isEqualNodes(node.expression, other.expression) && 2585 isEqualNodes(node.expression, other.expression) &&
2523 isEqualTokens(node.rightParenthesis, other.rightParenthesis); 2586 isEqualTokens(node.rightParenthesis, other.rightParenthesis);
2524 } 2587 }
2525 2588
2526 @override 2589 @override
2527 bool visitPartDirective(PartDirective node) { 2590 bool visitPartDirective(PartDirective node) {
2528 PartDirective other = _other as PartDirective; 2591 PartDirective other = _other as PartDirective;
2529 return isEqualNodes( 2592 return isEqualNodes(
2530 node.documentationComment, 2593 node.documentationComment,
2531 other.documentationComment) && 2594 other.documentationComment) &&
2532 _isEqualNodeLists(node.metadata, other.metadata) && 2595 _isEqualNodeLists(node.metadata, other.metadata) &&
2533 isEqualTokens(node.partToken, other.partToken) && 2596 isEqualTokens(node.partKeyword, other.partKeyword) &&
2534 isEqualNodes(node.uri, other.uri) && 2597 isEqualNodes(node.uri, other.uri) &&
2535 isEqualTokens(node.semicolon, other.semicolon); 2598 isEqualTokens(node.semicolon, other.semicolon);
2536 } 2599 }
2537 2600
2538 @override 2601 @override
2539 bool visitPartOfDirective(PartOfDirective node) { 2602 bool visitPartOfDirective(PartOfDirective node) {
2540 PartOfDirective other = _other as PartOfDirective; 2603 PartOfDirective other = _other as PartOfDirective;
2541 return isEqualNodes( 2604 return isEqualNodes(
2542 node.documentationComment, 2605 node.documentationComment,
2543 other.documentationComment) && 2606 other.documentationComment) &&
2544 _isEqualNodeLists(node.metadata, other.metadata) && 2607 _isEqualNodeLists(node.metadata, other.metadata) &&
2545 isEqualTokens(node.partToken, other.partToken) && 2608 isEqualTokens(node.partKeyword, other.partKeyword) &&
2546 isEqualTokens(node.ofToken, other.ofToken) && 2609 isEqualTokens(node.ofKeyword, other.ofKeyword) &&
2547 isEqualNodes(node.libraryName, other.libraryName) && 2610 isEqualNodes(node.libraryName, other.libraryName) &&
2548 isEqualTokens(node.semicolon, other.semicolon); 2611 isEqualTokens(node.semicolon, other.semicolon);
2549 } 2612 }
2550 2613
2551 @override 2614 @override
2552 bool visitPostfixExpression(PostfixExpression node) { 2615 bool visitPostfixExpression(PostfixExpression node) {
2553 PostfixExpression other = _other as PostfixExpression; 2616 PostfixExpression other = _other as PostfixExpression;
2554 return isEqualNodes(node.operand, other.operand) && 2617 return isEqualNodes(node.operand, other.operand) &&
2555 isEqualTokens(node.operator, other.operator); 2618 isEqualTokens(node.operator, other.operator);
2556 } 2619 }
(...skipping 19 matching lines...) Expand all
2576 return isEqualNodes(node.target, other.target) && 2639 return isEqualNodes(node.target, other.target) &&
2577 isEqualTokens(node.operator, other.operator) && 2640 isEqualTokens(node.operator, other.operator) &&
2578 isEqualNodes(node.propertyName, other.propertyName); 2641 isEqualNodes(node.propertyName, other.propertyName);
2579 } 2642 }
2580 2643
2581 @override 2644 @override
2582 bool 2645 bool
2583 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) { 2646 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) {
2584 RedirectingConstructorInvocation other = 2647 RedirectingConstructorInvocation other =
2585 _other as RedirectingConstructorInvocation; 2648 _other as RedirectingConstructorInvocation;
2586 return isEqualTokens(node.keyword, other.keyword) && 2649 return isEqualTokens(node.thisKeyword, other.thisKeyword) &&
2587 isEqualTokens(node.period, other.period) && 2650 isEqualTokens(node.period, other.period) &&
2588 isEqualNodes(node.constructorName, other.constructorName) && 2651 isEqualNodes(node.constructorName, other.constructorName) &&
2589 isEqualNodes(node.argumentList, other.argumentList); 2652 isEqualNodes(node.argumentList, other.argumentList);
2590 } 2653 }
2591 2654
2592 @override 2655 @override
2593 bool visitRethrowExpression(RethrowExpression node) { 2656 bool visitRethrowExpression(RethrowExpression node) {
2594 RethrowExpression other = _other as RethrowExpression; 2657 RethrowExpression other = _other as RethrowExpression;
2595 return isEqualTokens(node.keyword, other.keyword); 2658 return isEqualTokens(node.rethrowKeyword, other.rethrowKeyword);
2596 } 2659 }
2597 2660
2598 @override 2661 @override
2599 bool visitReturnStatement(ReturnStatement node) { 2662 bool visitReturnStatement(ReturnStatement node) {
2600 ReturnStatement other = _other as ReturnStatement; 2663 ReturnStatement other = _other as ReturnStatement;
2601 return isEqualTokens(node.keyword, other.keyword) && 2664 return isEqualTokens(node.returnKeyword, other.returnKeyword) &&
2602 isEqualNodes(node.expression, other.expression) && 2665 isEqualNodes(node.expression, other.expression) &&
2603 isEqualTokens(node.semicolon, other.semicolon); 2666 isEqualTokens(node.semicolon, other.semicolon);
2604 } 2667 }
2605 2668
2606 @override 2669 @override
2607 bool visitScriptTag(ScriptTag node) { 2670 bool visitScriptTag(ScriptTag node) {
2608 ScriptTag other = _other as ScriptTag; 2671 ScriptTag other = _other as ScriptTag;
2609 return isEqualTokens(node.scriptTag, other.scriptTag); 2672 return isEqualTokens(node.scriptTag, other.scriptTag);
2610 } 2673 }
2611 2674
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 2706
2644 @override 2707 @override
2645 bool visitStringInterpolation(StringInterpolation node) { 2708 bool visitStringInterpolation(StringInterpolation node) {
2646 StringInterpolation other = _other as StringInterpolation; 2709 StringInterpolation other = _other as StringInterpolation;
2647 return _isEqualNodeLists(node.elements, other.elements); 2710 return _isEqualNodeLists(node.elements, other.elements);
2648 } 2711 }
2649 2712
2650 @override 2713 @override
2651 bool visitSuperConstructorInvocation(SuperConstructorInvocation node) { 2714 bool visitSuperConstructorInvocation(SuperConstructorInvocation node) {
2652 SuperConstructorInvocation other = _other as SuperConstructorInvocation; 2715 SuperConstructorInvocation other = _other as SuperConstructorInvocation;
2653 return isEqualTokens(node.keyword, other.keyword) && 2716 return isEqualTokens(node.superKeyword, other.superKeyword) &&
2654 isEqualTokens(node.period, other.period) && 2717 isEqualTokens(node.period, other.period) &&
2655 isEqualNodes(node.constructorName, other.constructorName) && 2718 isEqualNodes(node.constructorName, other.constructorName) &&
2656 isEqualNodes(node.argumentList, other.argumentList); 2719 isEqualNodes(node.argumentList, other.argumentList);
2657 } 2720 }
2658 2721
2659 @override 2722 @override
2660 bool visitSuperExpression(SuperExpression node) { 2723 bool visitSuperExpression(SuperExpression node) {
2661 SuperExpression other = _other as SuperExpression; 2724 SuperExpression other = _other as SuperExpression;
2662 return isEqualTokens(node.keyword, other.keyword); 2725 return isEqualTokens(node.superKeyword, other.superKeyword);
2663 } 2726 }
2664 2727
2665 @override 2728 @override
2666 bool visitSwitchCase(SwitchCase node) { 2729 bool visitSwitchCase(SwitchCase node) {
2667 SwitchCase other = _other as SwitchCase; 2730 SwitchCase other = _other as SwitchCase;
2668 return _isEqualNodeLists(node.labels, other.labels) && 2731 return _isEqualNodeLists(node.labels, other.labels) &&
2669 isEqualTokens(node.keyword, other.keyword) && 2732 isEqualTokens(node.keyword, other.keyword) &&
2670 isEqualNodes(node.expression, other.expression) && 2733 isEqualNodes(node.expression, other.expression) &&
2671 isEqualTokens(node.colon, other.colon) && 2734 isEqualTokens(node.colon, other.colon) &&
2672 _isEqualNodeLists(node.statements, other.statements); 2735 _isEqualNodeLists(node.statements, other.statements);
2673 } 2736 }
2674 2737
2675 @override 2738 @override
2676 bool visitSwitchDefault(SwitchDefault node) { 2739 bool visitSwitchDefault(SwitchDefault node) {
2677 SwitchDefault other = _other as SwitchDefault; 2740 SwitchDefault other = _other as SwitchDefault;
2678 return _isEqualNodeLists(node.labels, other.labels) && 2741 return _isEqualNodeLists(node.labels, other.labels) &&
2679 isEqualTokens(node.keyword, other.keyword) && 2742 isEqualTokens(node.keyword, other.keyword) &&
2680 isEqualTokens(node.colon, other.colon) && 2743 isEqualTokens(node.colon, other.colon) &&
2681 _isEqualNodeLists(node.statements, other.statements); 2744 _isEqualNodeLists(node.statements, other.statements);
2682 } 2745 }
2683 2746
2684 @override 2747 @override
2685 bool visitSwitchStatement(SwitchStatement node) { 2748 bool visitSwitchStatement(SwitchStatement node) {
2686 SwitchStatement other = _other as SwitchStatement; 2749 SwitchStatement other = _other as SwitchStatement;
2687 return isEqualTokens(node.keyword, other.keyword) && 2750 return isEqualTokens(node.switchKeyword, other.switchKeyword) &&
2688 isEqualTokens(node.leftParenthesis, other.leftParenthesis) && 2751 isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
2689 isEqualNodes(node.expression, other.expression) && 2752 isEqualNodes(node.expression, other.expression) &&
2690 isEqualTokens(node.rightParenthesis, other.rightParenthesis) && 2753 isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
2691 isEqualTokens(node.leftBracket, other.leftBracket) && 2754 isEqualTokens(node.leftBracket, other.leftBracket) &&
2692 _isEqualNodeLists(node.members, other.members) && 2755 _isEqualNodeLists(node.members, other.members) &&
2693 isEqualTokens(node.rightBracket, other.rightBracket); 2756 isEqualTokens(node.rightBracket, other.rightBracket);
2694 } 2757 }
2695 2758
2696 @override 2759 @override
2697 bool visitSymbolLiteral(SymbolLiteral node) { 2760 bool visitSymbolLiteral(SymbolLiteral node) {
2698 SymbolLiteral other = _other as SymbolLiteral; 2761 SymbolLiteral other = _other as SymbolLiteral;
2699 return isEqualTokens(node.poundSign, other.poundSign) && 2762 return isEqualTokens(node.poundSign, other.poundSign) &&
2700 _isEqualTokenLists(node.components, other.components); 2763 _isEqualTokenLists(node.components, other.components);
2701 } 2764 }
2702 2765
2703 @override 2766 @override
2704 bool visitThisExpression(ThisExpression node) { 2767 bool visitThisExpression(ThisExpression node) {
2705 ThisExpression other = _other as ThisExpression; 2768 ThisExpression other = _other as ThisExpression;
2706 return isEqualTokens(node.keyword, other.keyword); 2769 return isEqualTokens(node.thisKeyword, other.thisKeyword);
2707 } 2770 }
2708 2771
2709 @override 2772 @override
2710 bool visitThrowExpression(ThrowExpression node) { 2773 bool visitThrowExpression(ThrowExpression node) {
2711 ThrowExpression other = _other as ThrowExpression; 2774 ThrowExpression other = _other as ThrowExpression;
2712 return isEqualTokens(node.keyword, other.keyword) && 2775 return isEqualTokens(node.throwKeyword, other.throwKeyword) &&
2713 isEqualNodes(node.expression, other.expression); 2776 isEqualNodes(node.expression, other.expression);
2714 } 2777 }
2715 2778
2716 @override 2779 @override
2717 bool visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { 2780 bool visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
2718 TopLevelVariableDeclaration other = _other as TopLevelVariableDeclaration; 2781 TopLevelVariableDeclaration other = _other as TopLevelVariableDeclaration;
2719 return isEqualNodes( 2782 return isEqualNodes(
2720 node.documentationComment, 2783 node.documentationComment,
2721 other.documentationComment) && 2784 other.documentationComment) &&
2722 _isEqualNodeLists(node.metadata, other.metadata) && 2785 _isEqualNodeLists(node.metadata, other.metadata) &&
(...skipping 27 matching lines...) Expand all
2750 } 2813 }
2751 2814
2752 @override 2815 @override
2753 bool visitTypeParameter(TypeParameter node) { 2816 bool visitTypeParameter(TypeParameter node) {
2754 TypeParameter other = _other as TypeParameter; 2817 TypeParameter other = _other as TypeParameter;
2755 return isEqualNodes( 2818 return isEqualNodes(
2756 node.documentationComment, 2819 node.documentationComment,
2757 other.documentationComment) && 2820 other.documentationComment) &&
2758 _isEqualNodeLists(node.metadata, other.metadata) && 2821 _isEqualNodeLists(node.metadata, other.metadata) &&
2759 isEqualNodes(node.name, other.name) && 2822 isEqualNodes(node.name, other.name) &&
2760 isEqualTokens(node.keyword, other.keyword) && 2823 isEqualTokens(node.extendsKeyword, other.extendsKeyword) &&
2761 isEqualNodes(node.bound, other.bound); 2824 isEqualNodes(node.bound, other.bound);
2762 } 2825 }
2763 2826
2764 @override 2827 @override
2765 bool visitTypeParameterList(TypeParameterList node) { 2828 bool visitTypeParameterList(TypeParameterList node) {
2766 TypeParameterList other = _other as TypeParameterList; 2829 TypeParameterList other = _other as TypeParameterList;
2767 return isEqualTokens(node.leftBracket, other.leftBracket) && 2830 return isEqualTokens(node.leftBracket, other.leftBracket) &&
2768 _isEqualNodeLists(node.typeParameters, other.typeParameters) && 2831 _isEqualNodeLists(node.typeParameters, other.typeParameters) &&
2769 isEqualTokens(node.rightBracket, other.rightBracket); 2832 isEqualTokens(node.rightBracket, other.rightBracket);
2770 } 2833 }
(...skipping 25 matching lines...) Expand all
2796 @override 2859 @override
2797 bool visitVariableDeclarationStatement(VariableDeclarationStatement node) { 2860 bool visitVariableDeclarationStatement(VariableDeclarationStatement node) {
2798 VariableDeclarationStatement other = _other as VariableDeclarationStatement; 2861 VariableDeclarationStatement other = _other as VariableDeclarationStatement;
2799 return isEqualNodes(node.variables, other.variables) && 2862 return isEqualNodes(node.variables, other.variables) &&
2800 isEqualTokens(node.semicolon, other.semicolon); 2863 isEqualTokens(node.semicolon, other.semicolon);
2801 } 2864 }
2802 2865
2803 @override 2866 @override
2804 bool visitWhileStatement(WhileStatement node) { 2867 bool visitWhileStatement(WhileStatement node) {
2805 WhileStatement other = _other as WhileStatement; 2868 WhileStatement other = _other as WhileStatement;
2806 return isEqualTokens(node.keyword, other.keyword) && 2869 return isEqualTokens(node.whileKeyword, other.whileKeyword) &&
2807 isEqualTokens(node.leftParenthesis, other.leftParenthesis) && 2870 isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
2808 isEqualNodes(node.condition, other.condition) && 2871 isEqualNodes(node.condition, other.condition) &&
2809 isEqualTokens(node.rightParenthesis, other.rightParenthesis) && 2872 isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
2810 isEqualNodes(node.body, other.body); 2873 isEqualNodes(node.body, other.body);
2811 } 2874 }
2812 2875
2813 @override 2876 @override
2814 bool visitWithClause(WithClause node) { 2877 bool visitWithClause(WithClause node) {
2815 WithClause other = _other as WithClause; 2878 WithClause other = _other as WithClause;
2816 return isEqualTokens(node.withKeyword, other.withKeyword) && 2879 return isEqualTokens(node.withKeyword, other.withKeyword) &&
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 AstComparator comparator = new AstComparator(); 2934 AstComparator comparator = new AstComparator();
2872 return comparator.isEqualNodes(first, second); 2935 return comparator.isEqualNodes(first, second);
2873 } 2936 }
2874 } 2937 }
2875 2938
2876 /** 2939 /**
2877 * A node in the AST structure for a Dart program. 2940 * A node in the AST structure for a Dart program.
2878 */ 2941 */
2879 abstract class AstNode { 2942 abstract class AstNode {
2880 /** 2943 /**
2881 * An empty list of ast nodes. 2944 * An empty list of AST nodes.
2882 */ 2945 */
2883 static const List<AstNode> EMPTY_ARRAY = const <AstNode>[]; 2946 @deprecated // Use "AstNode.EMPTY_LIST"
2947 static const List<AstNode> EMPTY_ARRAY = EMPTY_LIST;
2948
2949 /**
2950 * An empty list of AST nodes.
2951 */
2952 static const List<AstNode> EMPTY_LIST = const <AstNode>[];
2884 2953
2885 /** 2954 /**
2886 * A comparator that can be used to sort AST nodes in lexical order. In other 2955 * A comparator that can be used to sort AST nodes in lexical order. In other
2887 * words, `compare` will return a negative value if the offset of the first 2956 * words, `compare` will return a negative value if the offset of the first
2888 * node is less than the offset of the second node, zero (0) if the nodes have 2957 * node is less than the offset of the second node, zero (0) if the nodes have
2889 * the same offset, and a positive value if if the offset of the first node is 2958 * the same offset, and a positive value if the offset of the first node is
2890 * greater than the offset of the second node. 2959 * greater than the offset of the second node.
2891 */ 2960 */
2892 static Comparator<AstNode> LEXICAL_ORDER = 2961 static Comparator<AstNode> LEXICAL_ORDER =
2893 (AstNode first, AstNode second) => second.offset - first.offset; 2962 (AstNode first, AstNode second) => second.offset - first.offset;
2894 2963
2895 /** 2964 /**
2896 * The parent of the node, or `null` if the node is the root of an AST 2965 * The parent of the node, or `null` if the node is the root of an AST
2897 * structure. 2966 * structure.
2898 */ 2967 */
2899 AstNode _parent; 2968 AstNode _parent;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2967 * AST structure. 3036 * AST structure.
2968 * 3037 *
2969 * Note that the relationship between an AST node and its parent node may 3038 * Note that the relationship between an AST node and its parent node may
2970 * change over the lifetime of a node. 3039 * change over the lifetime of a node.
2971 */ 3040 */
2972 AstNode get parent => _parent; 3041 AstNode get parent => _parent;
2973 3042
2974 /** 3043 /**
2975 * Set the parent of this node to the [newParent]. 3044 * Set the parent of this node to the [newParent].
2976 */ 3045 */
2977 @deprecated 3046 @deprecated // Never intended for public use.
2978 void set parent(AstNode newParent) { 3047 void set parent(AstNode newParent) {
2979 _parent = newParent; 3048 _parent = newParent;
2980 } 3049 }
2981 3050
2982 /** 3051 /**
2983 * Return the node at the root of this node's AST structure. Note that this 3052 * Return the node at the root of this node's AST structure. Note that this
2984 * method's performance is linear with respect to the depth of the node in the 3053 * method's performance is linear with respect to the depth of the node in the
2985 * AST structure (O(depth)). 3054 * AST structure (O(depth)).
2986 */ 3055 */
2987 AstNode get root { 3056 AstNode get root {
2988 AstNode root = this; 3057 AstNode root = this;
2989 AstNode parent = this.parent; 3058 AstNode parent = this.parent;
2990 while (parent != null) { 3059 while (parent != null) {
2991 root = parent; 3060 root = parent;
2992 parent = root.parent; 3061 parent = root.parent;
2993 } 3062 }
2994 return root; 3063 return root;
2995 } 3064 }
2996 3065
2997 /** 3066 /**
2998 * Use the given [visitor] to visit this node. Return the value returned by 3067 * Use the given [visitor] to visit this node. Return the value returned by
2999 * the visitor as a result of visiting this node. 3068 * the visitor as a result of visiting this node.
3000 */ 3069 */
3001 /* <E> E */ accept(AstVisitor /*<E>*/ visitor); 3070 /* <E> E */ accept(AstVisitor /*<E>*/ visitor);
3002 3071
3003 /** 3072 /**
3004 * Make this node the parent of the given [child] node. Return the child node. 3073 * Make this node the parent of the given [child] node. Return the child node.
3005 */ 3074 */
3075 @deprecated // Never intended for public use.
3006 AstNode becomeParentOf(AstNode child) { 3076 AstNode becomeParentOf(AstNode child) {
3007 if (child != null) { 3077 return _becomeParentOf(child);
3008 child._parent = this;
3009 }
3010 return child;
3011 } 3078 }
3012 3079
3013 /** 3080 /**
3014 * Return the most immediate ancestor of this node for which the [predicate] 3081 * Return the most immediate ancestor of this node for which the [predicate]
3015 * returns `true`, or `null` if there is no such ancestor. Note that this node 3082 * returns `true`, or `null` if there is no such ancestor. Note that this node
3016 * will never be returned. 3083 * will never be returned.
3017 */ 3084 */
3018 AstNode getAncestor(Predicate<AstNode> predicate) { 3085 AstNode getAncestor(Predicate<AstNode> predicate) {
3019 // TODO(brianwilkerson) It is a bug that this method can return `this`. 3086 // TODO(brianwilkerson) It is a bug that this method can return `this`.
3020 AstNode node = this; 3087 AstNode node = this;
(...skipping 10 matching lines...) Expand all
3031 Object getProperty(String name) { 3098 Object getProperty(String name) {
3032 if (_propertyMap == null) { 3099 if (_propertyMap == null) {
3033 return null; 3100 return null;
3034 } 3101 }
3035 return _propertyMap[name]; 3102 return _propertyMap[name];
3036 } 3103 }
3037 3104
3038 /** 3105 /**
3039 * If the given [child] is not `null`, use the given [visitor] to visit it. 3106 * If the given [child] is not `null`, use the given [visitor] to visit it.
3040 */ 3107 */
3041 @deprecated 3108 @deprecated // Never intended for public use.
3042 void safelyVisitChild(AstNode child, AstVisitor visitor) { 3109 void safelyVisitChild(AstNode child, AstVisitor visitor) {
3043 if (child != null) { 3110 if (child != null) {
3044 child.accept(visitor); 3111 child.accept(visitor);
3045 } 3112 }
3046 } 3113 }
3047 3114
3048 /** 3115 /**
3049 * Set the value of the property with the given [name] to the given [value]. 3116 * Set the value of the property with the given [name] to the given [value].
3050 * If the value is `null`, the property will effectively be removed. 3117 * If the value is `null`, the property will effectively be removed.
3051 */ 3118 */
(...skipping 27 matching lines...) Expand all
3079 @override 3146 @override
3080 String toString() => toSource(); 3147 String toString() => toSource();
3081 3148
3082 /** 3149 /**
3083 * Use the given [visitor] to visit all of the children of this node. The 3150 * Use the given [visitor] to visit all of the children of this node. The
3084 * children will be visited in lexical order. 3151 * children will be visited in lexical order.
3085 */ 3152 */
3086 void visitChildren(AstVisitor visitor); 3153 void visitChildren(AstVisitor visitor);
3087 3154
3088 /** 3155 /**
3156 * Make this node the parent of the given [child] node. Return the child node.
3157 */
3158 AstNode _becomeParentOf(AstNode child) {
3159 if (child != null) {
3160 child._parent = this;
3161 }
3162 return child;
3163 }
3164
3165 /**
3089 * If the given [child] is not `null`, use the given [visitor] to visit it. 3166 * If the given [child] is not `null`, use the given [visitor] to visit it.
3090 */ 3167 */
3091 void _safelyVisitChild(AstNode child, AstVisitor visitor) { 3168 void _safelyVisitChild(AstNode child, AstVisitor visitor) {
3092 if (child != null) { 3169 if (child != null) {
3093 child.accept(visitor); 3170 child.accept(visitor);
3094 } 3171 }
3095 } 3172 }
3096 } 3173 }
3097 3174
3098 /** 3175 /**
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3327 3404
3328 /** 3405 /**
3329 * The expression whose value is being waited on. 3406 * The expression whose value is being waited on.
3330 */ 3407 */
3331 Expression _expression; 3408 Expression _expression;
3332 3409
3333 /** 3410 /**
3334 * Initialize a newly created await expression. 3411 * Initialize a newly created await expression.
3335 */ 3412 */
3336 AwaitExpression(this.awaitKeyword, Expression expression) { 3413 AwaitExpression(this.awaitKeyword, Expression expression) {
3337 _expression = becomeParentOf(expression); 3414 _expression = _becomeParentOf(expression);
3338 } 3415 }
3339 3416
3340 @override 3417 @override
3341 Token get beginToken { 3418 Token get beginToken {
3342 if (awaitKeyword != null) { 3419 if (awaitKeyword != null) {
3343 return awaitKeyword; 3420 return awaitKeyword;
3344 } 3421 }
3345 return _expression.beginToken; 3422 return _expression.beginToken;
3346 } 3423 }
3347 3424
3348 @override 3425 @override
3349 Iterable get childEntities => new ChildEntities() 3426 Iterable get childEntities => new ChildEntities()
3350 ..add(awaitKeyword) 3427 ..add(awaitKeyword)
3351 ..add(_expression); 3428 ..add(_expression);
3352 3429
3353 @override 3430 @override
3354 Token get endToken => _expression.endToken; 3431 Token get endToken => _expression.endToken;
3355 3432
3356 /** 3433 /**
3357 * Return the expression whose value is being waited on. 3434 * Return the expression whose value is being waited on.
3358 */ 3435 */
3359 Expression get expression => _expression; 3436 Expression get expression => _expression;
3360 3437
3361 /** 3438 /**
3362 * Set the expression whose value is being waited on to the given [expression] . 3439 * Set the expression whose value is being waited on to the given [expression] .
3363 */ 3440 */
3364 void set expression(Expression expression) { 3441 void set expression(Expression expression) {
3365 _expression = becomeParentOf(expression); 3442 _expression = _becomeParentOf(expression);
3366 } 3443 }
3367 3444
3368 @override 3445 @override
3369 int get precedence => 0; 3446 int get precedence => 0;
3370 3447
3371 @override 3448 @override
3372 accept(AstVisitor visitor) => visitor.visitAwaitExpression(this); 3449 accept(AstVisitor visitor) => visitor.visitAwaitExpression(this);
3373 3450
3374 @override 3451 @override
3375 void visitChildren(AstVisitor visitor) { 3452 void visitChildren(AstVisitor visitor) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 * the operator is not user definable, or if the operator could not be 3489 * the operator is not user definable, or if the operator could not be
3413 * resolved. 3490 * resolved.
3414 */ 3491 */
3415 MethodElement propagatedElement; 3492 MethodElement propagatedElement;
3416 3493
3417 /** 3494 /**
3418 * Initialize a newly created binary expression. 3495 * Initialize a newly created binary expression.
3419 */ 3496 */
3420 BinaryExpression(Expression leftOperand, this.operator, 3497 BinaryExpression(Expression leftOperand, this.operator,
3421 Expression rightOperand) { 3498 Expression rightOperand) {
3422 _leftOperand = becomeParentOf(leftOperand); 3499 _leftOperand = _becomeParentOf(leftOperand);
3423 _rightOperand = becomeParentOf(rightOperand); 3500 _rightOperand = _becomeParentOf(rightOperand);
3424 } 3501 }
3425 3502
3426 @override 3503 @override
3427 Token get beginToken => _leftOperand.beginToken; 3504 Token get beginToken => _leftOperand.beginToken;
3428 3505
3429 /** 3506 /**
3430 * Return the best element available for this operator. If resolution was able 3507 * Return the best element available for this operator. If resolution was able
3431 * to find a better element based on type propagation, that element will be 3508 * to find a better element based on type propagation, that element will be
3432 * returned. Otherwise, the element found using the result of static analysis 3509 * returned. Otherwise, the element found using the result of static analysis
3433 * will be returned. If resolution has not been performed, then `null` will be 3510 * will be returned. If resolution has not been performed, then `null` will be
(...skipping 19 matching lines...) Expand all
3453 /** 3530 /**
3454 * Return the expression used to compute the left operand. 3531 * Return the expression used to compute the left operand.
3455 */ 3532 */
3456 Expression get leftOperand => _leftOperand; 3533 Expression get leftOperand => _leftOperand;
3457 3534
3458 /** 3535 /**
3459 * Set the expression used to compute the left operand to the given 3536 * Set the expression used to compute the left operand to the given
3460 * [expression]. 3537 * [expression].
3461 */ 3538 */
3462 void set leftOperand(Expression expression) { 3539 void set leftOperand(Expression expression) {
3463 _leftOperand = becomeParentOf(expression); 3540 _leftOperand = _becomeParentOf(expression);
3464 } 3541 }
3465 3542
3466 @override 3543 @override
3467 int get precedence => operator.type.precedence; 3544 int get precedence => operator.type.precedence;
3468 3545
3469 /** 3546 /**
3470 * If the AST structure has been resolved, and the function being invoked is 3547 * If the AST structure has been resolved, and the function being invoked is
3471 * known based on propagated type information, then return the parameter 3548 * known based on propagated type information, then return the parameter
3472 * element representing the parameter to which the value of the right operand 3549 * element representing the parameter to which the value of the right operand
3473 * will be bound. Otherwise, return `null`. 3550 * will be bound. Otherwise, return `null`.
3474 *
3475 * This method is only intended to be used by
3476 * [Expression.propagatedParameterElement].
3477 */ 3551 */
3552 @deprecated // Use "expression.propagatedParameterElement"
3478 ParameterElement get propagatedParameterElementForRightOperand { 3553 ParameterElement get propagatedParameterElementForRightOperand {
3479 if (propagatedElement == null) { 3554 return _propagatedParameterElementForRightOperand;
3480 return null;
3481 }
3482 List<ParameterElement> parameters = propagatedElement.parameters;
3483 if (parameters.length < 1) {
3484 return null;
3485 }
3486 return parameters[0];
3487 } 3555 }
3488 3556
3489 /** 3557 /**
3490 * Return the expression used to compute the right operand. 3558 * Return the expression used to compute the right operand.
3491 */ 3559 */
3492 Expression get rightOperand => _rightOperand; 3560 Expression get rightOperand => _rightOperand;
3493 3561
3494 /** 3562 /**
3495 * Set the expression used to compute the right operand to the given 3563 * Set the expression used to compute the right operand to the given
3496 * [expression]. 3564 * [expression].
3497 */ 3565 */
3498 void set rightOperand(Expression expression) { 3566 void set rightOperand(Expression expression) {
3499 _rightOperand = becomeParentOf(expression); 3567 _rightOperand = _becomeParentOf(expression);
3500 } 3568 }
3501 3569
3502 /** 3570 /**
3503 * If the AST structure has been resolved, and the function being invoked is 3571 * If the AST structure has been resolved, and the function being invoked is
3504 * known based on static type information, then return the parameter element 3572 * known based on static type information, then return the parameter element
3505 * representing the parameter to which the value of the right operand will be 3573 * representing the parameter to which the value of the right operand will be
3506 * bound. Otherwise, return `null`. 3574 * bound. Otherwise, return `null`.
3507 *
3508 * This method is only intended to be used by
3509 * [Expression.staticParameterElement].
3510 */ 3575 */
3576 @deprecated // Use "expression.propagatedParameterElement"
3511 ParameterElement get staticParameterElementForRightOperand { 3577 ParameterElement get staticParameterElementForRightOperand {
3578 return _staticParameterElementForRightOperand;
3579 }
3580
3581 /**
3582 * If the AST structure has been resolved, and the function being invoked is
3583 * known based on propagated type information, then return the parameter
3584 * element representing the parameter to which the value of the right operand
3585 * will be bound. Otherwise, return `null`.
3586 */
3587 ParameterElement get _propagatedParameterElementForRightOperand {
3588 if (propagatedElement == null) {
3589 return null;
3590 }
3591 List<ParameterElement> parameters = propagatedElement.parameters;
3592 if (parameters.length < 1) {
3593 return null;
3594 }
3595 return parameters[0];
3596 }
3597
3598 /**
3599 * If the AST structure has been resolved, and the function being invoked is
3600 * known based on static type information, then return the parameter element
3601 * representing the parameter to which the value of the right operand will be
3602 * bound. Otherwise, return `null`.
3603 */
3604 ParameterElement get _staticParameterElementForRightOperand {
3512 if (staticElement == null) { 3605 if (staticElement == null) {
3513 return null; 3606 return null;
3514 } 3607 }
3515 List<ParameterElement> parameters = staticElement.parameters; 3608 List<ParameterElement> parameters = staticElement.parameters;
3516 if (parameters.length < 1) { 3609 if (parameters.length < 1) {
3517 return null; 3610 return null;
3518 } 3611 }
3519 return parameters[0]; 3612 return parameters[0];
3520 } 3613 }
3521 3614
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3608 */ 3701 */
3609 Block _block; 3702 Block _block;
3610 3703
3611 /** 3704 /**
3612 * Initialize a newly created function body consisting of a block of 3705 * Initialize a newly created function body consisting of a block of
3613 * statements. The [keyword] can be `null` if there is no keyword specified 3706 * statements. The [keyword] can be `null` if there is no keyword specified
3614 * for the block. The [star] can be `null` if there is no star following the 3707 * for the block. The [star] can be `null` if there is no star following the
3615 * keyword (and must be `null` if there is no keyword). 3708 * keyword (and must be `null` if there is no keyword).
3616 */ 3709 */
3617 BlockFunctionBody(this.keyword, this.star, Block block) { 3710 BlockFunctionBody(this.keyword, this.star, Block block) {
3618 _block = becomeParentOf(block); 3711 _block = _becomeParentOf(block);
3619 } 3712 }
3620 3713
3621 @override 3714 @override
3622 Token get beginToken => _block.beginToken; 3715 Token get beginToken => _block.beginToken;
3623 3716
3624 /** 3717 /**
3625 * Return the block representing the body of the function. 3718 * Return the block representing the body of the function.
3626 */ 3719 */
3627 Block get block => _block; 3720 Block get block => _block;
3628 3721
3629 /** 3722 /**
3630 * Set the block representing the body of the function to the given [block]. 3723 * Set the block representing the body of the function to the given [block].
3631 */ 3724 */
3632 void set block(Block block) { 3725 void set block(Block block) {
3633 _block = becomeParentOf(block); 3726 _block = _becomeParentOf(block);
3634 } 3727 }
3635 3728
3636 @override 3729 @override
3637 Iterable get childEntities => new ChildEntities() 3730 Iterable get childEntities => new ChildEntities()
3638 ..add(keyword) 3731 ..add(keyword)
3639 ..add(star) 3732 ..add(star)
3640 ..add(_block); 3733 ..add(_block);
3641 3734
3642 @override 3735 @override
3643 Token get endToken => _block.endToken; 3736 Token get endToken => _block.endToken;
3644 3737
3645 @override 3738 @override
3646 bool get isAsynchronous { 3739 bool get isAsynchronous => keyword != null && keyword.lexeme == Parser.ASYNC;
3647 if (keyword == null) {
3648 return false;
3649 }
3650 String keywordValue = keyword.lexeme;
3651 return keywordValue == Parser.ASYNC;
3652 }
3653 3740
3654 @override 3741 @override
3655 bool get isGenerator => star != null; 3742 bool get isGenerator => star != null;
3656 3743
3657 @override 3744 @override
3658 bool get isSynchronous => keyword == null || keyword.lexeme != Parser.ASYNC; 3745 bool get isSynchronous => keyword == null || keyword.lexeme != Parser.ASYNC;
3659 3746
3660 @override 3747 @override
3661 accept(AstVisitor visitor) => visitor.visitBlockFunctionBody(this); 3748 accept(AstVisitor visitor) => visitor.visitBlockFunctionBody(this);
3662 3749
(...skipping 21 matching lines...) Expand all
3684 bool value = false; 3771 bool value = false;
3685 3772
3686 /** 3773 /**
3687 * Initialize a newly created boolean literal. 3774 * Initialize a newly created boolean literal.
3688 */ 3775 */
3689 BooleanLiteral(this.literal, this.value); 3776 BooleanLiteral(this.literal, this.value);
3690 3777
3691 @override 3778 @override
3692 Token get beginToken => literal; 3779 Token get beginToken => literal;
3693 3780
3694 /**
3695 * TODO(paulberry): untested.
3696 */
3697 @override 3781 @override
3698 Iterable get childEntities => new ChildEntities()..add(literal); 3782 Iterable get childEntities => new ChildEntities()..add(literal);
3699 3783
3700 @override 3784 @override
3701 Token get endToken => literal; 3785 Token get endToken => literal;
3702 3786
3703 @override 3787 @override
3704 bool get isSynthetic => literal.isSynthetic; 3788 bool get isSynthetic => literal.isSynthetic;
3705 3789
3706 @override 3790 @override
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3770 /** 3854 /**
3771 * A break statement. 3855 * A break statement.
3772 * 3856 *
3773 * > breakStatement ::= 3857 * > breakStatement ::=
3774 * > 'break' [SimpleIdentifier]? ';' 3858 * > 'break' [SimpleIdentifier]? ';'
3775 */ 3859 */
3776 class BreakStatement extends Statement { 3860 class BreakStatement extends Statement {
3777 /** 3861 /**
3778 * The token representing the 'break' keyword. 3862 * The token representing the 'break' keyword.
3779 */ 3863 */
3780 Token keyword; 3864 Token breakKeyword;
3781 3865
3782 /** 3866 /**
3783 * The label associated with the statement, or `null` if there is no label. 3867 * The label associated with the statement, or `null` if there is no label.
3784 */ 3868 */
3785 SimpleIdentifier _label; 3869 SimpleIdentifier _label;
3786 3870
3787 /** 3871 /**
3788 * The semicolon terminating the statement. 3872 * The semicolon terminating the statement.
3789 */ 3873 */
3790 Token semicolon; 3874 Token semicolon;
3791 3875
3792 /** 3876 /**
3793 * The AstNode which this break statement is breaking from. This will be 3877 * The AstNode which this break statement is breaking from. This will be
3794 * either a [Statement] (in the case of breaking out of a loop), a 3878 * either a [Statement] (in the case of breaking out of a loop), a
3795 * [SwitchMember] (in the case of a labeled break statement whose label 3879 * [SwitchMember] (in the case of a labeled break statement whose label
3796 * matches a label on a switch case in an enclosing switch statement), or 3880 * matches a label on a switch case in an enclosing switch statement), or
3797 * `null` if the AST has not yet been resolved or if the target could not be 3881 * `null` if the AST has not yet been resolved or if the target could not be
3798 * resolved. Note that if the source code has errors, the target might be 3882 * resolved. Note that if the source code has errors, the target might be
3799 * invalid (e.g. trying to break to a switch case). 3883 * invalid (e.g. trying to break to a switch case).
3800 */ 3884 */
3801 AstNode target; 3885 AstNode target;
3802 3886
3803 /** 3887 /**
3804 * Initialize a newly created break statement. The [label] can be `null` if 3888 * Initialize a newly created break statement. The [label] can be `null` if
3805 * there is no label associated with the statement. 3889 * there is no label associated with the statement.
3806 */ 3890 */
3807 BreakStatement(this.keyword, SimpleIdentifier label, this.semicolon) { 3891 BreakStatement(this.breakKeyword, SimpleIdentifier label, this.semicolon) {
3808 _label = becomeParentOf(label); 3892 _label = _becomeParentOf(label);
3809 } 3893 }
3810 3894
3811 @override 3895 @override
3812 Token get beginToken => keyword; 3896 Token get beginToken => breakKeyword;
3813 3897
3814 /**
3815 * TODO(paulberry): untested.
3816 */
3817 @override 3898 @override
3818 Iterable get childEntities => new ChildEntities() 3899 Iterable get childEntities => new ChildEntities()
3819 ..add(keyword) 3900 ..add(breakKeyword)
3820 ..add(_label) 3901 ..add(_label)
3821 ..add(semicolon); 3902 ..add(semicolon);
3822 3903
3823 @override 3904 @override
3824 Token get endToken => semicolon; 3905 Token get endToken => semicolon;
3825 3906
3826 /** 3907 /**
3908 * Return the token representing the 'break' keyword.
3909 */
3910 @deprecated // Use "this.breakKeyword"
3911 Token get keyword => breakKeyword;
3912
3913 /**
3914 * Sethe token representing the 'break' keyword to the given [token].
3915 */
3916 @deprecated // Use "this.breakKeyword"
3917 void set keyword(Token token) {
3918 breakKeyword = token;
3919 }
3920
3921 /**
3827 * Return the label associated with the statement, or `null` if there is no 3922 * Return the label associated with the statement, or `null` if there is no
3828 * label. 3923 * label.
3829 */ 3924 */
3830 SimpleIdentifier get label => _label; 3925 SimpleIdentifier get label => _label;
3831 3926
3832 /** 3927 /**
3833 * Set the label associated with the statement to the given [identifier]. 3928 * Set the label associated with the statement to the given [identifier].
3834 */ 3929 */
3835 void set label(SimpleIdentifier identifier) { 3930 void set label(SimpleIdentifier identifier) {
3836 _label = becomeParentOf(identifier); 3931 _label = _becomeParentOf(identifier);
3837 } 3932 }
3838 3933
3839 @override 3934 @override
3840 accept(AstVisitor visitor) => visitor.visitBreakStatement(this); 3935 accept(AstVisitor visitor) => visitor.visitBreakStatement(this);
3841 3936
3842 @override 3937 @override
3843 void visitChildren(AstVisitor visitor) { 3938 void visitChildren(AstVisitor visitor) {
3844 _safelyVisitChild(_label, visitor); 3939 _safelyVisitChild(_label, visitor);
3845 } 3940 }
3846 } 3941 }
(...skipping 23 matching lines...) Expand all
3870 /** 3965 /**
3871 * The cascade sections sharing the common target. 3966 * The cascade sections sharing the common target.
3872 */ 3967 */
3873 NodeList<Expression> _cascadeSections; 3968 NodeList<Expression> _cascadeSections;
3874 3969
3875 /** 3970 /**
3876 * Initialize a newly created cascade expression. The list of 3971 * Initialize a newly created cascade expression. The list of
3877 * [cascadeSections] must contain at least one element. 3972 * [cascadeSections] must contain at least one element.
3878 */ 3973 */
3879 CascadeExpression(Expression target, List<Expression> cascadeSections) { 3974 CascadeExpression(Expression target, List<Expression> cascadeSections) {
3880 _target = becomeParentOf(target); 3975 _target = _becomeParentOf(target);
3881 _cascadeSections = new NodeList<Expression>(this, cascadeSections); 3976 _cascadeSections = new NodeList<Expression>(this, cascadeSections);
3882 } 3977 }
3883 3978
3884 @override 3979 @override
3885 Token get beginToken => _target.beginToken; 3980 Token get beginToken => _target.beginToken;
3886 3981
3887 /** 3982 /**
3888 * Return the cascade sections sharing the common target. 3983 * Return the cascade sections sharing the common target.
3889 */ 3984 */
3890 NodeList<Expression> get cascadeSections => _cascadeSections; 3985 NodeList<Expression> get cascadeSections => _cascadeSections;
(...skipping 11 matching lines...) Expand all
3902 3997
3903 /** 3998 /**
3904 * Return the target of the cascade sections. 3999 * Return the target of the cascade sections.
3905 */ 4000 */
3906 Expression get target => _target; 4001 Expression get target => _target;
3907 4002
3908 /** 4003 /**
3909 * Set the target of the cascade sections to the given [expression]. 4004 * Set the target of the cascade sections to the given [expression].
3910 */ 4005 */
3911 void set target(Expression target) { 4006 void set target(Expression target) {
3912 _target = becomeParentOf(target); 4007 _target = _becomeParentOf(target);
3913 } 4008 }
3914 4009
3915 @override 4010 @override
3916 accept(AstVisitor visitor) => visitor.visitCascadeExpression(this); 4011 accept(AstVisitor visitor) => visitor.visitCascadeExpression(this);
3917 4012
3918 @override 4013 @override
3919 void visitChildren(AstVisitor visitor) { 4014 void visitChildren(AstVisitor visitor) {
3920 _safelyVisitChild(_target, visitor); 4015 _safelyVisitChild(_target, visitor);
3921 _cascadeSections.accept(visitor); 4016 _cascadeSections.accept(visitor);
3922 } 4017 }
(...skipping 22 matching lines...) Expand all
3945 */ 4040 */
3946 TypeName _exceptionType; 4041 TypeName _exceptionType;
3947 4042
3948 /** 4043 /**
3949 * The token representing the 'catch' keyword, or `null` if there is no 4044 * The token representing the 'catch' keyword, or `null` if there is no
3950 * 'catch' keyword. 4045 * 'catch' keyword.
3951 */ 4046 */
3952 Token catchKeyword; 4047 Token catchKeyword;
3953 4048
3954 /** 4049 /**
3955 * The left parenthesis. 4050 * The left parenthesis, or `null` if there is no 'catch' keyword.
3956 */ 4051 */
3957 Token leftParenthesis; 4052 Token leftParenthesis;
3958 4053
3959 /** 4054 /**
3960 * The parameter whose value will be the exception that was thrown. 4055 * The parameter whose value will be the exception that was thrown, or `null`
4056 * if there is no 'catch' keyword.
3961 */ 4057 */
3962 SimpleIdentifier _exceptionParameter; 4058 SimpleIdentifier _exceptionParameter;
3963 4059
3964 /** 4060 /**
3965 * The comma separating the exception parameter from the stack trace 4061 * The comma separating the exception parameter from the stack trace
3966 * parameter, or `null` if there is no stack trace parameter. 4062 * parameter, or `null` if there is no stack trace parameter.
3967 */ 4063 */
3968 Token comma; 4064 Token comma;
3969 4065
3970 /** 4066 /**
3971 * The parameter whose value will be the stack trace associated with the 4067 * The parameter whose value will be the stack trace associated with the
3972 * exception, or `null` if there is no stack trace parameter. 4068 * exception, or `null` if there is no stack trace parameter.
3973 */ 4069 */
3974 SimpleIdentifier _stackTraceParameter; 4070 SimpleIdentifier _stackTraceParameter;
3975 4071
3976 /** 4072 /**
3977 * The right parenthesis. 4073 * The right parenthesis, or `null` if there is no 'catch' keyword.
3978 */ 4074 */
3979 Token rightParenthesis; 4075 Token rightParenthesis;
3980 4076
3981 /** 4077 /**
3982 * The body of the catch block. 4078 * The body of the catch block.
3983 */ 4079 */
3984 Block _body; 4080 Block _body;
3985 4081
3986 /** 4082 /**
3987 * Initialize a newly created catch clause. The [onKeyword] and 4083 * Initialize a newly created catch clause. The [onKeyword] and
3988 * [exceptionType] can be `null` if the clause will catch all exceptions. The 4084 * [exceptionType] can be `null` if the clause will catch all exceptions. The
3989 * [comma] and [stackTraceParameter] can be `null` if the stack trace is not 4085 * [comma] and [stackTraceParameter] can be `null` if the stack trace is not
3990 * referencable within the body. 4086 * referencable within the body.
3991 */ 4087 */
3992 CatchClause(this.onKeyword, TypeName exceptionType, this.catchKeyword, 4088 CatchClause(this.onKeyword, TypeName exceptionType, this.catchKeyword,
3993 this.leftParenthesis, SimpleIdentifier exceptionParameter, this.comma, 4089 this.leftParenthesis, SimpleIdentifier exceptionParameter, this.comma,
3994 SimpleIdentifier stackTraceParameter, this.rightParenthesis, Block body) { 4090 SimpleIdentifier stackTraceParameter, this.rightParenthesis, Block body) {
3995 _exceptionType = becomeParentOf(exceptionType); 4091 _exceptionType = _becomeParentOf(exceptionType);
3996 _exceptionParameter = becomeParentOf(exceptionParameter); 4092 _exceptionParameter = _becomeParentOf(exceptionParameter);
3997 _stackTraceParameter = becomeParentOf(stackTraceParameter); 4093 _stackTraceParameter = _becomeParentOf(stackTraceParameter);
3998 _body = becomeParentOf(body); 4094 _body = _becomeParentOf(body);
3999 } 4095 }
4000 4096
4001 @override 4097 @override
4002 Token get beginToken { 4098 Token get beginToken {
4003 if (onKeyword != null) { 4099 if (onKeyword != null) {
4004 return onKeyword; 4100 return onKeyword;
4005 } 4101 }
4006 return catchKeyword; 4102 return catchKeyword;
4007 } 4103 }
4008 4104
4009 /** 4105 /**
4010 * Return the body of the catch block. 4106 * Return the body of the catch block.
4011 */ 4107 */
4012 Block get body => _body; 4108 Block get body => _body;
4013 4109
4014 /** 4110 /**
4015 * Set the body of the catch block to the given [block]. 4111 * Set the body of the catch block to the given [block].
4016 */ 4112 */
4017 void set body(Block block) { 4113 void set body(Block block) {
4018 _body = becomeParentOf(block); 4114 _body = _becomeParentOf(block);
4019 } 4115 }
4020 4116
4021 @override 4117 @override
4022 Iterable get childEntities => new ChildEntities() 4118 Iterable get childEntities => new ChildEntities()
4023 ..add(onKeyword) 4119 ..add(onKeyword)
4024 ..add(_exceptionType) 4120 ..add(_exceptionType)
4025 ..add(catchKeyword) 4121 ..add(catchKeyword)
4026 ..add(leftParenthesis) 4122 ..add(leftParenthesis)
4027 ..add(_exceptionParameter) 4123 ..add(_exceptionParameter)
4028 ..add(comma) 4124 ..add(comma)
4029 ..add(_stackTraceParameter) 4125 ..add(_stackTraceParameter)
4030 ..add(rightParenthesis) 4126 ..add(rightParenthesis)
4031 ..add(_body); 4127 ..add(_body);
4032 4128
4033 @override 4129 @override
4034 Token get endToken => _body.endToken; 4130 Token get endToken => _body.endToken;
4035 4131
4036 /** 4132 /**
4037 * Return the parameter whose value will be the exception that was thrown. 4133 * Return the parameter whose value will be the exception that was thrown, or
4134 * `null` if there is no 'catch' keyword.
4038 */ 4135 */
4039 SimpleIdentifier get exceptionParameter => _exceptionParameter; 4136 SimpleIdentifier get exceptionParameter => _exceptionParameter;
4040 4137
4041 /** 4138 /**
4042 * Set the parameter whose value will be the exception that was thrown to the 4139 * Set the parameter whose value will be the exception that was thrown to the
4043 * given [parameter]. 4140 * given [parameter].
4044 */ 4141 */
4045 void set exceptionParameter(SimpleIdentifier parameter) { 4142 void set exceptionParameter(SimpleIdentifier parameter) {
4046 _exceptionParameter = becomeParentOf(parameter); 4143 _exceptionParameter = _becomeParentOf(parameter);
4047 } 4144 }
4048 4145
4049 /** 4146 /**
4050 * Return the type of exceptions caught by this catch clause, or `null` if 4147 * Return the type of exceptions caught by this catch clause, or `null` if
4051 * this catch clause catches every type of exception. 4148 * this catch clause catches every type of exception.
4052 */ 4149 */
4053 TypeName get exceptionType => _exceptionType; 4150 TypeName get exceptionType => _exceptionType;
4054 4151
4055 /** 4152 /**
4056 * Set the type of exceptions caught by this catch clause to the given 4153 * Set the type of exceptions caught by this catch clause to the given
4057 * [exceptionType]. 4154 * [exceptionType].
4058 */ 4155 */
4059 void set exceptionType(TypeName exceptionType) { 4156 void set exceptionType(TypeName exceptionType) {
4060 _exceptionType = becomeParentOf(exceptionType); 4157 _exceptionType = _becomeParentOf(exceptionType);
4061 } 4158 }
4062 4159
4063 /** 4160 /**
4064 * Return the parameter whose value will be the stack trace associated with 4161 * Return the parameter whose value will be the stack trace associated with
4065 * the exception, or `null` if there is no stack trace parameter. 4162 * the exception, or `null` if there is no stack trace parameter.
4066 */ 4163 */
4067 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; 4164 SimpleIdentifier get stackTraceParameter => _stackTraceParameter;
4068 4165
4069 /** 4166 /**
4070 * Set the parameter whose value will be the stack trace associated with the 4167 * Set the parameter whose value will be the stack trace associated with the
4071 * exception to the given [parameter]. 4168 * exception to the given [parameter].
4072 */ 4169 */
4073 void set stackTraceParameter(SimpleIdentifier parameter) { 4170 void set stackTraceParameter(SimpleIdentifier parameter) {
4074 _stackTraceParameter = becomeParentOf(parameter); 4171 _stackTraceParameter = _becomeParentOf(parameter);
4075 } 4172 }
4076 4173
4077 @override 4174 @override
4078 accept(AstVisitor visitor) => visitor.visitCatchClause(this); 4175 accept(AstVisitor visitor) => visitor.visitCatchClause(this);
4079 4176
4080 @override 4177 @override
4081 void visitChildren(AstVisitor visitor) { 4178 void visitChildren(AstVisitor visitor) {
4082 _safelyVisitChild(_exceptionType, visitor); 4179 _safelyVisitChild(_exceptionType, visitor);
4083 _safelyVisitChild(_exceptionParameter, visitor); 4180 _safelyVisitChild(_exceptionParameter, visitor);
4084 _safelyVisitChild(_stackTraceParameter, visitor); 4181 _safelyVisitChild(_stackTraceParameter, visitor);
4085 _safelyVisitChild(_body, visitor); 4182 _safelyVisitChild(_body, visitor);
4086 } 4183 }
4087 } 4184 }
4088 4185
4089 /** 4186 /**
4090 * Helper class to allow iteration of child entities of an AST node. 4187 * Helper class to allow iteration of child entities of an AST node.
4091 */ 4188 */
4092 class ChildEntities extends Object with IterableMixin implements Iterable { 4189 class ChildEntities extends Object with IterableMixin implements Iterable {
4190 /**
4191 * The list of child entities to be iterated over.
4192 */
4093 List _entities = []; 4193 List _entities = [];
4094 4194
4095 @override 4195 @override
4096 Iterator get iterator => _entities.iterator; 4196 Iterator get iterator => _entities.iterator;
4097 4197
4098 /** 4198 /**
4099 * Add an AST node or token as the next child entity, if it is not null. 4199 * Add an AST node or token as the next child entity, if it is not null.
4100 */ 4200 */
4101 void add(entity) { 4201 void add(entity) {
4102 if (entity != null) { 4202 if (entity != null) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
4194 * and [implementsClause] can be `null` if the class does not have the 4294 * and [implementsClause] can be `null` if the class does not have the
4195 * corresponding clause. The list of [members] can be `null` if the class does 4295 * corresponding clause. The list of [members] can be `null` if the class does
4196 * not have any members. 4296 * not have any members.
4197 */ 4297 */
4198 ClassDeclaration(Comment comment, List<Annotation> metadata, 4298 ClassDeclaration(Comment comment, List<Annotation> metadata,
4199 this.abstractKeyword, this.classKeyword, SimpleIdentifier name, 4299 this.abstractKeyword, this.classKeyword, SimpleIdentifier name,
4200 TypeParameterList typeParameters, ExtendsClause extendsClause, 4300 TypeParameterList typeParameters, ExtendsClause extendsClause,
4201 WithClause withClause, ImplementsClause implementsClause, this.leftBracket , 4301 WithClause withClause, ImplementsClause implementsClause, this.leftBracket ,
4202 List<ClassMember> members, this.rightBracket) 4302 List<ClassMember> members, this.rightBracket)
4203 : super(comment, metadata) { 4303 : super(comment, metadata) {
4204 _name = becomeParentOf(name); 4304 _name = _becomeParentOf(name);
4205 _typeParameters = becomeParentOf(typeParameters); 4305 _typeParameters = _becomeParentOf(typeParameters);
4206 _extendsClause = becomeParentOf(extendsClause); 4306 _extendsClause = _becomeParentOf(extendsClause);
4207 _withClause = becomeParentOf(withClause); 4307 _withClause = _becomeParentOf(withClause);
4208 _implementsClause = becomeParentOf(implementsClause); 4308 _implementsClause = _becomeParentOf(implementsClause);
4209 _members = new NodeList<ClassMember>(this, members); 4309 _members = new NodeList<ClassMember>(this, members);
4210 } 4310 }
4211 4311
4212 @override 4312 @override
4213 Iterable get childEntities => super._childEntities 4313 Iterable get childEntities => super._childEntities
4214 ..add(abstractKeyword) 4314 ..add(abstractKeyword)
4215 ..add(classKeyword) 4315 ..add(classKeyword)
4216 ..add(_name) 4316 ..add(_name)
4217 ..add(_typeParameters) 4317 ..add(_typeParameters)
4218 ..add(_extendsClause) 4318 ..add(_extendsClause)
(...skipping 14 matching lines...) Expand all
4233 /** 4333 /**
4234 * Return the extends clause for this class, or `null` if the class does not 4334 * Return the extends clause for this class, or `null` if the class does not
4235 * extend any other class. 4335 * extend any other class.
4236 */ 4336 */
4237 ExtendsClause get extendsClause => _extendsClause; 4337 ExtendsClause get extendsClause => _extendsClause;
4238 4338
4239 /** 4339 /**
4240 * Set the extends clause for this class to the given [extendsClause]. 4340 * Set the extends clause for this class to the given [extendsClause].
4241 */ 4341 */
4242 void set extendsClause(ExtendsClause extendsClause) { 4342 void set extendsClause(ExtendsClause extendsClause) {
4243 _extendsClause = becomeParentOf(extendsClause); 4343 _extendsClause = _becomeParentOf(extendsClause);
4244 } 4344 }
4245 4345
4246 @override 4346 @override
4247 Token get firstTokenAfterCommentAndMetadata { 4347 Token get firstTokenAfterCommentAndMetadata {
4248 if (abstractKeyword != null) { 4348 if (abstractKeyword != null) {
4249 return abstractKeyword; 4349 return abstractKeyword;
4250 } 4350 }
4251 return classKeyword; 4351 return classKeyword;
4252 } 4352 }
4253 4353
4254 /** 4354 /**
4255 * Return the implements clause for the class, or `null` if the class does not 4355 * Return the implements clause for the class, or `null` if the class does not
4256 * implement any interfaces. 4356 * implement any interfaces.
4257 */ 4357 */
4258 ImplementsClause get implementsClause => _implementsClause; 4358 ImplementsClause get implementsClause => _implementsClause;
4259 4359
4260 /** 4360 /**
4261 * Set the implements clause for the class to the given [implementsClause]. 4361 * Set the implements clause for the class to the given [implementsClause].
4262 */ 4362 */
4263 void set implementsClause(ImplementsClause implementsClause) { 4363 void set implementsClause(ImplementsClause implementsClause) {
4264 _implementsClause = becomeParentOf(implementsClause); 4364 _implementsClause = _becomeParentOf(implementsClause);
4265 } 4365 }
4266 4366
4267 /** 4367 /**
4268 * Return `true` if this class is declared to be an abstract class. 4368 * Return `true` if this class is declared to be an abstract class.
4269 */ 4369 */
4270 bool get isAbstract => abstractKeyword != null; 4370 bool get isAbstract => abstractKeyword != null;
4271 4371
4272 /** 4372 /**
4273 * Return the members defined by the class. 4373 * Return the members defined by the class.
4274 */ 4374 */
4275 NodeList<ClassMember> get members => _members; 4375 NodeList<ClassMember> get members => _members;
4276 4376
4277 /** 4377 /**
4278 * Return the name of the class being declared. 4378 * Return the name of the class being declared.
4279 */ 4379 */
4280 SimpleIdentifier get name => _name; 4380 SimpleIdentifier get name => _name;
4281 4381
4282 /** 4382 /**
4283 * Set the name of the class being declared to the given [identifier]. 4383 * Set the name of the class being declared to the given [identifier].
4284 */ 4384 */
4285 void set name(SimpleIdentifier identifier) { 4385 void set name(SimpleIdentifier identifier) {
4286 _name = becomeParentOf(identifier); 4386 _name = _becomeParentOf(identifier);
4287 } 4387 }
4288 4388
4289 /** 4389 /**
4290 * Return the native clause for this class, or `null` if the class does not 4390 * Return the native clause for this class, or `null` if the class does not
4291 * have a native clause. 4391 * have a native clause.
4292 */ 4392 */
4293 NativeClause get nativeClause => _nativeClause; 4393 NativeClause get nativeClause => _nativeClause;
4294 4394
4295 /** 4395 /**
4296 * Set the native clause for this class to the given [nativeClause]. 4396 * Set the native clause for this class to the given [nativeClause].
4297 */ 4397 */
4298 void set nativeClause(NativeClause nativeClause) { 4398 void set nativeClause(NativeClause nativeClause) {
4299 _nativeClause = becomeParentOf(nativeClause); 4399 _nativeClause = _becomeParentOf(nativeClause);
4300 } 4400 }
4301 4401
4302 /** 4402 /**
4303 * Return the type parameters for the class, or `null` if the class does not 4403 * Return the type parameters for the class, or `null` if the class does not
4304 * have any type parameters. 4404 * have any type parameters.
4305 */ 4405 */
4306 TypeParameterList get typeParameters => _typeParameters; 4406 TypeParameterList get typeParameters => _typeParameters;
4307 4407
4308 /** 4408 /**
4309 * Set the type parameters for the class to the given list of [typeParameters] . 4409 * Set the type parameters for the class to the given list of [typeParameters] .
4310 */ 4410 */
4311 void set typeParameters(TypeParameterList typeParameters) { 4411 void set typeParameters(TypeParameterList typeParameters) {
4312 _typeParameters = becomeParentOf(typeParameters); 4412 _typeParameters = _becomeParentOf(typeParameters);
4313 } 4413 }
4314 4414
4315 /** 4415 /**
4316 * Return the with clause for the class, or `null` if the class does not have 4416 * Return the with clause for the class, or `null` if the class does not have
4317 * a with clause. 4417 * a with clause.
4318 */ 4418 */
4319 WithClause get withClause => _withClause; 4419 WithClause get withClause => _withClause;
4320 4420
4321 /** 4421 /**
4322 * Set the with clause for the class to the given [withClause]. 4422 * Set the with clause for the class to the given [withClause].
4323 */ 4423 */
4324 void set withClause(WithClause withClause) { 4424 void set withClause(WithClause withClause) {
4325 _withClause = becomeParentOf(withClause); 4425 _withClause = _becomeParentOf(withClause);
4326 } 4426 }
4327 4427
4328 @override 4428 @override
4329 accept(AstVisitor visitor) => visitor.visitClassDeclaration(this); 4429 accept(AstVisitor visitor) => visitor.visitClassDeclaration(this);
4330 4430
4331 /** 4431 /**
4332 * Return the constructor declared in the class with the given [name], or 4432 * Return the constructor declared in the class with the given [name], or
4333 * `null` if there is no such constructor. If the [name] is `null` then the 4433 * `null` if there is no such constructor. If the [name] is `null` then the
4334 * default constructor will be searched for. 4434 * default constructor will be searched for.
4335 */ 4435 */
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
4414 } 4514 }
4415 4515
4416 /** 4516 /**
4417 * A class type alias. 4517 * A class type alias.
4418 * 4518 *
4419 * > classTypeAlias ::= 4519 * > classTypeAlias ::=
4420 * > [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplicatio n 4520 * > [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplicatio n
4421 * > 4521 * >
4422 * > mixinApplication ::= 4522 * > mixinApplication ::=
4423 * > [TypeName] [WithClause] [ImplementsClause]? ';' 4523 * > [TypeName] [WithClause] [ImplementsClause]? ';'
4424 *
4425 * Deprecated: This class captures obsolete syntax that is no longer part of the
4426 * Dart language.
4427 */ 4524 */
4428 class ClassTypeAlias extends TypeAlias { 4525 class ClassTypeAlias extends TypeAlias {
4429 /** 4526 /**
4430 * The name of the class being declared. 4527 * The name of the class being declared.
4431 */ 4528 */
4432 SimpleIdentifier _name; 4529 SimpleIdentifier _name;
4433 4530
4434 /** 4531 /**
4435 * The type parameters for the class, or `null` if the class does not have any 4532 * The type parameters for the class, or `null` if the class does not have any
4436 * type parameters. 4533 * type parameters.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4470 * have the corresponding attribute. The [typeParameters] can be `null` if the 4567 * have the corresponding attribute. The [typeParameters] can be `null` if the
4471 * class does not have any type parameters. The [abstractKeyword] can be 4568 * class does not have any type parameters. The [abstractKeyword] can be
4472 * `null` if the class is not abstract. The [implementsClause] can be `null` 4569 * `null` if the class is not abstract. The [implementsClause] can be `null`
4473 * if the class does not implement any interfaces. 4570 * if the class does not implement any interfaces.
4474 */ 4571 */
4475 ClassTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, 4572 ClassTypeAlias(Comment comment, List<Annotation> metadata, Token keyword,
4476 SimpleIdentifier name, TypeParameterList typeParameters, this.equals, 4573 SimpleIdentifier name, TypeParameterList typeParameters, this.equals,
4477 this.abstractKeyword, TypeName superclass, WithClause withClause, 4574 this.abstractKeyword, TypeName superclass, WithClause withClause,
4478 ImplementsClause implementsClause, Token semicolon) 4575 ImplementsClause implementsClause, Token semicolon)
4479 : super(comment, metadata, keyword, semicolon) { 4576 : super(comment, metadata, keyword, semicolon) {
4480 _name = becomeParentOf(name); 4577 _name = _becomeParentOf(name);
4481 _typeParameters = becomeParentOf(typeParameters); 4578 _typeParameters = _becomeParentOf(typeParameters);
4482 _superclass = becomeParentOf(superclass); 4579 _superclass = _becomeParentOf(superclass);
4483 _withClause = becomeParentOf(withClause); 4580 _withClause = _becomeParentOf(withClause);
4484 _implementsClause = becomeParentOf(implementsClause); 4581 _implementsClause = _becomeParentOf(implementsClause);
4485 } 4582 }
4486 4583
4487 @override 4584 @override
4488 Iterable get childEntities => super._childEntities 4585 Iterable get childEntities => super._childEntities
4489 ..add(keyword) 4586 ..add(typedefKeyword)
4490 ..add(_name) 4587 ..add(_name)
4491 ..add(_typeParameters) 4588 ..add(_typeParameters)
4492 ..add(equals) 4589 ..add(equals)
4493 ..add(abstractKeyword) 4590 ..add(abstractKeyword)
4494 ..add(_superclass) 4591 ..add(_superclass)
4495 ..add(_withClause) 4592 ..add(_withClause)
4496 ..add(_implementsClause) 4593 ..add(_implementsClause)
4497 ..add(semicolon); 4594 ..add(semicolon);
4498 4595
4499 @override 4596 @override
4500 ClassElement get element => 4597 ClassElement get element =>
4501 _name != null ? (_name.staticElement as ClassElement) : null; 4598 _name != null ? (_name.staticElement as ClassElement) : null;
4502 4599
4503 /** 4600 /**
4504 * Return the implements clause for this class, or `null` if there is no 4601 * Return the implements clause for this class, or `null` if there is no
4505 * implements clause. 4602 * implements clause.
4506 */ 4603 */
4507 ImplementsClause get implementsClause => _implementsClause; 4604 ImplementsClause get implementsClause => _implementsClause;
4508 4605
4509 /** 4606 /**
4510 * Set the implements clause for this class to the given [implementsClause]. 4607 * Set the implements clause for this class to the given [implementsClause].
4511 */ 4608 */
4512 void set implementsClause(ImplementsClause implementsClause) { 4609 void set implementsClause(ImplementsClause implementsClause) {
4513 _implementsClause = becomeParentOf(implementsClause); 4610 _implementsClause = _becomeParentOf(implementsClause);
4514 } 4611 }
4515 4612
4516 /** 4613 /**
4517 * Return `true` if this class is declared to be an abstract class. 4614 * Return `true` if this class is declared to be an abstract class.
4518 */ 4615 */
4519 bool get isAbstract => abstractKeyword != null; 4616 bool get isAbstract => abstractKeyword != null;
4520 4617
4521 /** 4618 /**
4522 * Return the name of the class being declared. 4619 * Return the name of the class being declared.
4523 */ 4620 */
4524 SimpleIdentifier get name => _name; 4621 SimpleIdentifier get name => _name;
4525 4622
4526 /** 4623 /**
4527 * Set the name of the class being declared to the given [identifier]. 4624 * Set the name of the class being declared to the given [identifier].
4528 */ 4625 */
4529 void set name(SimpleIdentifier name) { 4626 void set name(SimpleIdentifier name) {
4530 _name = becomeParentOf(name); 4627 _name = _becomeParentOf(name);
4531 } 4628 }
4532 4629
4533 /** 4630 /**
4534 * Return the name of the superclass of the class being declared. 4631 * Return the name of the superclass of the class being declared.
4535 */ 4632 */
4536 TypeName get superclass => _superclass; 4633 TypeName get superclass => _superclass;
4537 4634
4538 /** 4635 /**
4539 * Set the name of the superclass of the class being declared to the given 4636 * Set the name of the superclass of the class being declared to the given
4540 * [superclass] name. 4637 * [superclass] name.
4541 */ 4638 */
4542 void set superclass(TypeName superclass) { 4639 void set superclass(TypeName superclass) {
4543 _superclass = becomeParentOf(superclass); 4640 _superclass = _becomeParentOf(superclass);
4544 } 4641 }
4545 4642
4546 /** 4643 /**
4547 * Return the type parameters for the class, or `null` if the class does not 4644 * Return the type parameters for the class, or `null` if the class does not
4548 * have any type parameters. 4645 * have any type parameters.
4549 */ 4646 */
4550 TypeParameterList get typeParameters => _typeParameters; 4647 TypeParameterList get typeParameters => _typeParameters;
4551 4648
4552 /** 4649 /**
4553 * Set the type parameters for the class to the given list of [typeParameters] . 4650 * Set the type parameters for the class to the given list of [typeParameters] .
4554 */ 4651 */
4555 void set typeParameters(TypeParameterList typeParameters) { 4652 void set typeParameters(TypeParameterList typeParameters) {
4556 _typeParameters = becomeParentOf(typeParameters); 4653 _typeParameters = _becomeParentOf(typeParameters);
4557 } 4654 }
4558 4655
4559 /** 4656 /**
4560 * Return the with clause for this class. 4657 * Return the with clause for this class.
4561 */ 4658 */
4562 WithClause get withClause => _withClause; 4659 WithClause get withClause => _withClause;
4563 4660
4564 /** 4661 /**
4565 * Set the with clause for this class to the given with [withClause]. 4662 * Set the with clause for this class to the given with [withClause].
4566 */ 4663 */
4567 void set withClause(WithClause withClause) { 4664 void set withClause(WithClause withClause) {
4568 _withClause = becomeParentOf(withClause); 4665 _withClause = _becomeParentOf(withClause);
4569 } 4666 }
4570 4667
4571 @override 4668 @override
4572 accept(AstVisitor visitor) => visitor.visitClassTypeAlias(this); 4669 accept(AstVisitor visitor) => visitor.visitClassTypeAlias(this);
4573 4670
4574 @override 4671 @override
4575 void visitChildren(AstVisitor visitor) { 4672 void visitChildren(AstVisitor visitor) {
4576 super.visitChildren(visitor); 4673 super.visitChildren(visitor);
4577 _safelyVisitChild(_name, visitor); 4674 _safelyVisitChild(_name, visitor);
4578 _safelyVisitChild(_typeParameters, visitor); 4675 _safelyVisitChild(_typeParameters, visitor);
4579 _safelyVisitChild(_superclass, visitor); 4676 _safelyVisitChild(_superclass, visitor);
4580 _safelyVisitChild(_withClause, visitor); 4677 _safelyVisitChild(_withClause, visitor);
4581 _safelyVisitChild(_implementsClause, visitor); 4678 _safelyVisitChild(_implementsClause, visitor);
4582 } 4679 }
4583 } 4680 }
4584 4681
4585 /** 4682 /**
4586 * A combinator associated with an import or export directive. 4683 * A combinator associated with an import or export directive.
4587 * 4684 *
4588 * > combinator ::= 4685 * > combinator ::=
4589 * > [HideCombinator] 4686 * > [HideCombinator]
4590 * > | [ShowCombinator] 4687 * > | [ShowCombinator]
4591 */ 4688 */
4592 abstract class Combinator extends AstNode { 4689 abstract class Combinator extends AstNode {
4593 /** 4690 /**
4594 * The keyword specifying what kind of processing is to be done on the 4691 * The 'hide' or 'show' keyword specifying what kind of processing is to be
4595 * imported names. 4692 * done on the names.
4596 */ 4693 */
4597 Token keyword; 4694 Token keyword;
4598 4695
4599 /** 4696 /**
4600 * Initialize a newly created import combinator. 4697 * Initialize a newly created combinator.
4601 */ 4698 */
4602 Combinator(this.keyword); 4699 Combinator(this.keyword);
4603 4700
4604 @override 4701 @override
4605 Token get beginToken => keyword; 4702 Token get beginToken => keyword;
4606 } 4703 }
4607 4704
4608 /** 4705 /**
4609 * A comment within the source code. 4706 * A comment within the source code.
4610 * 4707 *
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4731 /** 4828 /**
4732 * The identifier being referenced. 4829 * The identifier being referenced.
4733 */ 4830 */
4734 Identifier _identifier; 4831 Identifier _identifier;
4735 4832
4736 /** 4833 /**
4737 * Initialize a newly created reference to a Dart element. The [newKeyword] 4834 * Initialize a newly created reference to a Dart element. The [newKeyword]
4738 * can be `null` if the reference is not to a constructor. 4835 * can be `null` if the reference is not to a constructor.
4739 */ 4836 */
4740 CommentReference(this.newKeyword, Identifier identifier) { 4837 CommentReference(this.newKeyword, Identifier identifier) {
4741 _identifier = becomeParentOf(identifier); 4838 _identifier = _becomeParentOf(identifier);
4742 } 4839 }
4743 4840
4744 @override 4841 @override
4745 Token get beginToken => _identifier.beginToken; 4842 Token get beginToken => _identifier.beginToken;
4746 4843
4747 @override 4844 @override
4748 Iterable get childEntities => new ChildEntities() 4845 Iterable get childEntities => new ChildEntities()
4749 ..add(newKeyword) 4846 ..add(newKeyword)
4750 ..add(_identifier); 4847 ..add(_identifier);
4751 4848
4752 @override 4849 @override
4753 Token get endToken => _identifier.endToken; 4850 Token get endToken => _identifier.endToken;
4754 4851
4755 /** 4852 /**
4756 * Return the identifier being referenced. 4853 * Return the identifier being referenced.
4757 */ 4854 */
4758 Identifier get identifier => _identifier; 4855 Identifier get identifier => _identifier;
4759 4856
4760 /** 4857 /**
4761 * Set the identifier being referenced to the given [identifier]. 4858 * Set the identifier being referenced to the given [identifier].
4762 */ 4859 */
4763 void set identifier(Identifier identifier) { 4860 void set identifier(Identifier identifier) {
4764 _identifier = becomeParentOf(identifier); 4861 _identifier = _becomeParentOf(identifier);
4765 } 4862 }
4766 4863
4767 @override 4864 @override
4768 accept(AstVisitor visitor) => visitor.visitCommentReference(this); 4865 accept(AstVisitor visitor) => visitor.visitCommentReference(this);
4769 4866
4770 @override 4867 @override
4771 void visitChildren(AstVisitor visitor) { 4868 void visitChildren(AstVisitor visitor) {
4772 _safelyVisitChild(_identifier, visitor); 4869 _safelyVisitChild(_identifier, visitor);
4773 } 4870 }
4774 } 4871 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4872 /** 4969 /**
4873 * Initialize a newly created compilation unit to have the given directives 4970 * Initialize a newly created compilation unit to have the given directives
4874 * and declarations. The [scriptTag] can be `null` if there is no script tag 4971 * and declarations. The [scriptTag] can be `null` if there is no script tag
4875 * in the compilation unit. The list of [directives] can be `null` if there 4972 * in the compilation unit. The list of [directives] can be `null` if there
4876 * are no directives in the compilation unit. The list of [declarations] can 4973 * are no directives in the compilation unit. The list of [declarations] can
4877 * be `null` if there are no declarations in the compilation unit. 4974 * be `null` if there are no declarations in the compilation unit.
4878 */ 4975 */
4879 CompilationUnit(this.beginToken, ScriptTag scriptTag, 4976 CompilationUnit(this.beginToken, ScriptTag scriptTag,
4880 List<Directive> directives, List<CompilationUnitMember> declarations, 4977 List<Directive> directives, List<CompilationUnitMember> declarations,
4881 this.endToken) { 4978 this.endToken) {
4882 _scriptTag = becomeParentOf(scriptTag); 4979 _scriptTag = _becomeParentOf(scriptTag);
4883 _directives = new NodeList<Directive>(this, directives); 4980 _directives = new NodeList<Directive>(this, directives);
4884 _declarations = new NodeList<CompilationUnitMember>(this, declarations); 4981 _declarations = new NodeList<CompilationUnitMember>(this, declarations);
4885 } 4982 }
4886 4983
4887 @override 4984 @override
4888 Iterable get childEntities { 4985 Iterable get childEntities {
4889 ChildEntities result = new ChildEntities()..add(_scriptTag); 4986 ChildEntities result = new ChildEntities()..add(_scriptTag);
4890 if (_directivesAreBeforeDeclarations()) { 4987 if (_directivesAreBeforeDeclarations) {
4891 result 4988 result
4892 ..addAll(_directives) 4989 ..addAll(_directives)
4893 ..addAll(_declarations); 4990 ..addAll(_declarations);
4894 } else { 4991 } else {
4895 result.addAll(sortedDirectivesAndDeclarations); 4992 result.addAll(sortedDirectivesAndDeclarations);
4896 } 4993 }
4897 return result; 4994 return result;
4898 } 4995 }
4899 4996
4900 /** 4997 /**
(...skipping 22 matching lines...) Expand all
4923 * Return the script tag at the beginning of the compilation unit, or `null` 5020 * Return the script tag at the beginning of the compilation unit, or `null`
4924 * if there is no script tag in this compilation unit. 5021 * if there is no script tag in this compilation unit.
4925 */ 5022 */
4926 ScriptTag get scriptTag => _scriptTag; 5023 ScriptTag get scriptTag => _scriptTag;
4927 5024
4928 /** 5025 /**
4929 * Set the script tag at the beginning of the compilation unit to the given 5026 * Set the script tag at the beginning of the compilation unit to the given
4930 * [scriptTag]. 5027 * [scriptTag].
4931 */ 5028 */
4932 void set scriptTag(ScriptTag scriptTag) { 5029 void set scriptTag(ScriptTag scriptTag) {
4933 _scriptTag = becomeParentOf(scriptTag); 5030 _scriptTag = _becomeParentOf(scriptTag);
4934 } 5031 }
4935 5032
4936 /** 5033 /**
4937 * Return a list containing all of the directives and declarations in this 5034 * Return a list containing all of the directives and declarations in this
4938 * compilation unit, sorted in lexical order. 5035 * compilation unit, sorted in lexical order.
4939 */ 5036 */
4940 List<AstNode> get sortedDirectivesAndDeclarations { 5037 List<AstNode> get sortedDirectivesAndDeclarations {
4941 return <AstNode>[] 5038 return <AstNode>[]
4942 ..addAll(_directives) 5039 ..addAll(_directives)
4943 ..addAll(_declarations) 5040 ..addAll(_declarations)
4944 ..sort(AstNode.LEXICAL_ORDER); 5041 ..sort(AstNode.LEXICAL_ORDER);
4945 } 5042 }
4946 5043
5044 /**
5045 * Return `true` if all of the directives are lexically before any
5046 * declarations.
5047 */
5048 bool get _directivesAreBeforeDeclarations {
5049 if (_directives.isEmpty || _declarations.isEmpty) {
5050 return true;
5051 }
5052 Directive lastDirective = _directives[_directives.length - 1];
5053 CompilationUnitMember firstDeclaration = _declarations[0];
5054 return lastDirective.offset < firstDeclaration.offset;
5055 }
5056
4947 @override 5057 @override
4948 accept(AstVisitor visitor) => visitor.visitCompilationUnit(this); 5058 accept(AstVisitor visitor) => visitor.visitCompilationUnit(this);
4949 5059
4950 @override 5060 @override
4951 void visitChildren(AstVisitor visitor) { 5061 void visitChildren(AstVisitor visitor) {
4952 _safelyVisitChild(_scriptTag, visitor); 5062 _safelyVisitChild(_scriptTag, visitor);
4953 if (_directivesAreBeforeDeclarations()) { 5063 if (_directivesAreBeforeDeclarations) {
4954 _directives.accept(visitor); 5064 _directives.accept(visitor);
4955 _declarations.accept(visitor); 5065 _declarations.accept(visitor);
4956 } else { 5066 } else {
4957 for (AstNode child in sortedDirectivesAndDeclarations) { 5067 for (AstNode child in sortedDirectivesAndDeclarations) {
4958 child.accept(visitor); 5068 child.accept(visitor);
4959 } 5069 }
4960 } 5070 }
4961 } 5071 }
4962
4963 /**
4964 * Return `true` if all of the directives are lexically before any
4965 * declarations.
4966 */
4967 bool _directivesAreBeforeDeclarations() {
4968 if (_directives.isEmpty || _declarations.isEmpty) {
4969 return true;
4970 }
4971 Directive lastDirective = _directives[_directives.length - 1];
4972 CompilationUnitMember firstDeclaration = _declarations[0];
4973 return lastDirective.offset < firstDeclaration.offset;
4974 }
4975 } 5072 }
4976 5073
4977 /** 5074 /**
4978 * A node that declares a name within the scope of a compilation unit. 5075 * A node that declares a name within the scope of a compilation unit.
4979 * 5076 *
4980 * > compilationUnitMember ::= 5077 * > compilationUnitMember ::=
4981 * > [ClassDeclaration] 5078 * > [ClassDeclaration]
4982 * > | [TypeAlias] 5079 * > | [TypeAlias]
4983 * > | [FunctionDeclaration] 5080 * > | [FunctionDeclaration]
4984 * > | [MethodDeclaration] 5081 * > | [MethodDeclaration]
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5025 /** 5122 /**
5026 * The expression that is executed if the condition evaluates to `false`. 5123 * The expression that is executed if the condition evaluates to `false`.
5027 */ 5124 */
5028 Expression _elseExpression; 5125 Expression _elseExpression;
5029 5126
5030 /** 5127 /**
5031 * Initialize a newly created conditional expression. 5128 * Initialize a newly created conditional expression.
5032 */ 5129 */
5033 ConditionalExpression(Expression condition, this.question, 5130 ConditionalExpression(Expression condition, this.question,
5034 Expression thenExpression, this.colon, Expression elseExpression) { 5131 Expression thenExpression, this.colon, Expression elseExpression) {
5035 _condition = becomeParentOf(condition); 5132 _condition = _becomeParentOf(condition);
5036 _thenExpression = becomeParentOf(thenExpression); 5133 _thenExpression = _becomeParentOf(thenExpression);
5037 _elseExpression = becomeParentOf(elseExpression); 5134 _elseExpression = _becomeParentOf(elseExpression);
5038 } 5135 }
5039 5136
5040 @override 5137 @override
5041 Token get beginToken => _condition.beginToken; 5138 Token get beginToken => _condition.beginToken;
5042 5139
5043 /**
5044 * TODO(paulberry): untested.
5045 */
5046 @override 5140 @override
5047 Iterable get childEntities => new ChildEntities() 5141 Iterable get childEntities => new ChildEntities()
5048 ..add(_condition) 5142 ..add(_condition)
5049 ..add(question) 5143 ..add(question)
5050 ..add(_thenExpression) 5144 ..add(_thenExpression)
5051 ..add(colon) 5145 ..add(colon)
5052 ..add(_elseExpression); 5146 ..add(_elseExpression);
5053 5147
5054 /** 5148 /**
5055 * Return the condition used to determine which of the expressions is executed 5149 * Return the condition used to determine which of the expressions is executed
5056 * next. 5150 * next.
5057 */ 5151 */
5058 Expression get condition => _condition; 5152 Expression get condition => _condition;
5059 5153
5060 /** 5154 /**
5061 * Set the condition used to determine which of the expressions is executed 5155 * Set the condition used to determine which of the expressions is executed
5062 * next to the given [expression]. 5156 * next to the given [expression].
5063 */ 5157 */
5064 void set condition(Expression expression) { 5158 void set condition(Expression expression) {
5065 _condition = becomeParentOf(expression); 5159 _condition = _becomeParentOf(expression);
5066 } 5160 }
5067 5161
5068 /** 5162 /**
5069 * Return the expression that is executed if the condition evaluates to 5163 * Return the expression that is executed if the condition evaluates to
5070 * `false`. 5164 * `false`.
5071 */ 5165 */
5072 Expression get elseExpression => _elseExpression; 5166 Expression get elseExpression => _elseExpression;
5073 5167
5074 /** 5168 /**
5075 * Set the expression that is executed if the condition evaluates to `false` 5169 * Set the expression that is executed if the condition evaluates to `false`
5076 * to the given [expression]. 5170 * to the given [expression].
5077 */ 5171 */
5078 void set elseExpression(Expression expression) { 5172 void set elseExpression(Expression expression) {
5079 _elseExpression = becomeParentOf(expression); 5173 _elseExpression = _becomeParentOf(expression);
5080 } 5174 }
5081 5175
5082 @override 5176 @override
5083 Token get endToken => _elseExpression.endToken; 5177 Token get endToken => _elseExpression.endToken;
5084 5178
5085 @override 5179 @override
5086 int get precedence => 3; 5180 int get precedence => 3;
5087 5181
5088 /** 5182 /**
5089 * Return the expression that is executed if the condition evaluates to 5183 * Return the expression that is executed if the condition evaluates to
5090 * `true`. 5184 * `true`.
5091 */ 5185 */
5092 Expression get thenExpression => _thenExpression; 5186 Expression get thenExpression => _thenExpression;
5093 5187
5094 /** 5188 /**
5095 * Set the expression that is executed if the condition evaluates to `true` to 5189 * Set the expression that is executed if the condition evaluates to `true` to
5096 * the given [expression]. 5190 * the given [expression].
5097 */ 5191 */
5098 void set thenExpression(Expression expression) { 5192 void set thenExpression(Expression expression) {
5099 _thenExpression = becomeParentOf(expression); 5193 _thenExpression = _becomeParentOf(expression);
5100 } 5194 }
5101 5195
5102 @override 5196 @override
5103 accept(AstVisitor visitor) => visitor.visitConditionalExpression(this); 5197 accept(AstVisitor visitor) => visitor.visitConditionalExpression(this);
5104 5198
5105 @override 5199 @override
5106 void visitChildren(AstVisitor visitor) { 5200 void visitChildren(AstVisitor visitor) {
5107 _safelyVisitChild(_condition, visitor); 5201 _safelyVisitChild(_condition, visitor);
5108 _safelyVisitChild(_thenExpression, visitor); 5202 _safelyVisitChild(_thenExpression, visitor);
5109 _safelyVisitChild(_elseExpression, visitor); 5203 _safelyVisitChild(_elseExpression, visitor);
5110 } 5204 }
5111 } 5205 }
5112 5206
5113 /** 5207 /**
5114 * An object that can be used to evaluate constant expressions to produce their 5208 * An object that can be used to evaluate constant expressions to produce their
5115 * compile-time value. According to the Dart Language Specification: 5209 * compile-time value. According to the Dart Language Specification:
5116 * <blockquote>A constant expression is one of the following: 5210 * <blockquote>
5211 * A constant expression is one of the following:
5117 * * A literal number. 5212 * * A literal number.
5118 * * A literal boolean. 5213 * * A literal boolean.
5119 * * A literal string where any interpolated expression is a compile-time 5214 * * A literal string where any interpolated expression is a compile-time
5120 * constant that evaluates to a numeric, string or boolean value or to `null`. 5215 * constant that evaluates to a numeric, string or boolean value or to `null`.
5121 * * `null`. 5216 * * `null`.
5122 * * A reference to a static constant variable. 5217 * * A reference to a static constant variable.
5123 * * An identifier expression that denotes a constant variable, a class or a 5218 * * An identifier expression that denotes a constant variable, a class or a
5124 * type parameter. 5219 * type parameter.
5125 * * A constant constructor invocation. 5220 * * A constant constructor invocation.
5126 * * A constant list literal. 5221 * * A constant list literal.
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
5591 * does not redirect to a different constructor. The [body] can be `null` if 5686 * does not redirect to a different constructor. The [body] can be `null` if
5592 * the constructor does not have a body. 5687 * the constructor does not have a body.
5593 */ 5688 */
5594 ConstructorDeclaration(Comment comment, List<Annotation> metadata, 5689 ConstructorDeclaration(Comment comment, List<Annotation> metadata,
5595 this.externalKeyword, this.constKeyword, this.factoryKeyword, 5690 this.externalKeyword, this.constKeyword, this.factoryKeyword,
5596 Identifier returnType, this.period, SimpleIdentifier name, 5691 Identifier returnType, this.period, SimpleIdentifier name,
5597 FormalParameterList parameters, this.separator, 5692 FormalParameterList parameters, this.separator,
5598 List<ConstructorInitializer> initializers, 5693 List<ConstructorInitializer> initializers,
5599 ConstructorName redirectedConstructor, FunctionBody body) 5694 ConstructorName redirectedConstructor, FunctionBody body)
5600 : super(comment, metadata) { 5695 : super(comment, metadata) {
5601 _returnType = becomeParentOf(returnType); 5696 _returnType = _becomeParentOf(returnType);
5602 _name = becomeParentOf(name); 5697 _name = _becomeParentOf(name);
5603 _parameters = becomeParentOf(parameters); 5698 _parameters = _becomeParentOf(parameters);
5604 _initializers = new NodeList<ConstructorInitializer>(this, initializers); 5699 _initializers = new NodeList<ConstructorInitializer>(this, initializers);
5605 _redirectedConstructor = becomeParentOf(redirectedConstructor); 5700 _redirectedConstructor = _becomeParentOf(redirectedConstructor);
5606 _body = becomeParentOf(body); 5701 _body = _becomeParentOf(body);
5607 } 5702 }
5608 5703
5609 /** 5704 /**
5610 * Return the body of the constructor, or `null` if the constructor does not 5705 * Return the body of the constructor, or `null` if the constructor does not
5611 * have a body. 5706 * have a body.
5612 */ 5707 */
5613 FunctionBody get body => _body; 5708 FunctionBody get body => _body;
5614 5709
5615 /** 5710 /**
5616 * Set the body of the constructor to the given [functionBody]. 5711 * Set the body of the constructor to the given [functionBody].
5617 */ 5712 */
5618 void set body(FunctionBody functionBody) { 5713 void set body(FunctionBody functionBody) {
5619 _body = becomeParentOf(functionBody); 5714 _body = _becomeParentOf(functionBody);
5620 } 5715 }
5621 5716
5622 @override 5717 @override
5623 Iterable get childEntities => super._childEntities 5718 Iterable get childEntities => super._childEntities
5624 ..add(externalKeyword) 5719 ..add(externalKeyword)
5625 ..add(constKeyword) 5720 ..add(constKeyword)
5626 ..add(factoryKeyword) 5721 ..add(factoryKeyword)
5627 ..add(_returnType) 5722 ..add(_returnType)
5628 ..add(period) 5723 ..add(period)
5629 ..add(_name) 5724 ..add(_name)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5661 /** 5756 /**
5662 * Return the name of the constructor, or `null` if the constructor being 5757 * Return the name of the constructor, or `null` if the constructor being
5663 * declared is unnamed. 5758 * declared is unnamed.
5664 */ 5759 */
5665 SimpleIdentifier get name => _name; 5760 SimpleIdentifier get name => _name;
5666 5761
5667 /** 5762 /**
5668 * Set the name of the constructor to the given [identifier]. 5763 * Set the name of the constructor to the given [identifier].
5669 */ 5764 */
5670 void set name(SimpleIdentifier identifier) { 5765 void set name(SimpleIdentifier identifier) {
5671 _name = becomeParentOf(identifier); 5766 _name = _becomeParentOf(identifier);
5672 } 5767 }
5673 5768
5674 /** 5769 /**
5675 * Return the parameters associated with the constructor. 5770 * Return the parameters associated with the constructor.
5676 */ 5771 */
5677 FormalParameterList get parameters => _parameters; 5772 FormalParameterList get parameters => _parameters;
5678 5773
5679 /** 5774 /**
5680 * Set the parameters associated with the constructor to the given list of 5775 * Set the parameters associated with the constructor to the given list of
5681 * [parameters]. 5776 * [parameters].
5682 */ 5777 */
5683 void set parameters(FormalParameterList parameters) { 5778 void set parameters(FormalParameterList parameters) {
5684 _parameters = becomeParentOf(parameters); 5779 _parameters = _becomeParentOf(parameters);
5685 } 5780 }
5686 5781
5687 /** 5782 /**
5688 * Return the name of the constructor to which this constructor will be 5783 * Return the name of the constructor to which this constructor will be
5689 * redirected, or `null` if this is not a redirecting factory constructor. 5784 * redirected, or `null` if this is not a redirecting factory constructor.
5690 */ 5785 */
5691 ConstructorName get redirectedConstructor => _redirectedConstructor; 5786 ConstructorName get redirectedConstructor => _redirectedConstructor;
5692 5787
5693 /** 5788 /**
5694 * Set the name of the constructor to which this constructor will be 5789 * Set the name of the constructor to which this constructor will be
5695 * redirected to the given [redirectedConstructor] name. 5790 * redirected to the given [redirectedConstructor] name.
5696 */ 5791 */
5697 void set redirectedConstructor(ConstructorName redirectedConstructor) { 5792 void set redirectedConstructor(ConstructorName redirectedConstructor) {
5698 _redirectedConstructor = becomeParentOf(redirectedConstructor); 5793 _redirectedConstructor = _becomeParentOf(redirectedConstructor);
5699 } 5794 }
5700 5795
5701 /** 5796 /**
5702 * Return the type of object being created. This can be different than the 5797 * Return the type of object being created. This can be different than the
5703 * type in which the constructor is being declared if the constructor is the 5798 * type in which the constructor is being declared if the constructor is the
5704 * implementation of a factory constructor. 5799 * implementation of a factory constructor.
5705 */ 5800 */
5706 Identifier get returnType => _returnType; 5801 Identifier get returnType => _returnType;
5707 5802
5708 /** 5803 /**
5709 * Set the type of object being created to the given [typeName]. 5804 * Set the type of object being created to the given [typeName].
5710 */ 5805 */
5711 void set returnType(Identifier typeName) { 5806 void set returnType(Identifier typeName) {
5712 _returnType = becomeParentOf(typeName); 5807 _returnType = _becomeParentOf(typeName);
5713 } 5808 }
5714 5809
5715 @override 5810 @override
5716 accept(AstVisitor visitor) => visitor.visitConstructorDeclaration(this); 5811 accept(AstVisitor visitor) => visitor.visitConstructorDeclaration(this);
5717 5812
5718 @override 5813 @override
5719 void visitChildren(AstVisitor visitor) { 5814 void visitChildren(AstVisitor visitor) {
5720 super.visitChildren(visitor); 5815 super.visitChildren(visitor);
5721 _safelyVisitChild(_returnType, visitor); 5816 _safelyVisitChild(_returnType, visitor);
5722 _safelyVisitChild(_name, visitor); 5817 _safelyVisitChild(_name, visitor);
5723 _safelyVisitChild(_parameters, visitor); 5818 _safelyVisitChild(_parameters, visitor);
5724 _initializers.accept(visitor); 5819 _initializers.accept(visitor);
5725 _safelyVisitChild(_redirectedConstructor, visitor); 5820 _safelyVisitChild(_redirectedConstructor, visitor);
5726 _safelyVisitChild(_body, visitor); 5821 _safelyVisitChild(_body, visitor);
5727 } 5822 }
5728 } 5823 }
5729 5824
5730 /** 5825 /**
5731 * The initialization of a field within a constructor's initialization list. 5826 * The initialization of a field within a constructor's initialization list.
5732 * 5827 *
5733 * > fieldInitializer ::= 5828 * > fieldInitializer ::=
5734 * > ('this' '.')? [SimpleIdentifier] '=' [Expression] 5829 * > ('this' '.')? [SimpleIdentifier] '=' [Expression]
5735 */ 5830 */
5736 class ConstructorFieldInitializer extends ConstructorInitializer { 5831 class ConstructorFieldInitializer extends ConstructorInitializer {
5737 /** 5832 /**
5738 * The token for the 'this' keyword, or `null` if there is no 'this' keyword. 5833 * The token for the 'this' keyword, or `null` if there is no 'this' keyword.
5739 */ 5834 */
5740 Token keyword; 5835 Token thisKeyword;
5741 5836
5742 /** 5837 /**
5743 * The token for the period after the 'this' keyword, or `null` if there is no 5838 * The token for the period after the 'this' keyword, or `null` if there is no
5744 * 'this' keyword. 5839 * 'this' keyword.
5745 */ 5840 */
5746 Token period; 5841 Token period;
5747 5842
5748 /** 5843 /**
5749 * The name of the field being initialized. 5844 * The name of the field being initialized.
5750 */ 5845 */
5751 SimpleIdentifier _fieldName; 5846 SimpleIdentifier _fieldName;
5752 5847
5753 /** 5848 /**
5754 * The token for the equal sign between the field name and the expression. 5849 * The token for the equal sign between the field name and the expression.
5755 */ 5850 */
5756 Token equals; 5851 Token equals;
5757 5852
5758 /** 5853 /**
5759 * The expression computing the value to which the field will be initialized. 5854 * The expression computing the value to which the field will be initialized.
5760 */ 5855 */
5761 Expression _expression; 5856 Expression _expression;
5762 5857
5763 /** 5858 /**
5764 * Initialize a newly created field initializer to initialize the field with 5859 * Initialize a newly created field initializer to initialize the field with
5765 * the given name to the value of the given expression. The [keyword] and 5860 * the given name to the value of the given expression. The [thisKeyword] and
5766 * [period] can be `null` if the 'this' keyword was not specified. 5861 * [period] can be `null` if the 'this' keyword was not specified.
5767 */ 5862 */
5768 ConstructorFieldInitializer(this.keyword, this.period, 5863 ConstructorFieldInitializer(this.thisKeyword, this.period,
5769 SimpleIdentifier fieldName, this.equals, Expression expression) { 5864 SimpleIdentifier fieldName, this.equals, Expression expression) {
5770 _fieldName = becomeParentOf(fieldName); 5865 _fieldName = _becomeParentOf(fieldName);
5771 _expression = becomeParentOf(expression); 5866 _expression = _becomeParentOf(expression);
5772 } 5867 }
5773 5868
5774 @override 5869 @override
5775 Token get beginToken { 5870 Token get beginToken {
5776 if (keyword != null) { 5871 if (thisKeyword != null) {
5777 return keyword; 5872 return thisKeyword;
5778 } 5873 }
5779 return _fieldName.beginToken; 5874 return _fieldName.beginToken;
5780 } 5875 }
5781 5876
5782 @override 5877 @override
5783 Iterable get childEntities => new ChildEntities() 5878 Iterable get childEntities => new ChildEntities()
5784 ..add(keyword) 5879 ..add(thisKeyword)
5785 ..add(period) 5880 ..add(period)
5786 ..add(_fieldName) 5881 ..add(_fieldName)
5787 ..add(equals) 5882 ..add(equals)
5788 ..add(_expression); 5883 ..add(_expression);
5789 5884
5790 @override 5885 @override
5791 Token get endToken => _expression.endToken; 5886 Token get endToken => _expression.endToken;
5792 5887
5793 /** 5888 /**
5794 * Return the expression computing the value to which the field will be 5889 * Return the expression computing the value to which the field will be
5795 * initialized. 5890 * initialized.
5796 */ 5891 */
5797 Expression get expression => _expression; 5892 Expression get expression => _expression;
5798 5893
5799 /** 5894 /**
5800 * Set the expression computing the value to which the field will be 5895 * Set the expression computing the value to which the field will be
5801 * initialized to the given [expression]. 5896 * initialized to the given [expression].
5802 */ 5897 */
5803 void set expression(Expression expression) { 5898 void set expression(Expression expression) {
5804 _expression = becomeParentOf(expression); 5899 _expression = _becomeParentOf(expression);
5805 } 5900 }
5806 5901
5807 /** 5902 /**
5808 * Return the name of the field being initialized. 5903 * Return the name of the field being initialized.
5809 */ 5904 */
5810 SimpleIdentifier get fieldName => _fieldName; 5905 SimpleIdentifier get fieldName => _fieldName;
5811 5906
5812 /** 5907 /**
5813 * Set the name of the field being initialized to the given [identifier]. 5908 * Set the name of the field being initialized to the given [identifier].
5814 */ 5909 */
5815 void set fieldName(SimpleIdentifier identifier) { 5910 void set fieldName(SimpleIdentifier identifier) {
5816 _fieldName = becomeParentOf(identifier); 5911 _fieldName = _becomeParentOf(identifier);
5912 }
5913
5914 /**
5915 * Return the token for the 'this' keyword, or `null` if there is no 'this'
5916 * keyword.
5917 */
5918 @deprecated // Use "this.thisKeyword"
5919 Token get keyword => thisKeyword;
5920
5921 /**
5922 * Set the token for the 'this' keyword to the given [token].
5923 */
5924 @deprecated // Use "this.thisKeyword"
5925 set keyword(Token token) {
5926 thisKeyword = token;
5817 } 5927 }
5818 5928
5819 @override 5929 @override
5820 accept(AstVisitor visitor) => visitor.visitConstructorFieldInitializer(this); 5930 accept(AstVisitor visitor) => visitor.visitConstructorFieldInitializer(this);
5821 5931
5822 @override 5932 @override
5823 void visitChildren(AstVisitor visitor) { 5933 void visitChildren(AstVisitor visitor) {
5824 _safelyVisitChild(_fieldName, visitor); 5934 _safelyVisitChild(_fieldName, visitor);
5825 _safelyVisitChild(_expression, visitor); 5935 _safelyVisitChild(_expression, visitor);
5826 } 5936 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5865 * information, or `null` if the AST structure has not been resolved or if 5975 * information, or `null` if the AST structure has not been resolved or if
5866 * this constructor name could not be resolved. 5976 * this constructor name could not be resolved.
5867 */ 5977 */
5868 ConstructorElement staticElement; 5978 ConstructorElement staticElement;
5869 5979
5870 /** 5980 /**
5871 * Initialize a newly created constructor name. The [period] and [name] can be 5981 * Initialize a newly created constructor name. The [period] and [name] can be
5872 * `null` if the constructor being named is the unnamed constructor. 5982 * `null` if the constructor being named is the unnamed constructor.
5873 */ 5983 */
5874 ConstructorName(TypeName type, this.period, SimpleIdentifier name) { 5984 ConstructorName(TypeName type, this.period, SimpleIdentifier name) {
5875 _type = becomeParentOf(type); 5985 _type = _becomeParentOf(type);
5876 _name = becomeParentOf(name); 5986 _name = _becomeParentOf(name);
5877 } 5987 }
5878 5988
5879 @override 5989 @override
5880 Token get beginToken => _type.beginToken; 5990 Token get beginToken => _type.beginToken;
5881 5991
5882 @override 5992 @override
5883 Iterable get childEntities => new ChildEntities() 5993 Iterable get childEntities => new ChildEntities()
5884 ..add(_type) 5994 ..add(_type)
5885 ..add(period) 5995 ..add(period)
5886 ..add(_name); 5996 ..add(_name);
5887 5997
5888 @override 5998 @override
5889 Token get endToken { 5999 Token get endToken {
5890 if (_name != null) { 6000 if (_name != null) {
5891 return _name.endToken; 6001 return _name.endToken;
5892 } 6002 }
5893 return _type.endToken; 6003 return _type.endToken;
5894 } 6004 }
5895 6005
5896 /** 6006 /**
5897 * Return the name of the constructor, or `null` if the specified constructor 6007 * Return the name of the constructor, or `null` if the specified constructor
5898 * is the unnamed constructor. 6008 * is the unnamed constructor.
5899 */ 6009 */
5900 SimpleIdentifier get name => _name; 6010 SimpleIdentifier get name => _name;
5901 6011
5902 /** 6012 /**
5903 * Set the name of the constructor to the given [name]. 6013 * Set the name of the constructor to the given [name].
5904 */ 6014 */
5905 void set name(SimpleIdentifier name) { 6015 void set name(SimpleIdentifier name) {
5906 _name = becomeParentOf(name); 6016 _name = _becomeParentOf(name);
5907 } 6017 }
5908 6018
5909 /** 6019 /**
5910 * Return the name of the type defining the constructor. 6020 * Return the name of the type defining the constructor.
5911 */ 6021 */
5912 TypeName get type => _type; 6022 TypeName get type => _type;
5913 6023
5914 /** 6024 /**
5915 * Set the name of the type defining the constructor to the given [type] name. 6025 * Set the name of the type defining the constructor to the given [type] name.
5916 */ 6026 */
5917 void set type(TypeName type) { 6027 void set type(TypeName type) {
5918 _type = becomeParentOf(type); 6028 _type = _becomeParentOf(type);
5919 } 6029 }
5920 6030
5921 @override 6031 @override
5922 accept(AstVisitor visitor) => visitor.visitConstructorName(this); 6032 accept(AstVisitor visitor) => visitor.visitConstructorName(this);
5923 6033
5924 @override 6034 @override
5925 void visitChildren(AstVisitor visitor) { 6035 void visitChildren(AstVisitor visitor) {
5926 _safelyVisitChild(_type, visitor); 6036 _safelyVisitChild(_type, visitor);
5927 _safelyVisitChild(_name, visitor); 6037 _safelyVisitChild(_name, visitor);
5928 } 6038 }
5929 } 6039 }
5930 6040
5931 /** 6041 /**
5932 * A continue statement. 6042 * A continue statement.
5933 * 6043 *
5934 * > continueStatement ::= 6044 * > continueStatement ::=
5935 * > 'continue' [SimpleIdentifier]? ';' 6045 * > 'continue' [SimpleIdentifier]? ';'
5936 */ 6046 */
5937 class ContinueStatement extends Statement { 6047 class ContinueStatement extends Statement {
5938 /** 6048 /**
5939 * The token representing the 'continue' keyword. 6049 * The token representing the 'continue' keyword.
5940 */ 6050 */
5941 Token keyword; 6051 Token continueKeyword;
5942 6052
5943 /** 6053 /**
5944 * The label associated with the statement, or `null` if there is no label. 6054 * The label associated with the statement, or `null` if there is no label.
5945 */ 6055 */
5946 SimpleIdentifier _label; 6056 SimpleIdentifier _label;
5947 6057
5948 /** 6058 /**
5949 * The semicolon terminating the statement. 6059 * The semicolon terminating the statement.
5950 */ 6060 */
5951 Token semicolon; 6061 Token semicolon;
5952 6062
5953 /** 6063 /**
5954 * The AstNode which this continue statement is continuing to. This will be 6064 * The AstNode which this continue statement is continuing to. This will be
5955 * either a Statement (in the case of continuing a loop) or a SwitchMember 6065 * either a Statement (in the case of continuing a loop) or a SwitchMember
5956 * (in the case of continuing from one switch case to another). Null if the 6066 * (in the case of continuing from one switch case to another). Null if the
5957 * AST has not yet been resolved or if the target could not be resolved. 6067 * AST has not yet been resolved or if the target could not be resolved.
5958 * Note that if the source code has errors, the target may be invalid (e.g. 6068 * Note that if the source code has errors, the target may be invalid (e.g.
5959 * the target may be in an enclosing function). 6069 * the target may be in an enclosing function).
5960 */ 6070 */
5961 AstNode target; 6071 AstNode target;
5962 6072
5963 /** 6073 /**
5964 * Initialize a newly created continue statement. The [label] can be `null` if 6074 * Initialize a newly created continue statement. The [label] can be `null` if
5965 * there is no label associated with the statement. 6075 * there is no label associated with the statement.
5966 */ 6076 */
5967 ContinueStatement(this.keyword, SimpleIdentifier label, this.semicolon) { 6077 ContinueStatement(this.continueKeyword, SimpleIdentifier label, this.semicolon ) {
5968 _label = becomeParentOf(label); 6078 _label = _becomeParentOf(label);
5969 } 6079 }
5970 6080
5971 @override 6081 @override
5972 Token get beginToken => keyword; 6082 Token get beginToken => continueKeyword;
5973 6083
5974 /**
5975 * TODO(paulberry): untested.
5976 */
5977 @override 6084 @override
5978 Iterable get childEntities => new ChildEntities() 6085 Iterable get childEntities => new ChildEntities()
5979 ..add(keyword) 6086 ..add(continueKeyword)
5980 ..add(_label) 6087 ..add(_label)
5981 ..add(semicolon); 6088 ..add(semicolon);
5982 6089
5983 @override 6090 @override
5984 Token get endToken => semicolon; 6091 Token get endToken => semicolon;
5985 6092
5986 /** 6093 /**
6094 * Return the token for the 'continue' keyword, or `null` if there is no
6095 * 'continue' keyword.
6096 */
6097 @deprecated // Use "this.continueKeyword"
6098 Token get keyword => continueKeyword;
6099
6100 /**
6101 * Set the token for the 'continue' keyword to the given [token].
6102 */
6103 @deprecated // Use "this.continueKeyword"
6104 set keyword(Token token) {
6105 continueKeyword = token;
6106 }
6107
6108 /**
5987 * Return the label associated with the statement, or `null` if there is no 6109 * Return the label associated with the statement, or `null` if there is no
5988 * label. 6110 * label.
5989 */ 6111 */
5990 SimpleIdentifier get label => _label; 6112 SimpleIdentifier get label => _label;
5991 6113
5992 /** 6114 /**
5993 * Set the label associated with the statement to the given [identifier]. 6115 * Set the label associated with the statement to the given [identifier].
5994 */ 6116 */
5995 void set label(SimpleIdentifier identifier) { 6117 void set label(SimpleIdentifier identifier) {
5996 _label = becomeParentOf(identifier); 6118 _label = _becomeParentOf(identifier);
5997 } 6119 }
5998 6120
5999 @override 6121 @override
6000 accept(AstVisitor visitor) => visitor.visitContinueStatement(this); 6122 accept(AstVisitor visitor) => visitor.visitContinueStatement(this);
6001 6123
6002 @override 6124 @override
6003 void visitChildren(AstVisitor visitor) { 6125 void visitChildren(AstVisitor visitor) {
6004 _safelyVisitChild(_label, visitor); 6126 _safelyVisitChild(_label, visitor);
6005 } 6127 }
6006 } 6128 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
6052 6174
6053 /** 6175 /**
6054 * Initialize a newly created formal parameter. Either or both of the 6176 * Initialize a newly created formal parameter. Either or both of the
6055 * [comment] and [metadata] can be `null` if the declaration does not have the 6177 * [comment] and [metadata] can be `null` if the declaration does not have the
6056 * corresponding attribute. The [keyword] can be `null` if a type name is 6178 * corresponding attribute. The [keyword] can be `null` if a type name is
6057 * given. The [type] must be `null` if the keyword is 'var'. 6179 * given. The [type] must be `null` if the keyword is 'var'.
6058 */ 6180 */
6059 DeclaredIdentifier(Comment comment, List<Annotation> metadata, this.keyword, 6181 DeclaredIdentifier(Comment comment, List<Annotation> metadata, this.keyword,
6060 TypeName type, SimpleIdentifier identifier) 6182 TypeName type, SimpleIdentifier identifier)
6061 : super(comment, metadata) { 6183 : super(comment, metadata) {
6062 _type = becomeParentOf(type); 6184 _type = _becomeParentOf(type);
6063 _identifier = becomeParentOf(identifier); 6185 _identifier = _becomeParentOf(identifier);
6064 } 6186 }
6065 6187
6066 /**
6067 * TODO(paulberry): untested.
6068 */
6069 @override 6188 @override
6070 Iterable get childEntities => super._childEntities 6189 Iterable get childEntities => super._childEntities
6071 ..add(keyword) 6190 ..add(keyword)
6072 ..add(_type) 6191 ..add(_type)
6073 ..add(_identifier); 6192 ..add(_identifier);
6074 6193
6075 @override 6194 @override
6076 LocalVariableElement get element { 6195 LocalVariableElement get element {
6077 if (_identifier == null) { 6196 if (_identifier == null) {
6078 return null; 6197 return null;
(...skipping 16 matching lines...) Expand all
6095 6214
6096 /** 6215 /**
6097 * Return the name of the variable being declared. 6216 * Return the name of the variable being declared.
6098 */ 6217 */
6099 SimpleIdentifier get identifier => _identifier; 6218 SimpleIdentifier get identifier => _identifier;
6100 6219
6101 /** 6220 /**
6102 * Set the name of the variable being declared to the given [identifier]. 6221 * Set the name of the variable being declared to the given [identifier].
6103 */ 6222 */
6104 void set identifier(SimpleIdentifier identifier) { 6223 void set identifier(SimpleIdentifier identifier) {
6105 _identifier = becomeParentOf(identifier); 6224 _identifier = _becomeParentOf(identifier);
6106 } 6225 }
6107 6226
6108 /** 6227 /**
6109 * Return `true` if this variable was declared with the 'const' modifier. 6228 * Return `true` if this variable was declared with the 'const' modifier.
6110 */ 6229 */
6111 bool get isConst => 6230 bool get isConst =>
6112 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. CONST; 6231 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. CONST;
6113 6232
6114 /** 6233 /**
6115 * Return `true` if this variable was declared with the 'final' modifier. 6234 * Return `true` if this variable was declared with the 'final' modifier.
6116 * Variables that are declared with the 'const' modifier will return `false` 6235 * Variables that are declared with the 'const' modifier will return `false`
6117 * even though they are implicitly final. 6236 * even though they are implicitly final.
6118 */ 6237 */
6119 bool get isFinal => 6238 bool get isFinal =>
6120 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. FINAL; 6239 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. FINAL;
6121 6240
6122 /** 6241 /**
6123 * Return the name of the declared type of the parameter, or `null` if the 6242 * Return the name of the declared type of the parameter, or `null` if the
6124 * parameter does not have a declared type. 6243 * parameter does not have a declared type.
6125 */ 6244 */
6126 TypeName get type => _type; 6245 TypeName get type => _type;
6127 6246
6128 /** 6247 /**
6129 * Set the name of the declared type of the parameter to the given [typeName]. 6248 * Set the name of the declared type of the parameter to the given [typeName].
6130 */ 6249 */
6131 void set type(TypeName typeName) { 6250 void set type(TypeName typeName) {
6132 _type = becomeParentOf(typeName); 6251 _type = _becomeParentOf(typeName);
6133 } 6252 }
6134 6253
6135 @override 6254 @override
6136 accept(AstVisitor visitor) => visitor.visitDeclaredIdentifier(this); 6255 accept(AstVisitor visitor) => visitor.visitDeclaredIdentifier(this);
6137 6256
6138 @override 6257 @override
6139 void visitChildren(AstVisitor visitor) { 6258 void visitChildren(AstVisitor visitor) {
6140 super.visitChildren(visitor); 6259 super.visitChildren(visitor);
6141 _safelyVisitChild(_type, visitor); 6260 _safelyVisitChild(_type, visitor);
6142 _safelyVisitChild(_identifier, visitor); 6261 _safelyVisitChild(_identifier, visitor);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
6176 * there is no default value. 6295 * there is no default value.
6177 */ 6296 */
6178 Expression _defaultValue; 6297 Expression _defaultValue;
6179 6298
6180 /** 6299 /**
6181 * Initialize a newly created default formal parameter. The [separator] and 6300 * Initialize a newly created default formal parameter. The [separator] and
6182 * [defaultValue] can be `null` if there is no default value. 6301 * [defaultValue] can be `null` if there is no default value.
6183 */ 6302 */
6184 DefaultFormalParameter(NormalFormalParameter parameter, this.kind, 6303 DefaultFormalParameter(NormalFormalParameter parameter, this.kind,
6185 this.separator, Expression defaultValue) { 6304 this.separator, Expression defaultValue) {
6186 _parameter = becomeParentOf(parameter); 6305 _parameter = _becomeParentOf(parameter);
6187 _defaultValue = becomeParentOf(defaultValue); 6306 _defaultValue = _becomeParentOf(defaultValue);
6188 } 6307 }
6189 6308
6190 @override 6309 @override
6191 Token get beginToken => _parameter.beginToken; 6310 Token get beginToken => _parameter.beginToken;
6192 6311
6193 /**
6194 * TODO(paulberry): untested.
6195 */
6196 @override 6312 @override
6197 Iterable get childEntities => new ChildEntities() 6313 Iterable get childEntities => new ChildEntities()
6198 ..add(_parameter) 6314 ..add(_parameter)
6199 ..add(separator) 6315 ..add(separator)
6200 ..add(_defaultValue); 6316 ..add(_defaultValue);
6201 6317
6202 /** 6318 /**
6203 * Return the expression computing the default value for the parameter, or 6319 * Return the expression computing the default value for the parameter, or
6204 * `null` if there is no default value. 6320 * `null` if there is no default value.
6205 */ 6321 */
6206 Expression get defaultValue => _defaultValue; 6322 Expression get defaultValue => _defaultValue;
6207 6323
6208 /** 6324 /**
6209 * Set the expression computing the default value for the parameter to the 6325 * Set the expression computing the default value for the parameter to the
6210 * given [expression]. 6326 * given [expression].
6211 */ 6327 */
6212 void set defaultValue(Expression expression) { 6328 void set defaultValue(Expression expression) {
6213 _defaultValue = becomeParentOf(expression); 6329 _defaultValue = _becomeParentOf(expression);
6214 } 6330 }
6215 6331
6216 @override 6332 @override
6217 Token get endToken { 6333 Token get endToken {
6218 if (_defaultValue != null) { 6334 if (_defaultValue != null) {
6219 return _defaultValue.endToken; 6335 return _defaultValue.endToken;
6220 } 6336 }
6221 return _parameter.endToken; 6337 return _parameter.endToken;
6222 } 6338 }
6223 6339
6224 @override 6340 @override
6225 SimpleIdentifier get identifier => _parameter.identifier; 6341 SimpleIdentifier get identifier => _parameter.identifier;
6226 6342
6227 @override 6343 @override
6228 bool get isConst => _parameter != null && _parameter.isConst; 6344 bool get isConst => _parameter != null && _parameter.isConst;
6229 6345
6230 @override 6346 @override
6231 bool get isFinal => _parameter != null && _parameter.isFinal; 6347 bool get isFinal => _parameter != null && _parameter.isFinal;
6232 6348
6233 /** 6349 /**
6234 * Return the formal parameter with which the default value is associated. 6350 * Return the formal parameter with which the default value is associated.
6235 */ 6351 */
6236 NormalFormalParameter get parameter => _parameter; 6352 NormalFormalParameter get parameter => _parameter;
6237 6353
6238 /** 6354 /**
6239 * Set the formal parameter with which the default value is associated to the 6355 * Set the formal parameter with which the default value is associated to the
6240 * given [formalParameter]. 6356 * given [formalParameter].
6241 */ 6357 */
6242 void set parameter(NormalFormalParameter formalParameter) { 6358 void set parameter(NormalFormalParameter formalParameter) {
6243 _parameter = becomeParentOf(formalParameter); 6359 _parameter = _becomeParentOf(formalParameter);
6244 } 6360 }
6245 6361
6246 @override 6362 @override
6247 accept(AstVisitor visitor) => visitor.visitDefaultFormalParameter(this); 6363 accept(AstVisitor visitor) => visitor.visitDefaultFormalParameter(this);
6248 6364
6249 @override 6365 @override
6250 void visitChildren(AstVisitor visitor) { 6366 void visitChildren(AstVisitor visitor) {
6251 _safelyVisitChild(_parameter, visitor); 6367 _safelyVisitChild(_parameter, visitor);
6252 _safelyVisitChild(_defaultValue, visitor); 6368 _safelyVisitChild(_defaultValue, visitor);
6253 } 6369 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6357 * The semicolon terminating the statement. 6473 * The semicolon terminating the statement.
6358 */ 6474 */
6359 Token semicolon; 6475 Token semicolon;
6360 6476
6361 /** 6477 /**
6362 * Initialize a newly created do loop. 6478 * Initialize a newly created do loop.
6363 */ 6479 */
6364 DoStatement(this.doKeyword, Statement body, this.whileKeyword, 6480 DoStatement(this.doKeyword, Statement body, this.whileKeyword,
6365 this.leftParenthesis, Expression condition, this.rightParenthesis, 6481 this.leftParenthesis, Expression condition, this.rightParenthesis,
6366 this.semicolon) { 6482 this.semicolon) {
6367 _body = becomeParentOf(body); 6483 _body = _becomeParentOf(body);
6368 _condition = becomeParentOf(condition); 6484 _condition = _becomeParentOf(condition);
6369 } 6485 }
6370 6486
6371 @override 6487 @override
6372 Token get beginToken => doKeyword; 6488 Token get beginToken => doKeyword;
6373 6489
6374 /** 6490 /**
6375 * Return the body of the loop. 6491 * Return the body of the loop.
6376 */ 6492 */
6377 Statement get body => _body; 6493 Statement get body => _body;
6378 6494
6379 /** 6495 /**
6380 * Set the body of the loop to the given [statement]. 6496 * Set the body of the loop to the given [statement].
6381 */ 6497 */
6382 void set body(Statement statement) { 6498 void set body(Statement statement) {
6383 _body = becomeParentOf(statement); 6499 _body = _becomeParentOf(statement);
6384 } 6500 }
6385 6501
6386 @override 6502 @override
6387 Iterable get childEntities => new ChildEntities() 6503 Iterable get childEntities => new ChildEntities()
6388 ..add(doKeyword) 6504 ..add(doKeyword)
6389 ..add(_body) 6505 ..add(_body)
6390 ..add(whileKeyword) 6506 ..add(whileKeyword)
6391 ..add(leftParenthesis) 6507 ..add(leftParenthesis)
6392 ..add(_condition) 6508 ..add(_condition)
6393 ..add(rightParenthesis) 6509 ..add(rightParenthesis)
6394 ..add(semicolon); 6510 ..add(semicolon);
6395 6511
6396 /** 6512 /**
6397 * Return the condition that determines when the loop will terminate. 6513 * Return the condition that determines when the loop will terminate.
6398 */ 6514 */
6399 Expression get condition => _condition; 6515 Expression get condition => _condition;
6400 6516
6401 /** 6517 /**
6402 * Set the condition that determines when the loop will terminate to the given 6518 * Set the condition that determines when the loop will terminate to the given
6403 * [expression]. 6519 * [expression].
6404 */ 6520 */
6405 void set condition(Expression expression) { 6521 void set condition(Expression expression) {
6406 _condition = becomeParentOf(expression); 6522 _condition = _becomeParentOf(expression);
6407 } 6523 }
6408 6524
6409 @override 6525 @override
6410 Token get endToken => semicolon; 6526 Token get endToken => semicolon;
6411 6527
6412 @override 6528 @override
6413 accept(AstVisitor visitor) => visitor.visitDoStatement(this); 6529 accept(AstVisitor visitor) => visitor.visitDoStatement(this);
6414 6530
6415 @override 6531 @override
6416 void visitChildren(AstVisitor visitor) { 6532 void visitChildren(AstVisitor visitor) {
(...skipping 14 matching lines...) Expand all
6431 */ 6547 */
6432 class DoubleLiteral extends Literal { 6548 class DoubleLiteral extends Literal {
6433 /** 6549 /**
6434 * The token representing the literal. 6550 * The token representing the literal.
6435 */ 6551 */
6436 Token literal; 6552 Token literal;
6437 6553
6438 /** 6554 /**
6439 * The value of the literal. 6555 * The value of the literal.
6440 */ 6556 */
6441 double value = 0.0; 6557 double value;
6442 6558
6443 /** 6559 /**
6444 * Initialize a newly created floating point literal. 6560 * Initialize a newly created floating point literal.
6445 */ 6561 */
6446 DoubleLiteral(this.literal, this.value); 6562 DoubleLiteral(this.literal, this.value);
6447 6563
6448 @override 6564 @override
6449 Token get beginToken => literal; 6565 Token get beginToken => literal;
6450 6566
6451 /**
6452 * TODO(paulberry): untested.
6453 */
6454 @override 6567 @override
6455 Iterable get childEntities => new ChildEntities()..add(literal); 6568 Iterable get childEntities => new ChildEntities()..add(literal);
6456 6569
6457 @override 6570 @override
6458 Token get endToken => literal; 6571 Token get endToken => literal;
6459 6572
6460 @override 6573 @override
6461 accept(AstVisitor visitor) => visitor.visitDoubleLiteral(this); 6574 accept(AstVisitor visitor) => visitor.visitDoubleLiteral(this);
6462 6575
6463 @override 6576 @override
6464 void visitChildren(AstVisitor visitor) { 6577 void visitChildren(AstVisitor visitor) {
6465 // There are no children to visit. 6578 // There are no children to visit.
6466 } 6579 }
6467 } 6580 }
6468 6581
6469 /** 6582 /**
6470 * An object used to locate the [Element] associated with a given [AstNode]. 6583 * An object used to locate the [Element] associated with a given [AstNode].
6471 */ 6584 */
6472 class ElementLocator { 6585 class ElementLocator {
6473 /** 6586 /**
6474 * Return the element associated with the given [node], or `null` if there is 6587 * Return the element associated with the given [node], or `null` if there is
6475 * no element associated with the node. 6588 * no element associated with the node.
6476 */ 6589 */
6477 static Element locate(AstNode node) { 6590 static Element locate(AstNode node) {
6591 if (node == null) {
6592 return null;
6593 }
6478 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); 6594 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper();
6479 return node.accept(mapper); 6595 return node.accept(mapper);
6480 } 6596 }
6481 6597
6482 /** 6598 /**
6483 * Return the element associated with the given [node], or `null` if there is 6599 * Return the element associated with the given [node], or `null` if there is
6484 * no element associated with the node. 6600 * no element associated with the node.
6485 */ 6601 */
6486 static Element locateWithOffset(AstNode node, int offset) { 6602 static Element locateWithOffset(AstNode node, int offset) {
6603 // TODO(brianwilkerson) 'offset' is not used. Figure out what's going on:
6604 // whether there's a bug or whether this method is unnecessary.
6487 if (node == null) { 6605 if (node == null) {
6488 return null; 6606 return null;
6489 } 6607 }
6490 // try to get Element from node 6608 // try to get Element from node
6491 Element nodeElement = locate(node); 6609 Element nodeElement = locate(node);
6492 if (nodeElement != null) { 6610 if (nodeElement != null) {
6493 return nodeElement; 6611 return nodeElement;
6494 } 6612 }
6495 // no Element 6613 // no Element
6496 return null; 6614 return null;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
6620 Token semicolon; 6738 Token semicolon;
6621 6739
6622 /** 6740 /**
6623 * Initialize a newly created function body. 6741 * Initialize a newly created function body.
6624 */ 6742 */
6625 EmptyFunctionBody(this.semicolon); 6743 EmptyFunctionBody(this.semicolon);
6626 6744
6627 @override 6745 @override
6628 Token get beginToken => semicolon; 6746 Token get beginToken => semicolon;
6629 6747
6630 /**
6631 * TODO(paulberry): untested.
6632 */
6633 @override 6748 @override
6634 Iterable get childEntities => new ChildEntities()..add(semicolon); 6749 Iterable get childEntities => new ChildEntities()..add(semicolon);
6635 6750
6636 @override 6751 @override
6637 Token get endToken => semicolon; 6752 Token get endToken => semicolon;
6638 6753
6639 @override 6754 @override
6640 accept(AstVisitor visitor) => visitor.visitEmptyFunctionBody(this); 6755 accept(AstVisitor visitor) => visitor.visitEmptyFunctionBody(this);
6641 6756
6642 @override 6757 @override
(...skipping 15 matching lines...) Expand all
6658 Token semicolon; 6773 Token semicolon;
6659 6774
6660 /** 6775 /**
6661 * Initialize a newly created empty statement. 6776 * Initialize a newly created empty statement.
6662 */ 6777 */
6663 EmptyStatement(this.semicolon); 6778 EmptyStatement(this.semicolon);
6664 6779
6665 @override 6780 @override
6666 Token get beginToken => semicolon; 6781 Token get beginToken => semicolon;
6667 6782
6668 /**
6669 * TODO(paulberry): untested.
6670 */
6671 @override 6783 @override
6672 Iterable get childEntities => new ChildEntities()..add(semicolon); 6784 Iterable get childEntities => new ChildEntities()..add(semicolon);
6673 6785
6674 @override 6786 @override
6675 Token get endToken => semicolon; 6787 Token get endToken => semicolon;
6676 6788
6677 @override 6789 @override
6678 accept(AstVisitor visitor) => visitor.visitEmptyStatement(this); 6790 accept(AstVisitor visitor) => visitor.visitEmptyStatement(this);
6679 6791
6680 @override 6792 @override
(...skipping 13 matching lines...) Expand all
6694 6806
6695 /** 6807 /**
6696 * Initialize a newly created enum constant declaration. Either or both of the 6808 * Initialize a newly created enum constant declaration. Either or both of the
6697 * [comment] and [metadata] can be `null` if the constant does not have the 6809 * [comment] and [metadata] can be `null` if the constant does not have the
6698 * corresponding attribute. (Technically, enum constants cannot have metadata, 6810 * corresponding attribute. (Technically, enum constants cannot have metadata,
6699 * but we allow it for consistency.) 6811 * but we allow it for consistency.)
6700 */ 6812 */
6701 EnumConstantDeclaration(Comment comment, List<Annotation> metadata, 6813 EnumConstantDeclaration(Comment comment, List<Annotation> metadata,
6702 SimpleIdentifier name) 6814 SimpleIdentifier name)
6703 : super(comment, metadata) { 6815 : super(comment, metadata) {
6704 _name = becomeParentOf(name); 6816 _name = _becomeParentOf(name);
6705 } 6817 }
6706 6818
6707 /**
6708 * TODO(paulberry): untested.
6709 */
6710 @override 6819 @override
6711 Iterable get childEntities => super._childEntities..add(_name); 6820 Iterable get childEntities => super._childEntities..add(_name);
6712 6821
6713 @override 6822 @override
6714 FieldElement get element => 6823 FieldElement get element =>
6715 _name == null ? null : (_name.staticElement as FieldElement); 6824 _name == null ? null : (_name.staticElement as FieldElement);
6716 6825
6717 @override 6826 @override
6718 Token get endToken => _name.endToken; 6827 Token get endToken => _name.endToken;
6719 6828
6720 @override 6829 @override
6721 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; 6830 Token get firstTokenAfterCommentAndMetadata => _name.beginToken;
6722 6831
6723 /** 6832 /**
6724 * Return the name of the constant. 6833 * Return the name of the constant.
6725 */ 6834 */
6726 SimpleIdentifier get name => _name; 6835 SimpleIdentifier get name => _name;
6727 6836
6728 /** 6837 /**
6729 * Set the name of the constant to the given [name]. 6838 * Set the name of the constant to the given [name].
6730 */ 6839 */
6731 void set name(SimpleIdentifier name) { 6840 void set name(SimpleIdentifier name) {
6732 _name = becomeParentOf(name); 6841 _name = _becomeParentOf(name);
6733 } 6842 }
6734 6843
6735 @override 6844 @override
6736 accept(AstVisitor visitor) => visitor.visitEnumConstantDeclaration(this); 6845 accept(AstVisitor visitor) => visitor.visitEnumConstantDeclaration(this);
6737 6846
6738 @override 6847 @override
6739 void visitChildren(AstVisitor visitor) { 6848 void visitChildren(AstVisitor visitor) {
6740 super.visitChildren(visitor); 6849 super.visitChildren(visitor);
6741 _safelyVisitChild(_name, visitor); 6850 _safelyVisitChild(_name, visitor);
6742 } 6851 }
6743 } 6852 }
6744 6853
6745 /** 6854 /**
6746 * The declaration of an enumeration. 6855 * The declaration of an enumeration.
6747 * 6856 *
6748 * > enumType ::= 6857 * > enumType ::=
6749 * > metadata 'enum' [SimpleIdentifier] '{' [SimpleIdentifier] (',' [SimpleI dentifier])* (',')? '}' 6858 * > metadata 'enum' [SimpleIdentifier] '{' [SimpleIdentifier] (',' [SimpleI dentifier])* (',')? '}'
6750 */ 6859 */
6751 class EnumDeclaration extends CompilationUnitMember { 6860 class EnumDeclaration extends CompilationUnitMember {
6752 /** 6861 /**
6753 * The 'enum' keyword. 6862 * The 'enum' keyword.
6754 */ 6863 */
6755 Token keyword; 6864 Token enumKeyword;
6756 6865
6757 /** 6866 /**
6758 * The name of the enumeration. 6867 * The name of the enumeration.
6759 */ 6868 */
6760 SimpleIdentifier _name; 6869 SimpleIdentifier _name;
6761 6870
6762 /** 6871 /**
6763 * The left curly bracket. 6872 * The left curly bracket.
6764 */ 6873 */
6765 Token leftBracket; 6874 Token leftBracket;
6766 6875
6767 /** 6876 /**
6768 * The enumeration constants being declared. 6877 * The enumeration constants being declared.
6769 */ 6878 */
6770 NodeList<EnumConstantDeclaration> _constants; 6879 NodeList<EnumConstantDeclaration> _constants;
6771 6880
6772 /** 6881 /**
6773 * The right curly bracket. 6882 * The right curly bracket.
6774 */ 6883 */
6775 Token rightBracket; 6884 Token rightBracket;
6776 6885
6777 /** 6886 /**
6778 * Initialize a newly created enumeration declaration. Either or both of the 6887 * Initialize a newly created enumeration declaration. Either or both of the
6779 * [comment] and [metadata] can be `null` if the declaration does not have the 6888 * [comment] and [metadata] can be `null` if the declaration does not have the
6780 * corresponding attribute. The list of [constants] must contain at least one 6889 * corresponding attribute. The list of [constants] must contain at least one
6781 * value. 6890 * value.
6782 */ 6891 */
6783 EnumDeclaration(Comment comment, List<Annotation> metadata, this.keyword, 6892 EnumDeclaration(Comment comment, List<Annotation> metadata, this.enumKeyword,
6784 SimpleIdentifier name, this.leftBracket, 6893 SimpleIdentifier name, this.leftBracket,
6785 List<EnumConstantDeclaration> constants, this.rightBracket) 6894 List<EnumConstantDeclaration> constants, this.rightBracket)
6786 : super(comment, metadata) { 6895 : super(comment, metadata) {
6787 _name = becomeParentOf(name); 6896 _name = _becomeParentOf(name);
6788 _constants = new NodeList<EnumConstantDeclaration>(this, constants); 6897 _constants = new NodeList<EnumConstantDeclaration>(this, constants);
6789 } 6898 }
6790 6899
6791 /**
6792 * TODO(paulberry): untested.
6793 */
6794 @override 6900 @override
6901 // TODO(brianwilkerson) Add commas?
6795 Iterable get childEntities => super._childEntities 6902 Iterable get childEntities => super._childEntities
6796 ..add(keyword) 6903 ..add(enumKeyword)
6797 ..add(_name) 6904 ..add(_name)
6798 ..add(leftBracket) 6905 ..add(leftBracket)
6799 ..addAll(_constants) 6906 ..addAll(_constants)
6800 ..add(rightBracket); 6907 ..add(rightBracket);
6801 6908
6802 /** 6909 /**
6803 * Return the enumeration constants being declared. 6910 * Return the enumeration constants being declared.
6804 */ 6911 */
6805 NodeList<EnumConstantDeclaration> get constants => _constants; 6912 NodeList<EnumConstantDeclaration> get constants => _constants;
6806 6913
6807 @override 6914 @override
6808 ClassElement get element => 6915 ClassElement get element =>
6809 _name != null ? (_name.staticElement as ClassElement) : null; 6916 _name != null ? (_name.staticElement as ClassElement) : null;
6810 6917
6811 @override 6918 @override
6812 Token get endToken => rightBracket; 6919 Token get endToken => rightBracket;
6813 6920
6814 @override 6921 @override
6815 Token get firstTokenAfterCommentAndMetadata => keyword; 6922 Token get firstTokenAfterCommentAndMetadata => enumKeyword;
6923
6924 /**
6925 * Return the token for the 'enum' keyword, or `null` if there is no
6926 * 'enum' keyword.
6927 */
6928 @deprecated // Use "this.enumKeyword"
6929 Token get keyword => enumKeyword;
6930
6931 /**
6932 * Set the token for the 'enum' keyword to the given [token].
6933 */
6934 @deprecated // Use "this.enumKeyword"
6935 set keyword(Token token) {
6936 enumKeyword = token;
6937 }
6816 6938
6817 /** 6939 /**
6818 * Return the name of the enumeration. 6940 * Return the name of the enumeration.
6819 */ 6941 */
6820 SimpleIdentifier get name => _name; 6942 SimpleIdentifier get name => _name;
6821 6943
6822 /** 6944 /**
6823 * Set the name of the enumeration to the given [name]. 6945 * Set the name of the enumeration to the given [name].
6824 */ 6946 */
6825 void set name(SimpleIdentifier name) { 6947 void set name(SimpleIdentifier name) {
6826 _name = becomeParentOf(name); 6948 _name = _becomeParentOf(name);
6827 } 6949 }
6828 6950
6829 @override 6951 @override
6830 accept(AstVisitor visitor) => visitor.visitEnumDeclaration(this); 6952 accept(AstVisitor visitor) => visitor.visitEnumDeclaration(this);
6831 6953
6832 @override 6954 @override
6833 void visitChildren(AstVisitor visitor) { 6955 void visitChildren(AstVisitor visitor) {
6834 super.visitChildren(visitor); 6956 super.visitChildren(visitor);
6835 _safelyVisitChild(_name, visitor); 6957 _safelyVisitChild(_name, visitor);
6836 _constants.accept(visitor); 6958 _constants.accept(visitor);
6837 } 6959 }
6838 } 6960 }
6839 6961
6840 /** 6962 /**
6841 * Ephemeral identifiers are created as needed to mimic the presence of an empty 6963 * Ephemeral identifiers are created as needed to mimic the presence of an empty
6842 * identifier. 6964 * identifier.
6843 */ 6965 */
6844 class EphemeralIdentifier extends SimpleIdentifier { 6966 class EphemeralIdentifier extends SimpleIdentifier {
6845 EphemeralIdentifier(AstNode parent, int location) 6967 EphemeralIdentifier(AstNode parent, int location)
6846 : super(new StringToken(TokenType.IDENTIFIER, "", location)) { 6968 : super(new StringToken(TokenType.IDENTIFIER, "", location)) {
6847 parent.becomeParentOf(this); 6969 parent._becomeParentOf(this);
6848 } 6970 }
6849 } 6971 }
6850 6972
6851 /** 6973 /**
6852 * An export directive. 6974 * An export directive.
6853 * 6975 *
6854 * > exportDirective ::= 6976 * > exportDirective ::=
6855 * > [Annotation] 'export' [StringLiteral] [Combinator]* ';' 6977 * > [Annotation] 'export' [StringLiteral] [Combinator]* ';'
6856 */ 6978 */
6857 class ExportDirective extends NamespaceDirective { 6979 class ExportDirective extends NamespaceDirective {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6897 * 7019 *
6898 * > expression ::= 7020 * > expression ::=
6899 * > [AssignmentExpression] 7021 * > [AssignmentExpression]
6900 * > | [ConditionalExpression] cascadeSection* 7022 * > | [ConditionalExpression] cascadeSection*
6901 * > | [ThrowExpression] 7023 * > | [ThrowExpression]
6902 */ 7024 */
6903 abstract class Expression extends AstNode { 7025 abstract class Expression extends AstNode {
6904 /** 7026 /**
6905 * An empty list of expressions. 7027 * An empty list of expressions.
6906 */ 7028 */
6907 static const List<Expression> EMPTY_ARRAY = const <Expression>[]; 7029 @deprecated // Use "Expression.EMPTY_LIST"
7030 static const List<Expression> EMPTY_ARRAY = EMPTY_LIST;
7031
7032 /**
7033 * An empty list of expressions.
7034 */
7035 static const List<Expression> EMPTY_LIST = const <Expression>[];
6908 7036
6909 /** 7037 /**
6910 * The static type of this expression, or `null` if the AST structure has not 7038 * The static type of this expression, or `null` if the AST structure has not
6911 * been resolved. 7039 * been resolved.
6912 */ 7040 */
6913 DartType staticType; 7041 DartType staticType;
6914 7042
6915 /** 7043 /**
6916 * The propagated type of this expression, or `null` if type propagation has 7044 * The propagated type of this expression, or `null` if type propagation has
6917 * not been performed on the AST structure. 7045 * not been performed on the AST structure.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
6970 * If this expression is an argument to an invocation, and the AST structure 7098 * If this expression is an argument to an invocation, and the AST structure
6971 * has been resolved, and the function being invoked is known based on 7099 * has been resolved, and the function being invoked is known based on
6972 * propagated type information, and this expression corresponds to one of the 7100 * propagated type information, and this expression corresponds to one of the
6973 * parameters of the function being invoked, then return the parameter element 7101 * parameters of the function being invoked, then return the parameter element
6974 * representing the parameter to which the value of this expression will be 7102 * representing the parameter to which the value of this expression will be
6975 * bound. Otherwise, return `null`. 7103 * bound. Otherwise, return `null`.
6976 */ 7104 */
6977 ParameterElement get propagatedParameterElement { 7105 ParameterElement get propagatedParameterElement {
6978 AstNode parent = this.parent; 7106 AstNode parent = this.parent;
6979 if (parent is ArgumentList) { 7107 if (parent is ArgumentList) {
6980 return parent.getPropagatedParameterElementFor(this); 7108 return parent._getPropagatedParameterElementFor(this);
6981 } else if (parent is IndexExpression) { 7109 } else if (parent is IndexExpression) {
6982 IndexExpression indexExpression = parent; 7110 IndexExpression indexExpression = parent;
6983 if (identical(indexExpression.index, this)) { 7111 if (identical(indexExpression.index, this)) {
6984 return indexExpression.propagatedParameterElementForIndex; 7112 return indexExpression._propagatedParameterElementForIndex;
6985 } 7113 }
6986 } else if (parent is BinaryExpression) { 7114 } else if (parent is BinaryExpression) {
6987 BinaryExpression binaryExpression = parent; 7115 BinaryExpression binaryExpression = parent;
6988 if (identical(binaryExpression.rightOperand, this)) { 7116 if (identical(binaryExpression.rightOperand, this)) {
6989 return binaryExpression.propagatedParameterElementForRightOperand; 7117 return binaryExpression._propagatedParameterElementForRightOperand;
6990 } 7118 }
6991 } else if (parent is AssignmentExpression) { 7119 } else if (parent is AssignmentExpression) {
6992 AssignmentExpression assignmentExpression = parent; 7120 AssignmentExpression assignmentExpression = parent;
6993 if (identical(assignmentExpression.rightHandSide, this)) { 7121 if (identical(assignmentExpression.rightHandSide, this)) {
6994 return assignmentExpression.propagatedParameterElementForRightHandSide; 7122 return assignmentExpression._propagatedParameterElementForRightHandSide;
6995 } 7123 }
6996 } else if (parent is PrefixExpression) { 7124 } else if (parent is PrefixExpression) {
6997 return parent.propagatedParameterElementForOperand; 7125 return parent._propagatedParameterElementForOperand;
6998 } else if (parent is PostfixExpression) { 7126 } else if (parent is PostfixExpression) {
6999 return parent.propagatedParameterElementForOperand; 7127 return parent._propagatedParameterElementForOperand;
7000 } 7128 }
7001 return null; 7129 return null;
7002 } 7130 }
7003 7131
7004 /** 7132 /**
7005 * If this expression is an argument to an invocation, and the AST structure 7133 * If this expression is an argument to an invocation, and the AST structure
7006 * has been resolved, and the function being invoked is known based on static 7134 * has been resolved, and the function being invoked is known based on static
7007 * type information, and this expression corresponds to one of the parameters 7135 * type information, and this expression corresponds to one of the parameters
7008 * of the function being invoked, then return the parameter element 7136 * of the function being invoked, then return the parameter element
7009 * representing the parameter to which the value of this expression will be 7137 * representing the parameter to which the value of this expression will be
7010 * bound. Otherwise, return `null`. 7138 * bound. Otherwise, return `null`.
7011 */ 7139 */
7012 ParameterElement get staticParameterElement { 7140 ParameterElement get staticParameterElement {
7013 AstNode parent = this.parent; 7141 AstNode parent = this.parent;
7014 if (parent is ArgumentList) { 7142 if (parent is ArgumentList) {
7015 return parent.getStaticParameterElementFor(this); 7143 return parent._getStaticParameterElementFor(this);
7016 } else if (parent is IndexExpression) { 7144 } else if (parent is IndexExpression) {
7017 IndexExpression indexExpression = parent; 7145 IndexExpression indexExpression = parent;
7018 if (identical(indexExpression.index, this)) { 7146 if (identical(indexExpression.index, this)) {
7019 return indexExpression.staticParameterElementForIndex; 7147 return indexExpression._staticParameterElementForIndex;
7020 } 7148 }
7021 } else if (parent is BinaryExpression) { 7149 } else if (parent is BinaryExpression) {
7022 BinaryExpression binaryExpression = parent; 7150 BinaryExpression binaryExpression = parent;
7023 if (identical(binaryExpression.rightOperand, this)) { 7151 if (identical(binaryExpression.rightOperand, this)) {
7024 return binaryExpression.staticParameterElementForRightOperand; 7152 return binaryExpression._staticParameterElementForRightOperand;
7025 } 7153 }
7026 } else if (parent is AssignmentExpression) { 7154 } else if (parent is AssignmentExpression) {
7027 AssignmentExpression assignmentExpression = parent; 7155 AssignmentExpression assignmentExpression = parent;
7028 if (identical(assignmentExpression.rightHandSide, this)) { 7156 if (identical(assignmentExpression.rightHandSide, this)) {
7029 return assignmentExpression.staticParameterElementForRightHandSide; 7157 return assignmentExpression._staticParameterElementForRightHandSide;
7030 } 7158 }
7031 } else if (parent is PrefixExpression) { 7159 } else if (parent is PrefixExpression) {
7032 return parent.staticParameterElementForOperand; 7160 return parent._staticParameterElementForOperand;
7033 } else if (parent is PostfixExpression) { 7161 } else if (parent is PostfixExpression) {
7034 return parent.staticParameterElementForOperand; 7162 return parent._staticParameterElementForOperand;
7035 } 7163 }
7036 return null; 7164 return null;
7037 } 7165 }
7038 } 7166 }
7039 7167
7040 /** 7168 /**
7041 * A function body consisting of a single expression. 7169 * A function body consisting of a single expression.
7042 * 7170 *
7043 * > expressionFunctionBody ::= 7171 * > expressionFunctionBody ::=
7044 * > 'async'? '=>' [Expression] ';' 7172 * > 'async'? '=>' [Expression] ';'
(...skipping 21 matching lines...) Expand all
7066 */ 7194 */
7067 Token semicolon; 7195 Token semicolon;
7068 7196
7069 /** 7197 /**
7070 * Initialize a newly created function body consisting of a block of 7198 * Initialize a newly created function body consisting of a block of
7071 * statements. The [keyword] can be `null` if the function body is not an 7199 * statements. The [keyword] can be `null` if the function body is not an
7072 * async function body. 7200 * async function body.
7073 */ 7201 */
7074 ExpressionFunctionBody(this.keyword, this.functionDefinition, 7202 ExpressionFunctionBody(this.keyword, this.functionDefinition,
7075 Expression expression, this.semicolon) { 7203 Expression expression, this.semicolon) {
7076 _expression = becomeParentOf(expression); 7204 _expression = _becomeParentOf(expression);
7077 } 7205 }
7078 7206
7079 @override 7207 @override
7080 Token get beginToken => functionDefinition; 7208 Token get beginToken {
7209 if (keyword != null) {
7210 return keyword;
7211 }
7212 return functionDefinition;
7213 }
7081 7214
7082 @override 7215 @override
7083 Iterable get childEntities => new ChildEntities() 7216 Iterable get childEntities => new ChildEntities()
7084 ..add(keyword) 7217 ..add(keyword)
7085 ..add(functionDefinition) 7218 ..add(functionDefinition)
7086 ..add(_expression) 7219 ..add(_expression)
7087 ..add(semicolon); 7220 ..add(semicolon);
7088 7221
7089 @override 7222 @override
7090 Token get endToken { 7223 Token get endToken {
7091 if (semicolon != null) { 7224 if (semicolon != null) {
7092 return semicolon; 7225 return semicolon;
7093 } 7226 }
7094 return _expression.endToken; 7227 return _expression.endToken;
7095 } 7228 }
7096 7229
7097 /** 7230 /**
7098 * Return the expression representing the body of the function. 7231 * Return the expression representing the body of the function.
7099 */ 7232 */
7100 Expression get expression => _expression; 7233 Expression get expression => _expression;
7101 7234
7102 /** 7235 /**
7103 * Set the expression representing the body of the function to the given 7236 * Set the expression representing the body of the function to the given
7104 * [expression]. 7237 * [expression].
7105 */ 7238 */
7106 void set expression(Expression expression) { 7239 void set expression(Expression expression) {
7107 _expression = becomeParentOf(expression); 7240 _expression = _becomeParentOf(expression);
7108 } 7241 }
7109 7242
7110 @override 7243 @override
7111 bool get isAsynchronous => keyword != null; 7244 bool get isAsynchronous => keyword != null;
7112 7245
7113 @override 7246 @override
7114 bool get isSynchronous => keyword == null; 7247 bool get isSynchronous => keyword == null;
7115 7248
7116 @override 7249 @override
7117 accept(AstVisitor visitor) => visitor.visitExpressionFunctionBody(this); 7250 accept(AstVisitor visitor) => visitor.visitExpressionFunctionBody(this);
(...skipping 19 matching lines...) Expand all
7137 /** 7270 /**
7138 * The semicolon terminating the statement, or `null` if the expression is a 7271 * The semicolon terminating the statement, or `null` if the expression is a
7139 * function expression and therefore isn't followed by a semicolon. 7272 * function expression and therefore isn't followed by a semicolon.
7140 */ 7273 */
7141 Token semicolon; 7274 Token semicolon;
7142 7275
7143 /** 7276 /**
7144 * Initialize a newly created expression statement. 7277 * Initialize a newly created expression statement.
7145 */ 7278 */
7146 ExpressionStatement(Expression expression, this.semicolon) { 7279 ExpressionStatement(Expression expression, this.semicolon) {
7147 _expression = becomeParentOf(expression); 7280 _expression = _becomeParentOf(expression);
7148 } 7281 }
7149 7282
7150 @override 7283 @override
7151 Token get beginToken => _expression.beginToken; 7284 Token get beginToken => _expression.beginToken;
7152 7285
7153 @override 7286 @override
7154 Iterable get childEntities => new ChildEntities() 7287 Iterable get childEntities => new ChildEntities()
7155 ..add(_expression) 7288 ..add(_expression)
7156 ..add(semicolon); 7289 ..add(semicolon);
7157 7290
7158 @override 7291 @override
7159 Token get endToken { 7292 Token get endToken {
7160 if (semicolon != null) { 7293 if (semicolon != null) {
7161 return semicolon; 7294 return semicolon;
7162 } 7295 }
7163 return _expression.endToken; 7296 return _expression.endToken;
7164 } 7297 }
7165 7298
7166 /** 7299 /**
7167 * Return the expression that comprises the statement. 7300 * Return the expression that comprises the statement.
7168 */ 7301 */
7169 Expression get expression => _expression; 7302 Expression get expression => _expression;
7170 7303
7171 /** 7304 /**
7172 * Set the expression that comprises the statement to the given [expression]. 7305 * Set the expression that comprises the statement to the given [expression].
7173 */ 7306 */
7174 void set expression(Expression expression) { 7307 void set expression(Expression expression) {
7175 _expression = becomeParentOf(expression); 7308 _expression = _becomeParentOf(expression);
7176 } 7309 }
7177 7310
7178 @override 7311 @override
7179 bool get isSynthetic => _expression.isSynthetic && semicolon.isSynthetic; 7312 bool get isSynthetic => _expression.isSynthetic && semicolon.isSynthetic;
7180 7313
7181 @override 7314 @override
7182 accept(AstVisitor visitor) => visitor.visitExpressionStatement(this); 7315 accept(AstVisitor visitor) => visitor.visitExpressionStatement(this);
7183 7316
7184 @override 7317 @override
7185 void visitChildren(AstVisitor visitor) { 7318 void visitChildren(AstVisitor visitor) {
7186 _safelyVisitChild(_expression, visitor); 7319 _safelyVisitChild(_expression, visitor);
7187 } 7320 }
7188 } 7321 }
7189 7322
7190 /** 7323 /**
7191 * The "extends" clause in a class declaration. 7324 * The "extends" clause in a class declaration.
7192 * 7325 *
7193 * > extendsClause ::= 7326 * > extendsClause ::=
7194 * > 'extends' [TypeName] 7327 * > 'extends' [TypeName]
7195 */ 7328 */
7196 class ExtendsClause extends AstNode { 7329 class ExtendsClause extends AstNode {
7197 /** 7330 /**
7198 * The token representing the 'extends' keyword. 7331 * The token representing the 'extends' keyword.
7199 */ 7332 */
7200 Token keyword; 7333 Token extendsKeyword;
7201 7334
7202 /** 7335 /**
7203 * The name of the class that is being extended. 7336 * The name of the class that is being extended.
7204 */ 7337 */
7205 TypeName _superclass; 7338 TypeName _superclass;
7206 7339
7207 /** 7340 /**
7208 * Initialize a newly created extends clause. 7341 * Initialize a newly created extends clause.
7209 */ 7342 */
7210 ExtendsClause(this.keyword, TypeName superclass) { 7343 ExtendsClause(this.extendsKeyword, TypeName superclass) {
7211 _superclass = becomeParentOf(superclass); 7344 _superclass = _becomeParentOf(superclass);
7212 } 7345 }
7213 7346
7214 @override 7347 @override
7215 Token get beginToken => keyword; 7348 Token get beginToken => extendsKeyword;
7216 7349
7217 @override 7350 @override
7218 Iterable get childEntities => new ChildEntities() 7351 Iterable get childEntities => new ChildEntities()
7219 ..add(keyword) 7352 ..add(extendsKeyword)
7220 ..add(_superclass); 7353 ..add(_superclass);
7221 7354
7222 @override 7355 @override
7223 Token get endToken => _superclass.endToken; 7356 Token get endToken => _superclass.endToken;
7224 7357
7225 /** 7358 /**
7359 * Return the token for the 'extends' keyword.
7360 */
7361 @deprecated // Use "this.extendsKeyword"
7362 Token get keyword => extendsKeyword;
7363
7364 /**
7365 * Set the token for the 'extends' keyword to the given [token].
7366 */
7367 @deprecated // Use "this.extendsKeyword"
7368 set keyword(Token token) {
7369 extendsKeyword = token;
7370 }
7371
7372 /**
7226 * Return the name of the class that is being extended. 7373 * Return the name of the class that is being extended.
7227 */ 7374 */
7228 TypeName get superclass => _superclass; 7375 TypeName get superclass => _superclass;
7229 7376
7230 /** 7377 /**
7231 * Set the name of the class that is being extended to the given [name]. 7378 * Set the name of the class that is being extended to the given [name].
7232 */ 7379 */
7233 void set superclass(TypeName name) { 7380 void set superclass(TypeName name) {
7234 _superclass = becomeParentOf(name); 7381 _superclass = _becomeParentOf(name);
7235 } 7382 }
7236 7383
7237 @override 7384 @override
7238 accept(AstVisitor visitor) => visitor.visitExtendsClause(this); 7385 accept(AstVisitor visitor) => visitor.visitExtendsClause(this);
7239 7386
7240 @override 7387 @override
7241 void visitChildren(AstVisitor visitor) { 7388 void visitChildren(AstVisitor visitor) {
7242 _safelyVisitChild(_superclass, visitor); 7389 _safelyVisitChild(_superclass, visitor);
7243 } 7390 }
7244 } 7391 }
(...skipping 23 matching lines...) Expand all
7268 7415
7269 /** 7416 /**
7270 * Initialize a newly created field declaration. Either or both of the 7417 * Initialize a newly created field declaration. Either or both of the
7271 * [comment] and [metadata] can be `null` if the declaration does not have the 7418 * [comment] and [metadata] can be `null` if the declaration does not have the
7272 * corresponding attribute. The [staticKeyword] can be `null` if the field is 7419 * corresponding attribute. The [staticKeyword] can be `null` if the field is
7273 * not a static field. 7420 * not a static field.
7274 */ 7421 */
7275 FieldDeclaration(Comment comment, List<Annotation> metadata, 7422 FieldDeclaration(Comment comment, List<Annotation> metadata,
7276 this.staticKeyword, VariableDeclarationList fieldList, this.semicolon) 7423 this.staticKeyword, VariableDeclarationList fieldList, this.semicolon)
7277 : super(comment, metadata) { 7424 : super(comment, metadata) {
7278 _fieldList = becomeParentOf(fieldList); 7425 _fieldList = _becomeParentOf(fieldList);
7279 } 7426 }
7280 7427
7281 @override 7428 @override
7282 Iterable get childEntities => super._childEntities 7429 Iterable get childEntities => super._childEntities
7283 ..add(staticKeyword) 7430 ..add(staticKeyword)
7284 ..add(_fieldList) 7431 ..add(_fieldList)
7285 ..add(semicolon); 7432 ..add(semicolon);
7286 7433
7287 @override 7434 @override
7288 Element get element => null; 7435 Element get element => null;
7289 7436
7290 @override 7437 @override
7291 Token get endToken => semicolon; 7438 Token get endToken => semicolon;
7292 7439
7293 /** 7440 /**
7294 * Return the fields being declared. 7441 * Return the fields being declared.
7295 */ 7442 */
7296 VariableDeclarationList get fields => _fieldList; 7443 VariableDeclarationList get fields => _fieldList;
7297 7444
7298 /** 7445 /**
7299 * Set the fields being declared to the given list of [fields]. 7446 * Set the fields being declared to the given list of [fields].
7300 */ 7447 */
7301 void set fields(VariableDeclarationList fields) { 7448 void set fields(VariableDeclarationList fields) {
7302 _fieldList = becomeParentOf(fields); 7449 _fieldList = _becomeParentOf(fields);
7303 } 7450 }
7304 7451
7305 @override 7452 @override
7306 Token get firstTokenAfterCommentAndMetadata { 7453 Token get firstTokenAfterCommentAndMetadata {
7307 if (staticKeyword != null) { 7454 if (staticKeyword != null) {
7308 return staticKeyword; 7455 return staticKeyword;
7309 } 7456 }
7310 return _fieldList.beginToken; 7457 return _fieldList.beginToken;
7311 } 7458 }
7312 7459
(...skipping 28 matching lines...) Expand all
7341 7488
7342 /** 7489 /**
7343 * The name of the declared type of the parameter, or `null` if the parameter 7490 * The name of the declared type of the parameter, or `null` if the parameter
7344 * does not have a declared type. 7491 * does not have a declared type.
7345 */ 7492 */
7346 TypeName _type; 7493 TypeName _type;
7347 7494
7348 /** 7495 /**
7349 * The token representing the 'this' keyword. 7496 * The token representing the 'this' keyword.
7350 */ 7497 */
7351 Token thisToken; 7498 Token thisKeyword;
7352 7499
7353 /** 7500 /**
7354 * The token representing the period. 7501 * The token representing the period.
7355 */ 7502 */
7356 Token period; 7503 Token period;
7357 7504
7358 /** 7505 /**
7359 * The parameters of the function-typed parameter, or `null` if this is not a 7506 * The parameters of the function-typed parameter, or `null` if this is not a
7360 * function-typed field formal parameter. 7507 * function-typed field formal parameter.
7361 */ 7508 */
7362 FormalParameterList _parameters; 7509 FormalParameterList _parameters;
7363 7510
7364 /** 7511 /**
7365 * Initialize a newly created formal parameter. Either or both of the 7512 * Initialize a newly created formal parameter. Either or both of the
7366 * [comment] and [metadata] can be `null` if the parameter does not have the 7513 * [comment] and [metadata] can be `null` if the parameter does not have the
7367 * corresponding attribute. The [keyword] can be `null` if there is a type. 7514 * corresponding attribute. The [keyword] can be `null` if there is a type.
7368 * The [type] must be `null` if the keyword is 'var'. The [thisToken] and 7515 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
7369 * [period] can be `null` if the keyword 'this' was not provided. The 7516 * [period] can be `null` if the keyword 'this' was not provided. The
7370 * [parameters] can be `null` if this is not a function-typed field formal 7517 * [parameters] can be `null` if this is not a function-typed field formal
7371 * parameter. 7518 * parameter.
7372 */ 7519 */
7373 FieldFormalParameter(Comment comment, List<Annotation> metadata, this.keyword, 7520 FieldFormalParameter(Comment comment, List<Annotation> metadata, this.keyword,
7374 TypeName type, this.thisToken, this.period, SimpleIdentifier identifier, 7521 TypeName type, this.thisKeyword, this.period, SimpleIdentifier identifier,
7375 FormalParameterList parameters) 7522 FormalParameterList parameters)
7376 : super(comment, metadata, identifier) { 7523 : super(comment, metadata, identifier) {
7377 _type = becomeParentOf(type); 7524 _type = _becomeParentOf(type);
7378 _parameters = becomeParentOf(parameters); 7525 _parameters = _becomeParentOf(parameters);
7379 } 7526 }
7380 7527
7381 @override 7528 @override
7382 Token get beginToken { 7529 Token get beginToken {
7383 if (keyword != null) { 7530 if (keyword != null) {
7384 return keyword; 7531 return keyword;
7385 } else if (_type != null) { 7532 } else if (_type != null) {
7386 return _type.beginToken; 7533 return _type.beginToken;
7387 } 7534 }
7388 return thisToken; 7535 return thisKeyword;
7389 } 7536 }
7390 7537
7391 @override 7538 @override
7392 Iterable get childEntities => super._childEntities 7539 Iterable get childEntities => super._childEntities
7393 ..add(keyword) 7540 ..add(keyword)
7394 ..add(_type) 7541 ..add(_type)
7395 ..add(thisToken) 7542 ..add(thisKeyword)
7396 ..add(period) 7543 ..add(period)
7397 ..add(identifier) 7544 ..add(identifier)
7398 ..add(_parameters); 7545 ..add(_parameters);
7399 7546
7400 @override 7547 @override
7401 Token get endToken { 7548 Token get endToken {
7402 if (_parameters != null) { 7549 if (_parameters != null) {
7403 return _parameters.endToken; 7550 return _parameters.endToken;
7404 } 7551 }
7405 return identifier.endToken; 7552 return identifier.endToken;
(...skipping 11 matching lines...) Expand all
7417 * Return the parameters of the function-typed parameter, or `null` if this is 7564 * Return the parameters of the function-typed parameter, or `null` if this is
7418 * not a function-typed field formal parameter. 7565 * not a function-typed field formal parameter.
7419 */ 7566 */
7420 FormalParameterList get parameters => _parameters; 7567 FormalParameterList get parameters => _parameters;
7421 7568
7422 /** 7569 /**
7423 * Set the parameters of the function-typed parameter to the given 7570 * Set the parameters of the function-typed parameter to the given
7424 * [parameters]. 7571 * [parameters].
7425 */ 7572 */
7426 void set parameters(FormalParameterList parameters) { 7573 void set parameters(FormalParameterList parameters) {
7427 _parameters = becomeParentOf(parameters); 7574 _parameters = _becomeParentOf(parameters);
7428 } 7575 }
7429 7576
7430 /** 7577 /**
7578 * Return the token representing the 'this' keyword.
7579 */
7580 @deprecated // Use "this.thisKeyword"
7581 Token get thisToken => thisKeyword;
7582
7583 /**
7584 * Set the token representing the 'this' keyword to the given [token].
7585 */
7586 @deprecated // Use "this.thisKeyword"
7587 set thisToken(Token token) {
7588 thisKeyword = token;
7589 }
7590
7591 /**
7431 * Return the name of the declared type of the parameter, or `null` if the 7592 * Return the name of the declared type of the parameter, or `null` if the
7432 * parameter does not have a declared type. Note that if this is a 7593 * parameter does not have a declared type. Note that if this is a
7433 * function-typed field formal parameter this is the return type of the 7594 * function-typed field formal parameter this is the return type of the
7434 * function. 7595 * function.
7435 */ 7596 */
7436 TypeName get type => _type; 7597 TypeName get type => _type;
7437 7598
7438 /** 7599 /**
7439 * Set the name of the declared type of the parameter to the given [typeName]. 7600 * Set the name of the declared type of the parameter to the given [typeName].
7440 */ 7601 */
7441 void set type(TypeName typeName) { 7602 void set type(TypeName typeName) {
7442 _type = becomeParentOf(typeName); 7603 _type = _becomeParentOf(typeName);
7443 } 7604 }
7444 7605
7445 @override 7606 @override
7446 accept(AstVisitor visitor) => visitor.visitFieldFormalParameter(this); 7607 accept(AstVisitor visitor) => visitor.visitFieldFormalParameter(this);
7447 7608
7448 @override 7609 @override
7449 void visitChildren(AstVisitor visitor) { 7610 void visitChildren(AstVisitor visitor) {
7450 super.visitChildren(visitor); 7611 super.visitChildren(visitor);
7451 _safelyVisitChild(_type, visitor); 7612 _safelyVisitChild(_type, visitor);
7452 _safelyVisitChild(identifier, visitor); 7613 _safelyVisitChild(identifier, visitor);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
7509 */ 7670 */
7510 Statement _body; 7671 Statement _body;
7511 7672
7512 /** 7673 /**
7513 * Initialize a newly created for-each statement. The [awaitKeyword] can be 7674 * Initialize a newly created for-each statement. The [awaitKeyword] can be
7514 * `null` if this is not an asynchronous for loop. 7675 * `null` if this is not an asynchronous for loop.
7515 */ 7676 */
7516 ForEachStatement.con1(this.awaitKeyword, this.forKeyword, 7677 ForEachStatement.con1(this.awaitKeyword, this.forKeyword,
7517 this.leftParenthesis, DeclaredIdentifier loopVariable, this.inKeyword, 7678 this.leftParenthesis, DeclaredIdentifier loopVariable, this.inKeyword,
7518 Expression iterator, this.rightParenthesis, Statement body) { 7679 Expression iterator, this.rightParenthesis, Statement body) {
7519 _loopVariable = becomeParentOf(loopVariable); 7680 _loopVariable = _becomeParentOf(loopVariable);
7520 _iterable = becomeParentOf(iterator); 7681 _iterable = _becomeParentOf(iterator);
7521 _body = becomeParentOf(body); 7682 _body = _becomeParentOf(body);
7522 } 7683 }
7523 7684
7524 /** 7685 /**
7525 * Initialize a newly created for-each statement. The [awaitKeyword] can be 7686 * Initialize a newly created for-each statement. The [awaitKeyword] can be
7526 * `null` if this is not an asynchronous for loop. 7687 * `null` if this is not an asynchronous for loop.
7527 */ 7688 */
7528 ForEachStatement.con2(this.awaitKeyword, this.forKeyword, 7689 ForEachStatement.con2(this.awaitKeyword, this.forKeyword,
7529 this.leftParenthesis, SimpleIdentifier identifier, this.inKeyword, 7690 this.leftParenthesis, SimpleIdentifier identifier, this.inKeyword,
7530 Expression iterator, this.rightParenthesis, Statement body) { 7691 Expression iterator, this.rightParenthesis, Statement body) {
7531 _identifier = becomeParentOf(identifier); 7692 _identifier = _becomeParentOf(identifier);
7532 _iterable = becomeParentOf(iterator); 7693 _iterable = _becomeParentOf(iterator);
7533 _body = becomeParentOf(body); 7694 _body = _becomeParentOf(body);
7534 } 7695 }
7535 7696
7536 @override 7697 @override
7537 Token get beginToken => forKeyword; 7698 Token get beginToken => forKeyword;
7538 7699
7539 /** 7700 /**
7540 * Return the body of the loop. 7701 * Return the body of the loop.
7541 */ 7702 */
7542 Statement get body => _body; 7703 Statement get body => _body;
7543 7704
7544 /** 7705 /**
7545 * Set the body of the loop to the given [statement]. 7706 * Set the body of the loop to the given [statement].
7546 */ 7707 */
7547 void set body(Statement statement) { 7708 void set body(Statement statement) {
7548 _body = becomeParentOf(statement); 7709 _body = _becomeParentOf(statement);
7549 } 7710 }
7550 7711
7551 @override 7712 @override
7552 Iterable get childEntities => new ChildEntities() 7713 Iterable get childEntities => new ChildEntities()
7553 ..add(awaitKeyword) 7714 ..add(awaitKeyword)
7554 ..add(forKeyword) 7715 ..add(forKeyword)
7555 ..add(leftParenthesis) 7716 ..add(leftParenthesis)
7556 ..add(_loopVariable) 7717 ..add(_loopVariable)
7557 ..add(_identifier) 7718 ..add(_identifier)
7558 ..add(inKeyword) 7719 ..add(inKeyword)
7559 ..add(_iterable) 7720 ..add(_iterable)
7560 ..add(rightParenthesis) 7721 ..add(rightParenthesis)
7561 ..add(_body); 7722 ..add(_body);
7562 7723
7563 @override 7724 @override
7564 Token get endToken => _body.endToken; 7725 Token get endToken => _body.endToken;
7565 7726
7566 /** 7727 /**
7567 * Return the loop variable, or `null` if the loop variable is declared in the 7728 * Return the loop variable, or `null` if the loop variable is declared in the
7568 * 'for'. 7729 * 'for'.
7569 */ 7730 */
7570 SimpleIdentifier get identifier => _identifier; 7731 SimpleIdentifier get identifier => _identifier;
7571 7732
7572 /** 7733 /**
7573 * Set the loop variable to the given [identifier]. 7734 * Set the loop variable to the given [identifier].
7574 */ 7735 */
7575 void set identifier(SimpleIdentifier identifier) { 7736 void set identifier(SimpleIdentifier identifier) {
7576 _identifier = becomeParentOf(identifier); 7737 _identifier = _becomeParentOf(identifier);
7577 } 7738 }
7578 7739
7579 /** 7740 /**
7580 * Return the expression evaluated to produce the iterator. 7741 * Return the expression evaluated to produce the iterator.
7581 */ 7742 */
7582 Expression get iterable => _iterable; 7743 Expression get iterable => _iterable;
7583 7744
7584 /** 7745 /**
7585 * Set the expression evaluated to produce the iterator to the given 7746 * Set the expression evaluated to produce the iterator to the given
7586 * [expression]. 7747 * [expression].
7587 */ 7748 */
7588 void set iterable(Expression expression) { 7749 void set iterable(Expression expression) {
7589 _iterable = becomeParentOf(expression); 7750 _iterable = _becomeParentOf(expression);
7590 } 7751 }
7591 7752
7592 /** 7753 /**
7593 * Return the expression evaluated to produce the iterator. 7754 * Return the expression evaluated to produce the iterator.
7594 *
7595 * Deprecated, use [iterable] instead.
7596 */ 7755 */
7597 @deprecated 7756 @deprecated // Use "this.iterable"
7598 Expression get iterator => iterable; 7757 Expression get iterator => iterable;
7599 7758
7600 /** 7759 /**
7601 * Return the declaration of the loop variable, or `null` if the loop variable 7760 * Return the declaration of the loop variable, or `null` if the loop variable
7602 * is a simple identifier. 7761 * is a simple identifier.
7603 */ 7762 */
7604 DeclaredIdentifier get loopVariable => _loopVariable; 7763 DeclaredIdentifier get loopVariable => _loopVariable;
7605 7764
7606 /** 7765 /**
7607 * Set the declaration of the loop variable to the given [variable]. 7766 * Set the declaration of the loop variable to the given [variable].
7608 */ 7767 */
7609 void set loopVariable(DeclaredIdentifier variable) { 7768 void set loopVariable(DeclaredIdentifier variable) {
7610 _loopVariable = becomeParentOf(variable); 7769 _loopVariable = _becomeParentOf(variable);
7611 } 7770 }
7612 7771
7613 @override 7772 @override
7614 accept(AstVisitor visitor) => visitor.visitForEachStatement(this); 7773 accept(AstVisitor visitor) => visitor.visitForEachStatement(this);
7615 7774
7616 @override 7775 @override
7617 void visitChildren(AstVisitor visitor) { 7776 void visitChildren(AstVisitor visitor) {
7618 _safelyVisitChild(_loopVariable, visitor); 7777 _safelyVisitChild(_loopVariable, visitor);
7619 _safelyVisitChild(_identifier, visitor); 7778 _safelyVisitChild(_identifier, visitor);
7620 _safelyVisitChild(_iterable, visitor); 7779 _safelyVisitChild(_iterable, visitor);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
7704 */ 7863 */
7705 NodeList<FormalParameter> _parameters; 7864 NodeList<FormalParameter> _parameters;
7706 7865
7707 /** 7866 /**
7708 * The left square bracket ('[') or left curly brace ('{') introducing the 7867 * The left square bracket ('[') or left curly brace ('{') introducing the
7709 * optional parameters, or `null` if there are no optional parameters. 7868 * optional parameters, or `null` if there are no optional parameters.
7710 */ 7869 */
7711 Token leftDelimiter; 7870 Token leftDelimiter;
7712 7871
7713 /** 7872 /**
7714 * The right square bracket (']') or right curly brace ('}') introducing the 7873 * The right square bracket (']') or right curly brace ('}') terminating the
7715 * optional parameters, or `null` if there are no optional parameters. 7874 * optional parameters, or `null` if there are no optional parameters.
7716 */ 7875 */
7717 Token rightDelimiter; 7876 Token rightDelimiter;
7718 7877
7719 /** 7878 /**
7720 * The right parenthesis. 7879 * The right parenthesis.
7721 */ 7880 */
7722 Token rightParenthesis; 7881 Token rightParenthesis;
7723 7882
7724 /** 7883 /**
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
7854 /** 8013 /**
7855 * Initialize a newly created for statement. Either the [variableList] or the 8014 * Initialize a newly created for statement. Either the [variableList] or the
7856 * [initialization] must be `null`. Either the [condition] and the list of 8015 * [initialization] must be `null`. Either the [condition] and the list of
7857 * [updaters] can be `null` if the loop does not have the corresponding 8016 * [updaters] can be `null` if the loop does not have the corresponding
7858 * attribute. 8017 * attribute.
7859 */ 8018 */
7860 ForStatement(this.forKeyword, this.leftParenthesis, 8019 ForStatement(this.forKeyword, this.leftParenthesis,
7861 VariableDeclarationList variableList, Expression initialization, 8020 VariableDeclarationList variableList, Expression initialization,
7862 this.leftSeparator, Expression condition, this.rightSeparator, 8021 this.leftSeparator, Expression condition, this.rightSeparator,
7863 List<Expression> updaters, this.rightParenthesis, Statement body) { 8022 List<Expression> updaters, this.rightParenthesis, Statement body) {
7864 _variableList = becomeParentOf(variableList); 8023 _variableList = _becomeParentOf(variableList);
7865 _initialization = becomeParentOf(initialization); 8024 _initialization = _becomeParentOf(initialization);
7866 _condition = becomeParentOf(condition); 8025 _condition = _becomeParentOf(condition);
7867 _updaters = new NodeList<Expression>(this, updaters); 8026 _updaters = new NodeList<Expression>(this, updaters);
7868 _body = becomeParentOf(body); 8027 _body = _becomeParentOf(body);
7869 } 8028 }
7870 8029
7871 @override 8030 @override
7872 Token get beginToken => forKeyword; 8031 Token get beginToken => forKeyword;
7873 8032
7874 /** 8033 /**
7875 * Return the body of the loop. 8034 * Return the body of the loop.
7876 */ 8035 */
7877 Statement get body => _body; 8036 Statement get body => _body;
7878 8037
7879 /** 8038 /**
7880 * Set the body of the loop to the given [statement]. 8039 * Set the body of the loop to the given [statement].
7881 */ 8040 */
7882 void set body(Statement statement) { 8041 void set body(Statement statement) {
7883 _body = becomeParentOf(statement); 8042 _body = _becomeParentOf(statement);
7884 } 8043 }
7885 8044
7886 @override 8045 @override
7887 Iterable get childEntities => new ChildEntities() 8046 Iterable get childEntities => new ChildEntities()
7888 ..add(forKeyword) 8047 ..add(forKeyword)
7889 ..add(leftParenthesis) 8048 ..add(leftParenthesis)
7890 ..add(_variableList) 8049 ..add(_variableList)
7891 ..add(_initialization) 8050 ..add(_initialization)
7892 ..add(leftSeparator) 8051 ..add(leftSeparator)
7893 ..add(_condition) 8052 ..add(_condition)
7894 ..add(rightSeparator) 8053 ..add(rightSeparator)
7895 ..addAll(_updaters) 8054 ..addAll(_updaters)
7896 ..add(rightParenthesis) 8055 ..add(rightParenthesis)
7897 ..add(_body); 8056 ..add(_body);
7898 8057
7899 /** 8058 /**
7900 * Return the condition used to determine when to terminate the loop, or 8059 * Return the condition used to determine when to terminate the loop, or
7901 * `null` if there is no condition. 8060 * `null` if there is no condition.
7902 */ 8061 */
7903 Expression get condition => _condition; 8062 Expression get condition => _condition;
7904 8063
7905 /** 8064 /**
7906 * Set the condition used to determine when to terminate the loop to the given 8065 * Set the condition used to determine when to terminate the loop to the given
7907 * [expression]. 8066 * [expression].
7908 */ 8067 */
7909 void set condition(Expression expression) { 8068 void set condition(Expression expression) {
7910 _condition = becomeParentOf(expression); 8069 _condition = _becomeParentOf(expression);
7911 } 8070 }
7912 8071
7913 @override 8072 @override
7914 Token get endToken => _body.endToken; 8073 Token get endToken => _body.endToken;
7915 8074
7916 /** 8075 /**
7917 * Return the initialization expression, or `null` if there is no 8076 * Return the initialization expression, or `null` if there is no
7918 * initialization expression. 8077 * initialization expression.
7919 */ 8078 */
7920 Expression get initialization => _initialization; 8079 Expression get initialization => _initialization;
7921 8080
7922 /** 8081 /**
7923 * Set the initialization expression to the given [expression]. 8082 * Set the initialization expression to the given [expression].
7924 */ 8083 */
7925 void set initialization(Expression initialization) { 8084 void set initialization(Expression initialization) {
7926 _initialization = becomeParentOf(initialization); 8085 _initialization = _becomeParentOf(initialization);
7927 } 8086 }
7928 8087
7929 /** 8088 /**
7930 * Return the list of expressions run after each execution of the loop body. 8089 * Return the list of expressions run after each execution of the loop body.
7931 */ 8090 */
7932 NodeList<Expression> get updaters => _updaters; 8091 NodeList<Expression> get updaters => _updaters;
7933 8092
7934 /** 8093 /**
7935 * Return the declaration of the loop variables, or `null` if there are no 8094 * Return the declaration of the loop variables, or `null` if there are no
7936 * variables. 8095 * variables.
7937 */ 8096 */
7938 VariableDeclarationList get variables => _variableList; 8097 VariableDeclarationList get variables => _variableList;
7939 8098
7940 /** 8099 /**
7941 * Set the declaration of the loop variables to the given [variableList]. 8100 * Set the declaration of the loop variables to the given [variableList].
7942 */ 8101 */
7943 void set variables(VariableDeclarationList variableList) { 8102 void set variables(VariableDeclarationList variableList) {
7944 _variableList = becomeParentOf(variableList); 8103 _variableList = _becomeParentOf(variableList);
7945 } 8104 }
7946 8105
7947 @override 8106 @override
7948 accept(AstVisitor visitor) => visitor.visitForStatement(this); 8107 accept(AstVisitor visitor) => visitor.visitForStatement(this);
7949 8108
7950 @override 8109 @override
7951 void visitChildren(AstVisitor visitor) { 8110 void visitChildren(AstVisitor visitor) {
7952 _safelyVisitChild(_variableList, visitor); 8111 _safelyVisitChild(_variableList, visitor);
7953 _safelyVisitChild(_initialization, visitor); 8112 _safelyVisitChild(_initialization, visitor);
7954 _safelyVisitChild(_condition, visitor); 8113 _safelyVisitChild(_condition, visitor);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
8037 * [comment] and [metadata] can be `null` if the function does not have the 8196 * [comment] and [metadata] can be `null` if the function does not have the
8038 * corresponding attribute. The [externalKeyword] can be `null` if the 8197 * corresponding attribute. The [externalKeyword] can be `null` if the
8039 * function is not an external function. The [returnType] can be `null` if no 8198 * function is not an external function. The [returnType] can be `null` if no
8040 * return type was specified. The [propertyKeyword] can be `null` if the 8199 * return type was specified. The [propertyKeyword] can be `null` if the
8041 * function is neither a getter or a setter. 8200 * function is neither a getter or a setter.
8042 */ 8201 */
8043 FunctionDeclaration(Comment comment, List<Annotation> metadata, 8202 FunctionDeclaration(Comment comment, List<Annotation> metadata,
8044 this.externalKeyword, TypeName returnType, this.propertyKeyword, 8203 this.externalKeyword, TypeName returnType, this.propertyKeyword,
8045 SimpleIdentifier name, FunctionExpression functionExpression) 8204 SimpleIdentifier name, FunctionExpression functionExpression)
8046 : super(comment, metadata) { 8205 : super(comment, metadata) {
8047 _returnType = becomeParentOf(returnType); 8206 _returnType = _becomeParentOf(returnType);
8048 _name = becomeParentOf(name); 8207 _name = _becomeParentOf(name);
8049 _functionExpression = becomeParentOf(functionExpression); 8208 _functionExpression = _becomeParentOf(functionExpression);
8050 } 8209 }
8051 8210
8052 @override 8211 @override
8053 Iterable get childEntities => super._childEntities 8212 Iterable get childEntities => super._childEntities
8054 ..add(externalKeyword) 8213 ..add(externalKeyword)
8055 ..add(_returnType) 8214 ..add(_returnType)
8056 ..add(propertyKeyword) 8215 ..add(propertyKeyword)
8057 ..add(_name) 8216 ..add(_name)
8058 ..add(_functionExpression); 8217 ..add(_functionExpression);
8059 8218
(...skipping 21 matching lines...) Expand all
8081 /** 8240 /**
8082 * Return the function expression being wrapped. 8241 * Return the function expression being wrapped.
8083 */ 8242 */
8084 FunctionExpression get functionExpression => _functionExpression; 8243 FunctionExpression get functionExpression => _functionExpression;
8085 8244
8086 /** 8245 /**
8087 * Set the function expression being wrapped to the given 8246 * Set the function expression being wrapped to the given
8088 * [functionExpression]. 8247 * [functionExpression].
8089 */ 8248 */
8090 void set functionExpression(FunctionExpression functionExpression) { 8249 void set functionExpression(FunctionExpression functionExpression) {
8091 _functionExpression = becomeParentOf(functionExpression); 8250 _functionExpression = _becomeParentOf(functionExpression);
8092 } 8251 }
8093 8252
8094 /** 8253 /**
8095 * Return `true` if this function declares a getter. 8254 * Return `true` if this function declares a getter.
8096 */ 8255 */
8097 bool get isGetter => 8256 bool get isGetter =>
8098 propertyKeyword != null && 8257 propertyKeyword != null &&
8099 (propertyKeyword as KeywordToken).keyword == Keyword.GET; 8258 (propertyKeyword as KeywordToken).keyword == Keyword.GET;
8100 8259
8101 /** 8260 /**
8102 * Return `true` if this function declares a setter. 8261 * Return `true` if this function declares a setter.
8103 */ 8262 */
8104 bool get isSetter => 8263 bool get isSetter =>
8105 propertyKeyword != null && 8264 propertyKeyword != null &&
8106 (propertyKeyword as KeywordToken).keyword == Keyword.SET; 8265 (propertyKeyword as KeywordToken).keyword == Keyword.SET;
8107 8266
8108 /** 8267 /**
8109 * Return the name of the function, or `null` if the function is not named. 8268 * Return the name of the function, or `null` if the function is not named.
8110 */ 8269 */
8111 SimpleIdentifier get name => _name; 8270 SimpleIdentifier get name => _name;
8112 8271
8113 /** 8272 /**
8114 * Set the name of the function to the given [identifier]. 8273 * Set the name of the function to the given [identifier].
8115 */ 8274 */
8116 void set name(SimpleIdentifier identifier) { 8275 void set name(SimpleIdentifier identifier) {
8117 _name = becomeParentOf(identifier); 8276 _name = _becomeParentOf(identifier);
8118 } 8277 }
8119 8278
8120 /** 8279 /**
8121 * Return the return type of the function, or `null` if no return type was 8280 * Return the return type of the function, or `null` if no return type was
8122 * declared. 8281 * declared.
8123 */ 8282 */
8124 TypeName get returnType => _returnType; 8283 TypeName get returnType => _returnType;
8125 8284
8126 /** 8285 /**
8127 * Set the return type of the function to the given [returnType]. 8286 * Set the return type of the function to the given [returnType].
8128 */ 8287 */
8129 void set returnType(TypeName returnType) { 8288 void set returnType(TypeName returnType) {
8130 _returnType = becomeParentOf(returnType); 8289 _returnType = _becomeParentOf(returnType);
8131 } 8290 }
8132 8291
8133 @override 8292 @override
8134 accept(AstVisitor visitor) => visitor.visitFunctionDeclaration(this); 8293 accept(AstVisitor visitor) => visitor.visitFunctionDeclaration(this);
8135 8294
8136 @override 8295 @override
8137 void visitChildren(AstVisitor visitor) { 8296 void visitChildren(AstVisitor visitor) {
8138 super.visitChildren(visitor); 8297 super.visitChildren(visitor);
8139 _safelyVisitChild(_returnType, visitor); 8298 _safelyVisitChild(_returnType, visitor);
8140 _safelyVisitChild(_name, visitor); 8299 _safelyVisitChild(_name, visitor);
8141 _safelyVisitChild(_functionExpression, visitor); 8300 _safelyVisitChild(_functionExpression, visitor);
8142 } 8301 }
8143 } 8302 }
8144 8303
8145 /** 8304 /**
8146 * A [FunctionDeclaration] used as a statement. 8305 * A [FunctionDeclaration] used as a statement.
8147 */ 8306 */
8148 class FunctionDeclarationStatement extends Statement { 8307 class FunctionDeclarationStatement extends Statement {
8149 /** 8308 /**
8150 * The function declaration being wrapped. 8309 * The function declaration being wrapped.
8151 */ 8310 */
8152 FunctionDeclaration _functionDeclaration; 8311 FunctionDeclaration _functionDeclaration;
8153 8312
8154 /** 8313 /**
8155 * Initialize a newly created function declaration statement. 8314 * Initialize a newly created function declaration statement.
8156 */ 8315 */
8157 FunctionDeclarationStatement(FunctionDeclaration functionDeclaration) { 8316 FunctionDeclarationStatement(FunctionDeclaration functionDeclaration) {
8158 _functionDeclaration = becomeParentOf(functionDeclaration); 8317 _functionDeclaration = _becomeParentOf(functionDeclaration);
8159 } 8318 }
8160 8319
8161 @override 8320 @override
8162 Token get beginToken => _functionDeclaration.beginToken; 8321 Token get beginToken => _functionDeclaration.beginToken;
8163 8322
8164 @override 8323 @override
8165 Iterable get childEntities => new ChildEntities()..add(_functionDeclaration); 8324 Iterable get childEntities => new ChildEntities()..add(_functionDeclaration);
8166 8325
8167 @override 8326 @override
8168 Token get endToken => _functionDeclaration.endToken; 8327 Token get endToken => _functionDeclaration.endToken;
8169 8328
8170 /** 8329 /**
8171 * Return the function declaration being wrapped. 8330 * Return the function declaration being wrapped.
8172 */ 8331 */
8173 FunctionDeclaration get functionDeclaration => _functionDeclaration; 8332 FunctionDeclaration get functionDeclaration => _functionDeclaration;
8174 8333
8175 /** 8334 /**
8176 * Set the function declaration being wrapped to the given 8335 * Set the function declaration being wrapped to the given
8177 * [functionDeclaration]. 8336 * [functionDeclaration].
8178 */ 8337 */
8179 void set functionDeclaration(FunctionDeclaration functionDeclaration) { 8338 void set functionDeclaration(FunctionDeclaration functionDeclaration) {
8180 _functionDeclaration = becomeParentOf(functionDeclaration); 8339 _functionDeclaration = _becomeParentOf(functionDeclaration);
8181 } 8340 }
8182 8341
8183 @override 8342 @override
8184 accept(AstVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); 8343 accept(AstVisitor visitor) => visitor.visitFunctionDeclarationStatement(this);
8185 8344
8186 @override 8345 @override
8187 void visitChildren(AstVisitor visitor) { 8346 void visitChildren(AstVisitor visitor) {
8188 _safelyVisitChild(_functionDeclaration, visitor); 8347 _safelyVisitChild(_functionDeclaration, visitor);
8189 } 8348 }
8190 } 8349 }
(...skipping 18 matching lines...) Expand all
8209 /** 8368 /**
8210 * The element associated with the function, or `null` if the AST structure 8369 * The element associated with the function, or `null` if the AST structure
8211 * has not been resolved. 8370 * has not been resolved.
8212 */ 8371 */
8213 ExecutableElement element; 8372 ExecutableElement element;
8214 8373
8215 /** 8374 /**
8216 * Initialize a newly created function declaration. 8375 * Initialize a newly created function declaration.
8217 */ 8376 */
8218 FunctionExpression(FormalParameterList parameters, FunctionBody body) { 8377 FunctionExpression(FormalParameterList parameters, FunctionBody body) {
8219 _parameters = becomeParentOf(parameters); 8378 _parameters = _becomeParentOf(parameters);
8220 _body = becomeParentOf(body); 8379 _body = _becomeParentOf(body);
8221 } 8380 }
8222 8381
8223 @override 8382 @override
8224 Token get beginToken { 8383 Token get beginToken {
8225 if (_parameters != null) { 8384 if (_parameters != null) {
8226 return _parameters.beginToken; 8385 return _parameters.beginToken;
8227 } else if (_body != null) { 8386 } else if (_body != null) {
8228 return _body.beginToken; 8387 return _body.beginToken;
8229 } 8388 }
8230 // This should never be reached because external functions must be named, 8389 // This should never be reached because external functions must be named,
8231 // hence either the body or the name should be non-null. 8390 // hence either the body or the name should be non-null.
8232 throw new IllegalStateException("Non-external functions must have a body"); 8391 throw new IllegalStateException("Non-external functions must have a body");
8233 } 8392 }
8234 8393
8235 /** 8394 /**
8236 * Return the body of the function, or `null` if this is an external function. 8395 * Return the body of the function, or `null` if this is an external function.
8237 */ 8396 */
8238 FunctionBody get body => _body; 8397 FunctionBody get body => _body;
8239 8398
8240 /** 8399 /**
8241 * Set the body of the function to the given [functionBody]. 8400 * Set the body of the function to the given [functionBody].
8242 */ 8401 */
8243 void set body(FunctionBody functionBody) { 8402 void set body(FunctionBody functionBody) {
8244 _body = becomeParentOf(functionBody); 8403 _body = _becomeParentOf(functionBody);
8245 } 8404 }
8246 8405
8247 @override 8406 @override
8248 Iterable get childEntities => new ChildEntities() 8407 Iterable get childEntities => new ChildEntities()
8249 ..add(_parameters) 8408 ..add(_parameters)
8250 ..add(_body); 8409 ..add(_body);
8251 8410
8252 @override 8411 @override
8253 Token get endToken { 8412 Token get endToken {
8254 if (_body != null) { 8413 if (_body != null) {
8255 return _body.endToken; 8414 return _body.endToken;
8256 } else if (_parameters != null) { 8415 } else if (_parameters != null) {
8257 return _parameters.endToken; 8416 return _parameters.endToken;
8258 } 8417 }
8259 // This should never be reached because external functions must be named, 8418 // This should never be reached because external functions must be named,
8260 // hence either the body or the name should be non-null. 8419 // hence either the body or the name should be non-null.
8261 throw new IllegalStateException("Non-external functions must have a body"); 8420 throw new IllegalStateException("Non-external functions must have a body");
8262 } 8421 }
8263 8422
8264 /** 8423 /**
8265 * Return the parameters associated with the function. 8424 * Return the parameters associated with the function.
8266 */ 8425 */
8267 FormalParameterList get parameters => _parameters; 8426 FormalParameterList get parameters => _parameters;
8268 8427
8269 /** 8428 /**
8270 * Set the parameters associated with the function to the given list of 8429 * Set the parameters associated with the function to the given list of
8271 * [parameters]. 8430 * [parameters].
8272 */ 8431 */
8273 void set parameters(FormalParameterList parameters) { 8432 void set parameters(FormalParameterList parameters) {
8274 _parameters = becomeParentOf(parameters); 8433 _parameters = _becomeParentOf(parameters);
8275 } 8434 }
8276 8435
8277 @override 8436 @override
8278 int get precedence => 16; 8437 int get precedence => 16;
8279 8438
8280 @override 8439 @override
8281 accept(AstVisitor visitor) => visitor.visitFunctionExpression(this); 8440 accept(AstVisitor visitor) => visitor.visitFunctionExpression(this);
8282 8441
8283 @override 8442 @override
8284 void visitChildren(AstVisitor visitor) { 8443 void visitChildren(AstVisitor visitor) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
8318 * The element associated with the function being invoked based on propagated 8477 * The element associated with the function being invoked based on propagated
8319 * type information, or `null` if the AST structure has not been resolved or 8478 * type information, or `null` if the AST structure has not been resolved or
8320 * the function could not be resolved. 8479 * the function could not be resolved.
8321 */ 8480 */
8322 ExecutableElement propagatedElement; 8481 ExecutableElement propagatedElement;
8323 8482
8324 /** 8483 /**
8325 * Initialize a newly created function expression invocation. 8484 * Initialize a newly created function expression invocation.
8326 */ 8485 */
8327 FunctionExpressionInvocation(Expression function, ArgumentList argumentList) { 8486 FunctionExpressionInvocation(Expression function, ArgumentList argumentList) {
8328 _function = becomeParentOf(function); 8487 _function = _becomeParentOf(function);
8329 _argumentList = becomeParentOf(argumentList); 8488 _argumentList = _becomeParentOf(argumentList);
8330 } 8489 }
8331 8490
8332 /** 8491 /**
8333 * Return the list of arguments to the method. 8492 * Return the list of arguments to the method.
8334 */ 8493 */
8335 ArgumentList get argumentList => _argumentList; 8494 ArgumentList get argumentList => _argumentList;
8336 8495
8337 /** 8496 /**
8338 * Set the list of arguments to the method to the given [argumentList]. 8497 * Set the list of arguments to the method to the given [argumentList].
8339 */ 8498 */
8340 void set argumentList(ArgumentList argumentList) { 8499 void set argumentList(ArgumentList argumentList) {
8341 _argumentList = becomeParentOf(argumentList); 8500 _argumentList = _becomeParentOf(argumentList);
8342 } 8501 }
8343 8502
8344 @override 8503 @override
8345 Token get beginToken => _function.beginToken; 8504 Token get beginToken => _function.beginToken;
8346 8505
8347 /** 8506 /**
8348 * Return the best element available for the function being invoked. If 8507 * Return the best element available for the function being invoked. If
8349 * resolution was able to find a better element based on type propagation, 8508 * resolution was able to find a better element based on type propagation,
8350 * that element will be returned. Otherwise, the element found using the 8509 * that element will be returned. Otherwise, the element found using the
8351 * result of static analysis will be returned. If resolution has not been 8510 * result of static analysis will be returned. If resolution has not been
8352 * performed, then `null` will be returned. 8511 * performed, then `null` will be returned.
8353 */ 8512 */
8354 ExecutableElement get bestElement { 8513 ExecutableElement get bestElement {
8355 ExecutableElement element = propagatedElement; 8514 ExecutableElement element = propagatedElement;
8356 if (element == null) { 8515 if (element == null) {
8357 element = staticElement; 8516 element = staticElement;
8358 } 8517 }
8359 return element; 8518 return element;
8360 } 8519 }
8361 8520
8362 /**
8363 * TODO(paulberry): untested.
8364 */
8365 @override 8521 @override
8366 Iterable get childEntities => new ChildEntities() 8522 Iterable get childEntities => new ChildEntities()
8367 ..add(_function) 8523 ..add(_function)
8368 ..add(_argumentList); 8524 ..add(_argumentList);
8369 8525
8370 @override 8526 @override
8371 Token get endToken => _argumentList.endToken; 8527 Token get endToken => _argumentList.endToken;
8372 8528
8373 /** 8529 /**
8374 * Return the expression producing the function being invoked. 8530 * Return the expression producing the function being invoked.
8375 */ 8531 */
8376 Expression get function => _function; 8532 Expression get function => _function;
8377 8533
8378 /** 8534 /**
8379 * Set the expression producing the function being invoked to the given 8535 * Set the expression producing the function being invoked to the given
8380 * [expression]. 8536 * [expression].
8381 */ 8537 */
8382 void set function(Expression expression) { 8538 void set function(Expression expression) {
8383 _function = becomeParentOf(expression); 8539 _function = _becomeParentOf(expression);
8384 } 8540 }
8385 8541
8386 @override 8542 @override
8387 int get precedence => 15; 8543 int get precedence => 15;
8388 8544
8389 @override 8545 @override
8390 accept(AstVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); 8546 accept(AstVisitor visitor) => visitor.visitFunctionExpressionInvocation(this);
8391 8547
8392 @override 8548 @override
8393 void visitChildren(AstVisitor visitor) { 8549 void visitChildren(AstVisitor visitor) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
8432 * Initialize a newly created function type alias. Either or both of the 8588 * Initialize a newly created function type alias. Either or both of the
8433 * [comment] and [metadata] can be `null` if the function does not have the 8589 * [comment] and [metadata] can be `null` if the function does not have the
8434 * corresponding attribute. The [returnType] can be `null` if no return type 8590 * corresponding attribute. The [returnType] can be `null` if no return type
8435 * was specified. The [typeParameters] can be `null` if the function has no 8591 * was specified. The [typeParameters] can be `null` if the function has no
8436 * type parameters. 8592 * type parameters.
8437 */ 8593 */
8438 FunctionTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, 8594 FunctionTypeAlias(Comment comment, List<Annotation> metadata, Token keyword,
8439 TypeName returnType, SimpleIdentifier name, TypeParameterList typeParamete rs, 8595 TypeName returnType, SimpleIdentifier name, TypeParameterList typeParamete rs,
8440 FormalParameterList parameters, Token semicolon) 8596 FormalParameterList parameters, Token semicolon)
8441 : super(comment, metadata, keyword, semicolon) { 8597 : super(comment, metadata, keyword, semicolon) {
8442 _returnType = becomeParentOf(returnType); 8598 _returnType = _becomeParentOf(returnType);
8443 _name = becomeParentOf(name); 8599 _name = _becomeParentOf(name);
8444 _typeParameters = becomeParentOf(typeParameters); 8600 _typeParameters = _becomeParentOf(typeParameters);
8445 _parameters = becomeParentOf(parameters); 8601 _parameters = _becomeParentOf(parameters);
8446 } 8602 }
8447 8603
8448 @override 8604 @override
8449 Iterable get childEntities => super._childEntities 8605 Iterable get childEntities => super._childEntities
8450 ..add(keyword) 8606 ..add(typedefKeyword)
8451 ..add(_returnType) 8607 ..add(_returnType)
8452 ..add(_name) 8608 ..add(_name)
8453 ..add(_typeParameters) 8609 ..add(_typeParameters)
8454 ..add(_parameters) 8610 ..add(_parameters)
8455 ..add(semicolon); 8611 ..add(semicolon);
8456 8612
8457 @override 8613 @override
8458 FunctionTypeAliasElement get element => 8614 FunctionTypeAliasElement get element =>
8459 _name != null ? (_name.staticElement as FunctionTypeAliasElement) : null; 8615 _name != null ? (_name.staticElement as FunctionTypeAliasElement) : null;
8460 8616
8461 /** 8617 /**
8462 * Return the name of the function type being declared. 8618 * Return the name of the function type being declared.
8463 */ 8619 */
8464 SimpleIdentifier get name => _name; 8620 SimpleIdentifier get name => _name;
8465 8621
8466 /** 8622 /**
8467 * Set the name of the function type being declared to the given [name]. 8623 * Set the name of the function type being declared to the given [name].
8468 */ 8624 */
8469 void set name(SimpleIdentifier name) { 8625 void set name(SimpleIdentifier name) {
8470 _name = becomeParentOf(name); 8626 _name = _becomeParentOf(name);
8471 } 8627 }
8472 8628
8473 /** 8629 /**
8474 * Return the parameters associated with the function type. 8630 * Return the parameters associated with the function type.
8475 */ 8631 */
8476 FormalParameterList get parameters => _parameters; 8632 FormalParameterList get parameters => _parameters;
8477 8633
8478 /** 8634 /**
8479 * Set the parameters associated with the function type to the given list of 8635 * Set the parameters associated with the function type to the given list of
8480 * [parameters]. 8636 * [parameters].
8481 */ 8637 */
8482 void set parameters(FormalParameterList parameters) { 8638 void set parameters(FormalParameterList parameters) {
8483 _parameters = becomeParentOf(parameters); 8639 _parameters = _becomeParentOf(parameters);
8484 } 8640 }
8485 8641
8486 /** 8642 /**
8487 * Return the name of the return type of the function type being defined, or 8643 * Return the name of the return type of the function type being defined, or
8488 * `null` if no return type was given. 8644 * `null` if no return type was given.
8489 */ 8645 */
8490 TypeName get returnType => _returnType; 8646 TypeName get returnType => _returnType;
8491 8647
8492 /** 8648 /**
8493 * Set the name of the return type of the function type being defined to the 8649 * Set the name of the return type of the function type being defined to the
8494 * given [typeName]. 8650 * given [typeName].
8495 */ 8651 */
8496 void set returnType(TypeName typeName) { 8652 void set returnType(TypeName typeName) {
8497 _returnType = becomeParentOf(typeName); 8653 _returnType = _becomeParentOf(typeName);
8498 } 8654 }
8499 8655
8500 /** 8656 /**
8501 * Return the type parameters for the function type, or `null` if the function 8657 * Return the type parameters for the function type, or `null` if the function
8502 * type does not have any type parameters. 8658 * type does not have any type parameters.
8503 */ 8659 */
8504 TypeParameterList get typeParameters => _typeParameters; 8660 TypeParameterList get typeParameters => _typeParameters;
8505 8661
8506 /** 8662 /**
8507 * Set the type parameters for the function type to the given list of 8663 * Set the type parameters for the function type to the given list of
8508 * [typeParameters]. 8664 * [typeParameters].
8509 */ 8665 */
8510 void set typeParameters(TypeParameterList typeParameters) { 8666 void set typeParameters(TypeParameterList typeParameters) {
8511 _typeParameters = becomeParentOf(typeParameters); 8667 _typeParameters = _becomeParentOf(typeParameters);
8512 } 8668 }
8513 8669
8514 @override 8670 @override
8515 accept(AstVisitor visitor) => visitor.visitFunctionTypeAlias(this); 8671 accept(AstVisitor visitor) => visitor.visitFunctionTypeAlias(this);
8516 8672
8517 @override 8673 @override
8518 void visitChildren(AstVisitor visitor) { 8674 void visitChildren(AstVisitor visitor) {
8519 super.visitChildren(visitor); 8675 super.visitChildren(visitor);
8520 _safelyVisitChild(_returnType, visitor); 8676 _safelyVisitChild(_returnType, visitor);
8521 _safelyVisitChild(_name, visitor); 8677 _safelyVisitChild(_name, visitor);
(...skipping 23 matching lines...) Expand all
8545 /** 8701 /**
8546 * Initialize a newly created formal parameter. Either or both of the 8702 * Initialize a newly created formal parameter. Either or both of the
8547 * [comment] and [metadata] can be `null` if the parameter does not have the 8703 * [comment] and [metadata] can be `null` if the parameter does not have the
8548 * corresponding attribute. The [returnType] can be `null` if no return type 8704 * corresponding attribute. The [returnType] can be `null` if no return type
8549 * was specified. 8705 * was specified.
8550 */ 8706 */
8551 FunctionTypedFormalParameter(Comment comment, List<Annotation> metadata, 8707 FunctionTypedFormalParameter(Comment comment, List<Annotation> metadata,
8552 TypeName returnType, SimpleIdentifier identifier, 8708 TypeName returnType, SimpleIdentifier identifier,
8553 FormalParameterList parameters) 8709 FormalParameterList parameters)
8554 : super(comment, metadata, identifier) { 8710 : super(comment, metadata, identifier) {
8555 _returnType = becomeParentOf(returnType); 8711 _returnType = _becomeParentOf(returnType);
8556 _parameters = becomeParentOf(parameters); 8712 _parameters = _becomeParentOf(parameters);
8557 } 8713 }
8558 8714
8559 @override 8715 @override
8560 Token get beginToken { 8716 Token get beginToken {
8561 if (_returnType != null) { 8717 if (_returnType != null) {
8562 return _returnType.beginToken; 8718 return _returnType.beginToken;
8563 } 8719 }
8564 return identifier.beginToken; 8720 return identifier.beginToken;
8565 } 8721 }
8566 8722
8567 /**
8568 * TODO(paulberry): untested.
8569 */
8570 @override 8723 @override
8571 Iterable get childEntities => super._childEntities 8724 Iterable get childEntities => super._childEntities
8572 ..add(_returnType) 8725 ..add(_returnType)
8573 ..add(identifier) 8726 ..add(identifier)
8574 ..add(parameters); 8727 ..add(parameters);
8575 8728
8576 @override 8729 @override
8577 Token get endToken => _parameters.endToken; 8730 Token get endToken => _parameters.endToken;
8578 8731
8579 @override 8732 @override
8580 bool get isConst => false; 8733 bool get isConst => false;
8581 8734
8582 @override 8735 @override
8583 bool get isFinal => false; 8736 bool get isFinal => false;
8584 8737
8585 /** 8738 /**
8586 * Return the parameters of the function-typed parameter. 8739 * Return the parameters of the function-typed parameter.
8587 */ 8740 */
8588 FormalParameterList get parameters => _parameters; 8741 FormalParameterList get parameters => _parameters;
8589 8742
8590 /** 8743 /**
8591 * Set the parameters of the function-typed parameter to the given 8744 * Set the parameters of the function-typed parameter to the given
8592 * [parameters]. 8745 * [parameters].
8593 */ 8746 */
8594 void set parameters(FormalParameterList parameters) { 8747 void set parameters(FormalParameterList parameters) {
8595 _parameters = becomeParentOf(parameters); 8748 _parameters = _becomeParentOf(parameters);
8596 } 8749 }
8597 8750
8598 /** 8751 /**
8599 * Return the return type of the function, or `null` if the function does not 8752 * Return the return type of the function, or `null` if the function does not
8600 * have a return type. 8753 * have a return type.
8601 */ 8754 */
8602 TypeName get returnType => _returnType; 8755 TypeName get returnType => _returnType;
8603 8756
8604 /** 8757 /**
8605 * Set the return type of the function to the given [type]. 8758 * Set the return type of the function to the given [type].
8606 */ 8759 */
8607 void set returnType(TypeName type) { 8760 void set returnType(TypeName type) {
8608 _returnType = becomeParentOf(type); 8761 _returnType = _becomeParentOf(type);
8609 } 8762 }
8610 8763
8611 @override 8764 @override
8612 accept(AstVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); 8765 accept(AstVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this);
8613 8766
8614 @override 8767 @override
8615 void visitChildren(AstVisitor visitor) { 8768 void visitChildren(AstVisitor visitor) {
8616 super.visitChildren(visitor); 8769 super.visitChildren(visitor);
8617 _safelyVisitChild(_returnType, visitor); 8770 _safelyVisitChild(_returnType, visitor);
8618 _safelyVisitChild(identifier, visitor); 8771 _safelyVisitChild(identifier, visitor);
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
9189 */ 9342 */
9190 Statement _elseStatement; 9343 Statement _elseStatement;
9191 9344
9192 /** 9345 /**
9193 * Initialize a newly created if statement. The [elseKeyword] and 9346 * Initialize a newly created if statement. The [elseKeyword] and
9194 * [elseStatement] can be `null` if there is no else clause. 9347 * [elseStatement] can be `null` if there is no else clause.
9195 */ 9348 */
9196 IfStatement(this.ifKeyword, this.leftParenthesis, Expression condition, 9349 IfStatement(this.ifKeyword, this.leftParenthesis, Expression condition,
9197 this.rightParenthesis, Statement thenStatement, this.elseKeyword, 9350 this.rightParenthesis, Statement thenStatement, this.elseKeyword,
9198 Statement elseStatement) { 9351 Statement elseStatement) {
9199 _condition = becomeParentOf(condition); 9352 _condition = _becomeParentOf(condition);
9200 _thenStatement = becomeParentOf(thenStatement); 9353 _thenStatement = _becomeParentOf(thenStatement);
9201 _elseStatement = becomeParentOf(elseStatement); 9354 _elseStatement = _becomeParentOf(elseStatement);
9202 } 9355 }
9203 9356
9204 @override 9357 @override
9205 Token get beginToken => ifKeyword; 9358 Token get beginToken => ifKeyword;
9206 9359
9207 @override 9360 @override
9208 Iterable get childEntities => new ChildEntities() 9361 Iterable get childEntities => new ChildEntities()
9209 ..add(ifKeyword) 9362 ..add(ifKeyword)
9210 ..add(leftParenthesis) 9363 ..add(leftParenthesis)
9211 ..add(_condition) 9364 ..add(_condition)
9212 ..add(rightParenthesis) 9365 ..add(rightParenthesis)
9213 ..add(_thenStatement) 9366 ..add(_thenStatement)
9214 ..add(elseKeyword) 9367 ..add(elseKeyword)
9215 ..add(_elseStatement); 9368 ..add(_elseStatement);
9216 9369
9217 /** 9370 /**
9218 * Return the condition used to determine which of the statements is executed 9371 * Return the condition used to determine which of the statements is executed
9219 * next. 9372 * next.
9220 */ 9373 */
9221 Expression get condition => _condition; 9374 Expression get condition => _condition;
9222 9375
9223 /** 9376 /**
9224 * Set the condition used to determine which of the statements is executed 9377 * Set the condition used to determine which of the statements is executed
9225 * next to the given [expression]. 9378 * next to the given [expression].
9226 */ 9379 */
9227 void set condition(Expression expression) { 9380 void set condition(Expression expression) {
9228 _condition = becomeParentOf(expression); 9381 _condition = _becomeParentOf(expression);
9229 } 9382 }
9230 9383
9231 /** 9384 /**
9232 * Return the statement that is executed if the condition evaluates to 9385 * Return the statement that is executed if the condition evaluates to
9233 * `false`, or `null` if there is no else statement. 9386 * `false`, or `null` if there is no else statement.
9234 */ 9387 */
9235 Statement get elseStatement => _elseStatement; 9388 Statement get elseStatement => _elseStatement;
9236 9389
9237 /** 9390 /**
9238 * Set the statement that is executed if the condition evaluates to `false` 9391 * Set the statement that is executed if the condition evaluates to `false`
9239 * to the given [statement]. 9392 * to the given [statement].
9240 */ 9393 */
9241 void set elseStatement(Statement statement) { 9394 void set elseStatement(Statement statement) {
9242 _elseStatement = becomeParentOf(statement); 9395 _elseStatement = _becomeParentOf(statement);
9243 } 9396 }
9244 9397
9245 @override 9398 @override
9246 Token get endToken { 9399 Token get endToken {
9247 if (_elseStatement != null) { 9400 if (_elseStatement != null) {
9248 return _elseStatement.endToken; 9401 return _elseStatement.endToken;
9249 } 9402 }
9250 return _thenStatement.endToken; 9403 return _thenStatement.endToken;
9251 } 9404 }
9252 9405
9253 /** 9406 /**
9254 * Return the statement that is executed if the condition evaluates to `true`. 9407 * Return the statement that is executed if the condition evaluates to `true`.
9255 */ 9408 */
9256 Statement get thenStatement => _thenStatement; 9409 Statement get thenStatement => _thenStatement;
9257 9410
9258 /** 9411 /**
9259 * Set the statement that is executed if the condition evaluates to `true` to 9412 * Set the statement that is executed if the condition evaluates to `true` to
9260 * the given [statement]. 9413 * the given [statement].
9261 */ 9414 */
9262 void set thenStatement(Statement statement) { 9415 void set thenStatement(Statement statement) {
9263 _thenStatement = becomeParentOf(statement); 9416 _thenStatement = _becomeParentOf(statement);
9264 } 9417 }
9265 9418
9266 @override 9419 @override
9267 accept(AstVisitor visitor) => visitor.visitIfStatement(this); 9420 accept(AstVisitor visitor) => visitor.visitIfStatement(this);
9268 9421
9269 @override 9422 @override
9270 void visitChildren(AstVisitor visitor) { 9423 void visitChildren(AstVisitor visitor) {
9271 _safelyVisitChild(_condition, visitor); 9424 _safelyVisitChild(_condition, visitor);
9272 _safelyVisitChild(_thenStatement, visitor); 9425 _safelyVisitChild(_thenStatement, visitor);
9273 _safelyVisitChild(_elseStatement, visitor); 9426 _safelyVisitChild(_elseStatement, visitor);
9274 } 9427 }
9275 } 9428 }
9276 9429
9277 /** 9430 /**
9278 * The "implements" clause in an class declaration. 9431 * The "implements" clause in an class declaration.
9279 * 9432 *
9280 * > implementsClause ::= 9433 * > implementsClause ::=
9281 * > 'implements' [TypeName] (',' [TypeName])* 9434 * > 'implements' [TypeName] (',' [TypeName])*
9282 */ 9435 */
9283 class ImplementsClause extends AstNode { 9436 class ImplementsClause extends AstNode {
9284 /** 9437 /**
9285 * The token representing the 'implements' keyword. 9438 * The token representing the 'implements' keyword.
9286 */ 9439 */
9287 Token keyword; 9440 Token implementsKeyword;
9288 9441
9289 /** 9442 /**
9290 * The interfaces that are being implemented. 9443 * The interfaces that are being implemented.
9291 */ 9444 */
9292 NodeList<TypeName> _interfaces; 9445 NodeList<TypeName> _interfaces;
9293 9446
9294 /** 9447 /**
9295 * Initialize a newly created implements clause. 9448 * Initialize a newly created implements clause.
9296 */ 9449 */
9297 ImplementsClause(this.keyword, List<TypeName> interfaces) { 9450 ImplementsClause(this.implementsKeyword, List<TypeName> interfaces) {
9298 _interfaces = new NodeList<TypeName>(this, interfaces); 9451 _interfaces = new NodeList<TypeName>(this, interfaces);
9299 } 9452 }
9300 9453
9301 @override 9454 @override
9302 Token get beginToken => keyword; 9455 Token get beginToken => implementsKeyword;
9303 9456
9304 /** 9457 /**
9305 * TODO(paulberry): add commas. 9458 * TODO(paulberry): add commas.
9306 */ 9459 */
9307 @override 9460 @override
9308 Iterable get childEntities => new ChildEntities() 9461 Iterable get childEntities => new ChildEntities()
9309 ..add(keyword) 9462 ..add(implementsKeyword)
9310 ..addAll(interfaces); 9463 ..addAll(interfaces);
9311 9464
9312 @override 9465 @override
9313 Token get endToken => _interfaces.endToken; 9466 Token get endToken => _interfaces.endToken;
9314 9467
9315 /** 9468 /**
9316 * Return the list of the interfaces that are being implemented. 9469 * Return the list of the interfaces that are being implemented.
9317 */ 9470 */
9318 NodeList<TypeName> get interfaces => _interfaces; 9471 NodeList<TypeName> get interfaces => _interfaces;
9319 9472
9473 /**
9474 * Return the token representing the 'implements' keyword.
9475 */
9476 @deprecated // Use "this.implementsKeyword"
9477 Token get keyword => implementsKeyword;
9478
9479 /**
9480 * Set the token representing the 'implements' keyword to the given [token].
9481 */
9482 @deprecated // Use "this.implementsKeyword"
9483 set keyword(Token token) {
9484 implementsKeyword = token;
9485 }
9486
9320 @override 9487 @override
9321 accept(AstVisitor visitor) => visitor.visitImplementsClause(this); 9488 accept(AstVisitor visitor) => visitor.visitImplementsClause(this);
9322 9489
9323 @override 9490 @override
9324 void visitChildren(AstVisitor visitor) { 9491 void visitChildren(AstVisitor visitor) {
9325 _interfaces.accept(visitor); 9492 _interfaces.accept(visitor);
9326 } 9493 }
9327 } 9494 }
9328 9495
9329 /** 9496 /**
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
9422 if (!javaCollectionContainsAll(allHides1, allHides2)) { 9589 if (!javaCollectionContainsAll(allHides1, allHides2)) {
9423 return -1; 9590 return -1;
9424 } 9591 }
9425 if (!javaCollectionContainsAll(allShows1, allShows2)) { 9592 if (!javaCollectionContainsAll(allShows1, allShows2)) {
9426 return -1; 9593 return -1;
9427 } 9594 }
9428 return 0; 9595 return 0;
9429 }; 9596 };
9430 9597
9431 /** 9598 /**
9432 * The token representing the 'deferred' token, or `null` if the imported is 9599 * The token representing the 'deferred' keyword, or `null` if the imported is
9433 * not deferred. 9600 * not deferred.
9434 */ 9601 */
9435 Token deferredToken; 9602 Token deferredKeyword;
9436 9603
9437 /** 9604 /**
9438 * The token representing the 'as' token, or `null` if the imported names are 9605 * The token representing the 'as' keyword, or `null` if the imported names ar e
9439 * not prefixed. 9606 * not prefixed.
9440 */ 9607 */
9441 Token asToken; 9608 Token asKeyword;
9442 9609
9443 /** 9610 /**
9444 * The prefix to be used with the imported names, or `null` if the imported 9611 * The prefix to be used with the imported names, or `null` if the imported
9445 * names are not prefixed. 9612 * names are not prefixed.
9446 */ 9613 */
9447 SimpleIdentifier _prefix; 9614 SimpleIdentifier _prefix;
9448 9615
9449 /** 9616 /**
9450 * Initialize a newly created import directive. Either or both of the 9617 * Initialize a newly created import directive. Either or both of the
9451 * [comment] and [metadata] can be `null` if the function does not have the 9618 * [comment] and [metadata] can be `null` if the function does not have the
9452 * corresponding attribute. The [deferredToken] can be `null` if the import is 9619 * corresponding attribute. The [deferredKeyword] can be `null` if the import
9453 * not deferred. The [asToken] and [prefix] can be `null` if the import does 9620 * is not deferred. The [asKeyword] and [prefix] can be `null` if the import
9454 * not specify a prefix. The list of [combinators] can be `null` if there are 9621 * does not specify a prefix. The list of [combinators] can be `null` if there
9455 * no combinators. 9622 * are no combinators.
9456 */ 9623 */
9457 ImportDirective(Comment comment, List<Annotation> metadata, Token keyword, 9624 ImportDirective(Comment comment, List<Annotation> metadata, Token keyword,
9458 StringLiteral libraryUri, this.deferredToken, this.asToken, 9625 StringLiteral libraryUri, this.deferredKeyword, this.asKeyword,
9459 SimpleIdentifier prefix, List<Combinator> combinators, Token semicolon) 9626 SimpleIdentifier prefix, List<Combinator> combinators, Token semicolon)
9460 : super(comment, metadata, keyword, libraryUri, combinators, semicolon) { 9627 : super(comment, metadata, keyword, libraryUri, combinators, semicolon) {
9461 _prefix = becomeParentOf(prefix); 9628 _prefix = _becomeParentOf(prefix);
9629 }
9630
9631 /**
9632 * The token representing the 'as' token, or `null` if the imported names are
9633 * not prefixed.
9634 */
9635 @deprecated // Use "this.asKeyword"
9636 Token get asToken => asKeyword;
9637
9638 /**
9639 * The token representing the 'as' token to the given token.
9640 */
9641 @deprecated // Use "this.asKeyword"
9642 set asToken (Token token) {
9643 asKeyword = token;
9462 } 9644 }
9463 9645
9464 @override 9646 @override
9465 Iterable get childEntities => super._childEntities 9647 Iterable get childEntities => super._childEntities
9466 ..add(_uri) 9648 ..add(_uri)
9467 ..add(deferredToken) 9649 ..add(deferredKeyword)
9468 ..add(asToken) 9650 ..add(asKeyword)
9469 ..add(_prefix) 9651 ..add(_prefix)
9470 ..addAll(combinators) 9652 ..addAll(combinators)
9471 ..add(semicolon); 9653 ..add(semicolon);
9472 9654
9655 /**
9656 * Return the token representing the 'deferred' token, or `null` if the
9657 * imported is not deferred.
9658 */
9659 @deprecated // Use "this.deferredKeyword"
9660 Token get deferredToken => deferredKeyword;
9661
9662 /**
9663 * Set the token representing the 'deferred' token to the given token.
9664 */
9665 @deprecated // Use "this.deferredKeyword"
9666 set deferredToken (Token token) {
9667 deferredKeyword = token;
9668 }
9669
9473 @override 9670 @override
9474 ImportElement get element => super.element as ImportElement; 9671 ImportElement get element => super.element as ImportElement;
9475 9672
9476 /** 9673 /**
9477 * Return the prefix to be used with the imported names, or `null` if the 9674 * Return the prefix to be used with the imported names, or `null` if the
9478 * imported names are not prefixed. 9675 * imported names are not prefixed.
9479 */ 9676 */
9480 SimpleIdentifier get prefix => _prefix; 9677 SimpleIdentifier get prefix => _prefix;
9481 9678
9482 /** 9679 /**
9483 * Set the prefix to be used with the imported names to the given [identifier] . 9680 * Set the prefix to be used with the imported names to the given [identifier] .
9484 */ 9681 */
9485 void set prefix(SimpleIdentifier identifier) { 9682 void set prefix(SimpleIdentifier identifier) {
9486 _prefix = becomeParentOf(identifier); 9683 _prefix = _becomeParentOf(identifier);
9487 } 9684 }
9488 9685
9489 @override 9686 @override
9490 LibraryElement get uriElement { 9687 LibraryElement get uriElement {
9491 ImportElement element = this.element; 9688 ImportElement element = this.element;
9492 if (element == null) { 9689 if (element == null) {
9493 return null; 9690 return null;
9494 } 9691 }
9495 return element.importedLibrary; 9692 return element.importedLibrary;
9496 } 9693 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
9565 _mapToken(node.asOperator), 9762 _mapToken(node.asOperator),
9566 _cloneNode(node.type)); 9763 _cloneNode(node.type));
9567 copy.propagatedType = node.propagatedType; 9764 copy.propagatedType = node.propagatedType;
9568 copy.staticType = node.staticType; 9765 copy.staticType = node.staticType;
9569 return copy; 9766 return copy;
9570 } 9767 }
9571 9768
9572 @override 9769 @override
9573 AstNode visitAssertStatement(AssertStatement node) => 9770 AstNode visitAssertStatement(AssertStatement node) =>
9574 new AssertStatement( 9771 new AssertStatement(
9575 _mapToken(node.keyword), 9772 _mapToken(node.assertKeyword),
9576 _mapToken(node.leftParenthesis), 9773 _mapToken(node.leftParenthesis),
9577 _cloneNode(node.condition), 9774 _cloneNode(node.condition),
9578 _mapToken(node.rightParenthesis), 9775 _mapToken(node.rightParenthesis),
9579 _mapToken(node.semicolon)); 9776 _mapToken(node.semicolon));
9580 9777
9581 @override 9778 @override
9582 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) { 9779 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) {
9583 AssignmentExpression copy = new AssignmentExpression( 9780 AssignmentExpression copy = new AssignmentExpression(
9584 _cloneNode(node.leftHandSide), 9781 _cloneNode(node.leftHandSide),
9585 _mapToken(node.operator), 9782 _mapToken(node.operator),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
9627 BooleanLiteral copy = 9824 BooleanLiteral copy =
9628 new BooleanLiteral(_mapToken(node.literal), node.value); 9825 new BooleanLiteral(_mapToken(node.literal), node.value);
9629 copy.propagatedType = node.propagatedType; 9826 copy.propagatedType = node.propagatedType;
9630 copy.staticType = node.staticType; 9827 copy.staticType = node.staticType;
9631 return copy; 9828 return copy;
9632 } 9829 }
9633 9830
9634 @override 9831 @override
9635 BreakStatement visitBreakStatement(BreakStatement node) => 9832 BreakStatement visitBreakStatement(BreakStatement node) =>
9636 new BreakStatement( 9833 new BreakStatement(
9637 _mapToken(node.keyword), 9834 _mapToken(node.breakKeyword),
9638 _cloneNode(node.label), 9835 _cloneNode(node.label),
9639 _mapToken(node.semicolon)); 9836 _mapToken(node.semicolon));
9640 9837
9641 @override 9838 @override
9642 CascadeExpression visitCascadeExpression(CascadeExpression node) { 9839 CascadeExpression visitCascadeExpression(CascadeExpression node) {
9643 CascadeExpression copy = new CascadeExpression( 9840 CascadeExpression copy = new CascadeExpression(
9644 _cloneNode(node.target), 9841 _cloneNode(node.target),
9645 _cloneNodeList(node.cascadeSections)); 9842 _cloneNodeList(node.cascadeSections));
9646 copy.propagatedType = node.propagatedType; 9843 copy.propagatedType = node.propagatedType;
9647 copy.staticType = node.staticType; 9844 copy.staticType = node.staticType;
(...skipping 30 matching lines...) Expand all
9678 _mapToken(node.rightBracket)); 9875 _mapToken(node.rightBracket));
9679 copy.nativeClause = _cloneNode(node.nativeClause); 9876 copy.nativeClause = _cloneNode(node.nativeClause);
9680 return copy; 9877 return copy;
9681 } 9878 }
9682 9879
9683 @override 9880 @override
9684 ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) => 9881 ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) =>
9685 new ClassTypeAlias( 9882 new ClassTypeAlias(
9686 _cloneNode(node.documentationComment), 9883 _cloneNode(node.documentationComment),
9687 _cloneNodeList(node.metadata), 9884 _cloneNodeList(node.metadata),
9688 _mapToken(node.keyword), 9885 _mapToken(node.typedefKeyword),
9689 _cloneNode(node.name), 9886 _cloneNode(node.name),
9690 _cloneNode(node.typeParameters), 9887 _cloneNode(node.typeParameters),
9691 _mapToken(node.equals), 9888 _mapToken(node.equals),
9692 _mapToken(node.abstractKeyword), 9889 _mapToken(node.abstractKeyword),
9693 _cloneNode(node.superclass), 9890 _cloneNode(node.superclass),
9694 _cloneNode(node.withClause), 9891 _cloneNode(node.withClause),
9695 _cloneNode(node.implementsClause), 9892 _cloneNode(node.implementsClause),
9696 _mapToken(node.semicolon)); 9893 _mapToken(node.semicolon));
9697 9894
9698 @override 9895 @override
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
9755 _cloneNode(node.redirectedConstructor), 9952 _cloneNode(node.redirectedConstructor),
9756 _cloneNode(node.body)); 9953 _cloneNode(node.body));
9757 copy.element = node.element; 9954 copy.element = node.element;
9758 return copy; 9955 return copy;
9759 } 9956 }
9760 9957
9761 @override 9958 @override
9762 ConstructorFieldInitializer 9959 ConstructorFieldInitializer
9763 visitConstructorFieldInitializer(ConstructorFieldInitializer node) => 9960 visitConstructorFieldInitializer(ConstructorFieldInitializer node) =>
9764 new ConstructorFieldInitializer( 9961 new ConstructorFieldInitializer(
9765 _mapToken(node.keyword), 9962 _mapToken(node.thisKeyword),
9766 _mapToken(node.period), 9963 _mapToken(node.period),
9767 _cloneNode(node.fieldName), 9964 _cloneNode(node.fieldName),
9768 _mapToken(node.equals), 9965 _mapToken(node.equals),
9769 _cloneNode(node.expression)); 9966 _cloneNode(node.expression));
9770 9967
9771 @override 9968 @override
9772 ConstructorName visitConstructorName(ConstructorName node) { 9969 ConstructorName visitConstructorName(ConstructorName node) {
9773 ConstructorName copy = new ConstructorName( 9970 ConstructorName copy = new ConstructorName(
9774 _cloneNode(node.type), 9971 _cloneNode(node.type),
9775 _mapToken(node.period), 9972 _mapToken(node.period),
9776 _cloneNode(node.name)); 9973 _cloneNode(node.name));
9777 copy.staticElement = node.staticElement; 9974 copy.staticElement = node.staticElement;
9778 return copy; 9975 return copy;
9779 } 9976 }
9780 9977
9781 @override 9978 @override
9782 ContinueStatement visitContinueStatement(ContinueStatement node) => 9979 ContinueStatement visitContinueStatement(ContinueStatement node) =>
9783 new ContinueStatement( 9980 new ContinueStatement(
9784 _mapToken(node.keyword), 9981 _mapToken(node.continueKeyword),
9785 _cloneNode(node.label), 9982 _cloneNode(node.label),
9786 _mapToken(node.semicolon)); 9983 _mapToken(node.semicolon));
9787 9984
9788 @override 9985 @override
9789 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => 9986 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) =>
9790 new DeclaredIdentifier( 9987 new DeclaredIdentifier(
9791 _cloneNode(node.documentationComment), 9988 _cloneNode(node.documentationComment),
9792 _cloneNodeList(node.metadata), 9989 _cloneNodeList(node.metadata),
9793 _mapToken(node.keyword), 9990 _mapToken(node.keyword),
9794 _cloneNode(node.type), 9991 _cloneNode(node.type),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
9835 new EnumConstantDeclaration( 10032 new EnumConstantDeclaration(
9836 _cloneNode(node.documentationComment), 10033 _cloneNode(node.documentationComment),
9837 _cloneNodeList(node.metadata), 10034 _cloneNodeList(node.metadata),
9838 _cloneNode(node.name)); 10035 _cloneNode(node.name));
9839 10036
9840 @override 10037 @override
9841 AstNode visitEnumDeclaration(EnumDeclaration node) => 10038 AstNode visitEnumDeclaration(EnumDeclaration node) =>
9842 new EnumDeclaration( 10039 new EnumDeclaration(
9843 _cloneNode(node.documentationComment), 10040 _cloneNode(node.documentationComment),
9844 _cloneNodeList(node.metadata), 10041 _cloneNodeList(node.metadata),
9845 _mapToken(node.keyword), 10042 _mapToken(node.enumKeyword),
9846 _cloneNode(node.name), 10043 _cloneNode(node.name),
9847 _mapToken(node.leftBracket), 10044 _mapToken(node.leftBracket),
9848 _cloneNodeList(node.constants), 10045 _cloneNodeList(node.constants),
9849 _mapToken(node.rightBracket)); 10046 _mapToken(node.rightBracket));
9850 10047
9851 @override 10048 @override
9852 ExportDirective visitExportDirective(ExportDirective node) { 10049 ExportDirective visitExportDirective(ExportDirective node) {
9853 ExportDirective copy = new ExportDirective( 10050 ExportDirective copy = new ExportDirective(
9854 _cloneNode(node.documentationComment), 10051 _cloneNode(node.documentationComment),
9855 _cloneNodeList(node.metadata), 10052 _cloneNodeList(node.metadata),
(...skipping 13 matching lines...) Expand all
9869 _mapToken(node.functionDefinition), 10066 _mapToken(node.functionDefinition),
9870 _cloneNode(node.expression), 10067 _cloneNode(node.expression),
9871 _mapToken(node.semicolon)); 10068 _mapToken(node.semicolon));
9872 10069
9873 @override 10070 @override
9874 ExpressionStatement visitExpressionStatement(ExpressionStatement node) => 10071 ExpressionStatement visitExpressionStatement(ExpressionStatement node) =>
9875 new ExpressionStatement(_cloneNode(node.expression), _mapToken(node.semico lon)); 10072 new ExpressionStatement(_cloneNode(node.expression), _mapToken(node.semico lon));
9876 10073
9877 @override 10074 @override
9878 ExtendsClause visitExtendsClause(ExtendsClause node) => 10075 ExtendsClause visitExtendsClause(ExtendsClause node) =>
9879 new ExtendsClause(_mapToken(node.keyword), _cloneNode(node.superclass)); 10076 new ExtendsClause(_mapToken(node.extendsKeyword), _cloneNode(node.supercla ss));
9880 10077
9881 @override 10078 @override
9882 FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => 10079 FieldDeclaration visitFieldDeclaration(FieldDeclaration node) =>
9883 new FieldDeclaration( 10080 new FieldDeclaration(
9884 _cloneNode(node.documentationComment), 10081 _cloneNode(node.documentationComment),
9885 _cloneNodeList(node.metadata), 10082 _cloneNodeList(node.metadata),
9886 _mapToken(node.staticKeyword), 10083 _mapToken(node.staticKeyword),
9887 _cloneNode(node.fields), 10084 _cloneNode(node.fields),
9888 _mapToken(node.semicolon)); 10085 _mapToken(node.semicolon));
9889 10086
9890 @override 10087 @override
9891 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => 10088 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) =>
9892 new FieldFormalParameter( 10089 new FieldFormalParameter(
9893 _cloneNode(node.documentationComment), 10090 _cloneNode(node.documentationComment),
9894 _cloneNodeList(node.metadata), 10091 _cloneNodeList(node.metadata),
9895 _mapToken(node.keyword), 10092 _mapToken(node.keyword),
9896 _cloneNode(node.type), 10093 _cloneNode(node.type),
9897 _mapToken(node.thisToken), 10094 _mapToken(node.thisKeyword),
9898 _mapToken(node.period), 10095 _mapToken(node.period),
9899 _cloneNode(node.identifier), 10096 _cloneNode(node.identifier),
9900 _cloneNode(node.parameters)); 10097 _cloneNode(node.parameters));
9901 10098
9902 @override 10099 @override
9903 ForEachStatement visitForEachStatement(ForEachStatement node) { 10100 ForEachStatement visitForEachStatement(ForEachStatement node) {
9904 DeclaredIdentifier loopVariable = node.loopVariable; 10101 DeclaredIdentifier loopVariable = node.loopVariable;
9905 if (loopVariable == null) { 10102 if (loopVariable == null) {
9906 return new ForEachStatement.con2( 10103 return new ForEachStatement.con2(
9907 _mapToken(node.awaitKeyword), 10104 _mapToken(node.awaitKeyword),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
9984 copy.staticElement = node.staticElement; 10181 copy.staticElement = node.staticElement;
9985 copy.staticType = node.staticType; 10182 copy.staticType = node.staticType;
9986 return copy; 10183 return copy;
9987 } 10184 }
9988 10185
9989 @override 10186 @override
9990 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => 10187 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) =>
9991 new FunctionTypeAlias( 10188 new FunctionTypeAlias(
9992 _cloneNode(node.documentationComment), 10189 _cloneNode(node.documentationComment),
9993 _cloneNodeList(node.metadata), 10190 _cloneNodeList(node.metadata),
9994 _mapToken(node.keyword), 10191 _mapToken(node.typedefKeyword),
9995 _cloneNode(node.returnType), 10192 _cloneNode(node.returnType),
9996 _cloneNode(node.name), 10193 _cloneNode(node.name),
9997 _cloneNode(node.typeParameters), 10194 _cloneNode(node.typeParameters),
9998 _cloneNode(node.parameters), 10195 _cloneNode(node.parameters),
9999 _mapToken(node.semicolon)); 10196 _mapToken(node.semicolon));
10000 10197
10001 @override 10198 @override
10002 FunctionTypedFormalParameter 10199 FunctionTypedFormalParameter
10003 visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) => 10200 visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) =>
10004 new FunctionTypedFormalParameter( 10201 new FunctionTypedFormalParameter(
(...skipping 13 matching lines...) Expand all
10018 _mapToken(node.ifKeyword), 10215 _mapToken(node.ifKeyword),
10019 _mapToken(node.leftParenthesis), 10216 _mapToken(node.leftParenthesis),
10020 _cloneNode(node.condition), 10217 _cloneNode(node.condition),
10021 _mapToken(node.rightParenthesis), 10218 _mapToken(node.rightParenthesis),
10022 _cloneNode(node.thenStatement), 10219 _cloneNode(node.thenStatement),
10023 _mapToken(node.elseKeyword), 10220 _mapToken(node.elseKeyword),
10024 _cloneNode(node.elseStatement)); 10221 _cloneNode(node.elseStatement));
10025 10222
10026 @override 10223 @override
10027 ImplementsClause visitImplementsClause(ImplementsClause node) => 10224 ImplementsClause visitImplementsClause(ImplementsClause node) =>
10028 new ImplementsClause(_mapToken(node.keyword), _cloneNodeList(node.interfac es)); 10225 new ImplementsClause(_mapToken(node.implementsKeyword), _cloneNodeList(nod e.interfaces));
10029 10226
10030 @override 10227 @override
10031 ImportDirective visitImportDirective(ImportDirective node) => 10228 ImportDirective visitImportDirective(ImportDirective node) =>
10032 new ImportDirective( 10229 new ImportDirective(
10033 _cloneNode(node.documentationComment), 10230 _cloneNode(node.documentationComment),
10034 _cloneNodeList(node.metadata), 10231 _cloneNodeList(node.metadata),
10035 _mapToken(node.keyword), 10232 _mapToken(node.keyword),
10036 _cloneNode(node.uri), 10233 _cloneNode(node.uri),
10037 _mapToken(node.deferredToken), 10234 _mapToken(node.deferredKeyword),
10038 _mapToken(node.asToken), 10235 _mapToken(node.asKeyword),
10039 _cloneNode(node.prefix), 10236 _cloneNode(node.prefix),
10040 _cloneNodeList(node.combinators), 10237 _cloneNodeList(node.combinators),
10041 _mapToken(node.semicolon)); 10238 _mapToken(node.semicolon));
10042 10239
10043 @override 10240 @override
10044 IndexExpression visitIndexExpression(IndexExpression node) { 10241 IndexExpression visitIndexExpression(IndexExpression node) {
10045 Token period = _mapToken(node.period); 10242 Token period = _mapToken(node.period);
10046 IndexExpression copy; 10243 IndexExpression copy;
10047 if (period == null) { 10244 if (period == null) {
10048 copy = new IndexExpression.forTarget( 10245 copy = new IndexExpression.forTarget(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
10117 10314
10118 @override 10315 @override
10119 LabeledStatement visitLabeledStatement(LabeledStatement node) => 10316 LabeledStatement visitLabeledStatement(LabeledStatement node) =>
10120 new LabeledStatement(_cloneNodeList(node.labels), _cloneNode(node.statemen t)); 10317 new LabeledStatement(_cloneNodeList(node.labels), _cloneNode(node.statemen t));
10121 10318
10122 @override 10319 @override
10123 LibraryDirective visitLibraryDirective(LibraryDirective node) => 10320 LibraryDirective visitLibraryDirective(LibraryDirective node) =>
10124 new LibraryDirective( 10321 new LibraryDirective(
10125 _cloneNode(node.documentationComment), 10322 _cloneNode(node.documentationComment),
10126 _cloneNodeList(node.metadata), 10323 _cloneNodeList(node.metadata),
10127 _mapToken(node.libraryToken), 10324 _mapToken(node.libraryKeyword),
10128 _cloneNode(node.name), 10325 _cloneNode(node.name),
10129 _mapToken(node.semicolon)); 10326 _mapToken(node.semicolon));
10130 10327
10131 @override 10328 @override
10132 LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) { 10329 LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) {
10133 LibraryIdentifier copy = 10330 LibraryIdentifier copy =
10134 new LibraryIdentifier(_cloneNodeList(node.components)); 10331 new LibraryIdentifier(_cloneNodeList(node.components));
10135 copy.propagatedType = node.propagatedType; 10332 copy.propagatedType = node.propagatedType;
10136 copy.staticType = node.staticType; 10333 copy.staticType = node.staticType;
10137 return copy; 10334 return copy;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
10200 NamedExpression visitNamedExpression(NamedExpression node) { 10397 NamedExpression visitNamedExpression(NamedExpression node) {
10201 NamedExpression copy = 10398 NamedExpression copy =
10202 new NamedExpression(_cloneNode(node.name), _cloneNode(node.expression)); 10399 new NamedExpression(_cloneNode(node.name), _cloneNode(node.expression));
10203 copy.propagatedType = node.propagatedType; 10400 copy.propagatedType = node.propagatedType;
10204 copy.staticType = node.staticType; 10401 copy.staticType = node.staticType;
10205 return copy; 10402 return copy;
10206 } 10403 }
10207 10404
10208 @override 10405 @override
10209 AstNode visitNativeClause(NativeClause node) => 10406 AstNode visitNativeClause(NativeClause node) =>
10210 new NativeClause(_mapToken(node.keyword), _cloneNode(node.name)); 10407 new NativeClause(_mapToken(node.nativeKeyword), _cloneNode(node.name));
10211 10408
10212 @override 10409 @override
10213 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => 10410 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) =>
10214 new NativeFunctionBody( 10411 new NativeFunctionBody(
10215 _mapToken(node.nativeToken), 10412 _mapToken(node.nativeKeyword),
10216 _cloneNode(node.stringLiteral), 10413 _cloneNode(node.stringLiteral),
10217 _mapToken(node.semicolon)); 10414 _mapToken(node.semicolon));
10218 10415
10219 @override 10416 @override
10220 NullLiteral visitNullLiteral(NullLiteral node) { 10417 NullLiteral visitNullLiteral(NullLiteral node) {
10221 NullLiteral copy = new NullLiteral(_mapToken(node.literal)); 10418 NullLiteral copy = new NullLiteral(_mapToken(node.literal));
10222 copy.propagatedType = node.propagatedType; 10419 copy.propagatedType = node.propagatedType;
10223 copy.staticType = node.staticType; 10420 copy.staticType = node.staticType;
10224 return copy; 10421 return copy;
10225 } 10422 }
10226 10423
10227 @override 10424 @override
10228 ParenthesizedExpression 10425 ParenthesizedExpression
10229 visitParenthesizedExpression(ParenthesizedExpression node) { 10426 visitParenthesizedExpression(ParenthesizedExpression node) {
10230 ParenthesizedExpression copy = new ParenthesizedExpression( 10427 ParenthesizedExpression copy = new ParenthesizedExpression(
10231 _mapToken(node.leftParenthesis), 10428 _mapToken(node.leftParenthesis),
10232 _cloneNode(node.expression), 10429 _cloneNode(node.expression),
10233 _mapToken(node.rightParenthesis)); 10430 _mapToken(node.rightParenthesis));
10234 copy.propagatedType = node.propagatedType; 10431 copy.propagatedType = node.propagatedType;
10235 copy.staticType = node.staticType; 10432 copy.staticType = node.staticType;
10236 return copy; 10433 return copy;
10237 } 10434 }
10238 10435
10239 @override 10436 @override
10240 PartDirective visitPartDirective(PartDirective node) { 10437 PartDirective visitPartDirective(PartDirective node) {
10241 PartDirective copy = new PartDirective( 10438 PartDirective copy = new PartDirective(
10242 _cloneNode(node.documentationComment), 10439 _cloneNode(node.documentationComment),
10243 _cloneNodeList(node.metadata), 10440 _cloneNodeList(node.metadata),
10244 _mapToken(node.partToken), 10441 _mapToken(node.partKeyword),
10245 _cloneNode(node.uri), 10442 _cloneNode(node.uri),
10246 _mapToken(node.semicolon)); 10443 _mapToken(node.semicolon));
10247 copy.element = node.element; 10444 copy.element = node.element;
10248 return copy; 10445 return copy;
10249 } 10446 }
10250 10447
10251 @override 10448 @override
10252 PartOfDirective visitPartOfDirective(PartOfDirective node) { 10449 PartOfDirective visitPartOfDirective(PartOfDirective node) {
10253 PartOfDirective copy = new PartOfDirective( 10450 PartOfDirective copy = new PartOfDirective(
10254 _cloneNode(node.documentationComment), 10451 _cloneNode(node.documentationComment),
10255 _cloneNodeList(node.metadata), 10452 _cloneNodeList(node.metadata),
10256 _mapToken(node.partToken), 10453 _mapToken(node.partKeyword),
10257 _mapToken(node.ofToken), 10454 _mapToken(node.ofKeyword),
10258 _cloneNode(node.libraryName), 10455 _cloneNode(node.libraryName),
10259 _mapToken(node.semicolon)); 10456 _mapToken(node.semicolon));
10260 copy.element = node.element; 10457 copy.element = node.element;
10261 return copy; 10458 return copy;
10262 } 10459 }
10263 10460
10264 @override 10461 @override
10265 PostfixExpression visitPostfixExpression(PostfixExpression node) { 10462 PostfixExpression visitPostfixExpression(PostfixExpression node) {
10266 PostfixExpression copy = 10463 PostfixExpression copy =
10267 new PostfixExpression(_cloneNode(node.operand), _mapToken(node.operator) ); 10464 new PostfixExpression(_cloneNode(node.operand), _mapToken(node.operator) );
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
10303 copy.propagatedType = node.propagatedType; 10500 copy.propagatedType = node.propagatedType;
10304 copy.staticType = node.staticType; 10501 copy.staticType = node.staticType;
10305 return copy; 10502 return copy;
10306 } 10503 }
10307 10504
10308 @override 10505 @override
10309 RedirectingConstructorInvocation 10506 RedirectingConstructorInvocation
10310 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) { 10507 visitRedirectingConstructorInvocation(RedirectingConstructorInvocation nod e) {
10311 RedirectingConstructorInvocation copy = 10508 RedirectingConstructorInvocation copy =
10312 new RedirectingConstructorInvocation( 10509 new RedirectingConstructorInvocation(
10313 _mapToken(node.keyword), 10510 _mapToken(node.thisKeyword),
10314 _mapToken(node.period), 10511 _mapToken(node.period),
10315 _cloneNode(node.constructorName), 10512 _cloneNode(node.constructorName),
10316 _cloneNode(node.argumentList)); 10513 _cloneNode(node.argumentList));
10317 copy.staticElement = node.staticElement; 10514 copy.staticElement = node.staticElement;
10318 return copy; 10515 return copy;
10319 } 10516 }
10320 10517
10321 @override 10518 @override
10322 RethrowExpression visitRethrowExpression(RethrowExpression node) { 10519 RethrowExpression visitRethrowExpression(RethrowExpression node) {
10323 RethrowExpression copy = new RethrowExpression(_mapToken(node.keyword)); 10520 RethrowExpression copy = new RethrowExpression(_mapToken(node.rethrowKeyword ));
10324 copy.propagatedType = node.propagatedType; 10521 copy.propagatedType = node.propagatedType;
10325 copy.staticType = node.staticType; 10522 copy.staticType = node.staticType;
10326 return copy; 10523 return copy;
10327 } 10524 }
10328 10525
10329 @override 10526 @override
10330 ReturnStatement visitReturnStatement(ReturnStatement node) => 10527 ReturnStatement visitReturnStatement(ReturnStatement node) =>
10331 new ReturnStatement( 10528 new ReturnStatement(
10332 _mapToken(node.keyword), 10529 _mapToken(node.returnKeyword),
10333 _cloneNode(node.expression), 10530 _cloneNode(node.expression),
10334 _mapToken(node.semicolon)); 10531 _mapToken(node.semicolon));
10335 10532
10336 @override 10533 @override
10337 ScriptTag visitScriptTag(ScriptTag node) => 10534 ScriptTag visitScriptTag(ScriptTag node) =>
10338 new ScriptTag(_mapToken(node.scriptTag)); 10535 new ScriptTag(_mapToken(node.scriptTag));
10339 10536
10340 @override 10537 @override
10341 ShowCombinator visitShowCombinator(ShowCombinator node) => 10538 ShowCombinator visitShowCombinator(ShowCombinator node) =>
10342 new ShowCombinator(_mapToken(node.keyword), _cloneNodeList(node.shownNames )); 10539 new ShowCombinator(_mapToken(node.keyword), _cloneNodeList(node.shownNames ));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
10386 new StringInterpolation(_cloneNodeList(node.elements)); 10583 new StringInterpolation(_cloneNodeList(node.elements));
10387 copy.propagatedType = node.propagatedType; 10584 copy.propagatedType = node.propagatedType;
10388 copy.staticType = node.staticType; 10585 copy.staticType = node.staticType;
10389 return copy; 10586 return copy;
10390 } 10587 }
10391 10588
10392 @override 10589 @override
10393 SuperConstructorInvocation 10590 SuperConstructorInvocation
10394 visitSuperConstructorInvocation(SuperConstructorInvocation node) { 10591 visitSuperConstructorInvocation(SuperConstructorInvocation node) {
10395 SuperConstructorInvocation copy = new SuperConstructorInvocation( 10592 SuperConstructorInvocation copy = new SuperConstructorInvocation(
10396 _mapToken(node.keyword), 10593 _mapToken(node.superKeyword),
10397 _mapToken(node.period), 10594 _mapToken(node.period),
10398 _cloneNode(node.constructorName), 10595 _cloneNode(node.constructorName),
10399 _cloneNode(node.argumentList)); 10596 _cloneNode(node.argumentList));
10400 copy.staticElement = node.staticElement; 10597 copy.staticElement = node.staticElement;
10401 return copy; 10598 return copy;
10402 } 10599 }
10403 10600
10404 @override 10601 @override
10405 SuperExpression visitSuperExpression(SuperExpression node) { 10602 SuperExpression visitSuperExpression(SuperExpression node) {
10406 SuperExpression copy = new SuperExpression(_mapToken(node.keyword)); 10603 SuperExpression copy = new SuperExpression(_mapToken(node.superKeyword));
10407 copy.propagatedType = node.propagatedType; 10604 copy.propagatedType = node.propagatedType;
10408 copy.staticType = node.staticType; 10605 copy.staticType = node.staticType;
10409 return copy; 10606 return copy;
10410 } 10607 }
10411 10608
10412 @override 10609 @override
10413 SwitchCase visitSwitchCase(SwitchCase node) => 10610 SwitchCase visitSwitchCase(SwitchCase node) =>
10414 new SwitchCase( 10611 new SwitchCase(
10415 _cloneNodeList(node.labels), 10612 _cloneNodeList(node.labels),
10416 _mapToken(node.keyword), 10613 _mapToken(node.keyword),
10417 _cloneNode(node.expression), 10614 _cloneNode(node.expression),
10418 _mapToken(node.colon), 10615 _mapToken(node.colon),
10419 _cloneNodeList(node.statements)); 10616 _cloneNodeList(node.statements));
10420 10617
10421 @override 10618 @override
10422 SwitchDefault visitSwitchDefault(SwitchDefault node) => 10619 SwitchDefault visitSwitchDefault(SwitchDefault node) =>
10423 new SwitchDefault( 10620 new SwitchDefault(
10424 _cloneNodeList(node.labels), 10621 _cloneNodeList(node.labels),
10425 _mapToken(node.keyword), 10622 _mapToken(node.keyword),
10426 _mapToken(node.colon), 10623 _mapToken(node.colon),
10427 _cloneNodeList(node.statements)); 10624 _cloneNodeList(node.statements));
10428 10625
10429 @override 10626 @override
10430 SwitchStatement visitSwitchStatement(SwitchStatement node) => 10627 SwitchStatement visitSwitchStatement(SwitchStatement node) =>
10431 new SwitchStatement( 10628 new SwitchStatement(
10432 _mapToken(node.keyword), 10629 _mapToken(node.switchKeyword),
10433 _mapToken(node.leftParenthesis), 10630 _mapToken(node.leftParenthesis),
10434 _cloneNode(node.expression), 10631 _cloneNode(node.expression),
10435 _mapToken(node.rightParenthesis), 10632 _mapToken(node.rightParenthesis),
10436 _mapToken(node.leftBracket), 10633 _mapToken(node.leftBracket),
10437 _cloneNodeList(node.members), 10634 _cloneNodeList(node.members),
10438 _mapToken(node.rightBracket)); 10635 _mapToken(node.rightBracket));
10439 10636
10440 @override 10637 @override
10441 AstNode visitSymbolLiteral(SymbolLiteral node) { 10638 AstNode visitSymbolLiteral(SymbolLiteral node) {
10442 SymbolLiteral copy = 10639 SymbolLiteral copy =
10443 new SymbolLiteral(_mapToken(node.poundSign), _mapTokens(node.components) ); 10640 new SymbolLiteral(_mapToken(node.poundSign), _mapTokens(node.components) );
10444 copy.propagatedType = node.propagatedType; 10641 copy.propagatedType = node.propagatedType;
10445 copy.staticType = node.staticType; 10642 copy.staticType = node.staticType;
10446 return copy; 10643 return copy;
10447 } 10644 }
10448 10645
10449 @override 10646 @override
10450 ThisExpression visitThisExpression(ThisExpression node) { 10647 ThisExpression visitThisExpression(ThisExpression node) {
10451 ThisExpression copy = new ThisExpression(_mapToken(node.keyword)); 10648 ThisExpression copy = new ThisExpression(_mapToken(node.thisKeyword));
10452 copy.propagatedType = node.propagatedType; 10649 copy.propagatedType = node.propagatedType;
10453 copy.staticType = node.staticType; 10650 copy.staticType = node.staticType;
10454 return copy; 10651 return copy;
10455 } 10652 }
10456 10653
10457 @override 10654 @override
10458 ThrowExpression visitThrowExpression(ThrowExpression node) { 10655 ThrowExpression visitThrowExpression(ThrowExpression node) {
10459 ThrowExpression copy = 10656 ThrowExpression copy =
10460 new ThrowExpression(_mapToken(node.keyword), _cloneNode(node.expression) ); 10657 new ThrowExpression(_mapToken(node.throwKeyword), _cloneNode(node.expres sion));
10461 copy.propagatedType = node.propagatedType; 10658 copy.propagatedType = node.propagatedType;
10462 copy.staticType = node.staticType; 10659 copy.staticType = node.staticType;
10463 return copy; 10660 return copy;
10464 } 10661 }
10465 10662
10466 @override 10663 @override
10467 TopLevelVariableDeclaration 10664 TopLevelVariableDeclaration
10468 visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => 10665 visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) =>
10469 new TopLevelVariableDeclaration( 10666 new TopLevelVariableDeclaration(
10470 _cloneNode(node.documentationComment), 10667 _cloneNode(node.documentationComment),
(...skipping 24 matching lines...) Expand all
10495 copy.type = node.type; 10692 copy.type = node.type;
10496 return copy; 10693 return copy;
10497 } 10694 }
10498 10695
10499 @override 10696 @override
10500 TypeParameter visitTypeParameter(TypeParameter node) => 10697 TypeParameter visitTypeParameter(TypeParameter node) =>
10501 new TypeParameter( 10698 new TypeParameter(
10502 _cloneNode(node.documentationComment), 10699 _cloneNode(node.documentationComment),
10503 _cloneNodeList(node.metadata), 10700 _cloneNodeList(node.metadata),
10504 _cloneNode(node.name), 10701 _cloneNode(node.name),
10505 _mapToken(node.keyword), 10702 _mapToken(node.extendsKeyword),
10506 _cloneNode(node.bound)); 10703 _cloneNode(node.bound));
10507 10704
10508 @override 10705 @override
10509 TypeParameterList visitTypeParameterList(TypeParameterList node) => 10706 TypeParameterList visitTypeParameterList(TypeParameterList node) =>
10510 new TypeParameterList( 10707 new TypeParameterList(
10511 _mapToken(node.leftBracket), 10708 _mapToken(node.leftBracket),
10512 _cloneNodeList(node.typeParameters), 10709 _cloneNodeList(node.typeParameters),
10513 _mapToken(node.rightBracket)); 10710 _mapToken(node.rightBracket));
10514 10711
10515 @override 10712 @override
(...skipping 18 matching lines...) Expand all
10534 @override 10731 @override
10535 VariableDeclarationStatement 10732 VariableDeclarationStatement
10536 visitVariableDeclarationStatement(VariableDeclarationStatement node) => 10733 visitVariableDeclarationStatement(VariableDeclarationStatement node) =>
10537 new VariableDeclarationStatement( 10734 new VariableDeclarationStatement(
10538 _cloneNode(node.variables), 10735 _cloneNode(node.variables),
10539 _mapToken(node.semicolon)); 10736 _mapToken(node.semicolon));
10540 10737
10541 @override 10738 @override
10542 WhileStatement visitWhileStatement(WhileStatement node) => 10739 WhileStatement visitWhileStatement(WhileStatement node) =>
10543 new WhileStatement( 10740 new WhileStatement(
10544 _mapToken(node.keyword), 10741 _mapToken(node.whileKeyword),
10545 _mapToken(node.leftParenthesis), 10742 _mapToken(node.leftParenthesis),
10546 _cloneNode(node.condition), 10743 _cloneNode(node.condition),
10547 _mapToken(node.rightParenthesis), 10744 _mapToken(node.rightParenthesis),
10548 _cloneNode(node.body)); 10745 _cloneNode(node.body));
10549 10746
10550 @override 10747 @override
10551 WithClause visitWithClause(WithClause node) => 10748 WithClause visitWithClause(WithClause node) =>
10552 new WithClause(_mapToken(node.withKeyword), _cloneNodeList(node.mixinTypes )); 10749 new WithClause(_mapToken(node.withKeyword), _cloneNodeList(node.mixinTypes ));
10553 10750
10554 @override 10751 @override
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
10647 * information. The auxiliary element will hold onto the elements from the 10844 * information. The auxiliary element will hold onto the elements from the
10648 * getter context. 10845 * getter context.
10649 */ 10846 */
10650 AuxiliaryElements auxiliaryElements = null; 10847 AuxiliaryElements auxiliaryElements = null;
10651 10848
10652 /** 10849 /**
10653 * Initialize a newly created index expression. 10850 * Initialize a newly created index expression.
10654 */ 10851 */
10655 IndexExpression.forCascade(this.period, this.leftBracket, Expression index, 10852 IndexExpression.forCascade(this.period, this.leftBracket, Expression index,
10656 this.rightBracket) { 10853 this.rightBracket) {
10657 _index = becomeParentOf(index); 10854 _index = _becomeParentOf(index);
10658 } 10855 }
10659 10856
10660 /** 10857 /**
10661 * Initialize a newly created index expression. 10858 * Initialize a newly created index expression.
10662 */ 10859 */
10663 IndexExpression.forTarget(Expression target, this.leftBracket, 10860 IndexExpression.forTarget(Expression target, this.leftBracket,
10664 Expression index, this.rightBracket) { 10861 Expression index, this.rightBracket) {
10665 _target = becomeParentOf(target); 10862 _target = _becomeParentOf(target);
10666 _index = becomeParentOf(index); 10863 _index = _becomeParentOf(index);
10667 } 10864 }
10668 10865
10669 @override 10866 @override
10670 Token get beginToken { 10867 Token get beginToken {
10671 if (_target != null) { 10868 if (_target != null) {
10672 return _target.beginToken; 10869 return _target.beginToken;
10673 } 10870 }
10674 return period; 10871 return period;
10675 } 10872 }
10676 10873
10677 /** 10874 /**
10678 * Return the best element available for this operator. If resolution was able 10875 * Return the best element available for this operator. If resolution was able
10679 * to find a better element based on type propagation, that element will be 10876 * to find a better element based on type propagation, that element will be
10680 * returned. Otherwise, the element found using the result of static analysis 10877 * returned. Otherwise, the element found using the result of static analysis
10681 * will be returned. If resolution has not been performed, then `null` will be 10878 * will be returned. If resolution has not been performed, then `null` will be
10682 * returned. 10879 * returned.
10683 */ 10880 */
10684 MethodElement get bestElement { 10881 MethodElement get bestElement {
10685 MethodElement element = propagatedElement; 10882 MethodElement element = propagatedElement;
10686 if (element == null) { 10883 if (element == null) {
10687 element = staticElement; 10884 element = staticElement;
10688 } 10885 }
10689 return element; 10886 return element;
10690 } 10887 }
10691 10888
10692 /**
10693 * TODO(paulberry): untested.
10694 */
10695 @override 10889 @override
10696 Iterable get childEntities => new ChildEntities() 10890 Iterable get childEntities => new ChildEntities()
10697 ..add(_target) 10891 ..add(_target)
10698 ..add(period) 10892 ..add(period)
10699 ..add(leftBracket) 10893 ..add(leftBracket)
10700 ..add(_index) 10894 ..add(_index)
10701 ..add(rightBracket); 10895 ..add(rightBracket);
10702 10896
10703 @override 10897 @override
10704 Token get endToken => rightBracket; 10898 Token get endToken => rightBracket;
10705 10899
10706 /** 10900 /**
10707 * Return the expression used to compute the index. 10901 * Return the expression used to compute the index.
10708 */ 10902 */
10709 Expression get index => _index; 10903 Expression get index => _index;
10710 10904
10711 /** 10905 /**
10712 * Set the expression used to compute the index to the given [expression]. 10906 * Set the expression used to compute the index to the given [expression].
10713 */ 10907 */
10714 void set index(Expression expression) { 10908 void set index(Expression expression) {
10715 _index = becomeParentOf(expression); 10909 _index = _becomeParentOf(expression);
10716 } 10910 }
10717 10911
10718 @override 10912 @override
10719 bool get isAssignable => true; 10913 bool get isAssignable => true;
10720 10914
10721 /** 10915 /**
10722 * Return `true` if this expression is cascaded. If it is, then the target of 10916 * Return `true` if this expression is cascaded. If it is, then the target of
10723 * this expression is not stored locally but is stored in the nearest ancestor 10917 * this expression is not stored locally but is stored in the nearest ancestor
10724 * that is a [CascadeExpression]. 10918 * that is a [CascadeExpression].
10725 */ 10919 */
10726 bool get isCascaded => period != null; 10920 bool get isCascaded => period != null;
10727 10921
10728 @override 10922 @override
10729 int get precedence => 15; 10923 int get precedence => 15;
10730 10924
10731 /** 10925 /**
10732 * If the AST structure has been resolved, and the function being invoked is 10926 * If the AST structure has been resolved, and the function being invoked is
10733 * known based on propagated type information, then return the parameter 10927 * known based on propagated type information, then return the parameter
10734 * element representing the parameter to which the value of the index 10928 * element representing the parameter to which the value of the index
10735 * expression will be bound. Otherwise, return `null`. 10929 * expression will be bound. Otherwise, return `null`.
10736 *
10737 * This method is only intended to be used by
10738 * [Expression.propagatedParameterElement].
10739 */ 10930 */
10931 @deprecated // Use "expression.propagatedParameterElement"
10740 ParameterElement get propagatedParameterElementForIndex { 10932 ParameterElement get propagatedParameterElementForIndex {
10741 if (propagatedElement == null) { 10933 return _propagatedParameterElementForIndex;
10742 return null;
10743 }
10744 List<ParameterElement> parameters = propagatedElement.parameters;
10745 if (parameters.length < 1) {
10746 return null;
10747 }
10748 return parameters[0];
10749 } 10934 }
10750 10935
10751 /** 10936 /**
10752 * Return the expression used to compute the object being indexed. If this 10937 * Return the expression used to compute the object being indexed. If this
10753 * index expression is not part of a cascade expression, then this is the same 10938 * index expression is not part of a cascade expression, then this is the same
10754 * as [target]. If this index expression is part of a cascade expression, then 10939 * as [target]. If this index expression is part of a cascade expression, then
10755 * the target expression stored with the cascade expression is returned. 10940 * the target expression stored with the cascade expression is returned.
10756 */ 10941 */
10757 Expression get realTarget { 10942 Expression get realTarget {
10758 if (isCascaded) { 10943 if (isCascaded) {
10759 AstNode ancestor = parent; 10944 AstNode ancestor = parent;
10760 while (ancestor is! CascadeExpression) { 10945 while (ancestor is! CascadeExpression) {
10761 if (ancestor == null) { 10946 if (ancestor == null) {
10762 return _target; 10947 return _target;
10763 } 10948 }
10764 ancestor = ancestor.parent; 10949 ancestor = ancestor.parent;
10765 } 10950 }
10766 return (ancestor as CascadeExpression).target; 10951 return (ancestor as CascadeExpression).target;
10767 } 10952 }
10768 return _target; 10953 return _target;
10769 } 10954 }
10770 10955
10771 /** 10956 /**
10772 * If the AST structure has been resolved, and the function being invoked is 10957 * If the AST structure has been resolved, and the function being invoked is
10773 * known based on static type information, then return the parameter element 10958 * known based on static type information, then return the parameter element
10774 * representing the parameter to which the value of the index expression will 10959 * representing the parameter to which the value of the index expression will
10775 * be bound. Otherwise, return `null`. 10960 * be bound. Otherwise, return `null`.
10776 *
10777 * This method is only intended to be used by
10778 * [Expression.staticParameterElement].
10779 */ 10961 */
10962 @deprecated // Use "expression.propagatedParameterElement"
10780 ParameterElement get staticParameterElementForIndex { 10963 ParameterElement get staticParameterElementForIndex {
10781 if (staticElement == null) { 10964 return _staticParameterElementForIndex;
10782 return null;
10783 }
10784 List<ParameterElement> parameters = staticElement.parameters;
10785 if (parameters.length < 1) {
10786 return null;
10787 }
10788 return parameters[0];
10789 } 10965 }
10790 10966
10791 /** 10967 /**
10792 * Return the expression used to compute the object being indexed, or `null` 10968 * Return the expression used to compute the object being indexed, or `null`
10793 * if this index expression is part of a cascade expression. 10969 * if this index expression is part of a cascade expression.
10794 * 10970 *
10795 * Use [realTarget] to get the target independent of whether this is part of a 10971 * Use [realTarget] to get the target independent of whether this is part of a
10796 * cascade expression. 10972 * cascade expression.
10797 */ 10973 */
10798 Expression get target => _target; 10974 Expression get target => _target;
10799 10975
10800 /** 10976 /**
10801 * Set the expression used to compute the object being indexed to the given 10977 * Set the expression used to compute the object being indexed to the given
10802 * [expression]. 10978 * [expression].
10803 */ 10979 */
10804 void set target(Expression expression) { 10980 void set target(Expression expression) {
10805 _target = becomeParentOf(expression); 10981 _target = _becomeParentOf(expression);
10982 }
10983
10984 /**
10985 * If the AST structure has been resolved, and the function being invoked is
10986 * known based on propagated type information, then return the parameter
10987 * element representing the parameter to which the value of the index
10988 * expression will be bound. Otherwise, return `null`.
10989 */
10990 ParameterElement get _propagatedParameterElementForIndex {
10991 if (propagatedElement == null) {
10992 return null;
10993 }
10994 List<ParameterElement> parameters = propagatedElement.parameters;
10995 if (parameters.length < 1) {
10996 return null;
10997 }
10998 return parameters[0];
10999 }
11000
11001 /**
11002 * If the AST structure has been resolved, and the function being invoked is
11003 * known based on static type information, then return the parameter element
11004 * representing the parameter to which the value of the index expression will
11005 * be bound. Otherwise, return `null`.
11006 */
11007 ParameterElement get _staticParameterElementForIndex {
11008 if (staticElement == null) {
11009 return null;
11010 }
11011 List<ParameterElement> parameters = staticElement.parameters;
11012 if (parameters.length < 1) {
11013 return null;
11014 }
11015 return parameters[0];
10806 } 11016 }
10807 11017
10808 @override 11018 @override
10809 accept(AstVisitor visitor) => visitor.visitIndexExpression(this); 11019 accept(AstVisitor visitor) => visitor.visitIndexExpression(this);
10810 11020
10811 /** 11021 /**
10812 * Return `true` if this expression is computing a right-hand value (that is, 11022 * Return `true` if this expression is computing a right-hand value (that is,
10813 * if this expression is in a context where the operator '[]' will be 11023 * if this expression is in a context where the operator '[]' will be
10814 * invoked). 11024 * invoked).
10815 * 11025 *
10816 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor 11026 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor
10817 * are they mutually exclusive. In other words, it is possible for both 11027 * are they mutually exclusive. In other words, it is possible for both
10818 * methods to return `true` when invoked on the same node. 11028 * methods to return `true` when invoked on the same node.
10819 */ 11029 */
10820 bool inGetterContext() { 11030 bool inGetterContext() {
11031 // TODO(brianwilkerson) Convert this to a getter.
10821 AstNode parent = this.parent; 11032 AstNode parent = this.parent;
10822 if (parent is AssignmentExpression) { 11033 if (parent is AssignmentExpression) {
10823 AssignmentExpression assignment = parent; 11034 AssignmentExpression assignment = parent;
10824 if (identical(assignment.leftHandSide, this) && 11035 if (identical(assignment.leftHandSide, this) &&
10825 assignment.operator.type == TokenType.EQ) { 11036 assignment.operator.type == TokenType.EQ) {
10826 return false; 11037 return false;
10827 } 11038 }
10828 } 11039 }
10829 return true; 11040 return true;
10830 } 11041 }
10831 11042
10832 /** 11043 /**
10833 * Return `true` if this expression is computing a left-hand value (that is, 11044 * Return `true` if this expression is computing a left-hand value (that is,
10834 * if this expression is in a context where the operator '[]=' will be 11045 * if this expression is in a context where the operator '[]=' will be
10835 * invoked). 11046 * invoked).
10836 * 11047 *
10837 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor 11048 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor
10838 * are they mutually exclusive. In other words, it is possible for both 11049 * are they mutually exclusive. In other words, it is possible for both
10839 * methods to return `true` when invoked on the same node. 11050 * methods to return `true` when invoked on the same node.
10840 */ 11051 */
10841 bool inSetterContext() { 11052 bool inSetterContext() {
11053 // TODO(brianwilkerson) Convert this to a getter.
10842 AstNode parent = this.parent; 11054 AstNode parent = this.parent;
10843 if (parent is PrefixExpression) { 11055 if (parent is PrefixExpression) {
10844 return parent.operator.type.isIncrementOperator; 11056 return parent.operator.type.isIncrementOperator;
10845 } else if (parent is PostfixExpression) { 11057 } else if (parent is PostfixExpression) {
10846 return true; 11058 return true;
10847 } else if (parent is AssignmentExpression) { 11059 } else if (parent is AssignmentExpression) {
10848 return identical(parent.leftHandSide, this); 11060 return identical(parent.leftHandSide, this);
10849 } 11061 }
10850 return false; 11062 return false;
10851 } 11063 }
10852 11064
10853 @override 11065 @override
10854 void visitChildren(AstVisitor visitor) { 11066 void visitChildren(AstVisitor visitor) {
10855 _safelyVisitChild(_target, visitor); 11067 _safelyVisitChild(_target, visitor);
10856 _safelyVisitChild(_index, visitor); 11068 _safelyVisitChild(_index, visitor);
10857 } 11069 }
10858 } 11070 }
10859 11071
10860 /** 11072 /**
10861 * An instance creation expression. 11073 * An instance creation expression.
10862 * 11074 *
10863 * > newExpression ::= 11075 * > newExpression ::=
10864 * > ('new' | 'const') [TypeName] ('.' [SimpleIdentifier])? [ArgumentList] 11076 * > ('new' | 'const') [TypeName] ('.' [SimpleIdentifier])? [ArgumentList]
10865 */ 11077 */
10866 class InstanceCreationExpression extends Expression { 11078 class InstanceCreationExpression extends Expression {
10867 /** 11079 /**
10868 * The keyword used to indicate how an object should be created. 11080 * The 'new' or 'const' keyword used to indicate how an object should be
11081 * created.
10869 */ 11082 */
10870 Token keyword; 11083 Token keyword;
10871 11084
10872 /** 11085 /**
10873 * The name of the constructor to be invoked. 11086 * The name of the constructor to be invoked.
10874 */ 11087 */
10875 ConstructorName _constructorName; 11088 ConstructorName _constructorName;
10876 11089
10877 /** 11090 /**
10878 * The list of arguments to the constructor. 11091 * The list of arguments to the constructor.
(...skipping 10 matching lines...) Expand all
10889 /** 11102 /**
10890 * The result of evaluating this expression, if it is constant. 11103 * The result of evaluating this expression, if it is constant.
10891 */ 11104 */
10892 EvaluationResultImpl evaluationResult; 11105 EvaluationResultImpl evaluationResult;
10893 11106
10894 /** 11107 /**
10895 * Initialize a newly created instance creation expression. 11108 * Initialize a newly created instance creation expression.
10896 */ 11109 */
10897 InstanceCreationExpression(this.keyword, ConstructorName constructorName, 11110 InstanceCreationExpression(this.keyword, ConstructorName constructorName,
10898 ArgumentList argumentList) { 11111 ArgumentList argumentList) {
10899 _constructorName = becomeParentOf(constructorName); 11112 _constructorName = _becomeParentOf(constructorName);
10900 _argumentList = becomeParentOf(argumentList); 11113 _argumentList = _becomeParentOf(argumentList);
10901 } 11114 }
10902 11115
10903 /** 11116 /**
10904 * Return the list of arguments to the constructor. 11117 * Return the list of arguments to the constructor.
10905 */ 11118 */
10906 ArgumentList get argumentList => _argumentList; 11119 ArgumentList get argumentList => _argumentList;
10907 11120
10908 /** 11121 /**
10909 * Set the list of arguments to the constructor to the given [argumentList]. 11122 * Set the list of arguments to the constructor to the given [argumentList].
10910 */ 11123 */
10911 void set argumentList(ArgumentList argumentList) { 11124 void set argumentList(ArgumentList argumentList) {
10912 _argumentList = becomeParentOf(argumentList); 11125 _argumentList = _becomeParentOf(argumentList);
10913 } 11126 }
10914 11127
10915 @override 11128 @override
10916 Token get beginToken => keyword; 11129 Token get beginToken => keyword;
10917 11130
10918 @override 11131 @override
10919 Iterable get childEntities => new ChildEntities() 11132 Iterable get childEntities => new ChildEntities()
10920 ..add(keyword) 11133 ..add(keyword)
10921 ..add(_constructorName) 11134 ..add(_constructorName)
10922 ..add(_argumentList); 11135 ..add(_argumentList);
10923 11136
10924 /** 11137 /**
10925 * Return the name of the constructor to be invoked. 11138 * Return the name of the constructor to be invoked.
10926 */ 11139 */
10927 ConstructorName get constructorName => _constructorName; 11140 ConstructorName get constructorName => _constructorName;
10928 11141
10929 /** 11142 /**
10930 * Set the name of the constructor to be invoked to the given [name]. 11143 * Set the name of the constructor to be invoked to the given [name].
10931 */ 11144 */
10932 void set constructorName(ConstructorName name) { 11145 void set constructorName(ConstructorName name) {
10933 _constructorName = becomeParentOf(name); 11146 _constructorName = _becomeParentOf(name);
10934 } 11147 }
10935 11148
10936 @override 11149 @override
10937 Token get endToken => _argumentList.endToken; 11150 Token get endToken => _argumentList.endToken;
10938 11151
10939 /** 11152 /**
10940 * Return `true` if this creation expression is used to invoke a constant 11153 * Return `true` if this creation expression is used to invoke a constant
10941 * constructor. 11154 * constructor.
10942 */ 11155 */
10943 bool get isConst => 11156 bool get isConst =>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
10982 int value = 0; 11195 int value = 0;
10983 11196
10984 /** 11197 /**
10985 * Initialize a newly created integer literal. 11198 * Initialize a newly created integer literal.
10986 */ 11199 */
10987 IntegerLiteral(this.literal, this.value); 11200 IntegerLiteral(this.literal, this.value);
10988 11201
10989 @override 11202 @override
10990 Token get beginToken => literal; 11203 Token get beginToken => literal;
10991 11204
10992 /**
10993 * TODO(paulberry): untested.
10994 */
10995 @override 11205 @override
10996 Iterable get childEntities => new ChildEntities()..add(literal); 11206 Iterable get childEntities => new ChildEntities()..add(literal);
10997 11207
10998 @override 11208 @override
10999 Token get endToken => literal; 11209 Token get endToken => literal;
11000 11210
11001 @override 11211 @override
11002 accept(AstVisitor visitor) => visitor.visitIntegerLiteral(this); 11212 accept(AstVisitor visitor) => visitor.visitIntegerLiteral(this);
11003 11213
11004 @override 11214 @override
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
11041 * The right curly bracket, or `null` if the expression is an identifier 11251 * The right curly bracket, or `null` if the expression is an identifier
11042 * without brackets. 11252 * without brackets.
11043 */ 11253 */
11044 Token rightBracket; 11254 Token rightBracket;
11045 11255
11046 /** 11256 /**
11047 * Initialize a newly created interpolation expression. 11257 * Initialize a newly created interpolation expression.
11048 */ 11258 */
11049 InterpolationExpression(this.leftBracket, Expression expression, 11259 InterpolationExpression(this.leftBracket, Expression expression,
11050 this.rightBracket) { 11260 this.rightBracket) {
11051 _expression = becomeParentOf(expression); 11261 _expression = _becomeParentOf(expression);
11052 } 11262 }
11053 11263
11054 @override 11264 @override
11055 Token get beginToken => leftBracket; 11265 Token get beginToken => leftBracket;
11056 11266
11057 @override 11267 @override
11058 Iterable get childEntities => new ChildEntities() 11268 Iterable get childEntities => new ChildEntities()
11059 ..add(leftBracket) 11269 ..add(leftBracket)
11060 ..add(_expression) 11270 ..add(_expression)
11061 ..add(rightBracket); 11271 ..add(rightBracket);
(...skipping 10 matching lines...) Expand all
11072 * Return the expression to be evaluated for the value to be converted into a 11282 * Return the expression to be evaluated for the value to be converted into a
11073 * string. 11283 * string.
11074 */ 11284 */
11075 Expression get expression => _expression; 11285 Expression get expression => _expression;
11076 11286
11077 /** 11287 /**
11078 * Set the expression to be evaluated for the value to be converted into a 11288 * Set the expression to be evaluated for the value to be converted into a
11079 * string to the given [expression]. 11289 * string to the given [expression].
11080 */ 11290 */
11081 void set expression(Expression expression) { 11291 void set expression(Expression expression) {
11082 _expression = becomeParentOf(expression); 11292 _expression = _becomeParentOf(expression);
11083 } 11293 }
11084 11294
11085 @override 11295 @override
11086 accept(AstVisitor visitor) => visitor.visitInterpolationExpression(this); 11296 accept(AstVisitor visitor) => visitor.visitInterpolationExpression(this);
11087 11297
11088 @override 11298 @override
11089 void visitChildren(AstVisitor visitor) { 11299 void visitChildren(AstVisitor visitor) {
11090 _safelyVisitChild(_expression, visitor); 11300 _safelyVisitChild(_expression, visitor);
11091 } 11301 }
11092 } 11302 }
(...skipping 19 matching lines...) Expand all
11112 * Initialize a newly created string of characters that are part of a string 11322 * Initialize a newly created string of characters that are part of a string
11113 * interpolation. 11323 * interpolation.
11114 */ 11324 */
11115 InterpolationString(this.contents, String value) { 11325 InterpolationString(this.contents, String value) {
11116 _value = value; 11326 _value = value;
11117 } 11327 }
11118 11328
11119 @override 11329 @override
11120 Token get beginToken => contents; 11330 Token get beginToken => contents;
11121 11331
11122 /**
11123 * TODO(paulberry): untested.
11124 */
11125 @override 11332 @override
11126 Iterable get childEntities => new ChildEntities()..add(contents); 11333 Iterable get childEntities => new ChildEntities()..add(contents);
11127 11334
11128 /** 11335 /**
11129 * Return the offset of the after-last contents character. 11336 * Return the offset of the after-last contents character.
11130 */ 11337 */
11131 int get contentsEnd { 11338 int get contentsEnd {
11132 int end = contents.end; 11339 int end = contents.end;
11133 String lexeme = contents.lexeme; 11340 String lexeme = contents.lexeme;
11134 if (StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || 11341 if (StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) ||
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
11207 * The name of the type being tested for. 11414 * The name of the type being tested for.
11208 */ 11415 */
11209 TypeName _type; 11416 TypeName _type;
11210 11417
11211 /** 11418 /**
11212 * Initialize a newly created is expression. The [notOperator] can be `null` 11419 * Initialize a newly created is expression. The [notOperator] can be `null`
11213 * if the sense of the test is not negated. 11420 * if the sense of the test is not negated.
11214 */ 11421 */
11215 IsExpression(Expression expression, this.isOperator, this.notOperator, 11422 IsExpression(Expression expression, this.isOperator, this.notOperator,
11216 TypeName type) { 11423 TypeName type) {
11217 _expression = becomeParentOf(expression); 11424 _expression = _becomeParentOf(expression);
11218 _type = becomeParentOf(type); 11425 _type = _becomeParentOf(type);
11219 } 11426 }
11220 11427
11221 @override 11428 @override
11222 Token get beginToken => _expression.beginToken; 11429 Token get beginToken => _expression.beginToken;
11223 11430
11224 @override 11431 @override
11225 Iterable get childEntities => new ChildEntities() 11432 Iterable get childEntities => new ChildEntities()
11226 ..add(_expression) 11433 ..add(_expression)
11227 ..add(isOperator) 11434 ..add(isOperator)
11228 ..add(notOperator) 11435 ..add(notOperator)
11229 ..add(_type); 11436 ..add(_type);
11230 11437
11231 @override 11438 @override
11232 Token get endToken => _type.endToken; 11439 Token get endToken => _type.endToken;
11233 11440
11234 /** 11441 /**
11235 * Return the expression used to compute the value whose type is being tested. 11442 * Return the expression used to compute the value whose type is being tested.
11236 */ 11443 */
11237 Expression get expression => _expression; 11444 Expression get expression => _expression;
11238 11445
11239 /** 11446 /**
11240 * Set the expression used to compute the value whose type is being tested to 11447 * Set the expression used to compute the value whose type is being tested to
11241 * the given [expression]. 11448 * the given [expression].
11242 */ 11449 */
11243 void set expression(Expression expression) { 11450 void set expression(Expression expression) {
11244 _expression = becomeParentOf(expression); 11451 _expression = _becomeParentOf(expression);
11245 } 11452 }
11246 11453
11247 @override 11454 @override
11248 int get precedence => 7; 11455 int get precedence => 7;
11249 11456
11250 /** 11457 /**
11251 * Return the name of the type being tested for. 11458 * Return the name of the type being tested for.
11252 */ 11459 */
11253 TypeName get type => _type; 11460 TypeName get type => _type;
11254 11461
11255 /** 11462 /**
11256 * Set the name of the type being tested for to the given [name]. 11463 * Set the name of the type being tested for to the given [name].
11257 */ 11464 */
11258 void set type(TypeName name) { 11465 void set type(TypeName name) {
11259 _type = becomeParentOf(name); 11466 _type = _becomeParentOf(name);
11260 } 11467 }
11261 11468
11262 @override 11469 @override
11263 accept(AstVisitor visitor) => visitor.visitIsExpression(this); 11470 accept(AstVisitor visitor) => visitor.visitIsExpression(this);
11264 11471
11265 @override 11472 @override
11266 void visitChildren(AstVisitor visitor) { 11473 void visitChildren(AstVisitor visitor) {
11267 _safelyVisitChild(_expression, visitor); 11474 _safelyVisitChild(_expression, visitor);
11268 _safelyVisitChild(_type, visitor); 11475 _safelyVisitChild(_type, visitor);
11269 } 11476 }
(...skipping 13 matching lines...) Expand all
11283 11490
11284 /** 11491 /**
11285 * The colon that separates the label from the statement. 11492 * The colon that separates the label from the statement.
11286 */ 11493 */
11287 Token colon; 11494 Token colon;
11288 11495
11289 /** 11496 /**
11290 * Initialize a newly created label. 11497 * Initialize a newly created label.
11291 */ 11498 */
11292 Label(SimpleIdentifier label, this.colon) { 11499 Label(SimpleIdentifier label, this.colon) {
11293 _label = becomeParentOf(label); 11500 _label = _becomeParentOf(label);
11294 } 11501 }
11295 11502
11296 @override 11503 @override
11297 Token get beginToken => _label.beginToken; 11504 Token get beginToken => _label.beginToken;
11298 11505
11299 /**
11300 * TODO(paulberry): untested.
11301 */
11302 @override 11506 @override
11303 Iterable get childEntities => new ChildEntities() 11507 Iterable get childEntities => new ChildEntities()
11304 ..add(_label) 11508 ..add(_label)
11305 ..add(colon); 11509 ..add(colon);
11306 11510
11307 @override 11511 @override
11308 Token get endToken => colon; 11512 Token get endToken => colon;
11309 11513
11310 /** 11514 /**
11311 * Return the label being associated with the statement. 11515 * Return the label being associated with the statement.
11312 */ 11516 */
11313 SimpleIdentifier get label => _label; 11517 SimpleIdentifier get label => _label;
11314 11518
11315 /** 11519 /**
11316 * Set the label being associated with the statement to the given [label]. 11520 * Set the label being associated with the statement to the given [label].
11317 */ 11521 */
11318 void set label(SimpleIdentifier label) { 11522 void set label(SimpleIdentifier label) {
11319 _label = becomeParentOf(label); 11523 _label = _becomeParentOf(label);
11320 } 11524 }
11321 11525
11322 @override 11526 @override
11323 accept(AstVisitor visitor) => visitor.visitLabel(this); 11527 accept(AstVisitor visitor) => visitor.visitLabel(this);
11324 11528
11325 @override 11529 @override
11326 void visitChildren(AstVisitor visitor) { 11530 void visitChildren(AstVisitor visitor) {
11327 _safelyVisitChild(_label, visitor); 11531 _safelyVisitChild(_label, visitor);
11328 } 11532 }
11329 } 11533 }
(...skipping 13 matching lines...) Expand all
11343 /** 11547 /**
11344 * The statement with which the labels are being associated. 11548 * The statement with which the labels are being associated.
11345 */ 11549 */
11346 Statement _statement; 11550 Statement _statement;
11347 11551
11348 /** 11552 /**
11349 * Initialize a newly created labeled statement. 11553 * Initialize a newly created labeled statement.
11350 */ 11554 */
11351 LabeledStatement(List<Label> labels, Statement statement) { 11555 LabeledStatement(List<Label> labels, Statement statement) {
11352 _labels = new NodeList<Label>(this, labels); 11556 _labels = new NodeList<Label>(this, labels);
11353 _statement = becomeParentOf(statement); 11557 _statement = _becomeParentOf(statement);
11354 } 11558 }
11355 11559
11356 @override 11560 @override
11357 Token get beginToken { 11561 Token get beginToken {
11358 if (!_labels.isEmpty) { 11562 if (!_labels.isEmpty) {
11359 return _labels.beginToken; 11563 return _labels.beginToken;
11360 } 11564 }
11361 return _statement.beginToken; 11565 return _statement.beginToken;
11362 } 11566 }
11363 11567
11364 /**
11365 * TODO(paulberry): untested.
11366 */
11367 @override 11568 @override
11368 Iterable get childEntities => new ChildEntities() 11569 Iterable get childEntities => new ChildEntities()
11369 ..addAll(_labels) 11570 ..addAll(_labels)
11370 ..add(_statement); 11571 ..add(_statement);
11371 11572
11372 @override 11573 @override
11373 Token get endToken => _statement.endToken; 11574 Token get endToken => _statement.endToken;
11374 11575
11375 /** 11576 /**
11376 * Return the labels being associated with the statement. 11577 * Return the labels being associated with the statement.
11377 */ 11578 */
11378 NodeList<Label> get labels => _labels; 11579 NodeList<Label> get labels => _labels;
11379 11580
11380 /** 11581 /**
11381 * Return the statement with which the labels are being associated. 11582 * Return the statement with which the labels are being associated.
11382 */ 11583 */
11383 Statement get statement => _statement; 11584 Statement get statement => _statement;
11384 11585
11385 /** 11586 /**
11386 * Set the statement with which the labels are being associated to the given 11587 * Set the statement with which the labels are being associated to the given
11387 * [statement]. 11588 * [statement].
11388 */ 11589 */
11389 void set statement(Statement statement) { 11590 void set statement(Statement statement) {
11390 _statement = becomeParentOf(statement); 11591 _statement = _becomeParentOf(statement);
11391 } 11592 }
11392 11593
11393 @override 11594 @override
11394 Statement get unlabeled => _statement.unlabeled; 11595 Statement get unlabeled => _statement.unlabeled;
11395 11596
11396 @override 11597 @override
11397 accept(AstVisitor visitor) => visitor.visitLabeledStatement(this); 11598 accept(AstVisitor visitor) => visitor.visitLabeledStatement(this);
11398 11599
11399 @override 11600 @override
11400 void visitChildren(AstVisitor visitor) { 11601 void visitChildren(AstVisitor visitor) {
11401 _labels.accept(visitor); 11602 _labels.accept(visitor);
11402 _safelyVisitChild(_statement, visitor); 11603 _safelyVisitChild(_statement, visitor);
11403 } 11604 }
11404 } 11605 }
11405 11606
11406 /** 11607 /**
11407 * A library directive. 11608 * A library directive.
11408 * 11609 *
11409 * > libraryDirective ::= 11610 * > libraryDirective ::=
11410 * > [Annotation] 'library' [Identifier] ';' 11611 * > [Annotation] 'library' [Identifier] ';'
11411 */ 11612 */
11412 class LibraryDirective extends Directive { 11613 class LibraryDirective extends Directive {
11413 /** 11614 /**
11414 * The token representing the 'library' token. 11615 * The token representing the 'library' keyword.
11415 */ 11616 */
11416 Token libraryToken; 11617 Token libraryKeyword;
11417 11618
11418 /** 11619 /**
11419 * The name of the library being defined. 11620 * The name of the library being defined.
11420 */ 11621 */
11421 LibraryIdentifier _name; 11622 LibraryIdentifier _name;
11422 11623
11423 /** 11624 /**
11424 * The semicolon terminating the directive. 11625 * The semicolon terminating the directive.
11425 */ 11626 */
11426 Token semicolon; 11627 Token semicolon;
11427 11628
11428 /** 11629 /**
11429 * Initialize a newly created library directive. Either or both of the 11630 * Initialize a newly created library directive. Either or both of the
11430 * [comment] and [metadata] can be `null` if the directive does not have the 11631 * [comment] and [metadata] can be `null` if the directive does not have the
11431 * corresponding attribute. 11632 * corresponding attribute.
11432 */ 11633 */
11433 LibraryDirective(Comment comment, List<Annotation> metadata, 11634 LibraryDirective(Comment comment, List<Annotation> metadata,
11434 this.libraryToken, LibraryIdentifier name, this.semicolon) 11635 this.libraryKeyword, LibraryIdentifier name, this.semicolon)
11435 : super(comment, metadata) { 11636 : super(comment, metadata) {
11436 _name = becomeParentOf(name); 11637 _name = _becomeParentOf(name);
11437 } 11638 }
11438 11639
11439 @override 11640 @override
11440 Iterable get childEntities => super._childEntities 11641 Iterable get childEntities => super._childEntities
11441 ..add(libraryToken) 11642 ..add(libraryKeyword)
11442 ..add(_name) 11643 ..add(_name)
11443 ..add(semicolon); 11644 ..add(semicolon);
11444 11645
11445 @override 11646 @override
11446 Token get endToken => semicolon; 11647 Token get endToken => semicolon;
11447 11648
11448 @override 11649 @override
11449 Token get firstTokenAfterCommentAndMetadata => libraryToken; 11650 Token get firstTokenAfterCommentAndMetadata => libraryKeyword;
11450 11651
11451 @override 11652 @override
11452 Token get keyword => libraryToken; 11653 Token get keyword => libraryKeyword;
11654
11655 /**
11656 * Return the token representing the 'library' token.
11657 */
11658 @deprecated // Use "this.libraryKeyword"
11659 Token get libraryToken => libraryKeyword;
11660
11661 /**
11662 * Set the token representing the 'library' token to the given [token].
11663 */
11664 @deprecated // Use "this.libraryKeyword"
11665 set libraryToken(Token token) {
11666 libraryKeyword = token;
11667 }
11453 11668
11454 /** 11669 /**
11455 * Return the name of the library being defined. 11670 * Return the name of the library being defined.
11456 */ 11671 */
11457 LibraryIdentifier get name => _name; 11672 LibraryIdentifier get name => _name;
11458 11673
11459 /** 11674 /**
11460 * Set the name of the library being defined to the given [name]. 11675 * Set the name of the library being defined to the given [name].
11461 */ 11676 */
11462 void set name(LibraryIdentifier name) { 11677 void set name(LibraryIdentifier name) {
11463 _name = becomeParentOf(name); 11678 _name = _becomeParentOf(name);
11464 } 11679 }
11465 11680
11466 @override 11681 @override
11467 accept(AstVisitor visitor) => visitor.visitLibraryDirective(this); 11682 accept(AstVisitor visitor) => visitor.visitLibraryDirective(this);
11468 11683
11469 @override 11684 @override
11470 void visitChildren(AstVisitor visitor) { 11685 void visitChildren(AstVisitor visitor) {
11471 super.visitChildren(visitor); 11686 super.visitChildren(visitor);
11472 _safelyVisitChild(_name, visitor); 11687 _safelyVisitChild(_name, visitor);
11473 } 11688 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
11675 return constKeyword; 11890 return constKeyword;
11676 } 11891 }
11677 TypeArgumentList typeArguments = this.typeArguments; 11892 TypeArgumentList typeArguments = this.typeArguments;
11678 if (typeArguments != null) { 11893 if (typeArguments != null) {
11679 return typeArguments.beginToken; 11894 return typeArguments.beginToken;
11680 } 11895 }
11681 return leftBracket; 11896 return leftBracket;
11682 } 11897 }
11683 11898
11684 /** 11899 /**
11685 * TODO(paulberry): untested.
11686 * TODO(paulberry): add commas. 11900 * TODO(paulberry): add commas.
11687 */ 11901 */
11688 @override 11902 @override
11689 Iterable get childEntities => super._childEntities 11903 Iterable get childEntities => super._childEntities
11690 ..add(leftBracket) 11904 ..add(leftBracket)
11691 ..addAll(entries) 11905 ..addAll(entries)
11692 ..add(rightBracket); 11906 ..add(rightBracket);
11693 11907
11694 @override 11908 @override
11695 Token get endToken => rightBracket; 11909 Token get endToken => rightBracket;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
11728 11942
11729 /** 11943 /**
11730 * The expression computing the value that will be associated with the key. 11944 * The expression computing the value that will be associated with the key.
11731 */ 11945 */
11732 Expression _value; 11946 Expression _value;
11733 11947
11734 /** 11948 /**
11735 * Initialize a newly created map literal entry. 11949 * Initialize a newly created map literal entry.
11736 */ 11950 */
11737 MapLiteralEntry(Expression key, this.separator, Expression value) { 11951 MapLiteralEntry(Expression key, this.separator, Expression value) {
11738 _key = becomeParentOf(key); 11952 _key = _becomeParentOf(key);
11739 _value = becomeParentOf(value); 11953 _value = _becomeParentOf(value);
11740 } 11954 }
11741 11955
11742 @override 11956 @override
11743 Token get beginToken => _key.beginToken; 11957 Token get beginToken => _key.beginToken;
11744 11958
11745 /**
11746 * TODO(paulberry): untested.
11747 */
11748 @override 11959 @override
11749 Iterable get childEntities => new ChildEntities() 11960 Iterable get childEntities => new ChildEntities()
11750 ..add(_key) 11961 ..add(_key)
11751 ..add(separator) 11962 ..add(separator)
11752 ..add(_value); 11963 ..add(_value);
11753 11964
11754 @override 11965 @override
11755 Token get endToken => _value.endToken; 11966 Token get endToken => _value.endToken;
11756 11967
11757 /** 11968 /**
11758 * Return the expression computing the key with which the value will be 11969 * Return the expression computing the key with which the value will be
11759 * associated. 11970 * associated.
11760 */ 11971 */
11761 Expression get key => _key; 11972 Expression get key => _key;
11762 11973
11763 /** 11974 /**
11764 * Set the expression computing the key with which the value will be 11975 * Set the expression computing the key with which the value will be
11765 * associated to the given [string]. 11976 * associated to the given [string].
11766 */ 11977 */
11767 void set key(Expression string) { 11978 void set key(Expression string) {
11768 _key = becomeParentOf(string); 11979 _key = _becomeParentOf(string);
11769 } 11980 }
11770 11981
11771 /** 11982 /**
11772 * Return the expression computing the value that will be associated with the 11983 * Return the expression computing the value that will be associated with the
11773 * key. 11984 * key.
11774 */ 11985 */
11775 Expression get value => _value; 11986 Expression get value => _value;
11776 11987
11777 /** 11988 /**
11778 * Set the expression computing the value that will be associated with the key 11989 * Set the expression computing the value that will be associated with the key
11779 * to the given [expression]. 11990 * to the given [expression].
11780 */ 11991 */
11781 void set value(Expression expression) { 11992 void set value(Expression expression) {
11782 _value = becomeParentOf(expression); 11993 _value = _becomeParentOf(expression);
11783 } 11994 }
11784 11995
11785 @override 11996 @override
11786 accept(AstVisitor visitor) => visitor.visitMapLiteralEntry(this); 11997 accept(AstVisitor visitor) => visitor.visitMapLiteralEntry(this);
11787 11998
11788 @override 11999 @override
11789 void visitChildren(AstVisitor visitor) { 12000 void visitChildren(AstVisitor visitor) {
11790 _safelyVisitChild(_key, visitor); 12001 _safelyVisitChild(_key, visitor);
11791 _safelyVisitChild(_value, visitor); 12002 _safelyVisitChild(_value, visitor);
11792 } 12003 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
11861 * type was specified. The [propertyKeyword] can be `null` if the method is 12072 * type was specified. The [propertyKeyword] can be `null` if the method is
11862 * neither a getter or a setter. The [operatorKeyword] can be `null` if the 12073 * neither a getter or a setter. The [operatorKeyword] can be `null` if the
11863 * method does not implement an operator. The [parameters] must be `null` if 12074 * method does not implement an operator. The [parameters] must be `null` if
11864 * this method declares a getter. 12075 * this method declares a getter.
11865 */ 12076 */
11866 MethodDeclaration(Comment comment, List<Annotation> metadata, 12077 MethodDeclaration(Comment comment, List<Annotation> metadata,
11867 this.externalKeyword, this.modifierKeyword, TypeName returnType, 12078 this.externalKeyword, this.modifierKeyword, TypeName returnType,
11868 this.propertyKeyword, this.operatorKeyword, SimpleIdentifier name, 12079 this.propertyKeyword, this.operatorKeyword, SimpleIdentifier name,
11869 FormalParameterList parameters, FunctionBody body) 12080 FormalParameterList parameters, FunctionBody body)
11870 : super(comment, metadata) { 12081 : super(comment, metadata) {
11871 _returnType = becomeParentOf(returnType); 12082 _returnType = _becomeParentOf(returnType);
11872 _name = becomeParentOf(name); 12083 _name = _becomeParentOf(name);
11873 _parameters = becomeParentOf(parameters); 12084 _parameters = _becomeParentOf(parameters);
11874 _body = becomeParentOf(body); 12085 _body = _becomeParentOf(body);
11875 } 12086 }
11876 12087
11877 /** 12088 /**
11878 * Return the body of the method. 12089 * Return the body of the method.
11879 */ 12090 */
11880 FunctionBody get body => _body; 12091 FunctionBody get body => _body;
11881 12092
11882 /** 12093 /**
11883 * Set the body of the method to the given [functionBody]. 12094 * Set the body of the method to the given [functionBody].
11884 */ 12095 */
11885 void set body(FunctionBody functionBody) { 12096 void set body(FunctionBody functionBody) {
11886 _body = becomeParentOf(functionBody); 12097 _body = _becomeParentOf(functionBody);
11887 } 12098 }
11888 12099
11889 @override 12100 @override
11890 Iterable get childEntities => super._childEntities 12101 Iterable get childEntities => super._childEntities
11891 ..add(externalKeyword) 12102 ..add(externalKeyword)
11892 ..add(modifierKeyword) 12103 ..add(modifierKeyword)
11893 ..add(_returnType) 12104 ..add(_returnType)
11894 ..add(propertyKeyword) 12105 ..add(propertyKeyword)
11895 ..add(operatorKeyword) 12106 ..add(operatorKeyword)
11896 ..add(_name) 12107 ..add(_name)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
11959 12170
11960 /** 12171 /**
11961 * Return the name of the method. 12172 * Return the name of the method.
11962 */ 12173 */
11963 SimpleIdentifier get name => _name; 12174 SimpleIdentifier get name => _name;
11964 12175
11965 /** 12176 /**
11966 * Set the name of the method to the given [identifier]. 12177 * Set the name of the method to the given [identifier].
11967 */ 12178 */
11968 void set name(SimpleIdentifier identifier) { 12179 void set name(SimpleIdentifier identifier) {
11969 _name = becomeParentOf(identifier); 12180 _name = _becomeParentOf(identifier);
11970 } 12181 }
11971 12182
11972 /** 12183 /**
11973 * Return the parameters associated with the method, or `null` if this method 12184 * Return the parameters associated with the method, or `null` if this method
11974 * declares a getter. 12185 * declares a getter.
11975 */ 12186 */
11976 FormalParameterList get parameters => _parameters; 12187 FormalParameterList get parameters => _parameters;
11977 12188
11978 /** 12189 /**
11979 * Set the parameters associated with the method to the given list of 12190 * Set the parameters associated with the method to the given list of
11980 * [parameters]. 12191 * [parameters].
11981 */ 12192 */
11982 void set parameters(FormalParameterList parameters) { 12193 void set parameters(FormalParameterList parameters) {
11983 _parameters = becomeParentOf(parameters); 12194 _parameters = _becomeParentOf(parameters);
11984 } 12195 }
11985 12196
11986 /** 12197 /**
11987 * Return the return type of the method, or `null` if no return type was 12198 * Return the return type of the method, or `null` if no return type was
11988 * declared. 12199 * declared.
11989 */ 12200 */
11990 TypeName get returnType => _returnType; 12201 TypeName get returnType => _returnType;
11991 12202
11992 /** 12203 /**
11993 * Set the return type of the method to the given [typeName]. 12204 * Set the return type of the method to the given [typeName].
11994 */ 12205 */
11995 void set returnType(TypeName typeName) { 12206 void set returnType(TypeName typeName) {
11996 _returnType = becomeParentOf(typeName); 12207 _returnType = _becomeParentOf(typeName);
11997 } 12208 }
11998 12209
11999 @override 12210 @override
12000 accept(AstVisitor visitor) => visitor.visitMethodDeclaration(this); 12211 accept(AstVisitor visitor) => visitor.visitMethodDeclaration(this);
12001 12212
12002 @override 12213 @override
12003 void visitChildren(AstVisitor visitor) { 12214 void visitChildren(AstVisitor visitor) {
12004 super.visitChildren(visitor); 12215 super.visitChildren(visitor);
12005 _safelyVisitChild(_returnType, visitor); 12216 _safelyVisitChild(_returnType, visitor);
12006 _safelyVisitChild(_name, visitor); 12217 _safelyVisitChild(_name, visitor);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
12040 * The list of arguments to the method. 12251 * The list of arguments to the method.
12041 */ 12252 */
12042 ArgumentList _argumentList; 12253 ArgumentList _argumentList;
12043 12254
12044 /** 12255 /**
12045 * Initialize a newly created method invocation. The [target] and [period] can 12256 * Initialize a newly created method invocation. The [target] and [period] can
12046 * be `null` if there is no target. 12257 * be `null` if there is no target.
12047 */ 12258 */
12048 MethodInvocation(Expression target, this.period, SimpleIdentifier methodName, 12259 MethodInvocation(Expression target, this.period, SimpleIdentifier methodName,
12049 ArgumentList argumentList) { 12260 ArgumentList argumentList) {
12050 _target = becomeParentOf(target); 12261 _target = _becomeParentOf(target);
12051 _methodName = becomeParentOf(methodName); 12262 _methodName = _becomeParentOf(methodName);
12052 _argumentList = becomeParentOf(argumentList); 12263 _argumentList = _becomeParentOf(argumentList);
12053 } 12264 }
12054 12265
12055 /** 12266 /**
12056 * Return the list of arguments to the method. 12267 * Return the list of arguments to the method.
12057 */ 12268 */
12058 ArgumentList get argumentList => _argumentList; 12269 ArgumentList get argumentList => _argumentList;
12059 12270
12060 /** 12271 /**
12061 * Set the list of arguments to the method to the given [argumentList]. 12272 * Set the list of arguments to the method to the given [argumentList].
12062 */ 12273 */
12063 void set argumentList(ArgumentList argumentList) { 12274 void set argumentList(ArgumentList argumentList) {
12064 _argumentList = becomeParentOf(argumentList); 12275 _argumentList = _becomeParentOf(argumentList);
12065 } 12276 }
12066 12277
12067 @override 12278 @override
12068 Token get beginToken { 12279 Token get beginToken {
12069 if (_target != null) { 12280 if (_target != null) {
12070 return _target.beginToken; 12281 return _target.beginToken;
12071 } else if (period != null) { 12282 } else if (period != null) {
12072 return period; 12283 return period;
12073 } 12284 }
12074 return _methodName.beginToken; 12285 return _methodName.beginToken;
(...skipping 19 matching lines...) Expand all
12094 12305
12095 /** 12306 /**
12096 * Return the name of the method being invoked. 12307 * Return the name of the method being invoked.
12097 */ 12308 */
12098 SimpleIdentifier get methodName => _methodName; 12309 SimpleIdentifier get methodName => _methodName;
12099 12310
12100 /** 12311 /**
12101 * Set the name of the method being invoked to the given [identifier]. 12312 * Set the name of the method being invoked to the given [identifier].
12102 */ 12313 */
12103 void set methodName(SimpleIdentifier identifier) { 12314 void set methodName(SimpleIdentifier identifier) {
12104 _methodName = becomeParentOf(identifier); 12315 _methodName = _becomeParentOf(identifier);
12105 } 12316 }
12106 12317
12107 @override 12318 @override
12108 int get precedence => 15; 12319 int get precedence => 15;
12109 12320
12110 /** 12321 /**
12111 * Return the expression used to compute the receiver of the invocation. If 12322 * Return the expression used to compute the receiver of the invocation. If
12112 * this invocation is not part of a cascade expression, then this is the same 12323 * this invocation is not part of a cascade expression, then this is the same
12113 * as [target]. If this invocation is part of a cascade expression, then the 12324 * as [target]. If this invocation is part of a cascade expression, then the
12114 * target stored with the cascade expression is returned. 12325 * target stored with the cascade expression is returned.
(...skipping 20 matching lines...) Expand all
12135 * Use [realTarget] to get the target independent of whether this is part of a 12346 * Use [realTarget] to get the target independent of whether this is part of a
12136 * cascade expression. 12347 * cascade expression.
12137 */ 12348 */
12138 Expression get target => _target; 12349 Expression get target => _target;
12139 12350
12140 /** 12351 /**
12141 * Set the expression producing the object on which the method is defined to 12352 * Set the expression producing the object on which the method is defined to
12142 * the given [expression]. 12353 * the given [expression].
12143 */ 12354 */
12144 void set target(Expression expression) { 12355 void set target(Expression expression) {
12145 _target = becomeParentOf(expression); 12356 _target = _becomeParentOf(expression);
12146 } 12357 }
12147 12358
12148 @override 12359 @override
12149 accept(AstVisitor visitor) => visitor.visitMethodInvocation(this); 12360 accept(AstVisitor visitor) => visitor.visitMethodInvocation(this);
12150 12361
12151 @override 12362 @override
12152 void visitChildren(AstVisitor visitor) { 12363 void visitChildren(AstVisitor visitor) {
12153 _safelyVisitChild(_target, visitor); 12364 _safelyVisitChild(_target, visitor);
12154 _safelyVisitChild(_methodName, visitor); 12365 _safelyVisitChild(_methodName, visitor);
12155 _safelyVisitChild(_argumentList, visitor); 12366 _safelyVisitChild(_argumentList, visitor);
(...skipping 15 matching lines...) Expand all
12171 12382
12172 /** 12383 /**
12173 * The expression with which the name is associated. 12384 * The expression with which the name is associated.
12174 */ 12385 */
12175 Expression _expression; 12386 Expression _expression;
12176 12387
12177 /** 12388 /**
12178 * Initialize a newly created named expression.. 12389 * Initialize a newly created named expression..
12179 */ 12390 */
12180 NamedExpression(Label name, Expression expression) { 12391 NamedExpression(Label name, Expression expression) {
12181 _name = becomeParentOf(name); 12392 _name = _becomeParentOf(name);
12182 _expression = becomeParentOf(expression); 12393 _expression = _becomeParentOf(expression);
12183 } 12394 }
12184 12395
12185 @override 12396 @override
12186 Token get beginToken => _name.beginToken; 12397 Token get beginToken => _name.beginToken;
12187 12398
12188 @override 12399 @override
12189 Iterable get childEntities => new ChildEntities() 12400 Iterable get childEntities => new ChildEntities()
12190 ..add(_name) 12401 ..add(_name)
12191 ..add(_expression); 12402 ..add(_expression);
12192 12403
(...skipping 16 matching lines...) Expand all
12209 /** 12420 /**
12210 * Return the expression with which the name is associated. 12421 * Return the expression with which the name is associated.
12211 */ 12422 */
12212 Expression get expression => _expression; 12423 Expression get expression => _expression;
12213 12424
12214 /** 12425 /**
12215 * Set the expression with which the name is associated to the given 12426 * Set the expression with which the name is associated to the given
12216 * [expression]. 12427 * [expression].
12217 */ 12428 */
12218 void set expression(Expression expression) { 12429 void set expression(Expression expression) {
12219 _expression = becomeParentOf(expression); 12430 _expression = _becomeParentOf(expression);
12220 } 12431 }
12221 12432
12222 /** 12433 /**
12223 * Return the name associated with the expression. 12434 * Return the name associated with the expression.
12224 */ 12435 */
12225 Label get name => _name; 12436 Label get name => _name;
12226 12437
12227 /** 12438 /**
12228 * Set the name associated with the expression to the given [identifier]. 12439 * Set the name associated with the expression to the given [identifier].
12229 */ 12440 */
12230 void set name(Label identifier) { 12441 void set name(Label identifier) {
12231 _name = becomeParentOf(identifier); 12442 _name = _becomeParentOf(identifier);
12232 } 12443 }
12233 12444
12234 @override 12445 @override
12235 int get precedence => 0; 12446 int get precedence => 0;
12236 12447
12237 @override 12448 @override
12238 accept(AstVisitor visitor) => visitor.visitNamedExpression(this); 12449 accept(AstVisitor visitor) => visitor.visitNamedExpression(this);
12239 12450
12240 @override 12451 @override
12241 void visitChildren(AstVisitor visitor) { 12452 void visitChildren(AstVisitor visitor) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
12297 /** 12508 /**
12298 * The "native" clause in an class declaration. 12509 * The "native" clause in an class declaration.
12299 * 12510 *
12300 * > nativeClause ::= 12511 * > nativeClause ::=
12301 * > 'native' [StringLiteral] 12512 * > 'native' [StringLiteral]
12302 */ 12513 */
12303 class NativeClause extends AstNode { 12514 class NativeClause extends AstNode {
12304 /** 12515 /**
12305 * The token representing the 'native' keyword. 12516 * The token representing the 'native' keyword.
12306 */ 12517 */
12307 Token keyword; 12518 Token nativeKeyword;
12308 12519
12309 /** 12520 /**
12310 * The name of the native object that implements the class. 12521 * The name of the native object that implements the class.
12311 */ 12522 */
12312 StringLiteral _name; 12523 StringLiteral _name;
12313 12524
12314 /** 12525 /**
12315 * Initialize a newly created native clause. 12526 * Initialize a newly created native clause.
12316 */ 12527 */
12317 NativeClause(this.keyword, StringLiteral name) { 12528 NativeClause(this.nativeKeyword, StringLiteral name) {
12318 _name = becomeParentOf(name); 12529 _name = _becomeParentOf(name);
12319 } 12530 }
12320 12531
12321 @override 12532 @override
12322 Token get beginToken => keyword; 12533 Token get beginToken => nativeKeyword;
12323 12534
12324 /**
12325 * TODO(paulberry): untested.
12326 */
12327 @override 12535 @override
12328 Iterable get childEntities => new ChildEntities() 12536 Iterable get childEntities => new ChildEntities()
12329 ..add(keyword) 12537 ..add(nativeKeyword)
12330 ..add(_name); 12538 ..add(_name);
12331 12539
12332 @override 12540 @override
12333 Token get endToken => _name.endToken; 12541 Token get endToken => _name.endToken;
12334 12542
12335 /** 12543 /**
12544 * Get the token representing the 'native' keyword.
12545 */
12546 @deprecated // Use "this.nativeKeyword"
12547 Token get keyword => nativeKeyword;
12548
12549 /**
12550 * Set the token representing the 'native' keyword to the given [token].
12551 */
12552 @deprecated // Use "this.nativeKeyword"
12553 set keyword(Token token) {
12554 nativeKeyword = token;
12555 }
12556
12557 /**
12336 * Return the name of the native object that implements the class. 12558 * Return the name of the native object that implements the class.
12337 */ 12559 */
12338 StringLiteral get name => _name; 12560 StringLiteral get name => _name;
12339 12561
12340 /** 12562 /**
12341 * Sets the name of the native object that implements the class to the given 12563 * Sets the name of the native object that implements the class to the given
12342 * [name]. 12564 * [name].
12343 */ 12565 */
12344 void set name(StringLiteral name) { 12566 void set name(StringLiteral name) {
12345 _name = becomeParentOf(name); 12567 _name = _becomeParentOf(name);
12346 } 12568 }
12347 12569
12348 @override 12570 @override
12349 accept(AstVisitor visitor) => visitor.visitNativeClause(this); 12571 accept(AstVisitor visitor) => visitor.visitNativeClause(this);
12350 12572
12351 @override 12573 @override
12352 void visitChildren(AstVisitor visitor) { 12574 void visitChildren(AstVisitor visitor) {
12353 _safelyVisitChild(_name, visitor); 12575 _safelyVisitChild(_name, visitor);
12354 } 12576 }
12355 } 12577 }
12356 12578
12357 /** 12579 /**
12358 * A function body that consists of a native keyword followed by a string 12580 * A function body that consists of a native keyword followed by a string
12359 * literal. 12581 * literal.
12360 * 12582 *
12361 * > nativeFunctionBody ::= 12583 * > nativeFunctionBody ::=
12362 * > 'native' [SimpleStringLiteral] ';' 12584 * > 'native' [SimpleStringLiteral] ';'
12363 */ 12585 */
12364 class NativeFunctionBody extends FunctionBody { 12586 class NativeFunctionBody extends FunctionBody {
12365 /** 12587 /**
12366 * The token representing 'native' that marks the start of the function body. 12588 * The token representing 'native' that marks the start of the function body.
12367 */ 12589 */
12368 Token nativeToken; 12590 Token nativeKeyword;
12369 12591
12370 /** 12592 /**
12371 * The string literal, after the 'native' token. 12593 * The string literal, after the 'native' token.
12372 */ 12594 */
12373 StringLiteral _stringLiteral; 12595 StringLiteral _stringLiteral;
12374 12596
12375 /** 12597 /**
12376 * The token representing the semicolon that marks the end of the function 12598 * The token representing the semicolon that marks the end of the function
12377 * body. 12599 * body.
12378 */ 12600 */
12379 Token semicolon; 12601 Token semicolon;
12380 12602
12381 /** 12603 /**
12382 * Initialize a newly created function body consisting of the 'native' token, 12604 * Initialize a newly created function body consisting of the 'native' token,
12383 * a string literal, and a semicolon. 12605 * a string literal, and a semicolon.
12384 */ 12606 */
12385 NativeFunctionBody(this.nativeToken, StringLiteral stringLiteral, 12607 NativeFunctionBody(this.nativeKeyword, StringLiteral stringLiteral,
12386 this.semicolon) { 12608 this.semicolon) {
12387 _stringLiteral = becomeParentOf(stringLiteral); 12609 _stringLiteral = _becomeParentOf(stringLiteral);
12388 } 12610 }
12389 12611
12390 @override 12612 @override
12391 Token get beginToken => nativeToken; 12613 Token get beginToken => nativeKeyword;
12392 12614
12393 /**
12394 * TODO(paulberry): untested.
12395 */
12396 @override 12615 @override
12397 Iterable get childEntities => new ChildEntities() 12616 Iterable get childEntities => new ChildEntities()
12398 ..add(nativeToken) 12617 ..add(nativeKeyword)
12399 ..add(_stringLiteral) 12618 ..add(_stringLiteral)
12400 ..add(semicolon); 12619 ..add(semicolon);
12401 12620
12402 @override 12621 @override
12403 Token get endToken => semicolon; 12622 Token get endToken => semicolon;
12404 12623
12405 /** 12624 /**
12625 * Return the token representing 'native' that marks the start of the function
12626 * body.
12627 */
12628 @deprecated // Use "this.nativeKeyword"
12629 Token get nativeToken => nativeKeyword;
12630
12631 /**
12632 * Set the token representing 'native' that marks the start of the function
12633 * body to the given [token].
12634 */
12635 @deprecated // Use "this.nativeKeyword"
12636 set nativeToken(Token token) {
12637 nativeKeyword = token;
12638 }
12639
12640 /**
12406 * Return the string literal representing the string after the 'native' token. 12641 * Return the string literal representing the string after the 'native' token.
12407 */ 12642 */
12408 StringLiteral get stringLiteral => _stringLiteral; 12643 StringLiteral get stringLiteral => _stringLiteral;
12409 12644
12410 /** 12645 /**
12411 * Set the string literal representing the string after the 'native' token to 12646 * Set the string literal representing the string after the 'native' token to
12412 * the given [stringLiteral]. 12647 * the given [stringLiteral].
12413 */ 12648 */
12414 void set stringLiteral(StringLiteral stringLiteral) { 12649 void set stringLiteral(StringLiteral stringLiteral) {
12415 _stringLiteral = becomeParentOf(stringLiteral); 12650 _stringLiteral = _becomeParentOf(stringLiteral);
12416 } 12651 }
12417 12652
12418 @override 12653 @override
12419 accept(AstVisitor visitor) => visitor.visitNativeFunctionBody(this); 12654 accept(AstVisitor visitor) => visitor.visitNativeFunctionBody(this);
12420 12655
12421 @override 12656 @override
12422 void visitChildren(AstVisitor visitor) { 12657 void visitChildren(AstVisitor visitor) {
12423 _safelyVisitChild(_stringLiteral, visitor); 12658 _safelyVisitChild(_stringLiteral, visitor);
12424 } 12659 }
12425 } 12660 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
12465 Token get endToken { 12700 Token get endToken {
12466 int length = _elements.length; 12701 int length = _elements.length;
12467 if (length == 0) { 12702 if (length == 0) {
12468 return null; 12703 return null;
12469 } 12704 }
12470 return _elements[length - 1].endToken; 12705 return _elements[length - 1].endToken;
12471 } 12706 }
12472 12707
12473 int get length => _elements.length; 12708 int get length => _elements.length;
12474 12709
12475 @deprecated 12710 @deprecated // Never intended for public use.
12476 void set length(int value) { 12711 void set length(int value) {
12477 throw new UnsupportedError("Cannot resize NodeList."); 12712 throw new UnsupportedError("Cannot resize NodeList.");
12478 } 12713 }
12479 12714
12480 E operator [](int index) { 12715 E operator [](int index) {
12481 if (index < 0 || index >= _elements.length) { 12716 if (index < 0 || index >= _elements.length) {
12482 throw new RangeError("Index: $index, Size: ${_elements.length}"); 12717 throw new RangeError("Index: $index, Size: ${_elements.length}");
12483 } 12718 }
12484 return _elements[index]; 12719 return _elements[index];
12485 } 12720 }
12486 12721
12487 void operator []=(int index, E node) { 12722 void operator []=(int index, E node) {
12488 if (index < 0 || index >= _elements.length) { 12723 if (index < 0 || index >= _elements.length) {
12489 throw new RangeError("Index: $index, Size: ${_elements.length}"); 12724 throw new RangeError("Index: $index, Size: ${_elements.length}");
12490 } 12725 }
12491 owner.becomeParentOf(node); 12726 owner._becomeParentOf(node);
12492 _elements[index] = node; 12727 _elements[index] = node;
12493 } 12728 }
12494 12729
12495 /** 12730 /**
12496 * Use the given [visitor] to visit each of the nodes in this list. 12731 * Use the given [visitor] to visit each of the nodes in this list.
12497 */ 12732 */
12498 accept(AstVisitor visitor) { 12733 accept(AstVisitor visitor) {
12499 int length = _elements.length; 12734 int length = _elements.length;
12500 for (var i = 0; i < length; i++) { 12735 for (var i = 0; i < length; i++) {
12501 _elements[i].accept(visitor); 12736 _elements[i].accept(visitor);
12502 } 12737 }
12503 } 12738 }
12504 12739
12505 @override 12740 @override
12506 void add(E node) { 12741 void add(E node) {
12507 insert(length, node); 12742 insert(length, node);
12508 } 12743 }
12509 12744
12510 @override 12745 @override
12511 bool addAll(Iterable<E> nodes) { 12746 bool addAll(Iterable<E> nodes) {
12512 if (nodes != null && !nodes.isEmpty) { 12747 if (nodes != null && !nodes.isEmpty) {
12513 _elements.addAll(nodes); 12748 _elements.addAll(nodes);
12514 for (E node in nodes) { 12749 for (E node in nodes) {
12515 owner.becomeParentOf(node); 12750 owner._becomeParentOf(node);
12516 } 12751 }
12517 return true; 12752 return true;
12518 } 12753 }
12519 return false; 12754 return false;
12520 } 12755 }
12521 12756
12522 @override 12757 @override
12523 void clear() { 12758 void clear() {
12524 _elements = <E>[]; 12759 _elements = <E>[];
12525 } 12760 }
12526 12761
12527 @override 12762 @override
12528 void insert(int index, E node) { 12763 void insert(int index, E node) {
12529 int length = _elements.length; 12764 int length = _elements.length;
12530 if (index < 0 || index > length) { 12765 if (index < 0 || index > length) {
12531 throw new RangeError("Index: $index, Size: ${_elements.length}"); 12766 throw new RangeError("Index: $index, Size: ${_elements.length}");
12532 } 12767 }
12533 owner.becomeParentOf(node); 12768 owner._becomeParentOf(node);
12534 if (length == 0) { 12769 if (length == 0) {
12535 _elements.add(node); 12770 _elements.add(node);
12536 } else { 12771 } else {
12537 _elements.insert(index, node); 12772 _elements.insert(index, node);
12538 } 12773 }
12539 } 12774 }
12540 12775
12541 @override 12776 @override
12542 E removeAt(int index) { 12777 E removeAt(int index) {
12543 if (index < 0 || index >= _elements.length) { 12778 if (index < 0 || index >= _elements.length) {
12544 throw new RangeError("Index: $index, Size: ${_elements.length}"); 12779 throw new RangeError("Index: $index, Size: ${_elements.length}");
12545 } 12780 }
12546 E removedNode = _elements[index]; 12781 E removedNode = _elements[index];
12547 _elements.removeAt(index); 12782 _elements.removeAt(index);
12548 return removedNode; 12783 return removedNode;
12549 } 12784 }
12550 12785
12551 /** 12786 /**
12552 * Create an empty list with the given [owner]. 12787 * Create an empty list with the given [owner].
12553 *
12554 * Use "new NodeList<E>(owner)"
12555 */ 12788 */
12556 @deprecated 12789 @deprecated // Use "new NodeList<E>(owner)"
12557 static NodeList create(AstNode owner) => new NodeList(owner); 12790 static NodeList create(AstNode owner) => new NodeList(owner);
12558 } 12791 }
12559 12792
12560 /** 12793 /**
12561 * An object used to locate the [AstNode] associated with a source range, given 12794 * An object used to locate the [AstNode] associated with a source range, given
12562 * the AST structure built from the source. More specifically, they will return 12795 * the AST structure built from the source. More specifically, they will return
12563 * the [AstNode] with the shortest length whose source range completely 12796 * the [AstNode] with the shortest length whose source range completely
12564 * encompasses the specified range. 12797 * encompasses the specified range.
12565 */ 12798 */
12566 class NodeLocator extends UnifyingAstVisitor<Object> { 12799 class NodeLocator extends UnifyingAstVisitor<Object> {
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
13847 */ 14080 */
13848 SimpleIdentifier _identifier; 14081 SimpleIdentifier _identifier;
13849 14082
13850 /** 14083 /**
13851 * Initialize a newly created formal parameter. Either or both of the 14084 * Initialize a newly created formal parameter. Either or both of the
13852 * [comment] and [metadata] can be `null` if the parameter does not have the 14085 * [comment] and [metadata] can be `null` if the parameter does not have the
13853 * corresponding attribute. 14086 * corresponding attribute.
13854 */ 14087 */
13855 NormalFormalParameter(Comment comment, List<Annotation> metadata, 14088 NormalFormalParameter(Comment comment, List<Annotation> metadata,
13856 SimpleIdentifier identifier) { 14089 SimpleIdentifier identifier) {
13857 _comment = becomeParentOf(comment); 14090 _comment = _becomeParentOf(comment);
13858 _metadata = new NodeList<Annotation>(this, metadata); 14091 _metadata = new NodeList<Annotation>(this, metadata);
13859 _identifier = becomeParentOf(identifier); 14092 _identifier = _becomeParentOf(identifier);
13860 } 14093 }
13861 14094
13862 /** 14095 /**
13863 * Return the documentation comment associated with this parameter, or `null` 14096 * Return the documentation comment associated with this parameter, or `null`
13864 * if this parameter does not have a documentation comment associated with it. 14097 * if this parameter does not have a documentation comment associated with it.
13865 */ 14098 */
13866 Comment get documentationComment => _comment; 14099 Comment get documentationComment => _comment;
13867 14100
13868 /** 14101 /**
13869 * Set the documentation comment associated with this parameter to the given 14102 * Set the documentation comment associated with this parameter to the given
13870 * [comment]. 14103 * [comment].
13871 */ 14104 */
13872 void set documentationComment(Comment comment) { 14105 void set documentationComment(Comment comment) {
13873 _comment = becomeParentOf(comment); 14106 _comment = _becomeParentOf(comment);
13874 } 14107 }
13875 14108
13876 @override 14109 @override
13877 SimpleIdentifier get identifier => _identifier; 14110 SimpleIdentifier get identifier => _identifier;
13878 14111
13879 /** 14112 /**
13880 * Set the name of the parameter being declared to the given [identifier]. 14113 * Set the name of the parameter being declared to the given [identifier].
13881 */ 14114 */
13882 void set identifier(SimpleIdentifier identifier) { 14115 void set identifier(SimpleIdentifier identifier) {
13883 _identifier = becomeParentOf(identifier); 14116 _identifier = _becomeParentOf(identifier);
13884 } 14117 }
13885 14118
13886 @override 14119 @override
13887 ParameterKind get kind { 14120 ParameterKind get kind {
13888 AstNode parent = this.parent; 14121 AstNode parent = this.parent;
13889 if (parent is DefaultFormalParameter) { 14122 if (parent is DefaultFormalParameter) {
13890 return parent.kind; 14123 return parent.kind;
13891 } 14124 }
13892 return ParameterKind.REQUIRED; 14125 return ParameterKind.REQUIRED;
13893 } 14126 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
13969 Token literal; 14202 Token literal;
13970 14203
13971 /** 14204 /**
13972 * Initialize a newly created null literal. 14205 * Initialize a newly created null literal.
13973 */ 14206 */
13974 NullLiteral(this.literal); 14207 NullLiteral(this.literal);
13975 14208
13976 @override 14209 @override
13977 Token get beginToken => literal; 14210 Token get beginToken => literal;
13978 14211
13979 /**
13980 * TODO(paulberry): untested.
13981 */
13982 @override 14212 @override
13983 Iterable get childEntities => new ChildEntities()..add(literal); 14213 Iterable get childEntities => new ChildEntities()..add(literal);
13984 14214
13985 @override 14215 @override
13986 Token get endToken => literal; 14216 Token get endToken => literal;
13987 14217
13988 @override 14218 @override
13989 accept(AstVisitor visitor) => visitor.visitNullLiteral(this); 14219 accept(AstVisitor visitor) => visitor.visitNullLiteral(this);
13990 14220
13991 @override 14221 @override
(...skipping 22 matching lines...) Expand all
14014 /** 14244 /**
14015 * The right parenthesis. 14245 * The right parenthesis.
14016 */ 14246 */
14017 Token rightParenthesis; 14247 Token rightParenthesis;
14018 14248
14019 /** 14249 /**
14020 * Initialize a newly created parenthesized expression. 14250 * Initialize a newly created parenthesized expression.
14021 */ 14251 */
14022 ParenthesizedExpression(this.leftParenthesis, Expression expression, 14252 ParenthesizedExpression(this.leftParenthesis, Expression expression,
14023 this.rightParenthesis) { 14253 this.rightParenthesis) {
14024 _expression = becomeParentOf(expression); 14254 _expression = _becomeParentOf(expression);
14025 } 14255 }
14026 14256
14027 @override 14257 @override
14028 Token get beginToken => leftParenthesis; 14258 Token get beginToken => leftParenthesis;
14029 14259
14030 @override 14260 @override
14031 Iterable get childEntities => new ChildEntities() 14261 Iterable get childEntities => new ChildEntities()
14032 ..add(leftParenthesis) 14262 ..add(leftParenthesis)
14033 ..add(_expression) 14263 ..add(_expression)
14034 ..add(rightParenthesis); 14264 ..add(rightParenthesis);
14035 14265
14036 @override 14266 @override
14037 Token get endToken => rightParenthesis; 14267 Token get endToken => rightParenthesis;
14038 14268
14039 /** 14269 /**
14040 * Return the expression within the parentheses. 14270 * Return the expression within the parentheses.
14041 */ 14271 */
14042 Expression get expression => _expression; 14272 Expression get expression => _expression;
14043 14273
14044 /** 14274 /**
14045 * Set the expression within the parentheses to the given [expression]. 14275 * Set the expression within the parentheses to the given [expression].
14046 */ 14276 */
14047 void set expression(Expression expression) { 14277 void set expression(Expression expression) {
14048 _expression = becomeParentOf(expression); 14278 _expression = _becomeParentOf(expression);
14049 } 14279 }
14050 14280
14051 @override 14281 @override
14052 int get precedence => 15; 14282 int get precedence => 15;
14053 14283
14054 @override 14284 @override
14055 accept(AstVisitor visitor) => visitor.visitParenthesizedExpression(this); 14285 accept(AstVisitor visitor) => visitor.visitParenthesizedExpression(this);
14056 14286
14057 @override 14287 @override
14058 void visitChildren(AstVisitor visitor) { 14288 void visitChildren(AstVisitor visitor) {
14059 _safelyVisitChild(_expression, visitor); 14289 _safelyVisitChild(_expression, visitor);
14060 } 14290 }
14061 } 14291 }
14062 14292
14063 /** 14293 /**
14064 * A part directive. 14294 * A part directive.
14065 * 14295 *
14066 * > partDirective ::= 14296 * > partDirective ::=
14067 * > [Annotation] 'part' [StringLiteral] ';' 14297 * > [Annotation] 'part' [StringLiteral] ';'
14068 */ 14298 */
14069 class PartDirective extends UriBasedDirective { 14299 class PartDirective extends UriBasedDirective {
14070 /** 14300 /**
14071 * The token representing the 'part' token. 14301 * The token representing the 'part' keyword.
14072 */ 14302 */
14073 Token partToken; 14303 Token partKeyword;
14074 14304
14075 /** 14305 /**
14076 * The semicolon terminating the directive. 14306 * The semicolon terminating the directive.
14077 */ 14307 */
14078 Token semicolon; 14308 Token semicolon;
14079 14309
14080 /** 14310 /**
14081 * Initialize a newly created part directive. Either or both of the [comment] 14311 * Initialize a newly created part directive. Either or both of the [comment]
14082 * and [metadata] can be `null` if the directive does not have the 14312 * and [metadata] can be `null` if the directive does not have the
14083 * corresponding attribute. 14313 * corresponding attribute.
14084 */ 14314 */
14085 PartDirective(Comment comment, List<Annotation> metadata, this.partToken, 14315 PartDirective(Comment comment, List<Annotation> metadata, this.partKeyword,
14086 StringLiteral partUri, this.semicolon) 14316 StringLiteral partUri, this.semicolon)
14087 : super(comment, metadata, partUri); 14317 : super(comment, metadata, partUri);
14088 14318
14089 /**
14090 * TODO(paulberry): untested.
14091 */
14092 @override 14319 @override
14093 Iterable get childEntities => super._childEntities 14320 Iterable get childEntities => super._childEntities
14094 ..add(partToken) 14321 ..add(partKeyword)
14095 ..add(_uri) 14322 ..add(_uri)
14096 ..add(semicolon); 14323 ..add(semicolon);
14097 14324
14098 @override 14325 @override
14099 Token get endToken => semicolon; 14326 Token get endToken => semicolon;
14100 14327
14101 @override 14328 @override
14102 Token get firstTokenAfterCommentAndMetadata => partToken; 14329 Token get firstTokenAfterCommentAndMetadata => partKeyword;
14103 14330
14104 @override 14331 @override
14105 Token get keyword => partToken; 14332 Token get keyword => partKeyword;
14333
14334 /**
14335 * Return the token representing the 'part' token.
14336 */
14337 @deprecated // Use "this.partKeyword"
14338 Token get partToken => partKeyword;
14339
14340 /**
14341 * Set the token representing the 'part' token to the given [token].
14342 */
14343 @deprecated // Use "this.partKeyword"
14344 set partToken(Token token) {
14345 partKeyword = token;
14346 }
14106 14347
14107 @override 14348 @override
14108 CompilationUnitElement get uriElement => element as CompilationUnitElement; 14349 CompilationUnitElement get uriElement => element as CompilationUnitElement;
14109 14350
14110 @override 14351 @override
14111 accept(AstVisitor visitor) => visitor.visitPartDirective(this); 14352 accept(AstVisitor visitor) => visitor.visitPartDirective(this);
14112 } 14353 }
14113 14354
14114 /** 14355 /**
14115 * A part-of directive. 14356 * A part-of directive.
14116 * 14357 *
14117 * > partOfDirective ::= 14358 * > partOfDirective ::=
14118 * > [Annotation] 'part' 'of' [Identifier] ';' 14359 * > [Annotation] 'part' 'of' [Identifier] ';'
14119 */ 14360 */
14120 class PartOfDirective extends Directive { 14361 class PartOfDirective extends Directive {
14121 /** 14362 /**
14122 * The token representing the 'part' token. 14363 * The token representing the 'part' keyword.
14123 */ 14364 */
14124 Token partToken; 14365 Token partKeyword;
14125 14366
14126 /** 14367 /**
14127 * The token representing the 'of' token. 14368 * The token representing the 'of' keyword.
14128 */ 14369 */
14129 Token ofToken; 14370 Token ofKeyword;
14130 14371
14131 /** 14372 /**
14132 * The name of the library that the containing compilation unit is part of. 14373 * The name of the library that the containing compilation unit is part of.
14133 */ 14374 */
14134 LibraryIdentifier _libraryName; 14375 LibraryIdentifier _libraryName;
14135 14376
14136 /** 14377 /**
14137 * The semicolon terminating the directive. 14378 * The semicolon terminating the directive.
14138 */ 14379 */
14139 Token semicolon; 14380 Token semicolon;
14140 14381
14141 /** 14382 /**
14142 * Initialize a newly created part-of directive. Either or both of the 14383 * Initialize a newly created part-of directive. Either or both of the
14143 * [comment] and [metadata] can be `null` if the directive does not have the 14384 * [comment] and [metadata] can be `null` if the directive does not have the
14144 * corresponding attribute. 14385 * corresponding attribute.
14145 */ 14386 */
14146 PartOfDirective(Comment comment, List<Annotation> metadata, this.partToken, 14387 PartOfDirective(Comment comment, List<Annotation> metadata, this.partKeyword,
14147 this.ofToken, LibraryIdentifier libraryName, this.semicolon) 14388 this.ofKeyword, LibraryIdentifier libraryName, this.semicolon)
14148 : super(comment, metadata) { 14389 : super(comment, metadata) {
14149 _libraryName = becomeParentOf(libraryName); 14390 _libraryName = _becomeParentOf(libraryName);
14150 } 14391 }
14151 14392
14152 @override 14393 @override
14153 Iterable get childEntities => super._childEntities 14394 Iterable get childEntities => super._childEntities
14154 ..add(partToken) 14395 ..add(partKeyword)
14155 ..add(ofToken) 14396 ..add(ofKeyword)
14156 ..add(_libraryName) 14397 ..add(_libraryName)
14157 ..add(semicolon); 14398 ..add(semicolon);
14158 14399
14159 @override 14400 @override
14160 Token get endToken => semicolon; 14401 Token get endToken => semicolon;
14161 14402
14162 @override 14403 @override
14163 Token get firstTokenAfterCommentAndMetadata => partToken; 14404 Token get firstTokenAfterCommentAndMetadata => partKeyword;
14164 14405
14165 @override 14406 @override
14166 Token get keyword => partToken; 14407 Token get keyword => partKeyword;
14167 14408
14168 /** 14409 /**
14169 * Return the name of the library that the containing compilation unit is part 14410 * Return the name of the library that the containing compilation unit is part
14170 * of. 14411 * of.
14171 */ 14412 */
14172 LibraryIdentifier get libraryName => _libraryName; 14413 LibraryIdentifier get libraryName => _libraryName;
14173 14414
14174 /** 14415 /**
14175 * Set the name of the library that the containing compilation unit is part of 14416 * Set the name of the library that the containing compilation unit is part of
14176 * to the given [libraryName]. 14417 * to the given [libraryName].
14177 */ 14418 */
14178 void set libraryName(LibraryIdentifier libraryName) { 14419 void set libraryName(LibraryIdentifier libraryName) {
14179 _libraryName = becomeParentOf(libraryName); 14420 _libraryName = _becomeParentOf(libraryName);
14421 }
14422
14423 /**
14424 * Return the token representing the 'of' token.
14425 */
14426 @deprecated // Use "this.ofKeyword"
14427 Token get ofToken => ofKeyword;
14428
14429 /**
14430 * Set the token representing the 'of' token to the given [token].
14431 */
14432 @deprecated // Use "this.ofKeyword"
14433 set ofToken(Token token) {
14434 ofKeyword = token;
14435 }
14436
14437 /**
14438 * Return the token representing the 'part' token.
14439 */
14440 @deprecated // Use "this.partKeyword"
14441 Token get partToken => partKeyword;
14442
14443 /**
14444 * Set the token representing the 'part' token to the given [token].
14445 */
14446 @deprecated // Use "this.partKeyword"
14447 set partToken(Token token) {
14448 partKeyword = token;
14180 } 14449 }
14181 14450
14182 @override 14451 @override
14183 accept(AstVisitor visitor) => visitor.visitPartOfDirective(this); 14452 accept(AstVisitor visitor) => visitor.visitPartOfDirective(this);
14184 14453
14185 @override 14454 @override
14186 void visitChildren(AstVisitor visitor) { 14455 void visitChildren(AstVisitor visitor) {
14187 super.visitChildren(visitor); 14456 super.visitChildren(visitor);
14188 _safelyVisitChild(_libraryName, visitor); 14457 _safelyVisitChild(_libraryName, visitor);
14189 } 14458 }
(...skipping 28 matching lines...) Expand all
14218 * The element associated with the operator based on the static type of the 14487 * The element associated with the operator based on the static type of the
14219 * operand, or `null` if the AST structure has not been resolved, if the 14488 * operand, or `null` if the AST structure has not been resolved, if the
14220 * operator is not user definable, or if the operator could not be resolved. 14489 * operator is not user definable, or if the operator could not be resolved.
14221 */ 14490 */
14222 MethodElement staticElement; 14491 MethodElement staticElement;
14223 14492
14224 /** 14493 /**
14225 * Initialize a newly created postfix expression. 14494 * Initialize a newly created postfix expression.
14226 */ 14495 */
14227 PostfixExpression(Expression operand, this.operator) { 14496 PostfixExpression(Expression operand, this.operator) {
14228 _operand = becomeParentOf(operand); 14497 _operand = _becomeParentOf(operand);
14229 } 14498 }
14230 14499
14231 @override 14500 @override
14232 Token get beginToken => _operand.beginToken; 14501 Token get beginToken => _operand.beginToken;
14233 14502
14234 /** 14503 /**
14235 * Return the best element available for this operator. If resolution was able 14504 * Return the best element available for this operator. If resolution was able
14236 * to find a better element based on type propagation, that element will be 14505 * to find a better element based on type propagation, that element will be
14237 * returned. Otherwise, the element found using the result of static analysis 14506 * returned. Otherwise, the element found using the result of static analysis
14238 * will be returned. If resolution has not been performed, then `null` will be 14507 * will be returned. If resolution has not been performed, then `null` will be
14239 * returned. 14508 * returned.
14240 */ 14509 */
14241 MethodElement get bestElement { 14510 MethodElement get bestElement {
14242 MethodElement element = propagatedElement; 14511 MethodElement element = propagatedElement;
14243 if (element == null) { 14512 if (element == null) {
14244 element = staticElement; 14513 element = staticElement;
14245 } 14514 }
14246 return element; 14515 return element;
14247 } 14516 }
14248 14517
14249 /**
14250 * TODO(paulberry): untested.
14251 */
14252 @override 14518 @override
14253 Iterable get childEntities => new ChildEntities() 14519 Iterable get childEntities => new ChildEntities()
14254 ..add(_operand) 14520 ..add(_operand)
14255 ..add(operator); 14521 ..add(operator);
14256 14522
14257 @override 14523 @override
14258 Token get endToken => operator; 14524 Token get endToken => operator;
14259 14525
14260 /** 14526 /**
14261 * Return the expression computing the operand for the operator. 14527 * Return the expression computing the operand for the operator.
14262 */ 14528 */
14263 Expression get operand => _operand; 14529 Expression get operand => _operand;
14264 14530
14265 /** 14531 /**
14266 * Set the expression computing the operand for the operator to the given 14532 * Set the expression computing the operand for the operator to the given
14267 * [expression]. 14533 * [expression].
14268 */ 14534 */
14269 void set operand(Expression expression) { 14535 void set operand(Expression expression) {
14270 _operand = becomeParentOf(expression); 14536 _operand = _becomeParentOf(expression);
14271 } 14537 }
14272 14538
14273 @override 14539 @override
14274 int get precedence => 15; 14540 int get precedence => 15;
14275 14541
14276 /** 14542 /**
14277 * If the AST structure has been resolved, and the function being invoked is 14543 * If the AST structure has been resolved, and the function being invoked is
14278 * known based on propagated type information, then return the parameter 14544 * known based on propagated type information, then return the parameter
14279 * element representing the parameter to which the value of the operand will 14545 * element representing the parameter to which the value of the operand will
14280 * be bound. Otherwise, return `null`. 14546 * be bound. Otherwise, return `null`.
14281 *
14282 * This method is only intended to be used by
14283 * [Expression.propagatedParameterElement].
14284 */ 14547 */
14548 @deprecated // Use "expression.propagatedParameterElement"
14285 ParameterElement get propagatedParameterElementForOperand { 14549 ParameterElement get propagatedParameterElementForOperand {
14550 return _propagatedParameterElementForOperand;
14551 }
14552
14553 /**
14554 * If the AST structure has been resolved, and the function being invoked is
14555 * known based on static type information, then return the parameter element
14556 * representing the parameter to which the value of the operand will be bound.
14557 * Otherwise, return `null`.
14558 */
14559 @deprecated // Use "expression.propagatedParameterElement"
14560 ParameterElement get staticParameterElementForOperand {
14561 return _staticParameterElementForOperand;
14562 }
14563
14564 /**
14565 * If the AST structure has been resolved, and the function being invoked is
14566 * known based on propagated type information, then return the parameter
14567 * element representing the parameter to which the value of the operand will
14568 * be bound. Otherwise, return `null`.
14569 */
14570 ParameterElement get _propagatedParameterElementForOperand {
14286 if (propagatedElement == null) { 14571 if (propagatedElement == null) {
14287 return null; 14572 return null;
14288 } 14573 }
14289 List<ParameterElement> parameters = propagatedElement.parameters; 14574 List<ParameterElement> parameters = propagatedElement.parameters;
14290 if (parameters.length < 1) { 14575 if (parameters.length < 1) {
14291 return null; 14576 return null;
14292 } 14577 }
14293 return parameters[0]; 14578 return parameters[0];
14294 } 14579 }
14295 14580
14296 /** 14581 /**
14297 * If the AST structure has been resolved, and the function being invoked is 14582 * If the AST structure has been resolved, and the function being invoked is
14298 * known based on static type information, then return the parameter element 14583 * known based on static type information, then return the parameter element
14299 * representing the parameter to which the value of the operand will be bound. 14584 * representing the parameter to which the value of the operand will be bound.
14300 * Otherwise, return `null`. 14585 * Otherwise, return `null`.
14301 *
14302 * This method is only intended to be used by
14303 * [Expression.staticParameterElement].
14304 */ 14586 */
14305 ParameterElement get staticParameterElementForOperand { 14587 ParameterElement get _staticParameterElementForOperand {
14306 if (staticElement == null) { 14588 if (staticElement == null) {
14307 return null; 14589 return null;
14308 } 14590 }
14309 List<ParameterElement> parameters = staticElement.parameters; 14591 List<ParameterElement> parameters = staticElement.parameters;
14310 if (parameters.length < 1) { 14592 if (parameters.length < 1) {
14311 return null; 14593 return null;
14312 } 14594 }
14313 return parameters[0]; 14595 return parameters[0];
14314 } 14596 }
14315 14597
(...skipping 27 matching lines...) Expand all
14343 /** 14625 /**
14344 * The identifier being prefixed. 14626 * The identifier being prefixed.
14345 */ 14627 */
14346 SimpleIdentifier _identifier; 14628 SimpleIdentifier _identifier;
14347 14629
14348 /** 14630 /**
14349 * Initialize a newly created prefixed identifier. 14631 * Initialize a newly created prefixed identifier.
14350 */ 14632 */
14351 PrefixedIdentifier(SimpleIdentifier prefix, this.period, 14633 PrefixedIdentifier(SimpleIdentifier prefix, this.period,
14352 SimpleIdentifier identifier) { 14634 SimpleIdentifier identifier) {
14353 _prefix = becomeParentOf(prefix); 14635 _prefix = _becomeParentOf(prefix);
14354 _identifier = becomeParentOf(identifier); 14636 _identifier = _becomeParentOf(identifier);
14355 } 14637 }
14356 14638
14357 @override 14639 @override
14358 Token get beginToken => _prefix.beginToken; 14640 Token get beginToken => _prefix.beginToken;
14359 14641
14360 @override 14642 @override
14361 Element get bestElement { 14643 Element get bestElement {
14362 if (_identifier == null) { 14644 if (_identifier == null) {
14363 return null; 14645 return null;
14364 } 14646 }
(...skipping 11 matching lines...) Expand all
14376 14658
14377 /** 14659 /**
14378 * Return the identifier being prefixed. 14660 * Return the identifier being prefixed.
14379 */ 14661 */
14380 SimpleIdentifier get identifier => _identifier; 14662 SimpleIdentifier get identifier => _identifier;
14381 14663
14382 /** 14664 /**
14383 * Set the identifier being prefixed to the given [identifier]. 14665 * Set the identifier being prefixed to the given [identifier].
14384 */ 14666 */
14385 void set identifier(SimpleIdentifier identifier) { 14667 void set identifier(SimpleIdentifier identifier) {
14386 _identifier = becomeParentOf(identifier); 14668 _identifier = _becomeParentOf(identifier);
14387 } 14669 }
14388 14670
14389 /** 14671 /**
14390 * Return `true` if this type is a deferred type. If the AST structure has not 14672 * Return `true` if this type is a deferred type. If the AST structure has not
14391 * been resolved, then return `false`. 14673 * been resolved, then return `false`.
14392 * 14674 *
14393 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form 14675 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
14394 * </i>p.T</i> where <i>p</i> is a deferred prefix. 14676 * </i>p.T</i> where <i>p</i> is a deferred prefix.
14395 */ 14677 */
14396 bool get isDeferred { 14678 bool get isDeferred {
(...skipping 20 matching lines...) Expand all
14417 * Return the prefix associated with the library in which the identifier is 14699 * Return the prefix associated with the library in which the identifier is
14418 * defined. 14700 * defined.
14419 */ 14701 */
14420 SimpleIdentifier get prefix => _prefix; 14702 SimpleIdentifier get prefix => _prefix;
14421 14703
14422 /** 14704 /**
14423 * Set the prefix associated with the library in which the identifier is 14705 * Set the prefix associated with the library in which the identifier is
14424 * defined to the given [identifier]. 14706 * defined to the given [identifier].
14425 */ 14707 */
14426 void set prefix(SimpleIdentifier identifier) { 14708 void set prefix(SimpleIdentifier identifier) {
14427 _prefix = becomeParentOf(identifier); 14709 _prefix = _becomeParentOf(identifier);
14428 } 14710 }
14429 14711
14430 @override 14712 @override
14431 Element get propagatedElement { 14713 Element get propagatedElement {
14432 if (_identifier == null) { 14714 if (_identifier == null) {
14433 return null; 14715 return null;
14434 } 14716 }
14435 return _identifier.propagatedElement; 14717 return _identifier.propagatedElement;
14436 } 14718 }
14437 14719
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
14481 * The element associated with the operator based on the propagated type of 14763 * The element associated with the operator based on the propagated type of
14482 * the operand, or `null` if the AST structure has not been resolved, if the 14764 * the operand, or `null` if the AST structure has not been resolved, if the
14483 * operator is not user definable, or if the operator could not be resolved. 14765 * operator is not user definable, or if the operator could not be resolved.
14484 */ 14766 */
14485 MethodElement propagatedElement; 14767 MethodElement propagatedElement;
14486 14768
14487 /** 14769 /**
14488 * Initialize a newly created prefix expression. 14770 * Initialize a newly created prefix expression.
14489 */ 14771 */
14490 PrefixExpression(this.operator, Expression operand) { 14772 PrefixExpression(this.operator, Expression operand) {
14491 _operand = becomeParentOf(operand); 14773 _operand = _becomeParentOf(operand);
14492 } 14774 }
14493 14775
14494 @override 14776 @override
14495 Token get beginToken => operator; 14777 Token get beginToken => operator;
14496 14778
14497 /** 14779 /**
14498 * Return the best element available for this operator. If resolution was able 14780 * Return the best element available for this operator. If resolution was able
14499 * to find a better element based on type propagation, that element will be 14781 * to find a better element based on type propagation, that element will be
14500 * returned. Otherwise, the element found using the result of static analysis 14782 * returned. Otherwise, the element found using the result of static analysis
14501 * will be returned. If resolution has not been performed, then `null` will be 14783 * will be returned. If resolution has not been performed, then `null` will be
(...skipping 18 matching lines...) Expand all
14520 /** 14802 /**
14521 * Return the expression computing the operand for the operator. 14803 * Return the expression computing the operand for the operator.
14522 */ 14804 */
14523 Expression get operand => _operand; 14805 Expression get operand => _operand;
14524 14806
14525 /** 14807 /**
14526 * Set the expression computing the operand for the operator to the given 14808 * Set the expression computing the operand for the operator to the given
14527 * [expression]. 14809 * [expression].
14528 */ 14810 */
14529 void set operand(Expression expression) { 14811 void set operand(Expression expression) {
14530 _operand = becomeParentOf(expression); 14812 _operand = _becomeParentOf(expression);
14531 } 14813 }
14532 14814
14533 @override 14815 @override
14534 int get precedence => 14; 14816 int get precedence => 14;
14535 14817
14536 /** 14818 /**
14537 * If the AST structure has been resolved, and the function being invoked is 14819 * If the AST structure has been resolved, and the function being invoked is
14538 * known based on propagated type information, then return the parameter 14820 * known based on propagated type information, then return the parameter
14539 * element representing the parameter to which the value of the operand will 14821 * element representing the parameter to which the value of the operand will
14540 * be bound. Otherwise, return `null`. 14822 * be bound. Otherwise, return `null`.
14541 *
14542 * This method is only intended to be used by
14543 * [Expression.propagatedParameterElement].
14544 */ 14823 */
14824 @deprecated // Use "expression.propagatedParameterElement"
14545 ParameterElement get propagatedParameterElementForOperand { 14825 ParameterElement get propagatedParameterElementForOperand {
14826 return _propagatedParameterElementForOperand;
14827 }
14828
14829 /**
14830 * If the AST structure has been resolved, and the function being invoked is
14831 * known based on static type information, then return the parameter element
14832 * representing the parameter to which the value of the operand will be bound.
14833 * Otherwise, return `null`.
14834 */
14835 @deprecated // Use "expression.propagatedParameterElement"
14836 ParameterElement get staticParameterElementForOperand {
14837 return _staticParameterElementForOperand;
14838 }
14839
14840 /**
14841 * If the AST structure has been resolved, and the function being invoked is
14842 * known based on propagated type information, then return the parameter
14843 * element representing the parameter to which the value of the operand will
14844 * be bound. Otherwise, return `null`.
14845 */
14846 ParameterElement get _propagatedParameterElementForOperand {
14546 if (propagatedElement == null) { 14847 if (propagatedElement == null) {
14547 return null; 14848 return null;
14548 } 14849 }
14549 List<ParameterElement> parameters = propagatedElement.parameters; 14850 List<ParameterElement> parameters = propagatedElement.parameters;
14550 if (parameters.length < 1) { 14851 if (parameters.length < 1) {
14551 return null; 14852 return null;
14552 } 14853 }
14553 return parameters[0]; 14854 return parameters[0];
14554 } 14855 }
14555 14856
14556 /** 14857 /**
14557 * If the AST structure has been resolved, and the function being invoked is 14858 * If the AST structure has been resolved, and the function being invoked is
14558 * known based on static type information, then return the parameter element 14859 * known based on static type information, then return the parameter element
14559 * representing the parameter to which the value of the operand will be bound. 14860 * representing the parameter to which the value of the operand will be bound.
14560 * Otherwise, return `null`. 14861 * Otherwise, return `null`.
14561 *
14562 * This method is only intended to be used by
14563 * [Expression.staticParameterElement].
14564 */ 14862 */
14565 ParameterElement get staticParameterElementForOperand { 14863 ParameterElement get _staticParameterElementForOperand {
14566 if (staticElement == null) { 14864 if (staticElement == null) {
14567 return null; 14865 return null;
14568 } 14866 }
14569 List<ParameterElement> parameters = staticElement.parameters; 14867 List<ParameterElement> parameters = staticElement.parameters;
14570 if (parameters.length < 1) { 14868 if (parameters.length < 1) {
14571 return null; 14869 return null;
14572 } 14870 }
14573 return parameters[0]; 14871 return parameters[0];
14574 } 14872 }
14575 14873
(...skipping 30 matching lines...) Expand all
14606 /** 14904 /**
14607 * The name of the property being accessed. 14905 * The name of the property being accessed.
14608 */ 14906 */
14609 SimpleIdentifier _propertyName; 14907 SimpleIdentifier _propertyName;
14610 14908
14611 /** 14909 /**
14612 * Initialize a newly created property access expression. 14910 * Initialize a newly created property access expression.
14613 */ 14911 */
14614 PropertyAccess(Expression target, this.operator, 14912 PropertyAccess(Expression target, this.operator,
14615 SimpleIdentifier propertyName) { 14913 SimpleIdentifier propertyName) {
14616 _target = becomeParentOf(target); 14914 _target = _becomeParentOf(target);
14617 _propertyName = becomeParentOf(propertyName); 14915 _propertyName = _becomeParentOf(propertyName);
14618 } 14916 }
14619 14917
14620 @override 14918 @override
14621 Token get beginToken { 14919 Token get beginToken {
14622 if (_target != null) { 14920 if (_target != null) {
14623 return _target.beginToken; 14921 return _target.beginToken;
14624 } 14922 }
14625 return operator; 14923 return operator;
14626 } 14924 }
14627 14925
(...skipping 22 matching lines...) Expand all
14650 14948
14651 /** 14949 /**
14652 * Return the name of the property being accessed. 14950 * Return the name of the property being accessed.
14653 */ 14951 */
14654 SimpleIdentifier get propertyName => _propertyName; 14952 SimpleIdentifier get propertyName => _propertyName;
14655 14953
14656 /** 14954 /**
14657 * Set the name of the property being accessed to the given [identifier]. 14955 * Set the name of the property being accessed to the given [identifier].
14658 */ 14956 */
14659 void set propertyName(SimpleIdentifier identifier) { 14957 void set propertyName(SimpleIdentifier identifier) {
14660 _propertyName = becomeParentOf(identifier); 14958 _propertyName = _becomeParentOf(identifier);
14661 } 14959 }
14662 14960
14663 /** 14961 /**
14664 * Return the expression used to compute the receiver of the invocation. If 14962 * Return the expression used to compute the receiver of the invocation. If
14665 * this invocation is not part of a cascade expression, then this is the same 14963 * this invocation is not part of a cascade expression, then this is the same
14666 * as [target]. If this invocation is part of a cascade expression, then the 14964 * as [target]. If this invocation is part of a cascade expression, then the
14667 * target stored with the cascade expression is returned. 14965 * target stored with the cascade expression is returned.
14668 */ 14966 */
14669 Expression get realTarget { 14967 Expression get realTarget {
14670 if (isCascaded) { 14968 if (isCascaded) {
(...skipping 16 matching lines...) Expand all
14687 * Use [realTarget] to get the target independent of whether this is part of a 14985 * Use [realTarget] to get the target independent of whether this is part of a
14688 * cascade expression. 14986 * cascade expression.
14689 */ 14987 */
14690 Expression get target => _target; 14988 Expression get target => _target;
14691 14989
14692 /** 14990 /**
14693 * Set the expression computing the object defining the property being 14991 * Set the expression computing the object defining the property being
14694 * accessed to the given [expression]. 14992 * accessed to the given [expression].
14695 */ 14993 */
14696 void set target(Expression expression) { 14994 void set target(Expression expression) {
14697 _target = becomeParentOf(expression); 14995 _target = _becomeParentOf(expression);
14698 } 14996 }
14699 14997
14700 @override 14998 @override
14701 accept(AstVisitor visitor) => visitor.visitPropertyAccess(this); 14999 accept(AstVisitor visitor) => visitor.visitPropertyAccess(this);
14702 15000
14703 @override 15001 @override
14704 void visitChildren(AstVisitor visitor) { 15002 void visitChildren(AstVisitor visitor) {
14705 _safelyVisitChild(_target, visitor); 15003 _safelyVisitChild(_target, visitor);
14706 _safelyVisitChild(_propertyName, visitor); 15004 _safelyVisitChild(_propertyName, visitor);
14707 } 15005 }
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
15360 * The invocation of a constructor in the same class from within a constructor's 15658 * The invocation of a constructor in the same class from within a constructor's
15361 * initialization list. 15659 * initialization list.
15362 * 15660 *
15363 * > redirectingConstructorInvocation ::= 15661 * > redirectingConstructorInvocation ::=
15364 * > 'this' ('.' identifier)? arguments 15662 * > 'this' ('.' identifier)? arguments
15365 */ 15663 */
15366 class RedirectingConstructorInvocation extends ConstructorInitializer { 15664 class RedirectingConstructorInvocation extends ConstructorInitializer {
15367 /** 15665 /**
15368 * The token for the 'this' keyword. 15666 * The token for the 'this' keyword.
15369 */ 15667 */
15370 Token keyword; 15668 Token thisKeyword;
15371 15669
15372 /** 15670 /**
15373 * The token for the period before the name of the constructor that is being 15671 * The token for the period before the name of the constructor that is being
15374 * invoked, or `null` if the unnamed constructor is being invoked. 15672 * invoked, or `null` if the unnamed constructor is being invoked.
15375 */ 15673 */
15376 Token period; 15674 Token period;
15377 15675
15378 /** 15676 /**
15379 * The name of the constructor that is being invoked, or `null` if the unnamed 15677 * The name of the constructor that is being invoked, or `null` if the unnamed
15380 * constructor is being invoked. 15678 * constructor is being invoked.
(...skipping 10 matching lines...) Expand all
15391 * information, or `null` if the AST structure has not been resolved or if the 15689 * information, or `null` if the AST structure has not been resolved or if the
15392 * constructor could not be resolved. 15690 * constructor could not be resolved.
15393 */ 15691 */
15394 ConstructorElement staticElement; 15692 ConstructorElement staticElement;
15395 15693
15396 /** 15694 /**
15397 * Initialize a newly created redirecting invocation to invoke the constructor 15695 * Initialize a newly created redirecting invocation to invoke the constructor
15398 * with the given name with the given arguments. The [constructorName] can be 15696 * with the given name with the given arguments. The [constructorName] can be
15399 * `null` if the constructor being invoked is the unnamed constructor. 15697 * `null` if the constructor being invoked is the unnamed constructor.
15400 */ 15698 */
15401 RedirectingConstructorInvocation(this.keyword, this.period, 15699 RedirectingConstructorInvocation(this.thisKeyword, this.period,
15402 SimpleIdentifier constructorName, ArgumentList argumentList) { 15700 SimpleIdentifier constructorName, ArgumentList argumentList) {
15403 _constructorName = becomeParentOf(constructorName); 15701 _constructorName = _becomeParentOf(constructorName);
15404 _argumentList = becomeParentOf(argumentList); 15702 _argumentList = _becomeParentOf(argumentList);
15405 } 15703 }
15406 15704
15407 /** 15705 /**
15408 * Return the list of arguments to the constructor. 15706 * Return the list of arguments to the constructor.
15409 */ 15707 */
15410 ArgumentList get argumentList => _argumentList; 15708 ArgumentList get argumentList => _argumentList;
15411 15709
15412 /** 15710 /**
15413 * Set the list of arguments to the constructor to the given [argumentList]. 15711 * Set the list of arguments to the constructor to the given [argumentList].
15414 */ 15712 */
15415 void set argumentList(ArgumentList argumentList) { 15713 void set argumentList(ArgumentList argumentList) {
15416 _argumentList = becomeParentOf(argumentList); 15714 _argumentList = _becomeParentOf(argumentList);
15417 } 15715 }
15418 15716
15419 @override 15717 @override
15420 Token get beginToken => keyword; 15718 Token get beginToken => thisKeyword;
15421 15719
15422 @override 15720 @override
15423 Iterable get childEntities => new ChildEntities() 15721 Iterable get childEntities => new ChildEntities()
15424 ..add(keyword) 15722 ..add(thisKeyword)
15425 ..add(period) 15723 ..add(period)
15426 ..add(_constructorName) 15724 ..add(_constructorName)
15427 ..add(_argumentList); 15725 ..add(_argumentList);
15428 15726
15429 /** 15727 /**
15430 * Return the name of the constructor that is being invoked, or `null` if the 15728 * Return the name of the constructor that is being invoked, or `null` if the
15431 * unnamed constructor is being invoked. 15729 * unnamed constructor is being invoked.
15432 */ 15730 */
15433 SimpleIdentifier get constructorName => _constructorName; 15731 SimpleIdentifier get constructorName => _constructorName;
15434 15732
15435 /** 15733 /**
15436 * Set the name of the constructor that is being invoked to the given 15734 * Set the name of the constructor that is being invoked to the given
15437 * [identifier]. 15735 * [identifier].
15438 */ 15736 */
15439 void set constructorName(SimpleIdentifier identifier) { 15737 void set constructorName(SimpleIdentifier identifier) {
15440 _constructorName = becomeParentOf(identifier); 15738 _constructorName = _becomeParentOf(identifier);
15441 } 15739 }
15442 15740
15443 @override 15741 @override
15444 Token get endToken => _argumentList.endToken; 15742 Token get endToken => _argumentList.endToken;
15445 15743
15744 /**
15745 * Return the token for the 'this' keyword.
15746 */
15747 @deprecated // Use "this.thisKeyword"
15748 Token get keyword => thisKeyword;
15749
15750 /**
15751 * Set the token for the 'this' keyword to the given [token].
15752 */
15753 @deprecated // Use "this.thisKeyword"
15754 set keyword(Token token) {
15755 thisKeyword = token;
15756 }
15757
15446 @override 15758 @override
15447 accept(AstVisitor visitor) => 15759 accept(AstVisitor visitor) =>
15448 visitor.visitRedirectingConstructorInvocation(this); 15760 visitor.visitRedirectingConstructorInvocation(this);
15449 15761
15450 @override 15762 @override
15451 void visitChildren(AstVisitor visitor) { 15763 void visitChildren(AstVisitor visitor) {
15452 _safelyVisitChild(_constructorName, visitor); 15764 _safelyVisitChild(_constructorName, visitor);
15453 _safelyVisitChild(_argumentList, visitor); 15765 _safelyVisitChild(_argumentList, visitor);
15454 } 15766 }
15455 } 15767 }
15456 15768
15457 /** 15769 /**
15458 * A rethrow expression. 15770 * A rethrow expression.
15459 * 15771 *
15460 * > rethrowExpression ::= 15772 * > rethrowExpression ::=
15461 * > 'rethrow' 15773 * > 'rethrow'
15462 */ 15774 */
15463 class RethrowExpression extends Expression { 15775 class RethrowExpression extends Expression {
15464 /** 15776 /**
15465 * The token representing the 'rethrow' keyword. 15777 * The token representing the 'rethrow' keyword.
15466 */ 15778 */
15467 Token keyword; 15779 Token rethrowKeyword;
15468 15780
15469 /** 15781 /**
15470 * Initialize a newly created rethrow expression. 15782 * Initialize a newly created rethrow expression.
15471 */ 15783 */
15472 RethrowExpression(this.keyword); 15784 RethrowExpression(this.rethrowKeyword);
15473 15785
15474 @override 15786 @override
15475 Token get beginToken => keyword; 15787 Token get beginToken => rethrowKeyword;
15788
15789 @override
15790 Iterable get childEntities => new ChildEntities()..add(rethrowKeyword);
15791
15792 @override
15793 Token get endToken => rethrowKeyword;
15476 15794
15477 /** 15795 /**
15478 * TODO(paulberry): untested. 15796 * Return the token representing the 'rethrow' keyword.
15479 */ 15797 */
15480 @override 15798 @deprecated // Use "this.rethrowKeyword"
15481 Iterable get childEntities => new ChildEntities()..add(keyword); 15799 Token get keyword => rethrowKeyword;
15482 15800
15483 @override 15801 /**
15484 Token get endToken => keyword; 15802 * Set the token representing the 'rethrow' keyword to the given [token].
15803 */
15804 @deprecated // Use "this.rethrowKeyword"
15805 set keyword(Token token) {
15806 rethrowKeyword = token;
15807 }
15485 15808
15486 @override 15809 @override
15487 int get precedence => 0; 15810 int get precedence => 0;
15488 15811
15489 @override 15812 @override
15490 accept(AstVisitor visitor) => visitor.visitRethrowExpression(this); 15813 accept(AstVisitor visitor) => visitor.visitRethrowExpression(this);
15491 15814
15492 @override 15815 @override
15493 void visitChildren(AstVisitor visitor) { 15816 void visitChildren(AstVisitor visitor) {
15494 // There are no children to visit. 15817 // There are no children to visit.
15495 } 15818 }
15496 } 15819 }
15497 15820
15498 /** 15821 /**
15499 * A return statement. 15822 * A return statement.
15500 * 15823 *
15501 * > returnStatement ::= 15824 * > returnStatement ::=
15502 * > 'return' [Expression]? ';' 15825 * > 'return' [Expression]? ';'
15503 */ 15826 */
15504 class ReturnStatement extends Statement { 15827 class ReturnStatement extends Statement {
15505 /** 15828 /**
15506 * The token representing the 'return' keyword. 15829 * The token representing the 'return' keyword.
15507 */ 15830 */
15508 Token keyword; 15831 Token returnKeyword;
15509 15832
15510 /** 15833 /**
15511 * The expression computing the value to be returned, or `null` if no explicit 15834 * The expression computing the value to be returned, or `null` if no explicit
15512 * value was provided. 15835 * value was provided.
15513 */ 15836 */
15514 Expression _expression; 15837 Expression _expression;
15515 15838
15516 /** 15839 /**
15517 * The semicolon terminating the statement. 15840 * The semicolon terminating the statement.
15518 */ 15841 */
15519 Token semicolon; 15842 Token semicolon;
15520 15843
15521 /** 15844 /**
15522 * Initialize a newly created return statement. The [expression] can be `null` 15845 * Initialize a newly created return statement. The [expression] can be `null`
15523 * if no explicit value was provided. 15846 * if no explicit value was provided.
15524 */ 15847 */
15525 ReturnStatement(this.keyword, Expression expression, this.semicolon) { 15848 ReturnStatement(this.returnKeyword, Expression expression, this.semicolon) {
15526 _expression = becomeParentOf(expression); 15849 _expression = _becomeParentOf(expression);
15527 } 15850 }
15528 15851
15529 @override 15852 @override
15530 Token get beginToken => keyword; 15853 Token get beginToken => returnKeyword;
15531 15854
15532 @override 15855 @override
15533 Iterable get childEntities => new ChildEntities() 15856 Iterable get childEntities => new ChildEntities()
15534 ..add(keyword) 15857 ..add(returnKeyword)
15535 ..add(_expression) 15858 ..add(_expression)
15536 ..add(semicolon); 15859 ..add(semicolon);
15537 15860
15538 @override 15861 @override
15539 Token get endToken => semicolon; 15862 Token get endToken => semicolon;
15540 15863
15541 /** 15864 /**
15542 * Return the expression computing the value to be returned, or `null` if no 15865 * Return the expression computing the value to be returned, or `null` if no
15543 * explicit value was provided. 15866 * explicit value was provided.
15544 */ 15867 */
15545 Expression get expression => _expression; 15868 Expression get expression => _expression;
15546 15869
15547 /** 15870 /**
15548 * Set the expression computing the value to be returned to the given 15871 * Set the expression computing the value to be returned to the given
15549 * [expression]. 15872 * [expression].
15550 */ 15873 */
15551 void set expression(Expression expression) { 15874 void set expression(Expression expression) {
15552 _expression = becomeParentOf(expression); 15875 _expression = _becomeParentOf(expression);
15876 }
15877
15878 /**
15879 * Return the token representing the 'return' keyword.
15880 */
15881 @deprecated // Use "this.returnKeyword"
15882 Token get keyword => returnKeyword;
15883
15884 /**
15885 * Set the token representing the 'return' keyword to the given [token].
15886 */
15887 @deprecated // Use "this.returnKeyword"
15888 set keyword(Token token) {
15889 returnKeyword = token;
15553 } 15890 }
15554 15891
15555 @override 15892 @override
15556 accept(AstVisitor visitor) => visitor.visitReturnStatement(this); 15893 accept(AstVisitor visitor) => visitor.visitReturnStatement(this);
15557 15894
15558 @override 15895 @override
15559 void visitChildren(AstVisitor visitor) { 15896 void visitChildren(AstVisitor visitor) {
15560 _safelyVisitChild(_expression, visitor); 15897 _safelyVisitChild(_expression, visitor);
15561 } 15898 }
15562 } 15899 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
15759 Token scriptTag; 16096 Token scriptTag;
15760 16097
15761 /** 16098 /**
15762 * Initialize a newly created script tag. 16099 * Initialize a newly created script tag.
15763 */ 16100 */
15764 ScriptTag(this.scriptTag); 16101 ScriptTag(this.scriptTag);
15765 16102
15766 @override 16103 @override
15767 Token get beginToken => scriptTag; 16104 Token get beginToken => scriptTag;
15768 16105
15769 /**
15770 * TODO(paulberry): untested.
15771 */
15772 @override 16106 @override
15773 Iterable get childEntities => new ChildEntities()..add(scriptTag); 16107 Iterable get childEntities => new ChildEntities()..add(scriptTag);
15774 16108
15775 @override 16109 @override
15776 Token get endToken => scriptTag; 16110 Token get endToken => scriptTag;
15777 16111
15778 @override 16112 @override
15779 accept(AstVisitor visitor) => visitor.visitScriptTag(this); 16113 accept(AstVisitor visitor) => visitor.visitScriptTag(this);
15780 16114
15781 @override 16115 @override
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
16183 16517
16184 /** 16518 /**
16185 * Initialize a newly created formal parameter. Either or both of the 16519 * Initialize a newly created formal parameter. Either or both of the
16186 * [comment] and [metadata] can be `null` if the parameter does not have the 16520 * [comment] and [metadata] can be `null` if the parameter does not have the
16187 * corresponding attribute. The [keyword] can be `null` if a type was 16521 * corresponding attribute. The [keyword] can be `null` if a type was
16188 * specified. The [type] must be `null` if the keyword is 'var'. 16522 * specified. The [type] must be `null` if the keyword is 'var'.
16189 */ 16523 */
16190 SimpleFormalParameter(Comment comment, List<Annotation> metadata, 16524 SimpleFormalParameter(Comment comment, List<Annotation> metadata,
16191 this.keyword, TypeName type, SimpleIdentifier identifier) 16525 this.keyword, TypeName type, SimpleIdentifier identifier)
16192 : super(comment, metadata, identifier) { 16526 : super(comment, metadata, identifier) {
16193 _type = becomeParentOf(type); 16527 _type = _becomeParentOf(type);
16194 } 16528 }
16195 16529
16196 @override 16530 @override
16197 Token get beginToken { 16531 Token get beginToken {
16198 NodeList<Annotation> metadata = this.metadata; 16532 NodeList<Annotation> metadata = this.metadata;
16199 if (!metadata.isEmpty) { 16533 if (!metadata.isEmpty) {
16200 return metadata.beginToken; 16534 return metadata.beginToken;
16201 } else if (keyword != null) { 16535 } else if (keyword != null) {
16202 return keyword; 16536 return keyword;
16203 } else if (_type != null) { 16537 } else if (_type != null) {
16204 return _type.beginToken; 16538 return _type.beginToken;
16205 } 16539 }
16206 return identifier.beginToken; 16540 return identifier.beginToken;
16207 } 16541 }
16208 16542
16209 /**
16210 * TODO(paulberry): untested.
16211 */
16212 @override 16543 @override
16213 Iterable get childEntities => super._childEntities 16544 Iterable get childEntities => super._childEntities
16214 ..add(keyword) 16545 ..add(keyword)
16215 ..add(_type) 16546 ..add(_type)
16216 ..add(identifier); 16547 ..add(identifier);
16217 16548
16218 @override 16549 @override
16219 Token get endToken => identifier.endToken; 16550 Token get endToken => identifier.endToken;
16220 16551
16221 @override 16552 @override
16222 bool get isConst => 16553 bool get isConst =>
16223 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. CONST; 16554 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. CONST;
16224 16555
16225 @override 16556 @override
16226 bool get isFinal => 16557 bool get isFinal =>
16227 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. FINAL; 16558 (keyword is KeywordToken) && (keyword as KeywordToken).keyword == Keyword. FINAL;
16228 16559
16229 /** 16560 /**
16230 * Return the name of the declared type of the parameter, or `null` if the 16561 * Return the name of the declared type of the parameter, or `null` if the
16231 * parameter does not have a declared type. 16562 * parameter does not have a declared type.
16232 */ 16563 */
16233 TypeName get type => _type; 16564 TypeName get type => _type;
16234 16565
16235 /** 16566 /**
16236 * Set the name of the declared type of the parameter to the given [typeName]. 16567 * Set the name of the declared type of the parameter to the given [typeName].
16237 */ 16568 */
16238 void set type(TypeName typeName) { 16569 void set type(TypeName typeName) {
16239 _type = becomeParentOf(typeName); 16570 _type = _becomeParentOf(typeName);
16240 } 16571 }
16241 16572
16242 @override 16573 @override
16243 accept(AstVisitor visitor) => visitor.visitSimpleFormalParameter(this); 16574 accept(AstVisitor visitor) => visitor.visitSimpleFormalParameter(this);
16244 16575
16245 @override 16576 @override
16246 void visitChildren(AstVisitor visitor) { 16577 void visitChildren(AstVisitor visitor) {
16247 super.visitChildren(visitor); 16578 super.visitChildren(visitor);
16248 _safelyVisitChild(_type, visitor); 16579 _safelyVisitChild(_type, visitor);
16249 _safelyVisitChild(identifier, visitor); 16580 _safelyVisitChild(identifier, visitor);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
16297 Token get beginToken => token; 16628 Token get beginToken => token;
16298 16629
16299 @override 16630 @override
16300 Element get bestElement { 16631 Element get bestElement {
16301 if (_propagatedElement == null) { 16632 if (_propagatedElement == null) {
16302 return _staticElement; 16633 return _staticElement;
16303 } 16634 }
16304 return _propagatedElement; 16635 return _propagatedElement;
16305 } 16636 }
16306 16637
16307 /**
16308 * TODO(paulberry): untested.
16309 */
16310 @override 16638 @override
16311 Iterable get childEntities => new ChildEntities()..add(token); 16639 Iterable get childEntities => new ChildEntities()..add(token);
16312 16640
16313 @override 16641 @override
16314 Token get endToken => token; 16642 Token get endToken => token;
16315 16643
16316 /** 16644 /**
16317 * Returns `true` if this identifier is the "name" part of a prefixed 16645 * Returns `true` if this identifier is the "name" part of a prefixed
16318 * identifier or a method invocation. 16646 * identifier or a method invocation.
16319 */ 16647 */
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
16365 } 16693 }
16366 16694
16367 @override 16695 @override
16368 accept(AstVisitor visitor) => visitor.visitSimpleIdentifier(this); 16696 accept(AstVisitor visitor) => visitor.visitSimpleIdentifier(this);
16369 16697
16370 /** 16698 /**
16371 * Return `true` if this identifier is the name being declared in a 16699 * Return `true` if this identifier is the name being declared in a
16372 * declaration. 16700 * declaration.
16373 */ 16701 */
16374 bool inDeclarationContext() { 16702 bool inDeclarationContext() {
16703 // TODO(brianwilkerson) Convert this to a getter.
16375 AstNode parent = this.parent; 16704 AstNode parent = this.parent;
16376 if (parent is CatchClause) { 16705 if (parent is CatchClause) {
16377 CatchClause clause = parent; 16706 CatchClause clause = parent;
16378 return identical(this, clause.exceptionParameter) || 16707 return identical(this, clause.exceptionParameter) ||
16379 identical(this, clause.stackTraceParameter); 16708 identical(this, clause.stackTraceParameter);
16380 } else if (parent is ClassDeclaration) { 16709 } else if (parent is ClassDeclaration) {
16381 return identical(this, parent.name); 16710 return identical(this, parent.name);
16382 } else if (parent is ClassTypeAlias) { 16711 } else if (parent is ClassTypeAlias) {
16383 return identical(this, parent.name); 16712 return identical(this, parent.name);
16384 } else if (parent is ConstructorDeclaration) { 16713 } else if (parent is ConstructorDeclaration) {
(...skipping 27 matching lines...) Expand all
16412 } 16741 }
16413 16742
16414 /** 16743 /**
16415 * Return `true` if this expression is computing a right-hand value. 16744 * Return `true` if this expression is computing a right-hand value.
16416 * 16745 *
16417 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor 16746 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor
16418 * are they mutually exclusive. In other words, it is possible for both 16747 * are they mutually exclusive. In other words, it is possible for both
16419 * methods to return `true` when invoked on the same node. 16748 * methods to return `true` when invoked on the same node.
16420 */ 16749 */
16421 bool inGetterContext() { 16750 bool inGetterContext() {
16751 // TODO(brianwilkerson) Convert this to a getter.
16422 AstNode parent = this.parent; 16752 AstNode parent = this.parent;
16423 AstNode target = this; 16753 AstNode target = this;
16424 // skip prefix 16754 // skip prefix
16425 if (parent is PrefixedIdentifier) { 16755 if (parent is PrefixedIdentifier) {
16426 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; 16756 PrefixedIdentifier prefixed = parent as PrefixedIdentifier;
16427 if (identical(prefixed.prefix, this)) { 16757 if (identical(prefixed.prefix, this)) {
16428 return true; 16758 return true;
16429 } 16759 }
16430 parent = prefixed.parent; 16760 parent = prefixed.parent;
16431 target = prefixed; 16761 target = prefixed;
(...skipping 27 matching lines...) Expand all
16459 } 16789 }
16460 16790
16461 /** 16791 /**
16462 * Return `true` if this expression is computing a left-hand value. 16792 * Return `true` if this expression is computing a left-hand value.
16463 * 16793 *
16464 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor 16794 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor
16465 * are they mutually exclusive. In other words, it is possible for both 16795 * are they mutually exclusive. In other words, it is possible for both
16466 * methods to return `true` when invoked on the same node. 16796 * methods to return `true` when invoked on the same node.
16467 */ 16797 */
16468 bool inSetterContext() { 16798 bool inSetterContext() {
16799 // TODO(brianwilkerson) Convert this to a getter.
16469 AstNode parent = this.parent; 16800 AstNode parent = this.parent;
16470 AstNode target = this; 16801 AstNode target = this;
16471 // skip prefix 16802 // skip prefix
16472 if (parent is PrefixedIdentifier) { 16803 if (parent is PrefixedIdentifier) {
16473 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; 16804 PrefixedIdentifier prefixed = parent as PrefixedIdentifier;
16474 // if this is the prefix, then return false 16805 // if this is the prefix, then return false
16475 if (identical(prefixed.prefix, this)) { 16806 if (identical(prefixed.prefix, this)) {
16476 return false; 16807 return false;
16477 } 16808 }
16478 parent = prefixed.parent; 16809 parent = prefixed.parent;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
16607 Token literal; 16938 Token literal;
16608 16939
16609 /** 16940 /**
16610 * The value of the literal. 16941 * The value of the literal.
16611 */ 16942 */
16612 String _value; 16943 String _value;
16613 16944
16614 /** 16945 /**
16615 * The toolkit specific element associated with this literal, or `null`. 16946 * The toolkit specific element associated with this literal, or `null`.
16616 */ 16947 */
16948 @deprecated // No replacement
16617 Element toolkitElement; 16949 Element toolkitElement;
16618 16950
16619 /** 16951 /**
16620 * Initialize a newly created simple string literal. 16952 * Initialize a newly created simple string literal.
16621 */ 16953 */
16622 SimpleStringLiteral(this.literal, String value) { 16954 SimpleStringLiteral(this.literal, String value) {
16623 _value = StringUtilities.intern(value); 16955 _value = StringUtilities.intern(value);
16624 } 16956 }
16625 16957
16626 @override 16958 @override
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
16695 * Set the value of the literal to the given [string]. 17027 * Set the value of the literal to the given [string].
16696 */ 17028 */
16697 void set value(String string) { 17029 void set value(String string) {
16698 _value = StringUtilities.intern(_value); 17030 _value = StringUtilities.intern(_value);
16699 } 17031 }
16700 17032
16701 @override 17033 @override
16702 accept(AstVisitor visitor) => visitor.visitSimpleStringLiteral(this); 17034 accept(AstVisitor visitor) => visitor.visitSimpleStringLiteral(this);
16703 17035
16704 @override 17036 @override
16705 void appendStringValue(StringBuffer buffer) {
16706 buffer.write(value);
16707 }
16708
16709 @override
16710 void visitChildren(AstVisitor visitor) { 17037 void visitChildren(AstVisitor visitor) {
16711 // There are no children to visit. 17038 // There are no children to visit.
16712 } 17039 }
17040
17041 @override
17042 void _appendStringValue(StringBuffer buffer) {
17043 buffer.write(value);
17044 }
16713 } 17045 }
16714 17046
16715 /** 17047 /**
16716 * A single string literal expression. 17048 * A single string literal expression.
16717 * 17049 *
16718 * > singleStringLiteral ::= 17050 * > singleStringLiteral ::=
16719 * > [SimpleStringLiteral] 17051 * > [SimpleStringLiteral]
16720 * > | [StringInterpolation] 17052 * > | [StringInterpolation]
16721 */ 17053 */
16722 abstract class SingleStringLiteral extends StringLiteral { 17054 abstract class SingleStringLiteral extends StringLiteral {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
16838 bool get isSingleQuoted { 17170 bool get isSingleQuoted {
16839 InterpolationString lastString = _elements.first; 17171 InterpolationString lastString = _elements.first;
16840 String lexeme = lastString.contents.lexeme; 17172 String lexeme = lastString.contents.lexeme;
16841 return StringUtilities.startsWithChar(lexeme, 0x27); 17173 return StringUtilities.startsWithChar(lexeme, 0x27);
16842 } 17174 }
16843 17175
16844 @override 17176 @override
16845 accept(AstVisitor visitor) => visitor.visitStringInterpolation(this); 17177 accept(AstVisitor visitor) => visitor.visitStringInterpolation(this);
16846 17178
16847 @override 17179 @override
16848 void appendStringValue(StringBuffer buffer) {
16849 throw new IllegalArgumentException();
16850 }
16851
16852 @override
16853 void visitChildren(AstVisitor visitor) { 17180 void visitChildren(AstVisitor visitor) {
16854 _elements.accept(visitor); 17181 _elements.accept(visitor);
16855 } 17182 }
17183
17184 @override
17185 void _appendStringValue(StringBuffer buffer) {
17186 throw new IllegalArgumentException();
17187 }
16856 } 17188 }
16857 17189
16858 /** 17190 /**
16859 * A string literal expression. 17191 * A string literal expression.
16860 * 17192 *
16861 * > stringLiteral ::= 17193 * > stringLiteral ::=
16862 * > [SimpleStringLiteral] 17194 * > [SimpleStringLiteral]
16863 * > | [AdjacentStrings] 17195 * > | [AdjacentStrings]
16864 * > | [StringInterpolation] 17196 * > | [StringInterpolation]
16865 */ 17197 */
16866 abstract class StringLiteral extends Literal { 17198 abstract class StringLiteral extends Literal {
16867 /** 17199 /**
16868 * Return the value of the string literal, or `null` if the string is not a 17200 * Return the value of the string literal, or `null` if the string is not a
16869 * constant string without any string interpolation. 17201 * constant string without any string interpolation.
16870 */ 17202 */
16871 String get stringValue { 17203 String get stringValue {
16872 StringBuffer buffer = new StringBuffer(); 17204 StringBuffer buffer = new StringBuffer();
16873 try { 17205 try {
16874 appendStringValue(buffer); 17206 _appendStringValue(buffer);
16875 } on IllegalArgumentException catch (exception) { 17207 } on IllegalArgumentException catch (exception) {
16876 return null; 17208 return null;
16877 } 17209 }
16878 return buffer.toString(); 17210 return buffer.toString();
16879 } 17211 }
16880 17212
16881 /** 17213 /**
16882 * Append the value of this string literal to the given [buffer]. Throw an 17214 * Append the value of this string literal to the given [buffer]. Throw an
16883 * [IllegalArgumentException] if the string is not a constant string without 17215 * [IllegalArgumentException] if the string is not a constant string without
16884 * any string interpolation. 17216 * any string interpolation.
16885 */ 17217 */
16886 void appendStringValue(StringBuffer buffer); 17218 @deprecated // Use "this.stringValue"
17219 void appendStringValue(StringBuffer buffer) => _appendStringValue(buffer);
17220
17221 /**
17222 * Append the value of this string literal to the given [buffer]. Throw an
17223 * [IllegalArgumentException] if the string is not a constant string without
17224 * any string interpolation.
17225 */
17226 void _appendStringValue(StringBuffer buffer);
16887 } 17227 }
16888 17228
16889 /** 17229 /**
16890 * The invocation of a superclass' constructor from within a constructor's 17230 * The invocation of a superclass' constructor from within a constructor's
16891 * initialization list. 17231 * initialization list.
16892 * 17232 *
16893 * > superInvocation ::= 17233 * > superInvocation ::=
16894 * > 'super' ('.' [SimpleIdentifier])? [ArgumentList] 17234 * > 'super' ('.' [SimpleIdentifier])? [ArgumentList]
16895 */ 17235 */
16896 class SuperConstructorInvocation extends ConstructorInitializer { 17236 class SuperConstructorInvocation extends ConstructorInitializer {
16897 /** 17237 /**
16898 * The token for the 'super' keyword. 17238 * The token for the 'super' keyword.
16899 */ 17239 */
16900 Token keyword; 17240 Token superKeyword;
16901 17241
16902 /** 17242 /**
16903 * The token for the period before the name of the constructor that is being 17243 * The token for the period before the name of the constructor that is being
16904 * invoked, or `null` if the unnamed constructor is being invoked. 17244 * invoked, or `null` if the unnamed constructor is being invoked.
16905 */ 17245 */
16906 Token period; 17246 Token period;
16907 17247
16908 /** 17248 /**
16909 * The name of the constructor that is being invoked, or `null` if the unnamed 17249 * The name of the constructor that is being invoked, or `null` if the unnamed
16910 * constructor is being invoked. 17250 * constructor is being invoked.
(...skipping 11 matching lines...) Expand all
16922 * constructor could not be resolved. 17262 * constructor could not be resolved.
16923 */ 17263 */
16924 ConstructorElement staticElement; 17264 ConstructorElement staticElement;
16925 17265
16926 /** 17266 /**
16927 * Initialize a newly created super invocation to invoke the inherited 17267 * Initialize a newly created super invocation to invoke the inherited
16928 * constructor with the given name with the given arguments. The [period] and 17268 * constructor with the given name with the given arguments. The [period] and
16929 * [constructorName] can be `null` if the constructor being invoked is the 17269 * [constructorName] can be `null` if the constructor being invoked is the
16930 * unnamed constructor. 17270 * unnamed constructor.
16931 */ 17271 */
16932 SuperConstructorInvocation(this.keyword, this.period, 17272 SuperConstructorInvocation(this.superKeyword, this.period,
16933 SimpleIdentifier constructorName, ArgumentList argumentList) { 17273 SimpleIdentifier constructorName, ArgumentList argumentList) {
16934 _constructorName = becomeParentOf(constructorName); 17274 _constructorName = _becomeParentOf(constructorName);
16935 _argumentList = becomeParentOf(argumentList); 17275 _argumentList = _becomeParentOf(argumentList);
16936 } 17276 }
16937 17277
16938 /** 17278 /**
16939 * Return the list of arguments to the constructor. 17279 * Return the list of arguments to the constructor.
16940 */ 17280 */
16941 ArgumentList get argumentList => _argumentList; 17281 ArgumentList get argumentList => _argumentList;
16942 17282
16943 /** 17283 /**
16944 * Set the list of arguments to the constructor to the given [argumentList]. 17284 * Set the list of arguments to the constructor to the given [argumentList].
16945 */ 17285 */
16946 void set argumentList(ArgumentList argumentList) { 17286 void set argumentList(ArgumentList argumentList) {
16947 _argumentList = becomeParentOf(argumentList); 17287 _argumentList = _becomeParentOf(argumentList);
16948 } 17288 }
16949 17289
16950 @override 17290 @override
16951 Token get beginToken => keyword; 17291 Token get beginToken => superKeyword;
16952 17292
16953 @override 17293 @override
16954 Iterable get childEntities => new ChildEntities() 17294 Iterable get childEntities => new ChildEntities()
16955 ..add(keyword) 17295 ..add(superKeyword)
16956 ..add(period) 17296 ..add(period)
16957 ..add(_constructorName) 17297 ..add(_constructorName)
16958 ..add(_argumentList); 17298 ..add(_argumentList);
16959 17299
16960 /** 17300 /**
16961 * Return the name of the constructor that is being invoked, or `null` if the 17301 * Return the name of the constructor that is being invoked, or `null` if the
16962 * unnamed constructor is being invoked. 17302 * unnamed constructor is being invoked.
16963 */ 17303 */
16964 SimpleIdentifier get constructorName => _constructorName; 17304 SimpleIdentifier get constructorName => _constructorName;
16965 17305
16966 /** 17306 /**
16967 * Set the name of the constructor that is being invoked to the given 17307 * Set the name of the constructor that is being invoked to the given
16968 * [identifier]. 17308 * [identifier].
16969 */ 17309 */
16970 void set constructorName(SimpleIdentifier identifier) { 17310 void set constructorName(SimpleIdentifier identifier) {
16971 _constructorName = becomeParentOf(identifier); 17311 _constructorName = _becomeParentOf(identifier);
16972 } 17312 }
16973 17313
16974 @override 17314 @override
16975 Token get endToken => _argumentList.endToken; 17315 Token get endToken => _argumentList.endToken;
16976 17316
17317 /**
17318 * Return the token for the 'super' keyword.
17319 */
17320 @deprecated // Use "this.superKeyword"
17321 Token get keyword => superKeyword;
17322
17323 /**
17324 * Set the token for the 'super' keyword to the given [token].
17325 */
17326 @deprecated // Use "this.superKeyword"
17327 set keyword(Token token) {
17328 superKeyword = token;
17329 }
17330
16977 @override 17331 @override
16978 accept(AstVisitor visitor) => visitor.visitSuperConstructorInvocation(this); 17332 accept(AstVisitor visitor) => visitor.visitSuperConstructorInvocation(this);
16979 17333
16980 @override 17334 @override
16981 void visitChildren(AstVisitor visitor) { 17335 void visitChildren(AstVisitor visitor) {
16982 _safelyVisitChild(_constructorName, visitor); 17336 _safelyVisitChild(_constructorName, visitor);
16983 _safelyVisitChild(_argumentList, visitor); 17337 _safelyVisitChild(_argumentList, visitor);
16984 } 17338 }
16985 } 17339 }
16986 17340
16987 /** 17341 /**
16988 * A super expression. 17342 * A super expression.
16989 * 17343 *
16990 * > superExpression ::= 17344 * > superExpression ::=
16991 * > 'super' 17345 * > 'super'
16992 */ 17346 */
16993 class SuperExpression extends Expression { 17347 class SuperExpression extends Expression {
16994 /** 17348 /**
16995 * The token representing the keyword. 17349 * The token representing the 'super' keyword.
16996 */ 17350 */
16997 Token keyword; 17351 Token superKeyword;
16998 17352
16999 /** 17353 /**
17000 * Initialize a newly created super expression. 17354 * Initialize a newly created super expression.
17001 */ 17355 */
17002 SuperExpression(this.keyword); 17356 SuperExpression(this.superKeyword);
17003 17357
17004 @override 17358 @override
17005 Token get beginToken => keyword; 17359 Token get beginToken => superKeyword;
17360
17361 @override
17362 Iterable get childEntities => new ChildEntities()..add(superKeyword);
17363
17364 @override
17365 Token get endToken => superKeyword;
17006 17366
17007 /** 17367 /**
17008 * TODO(paulberry): untested. 17368 * Return the token for the 'super' keyword.
17009 */ 17369 */
17010 @override 17370 @deprecated // Use "this.superKeyword"
17011 Iterable get childEntities => new ChildEntities()..add(keyword); 17371 Token get keyword => superKeyword;
17012 17372
17013 @override 17373 /**
17014 Token get endToken => keyword; 17374 * Set the token for the 'super' keyword to the given [token].
17375 */
17376 @deprecated // Use "this.superKeyword"
17377 set keyword(Token token) {
17378 superKeyword = token;
17379 }
17015 17380
17016 @override 17381 @override
17017 int get precedence => 16; 17382 int get precedence => 16;
17018 17383
17019 @override 17384 @override
17020 accept(AstVisitor visitor) => visitor.visitSuperExpression(this); 17385 accept(AstVisitor visitor) => visitor.visitSuperExpression(this);
17021 17386
17022 @override 17387 @override
17023 void visitChildren(AstVisitor visitor) { 17388 void visitChildren(AstVisitor visitor) {
17024 // There are no children to visit. 17389 // There are no children to visit.
(...skipping 12 matching lines...) Expand all
17037 */ 17402 */
17038 Expression _expression; 17403 Expression _expression;
17039 17404
17040 /** 17405 /**
17041 * Initialize a newly created switch case. The list of [labels] can be `null` 17406 * Initialize a newly created switch case. The list of [labels] can be `null`
17042 * if there are no labels. 17407 * if there are no labels.
17043 */ 17408 */
17044 SwitchCase(List<Label> labels, Token keyword, Expression expression, 17409 SwitchCase(List<Label> labels, Token keyword, Expression expression,
17045 Token colon, List<Statement> statements) 17410 Token colon, List<Statement> statements)
17046 : super(labels, keyword, colon, statements) { 17411 : super(labels, keyword, colon, statements) {
17047 _expression = becomeParentOf(expression); 17412 _expression = _becomeParentOf(expression);
17048 } 17413 }
17049 17414
17050 @override 17415 @override
17051 Iterable get childEntities => new ChildEntities() 17416 Iterable get childEntities => new ChildEntities()
17052 ..addAll(labels) 17417 ..addAll(labels)
17053 ..add(keyword) 17418 ..add(keyword)
17054 ..add(_expression) 17419 ..add(_expression)
17055 ..add(colon) 17420 ..add(colon)
17056 ..addAll(statements); 17421 ..addAll(statements);
17057 17422
17058 /** 17423 /**
17059 * Return the expression controlling whether the statements will be executed. 17424 * Return the expression controlling whether the statements will be executed.
17060 */ 17425 */
17061 Expression get expression => _expression; 17426 Expression get expression => _expression;
17062 17427
17063 /** 17428 /**
17064 * Set the expression controlling whether the statements will be executed to 17429 * Set the expression controlling whether the statements will be executed to
17065 * the given [expression]. 17430 * the given [expression].
17066 */ 17431 */
17067 void set expression(Expression expression) { 17432 void set expression(Expression expression) {
17068 _expression = becomeParentOf(expression); 17433 _expression = _becomeParentOf(expression);
17069 } 17434 }
17070 17435
17071 @override 17436 @override
17072 accept(AstVisitor visitor) => visitor.visitSwitchCase(this); 17437 accept(AstVisitor visitor) => visitor.visitSwitchCase(this);
17073 17438
17074 @override 17439 @override
17075 void visitChildren(AstVisitor visitor) { 17440 void visitChildren(AstVisitor visitor) {
17076 labels.accept(visitor); 17441 labels.accept(visitor);
17077 _safelyVisitChild(_expression, visitor); 17442 _safelyVisitChild(_expression, visitor);
17078 statements.accept(visitor); 17443 statements.accept(visitor);
17079 } 17444 }
17080 } 17445 }
17081 17446
17082 /** 17447 /**
17083 * The default case in a switch statement. 17448 * The default case in a switch statement.
17084 * 17449 *
17085 * > switchDefault ::= 17450 * > switchDefault ::=
17086 * > [SimpleIdentifier]* 'default' ':' [Statement]* 17451 * > [SimpleIdentifier]* 'default' ':' [Statement]*
17087 */ 17452 */
17088 class SwitchDefault extends SwitchMember { 17453 class SwitchDefault extends SwitchMember {
17089 /** 17454 /**
17090 * Initialize a newly created switch default. The list of [labels] can be 17455 * Initialize a newly created switch default. The list of [labels] can be
17091 * `null` if there are no labels. 17456 * `null` if there are no labels.
17092 */ 17457 */
17093 SwitchDefault(List<Label> labels, Token keyword, Token colon, 17458 SwitchDefault(List<Label> labels, Token keyword, Token colon,
17094 List<Statement> statements) 17459 List<Statement> statements)
17095 : super(labels, keyword, colon, statements); 17460 : super(labels, keyword, colon, statements);
17096 17461
17097 /**
17098 * TODO(paulberry): untested.
17099 */
17100 @override 17462 @override
17101 Iterable get childEntities => new ChildEntities() 17463 Iterable get childEntities => new ChildEntities()
17102 ..addAll(labels) 17464 ..addAll(labels)
17103 ..add(keyword) 17465 ..add(keyword)
17104 ..add(colon) 17466 ..add(colon)
17105 ..addAll(statements); 17467 ..addAll(statements);
17106 17468
17107 @override 17469 @override
17108 accept(AstVisitor visitor) => visitor.visitSwitchDefault(this); 17470 accept(AstVisitor visitor) => visitor.visitSwitchDefault(this);
17109 17471
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
17183 /** 17545 /**
17184 * A switch statement. 17546 * A switch statement.
17185 * 17547 *
17186 * > switchStatement ::= 17548 * > switchStatement ::=
17187 * > 'switch' '(' [Expression] ')' '{' [SwitchCase]* [SwitchDefault]? '}' 17549 * > 'switch' '(' [Expression] ')' '{' [SwitchCase]* [SwitchDefault]? '}'
17188 */ 17550 */
17189 class SwitchStatement extends Statement { 17551 class SwitchStatement extends Statement {
17190 /** 17552 /**
17191 * The token representing the 'switch' keyword. 17553 * The token representing the 'switch' keyword.
17192 */ 17554 */
17193 Token keyword; 17555 Token switchKeyword;
17194 17556
17195 /** 17557 /**
17196 * The left parenthesis. 17558 * The left parenthesis.
17197 */ 17559 */
17198 Token leftParenthesis; 17560 Token leftParenthesis;
17199 17561
17200 /** 17562 /**
17201 * The expression used to determine which of the switch members will be 17563 * The expression used to determine which of the switch members will be
17202 * selected. 17564 * selected.
17203 */ 17565 */
(...skipping 16 matching lines...) Expand all
17220 17582
17221 /** 17583 /**
17222 * The right curly bracket. 17584 * The right curly bracket.
17223 */ 17585 */
17224 Token rightBracket; 17586 Token rightBracket;
17225 17587
17226 /** 17588 /**
17227 * Initialize a newly created switch statement. The list of [members] can be 17589 * Initialize a newly created switch statement. The list of [members] can be
17228 * `null` if there are no switch members. 17590 * `null` if there are no switch members.
17229 */ 17591 */
17230 SwitchStatement(this.keyword, this.leftParenthesis, Expression expression, 17592 SwitchStatement(this.switchKeyword, this.leftParenthesis, Expression expressio n,
17231 this.rightParenthesis, this.leftBracket, List<SwitchMember> members, 17593 this.rightParenthesis, this.leftBracket, List<SwitchMember> members,
17232 this.rightBracket) { 17594 this.rightBracket) {
17233 _expression = becomeParentOf(expression); 17595 _expression = _becomeParentOf(expression);
17234 _members = new NodeList<SwitchMember>(this, members); 17596 _members = new NodeList<SwitchMember>(this, members);
17235 } 17597 }
17236 17598
17237 @override 17599 @override
17238 Token get beginToken => keyword; 17600 Token get beginToken => switchKeyword;
17239 17601
17240 @override 17602 @override
17241 Iterable get childEntities => new ChildEntities() 17603 Iterable get childEntities => new ChildEntities()
17242 ..add(keyword) 17604 ..add(switchKeyword)
17243 ..add(leftParenthesis) 17605 ..add(leftParenthesis)
17244 ..add(_expression) 17606 ..add(_expression)
17245 ..add(rightParenthesis) 17607 ..add(rightParenthesis)
17246 ..add(leftBracket) 17608 ..add(leftBracket)
17247 ..addAll(_members) 17609 ..addAll(_members)
17248 ..add(rightBracket); 17610 ..add(rightBracket);
17249 17611
17250 @override 17612 @override
17251 Token get endToken => rightBracket; 17613 Token get endToken => rightBracket;
17252 17614
17253 /** 17615 /**
17254 * Return the expression used to determine which of the switch members will be 17616 * Return the expression used to determine which of the switch members will be
17255 * selected. 17617 * selected.
17256 */ 17618 */
17257 Expression get expression => _expression; 17619 Expression get expression => _expression;
17258 17620
17259 /** 17621 /**
17260 * Set the expression used to determine which of the switch members will be 17622 * Set the expression used to determine which of the switch members will be
17261 * selected to the given [expression]. 17623 * selected to the given [expression].
17262 */ 17624 */
17263 void set expression(Expression expression) { 17625 void set expression(Expression expression) {
17264 _expression = becomeParentOf(expression); 17626 _expression = _becomeParentOf(expression);
17265 } 17627 }
17266 17628
17267 /** 17629 /**
17630 * Return the token representing the 'switch' keyword.
17631 */
17632 @deprecated // Use "this.switchKeyword"
17633 Token get keyword => switchKeyword;
17634
17635 /**
17636 * Set the token representing the 'switch' keyword to the given [token].
17637 */
17638 @deprecated // Use "this.switchKeyword"
17639 set keyword(Token token) {
17640 switchKeyword = token;
17641 }
17642
17643 /**
17268 * Return the switch members that can be selected by the expression. 17644 * Return the switch members that can be selected by the expression.
17269 */ 17645 */
17270 NodeList<SwitchMember> get members => _members; 17646 NodeList<SwitchMember> get members => _members;
17271 17647
17272 @override 17648 @override
17273 accept(AstVisitor visitor) => visitor.visitSwitchStatement(this); 17649 accept(AstVisitor visitor) => visitor.visitSwitchStatement(this);
17274 17650
17275 @override 17651 @override
17276 void visitChildren(AstVisitor visitor) { 17652 void visitChildren(AstVisitor visitor) {
17277 _safelyVisitChild(_expression, visitor); 17653 _safelyVisitChild(_expression, visitor);
(...skipping 20 matching lines...) Expand all
17298 17674
17299 /** 17675 /**
17300 * Initialize a newly created symbol literal. 17676 * Initialize a newly created symbol literal.
17301 */ 17677 */
17302 SymbolLiteral(this.poundSign, this.components); 17678 SymbolLiteral(this.poundSign, this.components);
17303 17679
17304 @override 17680 @override
17305 Token get beginToken => poundSign; 17681 Token get beginToken => poundSign;
17306 17682
17307 /** 17683 /**
17308 * TODO(paulberry): untested.
17309 * TODO(paulberry): add "." tokens. 17684 * TODO(paulberry): add "." tokens.
17310 */ 17685 */
17311 @override 17686 @override
17312 Iterable get childEntities => new ChildEntities() 17687 Iterable get childEntities => new ChildEntities()
17313 ..add(poundSign) 17688 ..add(poundSign)
17314 ..addAll(components); 17689 ..addAll(components);
17315 17690
17316 @override 17691 @override
17317 Token get endToken => components[components.length - 1]; 17692 Token get endToken => components[components.length - 1];
17318 17693
17319 @override 17694 @override
17320 accept(AstVisitor visitor) => visitor.visitSymbolLiteral(this); 17695 accept(AstVisitor visitor) => visitor.visitSymbolLiteral(this);
17321 17696
17322 @override 17697 @override
17323 void visitChildren(AstVisitor visitor) { 17698 void visitChildren(AstVisitor visitor) {
17324 // There are no children to visit. 17699 // There are no children to visit.
17325 } 17700 }
17326 } 17701 }
17327 17702
17328 /** 17703 /**
17329 * A this expression. 17704 * A this expression.
17330 * 17705 *
17331 * > thisExpression ::= 17706 * > thisExpression ::=
17332 * > 'this' 17707 * > 'this'
17333 */ 17708 */
17334 class ThisExpression extends Expression { 17709 class ThisExpression extends Expression {
17335 /** 17710 /**
17336 * The token representing the keyword. 17711 * The token representing the 'this' keyword.
17337 */ 17712 */
17338 Token keyword; 17713 Token thisKeyword;
17339 17714
17340 /** 17715 /**
17341 * Initialize a newly created this expression. 17716 * Initialize a newly created this expression.
17342 */ 17717 */
17343 ThisExpression(this.keyword); 17718 ThisExpression(this.thisKeyword);
17344 17719
17345 @override 17720 @override
17346 Token get beginToken => keyword; 17721 Token get beginToken => thisKeyword;
17722
17723 @override
17724 Iterable get childEntities => new ChildEntities()..add(thisKeyword);
17725
17726 @override
17727 Token get endToken => thisKeyword;
17347 17728
17348 /** 17729 /**
17349 * TODO(paulberry): untested. 17730 * Return the token representing the 'this' keyword.
17350 */ 17731 */
17351 @override 17732 @deprecated // Use "this.thisKeyword"
17352 Iterable get childEntities => new ChildEntities()..add(keyword); 17733 Token get keyword => thisKeyword;
17353 17734
17354 @override 17735 /**
17355 Token get endToken => keyword; 17736 * Set the token representing the 'this' keyword to the given [token].
17737 */
17738 @deprecated // Use "this.thisKeyword"
17739 set keyword(Token token) {
17740 thisKeyword = token;
17741 }
17356 17742
17357 @override 17743 @override
17358 int get precedence => 16; 17744 int get precedence => 16;
17359 17745
17360 @override 17746 @override
17361 accept(AstVisitor visitor) => visitor.visitThisExpression(this); 17747 accept(AstVisitor visitor) => visitor.visitThisExpression(this);
17362 17748
17363 @override 17749 @override
17364 void visitChildren(AstVisitor visitor) { 17750 void visitChildren(AstVisitor visitor) {
17365 // There are no children to visit. 17751 // There are no children to visit.
17366 } 17752 }
17367 } 17753 }
17368 17754
17369 /** 17755 /**
17370 * A throw expression. 17756 * A throw expression.
17371 * 17757 *
17372 * > throwExpression ::= 17758 * > throwExpression ::=
17373 * > 'throw' [Expression] 17759 * > 'throw' [Expression]
17374 */ 17760 */
17375 class ThrowExpression extends Expression { 17761 class ThrowExpression extends Expression {
17376 /** 17762 /**
17377 * The token representing the 'throw' keyword. 17763 * The token representing the 'throw' keyword.
17378 */ 17764 */
17379 Token keyword; 17765 Token throwKeyword;
17380 17766
17381 /** 17767 /**
17382 * The expression computing the exception to be thrown. 17768 * The expression computing the exception to be thrown.
17383 */ 17769 */
17384 Expression _expression; 17770 Expression _expression;
17385 17771
17386 /** 17772 /**
17387 * Initialize a newly created throw expression. 17773 * Initialize a newly created throw expression.
17388 */ 17774 */
17389 ThrowExpression(this.keyword, Expression expression) { 17775 ThrowExpression(this.throwKeyword, Expression expression) {
17390 _expression = becomeParentOf(expression); 17776 _expression = _becomeParentOf(expression);
17391 } 17777 }
17392 17778
17393 @override 17779 @override
17394 Token get beginToken => keyword; 17780 Token get beginToken => throwKeyword;
17395 17781
17396 @override 17782 @override
17397 Iterable get childEntities => new ChildEntities() 17783 Iterable get childEntities => new ChildEntities()
17398 ..add(keyword) 17784 ..add(throwKeyword)
17399 ..add(_expression); 17785 ..add(_expression);
17400 17786
17401 @override 17787 @override
17402 Token get endToken { 17788 Token get endToken {
17403 if (_expression != null) { 17789 if (_expression != null) {
17404 return _expression.endToken; 17790 return _expression.endToken;
17405 } 17791 }
17406 return keyword; 17792 return throwKeyword;
17407 } 17793 }
17408 17794
17409 /** 17795 /**
17410 * Return the expression computing the exception to be thrown. 17796 * Return the expression computing the exception to be thrown.
17411 */ 17797 */
17412 Expression get expression => _expression; 17798 Expression get expression => _expression;
17413 17799
17414 /** 17800 /**
17415 * Set the expression computing the exception to be thrown to the given 17801 * Set the expression computing the exception to be thrown to the given
17416 * [expression]. 17802 * [expression].
17417 */ 17803 */
17418 void set expression(Expression expression) { 17804 void set expression(Expression expression) {
17419 _expression = becomeParentOf(expression); 17805 _expression = _becomeParentOf(expression);
17806 }
17807
17808 /**
17809 * Return the token representing the 'throw' keyword.
17810 */
17811 @deprecated // Use "this.throwKeyword"
17812 Token get keyword => throwKeyword;
17813
17814 /**
17815 * Set the token representing the 'throw' keyword to the given [token].
17816 */
17817 @deprecated // Use "this.throwKeyword"
17818 set keyword(Token token) {
17819 throwKeyword = token;
17420 } 17820 }
17421 17821
17422 @override 17822 @override
17423 int get precedence => 0; 17823 int get precedence => 0;
17424 17824
17425 @override 17825 @override
17426 accept(AstVisitor visitor) => visitor.visitThrowExpression(this); 17826 accept(AstVisitor visitor) => visitor.visitThrowExpression(this);
17427 17827
17428 @override 17828 @override
17429 void visitChildren(AstVisitor visitor) { 17829 void visitChildren(AstVisitor visitor) {
(...skipping 20 matching lines...) Expand all
17450 Token semicolon; 17850 Token semicolon;
17451 17851
17452 /** 17852 /**
17453 * Initialize a newly created top-level variable declaration. Either or both 17853 * Initialize a newly created top-level variable declaration. Either or both
17454 * of the [comment] and [metadata] can be `null` if the variable does not have 17854 * of the [comment] and [metadata] can be `null` if the variable does not have
17455 * the corresponding attribute. 17855 * the corresponding attribute.
17456 */ 17856 */
17457 TopLevelVariableDeclaration(Comment comment, List<Annotation> metadata, 17857 TopLevelVariableDeclaration(Comment comment, List<Annotation> metadata,
17458 VariableDeclarationList variableList, this.semicolon) 17858 VariableDeclarationList variableList, this.semicolon)
17459 : super(comment, metadata) { 17859 : super(comment, metadata) {
17460 _variableList = becomeParentOf(variableList); 17860 _variableList = _becomeParentOf(variableList);
17461 } 17861 }
17462 17862
17463 @override 17863 @override
17464 Iterable get childEntities => super._childEntities 17864 Iterable get childEntities => super._childEntities
17465 ..add(_variableList) 17865 ..add(_variableList)
17466 ..add(semicolon); 17866 ..add(semicolon);
17467 17867
17468 @override 17868 @override
17469 Element get element => null; 17869 Element get element => null;
17470 17870
17471 @override 17871 @override
17472 Token get endToken => semicolon; 17872 Token get endToken => semicolon;
17473 17873
17474 @override 17874 @override
17475 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; 17875 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken;
17476 17876
17477 /** 17877 /**
17478 * Return the top-level variables being declared. 17878 * Return the top-level variables being declared.
17479 */ 17879 */
17480 VariableDeclarationList get variables => _variableList; 17880 VariableDeclarationList get variables => _variableList;
17481 17881
17482 /** 17882 /**
17483 * Set the top-level variables being declared to the given list of 17883 * Set the top-level variables being declared to the given list of
17484 * [variables]. 17884 * [variables].
17485 */ 17885 */
17486 void set variables(VariableDeclarationList variables) { 17886 void set variables(VariableDeclarationList variables) {
17487 _variableList = becomeParentOf(variables); 17887 _variableList = _becomeParentOf(variables);
17488 } 17888 }
17489 17889
17490 @override 17890 @override
17491 accept(AstVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); 17891 accept(AstVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this);
17492 17892
17493 @override 17893 @override
17494 void visitChildren(AstVisitor visitor) { 17894 void visitChildren(AstVisitor visitor) {
17495 super.visitChildren(visitor); 17895 super.visitChildren(visitor);
17496 _safelyVisitChild(_variableList, visitor); 17896 _safelyVisitChild(_variableList, visitor);
17497 } 17897 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
17712 _visitNodeWithPrefix(".", node.name); 18112 _visitNodeWithPrefix(".", node.name);
17713 _visitNode(node.parameters); 18113 _visitNode(node.parameters);
17714 _visitNodeListWithSeparatorAndPrefix(" : ", node.initializers, ", "); 18114 _visitNodeListWithSeparatorAndPrefix(" : ", node.initializers, ", ");
17715 _visitNodeWithPrefix(" = ", node.redirectedConstructor); 18115 _visitNodeWithPrefix(" = ", node.redirectedConstructor);
17716 _visitFunctionWithPrefix(" ", node.body); 18116 _visitFunctionWithPrefix(" ", node.body);
17717 return null; 18117 return null;
17718 } 18118 }
17719 18119
17720 @override 18120 @override
17721 Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) { 18121 Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
17722 _visitTokenWithSuffix(node.keyword, "."); 18122 _visitTokenWithSuffix(node.thisKeyword, ".");
17723 _visitNode(node.fieldName); 18123 _visitNode(node.fieldName);
17724 _writer.print(" = "); 18124 _writer.print(" = ");
17725 _visitNode(node.expression); 18125 _visitNode(node.expression);
17726 return null; 18126 return null;
17727 } 18127 }
17728 18128
17729 @override 18129 @override
17730 Object visitConstructorName(ConstructorName node) { 18130 Object visitConstructorName(ConstructorName node) {
17731 _visitNode(node.type); 18131 _visitNode(node.type);
17732 _visitNodeWithPrefix(".", node.name); 18132 _visitNodeWithPrefix(".", node.name);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
18004 _writer.print("implements "); 18404 _writer.print("implements ");
18005 _visitNodeListWithSeparator(node.interfaces, ", "); 18405 _visitNodeListWithSeparator(node.interfaces, ", ");
18006 return null; 18406 return null;
18007 } 18407 }
18008 18408
18009 @override 18409 @override
18010 Object visitImportDirective(ImportDirective node) { 18410 Object visitImportDirective(ImportDirective node) {
18011 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " "); 18411 _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
18012 _writer.print("import "); 18412 _writer.print("import ");
18013 _visitNode(node.uri); 18413 _visitNode(node.uri);
18014 if (node.deferredToken != null) { 18414 if (node.deferredKeyword != null) {
18015 _writer.print(" deferred"); 18415 _writer.print(" deferred");
18016 } 18416 }
18017 _visitNodeWithPrefix(" as ", node.prefix); 18417 _visitNodeWithPrefix(" as ", node.prefix);
18018 _visitNodeListWithSeparatorAndPrefix(" ", node.combinators, " "); 18418 _visitNodeListWithSeparatorAndPrefix(" ", node.combinators, " ");
18019 _writer.print(';'); 18419 _writer.print(';');
18020 return null; 18420 return null;
18021 } 18421 }
18022 18422
18023 @override 18423 @override
18024 Object visitIndexExpression(IndexExpression node) { 18424 Object visitIndexExpression(IndexExpression node) {
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
18643 */ 19043 */
18644 Block _finallyBlock; 19044 Block _finallyBlock;
18645 19045
18646 /** 19046 /**
18647 * Initialize a newly created try statement. The list of [catchClauses] can be 19047 * Initialize a newly created try statement. The list of [catchClauses] can be
18648 * `null` if there are no catch clauses. The [finallyKeyword] and 19048 * `null` if there are no catch clauses. The [finallyKeyword] and
18649 * [finallyBlock] can be `null` if there is no finally clause. 19049 * [finallyBlock] can be `null` if there is no finally clause.
18650 */ 19050 */
18651 TryStatement(this.tryKeyword, Block body, List<CatchClause> catchClauses, 19051 TryStatement(this.tryKeyword, Block body, List<CatchClause> catchClauses,
18652 this.finallyKeyword, Block finallyBlock) { 19052 this.finallyKeyword, Block finallyBlock) {
18653 _body = becomeParentOf(body); 19053 _body = _becomeParentOf(body);
18654 _catchClauses = new NodeList<CatchClause>(this, catchClauses); 19054 _catchClauses = new NodeList<CatchClause>(this, catchClauses);
18655 _finallyBlock = becomeParentOf(finallyBlock); 19055 _finallyBlock = _becomeParentOf(finallyBlock);
18656 } 19056 }
18657 19057
18658 @override 19058 @override
18659 Token get beginToken => tryKeyword; 19059 Token get beginToken => tryKeyword;
18660 19060
18661 /** 19061 /**
18662 * Return the body of the statement. 19062 * Return the body of the statement.
18663 */ 19063 */
18664 Block get body => _body; 19064 Block get body => _body;
18665 19065
18666 /** 19066 /**
18667 * Set the body of the statement to the given [block]. 19067 * Set the body of the statement to the given [block].
18668 */ 19068 */
18669 void set body(Block block) { 19069 void set body(Block block) {
18670 _body = becomeParentOf(block); 19070 _body = _becomeParentOf(block);
18671 } 19071 }
18672 19072
18673 /** 19073 /**
18674 * Return the catch clauses contained in the try statement. 19074 * Return the catch clauses contained in the try statement.
18675 */ 19075 */
18676 NodeList<CatchClause> get catchClauses => _catchClauses; 19076 NodeList<CatchClause> get catchClauses => _catchClauses;
18677 19077
18678 @override 19078 @override
18679 Iterable get childEntities => new ChildEntities() 19079 Iterable get childEntities => new ChildEntities()
18680 ..add(tryKeyword) 19080 ..add(tryKeyword)
(...skipping 17 matching lines...) Expand all
18698 /** 19098 /**
18699 * Return the finally block contained in the try statement, or `null` if the 19099 * Return the finally block contained in the try statement, or `null` if the
18700 * statement does not contain a finally clause. 19100 * statement does not contain a finally clause.
18701 */ 19101 */
18702 Block get finallyBlock => _finallyBlock; 19102 Block get finallyBlock => _finallyBlock;
18703 19103
18704 /** 19104 /**
18705 * Set the finally block contained in the try statement to the given [block]. 19105 * Set the finally block contained in the try statement to the given [block].
18706 */ 19106 */
18707 void set finallyBlock(Block block) { 19107 void set finallyBlock(Block block) {
18708 _finallyBlock = becomeParentOf(block); 19108 _finallyBlock = _becomeParentOf(block);
18709 } 19109 }
18710 19110
18711 @override 19111 @override
18712 accept(AstVisitor visitor) => visitor.visitTryStatement(this); 19112 accept(AstVisitor visitor) => visitor.visitTryStatement(this);
18713 19113
18714 @override 19114 @override
18715 void visitChildren(AstVisitor visitor) { 19115 void visitChildren(AstVisitor visitor) {
18716 _safelyVisitChild(_body, visitor); 19116 _safelyVisitChild(_body, visitor);
18717 _catchClauses.accept(visitor); 19117 _catchClauses.accept(visitor);
18718 _safelyVisitChild(_finallyBlock, visitor); 19118 _safelyVisitChild(_finallyBlock, visitor);
18719 } 19119 }
18720 } 19120 }
18721 19121
18722 /** 19122 /**
18723 * The declaration of a type alias. 19123 * The declaration of a type alias.
18724 * 19124 *
18725 * > typeAlias ::= 19125 * > typeAlias ::=
18726 * > 'typedef' typeAliasBody 19126 * > 'typedef' typeAliasBody
18727 * > 19127 * >
18728 * > typeAliasBody ::= 19128 * > typeAliasBody ::=
18729 * > classTypeAlias 19129 * > classTypeAlias
18730 * > | functionTypeAlias 19130 * > | functionTypeAlias
18731 */ 19131 */
18732 abstract class TypeAlias extends CompilationUnitMember { 19132 abstract class TypeAlias extends CompilationUnitMember {
18733 /** 19133 /**
18734 * The token representing the 'typedef' keyword. 19134 * The token representing the 'typedef' keyword.
18735 */ 19135 */
18736 Token keyword; 19136 Token typedefKeyword;
18737 19137
18738 /** 19138 /**
18739 * The semicolon terminating the declaration. 19139 * The semicolon terminating the declaration.
18740 */ 19140 */
18741 Token semicolon; 19141 Token semicolon;
18742 19142
18743 /** 19143 /**
18744 * Initialize a newly created type alias. Either or both of the [comment] and 19144 * Initialize a newly created type alias. Either or both of the [comment] and
18745 * [metadata] can be `null` if the declaration does not have the corresponding 19145 * [metadata] can be `null` if the declaration does not have the corresponding
18746 * attribute. 19146 * attribute.
18747 */ 19147 */
18748 TypeAlias(Comment comment, List<Annotation> metadata, this.keyword, 19148 TypeAlias(Comment comment, List<Annotation> metadata, this.typedefKeyword,
18749 this.semicolon) 19149 this.semicolon)
18750 : super(comment, metadata); 19150 : super(comment, metadata);
18751 19151
18752 @override 19152 @override
18753 Token get endToken => semicolon; 19153 Token get endToken => semicolon;
18754 19154
18755 @override 19155 @override
18756 Token get firstTokenAfterCommentAndMetadata => keyword; 19156 Token get firstTokenAfterCommentAndMetadata => typedefKeyword;
19157
19158 /**
19159 * Return the token representing the 'typedef' keyword.
19160 */
19161 @deprecated // Use "this.typedefKeyword"
19162 Token get keyword => typedefKeyword;
19163
19164 /**
19165 * Set the token representing the 'typedef' keyword to the given [token].
19166 */
19167 @deprecated // Use "this.typedefKeyword"
19168 set keyword(Token token) {
19169 typedefKeyword = token;
19170 }
18757 } 19171 }
18758 19172
18759 /** 19173 /**
18760 * A list of type arguments. 19174 * A list of type arguments.
18761 * 19175 *
18762 * > typeArguments ::= 19176 * > typeArguments ::=
18763 * > '<' typeName (',' typeName)* '>' 19177 * > '<' typeName (',' typeName)* '>'
18764 */ 19178 */
18765 class TypeArgumentList extends AstNode { 19179 class TypeArgumentList extends AstNode {
18766 /** 19180 /**
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
18834 * arguments were declared. 19248 * arguments were declared.
18835 */ 19249 */
18836 TypeArgumentList _typeArguments; 19250 TypeArgumentList _typeArguments;
18837 19251
18838 /** 19252 /**
18839 * Initialize a newly created typed literal. The [constKeyword] can be `null`\ 19253 * Initialize a newly created typed literal. The [constKeyword] can be `null`\
18840 * if the literal is not a constant. The [typeArguments] can be `null` if no 19254 * if the literal is not a constant. The [typeArguments] can be `null` if no
18841 * type arguments were declared. 19255 * type arguments were declared.
18842 */ 19256 */
18843 TypedLiteral(this.constKeyword, TypeArgumentList typeArguments) { 19257 TypedLiteral(this.constKeyword, TypeArgumentList typeArguments) {
18844 _typeArguments = becomeParentOf(typeArguments); 19258 _typeArguments = _becomeParentOf(typeArguments);
18845 } 19259 }
18846 19260
18847 /** 19261 /**
18848 * Return the type argument associated with this literal, or `null` if no type 19262 * Return the type argument associated with this literal, or `null` if no type
18849 * arguments were declared. 19263 * arguments were declared.
18850 */ 19264 */
18851 TypeArgumentList get typeArguments => _typeArguments; 19265 TypeArgumentList get typeArguments => _typeArguments;
18852 19266
18853 /** 19267 /**
18854 * Set the type argument associated with this literal to the given 19268 * Set the type argument associated with this literal to the given
18855 * [typeArguments]. 19269 * [typeArguments].
18856 */ 19270 */
18857 void set typeArguments(TypeArgumentList typeArguments) { 19271 void set typeArguments(TypeArgumentList typeArguments) {
18858 _typeArguments = becomeParentOf(typeArguments); 19272 _typeArguments = _becomeParentOf(typeArguments);
18859 } 19273 }
18860 19274
18861 ChildEntities get _childEntities => new ChildEntities() 19275 ChildEntities get _childEntities => new ChildEntities()
18862 ..add(constKeyword) 19276 ..add(constKeyword)
18863 ..add(_typeArguments); 19277 ..add(_typeArguments);
18864 19278
18865 @override 19279 @override
18866 void visitChildren(AstVisitor visitor) { 19280 void visitChildren(AstVisitor visitor) {
18867 _safelyVisitChild(_typeArguments, visitor); 19281 _safelyVisitChild(_typeArguments, visitor);
18868 } 19282 }
(...skipping 20 matching lines...) Expand all
18889 /** 19303 /**
18890 * The type being named, or `null` if the AST structure has not been resolved. 19304 * The type being named, or `null` if the AST structure has not been resolved.
18891 */ 19305 */
18892 DartType type; 19306 DartType type;
18893 19307
18894 /** 19308 /**
18895 * Initialize a newly created type name. The [typeArguments] can be `null` if 19309 * Initialize a newly created type name. The [typeArguments] can be `null` if
18896 * there are no type arguments. 19310 * there are no type arguments.
18897 */ 19311 */
18898 TypeName(Identifier name, TypeArgumentList typeArguments) { 19312 TypeName(Identifier name, TypeArgumentList typeArguments) {
18899 _name = becomeParentOf(name); 19313 _name = _becomeParentOf(name);
18900 _typeArguments = becomeParentOf(typeArguments); 19314 _typeArguments = _becomeParentOf(typeArguments);
18901 } 19315 }
18902 19316
18903 @override 19317 @override
18904 Token get beginToken => _name.beginToken; 19318 Token get beginToken => _name.beginToken;
18905 19319
18906 @override 19320 @override
18907 Iterable get childEntities => new ChildEntities() 19321 Iterable get childEntities => new ChildEntities()
18908 ..add(_name) 19322 ..add(_name)
18909 ..add(_typeArguments); 19323 ..add(_typeArguments);
18910 19324
(...skipping 24 matching lines...) Expand all
18935 19349
18936 /** 19350 /**
18937 * Return the name of the type. 19351 * Return the name of the type.
18938 */ 19352 */
18939 Identifier get name => _name; 19353 Identifier get name => _name;
18940 19354
18941 /** 19355 /**
18942 * Set the name of the type to the given [identifier]. 19356 * Set the name of the type to the given [identifier].
18943 */ 19357 */
18944 void set name(Identifier identifier) { 19358 void set name(Identifier identifier) {
18945 _name = becomeParentOf(identifier); 19359 _name = _becomeParentOf(identifier);
18946 } 19360 }
18947 19361
18948 /** 19362 /**
18949 * Return the type arguments associated with the type, or `null` if there are 19363 * Return the type arguments associated with the type, or `null` if there are
18950 * no type arguments. 19364 * no type arguments.
18951 */ 19365 */
18952 TypeArgumentList get typeArguments => _typeArguments; 19366 TypeArgumentList get typeArguments => _typeArguments;
18953 19367
18954 /** 19368 /**
18955 * Set the type arguments associated with the type to the given 19369 * Set the type arguments associated with the type to the given
18956 * [typeArguments]. 19370 * [typeArguments].
18957 */ 19371 */
18958 void set typeArguments(TypeArgumentList typeArguments) { 19372 void set typeArguments(TypeArgumentList typeArguments) {
18959 _typeArguments = becomeParentOf(typeArguments); 19373 _typeArguments = _becomeParentOf(typeArguments);
18960 } 19374 }
18961 19375
18962 @override 19376 @override
18963 accept(AstVisitor visitor) => visitor.visitTypeName(this); 19377 accept(AstVisitor visitor) => visitor.visitTypeName(this);
18964 19378
18965 @override 19379 @override
18966 void visitChildren(AstVisitor visitor) { 19380 void visitChildren(AstVisitor visitor) {
18967 _safelyVisitChild(_name, visitor); 19381 _safelyVisitChild(_name, visitor);
18968 _safelyVisitChild(_typeArguments, visitor); 19382 _safelyVisitChild(_typeArguments, visitor);
18969 } 19383 }
18970 } 19384 }
18971 19385
18972 /** 19386 /**
18973 * A type parameter. 19387 * A type parameter.
18974 * 19388 *
18975 * > typeParameter ::= 19389 * > typeParameter ::=
18976 * > [SimpleIdentifier] ('extends' [TypeName])? 19390 * > [SimpleIdentifier] ('extends' [TypeName])?
18977 */ 19391 */
18978 class TypeParameter extends Declaration { 19392 class TypeParameter extends Declaration {
18979 /** 19393 /**
18980 * The name of the type parameter. 19394 * The name of the type parameter.
18981 */ 19395 */
18982 SimpleIdentifier _name; 19396 SimpleIdentifier _name;
18983 19397
18984 /** 19398 /**
18985 * The token representing the 'extends' keyword, or `null` if there is no 19399 * The token representing the 'extends' keyword, or `null` if there is no
18986 * explicit upper bound. 19400 * explicit upper bound.
18987 */ 19401 */
18988 Token keyword; 19402 Token extendsKeyword;
18989 19403
18990 /** 19404 /**
18991 * The name of the upper bound for legal arguments, or `null` if there is no 19405 * The name of the upper bound for legal arguments, or `null` if there is no
18992 * explicit upper bound. 19406 * explicit upper bound.
18993 */ 19407 */
18994 TypeName _bound; 19408 TypeName _bound;
18995 19409
18996 /** 19410 /**
18997 * Initialize a newly created type parameter. Either or both of the [comment] 19411 * Initialize a newly created type parameter. Either or both of the [comment]
18998 * and [metadata] can be `null` if the parameter does not have the 19412 * and [metadata] can be `null` if the parameter does not have the
18999 * corresponding attribute. The [keyword] and [bound] can be `null` if the 19413 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
19000 * parameter does not have an upper bound. 19414 * the parameter does not have an upper bound.
19001 */ 19415 */
19002 TypeParameter(Comment comment, List<Annotation> metadata, 19416 TypeParameter(Comment comment, List<Annotation> metadata,
19003 SimpleIdentifier name, this.keyword, TypeName bound) 19417 SimpleIdentifier name, this.extendsKeyword, TypeName bound)
19004 : super(comment, metadata) { 19418 : super(comment, metadata) {
19005 _name = becomeParentOf(name); 19419 _name = _becomeParentOf(name);
19006 _bound = becomeParentOf(bound); 19420 _bound = _becomeParentOf(bound);
19007 } 19421 }
19008 19422
19009 /** 19423 /**
19010 * Return the name of the upper bound for legal arguments, or `null` if there 19424 * Return the name of the upper bound for legal arguments, or `null` if there
19011 * is no explicit upper bound. 19425 * is no explicit upper bound.
19012 */ 19426 */
19013 TypeName get bound => _bound; 19427 TypeName get bound => _bound;
19014 19428
19015 /** 19429 /**
19016 * Set the name of the upper bound for legal arguments to the given 19430 * Set the name of the upper bound for legal arguments to the given
19017 * [typeName]. 19431 * [typeName].
19018 */ 19432 */
19019 void set bound(TypeName typeName) { 19433 void set bound(TypeName typeName) {
19020 _bound = becomeParentOf(typeName); 19434 _bound = _becomeParentOf(typeName);
19021 } 19435 }
19022 19436
19023 @override 19437 @override
19024 Iterable get childEntities => super._childEntities 19438 Iterable get childEntities => super._childEntities
19025 ..add(_name) 19439 ..add(_name)
19026 ..add(keyword) 19440 ..add(extendsKeyword)
19027 ..add(_bound); 19441 ..add(_bound);
19028 19442
19029 @override 19443 @override
19030 TypeParameterElement get element => 19444 TypeParameterElement get element =>
19031 _name != null ? (_name.staticElement as TypeParameterElement) : null; 19445 _name != null ? (_name.staticElement as TypeParameterElement) : null;
19032 19446
19033 @override 19447 @override
19034 Token get endToken { 19448 Token get endToken {
19035 if (_bound == null) { 19449 if (_bound == null) {
19036 return _name.endToken; 19450 return _name.endToken;
19037 } 19451 }
19038 return _bound.endToken; 19452 return _bound.endToken;
19039 } 19453 }
19040 19454
19041 @override 19455 @override
19042 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; 19456 Token get firstTokenAfterCommentAndMetadata => _name.beginToken;
19043 19457
19044 /** 19458 /**
19459 * Return the token representing the 'extends' keyword, or `null` if there is
19460 * no explicit upper bound.
19461 */
19462 @deprecated // Use "this.extendsKeyword"
19463 Token get keyword => extendsKeyword;
19464
19465 /**
19466 * Set the token representing the 'extends' keyword to the given [token].
19467 */
19468 @deprecated // Use "this.extendsKeyword"
19469 set keyword(Token token) {
19470 extendsKeyword = token;
19471 }
19472
19473 /**
19045 * Return the name of the type parameter. 19474 * Return the name of the type parameter.
19046 */ 19475 */
19047 SimpleIdentifier get name => _name; 19476 SimpleIdentifier get name => _name;
19048 19477
19049 /** 19478 /**
19050 * Set the name of the type parameter to the given [identifier]. 19479 * Set the name of the type parameter to the given [identifier].
19051 */ 19480 */
19052 void set name(SimpleIdentifier identifier) { 19481 void set name(SimpleIdentifier identifier) {
19053 _name = becomeParentOf(identifier); 19482 _name = _becomeParentOf(identifier);
19054 } 19483 }
19055 19484
19056 @override 19485 @override
19057 accept(AstVisitor visitor) => visitor.visitTypeParameter(this); 19486 accept(AstVisitor visitor) => visitor.visitTypeParameter(this);
19058 19487
19059 @override 19488 @override
19060 void visitChildren(AstVisitor visitor) { 19489 void visitChildren(AstVisitor visitor) {
19061 super.visitChildren(visitor); 19490 super.visitChildren(visitor);
19062 _safelyVisitChild(_name, visitor); 19491 _safelyVisitChild(_name, visitor);
19063 _safelyVisitChild(_bound, visitor); 19492 _safelyVisitChild(_bound, visitor);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
19500 Source source; 19929 Source source;
19501 19930
19502 /** 19931 /**
19503 * Initialize a newly create URI-based directive. Either or both of the 19932 * Initialize a newly create URI-based directive. Either or both of the
19504 * [comment] and [metadata] can be `null` if the directive does not have the 19933 * [comment] and [metadata] can be `null` if the directive does not have the
19505 * corresponding attribute. 19934 * corresponding attribute.
19506 */ 19935 */
19507 UriBasedDirective(Comment comment, List<Annotation> metadata, 19936 UriBasedDirective(Comment comment, List<Annotation> metadata,
19508 StringLiteral uri) 19937 StringLiteral uri)
19509 : super(comment, metadata) { 19938 : super(comment, metadata) {
19510 _uri = becomeParentOf(uri); 19939 _uri = _becomeParentOf(uri);
19511 } 19940 }
19512 19941
19513 /** 19942 /**
19514 * Return the URI referenced by this directive. 19943 * Return the URI referenced by this directive.
19515 */ 19944 */
19516 StringLiteral get uri => _uri; 19945 StringLiteral get uri => _uri;
19517 19946
19518 /** 19947 /**
19519 * Set the URI referenced by this directive to the given [uri]. 19948 * Set the URI referenced by this directive to the given [uri].
19520 */ 19949 */
19521 void set uri(StringLiteral uri) { 19950 void set uri(StringLiteral uri) {
19522 _uri = becomeParentOf(uri); 19951 _uri = _becomeParentOf(uri);
19523 } 19952 }
19524 19953
19525 /** 19954 /**
19526 * Return the element associated with the URI of this directive, or `null` if 19955 * Return the element associated with the URI of this directive, or `null` if
19527 * the AST structure has not been resolved or if the URI could not be 19956 * the AST structure has not been resolved or if the URI could not be
19528 * resolved. Examples of the latter case include a directive that contains an 19957 * resolved. Examples of the latter case include a directive that contains an
19529 * invalid URL or a URL that does not exist. 19958 * invalid URL or a URL that does not exist.
19530 */ 19959 */
19531 Element get uriElement; 19960 Element get uriElement;
19532 19961
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
19615 20044
19616 /** 20045 /**
19617 * Initialize a newly created variable declaration. Either or both of the 20046 * Initialize a newly created variable declaration. Either or both of the
19618 * [comment] and [metadata] can be `null` if the declaration does not have the 20047 * [comment] and [metadata] can be `null` if the declaration does not have the
19619 * corresponding attribute. The [equals] and [initializer] can be `null` if 20048 * corresponding attribute. The [equals] and [initializer] can be `null` if
19620 * there is no initializer. 20049 * there is no initializer.
19621 */ 20050 */
19622 VariableDeclaration(Comment comment, List<Annotation> metadata, 20051 VariableDeclaration(Comment comment, List<Annotation> metadata,
19623 SimpleIdentifier name, this.equals, Expression initializer) 20052 SimpleIdentifier name, this.equals, Expression initializer)
19624 : super(comment, metadata) { 20053 : super(comment, metadata) {
19625 _name = becomeParentOf(name); 20054 _name = _becomeParentOf(name);
19626 _initializer = becomeParentOf(initializer); 20055 _initializer = _becomeParentOf(initializer);
19627 } 20056 }
19628 20057
19629 @override 20058 @override
19630 Iterable get childEntities => super._childEntities 20059 Iterable get childEntities => super._childEntities
19631 ..add(_name) 20060 ..add(_name)
19632 ..add(equals) 20061 ..add(equals)
19633 ..add(_initializer); 20062 ..add(_initializer);
19634 20063
19635 /** 20064 /**
19636 * This overridden implementation of getDocumentationComment() looks in the 20065 * This overridden implementation of getDocumentationComment() looks in the
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
19670 * Return the expression used to compute the initial value for the variable, 20099 * Return the expression used to compute the initial value for the variable,
19671 * or `null` if the initial value was not specified. 20100 * or `null` if the initial value was not specified.
19672 */ 20101 */
19673 Expression get initializer => _initializer; 20102 Expression get initializer => _initializer;
19674 20103
19675 /** 20104 /**
19676 * Set the expression used to compute the initial value for the variable to 20105 * Set the expression used to compute the initial value for the variable to
19677 * the given [expression]. 20106 * the given [expression].
19678 */ 20107 */
19679 void set initializer(Expression expression) { 20108 void set initializer(Expression expression) {
19680 _initializer = becomeParentOf(expression); 20109 _initializer = _becomeParentOf(expression);
19681 } 20110 }
19682 20111
19683 /** 20112 /**
19684 * Return `true` if this variable was declared with the 'const' modifier. 20113 * Return `true` if this variable was declared with the 'const' modifier.
19685 */ 20114 */
19686 bool get isConst { 20115 bool get isConst {
19687 AstNode parent = this.parent; 20116 AstNode parent = this.parent;
19688 return parent is VariableDeclarationList && parent.isConst; 20117 return parent is VariableDeclarationList && parent.isConst;
19689 } 20118 }
19690 20119
19691 /** 20120 /**
19692 * Return `true` if this variable was declared with the 'final' modifier. 20121 * Return `true` if this variable was declared with the 'final' modifier.
19693 * Variables that are declared with the 'const' modifier will return `false` 20122 * Variables that are declared with the 'const' modifier will return `false`
19694 * even though they are implicitly final. 20123 * even though they are implicitly final.
19695 */ 20124 */
19696 bool get isFinal { 20125 bool get isFinal {
19697 AstNode parent = this.parent; 20126 AstNode parent = this.parent;
19698 return parent is VariableDeclarationList && parent.isFinal; 20127 return parent is VariableDeclarationList && parent.isFinal;
19699 } 20128 }
19700 20129
19701 /** 20130 /**
19702 * Return the name of the variable being declared. 20131 * Return the name of the variable being declared.
19703 */ 20132 */
19704 SimpleIdentifier get name => _name; 20133 SimpleIdentifier get name => _name;
19705 20134
19706 /** 20135 /**
19707 * Set the name of the variable being declared to the given [identifier]. 20136 * Set the name of the variable being declared to the given [identifier].
19708 */ 20137 */
19709 void set name(SimpleIdentifier identifier) { 20138 void set name(SimpleIdentifier identifier) {
19710 _name = becomeParentOf(identifier); 20139 _name = _becomeParentOf(identifier);
19711 } 20140 }
19712 20141
19713 @override 20142 @override
19714 accept(AstVisitor visitor) => visitor.visitVariableDeclaration(this); 20143 accept(AstVisitor visitor) => visitor.visitVariableDeclaration(this);
19715 20144
19716 @override 20145 @override
19717 void visitChildren(AstVisitor visitor) { 20146 void visitChildren(AstVisitor visitor) {
19718 super.visitChildren(visitor); 20147 super.visitChildren(visitor);
19719 _safelyVisitChild(_name, visitor); 20148 _safelyVisitChild(_name, visitor);
19720 _safelyVisitChild(_initializer, visitor); 20149 _safelyVisitChild(_initializer, visitor);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
19752 20181
19753 /** 20182 /**
19754 * Initialize a newly created variable declaration list. Either or both of the 20183 * Initialize a newly created variable declaration list. Either or both of the
19755 * [comment] and [metadata] can be `null` if the variable list does not have 20184 * [comment] and [metadata] can be `null` if the variable list does not have
19756 * the corresponding attribute. The [keyword] can be `null` if a type was 20185 * the corresponding attribute. The [keyword] can be `null` if a type was
19757 * specified. The [type] must be `null` if the keyword is 'var'. 20186 * specified. The [type] must be `null` if the keyword is 'var'.
19758 */ 20187 */
19759 VariableDeclarationList(Comment comment, List<Annotation> metadata, 20188 VariableDeclarationList(Comment comment, List<Annotation> metadata,
19760 this.keyword, TypeName type, List<VariableDeclaration> variables) 20189 this.keyword, TypeName type, List<VariableDeclaration> variables)
19761 : super(comment, metadata) { 20190 : super(comment, metadata) {
19762 _type = becomeParentOf(type); 20191 _type = _becomeParentOf(type);
19763 _variables = new NodeList<VariableDeclaration>(this, variables); 20192 _variables = new NodeList<VariableDeclaration>(this, variables);
19764 } 20193 }
19765 20194
19766 /** 20195 /**
19767 * TODO(paulberry): include commas. 20196 * TODO(paulberry): include commas.
19768 */ 20197 */
19769 @override 20198 @override
19770 Iterable get childEntities => super._childEntities 20199 Iterable get childEntities => super._childEntities
19771 ..add(keyword) 20200 ..add(keyword)
19772 ..add(_type) 20201 ..add(_type)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
19804 /** 20233 /**
19805 * Return the type of the variables being declared, or `null` if no type was 20234 * Return the type of the variables being declared, or `null` if no type was
19806 * provided. 20235 * provided.
19807 */ 20236 */
19808 TypeName get type => _type; 20237 TypeName get type => _type;
19809 20238
19810 /** 20239 /**
19811 * Set the type of the variables being declared to the given [typeName]. 20240 * Set the type of the variables being declared to the given [typeName].
19812 */ 20241 */
19813 void set type(TypeName typeName) { 20242 void set type(TypeName typeName) {
19814 _type = becomeParentOf(typeName); 20243 _type = _becomeParentOf(typeName);
19815 } 20244 }
19816 20245
19817 /** 20246 /**
19818 * Return a list containing the individual variables being declared. 20247 * Return a list containing the individual variables being declared.
19819 */ 20248 */
19820 NodeList<VariableDeclaration> get variables => _variables; 20249 NodeList<VariableDeclaration> get variables => _variables;
19821 20250
19822 @override 20251 @override
19823 accept(AstVisitor visitor) => visitor.visitVariableDeclarationList(this); 20252 accept(AstVisitor visitor) => visitor.visitVariableDeclarationList(this);
19824 20253
(...skipping 21 matching lines...) Expand all
19846 /** 20275 /**
19847 * The semicolon terminating the statement. 20276 * The semicolon terminating the statement.
19848 */ 20277 */
19849 Token semicolon; 20278 Token semicolon;
19850 20279
19851 /** 20280 /**
19852 * Initialize a newly created variable declaration statement. 20281 * Initialize a newly created variable declaration statement.
19853 */ 20282 */
19854 VariableDeclarationStatement(VariableDeclarationList variableList, 20283 VariableDeclarationStatement(VariableDeclarationList variableList,
19855 this.semicolon) { 20284 this.semicolon) {
19856 _variableList = becomeParentOf(variableList); 20285 _variableList = _becomeParentOf(variableList);
19857 } 20286 }
19858 20287
19859 @override 20288 @override
19860 Token get beginToken => _variableList.beginToken; 20289 Token get beginToken => _variableList.beginToken;
19861 20290
19862 @override 20291 @override
19863 Iterable get childEntities => new ChildEntities() 20292 Iterable get childEntities => new ChildEntities()
19864 ..add(_variableList) 20293 ..add(_variableList)
19865 ..add(semicolon); 20294 ..add(semicolon);
19866 20295
19867 @override 20296 @override
19868 Token get endToken => semicolon; 20297 Token get endToken => semicolon;
19869 20298
19870 /** 20299 /**
19871 * Return the variables being declared. 20300 * Return the variables being declared.
19872 */ 20301 */
19873 VariableDeclarationList get variables => _variableList; 20302 VariableDeclarationList get variables => _variableList;
19874 20303
19875 /** 20304 /**
19876 * Set the variables being declared to the given list of [variables]. 20305 * Set the variables being declared to the given list of [variables].
19877 */ 20306 */
19878 void set variables(VariableDeclarationList variables) { 20307 void set variables(VariableDeclarationList variables) {
19879 _variableList = becomeParentOf(variables); 20308 _variableList = _becomeParentOf(variables);
19880 } 20309 }
19881 20310
19882 @override 20311 @override
19883 accept(AstVisitor visitor) => visitor.visitVariableDeclarationStatement(this); 20312 accept(AstVisitor visitor) => visitor.visitVariableDeclarationStatement(this);
19884 20313
19885 @override 20314 @override
19886 void visitChildren(AstVisitor visitor) { 20315 void visitChildren(AstVisitor visitor) {
19887 _safelyVisitChild(_variableList, visitor); 20316 _safelyVisitChild(_variableList, visitor);
19888 } 20317 }
19889 } 20318 }
19890 20319
19891 /** 20320 /**
19892 * A while statement. 20321 * A while statement.
19893 * 20322 *
19894 * > whileStatement ::= 20323 * > whileStatement ::=
19895 * > 'while' '(' [Expression] ')' [Statement] 20324 * > 'while' '(' [Expression] ')' [Statement]
19896 */ 20325 */
19897 class WhileStatement extends Statement { 20326 class WhileStatement extends Statement {
19898 /** 20327 /**
19899 * The token representing the 'while' keyword. 20328 * The token representing the 'while' keyword.
19900 */ 20329 */
19901 Token keyword; 20330 Token whileKeyword;
19902 20331
19903 /** 20332 /**
19904 * The left parenthesis. 20333 * The left parenthesis.
19905 */ 20334 */
19906 Token leftParenthesis; 20335 Token leftParenthesis;
19907 20336
19908 /** 20337 /**
19909 * The expression used to determine whether to execute the body of the loop. 20338 * The expression used to determine whether to execute the body of the loop.
19910 */ 20339 */
19911 Expression _condition; 20340 Expression _condition;
19912 20341
19913 /** 20342 /**
19914 * The right parenthesis. 20343 * The right parenthesis.
19915 */ 20344 */
19916 Token rightParenthesis; 20345 Token rightParenthesis;
19917 20346
19918 /** 20347 /**
19919 * The body of the loop. 20348 * The body of the loop.
19920 */ 20349 */
19921 Statement _body; 20350 Statement _body;
19922 20351
19923 /** 20352 /**
19924 * Initialize a newly created while statement. 20353 * Initialize a newly created while statement.
19925 */ 20354 */
19926 WhileStatement(this.keyword, this.leftParenthesis, Expression condition, 20355 WhileStatement(this.whileKeyword, this.leftParenthesis, Expression condition,
19927 this.rightParenthesis, Statement body) { 20356 this.rightParenthesis, Statement body) {
19928 _condition = becomeParentOf(condition); 20357 _condition = _becomeParentOf(condition);
19929 _body = becomeParentOf(body); 20358 _body = _becomeParentOf(body);
19930 } 20359 }
19931 20360
19932 @override 20361 @override
19933 Token get beginToken => keyword; 20362 Token get beginToken => whileKeyword;
19934 20363
19935 /** 20364 /**
19936 * Return the body of the loop. 20365 * Return the body of the loop.
19937 */ 20366 */
19938 Statement get body => _body; 20367 Statement get body => _body;
19939 20368
19940 /** 20369 /**
19941 * Set the body of the loop to the given [statement]. 20370 * Set the body of the loop to the given [statement].
19942 */ 20371 */
19943 void set body(Statement statement) { 20372 void set body(Statement statement) {
19944 _body = becomeParentOf(statement); 20373 _body = _becomeParentOf(statement);
19945 } 20374 }
19946 20375
19947 @override 20376 @override
19948 Iterable get childEntities => new ChildEntities() 20377 Iterable get childEntities => new ChildEntities()
19949 ..add(keyword) 20378 ..add(whileKeyword)
19950 ..add(leftParenthesis) 20379 ..add(leftParenthesis)
19951 ..add(_condition) 20380 ..add(_condition)
19952 ..add(rightParenthesis) 20381 ..add(rightParenthesis)
19953 ..add(_body); 20382 ..add(_body);
19954 20383
19955 /** 20384 /**
19956 * Return the expression used to determine whether to execute the body of the 20385 * Return the expression used to determine whether to execute the body of the
19957 * loop. 20386 * loop.
19958 */ 20387 */
19959 Expression get condition => _condition; 20388 Expression get condition => _condition;
19960 20389
19961 /** 20390 /**
19962 * Set the expression used to determine whether to execute the body of the 20391 * Set the expression used to determine whether to execute the body of the
19963 * loop to the given [expression]. 20392 * loop to the given [expression].
19964 */ 20393 */
19965 void set condition(Expression expression) { 20394 void set condition(Expression expression) {
19966 _condition = becomeParentOf(expression); 20395 _condition = _becomeParentOf(expression);
19967 } 20396 }
19968 20397
19969 @override 20398 @override
19970 Token get endToken => _body.endToken; 20399 Token get endToken => _body.endToken;
19971 20400
20401 /**
20402 * Return the token representing the 'while' keyword.
20403 */
20404 @deprecated // Use "this.whileKeyword"
20405 Token get keyword => whileKeyword;
20406
20407 /**
20408 * Set the token representing the 'while' keyword to the given [token].
20409 */
20410 @deprecated // Use "this.whileKeyword"
20411 set keyword(Token token) {
20412 whileKeyword = token;
20413 }
20414
19972 @override 20415 @override
19973 accept(AstVisitor visitor) => visitor.visitWhileStatement(this); 20416 accept(AstVisitor visitor) => visitor.visitWhileStatement(this);
19974 20417
19975 @override 20418 @override
19976 void visitChildren(AstVisitor visitor) { 20419 void visitChildren(AstVisitor visitor) {
19977 _safelyVisitChild(_condition, visitor); 20420 _safelyVisitChild(_condition, visitor);
19978 _safelyVisitChild(_body, visitor); 20421 _safelyVisitChild(_body, visitor);
19979 } 20422 }
19980 } 20423 }
19981 20424
(...skipping 30 matching lines...) Expand all
20012 @override 20455 @override
20013 Iterable get childEntities => new ChildEntities() 20456 Iterable get childEntities => new ChildEntities()
20014 ..add(withKeyword) 20457 ..add(withKeyword)
20015 ..addAll(_mixinTypes); 20458 ..addAll(_mixinTypes);
20016 20459
20017 @override 20460 @override
20018 Token get endToken => _mixinTypes.endToken; 20461 Token get endToken => _mixinTypes.endToken;
20019 20462
20020 /** 20463 /**
20021 * Set the token representing the 'with' keyword to the given [token]. 20464 * Set the token representing the 'with' keyword to the given [token].
20022 *
20023 * Deprecated: Use withKeyword instead.
20024 */ 20465 */
20025 @deprecated 20466 @deprecated // Use "this.withKeyword"
20026 void set mixinKeyword(Token token) { 20467 void set mixinKeyword(Token token) {
20027 this.withKeyword = token; 20468 this.withKeyword = token;
20028 } 20469 }
20029 20470
20030 /** 20471 /**
20031 * Return the names of the mixins that were specified. 20472 * Return the names of the mixins that were specified.
20032 */ 20473 */
20033 NodeList<TypeName> get mixinTypes => _mixinTypes; 20474 NodeList<TypeName> get mixinTypes => _mixinTypes;
20034 20475
20035 @override 20476 @override
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
20067 * The semicolon following the expression. 20508 * The semicolon following the expression.
20068 */ 20509 */
20069 Token semicolon; 20510 Token semicolon;
20070 20511
20071 /** 20512 /**
20072 * Initialize a newly created yield expression. The [star] can be `null` if no 20513 * Initialize a newly created yield expression. The [star] can be `null` if no
20073 * star was provided. 20514 * star was provided.
20074 */ 20515 */
20075 YieldStatement(this.yieldKeyword, this.star, Expression expression, 20516 YieldStatement(this.yieldKeyword, this.star, Expression expression,
20076 this.semicolon) { 20517 this.semicolon) {
20077 _expression = becomeParentOf(expression); 20518 _expression = _becomeParentOf(expression);
20078 } 20519 }
20079 20520
20080 @override 20521 @override
20081 Token get beginToken { 20522 Token get beginToken {
20082 if (yieldKeyword != null) { 20523 if (yieldKeyword != null) {
20083 return yieldKeyword; 20524 return yieldKeyword;
20084 } 20525 }
20085 return _expression.beginToken; 20526 return _expression.beginToken;
20086 } 20527 }
20087 20528
20088 /**
20089 * TODO(paulberry): untested.
20090 */
20091 @override 20529 @override
20092 Iterable get childEntities => new ChildEntities() 20530 Iterable get childEntities => new ChildEntities()
20093 ..add(yieldKeyword) 20531 ..add(yieldKeyword)
20094 ..add(star) 20532 ..add(star)
20095 ..add(_expression) 20533 ..add(_expression)
20096 ..add(semicolon); 20534 ..add(semicolon);
20097 20535
20098 @override 20536 @override
20099 Token get endToken { 20537 Token get endToken {
20100 if (semicolon != null) { 20538 if (semicolon != null) {
20101 return semicolon; 20539 return semicolon;
20102 } 20540 }
20103 return _expression.endToken; 20541 return _expression.endToken;
20104 } 20542 }
20105 20543
20106 /** 20544 /**
20107 * Return the expression whose value will be yielded. 20545 * Return the expression whose value will be yielded.
20108 */ 20546 */
20109 Expression get expression => _expression; 20547 Expression get expression => _expression;
20110 20548
20111 /** 20549 /**
20112 * Set the expression whose value will be yielded to the given [expression]. 20550 * Set the expression whose value will be yielded to the given [expression].
20113 */ 20551 */
20114 void set expression(Expression expression) { 20552 void set expression(Expression expression) {
20115 _expression = becomeParentOf(expression); 20553 _expression = _becomeParentOf(expression);
20116 } 20554 }
20117 20555
20118 @override 20556 @override
20119 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); 20557 accept(AstVisitor visitor) => visitor.visitYieldStatement(this);
20120 20558
20121 @override 20559 @override
20122 void visitChildren(AstVisitor visitor) { 20560 void visitChildren(AstVisitor visitor) {
20123 _safelyVisitChild(_expression, visitor); 20561 _safelyVisitChild(_expression, visitor);
20124 } 20562 }
20125 } 20563 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/index_contributor.dart ('k') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698