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

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

Issue 185603002: Update and analyzer snapshot with AST -> Ast rename. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweak for analyzer version in 'intl' package. Created 6 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';
11 import 'java_core.dart'; 11 import 'java_core.dart';
12 import 'java_engine.dart'; 12 import 'java_engine.dart';
13 import 'source.dart' show LineInfo; 13 import 'source.dart' show LineInfo;
14 import 'scanner.dart'; 14 import 'scanner.dart';
15 import 'engine.dart' show AnalysisEngine; 15 import 'engine.dart' show AnalysisEngine;
16 import 'utilities_dart.dart'; 16 import 'utilities_dart.dart';
17 import 'utilities_collection.dart' show TokenMap; 17 import 'utilities_collection.dart' show TokenMap;
18 import 'element.dart'; 18 import 'element.dart';
19 19
20 /** 20 /**
21 * The abstract class `ASTNode` defines the behavior common to all nodes in the AST structure 21 * Instances of the class `AdjacentStrings` represents two or more string litera ls that are
22 * implicitly concatenated because of being adjacent (separated only by whitespa ce).
23 *
24 * While the grammar only allows adjacent strings when all of the strings are of the same kind
25 * (single line or multi-line), this class doesn't enforce that restriction.
26 *
27 * <pre>
28 * adjacentStrings ::=
29 * [StringLiteral] [StringLiteral]+
30 * </pre>
31 */
32 class AdjacentStrings extends StringLiteral {
33 /**
34 * The strings that are implicitly concatenated.
35 */
36 NodeList<StringLiteral> _strings;
37
38 /**
39 * Initialize a newly created list of adjacent strings.
40 *
41 * @param strings the strings that are implicitly concatenated
42 */
43 AdjacentStrings(List<StringLiteral> strings) {
44 this._strings = new NodeList<StringLiteral>(this);
45 this._strings.addAll(strings);
46 }
47
48 accept(AstVisitor visitor) => visitor.visitAdjacentStrings(this);
49
50 Token get beginToken => _strings.beginToken;
51
52 Token get endToken => _strings.endToken;
53
54 /**
55 * Return the strings that are implicitly concatenated.
56 *
57 * @return the strings that are implicitly concatenated
58 */
59 NodeList<StringLiteral> get strings => _strings;
60
61 void visitChildren(AstVisitor visitor) {
62 _strings.accept(visitor);
63 }
64
65 void appendStringValue(JavaStringBuilder builder) {
66 for (StringLiteral stringLiteral in strings) {
67 stringLiteral.appendStringValue(builder);
68 }
69 }
70 }
71
72 /**
73 * The abstract class `AnnotatedNode` defines the behavior of nodes that can be annotated with
74 * both a comment and metadata.
75 */
76 abstract class AnnotatedNode extends AstNode {
77 /**
78 * The documentation comment associated with this node, or `null` if this node does not have
79 * a documentation comment associated with it.
80 */
81 Comment _comment;
82
83 /**
84 * The annotations associated with this node.
85 */
86 NodeList<Annotation> _metadata;
87
88 /**
89 * Initialize a newly created node.
90 *
91 * @param comment the documentation comment associated with this node
92 * @param metadata the annotations associated with this node
93 */
94 AnnotatedNode(Comment comment, List<Annotation> metadata) {
95 this._metadata = new NodeList<Annotation>(this);
96 this._comment = becomeParentOf(comment);
97 this._metadata.addAll(metadata);
98 }
99
100 Token get beginToken {
101 if (_comment == null) {
102 if (_metadata.isEmpty) {
103 return firstTokenAfterCommentAndMetadata;
104 } else {
105 return _metadata.beginToken;
106 }
107 } else if (_metadata.isEmpty) {
108 return _comment.beginToken;
109 }
110 Token commentToken = _comment.beginToken;
111 Token metadataToken = _metadata.beginToken;
112 if (commentToken.offset < metadataToken.offset) {
113 return commentToken;
114 }
115 return metadataToken;
116 }
117
118 /**
119 * Return the documentation comment associated with this node, or `null` if th is node does
120 * not have a documentation comment associated with it.
121 *
122 * @return the documentation comment associated with this node
123 */
124 Comment get documentationComment => _comment;
125
126 /**
127 * Return the annotations associated with this node.
128 *
129 * @return the annotations associated with this node
130 */
131 NodeList<Annotation> get metadata => _metadata;
132
133 /**
134 * Set the documentation comment associated with this node to the given commen t.
135 *
136 * @param comment the documentation comment to be associated with this node
137 */
138 void set documentationComment(Comment comment) {
139 this._comment = becomeParentOf(comment);
140 }
141
142 /**
143 * Set the metadata associated with this node to the given metadata.
144 *
145 * @param metadata the metadata to be associated with this node
146 */
147 void set metadata(List<Annotation> metadata) {
148 this._metadata.clear();
149 this._metadata.addAll(metadata);
150 }
151
152 void visitChildren(AstVisitor visitor) {
153 if (commentIsBeforeAnnotations()) {
154 safelyVisitChild(_comment, visitor);
155 _metadata.accept(visitor);
156 } else {
157 for (AstNode child in sortedCommentAndAnnotations) {
158 child.accept(visitor);
159 }
160 }
161 }
162
163 /**
164 * Return the first token following the comment and metadata.
165 *
166 * @return the first token following the comment and metadata
167 */
168 Token get firstTokenAfterCommentAndMetadata;
169
170 /**
171 * Return `true` if the comment is lexically before any annotations.
172 *
173 * @return `true` if the comment is lexically before any annotations
174 */
175 bool commentIsBeforeAnnotations() {
176 if (_comment == null || _metadata.isEmpty) {
177 return true;
178 }
179 Annotation firstAnnotation = _metadata[0];
180 return _comment.offset < firstAnnotation.offset;
181 }
182
183 /**
184 * Return an array containing the comment and annotations associated with this node, sorted in
185 * lexical order.
186 *
187 * @return the comment and annotations associated with this node in the order in which they
188 * appeared in the original source
189 */
190 List<AstNode> get sortedCommentAndAnnotations {
191 List<AstNode> childList = new List<AstNode>();
192 childList.add(_comment);
193 childList.addAll(_metadata);
194 List<AstNode> children = new List.from(childList);
195 children.sort(AstNode.LEXICAL_ORDER);
196 return children;
197 }
198 }
199
200 /**
201 * Instances of the class `Annotation` represent an annotation that can be assoc iated with an
202 * AST node.
203 *
204 * <pre>
205 * metadata ::=
206 * annotation*
207 *
208 * annotation ::=
209 * '@' [Identifier] ('.' [SimpleIdentifier])? [ArgumentList]?
210 * </pre>
211 */
212 class Annotation extends AstNode {
213 /**
214 * The at sign that introduced the annotation.
215 */
216 Token atSign;
217
218 /**
219 * The name of the class defining the constructor that is being invoked or the name of the field
220 * that is being referenced.
221 */
222 Identifier _name;
223
224 /**
225 * The period before the constructor name, or `null` if this annotation is not the
226 * invocation of a named constructor.
227 */
228 Token period;
229
230 /**
231 * The name of the constructor being invoked, or `null` if this annotation is not the
232 * invocation of a named constructor.
233 */
234 SimpleIdentifier _constructorName;
235
236 /**
237 * The arguments to the constructor being invoked, or `null` if this annotatio n is not the
238 * invocation of a constructor.
239 */
240 ArgumentList _arguments;
241
242 /**
243 * The element associated with this annotation, or `null` if the AST structure has not been
244 * resolved or if this annotation could not be resolved.
245 */
246 Element _element;
247
248 /**
249 * Initialize a newly created annotation.
250 *
251 * @param atSign the at sign that introduced the annotation
252 * @param name the name of the class defining the constructor that is being in voked or the name of
253 * the field that is being referenced
254 * @param period the period before the constructor name, or `null` if this ann otation is not
255 * the invocation of a named constructor
256 * @param constructorName the name of the constructor being invoked, or `null` if this
257 * annotation is not the invocation of a named constructor
258 * @param arguments the arguments to the constructor being invoked, or `null` if this
259 * annotation is not the invocation of a constructor
260 */
261 Annotation(this.atSign, Identifier name, this.period, SimpleIdentifier constru ctorName, ArgumentList arguments) {
262 this._name = becomeParentOf(name);
263 this._constructorName = becomeParentOf(constructorName);
264 this._arguments = becomeParentOf(arguments);
265 }
266
267 accept(AstVisitor visitor) => visitor.visitAnnotation(this);
268
269 /**
270 * Return the arguments to the constructor being invoked, or `null` if this an notation is
271 * not the invocation of a constructor.
272 *
273 * @return the arguments to the constructor being invoked
274 */
275 ArgumentList get arguments => _arguments;
276
277 Token get beginToken => atSign;
278
279 /**
280 * Return the name of the constructor being invoked, or `null` if this annotat ion is not the
281 * invocation of a named constructor.
282 *
283 * @return the name of the constructor being invoked
284 */
285 SimpleIdentifier get constructorName => _constructorName;
286
287 /**
288 * Return the element associated with this annotation, or `null` if the AST st ructure has
289 * not been resolved or if this annotation could not be resolved.
290 *
291 * @return the element associated with this annotation
292 */
293 Element get element {
294 if (_element != null) {
295 return _element;
296 }
297 if (_name != null) {
298 return _name.staticElement;
299 }
300 return null;
301 }
302
303 Token get endToken {
304 if (_arguments != null) {
305 return _arguments.endToken;
306 } else if (_constructorName != null) {
307 return _constructorName.endToken;
308 }
309 return _name.endToken;
310 }
311
312 /**
313 * Return the name of the class defining the constructor that is being invoked or the name of the
314 * field that is being referenced.
315 *
316 * @return the name of the constructor being invoked or the name of the field being referenced
317 */
318 Identifier get name => _name;
319
320 /**
321 * Set the arguments to the constructor being invoked to the given arguments.
322 *
323 * @param arguments the arguments to the constructor being invoked
324 */
325 void set arguments(ArgumentList arguments) {
326 this._arguments = becomeParentOf(arguments);
327 }
328
329 /**
330 * Set the name of the constructor being invoked to the given name.
331 *
332 * @param constructorName the name of the constructor being invoked
333 */
334 void set constructorName(SimpleIdentifier constructorName) {
335 this._constructorName = becomeParentOf(constructorName);
336 }
337
338 /**
339 * Set the element associated with this annotation based.
340 *
341 * @param element the element to be associated with this identifier
342 */
343 void set element(Element element) {
344 this._element = element;
345 }
346
347 /**
348 * Set the name of the class defining the constructor that is being invoked or the name of the
349 * field that is being referenced to the given name.
350 *
351 * @param name the name of the constructor being invoked or the name of the fi eld being referenced
352 */
353 void set name(Identifier name) {
354 this._name = becomeParentOf(name);
355 }
356
357 void visitChildren(AstVisitor visitor) {
358 safelyVisitChild(_name, visitor);
359 safelyVisitChild(_constructorName, visitor);
360 safelyVisitChild(_arguments, visitor);
361 }
362 }
363
364 /**
365 * Instances of the class `ArgumentDefinitionTest` represent an argument definit ion test.
366 *
367 * <pre>
368 * argumentDefinitionTest ::=
369 * '?' [SimpleIdentifier]
370 * </pre>
371 */
372 class ArgumentDefinitionTest extends Expression {
373 /**
374 * The token representing the question mark.
375 */
376 Token question;
377
378 /**
379 * The identifier representing the argument being tested.
380 */
381 SimpleIdentifier _identifier;
382
383 /**
384 * Initialize a newly created argument definition test.
385 *
386 * @param question the token representing the question mark
387 * @param identifier the identifier representing the argument being tested
388 */
389 ArgumentDefinitionTest(this.question, SimpleIdentifier identifier) {
390 this._identifier = becomeParentOf(identifier);
391 }
392
393 accept(AstVisitor visitor) => visitor.visitArgumentDefinitionTest(this);
394
395 Token get beginToken => question;
396
397 Token get endToken => _identifier.endToken;
398
399 /**
400 * Return the identifier representing the argument being tested.
401 *
402 * @return the identifier representing the argument being tested
403 */
404 SimpleIdentifier get identifier => _identifier;
405
406 int get precedence => 15;
407
408 /**
409 * Set the identifier representing the argument being tested to the given iden tifier.
410 *
411 * @param identifier the identifier representing the argument being tested
412 */
413 void set identifier(SimpleIdentifier identifier) {
414 this._identifier = becomeParentOf(identifier);
415 }
416
417 void visitChildren(AstVisitor visitor) {
418 safelyVisitChild(_identifier, visitor);
419 }
420 }
421
422 /**
423 * Instances of the class `ArgumentList` represent a list of arguments in the in vocation of a
424 * executable element: a function, method, or constructor.
425 *
426 * <pre>
427 * argumentList ::=
428 * '(' arguments? ')'
429 *
430 * arguments ::=
431 * [NamedExpression] (',' [NamedExpression])*
432 * | [Expression] (',' [NamedExpression])*
433 * </pre>
434 */
435 class ArgumentList extends AstNode {
436 /**
437 * The left parenthesis.
438 */
439 Token _leftParenthesis;
440
441 /**
442 * The expressions producing the values of the arguments.
443 */
444 NodeList<Expression> _arguments;
445
446 /**
447 * The right parenthesis.
448 */
449 Token _rightParenthesis;
450
451 /**
452 * An array containing the elements representing the parameters corresponding to each of the
453 * arguments in this list, or `null` if the AST has not been resolved or if th e function or
454 * method being invoked could not be determined based on static type informati on. The array must
455 * be the same length as the number of arguments, but can contain `null` entri es if a given
456 * argument does not correspond to a formal parameter.
457 */
458 List<ParameterElement> _correspondingStaticParameters;
459
460 /**
461 * An array containing the elements representing the parameters corresponding to each of the
462 * arguments in this list, or `null` if the AST has not been resolved or if th e function or
463 * method being invoked could not be determined based on propagated type infor mation. The array
464 * must be the same length as the number of arguments, but can contain `null` entries if a
465 * given argument does not correspond to a formal parameter.
466 */
467 List<ParameterElement> _correspondingPropagatedParameters;
468
469 /**
470 * Initialize a newly created list of arguments.
471 *
472 * @param leftParenthesis the left parenthesis
473 * @param arguments the expressions producing the values of the arguments
474 * @param rightParenthesis the right parenthesis
475 */
476 ArgumentList(Token leftParenthesis, List<Expression> arguments, Token rightPar enthesis) {
477 this._arguments = new NodeList<Expression>(this);
478 this._leftParenthesis = leftParenthesis;
479 this._arguments.addAll(arguments);
480 this._rightParenthesis = rightParenthesis;
481 }
482
483 accept(AstVisitor visitor) => visitor.visitArgumentList(this);
484
485 /**
486 * Return the expressions producing the values of the arguments. Although the language requires
487 * that positional arguments appear before named arguments, this class allows them to be
488 * intermixed.
489 *
490 * @return the expressions producing the values of the arguments
491 */
492 NodeList<Expression> get arguments => _arguments;
493
494 Token get beginToken => _leftParenthesis;
495
496 Token get endToken => _rightParenthesis;
497
498 /**
499 * Return the left parenthesis.
500 *
501 * @return the left parenthesis
502 */
503 Token get leftParenthesis => _leftParenthesis;
504
505 /**
506 * Return the right parenthesis.
507 *
508 * @return the right parenthesis
509 */
510 Token get rightParenthesis => _rightParenthesis;
511
512 /**
513 * Set the parameter elements corresponding to each of the arguments in this l ist to the given
514 * array of parameters. The array of parameters must be the same length as the number of
515 * arguments, but can contain `null` entries if a given argument does not corr espond to a
516 * formal parameter.
517 *
518 * @param parameters the parameter elements corresponding to the arguments
519 */
520 void set correspondingPropagatedParameters(List<ParameterElement> parameters) {
521 if (parameters.length != _arguments.length) {
522 throw new IllegalArgumentException("Expected ${_arguments.length} paramete rs, not ${parameters.length}");
523 }
524 _correspondingPropagatedParameters = parameters;
525 }
526
527 /**
528 * Set the parameter elements corresponding to each of the arguments in this l ist to the given
529 * array of parameters. The array of parameters must be the same length as the number of
530 * arguments, but can contain `null` entries if a given argument does not corr espond to a
531 * formal parameter.
532 *
533 * @param parameters the parameter elements corresponding to the arguments
534 */
535 void set correspondingStaticParameters(List<ParameterElement> parameters) {
536 if (parameters.length != _arguments.length) {
537 throw new IllegalArgumentException("Expected ${_arguments.length} paramete rs, not ${parameters.length}");
538 }
539 _correspondingStaticParameters = parameters;
540 }
541
542 /**
543 * Set the left parenthesis to the given token.
544 *
545 * @param parenthesis the left parenthesis
546 */
547 void set leftParenthesis(Token parenthesis) {
548 _leftParenthesis = parenthesis;
549 }
550
551 /**
552 * Set the right parenthesis to the given token.
553 *
554 * @param parenthesis the right parenthesis
555 */
556 void set rightParenthesis(Token parenthesis) {
557 _rightParenthesis = parenthesis;
558 }
559
560 void visitChildren(AstVisitor visitor) {
561 _arguments.accept(visitor);
562 }
563
564 /**
565 * If the given expression is a child of this list, and the AST structure has been resolved, and
566 * the function being invoked is known based on propagated type information, a nd the expression
567 * corresponds to one of the parameters of the function being invoked, then re turn the parameter
568 * element representing the parameter to which the value of the given expressi on will be bound.
569 * Otherwise, return `null`.
570 *
571 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
572 *
573 * @param expression the expression corresponding to the parameter to be retur ned
574 * @return the parameter element representing the parameter to which the value of the expression
575 * will be bound
576 */
577 ParameterElement getPropagatedParameterElementFor(Expression expression) {
578 if (_correspondingPropagatedParameters == null) {
579 // Either the AST structure has not been resolved or the invocation of whi ch this list is a
580 // part could not be resolved.
581 return null;
582 }
583 int index = _arguments.indexOf(expression);
584 if (index < 0) {
585 // The expression isn't a child of this node.
586 return null;
587 }
588 return _correspondingPropagatedParameters[index];
589 }
590
591 /**
592 * If the given expression is a child of this list, and the AST structure has been resolved, and
593 * the function being invoked is known based on static type information, and t he expression
594 * corresponds to one of the parameters of the function being invoked, then re turn the parameter
595 * element representing the parameter to which the value of the given expressi on will be bound.
596 * Otherwise, return `null`.
597 *
598 * This method is only intended to be used by [Expression#getStaticParameterEl ement].
599 *
600 * @param expression the expression corresponding to the parameter to be retur ned
601 * @return the parameter element representing the parameter to which the value of the expression
602 * will be bound
603 */
604 ParameterElement getStaticParameterElementFor(Expression expression) {
605 if (_correspondingStaticParameters == null) {
606 // Either the AST structure has not been resolved or the invocation of whi ch this list is a
607 // part could not be resolved.
608 return null;
609 }
610 int index = _arguments.indexOf(expression);
611 if (index < 0) {
612 // The expression isn't a child of this node.
613 return null;
614 }
615 return _correspondingStaticParameters[index];
616 }
617 }
618
619 /**
620 * Instances of the class `AsExpression` represent an 'as' expression.
621 *
622 * <pre>
623 * asExpression ::=
624 * [Expression] 'as' [TypeName]
625 * </pre>
626 */
627 class AsExpression extends Expression {
628 /**
629 * The expression used to compute the value being cast.
630 */
631 Expression _expression;
632
633 /**
634 * The as operator.
635 */
636 Token asOperator;
637
638 /**
639 * The name of the type being cast to.
640 */
641 TypeName _type;
642
643 /**
644 * Initialize a newly created as expression.
645 *
646 * @param expression the expression used to compute the value being cast
647 * @param isOperator the is operator
648 * @param type the name of the type being cast to
649 */
650 AsExpression(Expression expression, Token isOperator, TypeName type) {
651 this._expression = becomeParentOf(expression);
652 this.asOperator = isOperator;
653 this._type = becomeParentOf(type);
654 }
655
656 accept(AstVisitor visitor) => visitor.visitAsExpression(this);
657
658 Token get beginToken => _expression.beginToken;
659
660 Token get endToken => _type.endToken;
661
662 /**
663 * Return the expression used to compute the value being cast.
664 *
665 * @return the expression used to compute the value being cast
666 */
667 Expression get expression => _expression;
668
669 int get precedence => 7;
670
671 /**
672 * Return the name of the type being cast to.
673 *
674 * @return the name of the type being cast to
675 */
676 TypeName get type => _type;
677
678 /**
679 * Set the expression used to compute the value being cast to the given expres sion.
680 *
681 * @param expression the expression used to compute the value being cast
682 */
683 void set expression(Expression expression) {
684 this._expression = becomeParentOf(expression);
685 }
686
687 /**
688 * Set the name of the type being cast to to the given name.
689 *
690 * @param name the name of the type being cast to
691 */
692 void set type(TypeName name) {
693 this._type = becomeParentOf(name);
694 }
695
696 void visitChildren(AstVisitor visitor) {
697 safelyVisitChild(_expression, visitor);
698 safelyVisitChild(_type, visitor);
699 }
700 }
701
702 /**
703 * Instances of the class `AssertStatement` represent an assert statement.
704 *
705 * <pre>
706 * assertStatement ::=
707 * 'assert' '(' [Expression] ')' ';'
708 * </pre>
709 */
710 class AssertStatement extends Statement {
711 /**
712 * The token representing the 'assert' keyword.
713 */
714 Token keyword;
715
716 /**
717 * The left parenthesis.
718 */
719 Token leftParenthesis;
720
721 /**
722 * The condition that is being asserted to be `true`.
723 */
724 Expression _condition;
725
726 /**
727 * The right parenthesis.
728 */
729 Token rightParenthesis;
730
731 /**
732 * The semicolon terminating the statement.
733 */
734 Token semicolon;
735
736 /**
737 * Initialize a newly created assert statement.
738 *
739 * @param keyword the token representing the 'assert' keyword
740 * @param leftParenthesis the left parenthesis
741 * @param condition the condition that is being asserted to be `true`
742 * @param rightParenthesis the right parenthesis
743 * @param semicolon the semicolon terminating the statement
744 */
745 AssertStatement(this.keyword, this.leftParenthesis, Expression condition, this .rightParenthesis, this.semicolon) {
746 this._condition = becomeParentOf(condition);
747 }
748
749 accept(AstVisitor visitor) => visitor.visitAssertStatement(this);
750
751 Token get beginToken => keyword;
752
753 /**
754 * Return the condition that is being asserted to be `true`.
755 *
756 * @return the condition that is being asserted to be `true`
757 */
758 Expression get condition => _condition;
759
760 Token get endToken => semicolon;
761
762 /**
763 * Set the condition that is being asserted to be `true` to the given expressi on.
764 *
765 * @param the condition that is being asserted to be `true`
766 */
767 void set condition(Expression condition) {
768 this._condition = becomeParentOf(condition);
769 }
770
771 void visitChildren(AstVisitor visitor) {
772 safelyVisitChild(_condition, visitor);
773 }
774 }
775
776 /**
777 * Instances of the class `AssignmentExpression` represent an assignment express ion.
778 *
779 * <pre>
780 * assignmentExpression ::=
781 * [Expression] [Token] [Expression]
782 * </pre>
783 */
784 class AssignmentExpression extends Expression {
785 /**
786 * The expression used to compute the left hand side.
787 */
788 Expression _leftHandSide;
789
790 /**
791 * The assignment operator being applied.
792 */
793 Token operator;
794
795 /**
796 * The expression used to compute the right hand side.
797 */
798 Expression _rightHandSide;
799
800 /**
801 * The element associated with the operator based on the static type of the le ft-hand-side, or
802 * `null` if the AST structure has not been resolved, if the operator is not a compound
803 * operator, or if the operator could not be resolved.
804 */
805 MethodElement _staticElement;
806
807 /**
808 * The element associated with the operator based on the propagated type of th e left-hand-side, or
809 * `null` if the AST structure has not been resolved, if the operator is not a compound
810 * operator, or if the operator could not be resolved.
811 */
812 MethodElement _propagatedElement;
813
814 /**
815 * Initialize a newly created assignment expression.
816 *
817 * @param leftHandSide the expression used to compute the left hand side
818 * @param operator the assignment operator being applied
819 * @param rightHandSide the expression used to compute the right hand side
820 */
821 AssignmentExpression(Expression leftHandSide, this.operator, Expression rightH andSide) {
822 this._leftHandSide = becomeParentOf(leftHandSide);
823 this._rightHandSide = becomeParentOf(rightHandSide);
824 }
825
826 accept(AstVisitor visitor) => visitor.visitAssignmentExpression(this);
827
828 Token get beginToken => _leftHandSide.beginToken;
829
830 /**
831 * Return the best element available for this operator. If resolution was able to find a better
832 * element based on type propagation, that element will be returned. Otherwise , the element found
833 * using the result of static analysis will be returned. If resolution has not been performed,
834 * then `null` will be returned.
835 *
836 * @return the best element available for this operator
837 */
838 MethodElement get bestElement {
839 MethodElement element = propagatedElement;
840 if (element == null) {
841 element = staticElement;
842 }
843 return element;
844 }
845
846 Token get endToken => _rightHandSide.endToken;
847
848 /**
849 * Set the expression used to compute the left hand side to the given expressi on.
850 *
851 * @return the expression used to compute the left hand side
852 */
853 Expression get leftHandSide => _leftHandSide;
854
855 int get precedence => 1;
856
857 /**
858 * Return the element associated with the operator based on the propagated typ e of the
859 * left-hand-side, or `null` if the AST structure has not been resolved, if th e operator is
860 * not a compound operator, or if the operator could not be resolved. One exam ple of the latter
861 * case is an operator that is not defined for the type of the left-hand opera nd.
862 *
863 * @return the element associated with the operator
864 */
865 MethodElement get propagatedElement => _propagatedElement;
866
867 /**
868 * Return the expression used to compute the right hand side.
869 *
870 * @return the expression used to compute the right hand side
871 */
872 Expression get rightHandSide => _rightHandSide;
873
874 /**
875 * Return the element associated with the operator based on the static type of the left-hand-side,
876 * or `null` if the AST structure has not been resolved, if the operator is no t a compound
877 * operator, or if the operator could not be resolved. One example of the latt er case is an
878 * operator that is not defined for the type of the left-hand operand.
879 *
880 * @return the element associated with the operator
881 */
882 MethodElement get staticElement => _staticElement;
883
884 /**
885 * Return the expression used to compute the left hand side.
886 *
887 * @param expression the expression used to compute the left hand side
888 */
889 void set leftHandSide(Expression expression) {
890 _leftHandSide = becomeParentOf(expression);
891 }
892
893 /**
894 * Set the element associated with the operator based on the propagated type o f the left-hand-side
895 * to the given element.
896 *
897 * @param element the element to be associated with the operator
898 */
899 void set propagatedElement(MethodElement element) {
900 _propagatedElement = element;
901 }
902
903 /**
904 * Set the expression used to compute the left hand side to the given expressi on.
905 *
906 * @param expression the expression used to compute the left hand side
907 */
908 void set rightHandSide(Expression expression) {
909 _rightHandSide = becomeParentOf(expression);
910 }
911
912 /**
913 * Set the element associated with the operator based on the static type of th e left-hand-side to
914 * the given element.
915 *
916 * @param element the static element to be associated with the operator
917 */
918 void set staticElement(MethodElement element) {
919 _staticElement = element;
920 }
921
922 void visitChildren(AstVisitor visitor) {
923 safelyVisitChild(_leftHandSide, visitor);
924 safelyVisitChild(_rightHandSide, visitor);
925 }
926
927 /**
928 * If the AST structure has been resolved, and the function being invoked is k nown based on
929 * propagated type information, then return the parameter element representing the parameter to
930 * which the value of the right operand will be bound. Otherwise, return `null `.
931 *
932 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
933 *
934 * @return the parameter element representing the parameter to which the value of the right
935 * operand will be bound
936 */
937 ParameterElement get propagatedParameterElementForRightHandSide {
938 if (_propagatedElement == null) {
939 return null;
940 }
941 List<ParameterElement> parameters = _propagatedElement.parameters;
942 if (parameters.length < 1) {
943 return null;
944 }
945 return parameters[0];
946 }
947
948 /**
949 * If the AST structure has been resolved, and the function being invoked is k nown based on static
950 * type information, then return the parameter element representing the parame ter to which the
951 * value of the right operand will be bound. Otherwise, return `null`.
952 *
953 * This method is only intended to be used by [Expression#getStaticParameterEl ement].
954 *
955 * @return the parameter element representing the parameter to which the value of the right
956 * operand will be bound
957 */
958 ParameterElement get staticParameterElementForRightHandSide {
959 if (_staticElement == null) {
960 return null;
961 }
962 List<ParameterElement> parameters = _staticElement.parameters;
963 if (parameters.length < 1) {
964 return null;
965 }
966 return parameters[0];
967 }
968 }
969
970 /**
971 * The abstract class `AstNode` defines the behavior common to all nodes in the AST structure
22 * for a Dart program. 972 * for a Dart program.
23 *
24 * @coverage dart.engine.ast
25 */ 973 */
26 abstract class ASTNode { 974 abstract class AstNode {
27 /** 975 /**
28 * An empty array of ast nodes. 976 * An empty array of ast nodes.
29 */ 977 */
30 static List<ASTNode> EMPTY_ARRAY = new List<ASTNode>(0); 978 static List<AstNode> EMPTY_ARRAY = new List<AstNode>(0);
31 979
32 /** 980 /**
33 * The parent of the node, or `null` if the node is the root of an AST structu re. 981 * The parent of the node, or `null` if the node is the root of an AST structu re.
34 */ 982 */
35 ASTNode _parent; 983 AstNode _parent;
36 984
37 /** 985 /**
38 * A table mapping the names of properties to their values, or `null` if this node does not 986 * A table mapping the names of properties to their values, or `null` if this node does not
39 * have any properties associated with it. 987 * have any properties associated with it.
40 */ 988 */
41 Map<String, Object> _propertyMap; 989 Map<String, Object> _propertyMap;
42 990
43 /** 991 /**
44 * A comparator that can be used to sort AST nodes in lexical order. In other words, 992 * A comparator that can be used to sort AST nodes in lexical order. In other words,
45 * `compare` will return a negative value if the offset of the first node is l ess than the 993 * `compare` will return a negative value if the offset of the first node is l ess than the
46 * offset of the second node, zero (0) if the nodes have the same offset, and a positive value if 994 * offset of the second node, zero (0) if the nodes have the same offset, and a positive value if
47 * if the offset of the first node is greater than the offset of the second no de. 995 * if the offset of the first node is greater than the offset of the second no de.
48 */ 996 */
49 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) => second.offset - first.offset; 997 static Comparator<AstNode> LEXICAL_ORDER = (AstNode first, AstNode second) => second.offset - first.offset;
50 998
51 /** 999 /**
52 * Use the given visitor to visit this node. 1000 * Use the given visitor to visit this node.
53 * 1001 *
54 * @param visitor the visitor that will visit this node 1002 * @param visitor the visitor that will visit this node
55 * @return the value returned by the visitor as a result of visiting this node 1003 * @return the value returned by the visitor as a result of visiting this node
56 */ 1004 */
57 accept(ASTVisitor visitor); 1005 accept(AstVisitor visitor);
58 1006
59 /** 1007 /**
60 * Return the node of the given class that most immediately encloses this node , or `null` if 1008 * Return the node of the given class that most immediately encloses this node , or `null` if
61 * there is no enclosing node of the given class. 1009 * there is no enclosing node of the given class.
62 * 1010 *
63 * @param nodeClass the class of the node to be returned 1011 * @param nodeClass the class of the node to be returned
64 * @return the node of the given type that encloses this node 1012 * @return the node of the given type that encloses this node
65 */ 1013 */
66 ASTNode getAncestor(Type enclosingClass) { 1014 AstNode getAncestor(Type enclosingClass) {
67 ASTNode node = this; 1015 AstNode node = this;
68 while (node != null && !isInstanceOf(node, enclosingClass)) { 1016 while (node != null && !isInstanceOf(node, enclosingClass)) {
69 node = node.parent; 1017 node = node.parent;
70 } 1018 }
71 return node; 1019 return node;
72 } 1020 }
73 1021
74 /** 1022 /**
75 * Return the first token included in this node's source range. 1023 * Return the first token included in this node's source range.
76 * 1024 *
77 * @return the first token included in this node's source range 1025 * @return the first token included in this node's source range
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 1073 }
126 1074
127 /** 1075 /**
128 * Return this node's parent node, or `null` if this node is the root of an AS T structure. 1076 * Return this node's parent node, or `null` if this node is the root of an AS T structure.
129 * 1077 *
130 * Note that the relationship between an AST node and its parent node may chan ge over the lifetime 1078 * Note that the relationship between an AST node and its parent node may chan ge over the lifetime
131 * of a node. 1079 * of a node.
132 * 1080 *
133 * @return the parent of this node, or `null` if none 1081 * @return the parent of this node, or `null` if none
134 */ 1082 */
135 ASTNode get parent => _parent; 1083 AstNode get parent => _parent;
136 1084
137 /** 1085 /**
138 * Return the value of the property with the given name, or `null` if this nod e does not 1086 * Return the value of the property with the given name, or `null` if this nod e does not
139 * have a property with the given name. 1087 * have a property with the given name.
140 * 1088 *
141 * @return the value of the property with the given name 1089 * @return the value of the property with the given name
142 */ 1090 */
143 Object getProperty(String propertyName) { 1091 Object getProperty(String propertyName) {
144 if (_propertyMap == null) { 1092 if (_propertyMap == null) {
145 return null; 1093 return null;
146 } 1094 }
147 return _propertyMap[propertyName]; 1095 return _propertyMap[propertyName];
148 } 1096 }
149 1097
150 /** 1098 /**
151 * Return the node at the root of this node's AST structure. Note that this me thod's performance 1099 * Return the node at the root of this node's AST structure. Note that this me thod's performance
152 * is linear with respect to the depth of the node in the AST structure (O(dep th)). 1100 * is linear with respect to the depth of the node in the AST structure (O(dep th)).
153 * 1101 *
154 * @return the node at the root of this node's AST structure 1102 * @return the node at the root of this node's AST structure
155 */ 1103 */
156 ASTNode get root { 1104 AstNode get root {
157 ASTNode root = this; 1105 AstNode root = this;
158 ASTNode parent = this.parent; 1106 AstNode parent = this.parent;
159 while (parent != null) { 1107 while (parent != null) {
160 root = parent; 1108 root = parent;
161 parent = root.parent; 1109 parent = root.parent;
162 } 1110 }
163 return root; 1111 return root;
164 } 1112 }
165 1113
166 /** 1114 /**
167 * Return `true` if this node is a synthetic node. A synthetic node is a node that was 1115 * Return `true` if this node is a synthetic node. A synthetic node is a node that was
168 * introduced by the parser in order to recover from an error in the code. Syn thetic nodes always 1116 * introduced by the parser in order to recover from an error in the code. Syn thetic nodes always
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 1156 }
209 1157
210 String toString() => toSource(); 1158 String toString() => toSource();
211 1159
212 /** 1160 /**
213 * Use the given visitor to visit all of the children of this node. The childr en will be visited 1161 * Use the given visitor to visit all of the children of this node. The childr en will be visited
214 * in source order. 1162 * in source order.
215 * 1163 *
216 * @param visitor the visitor that will be used to visit the children of this node 1164 * @param visitor the visitor that will be used to visit the children of this node
217 */ 1165 */
218 void visitChildren(ASTVisitor visitor); 1166 void visitChildren(AstVisitor visitor);
219 1167
220 /** 1168 /**
221 * Make this node the parent of the given child node. 1169 * Make this node the parent of the given child node.
222 * 1170 *
223 * @param child the node that will become a child of this node 1171 * @param child the node that will become a child of this node
224 * @return the node that was made a child of this node 1172 * @return the node that was made a child of this node
225 */ 1173 */
226 ASTNode becomeParentOf(ASTNode child) { 1174 AstNode becomeParentOf(AstNode child) {
227 if (child != null) { 1175 if (child != null) {
228 ASTNode node = child; 1176 AstNode node = child;
229 node.parent = this; 1177 node.parent = this;
230 } 1178 }
231 return child; 1179 return child;
232 } 1180 }
233 1181
234 /** 1182 /**
235 * If the given child is not `null`, use the given visitor to visit it. 1183 * If the given child is not `null`, use the given visitor to visit it.
236 * 1184 *
237 * @param child the child to be visited 1185 * @param child the child to be visited
238 * @param visitor the visitor that will be used to visit the child 1186 * @param visitor the visitor that will be used to visit the child
239 */ 1187 */
240 void safelyVisitChild(ASTNode child, ASTVisitor visitor) { 1188 void safelyVisitChild(AstNode child, AstVisitor visitor) {
241 if (child != null) { 1189 if (child != null) {
242 child.accept(visitor); 1190 child.accept(visitor);
243 } 1191 }
244 } 1192 }
245 1193
246 /** 1194 /**
247 * Set the parent of this node to the given node. 1195 * Set the parent of this node to the given node.
248 * 1196 *
249 * @param newParent the node that is to be made the parent of this node 1197 * @param newParent the node that is to be made the parent of this node
250 */ 1198 */
251 void set parent(ASTNode newParent) { 1199 void set parent(AstNode newParent) {
252 _parent = newParent; 1200 _parent = newParent;
253 } 1201 }
254
255 static int _hashCodeGenerator = 0;
256
257 final int hashCode = ++_hashCodeGenerator;
258 } 1202 }
259 1203
260 /** 1204 /**
261 * The interface `ASTVisitor` defines the behavior of objects that can be used t o visit an AST 1205 * The interface `AstVisitor` defines the behavior of objects that can be used t o visit an AST
262 * structure. 1206 * structure.
263 *
264 * @coverage dart.engine.ast
265 */ 1207 */
266 abstract class ASTVisitor<R> { 1208 abstract class AstVisitor<R> {
267 R visitAdjacentStrings(AdjacentStrings node); 1209 R visitAdjacentStrings(AdjacentStrings node);
268 1210
269 R visitAnnotation(Annotation node); 1211 R visitAnnotation(Annotation node);
270 1212
271 R visitArgumentDefinitionTest(ArgumentDefinitionTest node); 1213 R visitArgumentDefinitionTest(ArgumentDefinitionTest node);
272 1214
273 R visitArgumentList(ArgumentList node); 1215 R visitArgumentList(ArgumentList node);
274 1216
275 R visitAsExpression(AsExpression node); 1217 R visitAsExpression(AsExpression node);
276 1218
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 R visitVariableDeclarationList(VariableDeclarationList node); 1407 R visitVariableDeclarationList(VariableDeclarationList node);
466 1408
467 R visitVariableDeclarationStatement(VariableDeclarationStatement node); 1409 R visitVariableDeclarationStatement(VariableDeclarationStatement node);
468 1410
469 R visitWhileStatement(WhileStatement node); 1411 R visitWhileStatement(WhileStatement node);
470 1412
471 R visitWithClause(WithClause node); 1413 R visitWithClause(WithClause node);
472 } 1414 }
473 1415
474 /** 1416 /**
475 * Instances of the class `AdjacentStrings` represents two or more string litera ls that are
476 * implicitly concatenated because of being adjacent (separated only by whitespa ce).
477 *
478 * While the grammar only allows adjacent strings when all of the strings are of the same kind
479 * (single line or multi-line), this class doesn't enforce that restriction.
480 *
481 * <pre>
482 * adjacentStrings ::=
483 * [StringLiteral] [StringLiteral]+
484 * </pre>
485 *
486 * @coverage dart.engine.ast
487 */
488 class AdjacentStrings extends StringLiteral {
489 /**
490 * The strings that are implicitly concatenated.
491 */
492 NodeList<StringLiteral> _strings;
493
494 /**
495 * Initialize a newly created list of adjacent strings.
496 *
497 * @param strings the strings that are implicitly concatenated
498 */
499 AdjacentStrings(List<StringLiteral> strings) {
500 this._strings = new NodeList<StringLiteral>(this);
501 this._strings.addAll(strings);
502 }
503
504 accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this);
505
506 Token get beginToken => _strings.beginToken;
507
508 Token get endToken => _strings.endToken;
509
510 /**
511 * Return the strings that are implicitly concatenated.
512 *
513 * @return the strings that are implicitly concatenated
514 */
515 NodeList<StringLiteral> get strings => _strings;
516
517 void visitChildren(ASTVisitor visitor) {
518 _strings.accept(visitor);
519 }
520
521 void appendStringValue(JavaStringBuilder builder) {
522 for (StringLiteral stringLiteral in strings) {
523 stringLiteral.appendStringValue(builder);
524 }
525 }
526 }
527
528 /**
529 * The abstract class `AnnotatedNode` defines the behavior of nodes that can be annotated with
530 * both a comment and metadata.
531 *
532 * @coverage dart.engine.ast
533 */
534 abstract class AnnotatedNode extends ASTNode {
535 /**
536 * The documentation comment associated with this node, or `null` if this node does not have
537 * a documentation comment associated with it.
538 */
539 Comment _comment;
540
541 /**
542 * The annotations associated with this node.
543 */
544 NodeList<Annotation> _metadata;
545
546 /**
547 * Initialize a newly created node.
548 *
549 * @param comment the documentation comment associated with this node
550 * @param metadata the annotations associated with this node
551 */
552 AnnotatedNode(Comment comment, List<Annotation> metadata) {
553 this._metadata = new NodeList<Annotation>(this);
554 this._comment = becomeParentOf(comment);
555 this._metadata.addAll(metadata);
556 }
557
558 Token get beginToken {
559 if (_comment == null) {
560 if (_metadata.isEmpty) {
561 return firstTokenAfterCommentAndMetadata;
562 } else {
563 return _metadata.beginToken;
564 }
565 } else if (_metadata.isEmpty) {
566 return _comment.beginToken;
567 }
568 Token commentToken = _comment.beginToken;
569 Token metadataToken = _metadata.beginToken;
570 if (commentToken.offset < metadataToken.offset) {
571 return commentToken;
572 }
573 return metadataToken;
574 }
575
576 /**
577 * Return the documentation comment associated with this node, or `null` if th is node does
578 * not have a documentation comment associated with it.
579 *
580 * @return the documentation comment associated with this node
581 */
582 Comment get documentationComment => _comment;
583
584 /**
585 * Return the annotations associated with this node.
586 *
587 * @return the annotations associated with this node
588 */
589 NodeList<Annotation> get metadata => _metadata;
590
591 /**
592 * Set the documentation comment associated with this node to the given commen t.
593 *
594 * @param comment the documentation comment to be associated with this node
595 */
596 void set documentationComment(Comment comment) {
597 this._comment = becomeParentOf(comment);
598 }
599
600 /**
601 * Set the metadata associated with this node to the given metadata.
602 *
603 * @param metadata the metadata to be associated with this node
604 */
605 void set metadata(List<Annotation> metadata) {
606 this._metadata.clear();
607 this._metadata.addAll(metadata);
608 }
609
610 void visitChildren(ASTVisitor visitor) {
611 if (commentIsBeforeAnnotations()) {
612 safelyVisitChild(_comment, visitor);
613 _metadata.accept(visitor);
614 } else {
615 for (ASTNode child in sortedCommentAndAnnotations) {
616 child.accept(visitor);
617 }
618 }
619 }
620
621 /**
622 * Return the first token following the comment and metadata.
623 *
624 * @return the first token following the comment and metadata
625 */
626 Token get firstTokenAfterCommentAndMetadata;
627
628 /**
629 * Return `true` if the comment is lexically before any annotations.
630 *
631 * @return `true` if the comment is lexically before any annotations
632 */
633 bool commentIsBeforeAnnotations() {
634 if (_comment == null || _metadata.isEmpty) {
635 return true;
636 }
637 Annotation firstAnnotation = _metadata[0];
638 return _comment.offset < firstAnnotation.offset;
639 }
640
641 /**
642 * Return an array containing the comment and annotations associated with this node, sorted in
643 * lexical order.
644 *
645 * @return the comment and annotations associated with this node in the order in which they
646 * appeared in the original source
647 */
648 List<ASTNode> get sortedCommentAndAnnotations {
649 List<ASTNode> childList = new List<ASTNode>();
650 childList.add(_comment);
651 childList.addAll(_metadata);
652 List<ASTNode> children = new List.from(childList);
653 children.sort(ASTNode.LEXICAL_ORDER);
654 return children;
655 }
656 }
657
658 /**
659 * Instances of the class `Annotation` represent an annotation that can be assoc iated with an
660 * AST node.
661 *
662 * <pre>
663 * metadata ::=
664 * annotation*
665 *
666 * annotation ::=
667 * '@' [Identifier] ('.' [SimpleIdentifier])? [ArgumentList]?
668 * </pre>
669 *
670 * @coverage dart.engine.ast
671 */
672 class Annotation extends ASTNode {
673 /**
674 * The at sign that introduced the annotation.
675 */
676 Token atSign;
677
678 /**
679 * The name of the class defining the constructor that is being invoked or the name of the field
680 * that is being referenced.
681 */
682 Identifier _name;
683
684 /**
685 * The period before the constructor name, or `null` if this annotation is not the
686 * invocation of a named constructor.
687 */
688 Token period;
689
690 /**
691 * The name of the constructor being invoked, or `null` if this annotation is not the
692 * invocation of a named constructor.
693 */
694 SimpleIdentifier _constructorName;
695
696 /**
697 * The arguments to the constructor being invoked, or `null` if this annotatio n is not the
698 * invocation of a constructor.
699 */
700 ArgumentList _arguments;
701
702 /**
703 * The element associated with this annotation, or `null` if the AST structure has not been
704 * resolved or if this annotation could not be resolved.
705 */
706 Element _element;
707
708 /**
709 * Initialize a newly created annotation.
710 *
711 * @param atSign the at sign that introduced the annotation
712 * @param name the name of the class defining the constructor that is being in voked or the name of
713 * the field that is being referenced
714 * @param period the period before the constructor name, or `null` if this ann otation is not
715 * the invocation of a named constructor
716 * @param constructorName the name of the constructor being invoked, or `null` if this
717 * annotation is not the invocation of a named constructor
718 * @param arguments the arguments to the constructor being invoked, or `null` if this
719 * annotation is not the invocation of a constructor
720 */
721 Annotation(this.atSign, Identifier name, this.period, SimpleIdentifier constru ctorName, ArgumentList arguments) {
722 this._name = becomeParentOf(name);
723 this._constructorName = becomeParentOf(constructorName);
724 this._arguments = becomeParentOf(arguments);
725 }
726
727 accept(ASTVisitor visitor) => visitor.visitAnnotation(this);
728
729 /**
730 * Return the arguments to the constructor being invoked, or `null` if this an notation is
731 * not the invocation of a constructor.
732 *
733 * @return the arguments to the constructor being invoked
734 */
735 ArgumentList get arguments => _arguments;
736
737 Token get beginToken => atSign;
738
739 /**
740 * Return the name of the constructor being invoked, or `null` if this annotat ion is not the
741 * invocation of a named constructor.
742 *
743 * @return the name of the constructor being invoked
744 */
745 SimpleIdentifier get constructorName => _constructorName;
746
747 /**
748 * Return the element associated with this annotation, or `null` if the AST st ructure has
749 * not been resolved or if this annotation could not be resolved.
750 *
751 * @return the element associated with this annotation
752 */
753 Element get element {
754 if (_element != null) {
755 return _element;
756 }
757 if (_name != null) {
758 return _name.staticElement;
759 }
760 return null;
761 }
762
763 Token get endToken {
764 if (_arguments != null) {
765 return _arguments.endToken;
766 } else if (_constructorName != null) {
767 return _constructorName.endToken;
768 }
769 return _name.endToken;
770 }
771
772 /**
773 * Return the name of the class defining the constructor that is being invoked or the name of the
774 * field that is being referenced.
775 *
776 * @return the name of the constructor being invoked or the name of the field being referenced
777 */
778 Identifier get name => _name;
779
780 /**
781 * Set the arguments to the constructor being invoked to the given arguments.
782 *
783 * @param arguments the arguments to the constructor being invoked
784 */
785 void set arguments(ArgumentList arguments) {
786 this._arguments = becomeParentOf(arguments);
787 }
788
789 /**
790 * Set the name of the constructor being invoked to the given name.
791 *
792 * @param constructorName the name of the constructor being invoked
793 */
794 void set constructorName(SimpleIdentifier constructorName) {
795 this._constructorName = becomeParentOf(constructorName);
796 }
797
798 /**
799 * Set the element associated with this annotation based.
800 *
801 * @param element the element to be associated with this identifier
802 */
803 void set element(Element element) {
804 this._element = element;
805 }
806
807 /**
808 * Set the name of the class defining the constructor that is being invoked or the name of the
809 * field that is being referenced to the given name.
810 *
811 * @param name the name of the constructor being invoked or the name of the fi eld being referenced
812 */
813 void set name(Identifier name) {
814 this._name = becomeParentOf(name);
815 }
816
817 void visitChildren(ASTVisitor visitor) {
818 safelyVisitChild(_name, visitor);
819 safelyVisitChild(_constructorName, visitor);
820 safelyVisitChild(_arguments, visitor);
821 }
822 }
823
824 /**
825 * Instances of the class `ArgumentDefinitionTest` represent an argument definit ion test.
826 *
827 * <pre>
828 * argumentDefinitionTest ::=
829 * '?' [SimpleIdentifier]
830 * </pre>
831 *
832 * @coverage dart.engine.ast
833 */
834 class ArgumentDefinitionTest extends Expression {
835 /**
836 * The token representing the question mark.
837 */
838 Token question;
839
840 /**
841 * The identifier representing the argument being tested.
842 */
843 SimpleIdentifier _identifier;
844
845 /**
846 * Initialize a newly created argument definition test.
847 *
848 * @param question the token representing the question mark
849 * @param identifier the identifier representing the argument being tested
850 */
851 ArgumentDefinitionTest(this.question, SimpleIdentifier identifier) {
852 this._identifier = becomeParentOf(identifier);
853 }
854
855 accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this);
856
857 Token get beginToken => question;
858
859 Token get endToken => _identifier.endToken;
860
861 /**
862 * Return the identifier representing the argument being tested.
863 *
864 * @return the identifier representing the argument being tested
865 */
866 SimpleIdentifier get identifier => _identifier;
867
868 int get precedence => 15;
869
870 /**
871 * Set the identifier representing the argument being tested to the given iden tifier.
872 *
873 * @param identifier the identifier representing the argument being tested
874 */
875 void set identifier(SimpleIdentifier identifier) {
876 this._identifier = becomeParentOf(identifier);
877 }
878
879 void visitChildren(ASTVisitor visitor) {
880 safelyVisitChild(_identifier, visitor);
881 }
882 }
883
884 /**
885 * Instances of the class `ArgumentList` represent a list of arguments in the in vocation of a
886 * executable element: a function, method, or constructor.
887 *
888 * <pre>
889 * argumentList ::=
890 * '(' arguments? ')'
891 *
892 * arguments ::=
893 * [NamedExpression] (',' [NamedExpression])*
894 * | [Expression] (',' [NamedExpression])*
895 * </pre>
896 *
897 * @coverage dart.engine.ast
898 */
899 class ArgumentList extends ASTNode {
900 /**
901 * The left parenthesis.
902 */
903 Token _leftParenthesis;
904
905 /**
906 * The expressions producing the values of the arguments.
907 */
908 NodeList<Expression> _arguments;
909
910 /**
911 * The right parenthesis.
912 */
913 Token _rightParenthesis;
914
915 /**
916 * An array containing the elements representing the parameters corresponding to each of the
917 * arguments in this list, or `null` if the AST has not been resolved or if th e function or
918 * method being invoked could not be determined based on static type informati on. The array must
919 * be the same length as the number of arguments, but can contain `null` entri es if a given
920 * argument does not correspond to a formal parameter.
921 */
922 List<ParameterElement> _correspondingStaticParameters;
923
924 /**
925 * An array containing the elements representing the parameters corresponding to each of the
926 * arguments in this list, or `null` if the AST has not been resolved or if th e function or
927 * method being invoked could not be determined based on propagated type infor mation. The array
928 * must be the same length as the number of arguments, but can contain `null` entries if a
929 * given argument does not correspond to a formal parameter.
930 */
931 List<ParameterElement> _correspondingPropagatedParameters;
932
933 /**
934 * Initialize a newly created list of arguments.
935 *
936 * @param leftParenthesis the left parenthesis
937 * @param arguments the expressions producing the values of the arguments
938 * @param rightParenthesis the right parenthesis
939 */
940 ArgumentList(Token leftParenthesis, List<Expression> arguments, Token rightPar enthesis) {
941 this._arguments = new NodeList<Expression>(this);
942 this._leftParenthesis = leftParenthesis;
943 this._arguments.addAll(arguments);
944 this._rightParenthesis = rightParenthesis;
945 }
946
947 accept(ASTVisitor visitor) => visitor.visitArgumentList(this);
948
949 /**
950 * Return the expressions producing the values of the arguments. Although the language requires
951 * that positional arguments appear before named arguments, this class allows them to be
952 * intermixed.
953 *
954 * @return the expressions producing the values of the arguments
955 */
956 NodeList<Expression> get arguments => _arguments;
957
958 Token get beginToken => _leftParenthesis;
959
960 Token get endToken => _rightParenthesis;
961
962 /**
963 * Return the left parenthesis.
964 *
965 * @return the left parenthesis
966 */
967 Token get leftParenthesis => _leftParenthesis;
968
969 /**
970 * Return the right parenthesis.
971 *
972 * @return the right parenthesis
973 */
974 Token get rightParenthesis => _rightParenthesis;
975
976 /**
977 * Set the parameter elements corresponding to each of the arguments in this l ist to the given
978 * array of parameters. The array of parameters must be the same length as the number of
979 * arguments, but can contain `null` entries if a given argument does not corr espond to a
980 * formal parameter.
981 *
982 * @param parameters the parameter elements corresponding to the arguments
983 */
984 void set correspondingPropagatedParameters(List<ParameterElement> parameters) {
985 if (parameters.length != _arguments.length) {
986 throw new IllegalArgumentException("Expected ${_arguments.length} paramete rs, not ${parameters.length}");
987 }
988 _correspondingPropagatedParameters = parameters;
989 }
990
991 /**
992 * Set the parameter elements corresponding to each of the arguments in this l ist to the given
993 * array of parameters. The array of parameters must be the same length as the number of
994 * arguments, but can contain `null` entries if a given argument does not corr espond to a
995 * formal parameter.
996 *
997 * @param parameters the parameter elements corresponding to the arguments
998 */
999 void set correspondingStaticParameters(List<ParameterElement> parameters) {
1000 if (parameters.length != _arguments.length) {
1001 throw new IllegalArgumentException("Expected ${_arguments.length} paramete rs, not ${parameters.length}");
1002 }
1003 _correspondingStaticParameters = parameters;
1004 }
1005
1006 /**
1007 * Set the left parenthesis to the given token.
1008 *
1009 * @param parenthesis the left parenthesis
1010 */
1011 void set leftParenthesis(Token parenthesis) {
1012 _leftParenthesis = parenthesis;
1013 }
1014
1015 /**
1016 * Set the right parenthesis to the given token.
1017 *
1018 * @param parenthesis the right parenthesis
1019 */
1020 void set rightParenthesis(Token parenthesis) {
1021 _rightParenthesis = parenthesis;
1022 }
1023
1024 void visitChildren(ASTVisitor visitor) {
1025 _arguments.accept(visitor);
1026 }
1027
1028 /**
1029 * If the given expression is a child of this list, and the AST structure has been resolved, and
1030 * the function being invoked is known based on propagated type information, a nd the expression
1031 * corresponds to one of the parameters of the function being invoked, then re turn the parameter
1032 * element representing the parameter to which the value of the given expressi on will be bound.
1033 * Otherwise, return `null`.
1034 *
1035 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
1036 *
1037 * @param expression the expression corresponding to the parameter to be retur ned
1038 * @return the parameter element representing the parameter to which the value of the expression
1039 * will be bound
1040 */
1041 ParameterElement getPropagatedParameterElementFor(Expression expression) {
1042 if (_correspondingPropagatedParameters == null) {
1043 // Either the AST structure has not been resolved or the invocation of whi ch this list is a
1044 // part could not be resolved.
1045 return null;
1046 }
1047 int index = _arguments.indexOf(expression);
1048 if (index < 0) {
1049 // The expression isn't a child of this node.
1050 return null;
1051 }
1052 return _correspondingPropagatedParameters[index];
1053 }
1054
1055 /**
1056 * If the given expression is a child of this list, and the AST structure has been resolved, and
1057 * the function being invoked is known based on static type information, and t he expression
1058 * corresponds to one of the parameters of the function being invoked, then re turn the parameter
1059 * element representing the parameter to which the value of the given expressi on will be bound.
1060 * Otherwise, return `null`.
1061 *
1062 * This method is only intended to be used by [Expression#getStaticParameterEl ement].
1063 *
1064 * @param expression the expression corresponding to the parameter to be retur ned
1065 * @return the parameter element representing the parameter to which the value of the expression
1066 * will be bound
1067 */
1068 ParameterElement getStaticParameterElementFor(Expression expression) {
1069 if (_correspondingStaticParameters == null) {
1070 // Either the AST structure has not been resolved or the invocation of whi ch this list is a
1071 // part could not be resolved.
1072 return null;
1073 }
1074 int index = _arguments.indexOf(expression);
1075 if (index < 0) {
1076 // The expression isn't a child of this node.
1077 return null;
1078 }
1079 return _correspondingStaticParameters[index];
1080 }
1081 }
1082
1083 /**
1084 * Instances of the class `AsExpression` represent an 'as' expression.
1085 *
1086 * <pre>
1087 * asExpression ::=
1088 * [Expression] 'as' [TypeName]
1089 * </pre>
1090 *
1091 * @coverage dart.engine.ast
1092 */
1093 class AsExpression extends Expression {
1094 /**
1095 * The expression used to compute the value being cast.
1096 */
1097 Expression _expression;
1098
1099 /**
1100 * The as operator.
1101 */
1102 Token asOperator;
1103
1104 /**
1105 * The name of the type being cast to.
1106 */
1107 TypeName _type;
1108
1109 /**
1110 * Initialize a newly created as expression.
1111 *
1112 * @param expression the expression used to compute the value being cast
1113 * @param isOperator the is operator
1114 * @param type the name of the type being cast to
1115 */
1116 AsExpression(Expression expression, Token isOperator, TypeName type) {
1117 this._expression = becomeParentOf(expression);
1118 this.asOperator = isOperator;
1119 this._type = becomeParentOf(type);
1120 }
1121
1122 accept(ASTVisitor visitor) => visitor.visitAsExpression(this);
1123
1124 Token get beginToken => _expression.beginToken;
1125
1126 Token get endToken => _type.endToken;
1127
1128 /**
1129 * Return the expression used to compute the value being cast.
1130 *
1131 * @return the expression used to compute the value being cast
1132 */
1133 Expression get expression => _expression;
1134
1135 int get precedence => 7;
1136
1137 /**
1138 * Return the name of the type being cast to.
1139 *
1140 * @return the name of the type being cast to
1141 */
1142 TypeName get type => _type;
1143
1144 /**
1145 * Set the expression used to compute the value being cast to the given expres sion.
1146 *
1147 * @param expression the expression used to compute the value being cast
1148 */
1149 void set expression(Expression expression) {
1150 this._expression = becomeParentOf(expression);
1151 }
1152
1153 /**
1154 * Set the name of the type being cast to to the given name.
1155 *
1156 * @param name the name of the type being cast to
1157 */
1158 void set type(TypeName name) {
1159 this._type = becomeParentOf(name);
1160 }
1161
1162 void visitChildren(ASTVisitor visitor) {
1163 safelyVisitChild(_expression, visitor);
1164 safelyVisitChild(_type, visitor);
1165 }
1166 }
1167
1168 /**
1169 * Instances of the class `AssertStatement` represent an assert statement.
1170 *
1171 * <pre>
1172 * assertStatement ::=
1173 * 'assert' '(' [Expression] ')' ';'
1174 * </pre>
1175 *
1176 * @coverage dart.engine.ast
1177 */
1178 class AssertStatement extends Statement {
1179 /**
1180 * The token representing the 'assert' keyword.
1181 */
1182 Token keyword;
1183
1184 /**
1185 * The left parenthesis.
1186 */
1187 Token leftParenthesis;
1188
1189 /**
1190 * The condition that is being asserted to be `true`.
1191 */
1192 Expression _condition;
1193
1194 /**
1195 * The right parenthesis.
1196 */
1197 Token rightParenthesis;
1198
1199 /**
1200 * The semicolon terminating the statement.
1201 */
1202 Token semicolon;
1203
1204 /**
1205 * Initialize a newly created assert statement.
1206 *
1207 * @param keyword the token representing the 'assert' keyword
1208 * @param leftParenthesis the left parenthesis
1209 * @param condition the condition that is being asserted to be `true`
1210 * @param rightParenthesis the right parenthesis
1211 * @param semicolon the semicolon terminating the statement
1212 */
1213 AssertStatement(this.keyword, this.leftParenthesis, Expression condition, this .rightParenthesis, this.semicolon) {
1214 this._condition = becomeParentOf(condition);
1215 }
1216
1217 accept(ASTVisitor visitor) => visitor.visitAssertStatement(this);
1218
1219 Token get beginToken => keyword;
1220
1221 /**
1222 * Return the condition that is being asserted to be `true`.
1223 *
1224 * @return the condition that is being asserted to be `true`
1225 */
1226 Expression get condition => _condition;
1227
1228 Token get endToken => semicolon;
1229
1230 /**
1231 * Set the condition that is being asserted to be `true` to the given expressi on.
1232 *
1233 * @param the condition that is being asserted to be `true`
1234 */
1235 void set condition(Expression condition) {
1236 this._condition = becomeParentOf(condition);
1237 }
1238
1239 void visitChildren(ASTVisitor visitor) {
1240 safelyVisitChild(_condition, visitor);
1241 }
1242 }
1243
1244 /**
1245 * Instances of the class `AssignmentExpression` represent an assignment express ion.
1246 *
1247 * <pre>
1248 * assignmentExpression ::=
1249 * [Expression] [Token] [Expression]
1250 * </pre>
1251 *
1252 * @coverage dart.engine.ast
1253 */
1254 class AssignmentExpression extends Expression {
1255 /**
1256 * The expression used to compute the left hand side.
1257 */
1258 Expression _leftHandSide;
1259
1260 /**
1261 * The assignment operator being applied.
1262 */
1263 Token operator;
1264
1265 /**
1266 * The expression used to compute the right hand side.
1267 */
1268 Expression _rightHandSide;
1269
1270 /**
1271 * The element associated with the operator based on the static type of the le ft-hand-side, or
1272 * `null` if the AST structure has not been resolved, if the operator is not a compound
1273 * operator, or if the operator could not be resolved.
1274 */
1275 MethodElement _staticElement;
1276
1277 /**
1278 * The element associated with the operator based on the propagated type of th e left-hand-side, or
1279 * `null` if the AST structure has not been resolved, if the operator is not a compound
1280 * operator, or if the operator could not be resolved.
1281 */
1282 MethodElement _propagatedElement;
1283
1284 /**
1285 * Initialize a newly created assignment expression.
1286 *
1287 * @param leftHandSide the expression used to compute the left hand side
1288 * @param operator the assignment operator being applied
1289 * @param rightHandSide the expression used to compute the right hand side
1290 */
1291 AssignmentExpression(Expression leftHandSide, this.operator, Expression rightH andSide) {
1292 this._leftHandSide = becomeParentOf(leftHandSide);
1293 this._rightHandSide = becomeParentOf(rightHandSide);
1294 }
1295
1296 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this);
1297
1298 Token get beginToken => _leftHandSide.beginToken;
1299
1300 /**
1301 * Return the best element available for this operator. If resolution was able to find a better
1302 * element based on type propagation, that element will be returned. Otherwise , the element found
1303 * using the result of static analysis will be returned. If resolution has not been performed,
1304 * then `null` will be returned.
1305 *
1306 * @return the best element available for this operator
1307 */
1308 MethodElement get bestElement {
1309 MethodElement element = propagatedElement;
1310 if (element == null) {
1311 element = staticElement;
1312 }
1313 return element;
1314 }
1315
1316 Token get endToken => _rightHandSide.endToken;
1317
1318 /**
1319 * Set the expression used to compute the left hand side to the given expressi on.
1320 *
1321 * @return the expression used to compute the left hand side
1322 */
1323 Expression get leftHandSide => _leftHandSide;
1324
1325 int get precedence => 1;
1326
1327 /**
1328 * Return the element associated with the operator based on the propagated typ e of the
1329 * left-hand-side, or `null` if the AST structure has not been resolved, if th e operator is
1330 * not a compound operator, or if the operator could not be resolved. One exam ple of the latter
1331 * case is an operator that is not defined for the type of the left-hand opera nd.
1332 *
1333 * @return the element associated with the operator
1334 */
1335 MethodElement get propagatedElement => _propagatedElement;
1336
1337 /**
1338 * Return the expression used to compute the right hand side.
1339 *
1340 * @return the expression used to compute the right hand side
1341 */
1342 Expression get rightHandSide => _rightHandSide;
1343
1344 /**
1345 * Return the element associated with the operator based on the static type of the left-hand-side,
1346 * or `null` if the AST structure has not been resolved, if the operator is no t a compound
1347 * operator, or if the operator could not be resolved. One example of the latt er case is an
1348 * operator that is not defined for the type of the left-hand operand.
1349 *
1350 * @return the element associated with the operator
1351 */
1352 MethodElement get staticElement => _staticElement;
1353
1354 /**
1355 * Return the expression used to compute the left hand side.
1356 *
1357 * @param expression the expression used to compute the left hand side
1358 */
1359 void set leftHandSide(Expression expression) {
1360 _leftHandSide = becomeParentOf(expression);
1361 }
1362
1363 /**
1364 * Set the element associated with the operator based on the propagated type o f the left-hand-side
1365 * to the given element.
1366 *
1367 * @param element the element to be associated with the operator
1368 */
1369 void set propagatedElement(MethodElement element) {
1370 _propagatedElement = element;
1371 }
1372
1373 /**
1374 * Set the expression used to compute the left hand side to the given expressi on.
1375 *
1376 * @param expression the expression used to compute the left hand side
1377 */
1378 void set rightHandSide(Expression expression) {
1379 _rightHandSide = becomeParentOf(expression);
1380 }
1381
1382 /**
1383 * Set the element associated with the operator based on the static type of th e left-hand-side to
1384 * the given element.
1385 *
1386 * @param element the static element to be associated with the operator
1387 */
1388 void set staticElement(MethodElement element) {
1389 _staticElement = element;
1390 }
1391
1392 void visitChildren(ASTVisitor visitor) {
1393 safelyVisitChild(_leftHandSide, visitor);
1394 safelyVisitChild(_rightHandSide, visitor);
1395 }
1396
1397 /**
1398 * If the AST structure has been resolved, and the function being invoked is k nown based on
1399 * propagated type information, then return the parameter element representing the parameter to
1400 * which the value of the right operand will be bound. Otherwise, return `null `.
1401 *
1402 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
1403 *
1404 * @return the parameter element representing the parameter to which the value of the right
1405 * operand will be bound
1406 */
1407 ParameterElement get propagatedParameterElementForRightHandSide {
1408 if (_propagatedElement == null) {
1409 return null;
1410 }
1411 List<ParameterElement> parameters = _propagatedElement.parameters;
1412 if (parameters.length < 1) {
1413 return null;
1414 }
1415 return parameters[0];
1416 }
1417
1418 /**
1419 * If the AST structure has been resolved, and the function being invoked is k nown based on static
1420 * type information, then return the parameter element representing the parame ter to which the
1421 * value of the right operand will be bound. Otherwise, return `null`.
1422 *
1423 * This method is only intended to be used by [Expression#getStaticParameterEl ement].
1424 *
1425 * @return the parameter element representing the parameter to which the value of the right
1426 * operand will be bound
1427 */
1428 ParameterElement get staticParameterElementForRightHandSide {
1429 if (_staticElement == null) {
1430 return null;
1431 }
1432 List<ParameterElement> parameters = _staticElement.parameters;
1433 if (parameters.length < 1) {
1434 return null;
1435 }
1436 return parameters[0];
1437 }
1438 }
1439
1440 /**
1441 * Instances of the class `BinaryExpression` represent a binary (infix) expressi on. 1417 * Instances of the class `BinaryExpression` represent a binary (infix) expressi on.
1442 * 1418 *
1443 * <pre> 1419 * <pre>
1444 * binaryExpression ::= 1420 * binaryExpression ::=
1445 * [Expression] [Token] [Expression] 1421 * [Expression] [Token] [Expression]
1446 * </pre> 1422 * </pre>
1447 *
1448 * @coverage dart.engine.ast
1449 */ 1423 */
1450 class BinaryExpression extends Expression { 1424 class BinaryExpression extends Expression {
1451 /** 1425 /**
1452 * The expression used to compute the left operand. 1426 * The expression used to compute the left operand.
1453 */ 1427 */
1454 Expression _leftOperand; 1428 Expression _leftOperand;
1455 1429
1456 /** 1430 /**
1457 * The binary operator being applied. 1431 * The binary operator being applied.
1458 */ 1432 */
(...skipping 23 matching lines...) Expand all
1482 * 1456 *
1483 * @param leftOperand the expression used to compute the left operand 1457 * @param leftOperand the expression used to compute the left operand
1484 * @param operator the binary operator being applied 1458 * @param operator the binary operator being applied
1485 * @param rightOperand the expression used to compute the right operand 1459 * @param rightOperand the expression used to compute the right operand
1486 */ 1460 */
1487 BinaryExpression(Expression leftOperand, this.operator, Expression rightOperan d) { 1461 BinaryExpression(Expression leftOperand, this.operator, Expression rightOperan d) {
1488 this._leftOperand = becomeParentOf(leftOperand); 1462 this._leftOperand = becomeParentOf(leftOperand);
1489 this._rightOperand = becomeParentOf(rightOperand); 1463 this._rightOperand = becomeParentOf(rightOperand);
1490 } 1464 }
1491 1465
1492 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); 1466 accept(AstVisitor visitor) => visitor.visitBinaryExpression(this);
1493 1467
1494 Token get beginToken => _leftOperand.beginToken; 1468 Token get beginToken => _leftOperand.beginToken;
1495 1469
1496 /** 1470 /**
1497 * Return the best element available for this operator. If resolution was able to find a better 1471 * Return the best element available for this operator. If resolution was able to find a better
1498 * element based on type propagation, that element will be returned. Otherwise , the element found 1472 * element based on type propagation, that element will be returned. Otherwise , the element found
1499 * using the result of static analysis will be returned. If resolution has not been performed, 1473 * using the result of static analysis will be returned. If resolution has not been performed,
1500 * then `null` will be returned. 1474 * then `null` will be returned.
1501 * 1475 *
1502 * @return the best element available for this operator 1476 * @return the best element available for this operator
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 /** 1552 /**
1579 * Set the element associated with the operator based on the static type of th e left operand to 1553 * Set the element associated with the operator based on the static type of th e left operand to
1580 * the given element. 1554 * the given element.
1581 * 1555 *
1582 * @param element the static element to be associated with the operator 1556 * @param element the static element to be associated with the operator
1583 */ 1557 */
1584 void set staticElement(MethodElement element) { 1558 void set staticElement(MethodElement element) {
1585 _staticElement = element; 1559 _staticElement = element;
1586 } 1560 }
1587 1561
1588 void visitChildren(ASTVisitor visitor) { 1562 void visitChildren(AstVisitor visitor) {
1589 safelyVisitChild(_leftOperand, visitor); 1563 safelyVisitChild(_leftOperand, visitor);
1590 safelyVisitChild(_rightOperand, visitor); 1564 safelyVisitChild(_rightOperand, visitor);
1591 } 1565 }
1592 1566
1593 /** 1567 /**
1594 * If the AST structure has been resolved, and the function being invoked is k nown based on 1568 * If the AST structure has been resolved, and the function being invoked is k nown based on
1595 * propagated type information, then return the parameter element representing the parameter to 1569 * propagated type information, then return the parameter element representing the parameter to
1596 * which the value of the right operand will be bound. Otherwise, return `null `. 1570 * which the value of the right operand will be bound. Otherwise, return `null `.
1597 * 1571 *
1598 * This method is only intended to be used by [Expression#getPropagatedParamet erElement]. 1572 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 } 1607 }
1634 } 1608 }
1635 1609
1636 /** 1610 /**
1637 * Instances of the class `Block` represent a sequence of statements. 1611 * Instances of the class `Block` represent a sequence of statements.
1638 * 1612 *
1639 * <pre> 1613 * <pre>
1640 * block ::= 1614 * block ::=
1641 * '{' statement* '}' 1615 * '{' statement* '}'
1642 * </pre> 1616 * </pre>
1643 *
1644 * @coverage dart.engine.ast
1645 */ 1617 */
1646 class Block extends Statement { 1618 class Block extends Statement {
1647 /** 1619 /**
1648 * The left curly bracket. 1620 * The left curly bracket.
1649 */ 1621 */
1650 Token leftBracket; 1622 Token leftBracket;
1651 1623
1652 /** 1624 /**
1653 * The statements contained in the block. 1625 * The statements contained in the block.
1654 */ 1626 */
1655 NodeList<Statement> _statements; 1627 NodeList<Statement> _statements;
1656 1628
1657 /** 1629 /**
1658 * The right curly bracket. 1630 * The right curly bracket.
1659 */ 1631 */
1660 Token rightBracket; 1632 Token rightBracket;
1661 1633
1662 /** 1634 /**
1663 * Initialize a newly created block of code. 1635 * Initialize a newly created block of code.
1664 * 1636 *
1665 * @param leftBracket the left curly bracket 1637 * @param leftBracket the left curly bracket
1666 * @param statements the statements contained in the block 1638 * @param statements the statements contained in the block
1667 * @param rightBracket the right curly bracket 1639 * @param rightBracket the right curly bracket
1668 */ 1640 */
1669 Block(this.leftBracket, List<Statement> statements, this.rightBracket) { 1641 Block(this.leftBracket, List<Statement> statements, this.rightBracket) {
1670 this._statements = new NodeList<Statement>(this); 1642 this._statements = new NodeList<Statement>(this);
1671 this._statements.addAll(statements); 1643 this._statements.addAll(statements);
1672 } 1644 }
1673 1645
1674 accept(ASTVisitor visitor) => visitor.visitBlock(this); 1646 accept(AstVisitor visitor) => visitor.visitBlock(this);
1675 1647
1676 Token get beginToken => leftBracket; 1648 Token get beginToken => leftBracket;
1677 1649
1678 Token get endToken => rightBracket; 1650 Token get endToken => rightBracket;
1679 1651
1680 /** 1652 /**
1681 * Return the statements contained in the block. 1653 * Return the statements contained in the block.
1682 * 1654 *
1683 * @return the statements contained in the block 1655 * @return the statements contained in the block
1684 */ 1656 */
1685 NodeList<Statement> get statements => _statements; 1657 NodeList<Statement> get statements => _statements;
1686 1658
1687 void visitChildren(ASTVisitor visitor) { 1659 void visitChildren(AstVisitor visitor) {
1688 _statements.accept(visitor); 1660 _statements.accept(visitor);
1689 } 1661 }
1690 } 1662 }
1691 1663
1692 /** 1664 /**
1693 * Instances of the class `BlockFunctionBody` represent a function body that con sists of a 1665 * Instances of the class `BlockFunctionBody` represent a function body that con sists of a
1694 * block of statements. 1666 * block of statements.
1695 * 1667 *
1696 * <pre> 1668 * <pre>
1697 * blockFunctionBody ::= 1669 * blockFunctionBody ::=
1698 * [Block] 1670 * [Block]
1699 * </pre> 1671 * </pre>
1700 *
1701 * @coverage dart.engine.ast
1702 */ 1672 */
1703 class BlockFunctionBody extends FunctionBody { 1673 class BlockFunctionBody extends FunctionBody {
1704 /** 1674 /**
1705 * The block representing the body of the function. 1675 * The block representing the body of the function.
1706 */ 1676 */
1707 Block _block; 1677 Block _block;
1708 1678
1709 /** 1679 /**
1710 * Initialize a newly created function body consisting of a block of statement s. 1680 * Initialize a newly created function body consisting of a block of statement s.
1711 * 1681 *
1712 * @param block the block representing the body of the function 1682 * @param block the block representing the body of the function
1713 */ 1683 */
1714 BlockFunctionBody(Block block) { 1684 BlockFunctionBody(Block block) {
1715 this._block = becomeParentOf(block); 1685 this._block = becomeParentOf(block);
1716 } 1686 }
1717 1687
1718 accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this); 1688 accept(AstVisitor visitor) => visitor.visitBlockFunctionBody(this);
1719 1689
1720 Token get beginToken => _block.beginToken; 1690 Token get beginToken => _block.beginToken;
1721 1691
1722 /** 1692 /**
1723 * Return the block representing the body of the function. 1693 * Return the block representing the body of the function.
1724 * 1694 *
1725 * @return the block representing the body of the function 1695 * @return the block representing the body of the function
1726 */ 1696 */
1727 Block get block => _block; 1697 Block get block => _block;
1728 1698
1729 Token get endToken => _block.endToken; 1699 Token get endToken => _block.endToken;
1730 1700
1731 /** 1701 /**
1732 * Set the block representing the body of the function to the given block. 1702 * Set the block representing the body of the function to the given block.
1733 * 1703 *
1734 * @param block the block representing the body of the function 1704 * @param block the block representing the body of the function
1735 */ 1705 */
1736 void set block(Block block) { 1706 void set block(Block block) {
1737 this._block = becomeParentOf(block); 1707 this._block = becomeParentOf(block);
1738 } 1708 }
1739 1709
1740 void visitChildren(ASTVisitor visitor) { 1710 void visitChildren(AstVisitor visitor) {
1741 safelyVisitChild(_block, visitor); 1711 safelyVisitChild(_block, visitor);
1742 } 1712 }
1743 } 1713 }
1744 1714
1745 /** 1715 /**
1746 * Instances of the class `BooleanLiteral` represent a boolean literal expressio n. 1716 * Instances of the class `BooleanLiteral` represent a boolean literal expressio n.
1747 * 1717 *
1748 * <pre> 1718 * <pre>
1749 * booleanLiteral ::= 1719 * booleanLiteral ::=
1750 * 'false' | 'true' 1720 * 'false' | 'true'
1751 * </pre> 1721 * </pre>
1752 *
1753 * @coverage dart.engine.ast
1754 */ 1722 */
1755 class BooleanLiteral extends Literal { 1723 class BooleanLiteral extends Literal {
1756 /** 1724 /**
1757 * The token representing the literal. 1725 * The token representing the literal.
1758 */ 1726 */
1759 Token literal; 1727 Token literal;
1760 1728
1761 /** 1729 /**
1762 * The value of the literal. 1730 * The value of the literal.
1763 */ 1731 */
1764 bool value = false; 1732 bool value = false;
1765 1733
1766 /** 1734 /**
1767 * Initialize a newly created boolean literal. 1735 * Initialize a newly created boolean literal.
1768 * 1736 *
1769 * @param literal the token representing the literal 1737 * @param literal the token representing the literal
1770 * @param value the value of the literal 1738 * @param value the value of the literal
1771 */ 1739 */
1772 BooleanLiteral(this.literal, this.value); 1740 BooleanLiteral(this.literal, this.value);
1773 1741
1774 accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this); 1742 accept(AstVisitor visitor) => visitor.visitBooleanLiteral(this);
1775 1743
1776 Token get beginToken => literal; 1744 Token get beginToken => literal;
1777 1745
1778 Token get endToken => literal; 1746 Token get endToken => literal;
1779 1747
1780 bool get isSynthetic => literal.isSynthetic; 1748 bool get isSynthetic => literal.isSynthetic;
1781 1749
1782 void visitChildren(ASTVisitor visitor) { 1750 void visitChildren(AstVisitor visitor) {
1783 } 1751 }
1784 } 1752 }
1785 1753
1786 /** 1754 /**
1787 * Instances of the class `BreakStatement` represent a break statement. 1755 * Instances of the class `BreakStatement` represent a break statement.
1788 * 1756 *
1789 * <pre> 1757 * <pre>
1790 * breakStatement ::= 1758 * breakStatement ::=
1791 * 'break' [SimpleIdentifier]? ';' 1759 * 'break' [SimpleIdentifier]? ';'
1792 * </pre> 1760 * </pre>
1793 *
1794 * @coverage dart.engine.ast
1795 */ 1761 */
1796 class BreakStatement extends Statement { 1762 class BreakStatement extends Statement {
1797 /** 1763 /**
1798 * The token representing the 'break' keyword. 1764 * The token representing the 'break' keyword.
1799 */ 1765 */
1800 Token keyword; 1766 Token keyword;
1801 1767
1802 /** 1768 /**
1803 * The label associated with the statement, or `null` if there is no label. 1769 * The label associated with the statement, or `null` if there is no label.
1804 */ 1770 */
1805 SimpleIdentifier _label; 1771 SimpleIdentifier _label;
1806 1772
1807 /** 1773 /**
1808 * The semicolon terminating the statement. 1774 * The semicolon terminating the statement.
1809 */ 1775 */
1810 Token semicolon; 1776 Token semicolon;
1811 1777
1812 /** 1778 /**
1813 * Initialize a newly created break statement. 1779 * Initialize a newly created break statement.
1814 * 1780 *
1815 * @param keyword the token representing the 'break' keyword 1781 * @param keyword the token representing the 'break' keyword
1816 * @param label the label associated with the statement 1782 * @param label the label associated with the statement
1817 * @param semicolon the semicolon terminating the statement 1783 * @param semicolon the semicolon terminating the statement
1818 */ 1784 */
1819 BreakStatement(this.keyword, SimpleIdentifier label, this.semicolon) { 1785 BreakStatement(this.keyword, SimpleIdentifier label, this.semicolon) {
1820 this._label = becomeParentOf(label); 1786 this._label = becomeParentOf(label);
1821 } 1787 }
1822 1788
1823 accept(ASTVisitor visitor) => visitor.visitBreakStatement(this); 1789 accept(AstVisitor visitor) => visitor.visitBreakStatement(this);
1824 1790
1825 Token get beginToken => keyword; 1791 Token get beginToken => keyword;
1826 1792
1827 Token get endToken => semicolon; 1793 Token get endToken => semicolon;
1828 1794
1829 /** 1795 /**
1830 * Return the label associated with the statement, or `null` if there is no la bel. 1796 * Return the label associated with the statement, or `null` if there is no la bel.
1831 * 1797 *
1832 * @return the label associated with the statement 1798 * @return the label associated with the statement
1833 */ 1799 */
1834 SimpleIdentifier get label => _label; 1800 SimpleIdentifier get label => _label;
1835 1801
1836 /** 1802 /**
1837 * Set the label associated with the statement to the given identifier. 1803 * Set the label associated with the statement to the given identifier.
1838 * 1804 *
1839 * @param identifier the label associated with the statement 1805 * @param identifier the label associated with the statement
1840 */ 1806 */
1841 void set label(SimpleIdentifier identifier) { 1807 void set label(SimpleIdentifier identifier) {
1842 _label = becomeParentOf(identifier); 1808 _label = becomeParentOf(identifier);
1843 } 1809 }
1844 1810
1845 void visitChildren(ASTVisitor visitor) { 1811 void visitChildren(AstVisitor visitor) {
1846 safelyVisitChild(_label, visitor); 1812 safelyVisitChild(_label, visitor);
1847 } 1813 }
1848 } 1814 }
1849 1815
1850 /** 1816 /**
1851 * Instances of the class `CascadeExpression` represent a sequence of cascaded e xpressions: 1817 * Instances of the class `CascadeExpression` represent a sequence of cascaded e xpressions:
1852 * expressions that share a common target. There are three kinds of expressions that can be used in 1818 * expressions that share a common target. There are three kinds of expressions that can be used in
1853 * a cascade expression: [IndexExpression], [MethodInvocation] and 1819 * a cascade expression: [IndexExpression], [MethodInvocation] and
1854 * [PropertyAccess]. 1820 * [PropertyAccess].
1855 * 1821 *
1856 * <pre> 1822 * <pre>
1857 * cascadeExpression ::= 1823 * cascadeExpression ::=
1858 * [Expression] cascadeSection* 1824 * [Expression] cascadeSection*
1859 * 1825 *
1860 * cascadeSection ::= 1826 * cascadeSection ::=
1861 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assi gnmentOperator expressionWithoutCascade)? 1827 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assi gnmentOperator expressionWithoutCascade)?
1862 * 1828 *
1863 * cascadeSelector ::= 1829 * cascadeSelector ::=
1864 * '[ ' expression '] ' 1830 * '[ ' expression '] '
1865 * | identifier 1831 * | identifier
1866 * </pre> 1832 * </pre>
1867 *
1868 * @coverage dart.engine.ast
1869 */ 1833 */
1870 class CascadeExpression extends Expression { 1834 class CascadeExpression extends Expression {
1871 /** 1835 /**
1872 * The target of the cascade sections. 1836 * The target of the cascade sections.
1873 */ 1837 */
1874 Expression _target; 1838 Expression _target;
1875 1839
1876 /** 1840 /**
1877 * The cascade sections sharing the common target. 1841 * The cascade sections sharing the common target.
1878 */ 1842 */
1879 NodeList<Expression> _cascadeSections; 1843 NodeList<Expression> _cascadeSections;
1880 1844
1881 /** 1845 /**
1882 * Initialize a newly created cascade expression. 1846 * Initialize a newly created cascade expression.
1883 * 1847 *
1884 * @param target the target of the cascade sections 1848 * @param target the target of the cascade sections
1885 * @param cascadeSections the cascade sections sharing the common target 1849 * @param cascadeSections the cascade sections sharing the common target
1886 */ 1850 */
1887 CascadeExpression(Expression target, List<Expression> cascadeSections) { 1851 CascadeExpression(Expression target, List<Expression> cascadeSections) {
1888 this._cascadeSections = new NodeList<Expression>(this); 1852 this._cascadeSections = new NodeList<Expression>(this);
1889 this._target = becomeParentOf(target); 1853 this._target = becomeParentOf(target);
1890 this._cascadeSections.addAll(cascadeSections); 1854 this._cascadeSections.addAll(cascadeSections);
1891 } 1855 }
1892 1856
1893 accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this); 1857 accept(AstVisitor visitor) => visitor.visitCascadeExpression(this);
1894 1858
1895 Token get beginToken => _target.beginToken; 1859 Token get beginToken => _target.beginToken;
1896 1860
1897 /** 1861 /**
1898 * Return the cascade sections sharing the common target. 1862 * Return the cascade sections sharing the common target.
1899 * 1863 *
1900 * @return the cascade sections sharing the common target 1864 * @return the cascade sections sharing the common target
1901 */ 1865 */
1902 NodeList<Expression> get cascadeSections => _cascadeSections; 1866 NodeList<Expression> get cascadeSections => _cascadeSections;
1903 1867
(...skipping 10 matching lines...) Expand all
1914 1878
1915 /** 1879 /**
1916 * Set the target of the cascade sections to the given expression. 1880 * Set the target of the cascade sections to the given expression.
1917 * 1881 *
1918 * @param target the target of the cascade sections 1882 * @param target the target of the cascade sections
1919 */ 1883 */
1920 void set target(Expression target) { 1884 void set target(Expression target) {
1921 this._target = becomeParentOf(target); 1885 this._target = becomeParentOf(target);
1922 } 1886 }
1923 1887
1924 void visitChildren(ASTVisitor visitor) { 1888 void visitChildren(AstVisitor visitor) {
1925 safelyVisitChild(_target, visitor); 1889 safelyVisitChild(_target, visitor);
1926 _cascadeSections.accept(visitor); 1890 _cascadeSections.accept(visitor);
1927 } 1891 }
1928 } 1892 }
1929 1893
1930 /** 1894 /**
1931 * Instances of the class `CatchClause` represent a catch clause within a try st atement. 1895 * Instances of the class `CatchClause` represent a catch clause within a try st atement.
1932 * 1896 *
1933 * <pre> 1897 * <pre>
1934 * onPart ::= 1898 * onPart ::=
1935 * catchPart [Block] 1899 * catchPart [Block]
1936 * | 'on' type catchPart? [Block] 1900 * | 'on' type catchPart? [Block]
1937 * 1901 *
1938 * catchPart ::= 1902 * catchPart ::=
1939 * 'catch' '(' [SimpleIdentifier] (',' [SimpleIdentifier])? ')' 1903 * 'catch' '(' [SimpleIdentifier] (',' [SimpleIdentifier])? ')'
1940 * </pre> 1904 * </pre>
1941 *
1942 * @coverage dart.engine.ast
1943 */ 1905 */
1944 class CatchClause extends ASTNode { 1906 class CatchClause extends AstNode {
1945 /** 1907 /**
1946 * The token representing the 'on' keyword, or `null` if there is no 'on' keyw ord. 1908 * The token representing the 'on' keyword, or `null` if there is no 'on' keyw ord.
1947 */ 1909 */
1948 Token onKeyword; 1910 Token onKeyword;
1949 1911
1950 /** 1912 /**
1951 * The type of exceptions caught by this catch clause, or `null` if this catch clause 1913 * The type of exceptions caught by this catch clause, or `null` if this catch clause
1952 * catches every type of exception. 1914 * catches every type of exception.
1953 */ 1915 */
1954 TypeName exceptionType; 1916 TypeName exceptionType;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 */ 1967 */
2006 CatchClause(this.onKeyword, TypeName exceptionType, this.catchKeyword, Token l eftParenthesis, SimpleIdentifier exceptionParameter, this.comma, SimpleIdentifie r stackTraceParameter, Token rightParenthesis, Block body) { 1968 CatchClause(this.onKeyword, TypeName exceptionType, this.catchKeyword, Token l eftParenthesis, SimpleIdentifier exceptionParameter, this.comma, SimpleIdentifie r stackTraceParameter, Token rightParenthesis, Block body) {
2007 this.exceptionType = becomeParentOf(exceptionType); 1969 this.exceptionType = becomeParentOf(exceptionType);
2008 this._leftParenthesis = leftParenthesis; 1970 this._leftParenthesis = leftParenthesis;
2009 this._exceptionParameter = becomeParentOf(exceptionParameter); 1971 this._exceptionParameter = becomeParentOf(exceptionParameter);
2010 this._stackTraceParameter = becomeParentOf(stackTraceParameter); 1972 this._stackTraceParameter = becomeParentOf(stackTraceParameter);
2011 this._rightParenthesis = rightParenthesis; 1973 this._rightParenthesis = rightParenthesis;
2012 this._body = becomeParentOf(body); 1974 this._body = becomeParentOf(body);
2013 } 1975 }
2014 1976
2015 accept(ASTVisitor visitor) => visitor.visitCatchClause(this); 1977 accept(AstVisitor visitor) => visitor.visitCatchClause(this);
2016 1978
2017 Token get beginToken { 1979 Token get beginToken {
2018 if (onKeyword != null) { 1980 if (onKeyword != null) {
2019 return onKeyword; 1981 return onKeyword;
2020 } 1982 }
2021 return catchKeyword; 1983 return catchKeyword;
2022 } 1984 }
2023 1985
2024 /** 1986 /**
2025 * Return the body of the catch block. 1987 * Return the body of the catch block.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 * Set the parameter whose value will be the stack trace associated with the e xception to the 2061 * Set the parameter whose value will be the stack trace associated with the e xception to the
2100 * given parameter. 2062 * given parameter.
2101 * 2063 *
2102 * @param parameter the parameter whose value will be the stack trace associat ed with the 2064 * @param parameter the parameter whose value will be the stack trace associat ed with the
2103 * exception 2065 * exception
2104 */ 2066 */
2105 void set stackTraceParameter(SimpleIdentifier parameter) { 2067 void set stackTraceParameter(SimpleIdentifier parameter) {
2106 _stackTraceParameter = becomeParentOf(parameter); 2068 _stackTraceParameter = becomeParentOf(parameter);
2107 } 2069 }
2108 2070
2109 void visitChildren(ASTVisitor visitor) { 2071 void visitChildren(AstVisitor visitor) {
2110 safelyVisitChild(exceptionType, visitor); 2072 safelyVisitChild(exceptionType, visitor);
2111 safelyVisitChild(_exceptionParameter, visitor); 2073 safelyVisitChild(_exceptionParameter, visitor);
2112 safelyVisitChild(_stackTraceParameter, visitor); 2074 safelyVisitChild(_stackTraceParameter, visitor);
2113 safelyVisitChild(_body, visitor); 2075 safelyVisitChild(_body, visitor);
2114 } 2076 }
2115 } 2077 }
2116 2078
2117 /** 2079 /**
2118 * Instances of the class `ClassDeclaration` represent the declaration of a clas s. 2080 * Instances of the class `ClassDeclaration` represent the declaration of a clas s.
2119 * 2081 *
2120 * <pre> 2082 * <pre>
2121 * classDeclaration ::= 2083 * classDeclaration ::=
2122 * 'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]? 2084 * 'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]?
2123 * ([ExtendsClause] [WithClause]?)? 2085 * ([ExtendsClause] [WithClause]?)?
2124 * [ImplementsClause]? 2086 * [ImplementsClause]?
2125 * '{' [ClassMember]* '}' 2087 * '{' [ClassMember]* '}'
2126 * </pre> 2088 * </pre>
2127 *
2128 * @coverage dart.engine.ast
2129 */ 2089 */
2130 class ClassDeclaration extends CompilationUnitMember { 2090 class ClassDeclaration extends CompilationUnitMember {
2131 /** 2091 /**
2132 * The 'abstract' keyword, or `null` if the keyword was absent. 2092 * The 'abstract' keyword, or `null` if the keyword was absent.
2133 */ 2093 */
2134 Token abstractKeyword; 2094 Token abstractKeyword;
2135 2095
2136 /** 2096 /**
2137 * The token representing the 'class' keyword. 2097 * The token representing the 'class' keyword.
2138 */ 2098 */
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 ClassDeclaration(Comment comment, List<Annotation> metadata, this.abstractKeyw ord, this.classKeyword, SimpleIdentifier name, TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withClause, ImplementsClause implements Clause, this.leftBracket, List<ClassMember> members, this.rightBracket) : super( comment, metadata) { 2164 ClassDeclaration(Comment comment, List<Annotation> metadata, this.abstractKeyw ord, this.classKeyword, SimpleIdentifier name, TypeParameterList typeParameters, ExtendsClause extendsClause, WithClause withClause, ImplementsClause implements Clause, this.leftBracket, List<ClassMember> members, this.rightBracket) : super( comment, metadata) {
2205 this._members = new NodeList<ClassMember>(this); 2165 this._members = new NodeList<ClassMember>(this);
2206 this._name = becomeParentOf(name); 2166 this._name = becomeParentOf(name);
2207 this.typeParameters = becomeParentOf(typeParameters); 2167 this.typeParameters = becomeParentOf(typeParameters);
2208 this._extendsClause = becomeParentOf(extendsClause); 2168 this._extendsClause = becomeParentOf(extendsClause);
2209 this._withClause = becomeParentOf(withClause); 2169 this._withClause = becomeParentOf(withClause);
2210 this._implementsClause = becomeParentOf(implementsClause); 2170 this._implementsClause = becomeParentOf(implementsClause);
2211 this._members.addAll(members); 2171 this._members.addAll(members);
2212 } 2172 }
2213 2173
2214 accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); 2174 accept(AstVisitor visitor) => visitor.visitClassDeclaration(this);
2215 2175
2216 /** 2176 /**
2217 * Return the constructor declared in the class with the given name. 2177 * Return the constructor declared in the class with the given name.
2218 * 2178 *
2219 * @param name the name of the constructor to find, `null` for default 2179 * @param name the name of the constructor to find, `null` for default
2220 * @return the found constructor or `null` if not found 2180 * @return the found constructor or `null` if not found
2221 */ 2181 */
2222 ConstructorDeclaration getConstructor(String name) { 2182 ConstructorDeclaration getConstructor(String name) {
2223 for (ClassMember classMember in _members) { 2183 for (ClassMember classMember in _members) {
2224 if (classMember is ConstructorDeclaration) { 2184 if (classMember is ConstructorDeclaration) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 2306
2347 /** 2307 /**
2348 * Set the with clause for the class to the given clause. 2308 * Set the with clause for the class to the given clause.
2349 * 2309 *
2350 * @param withClause the with clause for the class 2310 * @param withClause the with clause for the class
2351 */ 2311 */
2352 void set withClause(WithClause withClause) { 2312 void set withClause(WithClause withClause) {
2353 this._withClause = becomeParentOf(withClause); 2313 this._withClause = becomeParentOf(withClause);
2354 } 2314 }
2355 2315
2356 void visitChildren(ASTVisitor visitor) { 2316 void visitChildren(AstVisitor visitor) {
2357 super.visitChildren(visitor); 2317 super.visitChildren(visitor);
2358 safelyVisitChild(_name, visitor); 2318 safelyVisitChild(_name, visitor);
2359 safelyVisitChild(typeParameters, visitor); 2319 safelyVisitChild(typeParameters, visitor);
2360 safelyVisitChild(_extendsClause, visitor); 2320 safelyVisitChild(_extendsClause, visitor);
2361 safelyVisitChild(_withClause, visitor); 2321 safelyVisitChild(_withClause, visitor);
2362 safelyVisitChild(_implementsClause, visitor); 2322 safelyVisitChild(_implementsClause, visitor);
2363 safelyVisitChild(nativeClause, visitor); 2323 safelyVisitChild(nativeClause, visitor);
2364 members.accept(visitor); 2324 members.accept(visitor);
2365 } 2325 }
2366 2326
2367 Token get firstTokenAfterCommentAndMetadata { 2327 Token get firstTokenAfterCommentAndMetadata {
2368 if (abstractKeyword != null) { 2328 if (abstractKeyword != null) {
2369 return abstractKeyword; 2329 return abstractKeyword;
2370 } 2330 }
2371 return classKeyword; 2331 return classKeyword;
2372 } 2332 }
2373 } 2333 }
2374 2334
2375 /** 2335 /**
2376 * The abstract class `ClassMember` defines the behavior common to nodes that de clare a name 2336 * The abstract class `ClassMember` defines the behavior common to nodes that de clare a name
2377 * within the scope of a class. 2337 * within the scope of a class.
2378 *
2379 * @coverage dart.engine.ast
2380 */ 2338 */
2381 abstract class ClassMember extends Declaration { 2339 abstract class ClassMember extends Declaration {
2382 /** 2340 /**
2383 * Initialize a newly created member of a class. 2341 * Initialize a newly created member of a class.
2384 * 2342 *
2385 * @param comment the documentation comment associated with this member 2343 * @param comment the documentation comment associated with this member
2386 * @param metadata the annotations associated with this member 2344 * @param metadata the annotations associated with this member
2387 */ 2345 */
2388 ClassMember(Comment comment, List<Annotation> metadata) : super(comment, metad ata); 2346 ClassMember(Comment comment, List<Annotation> metadata) : super(comment, metad ata);
2389 } 2347 }
2390 2348
2391 /** 2349 /**
2392 * Instances of the class `ClassTypeAlias` represent a class type alias. 2350 * Instances of the class `ClassTypeAlias` represent a class type alias.
2393 * 2351 *
2394 * <pre> 2352 * <pre>
2395 * classTypeAlias ::= 2353 * classTypeAlias ::=
2396 * [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplication 2354 * [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplication
2397 * 2355 *
2398 * mixinApplication ::= 2356 * mixinApplication ::=
2399 * [TypeName] [WithClause] [ImplementsClause]? ';' 2357 * [TypeName] [WithClause] [ImplementsClause]? ';'
2400 * </pre> 2358 * </pre>
2401 *
2402 * @coverage dart.engine.ast
2403 */ 2359 */
2404 class ClassTypeAlias extends TypeAlias { 2360 class ClassTypeAlias extends TypeAlias {
2405 /** 2361 /**
2406 * The name of the class being declared. 2362 * The name of the class being declared.
2407 */ 2363 */
2408 SimpleIdentifier _name; 2364 SimpleIdentifier _name;
2409 2365
2410 /** 2366 /**
2411 * The type parameters for the class, or `null` if the class does not have any type 2367 * The type parameters for the class, or `null` if the class does not have any type
2412 * parameters. 2368 * parameters.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2455 * @param semicolon the semicolon terminating the declaration 2411 * @param semicolon the semicolon terminating the declaration
2456 */ 2412 */
2457 ClassTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, Simp leIdentifier name, TypeParameterList typeParameters, this.equals, this.abstractK eyword, TypeName superclass, WithClause withClause, ImplementsClause implementsC lause, Token semicolon) : super(comment, metadata, keyword, semicolon) { 2413 ClassTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, Simp leIdentifier name, TypeParameterList typeParameters, this.equals, this.abstractK eyword, TypeName superclass, WithClause withClause, ImplementsClause implementsC lause, Token semicolon) : super(comment, metadata, keyword, semicolon) {
2458 this._name = becomeParentOf(name); 2414 this._name = becomeParentOf(name);
2459 this._typeParameters = becomeParentOf(typeParameters); 2415 this._typeParameters = becomeParentOf(typeParameters);
2460 this._superclass = becomeParentOf(superclass); 2416 this._superclass = becomeParentOf(superclass);
2461 this._withClause = becomeParentOf(withClause); 2417 this._withClause = becomeParentOf(withClause);
2462 this._implementsClause = becomeParentOf(implementsClause); 2418 this._implementsClause = becomeParentOf(implementsClause);
2463 } 2419 }
2464 2420
2465 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); 2421 accept(AstVisitor visitor) => visitor.visitClassTypeAlias(this);
2466 2422
2467 ClassElement get element => _name != null ? (_name.staticElement as ClassEleme nt) : null; 2423 ClassElement get element => _name != null ? (_name.staticElement as ClassEleme nt) : null;
2468 2424
2469 /** 2425 /**
2470 * Return the implements clause for this class, or `null` if there is no imple ments clause. 2426 * Return the implements clause for this class, or `null` if there is no imple ments clause.
2471 * 2427 *
2472 * @return the implements clause for this class 2428 * @return the implements clause for this class
2473 */ 2429 */
2474 ImplementsClause get implementsClause => _implementsClause; 2430 ImplementsClause get implementsClause => _implementsClause;
2475 2431
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 2496
2541 /** 2497 /**
2542 * Set the with clause for this class to the given with clause. 2498 * Set the with clause for this class to the given with clause.
2543 * 2499 *
2544 * @param withClause the with clause for this class 2500 * @param withClause the with clause for this class
2545 */ 2501 */
2546 void set withClause(WithClause withClause) { 2502 void set withClause(WithClause withClause) {
2547 this._withClause = becomeParentOf(withClause); 2503 this._withClause = becomeParentOf(withClause);
2548 } 2504 }
2549 2505
2550 void visitChildren(ASTVisitor visitor) { 2506 void visitChildren(AstVisitor visitor) {
2551 super.visitChildren(visitor); 2507 super.visitChildren(visitor);
2552 safelyVisitChild(_name, visitor); 2508 safelyVisitChild(_name, visitor);
2553 safelyVisitChild(_typeParameters, visitor); 2509 safelyVisitChild(_typeParameters, visitor);
2554 safelyVisitChild(_superclass, visitor); 2510 safelyVisitChild(_superclass, visitor);
2555 safelyVisitChild(_withClause, visitor); 2511 safelyVisitChild(_withClause, visitor);
2556 safelyVisitChild(_implementsClause, visitor); 2512 safelyVisitChild(_implementsClause, visitor);
2557 } 2513 }
2558 } 2514 }
2559 2515
2560 /** 2516 /**
2561 * Instances of the class `Combinator` represent the combinator associated with an import 2517 * Instances of the class `Combinator` represent the combinator associated with an import
2562 * directive. 2518 * directive.
2563 * 2519 *
2564 * <pre> 2520 * <pre>
2565 * combinator ::= 2521 * combinator ::=
2566 * [HideCombinator] 2522 * [HideCombinator]
2567 * | [ShowCombinator] 2523 * | [ShowCombinator]
2568 * </pre> 2524 * </pre>
2569 *
2570 * @coverage dart.engine.ast
2571 */ 2525 */
2572 abstract class Combinator extends ASTNode { 2526 abstract class Combinator extends AstNode {
2573 /** 2527 /**
2574 * The keyword specifying what kind of processing is to be done on the importe d names. 2528 * The keyword specifying what kind of processing is to be done on the importe d names.
2575 */ 2529 */
2576 Token keyword; 2530 Token keyword;
2577 2531
2578 /** 2532 /**
2579 * Initialize a newly created import combinator. 2533 * Initialize a newly created import combinator.
2580 * 2534 *
2581 * @param keyword the keyword specifying what kind of processing is to be done on the imported 2535 * @param keyword the keyword specifying what kind of processing is to be done on the imported
2582 * names 2536 * names
(...skipping 15 matching lines...) Expand all
2598 * endOfLineComment ::= 2552 * endOfLineComment ::=
2599 * '//' (CHARACTER - EOL)* EOL 2553 * '//' (CHARACTER - EOL)* EOL
2600 * 2554 *
2601 * blockComment ::= 2555 * blockComment ::=
2602 * '/ *' CHARACTER* '&#42;/' 2556 * '/ *' CHARACTER* '&#42;/'
2603 * 2557 *
2604 * documentationComment ::= 2558 * documentationComment ::=
2605 * '/ **' (CHARACTER | [CommentReference])* '&#42;/' 2559 * '/ **' (CHARACTER | [CommentReference])* '&#42;/'
2606 * | ('///' (CHARACTER - EOL)* EOL)+ 2560 * | ('///' (CHARACTER - EOL)* EOL)+
2607 * </pre> 2561 * </pre>
2608 *
2609 * @coverage dart.engine.ast
2610 */ 2562 */
2611 class Comment extends ASTNode { 2563 class Comment extends AstNode {
2612 /** 2564 /**
2613 * Create a block comment. 2565 * Create a block comment.
2614 * 2566 *
2615 * @param tokens the tokens representing the comment 2567 * @param tokens the tokens representing the comment
2616 * @return the block comment that was created 2568 * @return the block comment that was created
2617 */ 2569 */
2618 static Comment createBlockComment(List<Token> tokens) => new Comment(tokens, C ommentType.BLOCK, null); 2570 static Comment createBlockComment(List<Token> tokens) => new Comment(tokens, C ommentType.BLOCK, null);
2619 2571
2620 /** 2572 /**
2621 * Create a documentation comment. 2573 * Create a documentation comment.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 * @param tokens the tokens representing the comment 2616 * @param tokens the tokens representing the comment
2665 * @param type the type of the comment 2617 * @param type the type of the comment
2666 * @param references the references embedded within the documentation comment 2618 * @param references the references embedded within the documentation comment
2667 */ 2619 */
2668 Comment(this.tokens, CommentType type, List<CommentReference> references) { 2620 Comment(this.tokens, CommentType type, List<CommentReference> references) {
2669 this._references = new NodeList<CommentReference>(this); 2621 this._references = new NodeList<CommentReference>(this);
2670 this._type = type; 2622 this._type = type;
2671 this._references.addAll(references); 2623 this._references.addAll(references);
2672 } 2624 }
2673 2625
2674 accept(ASTVisitor visitor) => visitor.visitComment(this); 2626 accept(AstVisitor visitor) => visitor.visitComment(this);
2675 2627
2676 Token get beginToken => tokens[0]; 2628 Token get beginToken => tokens[0];
2677 2629
2678 Token get endToken => tokens[tokens.length - 1]; 2630 Token get endToken => tokens[tokens.length - 1];
2679 2631
2680 /** 2632 /**
2681 * Return the references embedded within the documentation comment. 2633 * Return the references embedded within the documentation comment.
2682 * 2634 *
2683 * @return the references embedded within the documentation comment 2635 * @return the references embedded within the documentation comment
2684 */ 2636 */
(...skipping 13 matching lines...) Expand all
2698 */ 2650 */
2699 bool get isDocumentation => identical(_type, CommentType.DOCUMENTATION); 2651 bool get isDocumentation => identical(_type, CommentType.DOCUMENTATION);
2700 2652
2701 /** 2653 /**
2702 * Return `true` if this is an end-of-line comment. 2654 * Return `true` if this is an end-of-line comment.
2703 * 2655 *
2704 * @return `true` if this is an end-of-line comment 2656 * @return `true` if this is an end-of-line comment
2705 */ 2657 */
2706 bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE); 2658 bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE);
2707 2659
2708 void visitChildren(ASTVisitor visitor) { 2660 void visitChildren(AstVisitor visitor) {
2709 _references.accept(visitor); 2661 _references.accept(visitor);
2710 } 2662 }
2711 } 2663 }
2712 2664
2713 /** 2665 /**
2714 * The enumeration `CommentType` encodes all the different types of comments tha t are 2666 * The enumeration `CommentType` encodes all the different types of comments tha t are
2715 * recognized by the parser. 2667 * recognized by the parser.
2716 */ 2668 */
2717 class CommentType extends Enum<CommentType> { 2669 class CommentType extends Enum<CommentType> {
2718 /** 2670 /**
(...skipping 17 matching lines...) Expand all
2736 } 2688 }
2737 2689
2738 /** 2690 /**
2739 * Instances of the class `CommentReference` represent a reference to a Dart ele ment that is 2691 * Instances of the class `CommentReference` represent a reference to a Dart ele ment that is
2740 * found within a documentation comment. 2692 * found within a documentation comment.
2741 * 2693 *
2742 * <pre> 2694 * <pre>
2743 * commentReference ::= 2695 * commentReference ::=
2744 * '[' 'new'? [Identifier] ']' 2696 * '[' 'new'? [Identifier] ']'
2745 * </pre> 2697 * </pre>
2746 *
2747 * @coverage dart.engine.ast
2748 */ 2698 */
2749 class CommentReference extends ASTNode { 2699 class CommentReference extends AstNode {
2750 /** 2700 /**
2751 * The token representing the 'new' keyword, or `null` if there was no 'new' k eyword. 2701 * The token representing the 'new' keyword, or `null` if there was no 'new' k eyword.
2752 */ 2702 */
2753 Token newKeyword; 2703 Token newKeyword;
2754 2704
2755 /** 2705 /**
2756 * The identifier being referenced. 2706 * The identifier being referenced.
2757 */ 2707 */
2758 Identifier _identifier; 2708 Identifier _identifier;
2759 2709
2760 /** 2710 /**
2761 * Initialize a newly created reference to a Dart element. 2711 * Initialize a newly created reference to a Dart element.
2762 * 2712 *
2763 * @param newKeyword the token representing the 'new' keyword 2713 * @param newKeyword the token representing the 'new' keyword
2764 * @param identifier the identifier being referenced 2714 * @param identifier the identifier being referenced
2765 */ 2715 */
2766 CommentReference(this.newKeyword, Identifier identifier) { 2716 CommentReference(this.newKeyword, Identifier identifier) {
2767 this._identifier = becomeParentOf(identifier); 2717 this._identifier = becomeParentOf(identifier);
2768 } 2718 }
2769 2719
2770 accept(ASTVisitor visitor) => visitor.visitCommentReference(this); 2720 accept(AstVisitor visitor) => visitor.visitCommentReference(this);
2771 2721
2772 Token get beginToken => _identifier.beginToken; 2722 Token get beginToken => _identifier.beginToken;
2773 2723
2774 Token get endToken => _identifier.endToken; 2724 Token get endToken => _identifier.endToken;
2775 2725
2776 /** 2726 /**
2777 * Return the identifier being referenced. 2727 * Return the identifier being referenced.
2778 * 2728 *
2779 * @return the identifier being referenced 2729 * @return the identifier being referenced
2780 */ 2730 */
2781 Identifier get identifier => _identifier; 2731 Identifier get identifier => _identifier;
2782 2732
2783 /** 2733 /**
2784 * Set the identifier being referenced to the given identifier. 2734 * Set the identifier being referenced to the given identifier.
2785 * 2735 *
2786 * @param identifier the identifier being referenced 2736 * @param identifier the identifier being referenced
2787 */ 2737 */
2788 void set identifier(Identifier identifier) { 2738 void set identifier(Identifier identifier) {
2789 identifier = becomeParentOf(identifier); 2739 identifier = becomeParentOf(identifier);
2790 } 2740 }
2791 2741
2792 void visitChildren(ASTVisitor visitor) { 2742 void visitChildren(AstVisitor visitor) {
2793 safelyVisitChild(_identifier, visitor); 2743 safelyVisitChild(_identifier, visitor);
2794 } 2744 }
2795 } 2745 }
2796 2746
2797 /** 2747 /**
2798 * Instances of the class `CompilationUnit` represent a compilation unit. 2748 * Instances of the class `CompilationUnit` represent a compilation unit.
2799 * 2749 *
2800 * While the grammar restricts the order of the directives and declarations with in a compilation 2750 * While the grammar restricts the order of the directives and declarations with in a compilation
2801 * unit, this class does not enforce those restrictions. In particular, the chil dren of a 2751 * unit, this class does not enforce those restrictions. In particular, the chil dren of a
2802 * compilation unit will be visited in lexical order even if lexical order does not conform to the 2752 * compilation unit will be visited in lexical order even if lexical order does not conform to the
2803 * restrictions of the grammar. 2753 * restrictions of the grammar.
2804 * 2754 *
2805 * <pre> 2755 * <pre>
2806 * compilationUnit ::= 2756 * compilationUnit ::=
2807 * directives declarations 2757 * directives declarations
2808 * 2758 *
2809 * directives ::= 2759 * directives ::=
2810 * [ScriptTag]? [LibraryDirective]? namespaceDirective* [PartDirective]* 2760 * [ScriptTag]? [LibraryDirective]? namespaceDirective* [PartDirective]*
2811 * | [PartOfDirective] 2761 * | [PartOfDirective]
2812 * 2762 *
2813 * namespaceDirective ::= 2763 * namespaceDirective ::=
2814 * [ImportDirective] 2764 * [ImportDirective]
2815 * | [ExportDirective] 2765 * | [ExportDirective]
2816 * 2766 *
2817 * declarations ::= 2767 * declarations ::=
2818 * [CompilationUnitMember]* 2768 * [CompilationUnitMember]*
2819 * </pre> 2769 * </pre>
2820 *
2821 * @coverage dart.engine.ast
2822 */ 2770 */
2823 class CompilationUnit extends ASTNode { 2771 class CompilationUnit extends AstNode {
2824 /** 2772 /**
2825 * The first token in the token stream that was parsed to form this compilatio n unit. 2773 * The first token in the token stream that was parsed to form this compilatio n unit.
2826 */ 2774 */
2827 final Token beginToken; 2775 final Token beginToken;
2828 2776
2829 /** 2777 /**
2830 * The script tag at the beginning of the compilation unit, or `null` if there is no script 2778 * The script tag at the beginning of the compilation unit, or `null` if there is no script
2831 * tag in this compilation unit. 2779 * tag in this compilation unit.
2832 */ 2780 */
2833 ScriptTag _scriptTag; 2781 ScriptTag _scriptTag;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 * @param endToken the last token in the token stream 2817 * @param endToken the last token in the token stream
2870 */ 2818 */
2871 CompilationUnit(this.beginToken, ScriptTag scriptTag, List<Directive> directiv es, List<CompilationUnitMember> declarations, this.endToken) { 2819 CompilationUnit(this.beginToken, ScriptTag scriptTag, List<Directive> directiv es, List<CompilationUnitMember> declarations, this.endToken) {
2872 this._directives = new NodeList<Directive>(this); 2820 this._directives = new NodeList<Directive>(this);
2873 this._declarations = new NodeList<CompilationUnitMember>(this); 2821 this._declarations = new NodeList<CompilationUnitMember>(this);
2874 this._scriptTag = becomeParentOf(scriptTag); 2822 this._scriptTag = becomeParentOf(scriptTag);
2875 this._directives.addAll(directives); 2823 this._directives.addAll(directives);
2876 this._declarations.addAll(declarations); 2824 this._declarations.addAll(declarations);
2877 } 2825 }
2878 2826
2879 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); 2827 accept(AstVisitor visitor) => visitor.visitCompilationUnit(this);
2880 2828
2881 /** 2829 /**
2882 * Return the declarations contained in this compilation unit. 2830 * Return the declarations contained in this compilation unit.
2883 * 2831 *
2884 * @return the declarations contained in this compilation unit 2832 * @return the declarations contained in this compilation unit
2885 */ 2833 */
2886 NodeList<CompilationUnitMember> get declarations => _declarations; 2834 NodeList<CompilationUnitMember> get declarations => _declarations;
2887 2835
2888 /** 2836 /**
2889 * Return the directives contained in this compilation unit. 2837 * Return the directives contained in this compilation unit.
(...skipping 22 matching lines...) Expand all
2912 2860
2913 /** 2861 /**
2914 * Set the script tag at the beginning of the compilation unit to the given sc ript tag. 2862 * Set the script tag at the beginning of the compilation unit to the given sc ript tag.
2915 * 2863 *
2916 * @param scriptTag the script tag at the beginning of the compilation unit 2864 * @param scriptTag the script tag at the beginning of the compilation unit
2917 */ 2865 */
2918 void set scriptTag(ScriptTag scriptTag) { 2866 void set scriptTag(ScriptTag scriptTag) {
2919 this._scriptTag = becomeParentOf(scriptTag); 2867 this._scriptTag = becomeParentOf(scriptTag);
2920 } 2868 }
2921 2869
2922 void visitChildren(ASTVisitor visitor) { 2870 void visitChildren(AstVisitor visitor) {
2923 safelyVisitChild(_scriptTag, visitor); 2871 safelyVisitChild(_scriptTag, visitor);
2924 if (directivesAreBeforeDeclarations()) { 2872 if (directivesAreBeforeDeclarations()) {
2925 _directives.accept(visitor); 2873 _directives.accept(visitor);
2926 _declarations.accept(visitor); 2874 _declarations.accept(visitor);
2927 } else { 2875 } else {
2928 for (ASTNode child in sortedDirectivesAndDeclarations) { 2876 for (AstNode child in sortedDirectivesAndDeclarations) {
2929 child.accept(visitor); 2877 child.accept(visitor);
2930 } 2878 }
2931 } 2879 }
2932 } 2880 }
2933 2881
2934 /** 2882 /**
2935 * Return `true` if all of the directives are lexically before any declaration s. 2883 * Return `true` if all of the directives are lexically before any declaration s.
2936 * 2884 *
2937 * @return `true` if all of the directives are lexically before any declaratio ns 2885 * @return `true` if all of the directives are lexically before any declaratio ns
2938 */ 2886 */
2939 bool directivesAreBeforeDeclarations() { 2887 bool directivesAreBeforeDeclarations() {
2940 if (_directives.isEmpty || _declarations.isEmpty) { 2888 if (_directives.isEmpty || _declarations.isEmpty) {
2941 return true; 2889 return true;
2942 } 2890 }
2943 Directive lastDirective = _directives[_directives.length - 1]; 2891 Directive lastDirective = _directives[_directives.length - 1];
2944 CompilationUnitMember firstDeclaration = _declarations[0]; 2892 CompilationUnitMember firstDeclaration = _declarations[0];
2945 return lastDirective.offset < firstDeclaration.offset; 2893 return lastDirective.offset < firstDeclaration.offset;
2946 } 2894 }
2947 2895
2948 /** 2896 /**
2949 * Return an array containing all of the directives and declarations in this c ompilation unit, 2897 * Return an array containing all of the directives and declarations in this c ompilation unit,
2950 * sorted in lexical order. 2898 * sorted in lexical order.
2951 * 2899 *
2952 * @return the directives and declarations in this compilation unit in the ord er in which they 2900 * @return the directives and declarations in this compilation unit in the ord er in which they
2953 * appeared in the original source 2901 * appeared in the original source
2954 */ 2902 */
2955 List<ASTNode> get sortedDirectivesAndDeclarations { 2903 List<AstNode> get sortedDirectivesAndDeclarations {
2956 List<ASTNode> childList = new List<ASTNode>(); 2904 List<AstNode> childList = new List<AstNode>();
2957 childList.addAll(_directives); 2905 childList.addAll(_directives);
2958 childList.addAll(_declarations); 2906 childList.addAll(_declarations);
2959 List<ASTNode> children = new List.from(childList); 2907 List<AstNode> children = new List.from(childList);
2960 children.sort(ASTNode.LEXICAL_ORDER); 2908 children.sort(AstNode.LEXICAL_ORDER);
2961 return children; 2909 return children;
2962 } 2910 }
2963 } 2911 }
2964 2912
2965 /** 2913 /**
2966 * Instances of the class `CompilationUnitMember` defines the behavior common to nodes that 2914 * Instances of the class `CompilationUnitMember` defines the behavior common to nodes that
2967 * declare a name within the scope of a compilation unit. 2915 * declare a name within the scope of a compilation unit.
2968 * 2916 *
2969 * <pre> 2917 * <pre>
2970 * compilationUnitMember ::= 2918 * compilationUnitMember ::=
2971 * [ClassDeclaration] 2919 * [ClassDeclaration]
2972 * | [TypeAlias] 2920 * | [TypeAlias]
2973 * | [FunctionDeclaration] 2921 * | [FunctionDeclaration]
2974 * | [MethodDeclaration] 2922 * | [MethodDeclaration]
2975 * | [VariableDeclaration] 2923 * | [VariableDeclaration]
2976 * | [VariableDeclaration] 2924 * | [VariableDeclaration]
2977 * </pre> 2925 * </pre>
2978 *
2979 * @coverage dart.engine.ast
2980 */ 2926 */
2981 abstract class CompilationUnitMember extends Declaration { 2927 abstract class CompilationUnitMember extends Declaration {
2982 /** 2928 /**
2983 * Initialize a newly created generic compilation unit member. 2929 * Initialize a newly created generic compilation unit member.
2984 * 2930 *
2985 * @param comment the documentation comment associated with this member 2931 * @param comment the documentation comment associated with this member
2986 * @param metadata the annotations associated with this member 2932 * @param metadata the annotations associated with this member
2987 */ 2933 */
2988 CompilationUnitMember(Comment comment, List<Annotation> metadata) : super(comm ent, metadata); 2934 CompilationUnitMember(Comment comment, List<Annotation> metadata) : super(comm ent, metadata);
2989 } 2935 }
2990 2936
2991 /** 2937 /**
2992 * Instances of the class `ConditionalExpression` represent a conditional expres sion. 2938 * Instances of the class `ConditionalExpression` represent a conditional expres sion.
2993 * 2939 *
2994 * <pre> 2940 * <pre>
2995 * conditionalExpression ::= 2941 * conditionalExpression ::=
2996 * [Expression] '?' [Expression] ':' [Expression] 2942 * [Expression] '?' [Expression] ':' [Expression]
2997 * </pre> 2943 * </pre>
2998 *
2999 * @coverage dart.engine.ast
3000 */ 2944 */
3001 class ConditionalExpression extends Expression { 2945 class ConditionalExpression extends Expression {
3002 /** 2946 /**
3003 * The condition used to determine which of the expressions is executed next. 2947 * The condition used to determine which of the expressions is executed next.
3004 */ 2948 */
3005 Expression _condition; 2949 Expression _condition;
3006 2950
3007 /** 2951 /**
3008 * The token used to separate the condition from the then expression. 2952 * The token used to separate the condition from the then expression.
3009 */ 2953 */
(...skipping 24 matching lines...) Expand all
3034 * @param colon the token used to separate the then expression from the else e xpression 2978 * @param colon the token used to separate the then expression from the else e xpression
3035 * @param elseExpression the expression that is executed if the condition eval uates to 2979 * @param elseExpression the expression that is executed if the condition eval uates to
3036 * `false` 2980 * `false`
3037 */ 2981 */
3038 ConditionalExpression(Expression condition, this.question, Expression thenExpr ession, this.colon, Expression elseExpression) { 2982 ConditionalExpression(Expression condition, this.question, Expression thenExpr ession, this.colon, Expression elseExpression) {
3039 this._condition = becomeParentOf(condition); 2983 this._condition = becomeParentOf(condition);
3040 this._thenExpression = becomeParentOf(thenExpression); 2984 this._thenExpression = becomeParentOf(thenExpression);
3041 this._elseExpression = becomeParentOf(elseExpression); 2985 this._elseExpression = becomeParentOf(elseExpression);
3042 } 2986 }
3043 2987
3044 accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this); 2988 accept(AstVisitor visitor) => visitor.visitConditionalExpression(this);
3045 2989
3046 Token get beginToken => _condition.beginToken; 2990 Token get beginToken => _condition.beginToken;
3047 2991
3048 /** 2992 /**
3049 * Return the condition used to determine which of the expressions is executed next. 2993 * Return the condition used to determine which of the expressions is executed next.
3050 * 2994 *
3051 * @return the condition used to determine which expression is executed next 2995 * @return the condition used to determine which expression is executed next
3052 */ 2996 */
3053 Expression get condition => _condition; 2997 Expression get condition => _condition;
3054 2998
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3093 /** 3037 /**
3094 * Set the expression that is executed if the condition evaluates to `true` to the given 3038 * Set the expression that is executed if the condition evaluates to `true` to the given
3095 * expression. 3039 * expression.
3096 * 3040 *
3097 * @param expression the expression that is executed if the condition evaluate s to `true` 3041 * @param expression the expression that is executed if the condition evaluate s to `true`
3098 */ 3042 */
3099 void set thenExpression(Expression expression) { 3043 void set thenExpression(Expression expression) {
3100 _thenExpression = becomeParentOf(expression); 3044 _thenExpression = becomeParentOf(expression);
3101 } 3045 }
3102 3046
3103 void visitChildren(ASTVisitor visitor) { 3047 void visitChildren(AstVisitor visitor) {
3104 safelyVisitChild(_condition, visitor); 3048 safelyVisitChild(_condition, visitor);
3105 safelyVisitChild(_thenExpression, visitor); 3049 safelyVisitChild(_thenExpression, visitor);
3106 safelyVisitChild(_elseExpression, visitor); 3050 safelyVisitChild(_elseExpression, visitor);
3107 } 3051 }
3108 } 3052 }
3109 3053
3110 /** 3054 /**
3111 * Instances of the class `ConstructorDeclaration` represent a constructor decla ration. 3055 * Instances of the class `ConstructorDeclaration` represent a constructor decla ration.
3112 * 3056 *
3113 * <pre> 3057 * <pre>
3114 * constructorDeclaration ::= 3058 * constructorDeclaration ::=
3115 * constructorSignature [FunctionBody]? 3059 * constructorSignature [FunctionBody]?
3116 * | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])? arguments 3060 * | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])? arguments
3117 * 3061 *
3118 * constructorSignature ::= 3062 * constructorSignature ::=
3119 * 'external'? constructorName formalParameterList initializerList? 3063 * 'external'? constructorName formalParameterList initializerList?
3120 * | 'external'? 'factory' factoryName formalParameterList initializerList? 3064 * | 'external'? 'factory' factoryName formalParameterList initializerList?
3121 * | 'external'? 'const' constructorName formalParameterList initializerList? 3065 * | 'external'? 'const' constructorName formalParameterList initializerList?
3122 * 3066 *
3123 * constructorName ::= 3067 * constructorName ::=
3124 * [SimpleIdentifier] ('.' [SimpleIdentifier])? 3068 * [SimpleIdentifier] ('.' [SimpleIdentifier])?
3125 * 3069 *
3126 * factoryName ::= 3070 * factoryName ::=
3127 * [Identifier] ('.' [SimpleIdentifier])? 3071 * [Identifier] ('.' [SimpleIdentifier])?
3128 * 3072 *
3129 * initializerList ::= 3073 * initializerList ::=
3130 * ':' [ConstructorInitializer] (',' [ConstructorInitializer])* 3074 * ':' [ConstructorInitializer] (',' [ConstructorInitializer])*
3131 * </pre> 3075 * </pre>
3132 *
3133 * @coverage dart.engine.ast
3134 */ 3076 */
3135 class ConstructorDeclaration extends ClassMember { 3077 class ConstructorDeclaration extends ClassMember {
3136 /** 3078 /**
3137 * The token for the 'external' keyword, or `null` if the constructor is not e xternal. 3079 * The token for the 'external' keyword, or `null` if the constructor is not e xternal.
3138 */ 3080 */
3139 Token externalKeyword; 3081 Token externalKeyword;
3140 3082
3141 /** 3083 /**
3142 * The token for the 'const' keyword, or `null` if the constructor is not a co nst 3084 * The token for the 'const' keyword, or `null` if the constructor is not a co nst
3143 * constructor. 3085 * constructor.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 ConstructorDeclaration(Comment comment, List<Annotation> metadata, this.extern alKeyword, this.constKeyword, this.factoryKeyword, Identifier returnType, this.p eriod, SimpleIdentifier name, FormalParameterList parameters, this.separator, Li st<ConstructorInitializer> initializers, ConstructorName redirectedConstructor, FunctionBody body) : super(comment, metadata) { 3163 ConstructorDeclaration(Comment comment, List<Annotation> metadata, this.extern alKeyword, this.constKeyword, this.factoryKeyword, Identifier returnType, this.p eriod, SimpleIdentifier name, FormalParameterList parameters, this.separator, Li st<ConstructorInitializer> initializers, ConstructorName redirectedConstructor, FunctionBody body) : super(comment, metadata) {
3222 this._initializers = new NodeList<ConstructorInitializer>(this); 3164 this._initializers = new NodeList<ConstructorInitializer>(this);
3223 this._returnType = becomeParentOf(returnType); 3165 this._returnType = becomeParentOf(returnType);
3224 this._name = becomeParentOf(name); 3166 this._name = becomeParentOf(name);
3225 this._parameters = becomeParentOf(parameters); 3167 this._parameters = becomeParentOf(parameters);
3226 this._initializers.addAll(initializers); 3168 this._initializers.addAll(initializers);
3227 this._redirectedConstructor = becomeParentOf(redirectedConstructor); 3169 this._redirectedConstructor = becomeParentOf(redirectedConstructor);
3228 this._body = becomeParentOf(body); 3170 this._body = becomeParentOf(body);
3229 } 3171 }
3230 3172
3231 accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this); 3173 accept(AstVisitor visitor) => visitor.visitConstructorDeclaration(this);
3232 3174
3233 /** 3175 /**
3234 * Return the body of the constructor, or `null` if the constructor does not h ave a body. 3176 * Return the body of the constructor, or `null` if the constructor does not h ave a body.
3235 * 3177 *
3236 * @return the body of the constructor 3178 * @return the body of the constructor
3237 */ 3179 */
3238 FunctionBody get body => _body; 3180 FunctionBody get body => _body;
3239 3181
3240 Token get endToken { 3182 Token get endToken {
3241 if (_body != null) { 3183 if (_body != null) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 3267
3326 /** 3268 /**
3327 * Set the type of object being created to the given type name. 3269 * Set the type of object being created to the given type name.
3328 * 3270 *
3329 * @param typeName the type of object being created 3271 * @param typeName the type of object being created
3330 */ 3272 */
3331 void set returnType(Identifier typeName) { 3273 void set returnType(Identifier typeName) {
3332 _returnType = becomeParentOf(typeName); 3274 _returnType = becomeParentOf(typeName);
3333 } 3275 }
3334 3276
3335 void visitChildren(ASTVisitor visitor) { 3277 void visitChildren(AstVisitor visitor) {
3336 super.visitChildren(visitor); 3278 super.visitChildren(visitor);
3337 safelyVisitChild(_returnType, visitor); 3279 safelyVisitChild(_returnType, visitor);
3338 safelyVisitChild(_name, visitor); 3280 safelyVisitChild(_name, visitor);
3339 safelyVisitChild(_parameters, visitor); 3281 safelyVisitChild(_parameters, visitor);
3340 _initializers.accept(visitor); 3282 _initializers.accept(visitor);
3341 safelyVisitChild(_redirectedConstructor, visitor); 3283 safelyVisitChild(_redirectedConstructor, visitor);
3342 safelyVisitChild(_body, visitor); 3284 safelyVisitChild(_body, visitor);
3343 } 3285 }
3344 3286
3345 Token get firstTokenAfterCommentAndMetadata { 3287 Token get firstTokenAfterCommentAndMetadata {
(...skipping 24 matching lines...) Expand all
3370 } 3312 }
3371 3313
3372 /** 3314 /**
3373 * Instances of the class `ConstructorFieldInitializer` represent the initializa tion of a 3315 * Instances of the class `ConstructorFieldInitializer` represent the initializa tion of a
3374 * field within a constructor's initialization list. 3316 * field within a constructor's initialization list.
3375 * 3317 *
3376 * <pre> 3318 * <pre>
3377 * fieldInitializer ::= 3319 * fieldInitializer ::=
3378 * ('this' '.')? [SimpleIdentifier] '=' [Expression] 3320 * ('this' '.')? [SimpleIdentifier] '=' [Expression]
3379 * </pre> 3321 * </pre>
3380 *
3381 * @coverage dart.engine.ast
3382 */ 3322 */
3383 class ConstructorFieldInitializer extends ConstructorInitializer { 3323 class ConstructorFieldInitializer extends ConstructorInitializer {
3384 /** 3324 /**
3385 * The token for the 'this' keyword, or `null` if there is no 'this' keyword. 3325 * The token for the 'this' keyword, or `null` if there is no 'this' keyword.
3386 */ 3326 */
3387 Token keyword; 3327 Token keyword;
3388 3328
3389 /** 3329 /**
3390 * The token for the period after the 'this' keyword, or `null` if there is no 'this' 3330 * The token for the period after the 'this' keyword, or `null` if there is no 'this'
3391 * keyword. 3331 * keyword.
(...skipping 23 matching lines...) Expand all
3415 * @param period the token for the period after the 'this' keyword 3355 * @param period the token for the period after the 'this' keyword
3416 * @param fieldName the name of the field being initialized 3356 * @param fieldName the name of the field being initialized
3417 * @param equals the token for the equal sign between the field name and the e xpression 3357 * @param equals the token for the equal sign between the field name and the e xpression
3418 * @param expression the expression computing the value to which the field wil l be initialized 3358 * @param expression the expression computing the value to which the field wil l be initialized
3419 */ 3359 */
3420 ConstructorFieldInitializer(this.keyword, this.period, SimpleIdentifier fieldN ame, this.equals, Expression expression) { 3360 ConstructorFieldInitializer(this.keyword, this.period, SimpleIdentifier fieldN ame, this.equals, Expression expression) {
3421 this._fieldName = becomeParentOf(fieldName); 3361 this._fieldName = becomeParentOf(fieldName);
3422 this._expression = becomeParentOf(expression); 3362 this._expression = becomeParentOf(expression);
3423 } 3363 }
3424 3364
3425 accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this); 3365 accept(AstVisitor visitor) => visitor.visitConstructorFieldInitializer(this);
3426 3366
3427 Token get beginToken { 3367 Token get beginToken {
3428 if (keyword != null) { 3368 if (keyword != null) {
3429 return keyword; 3369 return keyword;
3430 } 3370 }
3431 return _fieldName.beginToken; 3371 return _fieldName.beginToken;
3432 } 3372 }
3433 3373
3434 Token get endToken => _expression.endToken; 3374 Token get endToken => _expression.endToken;
3435 3375
(...skipping 23 matching lines...) Expand all
3459 3399
3460 /** 3400 /**
3461 * Set the name of the field being initialized to the given identifier. 3401 * Set the name of the field being initialized to the given identifier.
3462 * 3402 *
3463 * @param identifier the name of the field being initialized 3403 * @param identifier the name of the field being initialized
3464 */ 3404 */
3465 void set fieldName(SimpleIdentifier identifier) { 3405 void set fieldName(SimpleIdentifier identifier) {
3466 _fieldName = becomeParentOf(identifier); 3406 _fieldName = becomeParentOf(identifier);
3467 } 3407 }
3468 3408
3469 void visitChildren(ASTVisitor visitor) { 3409 void visitChildren(AstVisitor visitor) {
3470 safelyVisitChild(_fieldName, visitor); 3410 safelyVisitChild(_fieldName, visitor);
3471 safelyVisitChild(_expression, visitor); 3411 safelyVisitChild(_expression, visitor);
3472 } 3412 }
3473 } 3413 }
3474 3414
3475 /** 3415 /**
3476 * Instances of the class `ConstructorInitializer` defines the behavior of nodes that can 3416 * Instances of the class `ConstructorInitializer` defines the behavior of nodes that can
3477 * occur in the initializer list of a constructor declaration. 3417 * occur in the initializer list of a constructor declaration.
3478 * 3418 *
3479 * <pre> 3419 * <pre>
3480 * constructorInitializer ::= 3420 * constructorInitializer ::=
3481 * [SuperConstructorInvocation] 3421 * [SuperConstructorInvocation]
3482 * | [ConstructorFieldInitializer] 3422 * | [ConstructorFieldInitializer]
3483 * </pre> 3423 * </pre>
3484 *
3485 * @coverage dart.engine.ast
3486 */ 3424 */
3487 abstract class ConstructorInitializer extends ASTNode { 3425 abstract class ConstructorInitializer extends AstNode {
3488 } 3426 }
3489 3427
3490 /** 3428 /**
3491 * Instances of the class `ConstructorName` represent the name of the constructo r. 3429 * Instances of the class `ConstructorName` represent the name of the constructo r.
3492 * 3430 *
3493 * <pre> 3431 * <pre>
3494 * constructorName: 3432 * constructorName:
3495 * type ('.' identifier)? 3433 * type ('.' identifier)?
3496 * </pre> 3434 * </pre>
3497 *
3498 * @coverage dart.engine.ast
3499 */ 3435 */
3500 class ConstructorName extends ASTNode { 3436 class ConstructorName extends AstNode {
3501 /** 3437 /**
3502 * The name of the type defining the constructor. 3438 * The name of the type defining the constructor.
3503 */ 3439 */
3504 TypeName _type; 3440 TypeName _type;
3505 3441
3506 /** 3442 /**
3507 * The token for the period before the constructor name, or `null` if the spec ified 3443 * The token for the period before the constructor name, or `null` if the spec ified
3508 * constructor is the unnamed constructor. 3444 * constructor is the unnamed constructor.
3509 */ 3445 */
3510 Token period; 3446 Token period;
(...skipping 16 matching lines...) Expand all
3527 * 3463 *
3528 * @param type the name of the type defining the constructor 3464 * @param type the name of the type defining the constructor
3529 * @param period the token for the period before the constructor name 3465 * @param period the token for the period before the constructor name
3530 * @param name the name of the constructor 3466 * @param name the name of the constructor
3531 */ 3467 */
3532 ConstructorName(TypeName type, this.period, SimpleIdentifier name) { 3468 ConstructorName(TypeName type, this.period, SimpleIdentifier name) {
3533 this._type = becomeParentOf(type); 3469 this._type = becomeParentOf(type);
3534 this._name = becomeParentOf(name); 3470 this._name = becomeParentOf(name);
3535 } 3471 }
3536 3472
3537 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); 3473 accept(AstVisitor visitor) => visitor.visitConstructorName(this);
3538 3474
3539 Token get beginToken => _type.beginToken; 3475 Token get beginToken => _type.beginToken;
3540 3476
3541 Token get endToken { 3477 Token get endToken {
3542 if (_name != null) { 3478 if (_name != null) {
3543 return _name.endToken; 3479 return _name.endToken;
3544 } 3480 }
3545 return _type.endToken; 3481 return _type.endToken;
3546 } 3482 }
3547 3483
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3590 3526
3591 /** 3527 /**
3592 * Set the name of the type defining the constructor to the given type name. 3528 * Set the name of the type defining the constructor to the given type name.
3593 * 3529 *
3594 * @param type the name of the type defining the constructor 3530 * @param type the name of the type defining the constructor
3595 */ 3531 */
3596 void set type(TypeName type) { 3532 void set type(TypeName type) {
3597 this._type = becomeParentOf(type); 3533 this._type = becomeParentOf(type);
3598 } 3534 }
3599 3535
3600 void visitChildren(ASTVisitor visitor) { 3536 void visitChildren(AstVisitor visitor) {
3601 safelyVisitChild(_type, visitor); 3537 safelyVisitChild(_type, visitor);
3602 safelyVisitChild(_name, visitor); 3538 safelyVisitChild(_name, visitor);
3603 } 3539 }
3604 } 3540 }
3605 3541
3606 /** 3542 /**
3607 * Instances of the class `ContinueStatement` represent a continue statement. 3543 * Instances of the class `ContinueStatement` represent a continue statement.
3608 * 3544 *
3609 * <pre> 3545 * <pre>
3610 * continueStatement ::= 3546 * continueStatement ::=
3611 * 'continue' [SimpleIdentifier]? ';' 3547 * 'continue' [SimpleIdentifier]? ';'
3612 * </pre> 3548 * </pre>
3613 *
3614 * @coverage dart.engine.ast
3615 */ 3549 */
3616 class ContinueStatement extends Statement { 3550 class ContinueStatement extends Statement {
3617 /** 3551 /**
3618 * The token representing the 'continue' keyword. 3552 * The token representing the 'continue' keyword.
3619 */ 3553 */
3620 Token keyword; 3554 Token keyword;
3621 3555
3622 /** 3556 /**
3623 * The label associated with the statement, or `null` if there is no label. 3557 * The label associated with the statement, or `null` if there is no label.
3624 */ 3558 */
3625 SimpleIdentifier _label; 3559 SimpleIdentifier _label;
3626 3560
3627 /** 3561 /**
3628 * The semicolon terminating the statement. 3562 * The semicolon terminating the statement.
3629 */ 3563 */
3630 Token semicolon; 3564 Token semicolon;
3631 3565
3632 /** 3566 /**
3633 * Initialize a newly created continue statement. 3567 * Initialize a newly created continue statement.
3634 * 3568 *
3635 * @param keyword the token representing the 'continue' keyword 3569 * @param keyword the token representing the 'continue' keyword
3636 * @param label the label associated with the statement 3570 * @param label the label associated with the statement
3637 * @param semicolon the semicolon terminating the statement 3571 * @param semicolon the semicolon terminating the statement
3638 */ 3572 */
3639 ContinueStatement(this.keyword, SimpleIdentifier label, this.semicolon) { 3573 ContinueStatement(this.keyword, SimpleIdentifier label, this.semicolon) {
3640 this._label = becomeParentOf(label); 3574 this._label = becomeParentOf(label);
3641 } 3575 }
3642 3576
3643 accept(ASTVisitor visitor) => visitor.visitContinueStatement(this); 3577 accept(AstVisitor visitor) => visitor.visitContinueStatement(this);
3644 3578
3645 Token get beginToken => keyword; 3579 Token get beginToken => keyword;
3646 3580
3647 Token get endToken => semicolon; 3581 Token get endToken => semicolon;
3648 3582
3649 /** 3583 /**
3650 * Return the label associated with the statement, or `null` if there is no la bel. 3584 * Return the label associated with the statement, or `null` if there is no la bel.
3651 * 3585 *
3652 * @return the label associated with the statement 3586 * @return the label associated with the statement
3653 */ 3587 */
3654 SimpleIdentifier get label => _label; 3588 SimpleIdentifier get label => _label;
3655 3589
3656 /** 3590 /**
3657 * Set the label associated with the statement to the given label. 3591 * Set the label associated with the statement to the given label.
3658 * 3592 *
3659 * @param identifier the label associated with the statement 3593 * @param identifier the label associated with the statement
3660 */ 3594 */
3661 void set label(SimpleIdentifier identifier) { 3595 void set label(SimpleIdentifier identifier) {
3662 _label = becomeParentOf(identifier); 3596 _label = becomeParentOf(identifier);
3663 } 3597 }
3664 3598
3665 void visitChildren(ASTVisitor visitor) { 3599 void visitChildren(AstVisitor visitor) {
3666 safelyVisitChild(_label, visitor); 3600 safelyVisitChild(_label, visitor);
3667 } 3601 }
3668 } 3602 }
3669 3603
3670 /** 3604 /**
3671 * The abstract class `Declaration` defines the behavior common to nodes that re present the 3605 * The abstract class `Declaration` defines the behavior common to nodes that re present the
3672 * declaration of a name. Each declared name is visible within a name scope. 3606 * declaration of a name. Each declared name is visible within a name scope.
3673 *
3674 * @coverage dart.engine.ast
3675 */ 3607 */
3676 abstract class Declaration extends AnnotatedNode { 3608 abstract class Declaration extends AnnotatedNode {
3677 /** 3609 /**
3678 * Initialize a newly created declaration. 3610 * Initialize a newly created declaration.
3679 * 3611 *
3680 * @param comment the documentation comment associated with this declaration 3612 * @param comment the documentation comment associated with this declaration
3681 * @param metadata the annotations associated with this declaration 3613 * @param metadata the annotations associated with this declaration
3682 */ 3614 */
3683 Declaration(Comment comment, List<Annotation> metadata) : super(comment, metad ata); 3615 Declaration(Comment comment, List<Annotation> metadata) : super(comment, metad ata);
3684 3616
3685 /** 3617 /**
3686 * Return the element associated with this declaration, or `null` if either th is node 3618 * Return the element associated with this declaration, or `null` if either th is node
3687 * corresponds to a list of declarations or if the AST structure has not been resolved. 3619 * corresponds to a list of declarations or if the AST structure has not been resolved.
3688 * 3620 *
3689 * @return the element associated with this declaration 3621 * @return the element associated with this declaration
3690 */ 3622 */
3691 Element get element; 3623 Element get element;
3692 } 3624 }
3693 3625
3694 /** 3626 /**
3695 * Instances of the class `DeclaredIdentifier` represent the declaration of a si ngle 3627 * Instances of the class `DeclaredIdentifier` represent the declaration of a si ngle
3696 * identifier. 3628 * identifier.
3697 * 3629 *
3698 * <pre> 3630 * <pre>
3699 * declaredIdentifier ::= 3631 * declaredIdentifier ::=
3700 * ([Annotation] finalConstVarOrType [SimpleIdentifier] 3632 * ([Annotation] finalConstVarOrType [SimpleIdentifier]
3701 * </pre> 3633 * </pre>
3702 *
3703 * @coverage dart.engine.ast
3704 */ 3634 */
3705 class DeclaredIdentifier extends Declaration { 3635 class DeclaredIdentifier extends Declaration {
3706 /** 3636 /**
3707 * The token representing either the 'final', 'const' or 'var' keyword, or `nu ll` if no 3637 * The token representing either the 'final', 'const' or 'var' keyword, or `nu ll` if no
3708 * keyword was used. 3638 * keyword was used.
3709 */ 3639 */
3710 Token keyword; 3640 Token keyword;
3711 3641
3712 /** 3642 /**
3713 * The name of the declared type of the parameter, or `null` if the parameter does not have 3643 * The name of the declared type of the parameter, or `null` if the parameter does not have
(...skipping 13 matching lines...) Expand all
3727 * @param metadata the annotations associated with this parameter 3657 * @param metadata the annotations associated with this parameter
3728 * @param keyword the token representing either the 'final', 'const' or 'var' keyword 3658 * @param keyword the token representing either the 'final', 'const' or 'var' keyword
3729 * @param type the name of the declared type of the parameter 3659 * @param type the name of the declared type of the parameter
3730 * @param identifier the name of the parameter being declared 3660 * @param identifier the name of the parameter being declared
3731 */ 3661 */
3732 DeclaredIdentifier(Comment comment, List<Annotation> metadata, this.keyword, T ypeName type, SimpleIdentifier identifier) : super(comment, metadata) { 3662 DeclaredIdentifier(Comment comment, List<Annotation> metadata, this.keyword, T ypeName type, SimpleIdentifier identifier) : super(comment, metadata) {
3733 this._type = becomeParentOf(type); 3663 this._type = becomeParentOf(type);
3734 this._identifier = becomeParentOf(identifier); 3664 this._identifier = becomeParentOf(identifier);
3735 } 3665 }
3736 3666
3737 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); 3667 accept(AstVisitor visitor) => visitor.visitDeclaredIdentifier(this);
3738 3668
3739 LocalVariableElement get element { 3669 LocalVariableElement get element {
3740 SimpleIdentifier identifier = this.identifier; 3670 SimpleIdentifier identifier = this.identifier;
3741 if (identifier == null) { 3671 if (identifier == null) {
3742 return null; 3672 return null;
3743 } 3673 }
3744 return identifier.staticElement as LocalVariableElement; 3674 return identifier.staticElement as LocalVariableElement;
3745 } 3675 }
3746 3676
3747 Token get endToken => _identifier.endToken; 3677 Token get endToken => _identifier.endToken;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3779 3709
3780 /** 3710 /**
3781 * Set the name of the declared type of the parameter to the given type name. 3711 * Set the name of the declared type of the parameter to the given type name.
3782 * 3712 *
3783 * @param typeName the name of the declared type of the parameter 3713 * @param typeName the name of the declared type of the parameter
3784 */ 3714 */
3785 void set type(TypeName typeName) { 3715 void set type(TypeName typeName) {
3786 _type = becomeParentOf(typeName); 3716 _type = becomeParentOf(typeName);
3787 } 3717 }
3788 3718
3789 void visitChildren(ASTVisitor visitor) { 3719 void visitChildren(AstVisitor visitor) {
3790 super.visitChildren(visitor); 3720 super.visitChildren(visitor);
3791 safelyVisitChild(_type, visitor); 3721 safelyVisitChild(_type, visitor);
3792 safelyVisitChild(_identifier, visitor); 3722 safelyVisitChild(_identifier, visitor);
3793 } 3723 }
3794 3724
3795 Token get firstTokenAfterCommentAndMetadata { 3725 Token get firstTokenAfterCommentAndMetadata {
3796 if (keyword != null) { 3726 if (keyword != null) {
3797 return keyword; 3727 return keyword;
3798 } else if (_type != null) { 3728 } else if (_type != null) {
3799 return _type.beginToken; 3729 return _type.beginToken;
3800 } 3730 }
3801 return _identifier.beginToken; 3731 return _identifier.beginToken;
3802 } 3732 }
3803 } 3733 }
3804 3734
3805 /** 3735 /**
3806 * Instances of the class `DefaultFormalParameter` represent a formal parameter with a default 3736 * Instances of the class `DefaultFormalParameter` represent a formal parameter with a default
3807 * value. There are two kinds of parameters that are both represented by this cl ass: named formal 3737 * value. There are two kinds of parameters that are both represented by this cl ass: named formal
3808 * parameters and positional formal parameters. 3738 * parameters and positional formal parameters.
3809 * 3739 *
3810 * <pre> 3740 * <pre>
3811 * defaultFormalParameter ::= 3741 * defaultFormalParameter ::=
3812 * [NormalFormalParameter] ('=' [Expression])? 3742 * [NormalFormalParameter] ('=' [Expression])?
3813 * 3743 *
3814 * defaultNamedParameter ::= 3744 * defaultNamedParameter ::=
3815 * [NormalFormalParameter] (':' [Expression])? 3745 * [NormalFormalParameter] (':' [Expression])?
3816 * </pre> 3746 * </pre>
3817 *
3818 * @coverage dart.engine.ast
3819 */ 3747 */
3820 class DefaultFormalParameter extends FormalParameter { 3748 class DefaultFormalParameter extends FormalParameter {
3821 /** 3749 /**
3822 * The formal parameter with which the default value is associated. 3750 * The formal parameter with which the default value is associated.
3823 */ 3751 */
3824 NormalFormalParameter _parameter; 3752 NormalFormalParameter _parameter;
3825 3753
3826 /** 3754 /**
3827 * The kind of this parameter. 3755 * The kind of this parameter.
3828 */ 3756 */
(...skipping 17 matching lines...) Expand all
3846 * @param parameter the formal parameter with which the default value is assoc iated 3774 * @param parameter the formal parameter with which the default value is assoc iated
3847 * @param kind the kind of this parameter 3775 * @param kind the kind of this parameter
3848 * @param separator the token separating the parameter from the default value 3776 * @param separator the token separating the parameter from the default value
3849 * @param defaultValue the expression computing the default value for the para meter 3777 * @param defaultValue the expression computing the default value for the para meter
3850 */ 3778 */
3851 DefaultFormalParameter(NormalFormalParameter parameter, this.kind, this.separa tor, Expression defaultValue) { 3779 DefaultFormalParameter(NormalFormalParameter parameter, this.kind, this.separa tor, Expression defaultValue) {
3852 this._parameter = becomeParentOf(parameter); 3780 this._parameter = becomeParentOf(parameter);
3853 this._defaultValue = becomeParentOf(defaultValue); 3781 this._defaultValue = becomeParentOf(defaultValue);
3854 } 3782 }
3855 3783
3856 accept(ASTVisitor visitor) => visitor.visitDefaultFormalParameter(this); 3784 accept(AstVisitor visitor) => visitor.visitDefaultFormalParameter(this);
3857 3785
3858 Token get beginToken => _parameter.beginToken; 3786 Token get beginToken => _parameter.beginToken;
3859 3787
3860 /** 3788 /**
3861 * Return the expression computing the default value for the parameter, or `nu ll` if there 3789 * Return the expression computing the default value for the parameter, or `nu ll` if there
3862 * is no default value. 3790 * is no default value.
3863 * 3791 *
3864 * @return the expression computing the default value for the parameter 3792 * @return the expression computing the default value for the parameter
3865 */ 3793 */
3866 Expression get defaultValue => _defaultValue; 3794 Expression get defaultValue => _defaultValue;
(...skipping 29 matching lines...) Expand all
3896 3824
3897 /** 3825 /**
3898 * Set the formal parameter with which the default value is associated to the given parameter. 3826 * Set the formal parameter with which the default value is associated to the given parameter.
3899 * 3827 *
3900 * @param formalParameter the formal parameter with which the default value is associated 3828 * @param formalParameter the formal parameter with which the default value is associated
3901 */ 3829 */
3902 void set parameter(NormalFormalParameter formalParameter) { 3830 void set parameter(NormalFormalParameter formalParameter) {
3903 _parameter = becomeParentOf(formalParameter); 3831 _parameter = becomeParentOf(formalParameter);
3904 } 3832 }
3905 3833
3906 void visitChildren(ASTVisitor visitor) { 3834 void visitChildren(AstVisitor visitor) {
3907 safelyVisitChild(_parameter, visitor); 3835 safelyVisitChild(_parameter, visitor);
3908 safelyVisitChild(_defaultValue, visitor); 3836 safelyVisitChild(_defaultValue, visitor);
3909 } 3837 }
3910 } 3838 }
3911 3839
3912 /** 3840 /**
3913 * The abstract class `Directive` defines the behavior common to nodes that repr esent a 3841 * The abstract class `Directive` defines the behavior common to nodes that repr esent a
3914 * directive. 3842 * directive.
3915 * 3843 *
3916 * <pre> 3844 * <pre>
3917 * directive ::= 3845 * directive ::=
3918 * [ExportDirective] 3846 * [ExportDirective]
3919 * | [ImportDirective] 3847 * | [ImportDirective]
3920 * | [LibraryDirective] 3848 * | [LibraryDirective]
3921 * | [PartDirective] 3849 * | [PartDirective]
3922 * | [PartOfDirective] 3850 * | [PartOfDirective]
3923 * </pre> 3851 * </pre>
3924 *
3925 * @coverage dart.engine.ast
3926 */ 3852 */
3927 abstract class Directive extends AnnotatedNode { 3853 abstract class Directive extends AnnotatedNode {
3928 /** 3854 /**
3929 * The element associated with this directive, or `null` if the AST structure has not been 3855 * The element associated with this directive, or `null` if the AST structure has not been
3930 * resolved or if this directive could not be resolved. 3856 * resolved or if this directive could not be resolved.
3931 */ 3857 */
3932 Element _element; 3858 Element _element;
3933 3859
3934 /** 3860 /**
3935 * Initialize a newly create directive. 3861 * Initialize a newly create directive.
(...skipping 30 matching lines...) Expand all
3966 } 3892 }
3967 } 3893 }
3968 3894
3969 /** 3895 /**
3970 * Instances of the class `DoStatement` represent a do statement. 3896 * Instances of the class `DoStatement` represent a do statement.
3971 * 3897 *
3972 * <pre> 3898 * <pre>
3973 * doStatement ::= 3899 * doStatement ::=
3974 * 'do' [Statement] 'while' '(' [Expression] ')' ';' 3900 * 'do' [Statement] 'while' '(' [Expression] ')' ';'
3975 * </pre> 3901 * </pre>
3976 *
3977 * @coverage dart.engine.ast
3978 */ 3902 */
3979 class DoStatement extends Statement { 3903 class DoStatement extends Statement {
3980 /** 3904 /**
3981 * The token representing the 'do' keyword. 3905 * The token representing the 'do' keyword.
3982 */ 3906 */
3983 Token doKeyword; 3907 Token doKeyword;
3984 3908
3985 /** 3909 /**
3986 * The body of the loop. 3910 * The body of the loop.
3987 */ 3911 */
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4023 * @param rightParenthesis the right parenthesis 3947 * @param rightParenthesis the right parenthesis
4024 * @param semicolon the semicolon terminating the statement 3948 * @param semicolon the semicolon terminating the statement
4025 */ 3949 */
4026 DoStatement(this.doKeyword, Statement body, this.whileKeyword, Token leftParen thesis, Expression condition, Token rightParenthesis, this.semicolon) { 3950 DoStatement(this.doKeyword, Statement body, this.whileKeyword, Token leftParen thesis, Expression condition, Token rightParenthesis, this.semicolon) {
4027 this._body = becomeParentOf(body); 3951 this._body = becomeParentOf(body);
4028 this._leftParenthesis = leftParenthesis; 3952 this._leftParenthesis = leftParenthesis;
4029 this._condition = becomeParentOf(condition); 3953 this._condition = becomeParentOf(condition);
4030 this._rightParenthesis = rightParenthesis; 3954 this._rightParenthesis = rightParenthesis;
4031 } 3955 }
4032 3956
4033 accept(ASTVisitor visitor) => visitor.visitDoStatement(this); 3957 accept(AstVisitor visitor) => visitor.visitDoStatement(this);
4034 3958
4035 Token get beginToken => doKeyword; 3959 Token get beginToken => doKeyword;
4036 3960
4037 /** 3961 /**
4038 * Return the body of the loop. 3962 * Return the body of the loop.
4039 * 3963 *
4040 * @return the body of the loop 3964 * @return the body of the loop
4041 */ 3965 */
4042 Statement get body => _body; 3966 Statement get body => _body;
4043 3967
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4093 4017
4094 /** 4018 /**
4095 * Set the right parenthesis to the given token. 4019 * Set the right parenthesis to the given token.
4096 * 4020 *
4097 * @param parenthesis the right parenthesis 4021 * @param parenthesis the right parenthesis
4098 */ 4022 */
4099 void set rightParenthesis(Token parenthesis) { 4023 void set rightParenthesis(Token parenthesis) {
4100 _rightParenthesis = parenthesis; 4024 _rightParenthesis = parenthesis;
4101 } 4025 }
4102 4026
4103 void visitChildren(ASTVisitor visitor) { 4027 void visitChildren(AstVisitor visitor) {
4104 safelyVisitChild(_body, visitor); 4028 safelyVisitChild(_body, visitor);
4105 safelyVisitChild(_condition, visitor); 4029 safelyVisitChild(_condition, visitor);
4106 } 4030 }
4107 } 4031 }
4108 4032
4109 /** 4033 /**
4110 * Instances of the class `DoubleLiteral` represent a floating point literal exp ression. 4034 * Instances of the class `DoubleLiteral` represent a floating point literal exp ression.
4111 * 4035 *
4112 * <pre> 4036 * <pre>
4113 * doubleLiteral ::= 4037 * doubleLiteral ::=
4114 * decimalDigit+ ('.' decimalDigit*)? exponent? 4038 * decimalDigit+ ('.' decimalDigit*)? exponent?
4115 * | '.' decimalDigit+ exponent? 4039 * | '.' decimalDigit+ exponent?
4116 * 4040 *
4117 * exponent ::= 4041 * exponent ::=
4118 * ('e' | 'E') ('+' | '-')? decimalDigit+ 4042 * ('e' | 'E') ('+' | '-')? decimalDigit+
4119 * </pre> 4043 * </pre>
4120 *
4121 * @coverage dart.engine.ast
4122 */ 4044 */
4123 class DoubleLiteral extends Literal { 4045 class DoubleLiteral extends Literal {
4124 /** 4046 /**
4125 * The token representing the literal. 4047 * The token representing the literal.
4126 */ 4048 */
4127 Token literal; 4049 Token literal;
4128 4050
4129 /** 4051 /**
4130 * The value of the literal. 4052 * The value of the literal.
4131 */ 4053 */
4132 double value = 0.0; 4054 double value = 0.0;
4133 4055
4134 /** 4056 /**
4135 * Initialize a newly created floating point literal. 4057 * Initialize a newly created floating point literal.
4136 * 4058 *
4137 * @param literal the token representing the literal 4059 * @param literal the token representing the literal
4138 * @param value the value of the literal 4060 * @param value the value of the literal
4139 */ 4061 */
4140 DoubleLiteral(this.literal, this.value); 4062 DoubleLiteral(this.literal, this.value);
4141 4063
4142 accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this); 4064 accept(AstVisitor visitor) => visitor.visitDoubleLiteral(this);
4143 4065
4144 Token get beginToken => literal; 4066 Token get beginToken => literal;
4145 4067
4146 Token get endToken => literal; 4068 Token get endToken => literal;
4147 4069
4148 void visitChildren(ASTVisitor visitor) { 4070 void visitChildren(AstVisitor visitor) {
4149 } 4071 }
4150 } 4072 }
4151 4073
4152 /** 4074 /**
4153 * Instances of the class `EmptyFunctionBody` represent an empty function body, which can only 4075 * Instances of the class `EmptyFunctionBody` represent an empty function body, which can only
4154 * appear in constructors or abstract methods. 4076 * appear in constructors or abstract methods.
4155 * 4077 *
4156 * <pre> 4078 * <pre>
4157 * emptyFunctionBody ::= 4079 * emptyFunctionBody ::=
4158 * ';' 4080 * ';'
4159 * </pre> 4081 * </pre>
4160 *
4161 * @coverage dart.engine.ast
4162 */ 4082 */
4163 class EmptyFunctionBody extends FunctionBody { 4083 class EmptyFunctionBody extends FunctionBody {
4164 /** 4084 /**
4165 * The token representing the semicolon that marks the end of the function bod y. 4085 * The token representing the semicolon that marks the end of the function bod y.
4166 */ 4086 */
4167 Token semicolon; 4087 Token semicolon;
4168 4088
4169 /** 4089 /**
4170 * Initialize a newly created function body. 4090 * Initialize a newly created function body.
4171 * 4091 *
4172 * @param semicolon the token representing the semicolon that marks the end of the function body 4092 * @param semicolon the token representing the semicolon that marks the end of the function body
4173 */ 4093 */
4174 EmptyFunctionBody(this.semicolon); 4094 EmptyFunctionBody(this.semicolon);
4175 4095
4176 accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this); 4096 accept(AstVisitor visitor) => visitor.visitEmptyFunctionBody(this);
4177 4097
4178 Token get beginToken => semicolon; 4098 Token get beginToken => semicolon;
4179 4099
4180 Token get endToken => semicolon; 4100 Token get endToken => semicolon;
4181 4101
4182 void visitChildren(ASTVisitor visitor) { 4102 void visitChildren(AstVisitor visitor) {
4183 } 4103 }
4184 } 4104 }
4185 4105
4186 /** 4106 /**
4187 * Instances of the class `EmptyStatement` represent an empty statement. 4107 * Instances of the class `EmptyStatement` represent an empty statement.
4188 * 4108 *
4189 * <pre> 4109 * <pre>
4190 * emptyStatement ::= 4110 * emptyStatement ::=
4191 * ';' 4111 * ';'
4192 * </pre> 4112 * </pre>
4193 *
4194 * @coverage dart.engine.ast
4195 */ 4113 */
4196 class EmptyStatement extends Statement { 4114 class EmptyStatement extends Statement {
4197 /** 4115 /**
4198 * The semicolon terminating the statement. 4116 * The semicolon terminating the statement.
4199 */ 4117 */
4200 Token semicolon; 4118 Token semicolon;
4201 4119
4202 /** 4120 /**
4203 * Initialize a newly created empty statement. 4121 * Initialize a newly created empty statement.
4204 * 4122 *
4205 * @param semicolon the semicolon terminating the statement 4123 * @param semicolon the semicolon terminating the statement
4206 */ 4124 */
4207 EmptyStatement(this.semicolon); 4125 EmptyStatement(this.semicolon);
4208 4126
4209 accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this); 4127 accept(AstVisitor visitor) => visitor.visitEmptyStatement(this);
4210 4128
4211 Token get beginToken => semicolon; 4129 Token get beginToken => semicolon;
4212 4130
4213 Token get endToken => semicolon; 4131 Token get endToken => semicolon;
4214 4132
4215 void visitChildren(ASTVisitor visitor) { 4133 void visitChildren(AstVisitor visitor) {
4216 } 4134 }
4217 } 4135 }
4218 4136
4219 /** 4137 /**
4220 * Ephemeral identifiers are created as needed to mimic the presence of an empty identifier. 4138 * Ephemeral identifiers are created as needed to mimic the presence of an empty identifier.
4221 *
4222 * @coverage dart.engine.ast
4223 */ 4139 */
4224 class EphemeralIdentifier extends SimpleIdentifier { 4140 class EphemeralIdentifier extends SimpleIdentifier {
4225 EphemeralIdentifier(ASTNode parent, int location) : super(new StringToken(Toke nType.IDENTIFIER, "", location)) { 4141 EphemeralIdentifier(AstNode parent, int location) : super(new StringToken(Toke nType.IDENTIFIER, "", location)) {
4226 parent.becomeParentOf(this); 4142 parent.becomeParentOf(this);
4227 } 4143 }
4228 } 4144 }
4229 4145
4230 /** 4146 /**
4231 * Instances of the class `ExportDirective` represent an export directive. 4147 * Instances of the class `ExportDirective` represent an export directive.
4232 * 4148 *
4233 * <pre> 4149 * <pre>
4234 * exportDirective ::= 4150 * exportDirective ::=
4235 * [Annotation] 'export' [StringLiteral] [Combinator]* ';' 4151 * [Annotation] 'export' [StringLiteral] [Combinator]* ';'
4236 * </pre> 4152 * </pre>
4237 *
4238 * @coverage dart.engine.ast
4239 */ 4153 */
4240 class ExportDirective extends NamespaceDirective { 4154 class ExportDirective extends NamespaceDirective {
4241 /** 4155 /**
4242 * Initialize a newly created export directive. 4156 * Initialize a newly created export directive.
4243 * 4157 *
4244 * @param comment the documentation comment associated with this directive 4158 * @param comment the documentation comment associated with this directive
4245 * @param metadata the annotations associated with the directive 4159 * @param metadata the annotations associated with the directive
4246 * @param keyword the token representing the 'export' keyword 4160 * @param keyword the token representing the 'export' keyword
4247 * @param libraryUri the URI of the library being exported 4161 * @param libraryUri the URI of the library being exported
4248 * @param combinators the combinators used to control which names are exported 4162 * @param combinators the combinators used to control which names are exported
4249 * @param semicolon the semicolon terminating the directive 4163 * @param semicolon the semicolon terminating the directive
4250 */ 4164 */
4251 ExportDirective(Comment comment, List<Annotation> metadata, Token keyword, Str ingLiteral libraryUri, List<Combinator> combinators, Token semicolon) : super(co mment, metadata, keyword, libraryUri, combinators, semicolon); 4165 ExportDirective(Comment comment, List<Annotation> metadata, Token keyword, Str ingLiteral libraryUri, List<Combinator> combinators, Token semicolon) : super(co mment, metadata, keyword, libraryUri, combinators, semicolon);
4252 4166
4253 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); 4167 accept(AstVisitor visitor) => visitor.visitExportDirective(this);
4254 4168
4255 LibraryElement get uriElement { 4169 LibraryElement get uriElement {
4256 Element element = this.element; 4170 Element element = this.element;
4257 if (element is ExportElement) { 4171 if (element is ExportElement) {
4258 return element.exportedLibrary; 4172 return element.exportedLibrary;
4259 } 4173 }
4260 return null; 4174 return null;
4261 } 4175 }
4262 4176
4263 void visitChildren(ASTVisitor visitor) { 4177 void visitChildren(AstVisitor visitor) {
4264 super.visitChildren(visitor); 4178 super.visitChildren(visitor);
4265 combinators.accept(visitor); 4179 combinators.accept(visitor);
4266 } 4180 }
4267 } 4181 }
4268 4182
4269 /** 4183 /**
4270 * Instances of the class `Expression` defines the behavior common to nodes that represent an 4184 * Instances of the class `Expression` defines the behavior common to nodes that represent an
4271 * expression. 4185 * expression.
4272 * 4186 *
4273 * <pre> 4187 * <pre>
4274 * expression ::= 4188 * expression ::=
4275 * [AssignmentExpression] 4189 * [AssignmentExpression]
4276 * | [ConditionalExpression] cascadeSection* 4190 * | [ConditionalExpression] cascadeSection*
4277 * | [ThrowExpression] 4191 * | [ThrowExpression]
4278 * </pre> 4192 * </pre>
4279 *
4280 * @coverage dart.engine.ast
4281 */ 4193 */
4282 abstract class Expression extends ASTNode { 4194 abstract class Expression extends AstNode {
4283 /** 4195 /**
4284 * An empty array of expressions. 4196 * An empty array of expressions.
4285 */ 4197 */
4286 static List<Expression> EMPTY_ARRAY = new List<Expression>(0); 4198 static List<Expression> EMPTY_ARRAY = new List<Expression>(0);
4287 4199
4288 /** 4200 /**
4289 * The static type of this expression, or `null` if the AST structure has not been resolved. 4201 * The static type of this expression, or `null` if the AST structure has not been resolved.
4290 */ 4202 */
4291 Type2 staticType; 4203 Type2 staticType;
4292 4204
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4346 * If this expression is an argument to an invocation, and the AST structure h as been resolved, 4258 * If this expression is an argument to an invocation, and the AST structure h as been resolved,
4347 * and the function being invoked is known based on propagated type informatio n, and this 4259 * and the function being invoked is known based on propagated type informatio n, and this
4348 * expression corresponds to one of the parameters of the function being invok ed, then return the 4260 * expression corresponds to one of the parameters of the function being invok ed, then return the
4349 * parameter element representing the parameter to which the value of this exp ression will be 4261 * parameter element representing the parameter to which the value of this exp ression will be
4350 * bound. Otherwise, return `null`. 4262 * bound. Otherwise, return `null`.
4351 * 4263 *
4352 * @return the parameter element representing the parameter to which the value of this expression 4264 * @return the parameter element representing the parameter to which the value of this expression
4353 * will be bound 4265 * will be bound
4354 */ 4266 */
4355 ParameterElement get propagatedParameterElement { 4267 ParameterElement get propagatedParameterElement {
4356 ASTNode parent = this.parent; 4268 AstNode parent = this.parent;
4357 if (parent is ArgumentList) { 4269 if (parent is ArgumentList) {
4358 return parent.getPropagatedParameterElementFor(this); 4270 return parent.getPropagatedParameterElementFor(this);
4359 } else if (parent is IndexExpression) { 4271 } else if (parent is IndexExpression) {
4360 IndexExpression indexExpression = parent; 4272 IndexExpression indexExpression = parent;
4361 if (identical(indexExpression.index, this)) { 4273 if (identical(indexExpression.index, this)) {
4362 return indexExpression.propagatedParameterElementForIndex; 4274 return indexExpression.propagatedParameterElementForIndex;
4363 } 4275 }
4364 } else if (parent is BinaryExpression) { 4276 } else if (parent is BinaryExpression) {
4365 BinaryExpression binaryExpression = parent; 4277 BinaryExpression binaryExpression = parent;
4366 if (identical(binaryExpression.rightOperand, this)) { 4278 if (identical(binaryExpression.rightOperand, this)) {
(...skipping 16 matching lines...) Expand all
4383 * If this expression is an argument to an invocation, and the AST structure h as been resolved, 4295 * If this expression is an argument to an invocation, and the AST structure h as been resolved,
4384 * and the function being invoked is known based on static type information, a nd this expression 4296 * and the function being invoked is known based on static type information, a nd this expression
4385 * corresponds to one of the parameters of the function being invoked, then re turn the parameter 4297 * corresponds to one of the parameters of the function being invoked, then re turn the parameter
4386 * element representing the parameter to which the value of this expression wi ll be bound. 4298 * element representing the parameter to which the value of this expression wi ll be bound.
4387 * Otherwise, return `null`. 4299 * Otherwise, return `null`.
4388 * 4300 *
4389 * @return the parameter element representing the parameter to which the value of this expression 4301 * @return the parameter element representing the parameter to which the value of this expression
4390 * will be bound 4302 * will be bound
4391 */ 4303 */
4392 ParameterElement get staticParameterElement { 4304 ParameterElement get staticParameterElement {
4393 ASTNode parent = this.parent; 4305 AstNode parent = this.parent;
4394 if (parent is ArgumentList) { 4306 if (parent is ArgumentList) {
4395 return parent.getStaticParameterElementFor(this); 4307 return parent.getStaticParameterElementFor(this);
4396 } else if (parent is IndexExpression) { 4308 } else if (parent is IndexExpression) {
4397 IndexExpression indexExpression = parent; 4309 IndexExpression indexExpression = parent;
4398 if (identical(indexExpression.index, this)) { 4310 if (identical(indexExpression.index, this)) {
4399 return indexExpression.staticParameterElementForIndex; 4311 return indexExpression.staticParameterElementForIndex;
4400 } 4312 }
4401 } else if (parent is BinaryExpression) { 4313 } else if (parent is BinaryExpression) {
4402 BinaryExpression binaryExpression = parent; 4314 BinaryExpression binaryExpression = parent;
4403 if (identical(binaryExpression.rightOperand, this)) { 4315 if (identical(binaryExpression.rightOperand, this)) {
(...skipping 22 matching lines...) Expand all
4426 } 4338 }
4427 4339
4428 /** 4340 /**
4429 * Instances of the class `ExpressionFunctionBody` represent a function body con sisting of a 4341 * Instances of the class `ExpressionFunctionBody` represent a function body con sisting of a
4430 * single expression. 4342 * single expression.
4431 * 4343 *
4432 * <pre> 4344 * <pre>
4433 * expressionFunctionBody ::= 4345 * expressionFunctionBody ::=
4434 * '=>' [Expression] ';' 4346 * '=>' [Expression] ';'
4435 * </pre> 4347 * </pre>
4436 *
4437 * @coverage dart.engine.ast
4438 */ 4348 */
4439 class ExpressionFunctionBody extends FunctionBody { 4349 class ExpressionFunctionBody extends FunctionBody {
4440 /** 4350 /**
4441 * The token introducing the expression that represents the body of the functi on. 4351 * The token introducing the expression that represents the body of the functi on.
4442 */ 4352 */
4443 Token functionDefinition; 4353 Token functionDefinition;
4444 4354
4445 /** 4355 /**
4446 * The expression representing the body of the function. 4356 * The expression representing the body of the function.
4447 */ 4357 */
4448 Expression _expression; 4358 Expression _expression;
4449 4359
4450 /** 4360 /**
4451 * The semicolon terminating the statement. 4361 * The semicolon terminating the statement.
4452 */ 4362 */
4453 Token semicolon; 4363 Token semicolon;
4454 4364
4455 /** 4365 /**
4456 * Initialize a newly created function body consisting of a block of statement s. 4366 * Initialize a newly created function body consisting of a block of statement s.
4457 * 4367 *
4458 * @param functionDefinition the token introducing the expression that represe nts the body of the 4368 * @param functionDefinition the token introducing the expression that represe nts the body of the
4459 * function 4369 * function
4460 * @param expression the expression representing the body of the function 4370 * @param expression the expression representing the body of the function
4461 * @param semicolon the semicolon terminating the statement 4371 * @param semicolon the semicolon terminating the statement
4462 */ 4372 */
4463 ExpressionFunctionBody(this.functionDefinition, Expression expression, this.se micolon) { 4373 ExpressionFunctionBody(this.functionDefinition, Expression expression, this.se micolon) {
4464 this._expression = becomeParentOf(expression); 4374 this._expression = becomeParentOf(expression);
4465 } 4375 }
4466 4376
4467 accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this); 4377 accept(AstVisitor visitor) => visitor.visitExpressionFunctionBody(this);
4468 4378
4469 Token get beginToken => functionDefinition; 4379 Token get beginToken => functionDefinition;
4470 4380
4471 Token get endToken { 4381 Token get endToken {
4472 if (semicolon != null) { 4382 if (semicolon != null) {
4473 return semicolon; 4383 return semicolon;
4474 } 4384 }
4475 return _expression.endToken; 4385 return _expression.endToken;
4476 } 4386 }
4477 4387
4478 /** 4388 /**
4479 * Return the expression representing the body of the function. 4389 * Return the expression representing the body of the function.
4480 * 4390 *
4481 * @return the expression representing the body of the function 4391 * @return the expression representing the body of the function
4482 */ 4392 */
4483 Expression get expression => _expression; 4393 Expression get expression => _expression;
4484 4394
4485 /** 4395 /**
4486 * Set the expression representing the body of the function to the given expre ssion. 4396 * Set the expression representing the body of the function to the given expre ssion.
4487 * 4397 *
4488 * @param expression the expression representing the body of the function 4398 * @param expression the expression representing the body of the function
4489 */ 4399 */
4490 void set expression(Expression expression) { 4400 void set expression(Expression expression) {
4491 this._expression = becomeParentOf(expression); 4401 this._expression = becomeParentOf(expression);
4492 } 4402 }
4493 4403
4494 void visitChildren(ASTVisitor visitor) { 4404 void visitChildren(AstVisitor visitor) {
4495 safelyVisitChild(_expression, visitor); 4405 safelyVisitChild(_expression, visitor);
4496 } 4406 }
4497 } 4407 }
4498 4408
4499 /** 4409 /**
4500 * Instances of the class `ExpressionStatement` wrap an expression as a statemen t. 4410 * Instances of the class `ExpressionStatement` wrap an expression as a statemen t.
4501 * 4411 *
4502 * <pre> 4412 * <pre>
4503 * expressionStatement ::= 4413 * expressionStatement ::=
4504 * [Expression]? ';' 4414 * [Expression]? ';'
4505 * </pre> 4415 * </pre>
4506 *
4507 * @coverage dart.engine.ast
4508 */ 4416 */
4509 class ExpressionStatement extends Statement { 4417 class ExpressionStatement extends Statement {
4510 /** 4418 /**
4511 * The expression that comprises the statement. 4419 * The expression that comprises the statement.
4512 */ 4420 */
4513 Expression _expression; 4421 Expression _expression;
4514 4422
4515 /** 4423 /**
4516 * The semicolon terminating the statement, or `null` if the expression is a f unction 4424 * The semicolon terminating the statement, or `null` if the expression is a f unction
4517 * expression and therefore isn't followed by a semicolon. 4425 * expression and therefore isn't followed by a semicolon.
4518 */ 4426 */
4519 Token semicolon; 4427 Token semicolon;
4520 4428
4521 /** 4429 /**
4522 * Initialize a newly created expression statement. 4430 * Initialize a newly created expression statement.
4523 * 4431 *
4524 * @param expression the expression that comprises the statement 4432 * @param expression the expression that comprises the statement
4525 * @param semicolon the semicolon terminating the statement 4433 * @param semicolon the semicolon terminating the statement
4526 */ 4434 */
4527 ExpressionStatement(Expression expression, this.semicolon) { 4435 ExpressionStatement(Expression expression, this.semicolon) {
4528 this._expression = becomeParentOf(expression); 4436 this._expression = becomeParentOf(expression);
4529 } 4437 }
4530 4438
4531 accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this); 4439 accept(AstVisitor visitor) => visitor.visitExpressionStatement(this);
4532 4440
4533 Token get beginToken => _expression.beginToken; 4441 Token get beginToken => _expression.beginToken;
4534 4442
4535 Token get endToken { 4443 Token get endToken {
4536 if (semicolon != null) { 4444 if (semicolon != null) {
4537 return semicolon; 4445 return semicolon;
4538 } 4446 }
4539 return _expression.endToken; 4447 return _expression.endToken;
4540 } 4448 }
4541 4449
4542 /** 4450 /**
4543 * Return the expression that comprises the statement. 4451 * Return the expression that comprises the statement.
4544 * 4452 *
4545 * @return the expression that comprises the statement 4453 * @return the expression that comprises the statement
4546 */ 4454 */
4547 Expression get expression => _expression; 4455 Expression get expression => _expression;
4548 4456
4549 bool get isSynthetic => _expression.isSynthetic && semicolon.isSynthetic; 4457 bool get isSynthetic => _expression.isSynthetic && semicolon.isSynthetic;
4550 4458
4551 /** 4459 /**
4552 * Set the expression that comprises the statement to the given expression. 4460 * Set the expression that comprises the statement to the given expression.
4553 * 4461 *
4554 * @param expression the expression that comprises the statement 4462 * @param expression the expression that comprises the statement
4555 */ 4463 */
4556 void set expression(Expression expression) { 4464 void set expression(Expression expression) {
4557 this._expression = becomeParentOf(expression); 4465 this._expression = becomeParentOf(expression);
4558 } 4466 }
4559 4467
4560 void visitChildren(ASTVisitor visitor) { 4468 void visitChildren(AstVisitor visitor) {
4561 safelyVisitChild(_expression, visitor); 4469 safelyVisitChild(_expression, visitor);
4562 } 4470 }
4563 } 4471 }
4564 4472
4565 /** 4473 /**
4566 * Instances of the class `ExtendsClause` represent the "extends" clause in a cl ass 4474 * Instances of the class `ExtendsClause` represent the "extends" clause in a cl ass
4567 * declaration. 4475 * declaration.
4568 * 4476 *
4569 * <pre> 4477 * <pre>
4570 * extendsClause ::= 4478 * extendsClause ::=
4571 * 'extends' [TypeName] 4479 * 'extends' [TypeName]
4572 * </pre> 4480 * </pre>
4573 *
4574 * @coverage dart.engine.ast
4575 */ 4481 */
4576 class ExtendsClause extends ASTNode { 4482 class ExtendsClause extends AstNode {
4577 /** 4483 /**
4578 * The token representing the 'extends' keyword. 4484 * The token representing the 'extends' keyword.
4579 */ 4485 */
4580 Token keyword; 4486 Token keyword;
4581 4487
4582 /** 4488 /**
4583 * The name of the class that is being extended. 4489 * The name of the class that is being extended.
4584 */ 4490 */
4585 TypeName _superclass; 4491 TypeName _superclass;
4586 4492
4587 /** 4493 /**
4588 * Initialize a newly created extends clause. 4494 * Initialize a newly created extends clause.
4589 * 4495 *
4590 * @param keyword the token representing the 'extends' keyword 4496 * @param keyword the token representing the 'extends' keyword
4591 * @param superclass the name of the class that is being extended 4497 * @param superclass the name of the class that is being extended
4592 */ 4498 */
4593 ExtendsClause(this.keyword, TypeName superclass) { 4499 ExtendsClause(this.keyword, TypeName superclass) {
4594 this._superclass = becomeParentOf(superclass); 4500 this._superclass = becomeParentOf(superclass);
4595 } 4501 }
4596 4502
4597 accept(ASTVisitor visitor) => visitor.visitExtendsClause(this); 4503 accept(AstVisitor visitor) => visitor.visitExtendsClause(this);
4598 4504
4599 Token get beginToken => keyword; 4505 Token get beginToken => keyword;
4600 4506
4601 Token get endToken => _superclass.endToken; 4507 Token get endToken => _superclass.endToken;
4602 4508
4603 /** 4509 /**
4604 * Return the name of the class that is being extended. 4510 * Return the name of the class that is being extended.
4605 * 4511 *
4606 * @return the name of the class that is being extended 4512 * @return the name of the class that is being extended
4607 */ 4513 */
4608 TypeName get superclass => _superclass; 4514 TypeName get superclass => _superclass;
4609 4515
4610 /** 4516 /**
4611 * Set the name of the class that is being extended to the given name. 4517 * Set the name of the class that is being extended to the given name.
4612 * 4518 *
4613 * @param name the name of the class that is being extended 4519 * @param name the name of the class that is being extended
4614 */ 4520 */
4615 void set superclass(TypeName name) { 4521 void set superclass(TypeName name) {
4616 _superclass = becomeParentOf(name); 4522 _superclass = becomeParentOf(name);
4617 } 4523 }
4618 4524
4619 void visitChildren(ASTVisitor visitor) { 4525 void visitChildren(AstVisitor visitor) {
4620 safelyVisitChild(_superclass, visitor); 4526 safelyVisitChild(_superclass, visitor);
4621 } 4527 }
4622 } 4528 }
4623 4529
4624 /** 4530 /**
4625 * Instances of the class `FieldDeclaration` represent the declaration of one or more fields 4531 * Instances of the class `FieldDeclaration` represent the declaration of one or more fields
4626 * of the same type. 4532 * of the same type.
4627 * 4533 *
4628 * <pre> 4534 * <pre>
4629 * fieldDeclaration ::= 4535 * fieldDeclaration ::=
4630 * 'static'? [VariableDeclarationList] ';' 4536 * 'static'? [VariableDeclarationList] ';'
4631 * </pre> 4537 * </pre>
4632 *
4633 * @coverage dart.engine.ast
4634 */ 4538 */
4635 class FieldDeclaration extends ClassMember { 4539 class FieldDeclaration extends ClassMember {
4636 /** 4540 /**
4637 * The token representing the 'static' keyword, or `null` if the fields are no t static. 4541 * The token representing the 'static' keyword, or `null` if the fields are no t static.
4638 */ 4542 */
4639 Token staticKeyword; 4543 Token staticKeyword;
4640 4544
4641 /** 4545 /**
4642 * The fields being declared. 4546 * The fields being declared.
4643 */ 4547 */
(...skipping 10 matching lines...) Expand all
4654 * @param comment the documentation comment associated with this field 4558 * @param comment the documentation comment associated with this field
4655 * @param metadata the annotations associated with this field 4559 * @param metadata the annotations associated with this field
4656 * @param staticKeyword the token representing the 'static' keyword 4560 * @param staticKeyword the token representing the 'static' keyword
4657 * @param fieldList the fields being declared 4561 * @param fieldList the fields being declared
4658 * @param semicolon the semicolon terminating the declaration 4562 * @param semicolon the semicolon terminating the declaration
4659 */ 4563 */
4660 FieldDeclaration(Comment comment, List<Annotation> metadata, this.staticKeywor d, VariableDeclarationList fieldList, this.semicolon) : super(comment, metadata) { 4564 FieldDeclaration(Comment comment, List<Annotation> metadata, this.staticKeywor d, VariableDeclarationList fieldList, this.semicolon) : super(comment, metadata) {
4661 this._fieldList = becomeParentOf(fieldList); 4565 this._fieldList = becomeParentOf(fieldList);
4662 } 4566 }
4663 4567
4664 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); 4568 accept(AstVisitor visitor) => visitor.visitFieldDeclaration(this);
4665 4569
4666 Element get element => null; 4570 Element get element => null;
4667 4571
4668 Token get endToken => semicolon; 4572 Token get endToken => semicolon;
4669 4573
4670 /** 4574 /**
4671 * Return the fields being declared. 4575 * Return the fields being declared.
4672 * 4576 *
4673 * @return the fields being declared 4577 * @return the fields being declared
4674 */ 4578 */
4675 VariableDeclarationList get fields => _fieldList; 4579 VariableDeclarationList get fields => _fieldList;
4676 4580
4677 /** 4581 /**
4678 * Return `true` if the fields are static. 4582 * Return `true` if the fields are static.
4679 * 4583 *
4680 * @return `true` if the fields are declared to be static 4584 * @return `true` if the fields are declared to be static
4681 */ 4585 */
4682 bool get isStatic => staticKeyword != null; 4586 bool get isStatic => staticKeyword != null;
4683 4587
4684 /** 4588 /**
4685 * Set the fields being declared to the given list of variables. 4589 * Set the fields being declared to the given list of variables.
4686 * 4590 *
4687 * @param fieldList the fields being declared 4591 * @param fieldList the fields being declared
4688 */ 4592 */
4689 void set fields(VariableDeclarationList fieldList) { 4593 void set fields(VariableDeclarationList fieldList) {
4690 fieldList = becomeParentOf(fieldList); 4594 fieldList = becomeParentOf(fieldList);
4691 } 4595 }
4692 4596
4693 void visitChildren(ASTVisitor visitor) { 4597 void visitChildren(AstVisitor visitor) {
4694 super.visitChildren(visitor); 4598 super.visitChildren(visitor);
4695 safelyVisitChild(_fieldList, visitor); 4599 safelyVisitChild(_fieldList, visitor);
4696 } 4600 }
4697 4601
4698 Token get firstTokenAfterCommentAndMetadata { 4602 Token get firstTokenAfterCommentAndMetadata {
4699 if (staticKeyword != null) { 4603 if (staticKeyword != null) {
4700 return staticKeyword; 4604 return staticKeyword;
4701 } 4605 }
4702 return _fieldList.beginToken; 4606 return _fieldList.beginToken;
4703 } 4607 }
4704 } 4608 }
4705 4609
4706 /** 4610 /**
4707 * Instances of the class `FieldFormalParameter` represent a field formal parame ter. 4611 * Instances of the class `FieldFormalParameter` represent a field formal parame ter.
4708 * 4612 *
4709 * <pre> 4613 * <pre>
4710 * fieldFormalParameter ::= 4614 * fieldFormalParameter ::=
4711 * ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? 'this' '. ' [SimpleIdentifier] [FormalParameterList]? 4615 * ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? 'this' '. ' [SimpleIdentifier] [FormalParameterList]?
4712 * </pre> 4616 * </pre>
4713 *
4714 * @coverage dart.engine.ast
4715 */ 4617 */
4716 class FieldFormalParameter extends NormalFormalParameter { 4618 class FieldFormalParameter extends NormalFormalParameter {
4717 /** 4619 /**
4718 * The token representing either the 'final', 'const' or 'var' keyword, or `nu ll` if no 4620 * The token representing either the 'final', 'const' or 'var' keyword, or `nu ll` if no
4719 * keyword was used. 4621 * keyword was used.
4720 */ 4622 */
4721 Token keyword; 4623 Token keyword;
4722 4624
4723 /** 4625 /**
4724 * The name of the declared type of the parameter, or `null` if the parameter does not have 4626 * The name of the declared type of the parameter, or `null` if the parameter does not have
(...skipping 28 matching lines...) Expand all
4753 * @param period the token representing the period 4655 * @param period the token representing the period
4754 * @param identifier the name of the parameter being declared 4656 * @param identifier the name of the parameter being declared
4755 * @param parameters the parameters of the function-typed parameter, or `null` if this is 4657 * @param parameters the parameters of the function-typed parameter, or `null` if this is
4756 * not a function-typed field formal parameter 4658 * not a function-typed field formal parameter
4757 */ 4659 */
4758 FieldFormalParameter(Comment comment, List<Annotation> metadata, this.keyword, TypeName type, this.thisToken, this.period, SimpleIdentifier identifier, Formal ParameterList parameters) : super(comment, metadata, identifier) { 4660 FieldFormalParameter(Comment comment, List<Annotation> metadata, this.keyword, TypeName type, this.thisToken, this.period, SimpleIdentifier identifier, Formal ParameterList parameters) : super(comment, metadata, identifier) {
4759 this._type = becomeParentOf(type); 4661 this._type = becomeParentOf(type);
4760 this._parameters = becomeParentOf(parameters); 4662 this._parameters = becomeParentOf(parameters);
4761 } 4663 }
4762 4664
4763 accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this); 4665 accept(AstVisitor visitor) => visitor.visitFieldFormalParameter(this);
4764 4666
4765 Token get beginToken { 4667 Token get beginToken {
4766 if (keyword != null) { 4668 if (keyword != null) {
4767 return keyword; 4669 return keyword;
4768 } else if (_type != null) { 4670 } else if (_type != null) {
4769 return _type.beginToken; 4671 return _type.beginToken;
4770 } 4672 }
4771 return thisToken; 4673 return thisToken;
4772 } 4674 }
4773 4675
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4805 4707
4806 /** 4708 /**
4807 * Set the name of the declared type of the parameter to the given type name. 4709 * Set the name of the declared type of the parameter to the given type name.
4808 * 4710 *
4809 * @param typeName the name of the declared type of the parameter 4711 * @param typeName the name of the declared type of the parameter
4810 */ 4712 */
4811 void set type(TypeName typeName) { 4713 void set type(TypeName typeName) {
4812 _type = becomeParentOf(typeName); 4714 _type = becomeParentOf(typeName);
4813 } 4715 }
4814 4716
4815 void visitChildren(ASTVisitor visitor) { 4717 void visitChildren(AstVisitor visitor) {
4816 super.visitChildren(visitor); 4718 super.visitChildren(visitor);
4817 safelyVisitChild(_type, visitor); 4719 safelyVisitChild(_type, visitor);
4818 safelyVisitChild(identifier, visitor); 4720 safelyVisitChild(identifier, visitor);
4819 safelyVisitChild(_parameters, visitor); 4721 safelyVisitChild(_parameters, visitor);
4820 } 4722 }
4821 } 4723 }
4822 4724
4823 /** 4725 /**
4824 * Instances of the class `ForEachStatement` represent a for-each statement. 4726 * Instances of the class `ForEachStatement` represent a for-each statement.
4825 * 4727 *
4826 * <pre> 4728 * <pre>
4827 * forEachStatement ::= 4729 * forEachStatement ::=
4828 * 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block] 4730 * 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block]
4829 * | 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block] 4731 * | 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block]
4830 * </pre> 4732 * </pre>
4831 *
4832 * @coverage dart.engine.ast
4833 */ 4733 */
4834 class ForEachStatement extends Statement { 4734 class ForEachStatement extends Statement {
4835 /** 4735 /**
4836 * The token representing the 'for' keyword. 4736 * The token representing the 'for' keyword.
4837 */ 4737 */
4838 Token forKeyword; 4738 Token forKeyword;
4839 4739
4840 /** 4740 /**
4841 * The left parenthesis. 4741 * The left parenthesis.
4842 */ 4742 */
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4898 * @param iterator the expression evaluated to produce the iterator 4798 * @param iterator the expression evaluated to produce the iterator
4899 * @param rightParenthesis the right parenthesis 4799 * @param rightParenthesis the right parenthesis
4900 * @param body the body of the loop 4800 * @param body the body of the loop
4901 */ 4801 */
4902 ForEachStatement.con2(this.forKeyword, this.leftParenthesis, SimpleIdentifier identifier, this.inKeyword, Expression iterator, this.rightParenthesis, Statemen t body) { 4802 ForEachStatement.con2(this.forKeyword, this.leftParenthesis, SimpleIdentifier identifier, this.inKeyword, Expression iterator, this.rightParenthesis, Statemen t body) {
4903 this._identifier = becomeParentOf(identifier); 4803 this._identifier = becomeParentOf(identifier);
4904 this._iterator = becomeParentOf(iterator); 4804 this._iterator = becomeParentOf(iterator);
4905 this._body = becomeParentOf(body); 4805 this._body = becomeParentOf(body);
4906 } 4806 }
4907 4807
4908 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); 4808 accept(AstVisitor visitor) => visitor.visitForEachStatement(this);
4909 4809
4910 Token get beginToken => forKeyword; 4810 Token get beginToken => forKeyword;
4911 4811
4912 /** 4812 /**
4913 * Return the body of the loop. 4813 * Return the body of the loop.
4914 * 4814 *
4915 * @return the body of the loop 4815 * @return the body of the loop
4916 */ 4816 */
4917 Statement get body => _body; 4817 Statement get body => _body;
4918 4818
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4969 4869
4970 /** 4870 /**
4971 * Set the declaration of the loop variable to the given variable. 4871 * Set the declaration of the loop variable to the given variable.
4972 * 4872 *
4973 * @param variable the declaration of the loop variable 4873 * @param variable the declaration of the loop variable
4974 */ 4874 */
4975 void set loopVariable(DeclaredIdentifier variable) { 4875 void set loopVariable(DeclaredIdentifier variable) {
4976 _loopVariable = becomeParentOf(variable); 4876 _loopVariable = becomeParentOf(variable);
4977 } 4877 }
4978 4878
4979 void visitChildren(ASTVisitor visitor) { 4879 void visitChildren(AstVisitor visitor) {
4980 safelyVisitChild(_loopVariable, visitor); 4880 safelyVisitChild(_loopVariable, visitor);
4981 safelyVisitChild(_identifier, visitor); 4881 safelyVisitChild(_identifier, visitor);
4982 safelyVisitChild(_iterator, visitor); 4882 safelyVisitChild(_iterator, visitor);
4983 safelyVisitChild(_body, visitor); 4883 safelyVisitChild(_body, visitor);
4984 } 4884 }
4985 } 4885 }
4986 4886
4987 /** 4887 /**
4988 * Instances of the class `ForStatement` represent a for statement. 4888 * Instances of the class `ForStatement` represent a for statement.
4989 * 4889 *
4990 * <pre> 4890 * <pre>
4991 * forStatement ::= 4891 * forStatement ::=
4992 * 'for' '(' forLoopParts ')' [Statement] 4892 * 'for' '(' forLoopParts ')' [Statement]
4993 * 4893 *
4994 * forLoopParts ::= 4894 * forLoopParts ::=
4995 * forInitializerStatement ';' [Expression]? ';' [Expression]? 4895 * forInitializerStatement ';' [Expression]? ';' [Expression]?
4996 * 4896 *
4997 * forInitializerStatement ::= 4897 * forInitializerStatement ::=
4998 * [DefaultFormalParameter] 4898 * [DefaultFormalParameter]
4999 * | [Expression]? 4899 * | [Expression]?
5000 * </pre> 4900 * </pre>
5001 *
5002 * @coverage dart.engine.ast
5003 */ 4901 */
5004 class ForStatement extends Statement { 4902 class ForStatement extends Statement {
5005 /** 4903 /**
5006 * The token representing the 'for' keyword. 4904 * The token representing the 'for' keyword.
5007 */ 4905 */
5008 Token forKeyword; 4906 Token forKeyword;
5009 4907
5010 /** 4908 /**
5011 * The left parenthesis. 4909 * The left parenthesis.
5012 */ 4910 */
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5073 */ 4971 */
5074 ForStatement(this.forKeyword, this.leftParenthesis, VariableDeclarationList va riableList, Expression initialization, this.leftSeparator, Expression condition, this.rightSeparator, List<Expression> updaters, this.rightParenthesis, Statemen t body) { 4972 ForStatement(this.forKeyword, this.leftParenthesis, VariableDeclarationList va riableList, Expression initialization, this.leftSeparator, Expression condition, this.rightSeparator, List<Expression> updaters, this.rightParenthesis, Statemen t body) {
5075 this._updaters = new NodeList<Expression>(this); 4973 this._updaters = new NodeList<Expression>(this);
5076 this._variableList = becomeParentOf(variableList); 4974 this._variableList = becomeParentOf(variableList);
5077 this._initialization = becomeParentOf(initialization); 4975 this._initialization = becomeParentOf(initialization);
5078 this._condition = becomeParentOf(condition); 4976 this._condition = becomeParentOf(condition);
5079 this._updaters.addAll(updaters); 4977 this._updaters.addAll(updaters);
5080 this._body = becomeParentOf(body); 4978 this._body = becomeParentOf(body);
5081 } 4979 }
5082 4980
5083 accept(ASTVisitor visitor) => visitor.visitForStatement(this); 4981 accept(AstVisitor visitor) => visitor.visitForStatement(this);
5084 4982
5085 Token get beginToken => forKeyword; 4983 Token get beginToken => forKeyword;
5086 4984
5087 /** 4985 /**
5088 * Return the body of the loop. 4986 * Return the body of the loop.
5089 * 4987 *
5090 * @return the body of the loop 4988 * @return the body of the loop
5091 */ 4989 */
5092 Statement get body => _body; 4990 Statement get body => _body;
5093 4991
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5151 5049
5152 /** 5050 /**
5153 * Set the declaration of the loop variables to the given parameter. 5051 * Set the declaration of the loop variables to the given parameter.
5154 * 5052 *
5155 * @param variableList the declaration of the loop variables 5053 * @param variableList the declaration of the loop variables
5156 */ 5054 */
5157 void set variables(VariableDeclarationList variableList) { 5055 void set variables(VariableDeclarationList variableList) {
5158 variableList = becomeParentOf(variableList); 5056 variableList = becomeParentOf(variableList);
5159 } 5057 }
5160 5058
5161 void visitChildren(ASTVisitor visitor) { 5059 void visitChildren(AstVisitor visitor) {
5162 safelyVisitChild(_variableList, visitor); 5060 safelyVisitChild(_variableList, visitor);
5163 safelyVisitChild(_initialization, visitor); 5061 safelyVisitChild(_initialization, visitor);
5164 safelyVisitChild(_condition, visitor); 5062 safelyVisitChild(_condition, visitor);
5165 _updaters.accept(visitor); 5063 _updaters.accept(visitor);
5166 safelyVisitChild(_body, visitor); 5064 safelyVisitChild(_body, visitor);
5167 } 5065 }
5168 } 5066 }
5169 5067
5170 /** 5068 /**
5171 * The abstract class `FormalParameter` defines the behavior of objects represen ting a 5069 * The abstract class `FormalParameter` defines the behavior of objects represen ting a
5172 * parameter to a function. 5070 * parameter to a function.
5173 * 5071 *
5174 * <pre> 5072 * <pre>
5175 * formalParameter ::= 5073 * formalParameter ::=
5176 * [NormalFormalParameter] 5074 * [NormalFormalParameter]
5177 * | [DefaultFormalParameter] 5075 * | [DefaultFormalParameter]
5178 * | [DefaultFormalParameter] 5076 * | [DefaultFormalParameter]
5179 * </pre> 5077 * </pre>
5180 *
5181 * @coverage dart.engine.ast
5182 */ 5078 */
5183 abstract class FormalParameter extends ASTNode { 5079 abstract class FormalParameter extends AstNode {
5184 /** 5080 /**
5185 * Return the element representing this parameter, or `null` if this parameter has not been 5081 * Return the element representing this parameter, or `null` if this parameter has not been
5186 * resolved. 5082 * resolved.
5187 * 5083 *
5188 * @return the element representing this parameter 5084 * @return the element representing this parameter
5189 */ 5085 */
5190 ParameterElement get element { 5086 ParameterElement get element {
5191 SimpleIdentifier identifier = this.identifier; 5087 SimpleIdentifier identifier = this.identifier;
5192 if (identifier == null) { 5088 if (identifier == null) {
5193 return null; 5089 return null;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5247 * optionalFormalParameters ::= 5143 * optionalFormalParameters ::=
5248 * optionalPositionalFormalParameters 5144 * optionalPositionalFormalParameters
5249 * | namedFormalParameters 5145 * | namedFormalParameters
5250 * 5146 *
5251 * optionalPositionalFormalParameters ::= 5147 * optionalPositionalFormalParameters ::=
5252 * '[' [DefaultFormalParameter] (',' [DefaultFormalParameter])* ']' 5148 * '[' [DefaultFormalParameter] (',' [DefaultFormalParameter])* ']'
5253 * 5149 *
5254 * namedFormalParameters ::= 5150 * namedFormalParameters ::=
5255 * '{' [DefaultFormalParameter] (',' [DefaultFormalParameter])* '}' 5151 * '{' [DefaultFormalParameter] (',' [DefaultFormalParameter])* '}'
5256 * </pre> 5152 * </pre>
5257 *
5258 * @coverage dart.engine.ast
5259 */ 5153 */
5260 class FormalParameterList extends ASTNode { 5154 class FormalParameterList extends AstNode {
5261 /** 5155 /**
5262 * The left parenthesis. 5156 * The left parenthesis.
5263 */ 5157 */
5264 Token _leftParenthesis; 5158 Token _leftParenthesis;
5265 5159
5266 /** 5160 /**
5267 * The parameters associated with the method. 5161 * The parameters associated with the method.
5268 */ 5162 */
5269 NodeList<FormalParameter> _parameters; 5163 NodeList<FormalParameter> _parameters;
5270 5164
(...skipping 25 matching lines...) Expand all
5296 */ 5190 */
5297 FormalParameterList(Token leftParenthesis, List<FormalParameter> parameters, T oken leftDelimiter, Token rightDelimiter, Token rightParenthesis) { 5191 FormalParameterList(Token leftParenthesis, List<FormalParameter> parameters, T oken leftDelimiter, Token rightDelimiter, Token rightParenthesis) {
5298 this._parameters = new NodeList<FormalParameter>(this); 5192 this._parameters = new NodeList<FormalParameter>(this);
5299 this._leftParenthesis = leftParenthesis; 5193 this._leftParenthesis = leftParenthesis;
5300 this._parameters.addAll(parameters); 5194 this._parameters.addAll(parameters);
5301 this._leftDelimiter = leftDelimiter; 5195 this._leftDelimiter = leftDelimiter;
5302 this._rightDelimiter = rightDelimiter; 5196 this._rightDelimiter = rightDelimiter;
5303 this._rightParenthesis = rightParenthesis; 5197 this._rightParenthesis = rightParenthesis;
5304 } 5198 }
5305 5199
5306 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); 5200 accept(AstVisitor visitor) => visitor.visitFormalParameterList(this);
5307 5201
5308 Token get beginToken => _leftParenthesis; 5202 Token get beginToken => _leftParenthesis;
5309 5203
5310 Token get endToken => _rightParenthesis; 5204 Token get endToken => _rightParenthesis;
5311 5205
5312 /** 5206 /**
5313 * Return the left square bracket ('[') or left curly brace ('{') introducing the optional 5207 * Return the left square bracket ('[') or left curly brace ('{') introducing the optional
5314 * parameters, or `null` if there are no optional parameters. 5208 * parameters, or `null` if there are no optional parameters.
5315 * 5209 *
5316 * @return the left square bracket ('[') or left curly brace ('{') introducing the optional 5210 * @return the left square bracket ('[') or left curly brace ('{') introducing the optional
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
5394 5288
5395 /** 5289 /**
5396 * Set the right parenthesis to the given token. 5290 * Set the right parenthesis to the given token.
5397 * 5291 *
5398 * @param parenthesis the right parenthesis 5292 * @param parenthesis the right parenthesis
5399 */ 5293 */
5400 void set rightParenthesis(Token parenthesis) { 5294 void set rightParenthesis(Token parenthesis) {
5401 _rightParenthesis = parenthesis; 5295 _rightParenthesis = parenthesis;
5402 } 5296 }
5403 5297
5404 void visitChildren(ASTVisitor visitor) { 5298 void visitChildren(AstVisitor visitor) {
5405 _parameters.accept(visitor); 5299 _parameters.accept(visitor);
5406 } 5300 }
5407 } 5301 }
5408 5302
5409 /** 5303 /**
5410 * The abstract class `FunctionBody` defines the behavior common to objects repr esenting the 5304 * The abstract class `FunctionBody` defines the behavior common to objects repr esenting the
5411 * body of a function or method. 5305 * body of a function or method.
5412 * 5306 *
5413 * <pre> 5307 * <pre>
5414 * functionBody ::= 5308 * functionBody ::=
5415 * [BlockFunctionBody] 5309 * [BlockFunctionBody]
5416 * | [EmptyFunctionBody] 5310 * | [EmptyFunctionBody]
5417 * | [ExpressionFunctionBody] 5311 * | [ExpressionFunctionBody]
5418 * </pre> 5312 * </pre>
5419 *
5420 * @coverage dart.engine.ast
5421 */ 5313 */
5422 abstract class FunctionBody extends ASTNode { 5314 abstract class FunctionBody extends AstNode {
5423 } 5315 }
5424 5316
5425 /** 5317 /**
5426 * Instances of the class `FunctionDeclaration` wrap a [FunctionExpression] as a top-level declaration. 5318 * Instances of the class `FunctionDeclaration` wrap a [FunctionExpression] as a top-level declaration.
5427 * 5319 *
5428 * <pre> 5320 * <pre>
5429 * functionDeclaration ::= 5321 * functionDeclaration ::=
5430 * 'external' functionSignature 5322 * 'external' functionSignature
5431 * | functionSignature [FunctionBody] 5323 * | functionSignature [FunctionBody]
5432 * 5324 *
5433 * functionSignature ::= 5325 * functionSignature ::=
5434 * [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList] 5326 * [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList]
5435 * </pre> 5327 * </pre>
5436 *
5437 * @coverage dart.engine.ast
5438 */ 5328 */
5439 class FunctionDeclaration extends CompilationUnitMember { 5329 class FunctionDeclaration extends CompilationUnitMember {
5440 /** 5330 /**
5441 * The token representing the 'external' keyword, or `null` if this is not an external 5331 * The token representing the 'external' keyword, or `null` if this is not an external
5442 * function. 5332 * function.
5443 */ 5333 */
5444 Token externalKeyword; 5334 Token externalKeyword;
5445 5335
5446 /** 5336 /**
5447 * The return type of the function, or `null` if no return type was declared. 5337 * The return type of the function, or `null` if no return type was declared.
(...skipping 26 matching lines...) Expand all
5474 * @param propertyKeyword the token representing the 'get' or 'set' keyword 5364 * @param propertyKeyword the token representing the 'get' or 'set' keyword
5475 * @param name the name of the function 5365 * @param name the name of the function
5476 * @param functionExpression the function expression being wrapped 5366 * @param functionExpression the function expression being wrapped
5477 */ 5367 */
5478 FunctionDeclaration(Comment comment, List<Annotation> metadata, this.externalK eyword, TypeName returnType, this.propertyKeyword, SimpleIdentifier name, Functi onExpression functionExpression) : super(comment, metadata) { 5368 FunctionDeclaration(Comment comment, List<Annotation> metadata, this.externalK eyword, TypeName returnType, this.propertyKeyword, SimpleIdentifier name, Functi onExpression functionExpression) : super(comment, metadata) {
5479 this._returnType = becomeParentOf(returnType); 5369 this._returnType = becomeParentOf(returnType);
5480 this._name = becomeParentOf(name); 5370 this._name = becomeParentOf(name);
5481 this._functionExpression = becomeParentOf(functionExpression); 5371 this._functionExpression = becomeParentOf(functionExpression);
5482 } 5372 }
5483 5373
5484 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); 5374 accept(AstVisitor visitor) => visitor.visitFunctionDeclaration(this);
5485 5375
5486 ExecutableElement get element => _name != null ? (_name.staticElement as Execu tableElement) : null; 5376 ExecutableElement get element => _name != null ? (_name.staticElement as Execu tableElement) : null;
5487 5377
5488 Token get endToken => _functionExpression.endToken; 5378 Token get endToken => _functionExpression.endToken;
5489 5379
5490 /** 5380 /**
5491 * Return the function expression being wrapped. 5381 * Return the function expression being wrapped.
5492 * 5382 *
5493 * @return the function expression being wrapped 5383 * @return the function expression being wrapped
5494 */ 5384 */
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5542 5432
5543 /** 5433 /**
5544 * Set the return type of the function to the given name. 5434 * Set the return type of the function to the given name.
5545 * 5435 *
5546 * @param name the return type of the function 5436 * @param name the return type of the function
5547 */ 5437 */
5548 void set returnType(TypeName name) { 5438 void set returnType(TypeName name) {
5549 _returnType = becomeParentOf(name); 5439 _returnType = becomeParentOf(name);
5550 } 5440 }
5551 5441
5552 void visitChildren(ASTVisitor visitor) { 5442 void visitChildren(AstVisitor visitor) {
5553 super.visitChildren(visitor); 5443 super.visitChildren(visitor);
5554 safelyVisitChild(_returnType, visitor); 5444 safelyVisitChild(_returnType, visitor);
5555 safelyVisitChild(_name, visitor); 5445 safelyVisitChild(_name, visitor);
5556 safelyVisitChild(_functionExpression, visitor); 5446 safelyVisitChild(_functionExpression, visitor);
5557 } 5447 }
5558 5448
5559 Token get firstTokenAfterCommentAndMetadata { 5449 Token get firstTokenAfterCommentAndMetadata {
5560 if (externalKeyword != null) { 5450 if (externalKeyword != null) {
5561 return externalKeyword; 5451 return externalKeyword;
5562 } 5452 }
5563 if (_returnType != null) { 5453 if (_returnType != null) {
5564 return _returnType.beginToken; 5454 return _returnType.beginToken;
5565 } else if (propertyKeyword != null) { 5455 } else if (propertyKeyword != null) {
5566 return propertyKeyword; 5456 return propertyKeyword;
5567 } else if (_name != null) { 5457 } else if (_name != null) {
5568 return _name.beginToken; 5458 return _name.beginToken;
5569 } 5459 }
5570 return _functionExpression.beginToken; 5460 return _functionExpression.beginToken;
5571 } 5461 }
5572 } 5462 }
5573 5463
5574 /** 5464 /**
5575 * Instances of the class `FunctionDeclarationStatement` wrap a [FunctionDeclara tion 5465 * Instances of the class `FunctionDeclarationStatement` wrap a [FunctionDeclara tion
5576 ] as a statement. 5466 ] as a statement.
5577 *
5578 * @coverage dart.engine.ast
5579 */ 5467 */
5580 class FunctionDeclarationStatement extends Statement { 5468 class FunctionDeclarationStatement extends Statement {
5581 /** 5469 /**
5582 * The function declaration being wrapped. 5470 * The function declaration being wrapped.
5583 */ 5471 */
5584 FunctionDeclaration _functionDeclaration; 5472 FunctionDeclaration _functionDeclaration;
5585 5473
5586 /** 5474 /**
5587 * Initialize a newly created function declaration statement. 5475 * Initialize a newly created function declaration statement.
5588 * 5476 *
5589 * @param functionDeclaration the the function declaration being wrapped 5477 * @param functionDeclaration the the function declaration being wrapped
5590 */ 5478 */
5591 FunctionDeclarationStatement(FunctionDeclaration functionDeclaration) { 5479 FunctionDeclarationStatement(FunctionDeclaration functionDeclaration) {
5592 this._functionDeclaration = becomeParentOf(functionDeclaration); 5480 this._functionDeclaration = becomeParentOf(functionDeclaration);
5593 } 5481 }
5594 5482
5595 accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); 5483 accept(AstVisitor visitor) => visitor.visitFunctionDeclarationStatement(this);
5596 5484
5597 Token get beginToken => _functionDeclaration.beginToken; 5485 Token get beginToken => _functionDeclaration.beginToken;
5598 5486
5599 Token get endToken => _functionDeclaration.endToken; 5487 Token get endToken => _functionDeclaration.endToken;
5600 5488
5601 /** 5489 /**
5602 * Return the function declaration being wrapped. 5490 * Return the function declaration being wrapped.
5603 * 5491 *
5604 * @return the function declaration being wrapped 5492 * @return the function declaration being wrapped
5605 */ 5493 */
5606 FunctionDeclaration get functionDeclaration => _functionDeclaration; 5494 FunctionDeclaration get functionDeclaration => _functionDeclaration;
5607 5495
5608 /** 5496 /**
5609 * Set the function declaration being wrapped to the given function declaratio n. 5497 * Set the function declaration being wrapped to the given function declaratio n.
5610 * 5498 *
5611 * @param functionDeclaration the function declaration being wrapped 5499 * @param functionDeclaration the function declaration being wrapped
5612 */ 5500 */
5613 void set functionExpression(FunctionDeclaration functionDeclaration) { 5501 void set functionExpression(FunctionDeclaration functionDeclaration) {
5614 this._functionDeclaration = becomeParentOf(functionDeclaration); 5502 this._functionDeclaration = becomeParentOf(functionDeclaration);
5615 } 5503 }
5616 5504
5617 void visitChildren(ASTVisitor visitor) { 5505 void visitChildren(AstVisitor visitor) {
5618 safelyVisitChild(_functionDeclaration, visitor); 5506 safelyVisitChild(_functionDeclaration, visitor);
5619 } 5507 }
5620 } 5508 }
5621 5509
5622 /** 5510 /**
5623 * Instances of the class `FunctionExpression` represent a function expression. 5511 * Instances of the class `FunctionExpression` represent a function expression.
5624 * 5512 *
5625 * <pre> 5513 * <pre>
5626 * functionExpression ::= 5514 * functionExpression ::=
5627 * [FormalParameterList] [FunctionBody] 5515 * [FormalParameterList] [FunctionBody]
5628 * </pre> 5516 * </pre>
5629 *
5630 * @coverage dart.engine.ast
5631 */ 5517 */
5632 class FunctionExpression extends Expression { 5518 class FunctionExpression extends Expression {
5633 /** 5519 /**
5634 * The parameters associated with the function. 5520 * The parameters associated with the function.
5635 */ 5521 */
5636 FormalParameterList _parameters; 5522 FormalParameterList _parameters;
5637 5523
5638 /** 5524 /**
5639 * The body of the function, or `null` if this is an external function. 5525 * The body of the function, or `null` if this is an external function.
5640 */ 5526 */
5641 FunctionBody _body; 5527 FunctionBody _body;
5642 5528
5643 /** 5529 /**
5644 * The element associated with the function, or `null` if the AST structure ha s not been 5530 * The element associated with the function, or `null` if the AST structure ha s not been
5645 * resolved. 5531 * resolved.
5646 */ 5532 */
5647 ExecutableElement element; 5533 ExecutableElement element;
5648 5534
5649 /** 5535 /**
5650 * Initialize a newly created function declaration. 5536 * Initialize a newly created function declaration.
5651 * 5537 *
5652 * @param parameters the parameters associated with the function 5538 * @param parameters the parameters associated with the function
5653 * @param body the body of the function 5539 * @param body the body of the function
5654 */ 5540 */
5655 FunctionExpression(FormalParameterList parameters, FunctionBody body) { 5541 FunctionExpression(FormalParameterList parameters, FunctionBody body) {
5656 this._parameters = becomeParentOf(parameters); 5542 this._parameters = becomeParentOf(parameters);
5657 this._body = becomeParentOf(body); 5543 this._body = becomeParentOf(body);
5658 } 5544 }
5659 5545
5660 accept(ASTVisitor visitor) => visitor.visitFunctionExpression(this); 5546 accept(AstVisitor visitor) => visitor.visitFunctionExpression(this);
5661 5547
5662 Token get beginToken { 5548 Token get beginToken {
5663 if (_parameters != null) { 5549 if (_parameters != null) {
5664 return _parameters.beginToken; 5550 return _parameters.beginToken;
5665 } else if (_body != null) { 5551 } else if (_body != null) {
5666 return _body.beginToken; 5552 return _body.beginToken;
5667 } 5553 }
5668 // This should never be reached because external functions must be named, he nce either the body 5554 // This should never be reached because external functions must be named, he nce either the body
5669 // or the name should be non-null. 5555 // or the name should be non-null.
5670 throw new IllegalStateException("Non-external functions must have a body"); 5556 throw new IllegalStateException("Non-external functions must have a body");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5708 5594
5709 /** 5595 /**
5710 * Set the parameters associated with the function to the given list of parame ters. 5596 * Set the parameters associated with the function to the given list of parame ters.
5711 * 5597 *
5712 * @param parameters the parameters associated with the function 5598 * @param parameters the parameters associated with the function
5713 */ 5599 */
5714 void set parameters(FormalParameterList parameters) { 5600 void set parameters(FormalParameterList parameters) {
5715 this._parameters = becomeParentOf(parameters); 5601 this._parameters = becomeParentOf(parameters);
5716 } 5602 }
5717 5603
5718 void visitChildren(ASTVisitor visitor) { 5604 void visitChildren(AstVisitor visitor) {
5719 safelyVisitChild(_parameters, visitor); 5605 safelyVisitChild(_parameters, visitor);
5720 safelyVisitChild(_body, visitor); 5606 safelyVisitChild(_body, visitor);
5721 } 5607 }
5722 } 5608 }
5723 5609
5724 /** 5610 /**
5725 * Instances of the class `FunctionExpressionInvocation` represent the invocatio n of a 5611 * Instances of the class `FunctionExpressionInvocation` represent the invocatio n of a
5726 * function resulting from evaluating an expression. Invocations of methods and other forms of 5612 * function resulting from evaluating an expression. Invocations of methods and other forms of
5727 * functions are represented by [MethodInvocation] nodes. Invocations of 5613 * functions are represented by [MethodInvocation] nodes. Invocations of
5728 * getters and setters are represented by either [PrefixedIdentifier] or 5614 * getters and setters are represented by either [PrefixedIdentifier] or
5729 * [PropertyAccess] nodes. 5615 * [PropertyAccess] nodes.
5730 * 5616 *
5731 * <pre> 5617 * <pre>
5732 * functionExpressionInvoction ::= 5618 * functionExpressionInvoction ::=
5733 * [Expression] [ArgumentList] 5619 * [Expression] [ArgumentList]
5734 * </pre> 5620 * </pre>
5735 *
5736 * @coverage dart.engine.ast
5737 */ 5621 */
5738 class FunctionExpressionInvocation extends Expression { 5622 class FunctionExpressionInvocation extends Expression {
5739 /** 5623 /**
5740 * The expression producing the function being invoked. 5624 * The expression producing the function being invoked.
5741 */ 5625 */
5742 Expression _function; 5626 Expression _function;
5743 5627
5744 /** 5628 /**
5745 * The list of arguments to the function. 5629 * The list of arguments to the function.
5746 */ 5630 */
(...skipping 15 matching lines...) Expand all
5762 * Initialize a newly created function expression invocation. 5646 * Initialize a newly created function expression invocation.
5763 * 5647 *
5764 * @param function the expression producing the function being invoked 5648 * @param function the expression producing the function being invoked
5765 * @param argumentList the list of arguments to the method 5649 * @param argumentList the list of arguments to the method
5766 */ 5650 */
5767 FunctionExpressionInvocation(Expression function, ArgumentList argumentList) { 5651 FunctionExpressionInvocation(Expression function, ArgumentList argumentList) {
5768 this._function = becomeParentOf(function); 5652 this._function = becomeParentOf(function);
5769 this._argumentList = becomeParentOf(argumentList); 5653 this._argumentList = becomeParentOf(argumentList);
5770 } 5654 }
5771 5655
5772 accept(ASTVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); 5656 accept(AstVisitor visitor) => visitor.visitFunctionExpressionInvocation(this);
5773 5657
5774 /** 5658 /**
5775 * Return the list of arguments to the method. 5659 * Return the list of arguments to the method.
5776 * 5660 *
5777 * @return the list of arguments to the method 5661 * @return the list of arguments to the method
5778 */ 5662 */
5779 ArgumentList get argumentList => _argumentList; 5663 ArgumentList get argumentList => _argumentList;
5780 5664
5781 Token get beginToken => _function.beginToken; 5665 Token get beginToken => _function.beginToken;
5782 5666
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5838 /** 5722 /**
5839 * Set the element associated with the function being invoked based on propaga ted type information 5723 * Set the element associated with the function being invoked based on propaga ted type information
5840 * to the given element. 5724 * to the given element.
5841 * 5725 *
5842 * @param element the element to be associated with the function being invoked 5726 * @param element the element to be associated with the function being invoked
5843 */ 5727 */
5844 void set propagatedElement(ExecutableElement element) { 5728 void set propagatedElement(ExecutableElement element) {
5845 _propagatedElement = element; 5729 _propagatedElement = element;
5846 } 5730 }
5847 5731
5848 void visitChildren(ASTVisitor visitor) { 5732 void visitChildren(AstVisitor visitor) {
5849 safelyVisitChild(_function, visitor); 5733 safelyVisitChild(_function, visitor);
5850 safelyVisitChild(_argumentList, visitor); 5734 safelyVisitChild(_argumentList, visitor);
5851 } 5735 }
5852 } 5736 }
5853 5737
5854 /** 5738 /**
5855 * Instances of the class `FunctionTypeAlias` represent a function type alias. 5739 * Instances of the class `FunctionTypeAlias` represent a function type alias.
5856 * 5740 *
5857 * <pre> 5741 * <pre>
5858 * functionTypeAlias ::= 5742 * functionTypeAlias ::=
5859 * functionPrefix [TypeParameterList]? [FormalParameterList] ';' 5743 * functionPrefix [TypeParameterList]? [FormalParameterList] ';'
5860 * 5744 *
5861 * functionPrefix ::= 5745 * functionPrefix ::=
5862 * [TypeName]? [SimpleIdentifier] 5746 * [TypeName]? [SimpleIdentifier]
5863 * </pre> 5747 * </pre>
5864 *
5865 * @coverage dart.engine.ast
5866 */ 5748 */
5867 class FunctionTypeAlias extends TypeAlias { 5749 class FunctionTypeAlias extends TypeAlias {
5868 /** 5750 /**
5869 * The name of the return type of the function type being defined, or `null` i f no return 5751 * The name of the return type of the function type being defined, or `null` i f no return
5870 * type was given. 5752 * type was given.
5871 */ 5753 */
5872 TypeName _returnType; 5754 TypeName _returnType;
5873 5755
5874 /** 5756 /**
5875 * The name of the function type being declared. 5757 * The name of the function type being declared.
(...skipping 23 matching lines...) Expand all
5899 * @param parameters the parameters associated with the function 5781 * @param parameters the parameters associated with the function
5900 * @param semicolon the semicolon terminating the declaration 5782 * @param semicolon the semicolon terminating the declaration
5901 */ 5783 */
5902 FunctionTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, T ypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, For malParameterList parameters, Token semicolon) : super(comment, metadata, keyword , semicolon) { 5784 FunctionTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, T ypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, For malParameterList parameters, Token semicolon) : super(comment, metadata, keyword , semicolon) {
5903 this._returnType = becomeParentOf(returnType); 5785 this._returnType = becomeParentOf(returnType);
5904 this._name = becomeParentOf(name); 5786 this._name = becomeParentOf(name);
5905 this._typeParameters = becomeParentOf(typeParameters); 5787 this._typeParameters = becomeParentOf(typeParameters);
5906 this._parameters = becomeParentOf(parameters); 5788 this._parameters = becomeParentOf(parameters);
5907 } 5789 }
5908 5790
5909 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); 5791 accept(AstVisitor visitor) => visitor.visitFunctionTypeAlias(this);
5910 5792
5911 FunctionTypeAliasElement get element => _name != null ? (_name.staticElement a s FunctionTypeAliasElement) : null; 5793 FunctionTypeAliasElement get element => _name != null ? (_name.staticElement a s FunctionTypeAliasElement) : null;
5912 5794
5913 /** 5795 /**
5914 * Return the name of the function type being declared. 5796 * Return the name of the function type being declared.
5915 * 5797 *
5916 * @return the name of the function type being declared 5798 * @return the name of the function type being declared
5917 */ 5799 */
5918 SimpleIdentifier get name => _name; 5800 SimpleIdentifier get name => _name;
5919 5801
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5969 5851
5970 /** 5852 /**
5971 * Set the type parameters for the function type to the given list of paramete rs. 5853 * Set the type parameters for the function type to the given list of paramete rs.
5972 * 5854 *
5973 * @param typeParameters the type parameters for the function type 5855 * @param typeParameters the type parameters for the function type
5974 */ 5856 */
5975 void set typeParameters(TypeParameterList typeParameters) { 5857 void set typeParameters(TypeParameterList typeParameters) {
5976 this._typeParameters = becomeParentOf(typeParameters); 5858 this._typeParameters = becomeParentOf(typeParameters);
5977 } 5859 }
5978 5860
5979 void visitChildren(ASTVisitor visitor) { 5861 void visitChildren(AstVisitor visitor) {
5980 super.visitChildren(visitor); 5862 super.visitChildren(visitor);
5981 safelyVisitChild(_returnType, visitor); 5863 safelyVisitChild(_returnType, visitor);
5982 safelyVisitChild(_name, visitor); 5864 safelyVisitChild(_name, visitor);
5983 safelyVisitChild(_typeParameters, visitor); 5865 safelyVisitChild(_typeParameters, visitor);
5984 safelyVisitChild(_parameters, visitor); 5866 safelyVisitChild(_parameters, visitor);
5985 } 5867 }
5986 } 5868 }
5987 5869
5988 /** 5870 /**
5989 * Instances of the class `FunctionTypedFormalParameter` represent a function-ty ped formal 5871 * Instances of the class `FunctionTypedFormalParameter` represent a function-ty ped formal
5990 * parameter. 5872 * parameter.
5991 * 5873 *
5992 * <pre> 5874 * <pre>
5993 * functionSignature ::= 5875 * functionSignature ::=
5994 * [TypeName]? [SimpleIdentifier] [FormalParameterList] 5876 * [TypeName]? [SimpleIdentifier] [FormalParameterList]
5995 * </pre> 5877 * </pre>
5996 *
5997 * @coverage dart.engine.ast
5998 */ 5878 */
5999 class FunctionTypedFormalParameter extends NormalFormalParameter { 5879 class FunctionTypedFormalParameter extends NormalFormalParameter {
6000 /** 5880 /**
6001 * The return type of the function, or `null` if the function does not have a return type. 5881 * The return type of the function, or `null` if the function does not have a return type.
6002 */ 5882 */
6003 TypeName _returnType; 5883 TypeName _returnType;
6004 5884
6005 /** 5885 /**
6006 * The parameters of the function-typed parameter. 5886 * The parameters of the function-typed parameter.
6007 */ 5887 */
6008 FormalParameterList _parameters; 5888 FormalParameterList _parameters;
6009 5889
6010 /** 5890 /**
6011 * Initialize a newly created formal parameter. 5891 * Initialize a newly created formal parameter.
6012 * 5892 *
6013 * @param comment the documentation comment associated with this parameter 5893 * @param comment the documentation comment associated with this parameter
6014 * @param metadata the annotations associated with this parameter 5894 * @param metadata the annotations associated with this parameter
6015 * @param returnType the return type of the function, or `null` if the functio n does not 5895 * @param returnType the return type of the function, or `null` if the functio n does not
6016 * have a return type 5896 * have a return type
6017 * @param identifier the name of the function-typed parameter 5897 * @param identifier the name of the function-typed parameter
6018 * @param parameters the parameters of the function-typed parameter 5898 * @param parameters the parameters of the function-typed parameter
6019 */ 5899 */
6020 FunctionTypedFormalParameter(Comment comment, List<Annotation> metadata, TypeN ame returnType, SimpleIdentifier identifier, FormalParameterList parameters) : s uper(comment, metadata, identifier) { 5900 FunctionTypedFormalParameter(Comment comment, List<Annotation> metadata, TypeN ame returnType, SimpleIdentifier identifier, FormalParameterList parameters) : s uper(comment, metadata, identifier) {
6021 this._returnType = becomeParentOf(returnType); 5901 this._returnType = becomeParentOf(returnType);
6022 this._parameters = becomeParentOf(parameters); 5902 this._parameters = becomeParentOf(parameters);
6023 } 5903 }
6024 5904
6025 accept(ASTVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); 5905 accept(AstVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this);
6026 5906
6027 Token get beginToken { 5907 Token get beginToken {
6028 if (_returnType != null) { 5908 if (_returnType != null) {
6029 return _returnType.beginToken; 5909 return _returnType.beginToken;
6030 } 5910 }
6031 return identifier.beginToken; 5911 return identifier.beginToken;
6032 } 5912 }
6033 5913
6034 Token get endToken => _parameters.endToken; 5914 Token get endToken => _parameters.endToken;
6035 5915
(...skipping 27 matching lines...) Expand all
6063 5943
6064 /** 5944 /**
6065 * Set the return type of the function to the given type. 5945 * Set the return type of the function to the given type.
6066 * 5946 *
6067 * @param returnType the return type of the function 5947 * @param returnType the return type of the function
6068 */ 5948 */
6069 void set returnType(TypeName returnType) { 5949 void set returnType(TypeName returnType) {
6070 this._returnType = becomeParentOf(returnType); 5950 this._returnType = becomeParentOf(returnType);
6071 } 5951 }
6072 5952
6073 void visitChildren(ASTVisitor visitor) { 5953 void visitChildren(AstVisitor visitor) {
6074 super.visitChildren(visitor); 5954 super.visitChildren(visitor);
6075 safelyVisitChild(_returnType, visitor); 5955 safelyVisitChild(_returnType, visitor);
6076 safelyVisitChild(identifier, visitor); 5956 safelyVisitChild(identifier, visitor);
6077 safelyVisitChild(_parameters, visitor); 5957 safelyVisitChild(_parameters, visitor);
6078 } 5958 }
6079 } 5959 }
6080 5960
6081 /** 5961 /**
6082 * Instances of the class `HideCombinator` represent a combinator that restricts the names 5962 * Instances of the class `HideCombinator` represent a combinator that restricts the names
6083 * being imported to those that are not in a given list. 5963 * being imported to those that are not in a given list.
6084 * 5964 *
6085 * <pre> 5965 * <pre>
6086 * hideCombinator ::= 5966 * hideCombinator ::=
6087 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* 5967 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])*
6088 * </pre> 5968 * </pre>
6089 *
6090 * @coverage dart.engine.ast
6091 */ 5969 */
6092 class HideCombinator extends Combinator { 5970 class HideCombinator extends Combinator {
6093 /** 5971 /**
6094 * The list of names from the library that are hidden by this combinator. 5972 * The list of names from the library that are hidden by this combinator.
6095 */ 5973 */
6096 NodeList<SimpleIdentifier> _hiddenNames; 5974 NodeList<SimpleIdentifier> _hiddenNames;
6097 5975
6098 /** 5976 /**
6099 * Initialize a newly created import show combinator. 5977 * Initialize a newly created import show combinator.
6100 * 5978 *
6101 * @param keyword the comma introducing the combinator 5979 * @param keyword the comma introducing the combinator
6102 * @param hiddenNames the list of names from the library that are hidden by th is combinator 5980 * @param hiddenNames the list of names from the library that are hidden by th is combinator
6103 */ 5981 */
6104 HideCombinator(Token keyword, List<SimpleIdentifier> hiddenNames) : super(keyw ord) { 5982 HideCombinator(Token keyword, List<SimpleIdentifier> hiddenNames) : super(keyw ord) {
6105 this._hiddenNames = new NodeList<SimpleIdentifier>(this); 5983 this._hiddenNames = new NodeList<SimpleIdentifier>(this);
6106 this._hiddenNames.addAll(hiddenNames); 5984 this._hiddenNames.addAll(hiddenNames);
6107 } 5985 }
6108 5986
6109 accept(ASTVisitor visitor) => visitor.visitHideCombinator(this); 5987 accept(AstVisitor visitor) => visitor.visitHideCombinator(this);
6110 5988
6111 Token get endToken => _hiddenNames.endToken; 5989 Token get endToken => _hiddenNames.endToken;
6112 5990
6113 /** 5991 /**
6114 * Return the list of names from the library that are hidden by this combinato r. 5992 * Return the list of names from the library that are hidden by this combinato r.
6115 * 5993 *
6116 * @return the list of names from the library that are hidden by this combinat or 5994 * @return the list of names from the library that are hidden by this combinat or
6117 */ 5995 */
6118 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames; 5996 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames;
6119 5997
6120 void visitChildren(ASTVisitor visitor) { 5998 void visitChildren(AstVisitor visitor) {
6121 _hiddenNames.accept(visitor); 5999 _hiddenNames.accept(visitor);
6122 } 6000 }
6123 } 6001 }
6124 6002
6125 /** 6003 /**
6126 * The abstract class `Identifier` defines the behavior common to nodes that rep resent an 6004 * The abstract class `Identifier` defines the behavior common to nodes that rep resent an
6127 * identifier. 6005 * identifier.
6128 * 6006 *
6129 * <pre> 6007 * <pre>
6130 * identifier ::= 6008 * identifier ::=
6131 * [SimpleIdentifier] 6009 * [SimpleIdentifier]
6132 * | [PrefixedIdentifier] 6010 * | [PrefixedIdentifier]
6133 * </pre> 6011 * </pre>
6134 *
6135 * @coverage dart.engine.ast
6136 */ 6012 */
6137 abstract class Identifier extends Expression { 6013 abstract class Identifier extends Expression {
6138 /** 6014 /**
6139 * Return `true` if the given name is visible only within the library in which it is 6015 * Return `true` if the given name is visible only within the library in which it is
6140 * declared. 6016 * declared.
6141 * 6017 *
6142 * @param name the name being tested 6018 * @param name the name being tested
6143 * @return `true` if the given name is private 6019 * @return `true` if the given name is private
6144 */ 6020 */
6145 static bool isPrivateName(String name) => StringUtilities.startsWithChar(name, 0x5F); 6021 static bool isPrivateName(String name) => StringUtilities.startsWithChar(name, 0x5F);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
6184 bool get isAssignable => true; 6060 bool get isAssignable => true;
6185 } 6061 }
6186 6062
6187 /** 6063 /**
6188 * Instances of the class `IfStatement` represent an if statement. 6064 * Instances of the class `IfStatement` represent an if statement.
6189 * 6065 *
6190 * <pre> 6066 * <pre>
6191 * ifStatement ::= 6067 * ifStatement ::=
6192 * 'if' '(' [Expression] ')' [Statement] ('else' [Statement])? 6068 * 'if' '(' [Expression] ')' [Statement] ('else' [Statement])?
6193 * </pre> 6069 * </pre>
6194 *
6195 * @coverage dart.engine.ast
6196 */ 6070 */
6197 class IfStatement extends Statement { 6071 class IfStatement extends Statement {
6198 /** 6072 /**
6199 * The token representing the 'if' keyword. 6073 * The token representing the 'if' keyword.
6200 */ 6074 */
6201 Token ifKeyword; 6075 Token ifKeyword;
6202 6076
6203 /** 6077 /**
6204 * The left parenthesis. 6078 * The left parenthesis.
6205 */ 6079 */
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6241 * @param thenStatement the statement that is executed if the condition evalua tes to `true` 6115 * @param thenStatement the statement that is executed if the condition evalua tes to `true`
6242 * @param elseKeyword the token representing the 'else' keyword 6116 * @param elseKeyword the token representing the 'else' keyword
6243 * @param elseStatement the statement that is executed if the condition evalua tes to `false` 6117 * @param elseStatement the statement that is executed if the condition evalua tes to `false`
6244 */ 6118 */
6245 IfStatement(this.ifKeyword, this.leftParenthesis, Expression condition, this.r ightParenthesis, Statement thenStatement, this.elseKeyword, Statement elseStatem ent) { 6119 IfStatement(this.ifKeyword, this.leftParenthesis, Expression condition, this.r ightParenthesis, Statement thenStatement, this.elseKeyword, Statement elseStatem ent) {
6246 this._condition = becomeParentOf(condition); 6120 this._condition = becomeParentOf(condition);
6247 this._thenStatement = becomeParentOf(thenStatement); 6121 this._thenStatement = becomeParentOf(thenStatement);
6248 this._elseStatement = becomeParentOf(elseStatement); 6122 this._elseStatement = becomeParentOf(elseStatement);
6249 } 6123 }
6250 6124
6251 accept(ASTVisitor visitor) => visitor.visitIfStatement(this); 6125 accept(AstVisitor visitor) => visitor.visitIfStatement(this);
6252 6126
6253 Token get beginToken => ifKeyword; 6127 Token get beginToken => ifKeyword;
6254 6128
6255 /** 6129 /**
6256 * Return the condition used to determine which of the statements is executed next. 6130 * Return the condition used to determine which of the statements is executed next.
6257 * 6131 *
6258 * @return the condition used to determine which statement is executed next 6132 * @return the condition used to determine which statement is executed next
6259 */ 6133 */
6260 Expression get condition => _condition; 6134 Expression get condition => _condition;
6261 6135
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
6304 /** 6178 /**
6305 * Set the statement that is executed if the condition evaluates to `true` to the given 6179 * Set the statement that is executed if the condition evaluates to `true` to the given
6306 * statement. 6180 * statement.
6307 * 6181 *
6308 * @param statement the statement that is executed if the condition evaluates to `true` 6182 * @param statement the statement that is executed if the condition evaluates to `true`
6309 */ 6183 */
6310 void set thenStatement(Statement statement) { 6184 void set thenStatement(Statement statement) {
6311 _thenStatement = becomeParentOf(statement); 6185 _thenStatement = becomeParentOf(statement);
6312 } 6186 }
6313 6187
6314 void visitChildren(ASTVisitor visitor) { 6188 void visitChildren(AstVisitor visitor) {
6315 safelyVisitChild(_condition, visitor); 6189 safelyVisitChild(_condition, visitor);
6316 safelyVisitChild(_thenStatement, visitor); 6190 safelyVisitChild(_thenStatement, visitor);
6317 safelyVisitChild(_elseStatement, visitor); 6191 safelyVisitChild(_elseStatement, visitor);
6318 } 6192 }
6319 } 6193 }
6320 6194
6321 /** 6195 /**
6322 * Instances of the class `ImplementsClause` represent the "implements" clause i n an class 6196 * Instances of the class `ImplementsClause` represent the "implements" clause i n an class
6323 * declaration. 6197 * declaration.
6324 * 6198 *
6325 * <pre> 6199 * <pre>
6326 * implementsClause ::= 6200 * implementsClause ::=
6327 * 'implements' [TypeName] (',' [TypeName])* 6201 * 'implements' [TypeName] (',' [TypeName])*
6328 * </pre> 6202 * </pre>
6329 *
6330 * @coverage dart.engine.ast
6331 */ 6203 */
6332 class ImplementsClause extends ASTNode { 6204 class ImplementsClause extends AstNode {
6333 /** 6205 /**
6334 * The token representing the 'implements' keyword. 6206 * The token representing the 'implements' keyword.
6335 */ 6207 */
6336 Token keyword; 6208 Token keyword;
6337 6209
6338 /** 6210 /**
6339 * The interfaces that are being implemented. 6211 * The interfaces that are being implemented.
6340 */ 6212 */
6341 NodeList<TypeName> _interfaces; 6213 NodeList<TypeName> _interfaces;
6342 6214
6343 /** 6215 /**
6344 * Initialize a newly created implements clause. 6216 * Initialize a newly created implements clause.
6345 * 6217 *
6346 * @param keyword the token representing the 'implements' keyword 6218 * @param keyword the token representing the 'implements' keyword
6347 * @param interfaces the interfaces that are being implemented 6219 * @param interfaces the interfaces that are being implemented
6348 */ 6220 */
6349 ImplementsClause(this.keyword, List<TypeName> interfaces) { 6221 ImplementsClause(this.keyword, List<TypeName> interfaces) {
6350 this._interfaces = new NodeList<TypeName>(this); 6222 this._interfaces = new NodeList<TypeName>(this);
6351 this._interfaces.addAll(interfaces); 6223 this._interfaces.addAll(interfaces);
6352 } 6224 }
6353 6225
6354 accept(ASTVisitor visitor) => visitor.visitImplementsClause(this); 6226 accept(AstVisitor visitor) => visitor.visitImplementsClause(this);
6355 6227
6356 Token get beginToken => keyword; 6228 Token get beginToken => keyword;
6357 6229
6358 Token get endToken => _interfaces.endToken; 6230 Token get endToken => _interfaces.endToken;
6359 6231
6360 /** 6232 /**
6361 * Return the list of the interfaces that are being implemented. 6233 * Return the list of the interfaces that are being implemented.
6362 * 6234 *
6363 * @return the list of the interfaces that are being implemented 6235 * @return the list of the interfaces that are being implemented
6364 */ 6236 */
6365 NodeList<TypeName> get interfaces => _interfaces; 6237 NodeList<TypeName> get interfaces => _interfaces;
6366 6238
6367 void visitChildren(ASTVisitor visitor) { 6239 void visitChildren(AstVisitor visitor) {
6368 _interfaces.accept(visitor); 6240 _interfaces.accept(visitor);
6369 } 6241 }
6370 } 6242 }
6371 6243
6372 /** 6244 /**
6373 * Instances of the class `ImportDirective` represent an import directive. 6245 * Instances of the class `ImportDirective` represent an import directive.
6374 * 6246 *
6375 * <pre> 6247 * <pre>
6376 * importDirective ::= 6248 * importDirective ::=
6377 * [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]* '; ' 6249 * [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]* '; '
6378 * </pre> 6250 * </pre>
6379 *
6380 * @coverage dart.engine.ast
6381 */ 6251 */
6382 class ImportDirective extends NamespaceDirective { 6252 class ImportDirective extends NamespaceDirective {
6383 static Comparator<ImportDirective> COMPARATOR = (ImportDirective import1, Impo rtDirective import2) { 6253 static Comparator<ImportDirective> COMPARATOR = (ImportDirective import1, Impo rtDirective import2) {
6384 // 6254 //
6385 // uri 6255 // uri
6386 // 6256 //
6387 StringLiteral uri1 = import1.uri; 6257 StringLiteral uri1 = import1.uri;
6388 StringLiteral uri2 = import2.uri; 6258 StringLiteral uri2 = import2.uri;
6389 String uriStr1 = uri1.stringValue; 6259 String uriStr1 = uri1.stringValue;
6390 String uriStr2 = uri2.stringValue; 6260 String uriStr2 = uri2.stringValue;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
6491 * @param libraryUri the URI of the library being imported 6361 * @param libraryUri the URI of the library being imported
6492 * @param asToken the token representing the 'as' token 6362 * @param asToken the token representing the 'as' token
6493 * @param prefix the prefix to be used with the imported names 6363 * @param prefix the prefix to be used with the imported names
6494 * @param combinators the combinators used to control how names are imported 6364 * @param combinators the combinators used to control how names are imported
6495 * @param semicolon the semicolon terminating the directive 6365 * @param semicolon the semicolon terminating the directive
6496 */ 6366 */
6497 ImportDirective(Comment comment, List<Annotation> metadata, Token keyword, Str ingLiteral libraryUri, this.asToken, SimpleIdentifier prefix, List<Combinator> c ombinators, Token semicolon) : super(comment, metadata, keyword, libraryUri, com binators, semicolon) { 6367 ImportDirective(Comment comment, List<Annotation> metadata, Token keyword, Str ingLiteral libraryUri, this.asToken, SimpleIdentifier prefix, List<Combinator> c ombinators, Token semicolon) : super(comment, metadata, keyword, libraryUri, com binators, semicolon) {
6498 this._prefix = becomeParentOf(prefix); 6368 this._prefix = becomeParentOf(prefix);
6499 } 6369 }
6500 6370
6501 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); 6371 accept(AstVisitor visitor) => visitor.visitImportDirective(this);
6502 6372
6503 ImportElement get element => super.element as ImportElement; 6373 ImportElement get element => super.element as ImportElement;
6504 6374
6505 /** 6375 /**
6506 * Return the prefix to be used with the imported names, or `null` if the impo rted names are 6376 * Return the prefix to be used with the imported names, or `null` if the impo rted names are
6507 * not prefixed. 6377 * not prefixed.
6508 * 6378 *
6509 * @return the prefix to be used with the imported names 6379 * @return the prefix to be used with the imported names
6510 */ 6380 */
6511 SimpleIdentifier get prefix => _prefix; 6381 SimpleIdentifier get prefix => _prefix;
6512 6382
6513 LibraryElement get uriElement { 6383 LibraryElement get uriElement {
6514 ImportElement element = this.element; 6384 ImportElement element = this.element;
6515 if (element == null) { 6385 if (element == null) {
6516 return null; 6386 return null;
6517 } 6387 }
6518 return element.importedLibrary; 6388 return element.importedLibrary;
6519 } 6389 }
6520 6390
6521 /** 6391 /**
6522 * Set the prefix to be used with the imported names to the given identifier. 6392 * Set the prefix to be used with the imported names to the given identifier.
6523 * 6393 *
6524 * @param prefix the prefix to be used with the imported names 6394 * @param prefix the prefix to be used with the imported names
6525 */ 6395 */
6526 void set prefix(SimpleIdentifier prefix) { 6396 void set prefix(SimpleIdentifier prefix) {
6527 this._prefix = becomeParentOf(prefix); 6397 this._prefix = becomeParentOf(prefix);
6528 } 6398 }
6529 6399
6530 void visitChildren(ASTVisitor visitor) { 6400 void visitChildren(AstVisitor visitor) {
6531 super.visitChildren(visitor); 6401 super.visitChildren(visitor);
6532 safelyVisitChild(_prefix, visitor); 6402 safelyVisitChild(_prefix, visitor);
6533 combinators.accept(visitor); 6403 combinators.accept(visitor);
6534 } 6404 }
6535 } 6405 }
6536 6406
6537 /** 6407 /**
6538 * Instances of the class `IndexExpression` represent an index expression. 6408 * Instances of the class `IndexExpression` represent an index expression.
6539 * 6409 *
6540 * <pre> 6410 * <pre>
6541 * indexExpression ::= 6411 * indexExpression ::=
6542 * [Expression] '[' [Expression] ']' 6412 * [Expression] '[' [Expression] ']'
6543 * </pre> 6413 * </pre>
6544 *
6545 * @coverage dart.engine.ast
6546 */ 6414 */
6547 class IndexExpression extends Expression { 6415 class IndexExpression extends Expression {
6548 /** 6416 /**
6549 * The expression used to compute the object being indexed, or `null` if this index 6417 * The expression used to compute the object being indexed, or `null` if this index
6550 * expression is part of a cascade expression. 6418 * expression is part of a cascade expression.
6551 */ 6419 */
6552 Expression _target; 6420 Expression _target;
6553 6421
6554 /** 6422 /**
6555 * The period ("..") before a cascaded index expression, or `null` if this ind ex expression 6423 * The period ("..") before a cascaded index expression, or `null` if this ind ex expression
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6615 * @param leftBracket the left square bracket 6483 * @param leftBracket the left square bracket
6616 * @param index the expression used to compute the index 6484 * @param index the expression used to compute the index
6617 * @param rightBracket the right square bracket 6485 * @param rightBracket the right square bracket
6618 */ 6486 */
6619 IndexExpression.forCascade(this.period, Token leftBracket, Expression index, T oken rightBracket) { 6487 IndexExpression.forCascade(this.period, Token leftBracket, Expression index, T oken rightBracket) {
6620 this._leftBracket = leftBracket; 6488 this._leftBracket = leftBracket;
6621 this._index = becomeParentOf(index); 6489 this._index = becomeParentOf(index);
6622 this._rightBracket = rightBracket; 6490 this._rightBracket = rightBracket;
6623 } 6491 }
6624 6492
6625 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); 6493 accept(AstVisitor visitor) => visitor.visitIndexExpression(this);
6626 6494
6627 Token get beginToken { 6495 Token get beginToken {
6628 if (_target != null) { 6496 if (_target != null) {
6629 return _target.beginToken; 6497 return _target.beginToken;
6630 } 6498 }
6631 return period; 6499 return period;
6632 } 6500 }
6633 6501
6634 /** 6502 /**
6635 * Return the best element available for this operator. If resolution was able to find a better 6503 * Return the best element available for this operator. If resolution was able to find a better
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6679 * Return the expression used to compute the object being indexed. If this ind ex expression is not 6547 * Return the expression used to compute the object being indexed. If this ind ex expression is not
6680 * part of a cascade expression, then this is the same as [getTarget]. If this index 6548 * part of a cascade expression, then this is the same as [getTarget]. If this index
6681 * expression is part of a cascade expression, then the target expression stor ed with the cascade 6549 * expression is part of a cascade expression, then the target expression stor ed with the cascade
6682 * expression is returned. 6550 * expression is returned.
6683 * 6551 *
6684 * @return the expression used to compute the object being indexed 6552 * @return the expression used to compute the object being indexed
6685 * @see #getTarget() 6553 * @see #getTarget()
6686 */ 6554 */
6687 Expression get realTarget { 6555 Expression get realTarget {
6688 if (isCascaded) { 6556 if (isCascaded) {
6689 ASTNode ancestor = parent; 6557 AstNode ancestor = parent;
6690 while (ancestor is! CascadeExpression) { 6558 while (ancestor is! CascadeExpression) {
6691 if (ancestor == null) { 6559 if (ancestor == null) {
6692 return _target; 6560 return _target;
6693 } 6561 }
6694 ancestor = ancestor.parent; 6562 ancestor = ancestor.parent;
6695 } 6563 }
6696 return (ancestor as CascadeExpression).target; 6564 return (ancestor as CascadeExpression).target;
6697 } 6565 }
6698 return _target; 6566 return _target;
6699 } 6567 }
(...skipping 27 matching lines...) Expand all
6727 /** 6595 /**
6728 * Return `true` if this expression is computing a right-hand value. 6596 * Return `true` if this expression is computing a right-hand value.
6729 * 6597 *
6730 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e 6598 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e
6731 * they mutually exclusive. In other words, it is possible for both methods to return `true` 6599 * they mutually exclusive. In other words, it is possible for both methods to return `true`
6732 * when invoked on the same node. 6600 * when invoked on the same node.
6733 * 6601 *
6734 * @return `true` if this expression is in a context where the operator '[]' w ill be invoked 6602 * @return `true` if this expression is in a context where the operator '[]' w ill be invoked
6735 */ 6603 */
6736 bool inGetterContext() { 6604 bool inGetterContext() {
6737 ASTNode parent = this.parent; 6605 AstNode parent = this.parent;
6738 if (parent is AssignmentExpression) { 6606 if (parent is AssignmentExpression) {
6739 AssignmentExpression assignment = parent; 6607 AssignmentExpression assignment = parent;
6740 if (identical(assignment.leftHandSide, this) && identical(assignment.opera tor.type, TokenType.EQ)) { 6608 if (identical(assignment.leftHandSide, this) && identical(assignment.opera tor.type, TokenType.EQ)) {
6741 return false; 6609 return false;
6742 } 6610 }
6743 } 6611 }
6744 return true; 6612 return true;
6745 } 6613 }
6746 6614
6747 /** 6615 /**
6748 * Return `true` if this expression is computing a left-hand value. 6616 * Return `true` if this expression is computing a left-hand value.
6749 * 6617 *
6750 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e 6618 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e
6751 * they mutually exclusive. In other words, it is possible for both methods to return `true` 6619 * they mutually exclusive. In other words, it is possible for both methods to return `true`
6752 * when invoked on the same node. 6620 * when invoked on the same node.
6753 * 6621 *
6754 * @return `true` if this expression is in a context where the operator '[]=' will be 6622 * @return `true` if this expression is in a context where the operator '[]=' will be
6755 * invoked 6623 * invoked
6756 */ 6624 */
6757 bool inSetterContext() { 6625 bool inSetterContext() {
6758 ASTNode parent = this.parent; 6626 AstNode parent = this.parent;
6759 if (parent is PrefixExpression) { 6627 if (parent is PrefixExpression) {
6760 return parent.operator.type.isIncrementOperator; 6628 return parent.operator.type.isIncrementOperator;
6761 } else if (parent is PostfixExpression) { 6629 } else if (parent is PostfixExpression) {
6762 return true; 6630 return true;
6763 } else if (parent is AssignmentExpression) { 6631 } else if (parent is AssignmentExpression) {
6764 return identical(parent.leftHandSide, this); 6632 return identical(parent.leftHandSide, this);
6765 } 6633 }
6766 return false; 6634 return false;
6767 } 6635 }
6768 6636
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
6826 6694
6827 /** 6695 /**
6828 * Set the expression used to compute the object being indexed to the given ex pression. 6696 * Set the expression used to compute the object being indexed to the given ex pression.
6829 * 6697 *
6830 * @param expression the expression used to compute the object being indexed 6698 * @param expression the expression used to compute the object being indexed
6831 */ 6699 */
6832 void set target(Expression expression) { 6700 void set target(Expression expression) {
6833 _target = becomeParentOf(expression); 6701 _target = becomeParentOf(expression);
6834 } 6702 }
6835 6703
6836 void visitChildren(ASTVisitor visitor) { 6704 void visitChildren(AstVisitor visitor) {
6837 safelyVisitChild(_target, visitor); 6705 safelyVisitChild(_target, visitor);
6838 safelyVisitChild(_index, visitor); 6706 safelyVisitChild(_index, visitor);
6839 } 6707 }
6840 6708
6841 /** 6709 /**
6842 * If the AST structure has been resolved, and the function being invoked is k nown based on 6710 * If the AST structure has been resolved, and the function being invoked is k nown based on
6843 * propagated type information, then return the parameter element representing the parameter to 6711 * propagated type information, then return the parameter element representing the parameter to
6844 * which the value of the index expression will be bound. Otherwise, return `n ull`. 6712 * which the value of the index expression will be bound. Otherwise, return `n ull`.
6845 * 6713 *
6846 * This method is only intended to be used by [Expression#getPropagatedParamet erElement]. 6714 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6882 } 6750 }
6883 6751
6884 /** 6752 /**
6885 * Instances of the class `InstanceCreationExpression` represent an instance cre ation 6753 * Instances of the class `InstanceCreationExpression` represent an instance cre ation
6886 * expression. 6754 * expression.
6887 * 6755 *
6888 * <pre> 6756 * <pre>
6889 * newExpression ::= 6757 * newExpression ::=
6890 * ('new' | 'const') [TypeName] ('.' [SimpleIdentifier])? [ArgumentList] 6758 * ('new' | 'const') [TypeName] ('.' [SimpleIdentifier])? [ArgumentList]
6891 * </pre> 6759 * </pre>
6892 *
6893 * @coverage dart.engine.ast
6894 */ 6760 */
6895 class InstanceCreationExpression extends Expression { 6761 class InstanceCreationExpression extends Expression {
6896 /** 6762 /**
6897 * The keyword used to indicate how an object should be created. 6763 * The keyword used to indicate how an object should be created.
6898 */ 6764 */
6899 Token keyword; 6765 Token keyword;
6900 6766
6901 /** 6767 /**
6902 * The name of the constructor to be invoked. 6768 * The name of the constructor to be invoked.
6903 */ 6769 */
(...skipping 15 matching lines...) Expand all
6919 * 6785 *
6920 * @param keyword the keyword used to indicate how an object should be created 6786 * @param keyword the keyword used to indicate how an object should be created
6921 * @param constructorName the name of the constructor to be invoked 6787 * @param constructorName the name of the constructor to be invoked
6922 * @param argumentList the list of arguments to the constructor 6788 * @param argumentList the list of arguments to the constructor
6923 */ 6789 */
6924 InstanceCreationExpression(this.keyword, ConstructorName constructorName, Argu mentList argumentList) { 6790 InstanceCreationExpression(this.keyword, ConstructorName constructorName, Argu mentList argumentList) {
6925 this.constructorName = becomeParentOf(constructorName); 6791 this.constructorName = becomeParentOf(constructorName);
6926 this._argumentList = becomeParentOf(argumentList); 6792 this._argumentList = becomeParentOf(argumentList);
6927 } 6793 }
6928 6794
6929 accept(ASTVisitor visitor) => visitor.visitInstanceCreationExpression(this); 6795 accept(AstVisitor visitor) => visitor.visitInstanceCreationExpression(this);
6930 6796
6931 /** 6797 /**
6932 * Return the list of arguments to the constructor. 6798 * Return the list of arguments to the constructor.
6933 * 6799 *
6934 * @return the list of arguments to the constructor 6800 * @return the list of arguments to the constructor
6935 */ 6801 */
6936 ArgumentList get argumentList => _argumentList; 6802 ArgumentList get argumentList => _argumentList;
6937 6803
6938 Token get beginToken => keyword; 6804 Token get beginToken => keyword;
6939 6805
(...skipping 10 matching lines...) Expand all
6950 6816
6951 /** 6817 /**
6952 * Set the list of arguments to the constructor to the given list. 6818 * Set the list of arguments to the constructor to the given list.
6953 * 6819 *
6954 * @param argumentList the list of arguments to the constructor 6820 * @param argumentList the list of arguments to the constructor
6955 */ 6821 */
6956 void set argumentList(ArgumentList argumentList) { 6822 void set argumentList(ArgumentList argumentList) {
6957 this._argumentList = becomeParentOf(argumentList); 6823 this._argumentList = becomeParentOf(argumentList);
6958 } 6824 }
6959 6825
6960 void visitChildren(ASTVisitor visitor) { 6826 void visitChildren(AstVisitor visitor) {
6961 safelyVisitChild(constructorName, visitor); 6827 safelyVisitChild(constructorName, visitor);
6962 safelyVisitChild(_argumentList, visitor); 6828 safelyVisitChild(_argumentList, visitor);
6963 } 6829 }
6964 } 6830 }
6965 6831
6966 /** 6832 /**
6967 * Instances of the class `IntegerLiteral` represent an integer literal expressi on. 6833 * Instances of the class `IntegerLiteral` represent an integer literal expressi on.
6968 * 6834 *
6969 * <pre> 6835 * <pre>
6970 * integerLiteral ::= 6836 * integerLiteral ::=
6971 * decimalIntegerLiteral 6837 * decimalIntegerLiteral
6972 * | hexidecimalIntegerLiteral 6838 * | hexidecimalIntegerLiteral
6973 * 6839 *
6974 * decimalIntegerLiteral ::= 6840 * decimalIntegerLiteral ::=
6975 * decimalDigit+ 6841 * decimalDigit+
6976 * 6842 *
6977 * hexidecimalIntegerLiteral ::= 6843 * hexidecimalIntegerLiteral ::=
6978 * '0x' hexidecimalDigit+ 6844 * '0x' hexidecimalDigit+
6979 * | '0X' hexidecimalDigit+ 6845 * | '0X' hexidecimalDigit+
6980 * </pre> 6846 * </pre>
6981 *
6982 * @coverage dart.engine.ast
6983 */ 6847 */
6984 class IntegerLiteral extends Literal { 6848 class IntegerLiteral extends Literal {
6985 /** 6849 /**
6986 * The token representing the literal. 6850 * The token representing the literal.
6987 */ 6851 */
6988 Token literal; 6852 Token literal;
6989 6853
6990 /** 6854 /**
6991 * The value of the literal. 6855 * The value of the literal.
6992 */ 6856 */
6993 int value = 0; 6857 int value = 0;
6994 6858
6995 /** 6859 /**
6996 * Initialize a newly created integer literal. 6860 * Initialize a newly created integer literal.
6997 * 6861 *
6998 * @param literal the token representing the literal 6862 * @param literal the token representing the literal
6999 * @param value the value of the literal 6863 * @param value the value of the literal
7000 */ 6864 */
7001 IntegerLiteral(this.literal, this.value); 6865 IntegerLiteral(this.literal, this.value);
7002 6866
7003 accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this); 6867 accept(AstVisitor visitor) => visitor.visitIntegerLiteral(this);
7004 6868
7005 Token get beginToken => literal; 6869 Token get beginToken => literal;
7006 6870
7007 Token get endToken => literal; 6871 Token get endToken => literal;
7008 6872
7009 void visitChildren(ASTVisitor visitor) { 6873 void visitChildren(AstVisitor visitor) {
7010 } 6874 }
7011 } 6875 }
7012 6876
7013 /** 6877 /**
7014 * The abstract class `InterpolationElement` defines the behavior common to elem ents within a 6878 * The abstract class `InterpolationElement` defines the behavior common to elem ents within a
7015 * [StringInterpolation]. 6879 * [StringInterpolation].
7016 * 6880 *
7017 * <pre> 6881 * <pre>
7018 * interpolationElement ::= 6882 * interpolationElement ::=
7019 * [InterpolationExpression] 6883 * [InterpolationExpression]
7020 * | [InterpolationString] 6884 * | [InterpolationString]
7021 * </pre> 6885 * </pre>
7022 *
7023 * @coverage dart.engine.ast
7024 */ 6886 */
7025 abstract class InterpolationElement extends ASTNode { 6887 abstract class InterpolationElement extends AstNode {
7026 } 6888 }
7027 6889
7028 /** 6890 /**
7029 * Instances of the class `InterpolationExpression` represent an expression embe dded in a 6891 * Instances of the class `InterpolationExpression` represent an expression embe dded in a
7030 * string interpolation. 6892 * string interpolation.
7031 * 6893 *
7032 * <pre> 6894 * <pre>
7033 * interpolationExpression ::= 6895 * interpolationExpression ::=
7034 * '$' [SimpleIdentifier] 6896 * '$' [SimpleIdentifier]
7035 * | '$' '{' [Expression] '}' 6897 * | '$' '{' [Expression] '}'
7036 * </pre> 6898 * </pre>
7037 *
7038 * @coverage dart.engine.ast
7039 */ 6899 */
7040 class InterpolationExpression extends InterpolationElement { 6900 class InterpolationExpression extends InterpolationElement {
7041 /** 6901 /**
7042 * The token used to introduce the interpolation expression; either '$' if the expression is a 6902 * The token used to introduce the interpolation expression; either '$' if the expression is a
7043 * simple identifier or '${' if the expression is a full expression. 6903 * simple identifier or '${' if the expression is a full expression.
7044 */ 6904 */
7045 Token leftBracket; 6905 Token leftBracket;
7046 6906
7047 /** 6907 /**
7048 * The expression to be evaluated for the value to be converted into a string. 6908 * The expression to be evaluated for the value to be converted into a string.
7049 */ 6909 */
7050 Expression _expression; 6910 Expression _expression;
7051 6911
7052 /** 6912 /**
7053 * The right curly bracket, or `null` if the expression is an identifier witho ut brackets. 6913 * The right curly bracket, or `null` if the expression is an identifier witho ut brackets.
7054 */ 6914 */
7055 Token rightBracket; 6915 Token rightBracket;
7056 6916
7057 /** 6917 /**
7058 * Initialize a newly created interpolation expression. 6918 * Initialize a newly created interpolation expression.
7059 * 6919 *
7060 * @param leftBracket the left curly bracket 6920 * @param leftBracket the left curly bracket
7061 * @param expression the expression to be evaluated for the value to be conver ted into a string 6921 * @param expression the expression to be evaluated for the value to be conver ted into a string
7062 * @param rightBracket the right curly bracket 6922 * @param rightBracket the right curly bracket
7063 */ 6923 */
7064 InterpolationExpression(this.leftBracket, Expression expression, this.rightBra cket) { 6924 InterpolationExpression(this.leftBracket, Expression expression, this.rightBra cket) {
7065 this._expression = becomeParentOf(expression); 6925 this._expression = becomeParentOf(expression);
7066 } 6926 }
7067 6927
7068 accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this); 6928 accept(AstVisitor visitor) => visitor.visitInterpolationExpression(this);
7069 6929
7070 Token get beginToken => leftBracket; 6930 Token get beginToken => leftBracket;
7071 6931
7072 Token get endToken { 6932 Token get endToken {
7073 if (rightBracket != null) { 6933 if (rightBracket != null) {
7074 return rightBracket; 6934 return rightBracket;
7075 } 6935 }
7076 return _expression.endToken; 6936 return _expression.endToken;
7077 } 6937 }
7078 6938
7079 /** 6939 /**
7080 * Return the expression to be evaluated for the value to be converted into a string. 6940 * Return the expression to be evaluated for the value to be converted into a string.
7081 * 6941 *
7082 * @return the expression to be evaluated for the value to be converted into a string 6942 * @return the expression to be evaluated for the value to be converted into a string
7083 */ 6943 */
7084 Expression get expression => _expression; 6944 Expression get expression => _expression;
7085 6945
7086 /** 6946 /**
7087 * Set the expression to be evaluated for the value to be converted into a str ing to the given 6947 * Set the expression to be evaluated for the value to be converted into a str ing to the given
7088 * expression. 6948 * expression.
7089 * 6949 *
7090 * @param expression the expression to be evaluated for the value to be conver ted into a string 6950 * @param expression the expression to be evaluated for the value to be conver ted into a string
7091 */ 6951 */
7092 void set expression(Expression expression) { 6952 void set expression(Expression expression) {
7093 this._expression = becomeParentOf(expression); 6953 this._expression = becomeParentOf(expression);
7094 } 6954 }
7095 6955
7096 void visitChildren(ASTVisitor visitor) { 6956 void visitChildren(AstVisitor visitor) {
7097 safelyVisitChild(_expression, visitor); 6957 safelyVisitChild(_expression, visitor);
7098 } 6958 }
7099 } 6959 }
7100 6960
7101 /** 6961 /**
7102 * Instances of the class `InterpolationString` represent a non-empty substring of an 6962 * Instances of the class `InterpolationString` represent a non-empty substring of an
7103 * interpolated string. 6963 * interpolated string.
7104 * 6964 *
7105 * <pre> 6965 * <pre>
7106 * interpolationString ::= 6966 * interpolationString ::=
7107 * characters 6967 * characters
7108 * </pre> 6968 * </pre>
7109 *
7110 * @coverage dart.engine.ast
7111 */ 6969 */
7112 class InterpolationString extends InterpolationElement { 6970 class InterpolationString extends InterpolationElement {
7113 /** 6971 /**
7114 * The characters that will be added to the string. 6972 * The characters that will be added to the string.
7115 */ 6973 */
7116 Token _contents; 6974 Token _contents;
7117 6975
7118 /** 6976 /**
7119 * The value of the literal. 6977 * The value of the literal.
7120 */ 6978 */
7121 String _value; 6979 String _value;
7122 6980
7123 /** 6981 /**
7124 * Initialize a newly created string of characters that are part of a string i nterpolation. 6982 * Initialize a newly created string of characters that are part of a string i nterpolation.
7125 * 6983 *
7126 * @param the characters that will be added to the string 6984 * @param the characters that will be added to the string
7127 * @param value the value of the literal 6985 * @param value the value of the literal
7128 */ 6986 */
7129 InterpolationString(Token contents, String value) { 6987 InterpolationString(Token contents, String value) {
7130 this._contents = contents; 6988 this._contents = contents;
7131 this._value = value; 6989 this._value = value;
7132 } 6990 }
7133 6991
7134 accept(ASTVisitor visitor) => visitor.visitInterpolationString(this); 6992 accept(AstVisitor visitor) => visitor.visitInterpolationString(this);
7135 6993
7136 Token get beginToken => _contents; 6994 Token get beginToken => _contents;
7137 6995
7138 /** 6996 /**
7139 * Return the characters that will be added to the string. 6997 * Return the characters that will be added to the string.
7140 * 6998 *
7141 * @return the characters that will be added to the string 6999 * @return the characters that will be added to the string
7142 */ 7000 */
7143 Token get contents => _contents; 7001 Token get contents => _contents;
7144 7002
(...skipping 17 matching lines...) Expand all
7162 7020
7163 /** 7021 /**
7164 * Set the value of the literal to the given string. 7022 * Set the value of the literal to the given string.
7165 * 7023 *
7166 * @param string the value of the literal 7024 * @param string the value of the literal
7167 */ 7025 */
7168 void set value(String string) { 7026 void set value(String string) {
7169 _value = string; 7027 _value = string;
7170 } 7028 }
7171 7029
7172 void visitChildren(ASTVisitor visitor) { 7030 void visitChildren(AstVisitor visitor) {
7173 } 7031 }
7174 } 7032 }
7175 7033
7176 /** 7034 /**
7177 * Instances of the class `IsExpression` represent an is expression. 7035 * Instances of the class `IsExpression` represent an is expression.
7178 * 7036 *
7179 * <pre> 7037 * <pre>
7180 * isExpression ::= 7038 * isExpression ::=
7181 * [Expression] 'is' '!'? [TypeName] 7039 * [Expression] 'is' '!'? [TypeName]
7182 * </pre> 7040 * </pre>
7183 *
7184 * @coverage dart.engine.ast
7185 */ 7041 */
7186 class IsExpression extends Expression { 7042 class IsExpression extends Expression {
7187 /** 7043 /**
7188 * The expression used to compute the value whose type is being tested. 7044 * The expression used to compute the value whose type is being tested.
7189 */ 7045 */
7190 Expression _expression; 7046 Expression _expression;
7191 7047
7192 /** 7048 /**
7193 * The is operator. 7049 * The is operator.
7194 */ 7050 */
(...skipping 15 matching lines...) Expand all
7210 * @param expression the expression used to compute the value whose type is be ing tested 7066 * @param expression the expression used to compute the value whose type is be ing tested
7211 * @param isOperator the is operator 7067 * @param isOperator the is operator
7212 * @param notOperator the not operator, or `null` if the sense of the test is not negated 7068 * @param notOperator the not operator, or `null` if the sense of the test is not negated
7213 * @param type the name of the type being tested for 7069 * @param type the name of the type being tested for
7214 */ 7070 */
7215 IsExpression(Expression expression, this.isOperator, this.notOperator, TypeNam e type) { 7071 IsExpression(Expression expression, this.isOperator, this.notOperator, TypeNam e type) {
7216 this._expression = becomeParentOf(expression); 7072 this._expression = becomeParentOf(expression);
7217 this._type = becomeParentOf(type); 7073 this._type = becomeParentOf(type);
7218 } 7074 }
7219 7075
7220 accept(ASTVisitor visitor) => visitor.visitIsExpression(this); 7076 accept(AstVisitor visitor) => visitor.visitIsExpression(this);
7221 7077
7222 Token get beginToken => _expression.beginToken; 7078 Token get beginToken => _expression.beginToken;
7223 7079
7224 Token get endToken => _type.endToken; 7080 Token get endToken => _type.endToken;
7225 7081
7226 /** 7082 /**
7227 * Return the expression used to compute the value whose type is being tested. 7083 * Return the expression used to compute the value whose type is being tested.
7228 * 7084 *
7229 * @return the expression used to compute the value whose type is being tested 7085 * @return the expression used to compute the value whose type is being tested
7230 */ 7086 */
(...skipping 20 matching lines...) Expand all
7251 7107
7252 /** 7108 /**
7253 * Set the name of the type being tested for to the given name. 7109 * Set the name of the type being tested for to the given name.
7254 * 7110 *
7255 * @param name the name of the type being tested for 7111 * @param name the name of the type being tested for
7256 */ 7112 */
7257 void set type(TypeName name) { 7113 void set type(TypeName name) {
7258 this._type = becomeParentOf(name); 7114 this._type = becomeParentOf(name);
7259 } 7115 }
7260 7116
7261 void visitChildren(ASTVisitor visitor) { 7117 void visitChildren(AstVisitor visitor) {
7262 safelyVisitChild(_expression, visitor); 7118 safelyVisitChild(_expression, visitor);
7263 safelyVisitChild(_type, visitor); 7119 safelyVisitChild(_type, visitor);
7264 } 7120 }
7265 } 7121 }
7266 7122
7267 /** 7123 /**
7268 * Instances of the class `Label` represent a label. 7124 * Instances of the class `Label` represent a label.
7269 * 7125 *
7270 * <pre> 7126 * <pre>
7271 * label ::= 7127 * label ::=
7272 * [SimpleIdentifier] ':' 7128 * [SimpleIdentifier] ':'
7273 * </pre> 7129 * </pre>
7274 *
7275 * @coverage dart.engine.ast
7276 */ 7130 */
7277 class Label extends ASTNode { 7131 class Label extends AstNode {
7278 /** 7132 /**
7279 * The label being associated with the statement. 7133 * The label being associated with the statement.
7280 */ 7134 */
7281 SimpleIdentifier _label; 7135 SimpleIdentifier _label;
7282 7136
7283 /** 7137 /**
7284 * The colon that separates the label from the statement. 7138 * The colon that separates the label from the statement.
7285 */ 7139 */
7286 Token colon; 7140 Token colon;
7287 7141
7288 /** 7142 /**
7289 * Initialize a newly created label. 7143 * Initialize a newly created label.
7290 * 7144 *
7291 * @param label the label being applied 7145 * @param label the label being applied
7292 * @param colon the colon that separates the label from whatever follows 7146 * @param colon the colon that separates the label from whatever follows
7293 */ 7147 */
7294 Label(SimpleIdentifier label, this.colon) { 7148 Label(SimpleIdentifier label, this.colon) {
7295 this._label = becomeParentOf(label); 7149 this._label = becomeParentOf(label);
7296 } 7150 }
7297 7151
7298 accept(ASTVisitor visitor) => visitor.visitLabel(this); 7152 accept(AstVisitor visitor) => visitor.visitLabel(this);
7299 7153
7300 Token get beginToken => _label.beginToken; 7154 Token get beginToken => _label.beginToken;
7301 7155
7302 Token get endToken => colon; 7156 Token get endToken => colon;
7303 7157
7304 /** 7158 /**
7305 * Return the label being associated with the statement. 7159 * Return the label being associated with the statement.
7306 * 7160 *
7307 * @return the label being associated with the statement 7161 * @return the label being associated with the statement
7308 */ 7162 */
7309 SimpleIdentifier get label => _label; 7163 SimpleIdentifier get label => _label;
7310 7164
7311 /** 7165 /**
7312 * Set the label being associated with the statement to the given label. 7166 * Set the label being associated with the statement to the given label.
7313 * 7167 *
7314 * @param label the label being associated with the statement 7168 * @param label the label being associated with the statement
7315 */ 7169 */
7316 void set label(SimpleIdentifier label) { 7170 void set label(SimpleIdentifier label) {
7317 this._label = becomeParentOf(label); 7171 this._label = becomeParentOf(label);
7318 } 7172 }
7319 7173
7320 void visitChildren(ASTVisitor visitor) { 7174 void visitChildren(AstVisitor visitor) {
7321 safelyVisitChild(_label, visitor); 7175 safelyVisitChild(_label, visitor);
7322 } 7176 }
7323 } 7177 }
7324 7178
7325 /** 7179 /**
7326 * Instances of the class `LabeledStatement` represent a statement that has a la bel associated 7180 * Instances of the class `LabeledStatement` represent a statement that has a la bel associated
7327 * with them. 7181 * with them.
7328 * 7182 *
7329 * <pre> 7183 * <pre>
7330 * labeledStatement ::= 7184 * labeledStatement ::=
7331 * [Label]+ [Statement] 7185 * [Label]+ [Statement]
7332 * </pre> 7186 * </pre>
7333 *
7334 * @coverage dart.engine.ast
7335 */ 7187 */
7336 class LabeledStatement extends Statement { 7188 class LabeledStatement extends Statement {
7337 /** 7189 /**
7338 * The labels being associated with the statement. 7190 * The labels being associated with the statement.
7339 */ 7191 */
7340 NodeList<Label> _labels; 7192 NodeList<Label> _labels;
7341 7193
7342 /** 7194 /**
7343 * The statement with which the labels are being associated. 7195 * The statement with which the labels are being associated.
7344 */ 7196 */
7345 Statement _statement; 7197 Statement _statement;
7346 7198
7347 /** 7199 /**
7348 * Initialize a newly created labeled statement. 7200 * Initialize a newly created labeled statement.
7349 * 7201 *
7350 * @param labels the labels being associated with the statement 7202 * @param labels the labels being associated with the statement
7351 * @param statement the statement with which the labels are being associated 7203 * @param statement the statement with which the labels are being associated
7352 */ 7204 */
7353 LabeledStatement(List<Label> labels, Statement statement) { 7205 LabeledStatement(List<Label> labels, Statement statement) {
7354 this._labels = new NodeList<Label>(this); 7206 this._labels = new NodeList<Label>(this);
7355 this._labels.addAll(labels); 7207 this._labels.addAll(labels);
7356 this._statement = becomeParentOf(statement); 7208 this._statement = becomeParentOf(statement);
7357 } 7209 }
7358 7210
7359 accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this); 7211 accept(AstVisitor visitor) => visitor.visitLabeledStatement(this);
7360 7212
7361 Token get beginToken { 7213 Token get beginToken {
7362 if (!_labels.isEmpty) { 7214 if (!_labels.isEmpty) {
7363 return _labels.beginToken; 7215 return _labels.beginToken;
7364 } 7216 }
7365 return _statement.beginToken; 7217 return _statement.beginToken;
7366 } 7218 }
7367 7219
7368 Token get endToken => _statement.endToken; 7220 Token get endToken => _statement.endToken;
7369 7221
(...skipping 13 matching lines...) Expand all
7383 7235
7384 /** 7236 /**
7385 * Set the statement with which the labels are being associated to the given s tatement. 7237 * Set the statement with which the labels are being associated to the given s tatement.
7386 * 7238 *
7387 * @param statement the statement with which the labels are being associated 7239 * @param statement the statement with which the labels are being associated
7388 */ 7240 */
7389 void set statement(Statement statement) { 7241 void set statement(Statement statement) {
7390 this._statement = becomeParentOf(statement); 7242 this._statement = becomeParentOf(statement);
7391 } 7243 }
7392 7244
7393 void visitChildren(ASTVisitor visitor) { 7245 void visitChildren(AstVisitor visitor) {
7394 _labels.accept(visitor); 7246 _labels.accept(visitor);
7395 safelyVisitChild(_statement, visitor); 7247 safelyVisitChild(_statement, visitor);
7396 } 7248 }
7397 } 7249 }
7398 7250
7399 /** 7251 /**
7400 * Instances of the class `LibraryDirective` represent a library directive. 7252 * Instances of the class `LibraryDirective` represent a library directive.
7401 * 7253 *
7402 * <pre> 7254 * <pre>
7403 * libraryDirective ::= 7255 * libraryDirective ::=
7404 * [Annotation] 'library' [Identifier] ';' 7256 * [Annotation] 'library' [Identifier] ';'
7405 * </pre> 7257 * </pre>
7406 *
7407 * @coverage dart.engine.ast
7408 */ 7258 */
7409 class LibraryDirective extends Directive { 7259 class LibraryDirective extends Directive {
7410 /** 7260 /**
7411 * The token representing the 'library' token. 7261 * The token representing the 'library' token.
7412 */ 7262 */
7413 Token libraryToken; 7263 Token libraryToken;
7414 7264
7415 /** 7265 /**
7416 * The name of the library being defined. 7266 * The name of the library being defined.
7417 */ 7267 */
(...skipping 10 matching lines...) Expand all
7428 * @param comment the documentation comment associated with this directive 7278 * @param comment the documentation comment associated with this directive
7429 * @param metadata the annotations associated with the directive 7279 * @param metadata the annotations associated with the directive
7430 * @param libraryToken the token representing the 'library' token 7280 * @param libraryToken the token representing the 'library' token
7431 * @param name the name of the library being defined 7281 * @param name the name of the library being defined
7432 * @param semicolon the semicolon terminating the directive 7282 * @param semicolon the semicolon terminating the directive
7433 */ 7283 */
7434 LibraryDirective(Comment comment, List<Annotation> metadata, this.libraryToken , LibraryIdentifier name, this.semicolon) : super(comment, metadata) { 7284 LibraryDirective(Comment comment, List<Annotation> metadata, this.libraryToken , LibraryIdentifier name, this.semicolon) : super(comment, metadata) {
7435 this._name = becomeParentOf(name); 7285 this._name = becomeParentOf(name);
7436 } 7286 }
7437 7287
7438 accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this); 7288 accept(AstVisitor visitor) => visitor.visitLibraryDirective(this);
7439 7289
7440 Token get endToken => semicolon; 7290 Token get endToken => semicolon;
7441 7291
7442 Token get keyword => libraryToken; 7292 Token get keyword => libraryToken;
7443 7293
7444 /** 7294 /**
7445 * Return the name of the library being defined. 7295 * Return the name of the library being defined.
7446 * 7296 *
7447 * @return the name of the library being defined 7297 * @return the name of the library being defined
7448 */ 7298 */
7449 LibraryIdentifier get name => _name; 7299 LibraryIdentifier get name => _name;
7450 7300
7451 /** 7301 /**
7452 * Set the name of the library being defined to the given name. 7302 * Set the name of the library being defined to the given name.
7453 * 7303 *
7454 * @param name the name of the library being defined 7304 * @param name the name of the library being defined
7455 */ 7305 */
7456 void set name(LibraryIdentifier name) { 7306 void set name(LibraryIdentifier name) {
7457 this._name = becomeParentOf(name); 7307 this._name = becomeParentOf(name);
7458 } 7308 }
7459 7309
7460 void visitChildren(ASTVisitor visitor) { 7310 void visitChildren(AstVisitor visitor) {
7461 super.visitChildren(visitor); 7311 super.visitChildren(visitor);
7462 safelyVisitChild(_name, visitor); 7312 safelyVisitChild(_name, visitor);
7463 } 7313 }
7464 7314
7465 Token get firstTokenAfterCommentAndMetadata => libraryToken; 7315 Token get firstTokenAfterCommentAndMetadata => libraryToken;
7466 } 7316 }
7467 7317
7468 /** 7318 /**
7469 * Instances of the class `LibraryIdentifier` represent the identifier for a lib rary. 7319 * Instances of the class `LibraryIdentifier` represent the identifier for a lib rary.
7470 * 7320 *
7471 * <pre> 7321 * <pre>
7472 * libraryIdentifier ::= 7322 * libraryIdentifier ::=
7473 * [SimpleIdentifier] ('.' [SimpleIdentifier])* 7323 * [SimpleIdentifier] ('.' [SimpleIdentifier])*
7474 * </pre> 7324 * </pre>
7475 *
7476 * @coverage dart.engine.ast
7477 */ 7325 */
7478 class LibraryIdentifier extends Identifier { 7326 class LibraryIdentifier extends Identifier {
7479 /** 7327 /**
7480 * The components of the identifier. 7328 * The components of the identifier.
7481 */ 7329 */
7482 NodeList<SimpleIdentifier> _components; 7330 NodeList<SimpleIdentifier> _components;
7483 7331
7484 /** 7332 /**
7485 * Initialize a newly created prefixed identifier. 7333 * Initialize a newly created prefixed identifier.
7486 * 7334 *
7487 * @param components the components of the identifier 7335 * @param components the components of the identifier
7488 */ 7336 */
7489 LibraryIdentifier(List<SimpleIdentifier> components) { 7337 LibraryIdentifier(List<SimpleIdentifier> components) {
7490 this._components = new NodeList<SimpleIdentifier>(this); 7338 this._components = new NodeList<SimpleIdentifier>(this);
7491 this._components.addAll(components); 7339 this._components.addAll(components);
7492 } 7340 }
7493 7341
7494 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); 7342 accept(AstVisitor visitor) => visitor.visitLibraryIdentifier(this);
7495 7343
7496 Token get beginToken => _components.beginToken; 7344 Token get beginToken => _components.beginToken;
7497 7345
7498 Element get bestElement => staticElement; 7346 Element get bestElement => staticElement;
7499 7347
7500 /** 7348 /**
7501 * Return the components of the identifier. 7349 * Return the components of the identifier.
7502 * 7350 *
7503 * @return the components of the identifier 7351 * @return the components of the identifier
7504 */ 7352 */
(...skipping 14 matching lines...) Expand all
7519 } 7367 }
7520 return builder.toString(); 7368 return builder.toString();
7521 } 7369 }
7522 7370
7523 int get precedence => 15; 7371 int get precedence => 15;
7524 7372
7525 Element get propagatedElement => null; 7373 Element get propagatedElement => null;
7526 7374
7527 Element get staticElement => null; 7375 Element get staticElement => null;
7528 7376
7529 void visitChildren(ASTVisitor visitor) { 7377 void visitChildren(AstVisitor visitor) {
7530 _components.accept(visitor); 7378 _components.accept(visitor);
7531 } 7379 }
7532 } 7380 }
7533 7381
7534 /** 7382 /**
7535 * Instances of the class `ListLiteral` represent a list literal. 7383 * Instances of the class `ListLiteral` represent a list literal.
7536 * 7384 *
7537 * <pre> 7385 * <pre>
7538 * listLiteral ::= 7386 * listLiteral ::=
7539 * 'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']' 7387 * 'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']'
7540 * </pre> 7388 * </pre>
7541 *
7542 * @coverage dart.engine.ast
7543 */ 7389 */
7544 class ListLiteral extends TypedLiteral { 7390 class ListLiteral extends TypedLiteral {
7545 /** 7391 /**
7546 * The left square bracket. 7392 * The left square bracket.
7547 */ 7393 */
7548 Token _leftBracket; 7394 Token _leftBracket;
7549 7395
7550 /** 7396 /**
7551 * The expressions used to compute the elements of the list. 7397 * The expressions used to compute the elements of the list.
7552 */ 7398 */
(...skipping 14 matching lines...) Expand all
7567 * @param elements the expressions used to compute the elements of the list 7413 * @param elements the expressions used to compute the elements of the list
7568 * @param rightBracket the right square bracket 7414 * @param rightBracket the right square bracket
7569 */ 7415 */
7570 ListLiteral(Token constKeyword, TypeArgumentList typeArguments, Token leftBrac ket, List<Expression> elements, Token rightBracket) : super(constKeyword, typeAr guments) { 7416 ListLiteral(Token constKeyword, TypeArgumentList typeArguments, Token leftBrac ket, List<Expression> elements, Token rightBracket) : super(constKeyword, typeAr guments) {
7571 this._elements = new NodeList<Expression>(this); 7417 this._elements = new NodeList<Expression>(this);
7572 this._leftBracket = leftBracket; 7418 this._leftBracket = leftBracket;
7573 this._elements.addAll(elements); 7419 this._elements.addAll(elements);
7574 this._rightBracket = rightBracket; 7420 this._rightBracket = rightBracket;
7575 } 7421 }
7576 7422
7577 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); 7423 accept(AstVisitor visitor) => visitor.visitListLiteral(this);
7578 7424
7579 Token get beginToken { 7425 Token get beginToken {
7580 Token token = constKeyword; 7426 Token token = constKeyword;
7581 if (token != null) { 7427 if (token != null) {
7582 return token; 7428 return token;
7583 } 7429 }
7584 TypeArgumentList typeArguments = this.typeArguments; 7430 TypeArgumentList typeArguments = this.typeArguments;
7585 if (typeArguments != null) { 7431 if (typeArguments != null) {
7586 return typeArguments.beginToken; 7432 return typeArguments.beginToken;
7587 } 7433 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
7622 7468
7623 /** 7469 /**
7624 * Set the right square bracket to the given token. 7470 * Set the right square bracket to the given token.
7625 * 7471 *
7626 * @param bracket the right square bracket 7472 * @param bracket the right square bracket
7627 */ 7473 */
7628 void set rightBracket(Token bracket) { 7474 void set rightBracket(Token bracket) {
7629 _rightBracket = bracket; 7475 _rightBracket = bracket;
7630 } 7476 }
7631 7477
7632 void visitChildren(ASTVisitor visitor) { 7478 void visitChildren(AstVisitor visitor) {
7633 super.visitChildren(visitor); 7479 super.visitChildren(visitor);
7634 _elements.accept(visitor); 7480 _elements.accept(visitor);
7635 } 7481 }
7636 } 7482 }
7637 7483
7638 /** 7484 /**
7639 * The abstract class `Literal` defines the behavior common to nodes that repres ent a literal 7485 * The abstract class `Literal` defines the behavior common to nodes that repres ent a literal
7640 * expression. 7486 * expression.
7641 * 7487 *
7642 * <pre> 7488 * <pre>
7643 * literal ::= 7489 * literal ::=
7644 * [BooleanLiteral] 7490 * [BooleanLiteral]
7645 * | [DoubleLiteral] 7491 * | [DoubleLiteral]
7646 * | [IntegerLiteral] 7492 * | [IntegerLiteral]
7647 * | [ListLiteral] 7493 * | [ListLiteral]
7648 * | [MapLiteral] 7494 * | [MapLiteral]
7649 * | [NullLiteral] 7495 * | [NullLiteral]
7650 * | [StringLiteral] 7496 * | [StringLiteral]
7651 * </pre> 7497 * </pre>
7652 *
7653 * @coverage dart.engine.ast
7654 */ 7498 */
7655 abstract class Literal extends Expression { 7499 abstract class Literal extends Expression {
7656 int get precedence => 16; 7500 int get precedence => 16;
7657 } 7501 }
7658 7502
7659 /** 7503 /**
7660 * Instances of the class `MapLiteral` represent a literal map. 7504 * Instances of the class `MapLiteral` represent a literal map.
7661 * 7505 *
7662 * <pre> 7506 * <pre>
7663 * mapLiteral ::= 7507 * mapLiteral ::=
7664 * 'const'? ('<' [TypeName] (',' [TypeName])* '>')? '{' ([MapLiteralEntry] ( ',' [MapLiteralEntry])* ','?)? '}' 7508 * 'const'? ('<' [TypeName] (',' [TypeName])* '>')? '{' ([MapLiteralEntry] ( ',' [MapLiteralEntry])* ','?)? '}'
7665 * </pre> 7509 * </pre>
7666 *
7667 * @coverage dart.engine.ast
7668 */ 7510 */
7669 class MapLiteral extends TypedLiteral { 7511 class MapLiteral extends TypedLiteral {
7670 /** 7512 /**
7671 * The left curly bracket. 7513 * The left curly bracket.
7672 */ 7514 */
7673 Token _leftBracket; 7515 Token _leftBracket;
7674 7516
7675 /** 7517 /**
7676 * The entries in the map. 7518 * The entries in the map.
7677 */ 7519 */
(...skipping 14 matching lines...) Expand all
7692 * @param entries the entries in the map 7534 * @param entries the entries in the map
7693 * @param rightBracket the right curly bracket 7535 * @param rightBracket the right curly bracket
7694 */ 7536 */
7695 MapLiteral(Token constKeyword, TypeArgumentList typeArguments, Token leftBrack et, List<MapLiteralEntry> entries, Token rightBracket) : super(constKeyword, typ eArguments) { 7537 MapLiteral(Token constKeyword, TypeArgumentList typeArguments, Token leftBrack et, List<MapLiteralEntry> entries, Token rightBracket) : super(constKeyword, typ eArguments) {
7696 this._entries = new NodeList<MapLiteralEntry>(this); 7538 this._entries = new NodeList<MapLiteralEntry>(this);
7697 this._leftBracket = leftBracket; 7539 this._leftBracket = leftBracket;
7698 this._entries.addAll(entries); 7540 this._entries.addAll(entries);
7699 this._rightBracket = rightBracket; 7541 this._rightBracket = rightBracket;
7700 } 7542 }
7701 7543
7702 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); 7544 accept(AstVisitor visitor) => visitor.visitMapLiteral(this);
7703 7545
7704 Token get beginToken { 7546 Token get beginToken {
7705 Token token = constKeyword; 7547 Token token = constKeyword;
7706 if (token != null) { 7548 if (token != null) {
7707 return token; 7549 return token;
7708 } 7550 }
7709 TypeArgumentList typeArguments = this.typeArguments; 7551 TypeArgumentList typeArguments = this.typeArguments;
7710 if (typeArguments != null) { 7552 if (typeArguments != null) {
7711 return typeArguments.beginToken; 7553 return typeArguments.beginToken;
7712 } 7554 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
7747 7589
7748 /** 7590 /**
7749 * Set the right curly bracket to the given token. 7591 * Set the right curly bracket to the given token.
7750 * 7592 *
7751 * @param bracket the right curly bracket 7593 * @param bracket the right curly bracket
7752 */ 7594 */
7753 void set rightBracket(Token bracket) { 7595 void set rightBracket(Token bracket) {
7754 _rightBracket = bracket; 7596 _rightBracket = bracket;
7755 } 7597 }
7756 7598
7757 void visitChildren(ASTVisitor visitor) { 7599 void visitChildren(AstVisitor visitor) {
7758 super.visitChildren(visitor); 7600 super.visitChildren(visitor);
7759 _entries.accept(visitor); 7601 _entries.accept(visitor);
7760 } 7602 }
7761 } 7603 }
7762 7604
7763 /** 7605 /**
7764 * Instances of the class `MapLiteralEntry` represent a single key/value pair in a map 7606 * Instances of the class `MapLiteralEntry` represent a single key/value pair in a map
7765 * literal. 7607 * literal.
7766 * 7608 *
7767 * <pre> 7609 * <pre>
7768 * mapLiteralEntry ::= 7610 * mapLiteralEntry ::=
7769 * [Expression] ':' [Expression] 7611 * [Expression] ':' [Expression]
7770 * </pre> 7612 * </pre>
7771 *
7772 * @coverage dart.engine.ast
7773 */ 7613 */
7774 class MapLiteralEntry extends ASTNode { 7614 class MapLiteralEntry extends AstNode {
7775 /** 7615 /**
7776 * The expression computing the key with which the value will be associated. 7616 * The expression computing the key with which the value will be associated.
7777 */ 7617 */
7778 Expression _key; 7618 Expression _key;
7779 7619
7780 /** 7620 /**
7781 * The colon that separates the key from the value. 7621 * The colon that separates the key from the value.
7782 */ 7622 */
7783 Token separator; 7623 Token separator;
7784 7624
7785 /** 7625 /**
7786 * The expression computing the value that will be associated with the key. 7626 * The expression computing the value that will be associated with the key.
7787 */ 7627 */
7788 Expression _value; 7628 Expression _value;
7789 7629
7790 /** 7630 /**
7791 * Initialize a newly created map literal entry. 7631 * Initialize a newly created map literal entry.
7792 * 7632 *
7793 * @param key the expression computing the key with which the value will be as sociated 7633 * @param key the expression computing the key with which the value will be as sociated
7794 * @param separator the colon that separates the key from the value 7634 * @param separator the colon that separates the key from the value
7795 * @param value the expression computing the value that will be associated wit h the key 7635 * @param value the expression computing the value that will be associated wit h the key
7796 */ 7636 */
7797 MapLiteralEntry(Expression key, this.separator, Expression value) { 7637 MapLiteralEntry(Expression key, this.separator, Expression value) {
7798 this._key = becomeParentOf(key); 7638 this._key = becomeParentOf(key);
7799 this._value = becomeParentOf(value); 7639 this._value = becomeParentOf(value);
7800 } 7640 }
7801 7641
7802 accept(ASTVisitor visitor) => visitor.visitMapLiteralEntry(this); 7642 accept(AstVisitor visitor) => visitor.visitMapLiteralEntry(this);
7803 7643
7804 Token get beginToken => _key.beginToken; 7644 Token get beginToken => _key.beginToken;
7805 7645
7806 Token get endToken => _value.endToken; 7646 Token get endToken => _value.endToken;
7807 7647
7808 /** 7648 /**
7809 * Return the expression computing the key with which the value will be associ ated. 7649 * Return the expression computing the key with which the value will be associ ated.
7810 * 7650 *
7811 * @return the expression computing the key with which the value will be assoc iated 7651 * @return the expression computing the key with which the value will be assoc iated
7812 */ 7652 */
(...skipping 19 matching lines...) Expand all
7832 /** 7672 /**
7833 * Set the expression computing the value that will be associated with the key to the given 7673 * Set the expression computing the value that will be associated with the key to the given
7834 * expression. 7674 * expression.
7835 * 7675 *
7836 * @param expression the expression computing the value that will be associate d with the key 7676 * @param expression the expression computing the value that will be associate d with the key
7837 */ 7677 */
7838 void set value(Expression expression) { 7678 void set value(Expression expression) {
7839 _value = becomeParentOf(expression); 7679 _value = becomeParentOf(expression);
7840 } 7680 }
7841 7681
7842 void visitChildren(ASTVisitor visitor) { 7682 void visitChildren(AstVisitor visitor) {
7843 safelyVisitChild(_key, visitor); 7683 safelyVisitChild(_key, visitor);
7844 safelyVisitChild(_value, visitor); 7684 safelyVisitChild(_value, visitor);
7845 } 7685 }
7846 } 7686 }
7847 7687
7848 /** 7688 /**
7849 * Instances of the class `MethodDeclaration` represent a method declaration. 7689 * Instances of the class `MethodDeclaration` represent a method declaration.
7850 * 7690 *
7851 * <pre> 7691 * <pre>
7852 * methodDeclaration ::= 7692 * methodDeclaration ::=
7853 * methodSignature [FunctionBody] 7693 * methodSignature [FunctionBody]
7854 * 7694 *
7855 * methodSignature ::= 7695 * methodSignature ::=
7856 * 'external'? ('abstract' | 'static')? [Type]? ('get' | 'set')? methodName 7696 * 'external'? ('abstract' | 'static')? [Type]? ('get' | 'set')? methodName
7857 * [FormalParameterList] 7697 * [FormalParameterList]
7858 * 7698 *
7859 * methodName ::= 7699 * methodName ::=
7860 * [SimpleIdentifier] 7700 * [SimpleIdentifier]
7861 * | 'operator' [SimpleIdentifier] 7701 * | 'operator' [SimpleIdentifier]
7862 * </pre> 7702 * </pre>
7863 *
7864 * @coverage dart.engine.ast
7865 */ 7703 */
7866 class MethodDeclaration extends ClassMember { 7704 class MethodDeclaration extends ClassMember {
7867 /** 7705 /**
7868 * The token for the 'external' keyword, or `null` if the constructor is not e xternal. 7706 * The token for the 'external' keyword, or `null` if the constructor is not e xternal.
7869 */ 7707 */
7870 Token externalKeyword; 7708 Token externalKeyword;
7871 7709
7872 /** 7710 /**
7873 * The token representing the 'abstract' or 'static' keyword, or `null` if nei ther modifier 7711 * The token representing the 'abstract' or 'static' keyword, or `null` if nei ther modifier
7874 * was specified. 7712 * was specified.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
7922 * declares a getter 7760 * declares a getter
7923 * @param body the body of the method 7761 * @param body the body of the method
7924 */ 7762 */
7925 MethodDeclaration(Comment comment, List<Annotation> metadata, this.externalKey word, this.modifierKeyword, TypeName returnType, this.propertyKeyword, this.oper atorKeyword, SimpleIdentifier name, FormalParameterList parameters, FunctionBody body) : super(comment, metadata) { 7763 MethodDeclaration(Comment comment, List<Annotation> metadata, this.externalKey word, this.modifierKeyword, TypeName returnType, this.propertyKeyword, this.oper atorKeyword, SimpleIdentifier name, FormalParameterList parameters, FunctionBody body) : super(comment, metadata) {
7926 this._returnType = becomeParentOf(returnType); 7764 this._returnType = becomeParentOf(returnType);
7927 this._name = becomeParentOf(name); 7765 this._name = becomeParentOf(name);
7928 this._parameters = becomeParentOf(parameters); 7766 this._parameters = becomeParentOf(parameters);
7929 this._body = becomeParentOf(body); 7767 this._body = becomeParentOf(body);
7930 } 7768 }
7931 7769
7932 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); 7770 accept(AstVisitor visitor) => visitor.visitMethodDeclaration(this);
7933 7771
7934 /** 7772 /**
7935 * Return the body of the method. 7773 * Return the body of the method.
7936 * 7774 *
7937 * @return the body of the method 7775 * @return the body of the method
7938 */ 7776 */
7939 FunctionBody get body => _body; 7777 FunctionBody get body => _body;
7940 7778
7941 /** 7779 /**
7942 * Return the element associated with this method, or `null` if the AST struct ure has not 7780 * Return the element associated with this method, or `null` if the AST struct ure has not
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
8036 7874
8037 /** 7875 /**
8038 * Set the return type of the method to the given type name. 7876 * Set the return type of the method to the given type name.
8039 * 7877 *
8040 * @param typeName the return type of the method 7878 * @param typeName the return type of the method
8041 */ 7879 */
8042 void set returnType(TypeName typeName) { 7880 void set returnType(TypeName typeName) {
8043 _returnType = becomeParentOf(typeName); 7881 _returnType = becomeParentOf(typeName);
8044 } 7882 }
8045 7883
8046 void visitChildren(ASTVisitor visitor) { 7884 void visitChildren(AstVisitor visitor) {
8047 super.visitChildren(visitor); 7885 super.visitChildren(visitor);
8048 safelyVisitChild(_returnType, visitor); 7886 safelyVisitChild(_returnType, visitor);
8049 safelyVisitChild(_name, visitor); 7887 safelyVisitChild(_name, visitor);
8050 safelyVisitChild(_parameters, visitor); 7888 safelyVisitChild(_parameters, visitor);
8051 safelyVisitChild(_body, visitor); 7889 safelyVisitChild(_body, visitor);
8052 } 7890 }
8053 7891
8054 Token get firstTokenAfterCommentAndMetadata { 7892 Token get firstTokenAfterCommentAndMetadata {
8055 if (modifierKeyword != null) { 7893 if (modifierKeyword != null) {
8056 return modifierKeyword; 7894 return modifierKeyword;
(...skipping 12 matching lines...) Expand all
8069 * Instances of the class `MethodInvocation` represent the invocation of either a function or 7907 * Instances of the class `MethodInvocation` represent the invocation of either a function or
8070 * a method. Invocations of functions resulting from evaluating an expression ar e represented by 7908 * a method. Invocations of functions resulting from evaluating an expression ar e represented by
8071 * [FunctionExpressionInvocation] nodes. Invocations of getters 7909 * [FunctionExpressionInvocation] nodes. Invocations of getters
8072 * and setters are represented by either [PrefixedIdentifier] or 7910 * and setters are represented by either [PrefixedIdentifier] or
8073 * [PropertyAccess] nodes. 7911 * [PropertyAccess] nodes.
8074 * 7912 *
8075 * <pre> 7913 * <pre>
8076 * methodInvoction ::= 7914 * methodInvoction ::=
8077 * ([Expression] '.')? [SimpleIdentifier] [ArgumentList] 7915 * ([Expression] '.')? [SimpleIdentifier] [ArgumentList]
8078 * </pre> 7916 * </pre>
8079 *
8080 * @coverage dart.engine.ast
8081 */ 7917 */
8082 class MethodInvocation extends Expression { 7918 class MethodInvocation extends Expression {
8083 /** 7919 /**
8084 * The expression producing the object on which the method is defined, or `nul l` if there is 7920 * The expression producing the object on which the method is defined, or `nul l` if there is
8085 * no target (that is, the target is implicitly `this`). 7921 * no target (that is, the target is implicitly `this`).
8086 */ 7922 */
8087 Expression _target; 7923 Expression _target;
8088 7924
8089 /** 7925 /**
8090 * The period that separates the target from the method name, or `null` if the re is no 7926 * The period that separates the target from the method name, or `null` if the re is no
(...skipping 18 matching lines...) Expand all
8109 * @param period the period that separates the target from the method name 7945 * @param period the period that separates the target from the method name
8110 * @param methodName the name of the method being invoked 7946 * @param methodName the name of the method being invoked
8111 * @param argumentList the list of arguments to the method 7947 * @param argumentList the list of arguments to the method
8112 */ 7948 */
8113 MethodInvocation(Expression target, this.period, SimpleIdentifier methodName, ArgumentList argumentList) { 7949 MethodInvocation(Expression target, this.period, SimpleIdentifier methodName, ArgumentList argumentList) {
8114 this._target = becomeParentOf(target); 7950 this._target = becomeParentOf(target);
8115 this._methodName = becomeParentOf(methodName); 7951 this._methodName = becomeParentOf(methodName);
8116 this._argumentList = becomeParentOf(argumentList); 7952 this._argumentList = becomeParentOf(argumentList);
8117 } 7953 }
8118 7954
8119 accept(ASTVisitor visitor) => visitor.visitMethodInvocation(this); 7955 accept(AstVisitor visitor) => visitor.visitMethodInvocation(this);
8120 7956
8121 /** 7957 /**
8122 * Return the list of arguments to the method. 7958 * Return the list of arguments to the method.
8123 * 7959 *
8124 * @return the list of arguments to the method 7960 * @return the list of arguments to the method
8125 */ 7961 */
8126 ArgumentList get argumentList => _argumentList; 7962 ArgumentList get argumentList => _argumentList;
8127 7963
8128 Token get beginToken { 7964 Token get beginToken {
8129 if (_target != null) { 7965 if (_target != null) {
(...skipping 19 matching lines...) Expand all
8149 * Return the expression used to compute the receiver of the invocation. If th is invocation is not 7985 * Return the expression used to compute the receiver of the invocation. If th is invocation is not
8150 * part of a cascade expression, then this is the same as [getTarget]. If this invocation 7986 * part of a cascade expression, then this is the same as [getTarget]. If this invocation
8151 * is part of a cascade expression, then the target stored with the cascade ex pression is 7987 * is part of a cascade expression, then the target stored with the cascade ex pression is
8152 * returned. 7988 * returned.
8153 * 7989 *
8154 * @return the expression used to compute the receiver of the invocation 7990 * @return the expression used to compute the receiver of the invocation
8155 * @see #getTarget() 7991 * @see #getTarget()
8156 */ 7992 */
8157 Expression get realTarget { 7993 Expression get realTarget {
8158 if (isCascaded) { 7994 if (isCascaded) {
8159 ASTNode ancestor = parent; 7995 AstNode ancestor = parent;
8160 while (ancestor is! CascadeExpression) { 7996 while (ancestor is! CascadeExpression) {
8161 if (ancestor == null) { 7997 if (ancestor == null) {
8162 return _target; 7998 return _target;
8163 } 7999 }
8164 ancestor = ancestor.parent; 8000 ancestor = ancestor.parent;
8165 } 8001 }
8166 return (ancestor as CascadeExpression).target; 8002 return (ancestor as CascadeExpression).target;
8167 } 8003 }
8168 return _target; 8004 return _target;
8169 } 8005 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
8207 8043
8208 /** 8044 /**
8209 * Set the expression producing the object on which the method is defined to t he given expression. 8045 * Set the expression producing the object on which the method is defined to t he given expression.
8210 * 8046 *
8211 * @param expression the expression producing the object on which the method i s defined 8047 * @param expression the expression producing the object on which the method i s defined
8212 */ 8048 */
8213 void set target(Expression expression) { 8049 void set target(Expression expression) {
8214 _target = becomeParentOf(expression); 8050 _target = becomeParentOf(expression);
8215 } 8051 }
8216 8052
8217 void visitChildren(ASTVisitor visitor) { 8053 void visitChildren(AstVisitor visitor) {
8218 safelyVisitChild(_target, visitor); 8054 safelyVisitChild(_target, visitor);
8219 safelyVisitChild(_methodName, visitor); 8055 safelyVisitChild(_methodName, visitor);
8220 safelyVisitChild(_argumentList, visitor); 8056 safelyVisitChild(_argumentList, visitor);
8221 } 8057 }
8222 } 8058 }
8223 8059
8224 /** 8060 /**
8225 * Instances of the class `NamedExpression` represent an expression that has a n ame associated 8061 * Instances of the class `NamedExpression` represent an expression that has a n ame associated
8226 * with it. They are used in method invocations when there are named parameters. 8062 * with it. They are used in method invocations when there are named parameters.
8227 * 8063 *
8228 * <pre> 8064 * <pre>
8229 * namedExpression ::= 8065 * namedExpression ::=
8230 * [Label] [Expression] 8066 * [Label] [Expression]
8231 * </pre> 8067 * </pre>
8232 *
8233 * @coverage dart.engine.ast
8234 */ 8068 */
8235 class NamedExpression extends Expression { 8069 class NamedExpression extends Expression {
8236 /** 8070 /**
8237 * The name associated with the expression. 8071 * The name associated with the expression.
8238 */ 8072 */
8239 Label _name; 8073 Label _name;
8240 8074
8241 /** 8075 /**
8242 * The expression with which the name is associated. 8076 * The expression with which the name is associated.
8243 */ 8077 */
8244 Expression _expression; 8078 Expression _expression;
8245 8079
8246 /** 8080 /**
8247 * Initialize a newly created named expression. 8081 * Initialize a newly created named expression.
8248 * 8082 *
8249 * @param name the name associated with the expression 8083 * @param name the name associated with the expression
8250 * @param expression the expression with which the name is associated 8084 * @param expression the expression with which the name is associated
8251 */ 8085 */
8252 NamedExpression(Label name, Expression expression) { 8086 NamedExpression(Label name, Expression expression) {
8253 this._name = becomeParentOf(name); 8087 this._name = becomeParentOf(name);
8254 this._expression = becomeParentOf(expression); 8088 this._expression = becomeParentOf(expression);
8255 } 8089 }
8256 8090
8257 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); 8091 accept(AstVisitor visitor) => visitor.visitNamedExpression(this);
8258 8092
8259 Token get beginToken => _name.beginToken; 8093 Token get beginToken => _name.beginToken;
8260 8094
8261 /** 8095 /**
8262 * Return the element representing the parameter being named by this expressio n, or `null` 8096 * Return the element representing the parameter being named by this expressio n, or `null`
8263 * if the AST structure has not been resolved or if there is no parameter with the same name as 8097 * if the AST structure has not been resolved or if there is no parameter with the same name as
8264 * this expression. 8098 * this expression.
8265 * 8099 *
8266 * @return the element representing the parameter being named by this expressi on 8100 * @return the element representing the parameter being named by this expressi on
8267 */ 8101 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
8302 8136
8303 /** 8137 /**
8304 * Set the name associated with the expression to the given identifier. 8138 * Set the name associated with the expression to the given identifier.
8305 * 8139 *
8306 * @param identifier the name associated with the expression 8140 * @param identifier the name associated with the expression
8307 */ 8141 */
8308 void set name(Label identifier) { 8142 void set name(Label identifier) {
8309 _name = becomeParentOf(identifier); 8143 _name = becomeParentOf(identifier);
8310 } 8144 }
8311 8145
8312 void visitChildren(ASTVisitor visitor) { 8146 void visitChildren(AstVisitor visitor) {
8313 safelyVisitChild(_name, visitor); 8147 safelyVisitChild(_name, visitor);
8314 safelyVisitChild(_expression, visitor); 8148 safelyVisitChild(_expression, visitor);
8315 } 8149 }
8316 } 8150 }
8317 8151
8318 /** 8152 /**
8319 * The abstract class `NamespaceDirective` defines the behavior common to nodes that represent 8153 * The abstract class `NamespaceDirective` defines the behavior common to nodes that represent
8320 * a directive that impacts the namespace of a library. 8154 * a directive that impacts the namespace of a library.
8321 * 8155 *
8322 * <pre> 8156 * <pre>
8323 * directive ::= 8157 * directive ::=
8324 * [ExportDirective] 8158 * [ExportDirective]
8325 * | [ImportDirective] 8159 * | [ImportDirective]
8326 * </pre> 8160 * </pre>
8327 *
8328 * @coverage dart.engine.ast
8329 */ 8161 */
8330 abstract class NamespaceDirective extends UriBasedDirective { 8162 abstract class NamespaceDirective extends UriBasedDirective {
8331 /** 8163 /**
8332 * The token representing the 'import' or 'export' keyword. 8164 * The token representing the 'import' or 'export' keyword.
8333 */ 8165 */
8334 Token keyword; 8166 Token keyword;
8335 8167
8336 /** 8168 /**
8337 * The combinators used to control which names are imported or exported. 8169 * The combinators used to control which names are imported or exported.
8338 */ 8170 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
8373 } 8205 }
8374 8206
8375 /** 8207 /**
8376 * Instances of the class `NativeClause` represent the "native" clause in an cla ss 8208 * Instances of the class `NativeClause` represent the "native" clause in an cla ss
8377 * declaration. 8209 * declaration.
8378 * 8210 *
8379 * <pre> 8211 * <pre>
8380 * nativeClause ::= 8212 * nativeClause ::=
8381 * 'native' [StringLiteral] 8213 * 'native' [StringLiteral]
8382 * </pre> 8214 * </pre>
8383 *
8384 * @coverage dart.engine.ast
8385 */ 8215 */
8386 class NativeClause extends ASTNode { 8216 class NativeClause extends AstNode {
8387 /** 8217 /**
8388 * The token representing the 'native' keyword. 8218 * The token representing the 'native' keyword.
8389 */ 8219 */
8390 Token keyword; 8220 Token keyword;
8391 8221
8392 /** 8222 /**
8393 * The name of the native object that implements the class. 8223 * The name of the native object that implements the class.
8394 */ 8224 */
8395 StringLiteral name; 8225 StringLiteral name;
8396 8226
8397 /** 8227 /**
8398 * Initialize a newly created native clause. 8228 * Initialize a newly created native clause.
8399 * 8229 *
8400 * @param keyword the token representing the 'native' keyword 8230 * @param keyword the token representing the 'native' keyword
8401 * @param name the name of the native object that implements the class. 8231 * @param name the name of the native object that implements the class.
8402 */ 8232 */
8403 NativeClause(this.keyword, this.name); 8233 NativeClause(this.keyword, this.name);
8404 8234
8405 accept(ASTVisitor visitor) => visitor.visitNativeClause(this); 8235 accept(AstVisitor visitor) => visitor.visitNativeClause(this);
8406 8236
8407 Token get beginToken => keyword; 8237 Token get beginToken => keyword;
8408 8238
8409 Token get endToken => name.endToken; 8239 Token get endToken => name.endToken;
8410 8240
8411 void visitChildren(ASTVisitor visitor) { 8241 void visitChildren(AstVisitor visitor) {
8412 safelyVisitChild(name, visitor); 8242 safelyVisitChild(name, visitor);
8413 } 8243 }
8414 } 8244 }
8415 8245
8416 /** 8246 /**
8417 * Instances of the class `NativeFunctionBody` represent a function body that co nsists of a 8247 * Instances of the class `NativeFunctionBody` represent a function body that co nsists of a
8418 * native keyword followed by a string literal. 8248 * native keyword followed by a string literal.
8419 * 8249 *
8420 * <pre> 8250 * <pre>
8421 * nativeFunctionBody ::= 8251 * nativeFunctionBody ::=
8422 * 'native' [SimpleStringLiteral] ';' 8252 * 'native' [SimpleStringLiteral] ';'
8423 * </pre> 8253 * </pre>
8424 *
8425 * @coverage dart.engine.ast
8426 */ 8254 */
8427 class NativeFunctionBody extends FunctionBody { 8255 class NativeFunctionBody extends FunctionBody {
8428 /** 8256 /**
8429 * The token representing 'native' that marks the start of the function body. 8257 * The token representing 'native' that marks the start of the function body.
8430 */ 8258 */
8431 final Token nativeToken; 8259 final Token nativeToken;
8432 8260
8433 /** 8261 /**
8434 * The string literal, after the 'native' token. 8262 * The string literal, after the 'native' token.
8435 */ 8263 */
8436 StringLiteral _stringLiteral; 8264 StringLiteral _stringLiteral;
8437 8265
8438 /** 8266 /**
8439 * The token representing the semicolon that marks the end of the function bod y. 8267 * The token representing the semicolon that marks the end of the function bod y.
8440 */ 8268 */
8441 final Token semicolon; 8269 final Token semicolon;
8442 8270
8443 /** 8271 /**
8444 * Initialize a newly created function body consisting of the 'native' token, a string literal, 8272 * Initialize a newly created function body consisting of the 'native' token, a string literal,
8445 * and a semicolon. 8273 * and a semicolon.
8446 * 8274 *
8447 * @param nativeToken the token representing 'native' that marks the start of the function body 8275 * @param nativeToken the token representing 'native' that marks the start of the function body
8448 * @param stringLiteral the string literal 8276 * @param stringLiteral the string literal
8449 * @param semicolon the token representing the semicolon that marks the end of the function body 8277 * @param semicolon the token representing the semicolon that marks the end of the function body
8450 */ 8278 */
8451 NativeFunctionBody(this.nativeToken, StringLiteral stringLiteral, this.semicol on) { 8279 NativeFunctionBody(this.nativeToken, StringLiteral stringLiteral, this.semicol on) {
8452 this._stringLiteral = becomeParentOf(stringLiteral); 8280 this._stringLiteral = becomeParentOf(stringLiteral);
8453 } 8281 }
8454 8282
8455 accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this); 8283 accept(AstVisitor visitor) => visitor.visitNativeFunctionBody(this);
8456 8284
8457 Token get beginToken => nativeToken; 8285 Token get beginToken => nativeToken;
8458 8286
8459 Token get endToken => semicolon; 8287 Token get endToken => semicolon;
8460 8288
8461 /** 8289 /**
8462 * Return the string literal representing the string after the 'native' token. 8290 * Return the string literal representing the string after the 'native' token.
8463 * 8291 *
8464 * @return the string literal representing the string after the 'native' token 8292 * @return the string literal representing the string after the 'native' token
8465 */ 8293 */
8466 StringLiteral get stringLiteral => _stringLiteral; 8294 StringLiteral get stringLiteral => _stringLiteral;
8467 8295
8468 void visitChildren(ASTVisitor visitor) { 8296 void visitChildren(AstVisitor visitor) {
8469 safelyVisitChild(_stringLiteral, visitor); 8297 safelyVisitChild(_stringLiteral, visitor);
8470 } 8298 }
8471 } 8299 }
8472 8300
8473 /** 8301 /**
8474 * The abstract class `NormalFormalParameter` defines the behavior common to for mal parameters 8302 * The abstract class `NormalFormalParameter` defines the behavior common to for mal parameters
8475 * that are required (are not optional). 8303 * that are required (are not optional).
8476 * 8304 *
8477 * <pre> 8305 * <pre>
8478 * normalFormalParameter ::= 8306 * normalFormalParameter ::=
8479 * [FunctionTypedFormalParameter] 8307 * [FunctionTypedFormalParameter]
8480 * | [FieldFormalParameter] 8308 * | [FieldFormalParameter]
8481 * | [SimpleFormalParameter] 8309 * | [SimpleFormalParameter]
8482 * </pre> 8310 * </pre>
8483 *
8484 * @coverage dart.engine.ast
8485 */ 8311 */
8486 abstract class NormalFormalParameter extends FormalParameter { 8312 abstract class NormalFormalParameter extends FormalParameter {
8487 /** 8313 /**
8488 * The documentation comment associated with this parameter, or `null` if this parameter 8314 * The documentation comment associated with this parameter, or `null` if this parameter
8489 * does not have a documentation comment associated with it. 8315 * does not have a documentation comment associated with it.
8490 */ 8316 */
8491 Comment _comment; 8317 Comment _comment;
8492 8318
8493 /** 8319 /**
8494 * The annotations associated with this parameter. 8320 * The annotations associated with this parameter.
(...skipping 23 matching lines...) Expand all
8518 * Return the documentation comment associated with this parameter, or `null` if this 8344 * Return the documentation comment associated with this parameter, or `null` if this
8519 * parameter does not have a documentation comment associated with it. 8345 * parameter does not have a documentation comment associated with it.
8520 * 8346 *
8521 * @return the documentation comment associated with this parameter 8347 * @return the documentation comment associated with this parameter
8522 */ 8348 */
8523 Comment get documentationComment => _comment; 8349 Comment get documentationComment => _comment;
8524 8350
8525 SimpleIdentifier get identifier => _identifier; 8351 SimpleIdentifier get identifier => _identifier;
8526 8352
8527 ParameterKind get kind { 8353 ParameterKind get kind {
8528 ASTNode parent = this.parent; 8354 AstNode parent = this.parent;
8529 if (parent is DefaultFormalParameter) { 8355 if (parent is DefaultFormalParameter) {
8530 return parent.kind; 8356 return parent.kind;
8531 } 8357 }
8532 return ParameterKind.REQUIRED; 8358 return ParameterKind.REQUIRED;
8533 } 8359 }
8534 8360
8535 /** 8361 /**
8536 * Return the annotations associated with this parameter. 8362 * Return the annotations associated with this parameter.
8537 * 8363 *
8538 * @return the annotations associated with this parameter 8364 * @return the annotations associated with this parameter
(...skipping 11 matching lines...) Expand all
8550 8376
8551 /** 8377 /**
8552 * Set the name of the parameter being declared to the given identifier. 8378 * Set the name of the parameter being declared to the given identifier.
8553 * 8379 *
8554 * @param identifier the name of the parameter being declared 8380 * @param identifier the name of the parameter being declared
8555 */ 8381 */
8556 void set identifier(SimpleIdentifier identifier) { 8382 void set identifier(SimpleIdentifier identifier) {
8557 this._identifier = becomeParentOf(identifier); 8383 this._identifier = becomeParentOf(identifier);
8558 } 8384 }
8559 8385
8560 void visitChildren(ASTVisitor visitor) { 8386 void visitChildren(AstVisitor visitor) {
8561 // 8387 //
8562 // Note that subclasses are responsible for visiting the identifier because they often need to 8388 // Note that subclasses are responsible for visiting the identifier because they often need to
8563 // visit other nodes before visiting the identifier. 8389 // visit other nodes before visiting the identifier.
8564 // 8390 //
8565 if (commentIsBeforeAnnotations()) { 8391 if (commentIsBeforeAnnotations()) {
8566 safelyVisitChild(_comment, visitor); 8392 safelyVisitChild(_comment, visitor);
8567 _metadata.accept(visitor); 8393 _metadata.accept(visitor);
8568 } else { 8394 } else {
8569 for (ASTNode child in sortedCommentAndAnnotations) { 8395 for (AstNode child in sortedCommentAndAnnotations) {
8570 child.accept(visitor); 8396 child.accept(visitor);
8571 } 8397 }
8572 } 8398 }
8573 } 8399 }
8574 8400
8575 /** 8401 /**
8576 * Return `true` if the comment is lexically before any annotations. 8402 * Return `true` if the comment is lexically before any annotations.
8577 * 8403 *
8578 * @return `true` if the comment is lexically before any annotations 8404 * @return `true` if the comment is lexically before any annotations
8579 */ 8405 */
8580 bool commentIsBeforeAnnotations() { 8406 bool commentIsBeforeAnnotations() {
8581 if (_comment == null || _metadata.isEmpty) { 8407 if (_comment == null || _metadata.isEmpty) {
8582 return true; 8408 return true;
8583 } 8409 }
8584 Annotation firstAnnotation = _metadata[0]; 8410 Annotation firstAnnotation = _metadata[0];
8585 return _comment.offset < firstAnnotation.offset; 8411 return _comment.offset < firstAnnotation.offset;
8586 } 8412 }
8587 8413
8588 /** 8414 /**
8589 * Return an array containing the comment and annotations associated with this parameter, sorted 8415 * Return an array containing the comment and annotations associated with this parameter, sorted
8590 * in lexical order. 8416 * in lexical order.
8591 * 8417 *
8592 * @return the comment and annotations associated with this parameter in the o rder in which they 8418 * @return the comment and annotations associated with this parameter in the o rder in which they
8593 * appeared in the original source 8419 * appeared in the original source
8594 */ 8420 */
8595 List<ASTNode> get sortedCommentAndAnnotations { 8421 List<AstNode> get sortedCommentAndAnnotations {
8596 List<ASTNode> childList = new List<ASTNode>(); 8422 List<AstNode> childList = new List<AstNode>();
8597 childList.add(_comment); 8423 childList.add(_comment);
8598 childList.addAll(_metadata); 8424 childList.addAll(_metadata);
8599 List<ASTNode> children = new List.from(childList); 8425 List<AstNode> children = new List.from(childList);
8600 children.sort(ASTNode.LEXICAL_ORDER); 8426 children.sort(AstNode.LEXICAL_ORDER);
8601 return children; 8427 return children;
8602 } 8428 }
8603 } 8429 }
8604 8430
8605 /** 8431 /**
8606 * Instances of the class `NullLiteral` represent a null literal expression. 8432 * Instances of the class `NullLiteral` represent a null literal expression.
8607 * 8433 *
8608 * <pre> 8434 * <pre>
8609 * nullLiteral ::= 8435 * nullLiteral ::=
8610 * 'null' 8436 * 'null'
8611 * </pre> 8437 * </pre>
8612 *
8613 * @coverage dart.engine.ast
8614 */ 8438 */
8615 class NullLiteral extends Literal { 8439 class NullLiteral extends Literal {
8616 /** 8440 /**
8617 * The token representing the literal. 8441 * The token representing the literal.
8618 */ 8442 */
8619 Token literal; 8443 Token literal;
8620 8444
8621 /** 8445 /**
8622 * Initialize a newly created null literal. 8446 * Initialize a newly created null literal.
8623 * 8447 *
8624 * @param token the token representing the literal 8448 * @param token the token representing the literal
8625 */ 8449 */
8626 NullLiteral(Token token) { 8450 NullLiteral(Token token) {
8627 this.literal = token; 8451 this.literal = token;
8628 } 8452 }
8629 8453
8630 accept(ASTVisitor visitor) => visitor.visitNullLiteral(this); 8454 accept(AstVisitor visitor) => visitor.visitNullLiteral(this);
8631 8455
8632 Token get beginToken => literal; 8456 Token get beginToken => literal;
8633 8457
8634 Token get endToken => literal; 8458 Token get endToken => literal;
8635 8459
8636 void visitChildren(ASTVisitor visitor) { 8460 void visitChildren(AstVisitor visitor) {
8637 } 8461 }
8638 } 8462 }
8639 8463
8640 /** 8464 /**
8641 * Instances of the class `ParenthesizedExpression` represent a parenthesized ex pression. 8465 * Instances of the class `ParenthesizedExpression` represent a parenthesized ex pression.
8642 * 8466 *
8643 * <pre> 8467 * <pre>
8644 * parenthesizedExpression ::= 8468 * parenthesizedExpression ::=
8645 * '(' [Expression] ')' 8469 * '(' [Expression] ')'
8646 * </pre> 8470 * </pre>
8647 *
8648 * @coverage dart.engine.ast
8649 */ 8471 */
8650 class ParenthesizedExpression extends Expression { 8472 class ParenthesizedExpression extends Expression {
8651 /** 8473 /**
8652 * The left parenthesis. 8474 * The left parenthesis.
8653 */ 8475 */
8654 Token _leftParenthesis; 8476 Token _leftParenthesis;
8655 8477
8656 /** 8478 /**
8657 * The expression within the parentheses. 8479 * The expression within the parentheses.
8658 */ 8480 */
(...skipping 10 matching lines...) Expand all
8669 * @param leftParenthesis the left parenthesis 8491 * @param leftParenthesis the left parenthesis
8670 * @param expression the expression within the parentheses 8492 * @param expression the expression within the parentheses
8671 * @param rightParenthesis the right parenthesis 8493 * @param rightParenthesis the right parenthesis
8672 */ 8494 */
8673 ParenthesizedExpression(Token leftParenthesis, Expression expression, Token ri ghtParenthesis) { 8495 ParenthesizedExpression(Token leftParenthesis, Expression expression, Token ri ghtParenthesis) {
8674 this._leftParenthesis = leftParenthesis; 8496 this._leftParenthesis = leftParenthesis;
8675 this._expression = becomeParentOf(expression); 8497 this._expression = becomeParentOf(expression);
8676 this._rightParenthesis = rightParenthesis; 8498 this._rightParenthesis = rightParenthesis;
8677 } 8499 }
8678 8500
8679 accept(ASTVisitor visitor) => visitor.visitParenthesizedExpression(this); 8501 accept(AstVisitor visitor) => visitor.visitParenthesizedExpression(this);
8680 8502
8681 Token get beginToken => _leftParenthesis; 8503 Token get beginToken => _leftParenthesis;
8682 8504
8683 Token get endToken => _rightParenthesis; 8505 Token get endToken => _rightParenthesis;
8684 8506
8685 /** 8507 /**
8686 * Return the expression within the parentheses. 8508 * Return the expression within the parentheses.
8687 * 8509 *
8688 * @return the expression within the parentheses 8510 * @return the expression within the parentheses
8689 */ 8511 */
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
8725 8547
8726 /** 8548 /**
8727 * Set the right parenthesis to the given token. 8549 * Set the right parenthesis to the given token.
8728 * 8550 *
8729 * @param parenthesis the right parenthesis 8551 * @param parenthesis the right parenthesis
8730 */ 8552 */
8731 void set rightParenthesis(Token parenthesis) { 8553 void set rightParenthesis(Token parenthesis) {
8732 _rightParenthesis = parenthesis; 8554 _rightParenthesis = parenthesis;
8733 } 8555 }
8734 8556
8735 void visitChildren(ASTVisitor visitor) { 8557 void visitChildren(AstVisitor visitor) {
8736 safelyVisitChild(_expression, visitor); 8558 safelyVisitChild(_expression, visitor);
8737 } 8559 }
8738 } 8560 }
8739 8561
8740 /** 8562 /**
8741 * Instances of the class `PartDirective` represent a part directive. 8563 * Instances of the class `PartDirective` represent a part directive.
8742 * 8564 *
8743 * <pre> 8565 * <pre>
8744 * partDirective ::= 8566 * partDirective ::=
8745 * [Annotation] 'part' [StringLiteral] ';' 8567 * [Annotation] 'part' [StringLiteral] ';'
8746 * </pre> 8568 * </pre>
8747 *
8748 * @coverage dart.engine.ast
8749 */ 8569 */
8750 class PartDirective extends UriBasedDirective { 8570 class PartDirective extends UriBasedDirective {
8751 /** 8571 /**
8752 * The token representing the 'part' token. 8572 * The token representing the 'part' token.
8753 */ 8573 */
8754 Token partToken; 8574 Token partToken;
8755 8575
8756 /** 8576 /**
8757 * The semicolon terminating the directive. 8577 * The semicolon terminating the directive.
8758 */ 8578 */
8759 Token semicolon; 8579 Token semicolon;
8760 8580
8761 /** 8581 /**
8762 * Initialize a newly created part directive. 8582 * Initialize a newly created part directive.
8763 * 8583 *
8764 * @param comment the documentation comment associated with this directive 8584 * @param comment the documentation comment associated with this directive
8765 * @param metadata the annotations associated with the directive 8585 * @param metadata the annotations associated with the directive
8766 * @param partToken the token representing the 'part' token 8586 * @param partToken the token representing the 'part' token
8767 * @param partUri the URI of the part being included 8587 * @param partUri the URI of the part being included
8768 * @param semicolon the semicolon terminating the directive 8588 * @param semicolon the semicolon terminating the directive
8769 */ 8589 */
8770 PartDirective(Comment comment, List<Annotation> metadata, this.partToken, Stri ngLiteral partUri, this.semicolon) : super(comment, metadata, partUri); 8590 PartDirective(Comment comment, List<Annotation> metadata, this.partToken, Stri ngLiteral partUri, this.semicolon) : super(comment, metadata, partUri);
8771 8591
8772 accept(ASTVisitor visitor) => visitor.visitPartDirective(this); 8592 accept(AstVisitor visitor) => visitor.visitPartDirective(this);
8773 8593
8774 Token get endToken => semicolon; 8594 Token get endToken => semicolon;
8775 8595
8776 Token get keyword => partToken; 8596 Token get keyword => partToken;
8777 8597
8778 CompilationUnitElement get uriElement => element as CompilationUnitElement; 8598 CompilationUnitElement get uriElement => element as CompilationUnitElement;
8779 8599
8780 Token get firstTokenAfterCommentAndMetadata => partToken; 8600 Token get firstTokenAfterCommentAndMetadata => partToken;
8781 } 8601 }
8782 8602
8783 /** 8603 /**
8784 * Instances of the class `PartOfDirective` represent a part-of directive. 8604 * Instances of the class `PartOfDirective` represent a part-of directive.
8785 * 8605 *
8786 * <pre> 8606 * <pre>
8787 * partOfDirective ::= 8607 * partOfDirective ::=
8788 * [Annotation] 'part' 'of' [Identifier] ';' 8608 * [Annotation] 'part' 'of' [Identifier] ';'
8789 * </pre> 8609 * </pre>
8790 *
8791 * @coverage dart.engine.ast
8792 */ 8610 */
8793 class PartOfDirective extends Directive { 8611 class PartOfDirective extends Directive {
8794 /** 8612 /**
8795 * The token representing the 'part' token. 8613 * The token representing the 'part' token.
8796 */ 8614 */
8797 Token partToken; 8615 Token partToken;
8798 8616
8799 /** 8617 /**
8800 * The token representing the 'of' token. 8618 * The token representing the 'of' token.
8801 */ 8619 */
(...skipping 16 matching lines...) Expand all
8818 * @param metadata the annotations associated with the directive 8636 * @param metadata the annotations associated with the directive
8819 * @param partToken the token representing the 'part' token 8637 * @param partToken the token representing the 'part' token
8820 * @param ofToken the token representing the 'of' token 8638 * @param ofToken the token representing the 'of' token
8821 * @param libraryName the name of the library that the containing compilation unit is part of 8639 * @param libraryName the name of the library that the containing compilation unit is part of
8822 * @param semicolon the semicolon terminating the directive 8640 * @param semicolon the semicolon terminating the directive
8823 */ 8641 */
8824 PartOfDirective(Comment comment, List<Annotation> metadata, this.partToken, th is.ofToken, LibraryIdentifier libraryName, this.semicolon) : super(comment, meta data) { 8642 PartOfDirective(Comment comment, List<Annotation> metadata, this.partToken, th is.ofToken, LibraryIdentifier libraryName, this.semicolon) : super(comment, meta data) {
8825 this._libraryName = becomeParentOf(libraryName); 8643 this._libraryName = becomeParentOf(libraryName);
8826 } 8644 }
8827 8645
8828 accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this); 8646 accept(AstVisitor visitor) => visitor.visitPartOfDirective(this);
8829 8647
8830 Token get endToken => semicolon; 8648 Token get endToken => semicolon;
8831 8649
8832 Token get keyword => partToken; 8650 Token get keyword => partToken;
8833 8651
8834 /** 8652 /**
8835 * Return the name of the library that the containing compilation unit is part of. 8653 * Return the name of the library that the containing compilation unit is part of.
8836 * 8654 *
8837 * @return the name of the library that the containing compilation unit is par t of 8655 * @return the name of the library that the containing compilation unit is par t of
8838 */ 8656 */
8839 LibraryIdentifier get libraryName => _libraryName; 8657 LibraryIdentifier get libraryName => _libraryName;
8840 8658
8841 /** 8659 /**
8842 * Set the name of the library that the containing compilation unit is part of to the given name. 8660 * Set the name of the library that the containing compilation unit is part of to the given name.
8843 * 8661 *
8844 * @param libraryName the name of the library that the containing compilation unit is part of 8662 * @param libraryName the name of the library that the containing compilation unit is part of
8845 */ 8663 */
8846 void set libraryName(LibraryIdentifier libraryName) { 8664 void set libraryName(LibraryIdentifier libraryName) {
8847 this._libraryName = becomeParentOf(libraryName); 8665 this._libraryName = becomeParentOf(libraryName);
8848 } 8666 }
8849 8667
8850 void visitChildren(ASTVisitor visitor) { 8668 void visitChildren(AstVisitor visitor) {
8851 super.visitChildren(visitor); 8669 super.visitChildren(visitor);
8852 safelyVisitChild(_libraryName, visitor); 8670 safelyVisitChild(_libraryName, visitor);
8853 } 8671 }
8854 8672
8855 Token get firstTokenAfterCommentAndMetadata => partToken; 8673 Token get firstTokenAfterCommentAndMetadata => partToken;
8856 } 8674 }
8857 8675
8858 /** 8676 /**
8859 * Instances of the class `PostfixExpression` represent a postfix unary expressi on. 8677 * Instances of the class `PostfixExpression` represent a postfix unary expressi on.
8860 * 8678 *
8861 * <pre> 8679 * <pre>
8862 * postfixExpression ::= 8680 * postfixExpression ::=
8863 * [Expression] [Token] 8681 * [Expression] [Token]
8864 * </pre> 8682 * </pre>
8865 *
8866 * @coverage dart.engine.ast
8867 */ 8683 */
8868 class PostfixExpression extends Expression { 8684 class PostfixExpression extends Expression {
8869 /** 8685 /**
8870 * The expression computing the operand for the operator. 8686 * The expression computing the operand for the operator.
8871 */ 8687 */
8872 Expression _operand; 8688 Expression _operand;
8873 8689
8874 /** 8690 /**
8875 * The postfix operator being applied to the operand. 8691 * The postfix operator being applied to the operand.
8876 */ 8692 */
(...skipping 16 matching lines...) Expand all
8893 /** 8709 /**
8894 * Initialize a newly created postfix expression. 8710 * Initialize a newly created postfix expression.
8895 * 8711 *
8896 * @param operand the expression computing the operand for the operator 8712 * @param operand the expression computing the operand for the operator
8897 * @param operator the postfix operator being applied to the operand 8713 * @param operator the postfix operator being applied to the operand
8898 */ 8714 */
8899 PostfixExpression(Expression operand, this.operator) { 8715 PostfixExpression(Expression operand, this.operator) {
8900 this._operand = becomeParentOf(operand); 8716 this._operand = becomeParentOf(operand);
8901 } 8717 }
8902 8718
8903 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); 8719 accept(AstVisitor visitor) => visitor.visitPostfixExpression(this);
8904 8720
8905 Token get beginToken => _operand.beginToken; 8721 Token get beginToken => _operand.beginToken;
8906 8722
8907 /** 8723 /**
8908 * Return the best element available for this operator. If resolution was able to find a better 8724 * Return the best element available for this operator. If resolution was able to find a better
8909 * element based on type propagation, that element will be returned. Otherwise , the element found 8725 * element based on type propagation, that element will be returned. Otherwise , the element found
8910 * using the result of static analysis will be returned. If resolution has not been performed, 8726 * using the result of static analysis will be returned. If resolution has not been performed,
8911 * then `null` will be returned. 8727 * then `null` will be returned.
8912 * 8728 *
8913 * @return the best element available for this operator 8729 * @return the best element available for this operator
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
8973 /** 8789 /**
8974 * Set the element associated with the operator based on the static type of th e operand to the 8790 * Set the element associated with the operator based on the static type of th e operand to the
8975 * given element. 8791 * given element.
8976 * 8792 *
8977 * @param element the element to be associated with the operator 8793 * @param element the element to be associated with the operator
8978 */ 8794 */
8979 void set staticElement(MethodElement element) { 8795 void set staticElement(MethodElement element) {
8980 _staticElement = element; 8796 _staticElement = element;
8981 } 8797 }
8982 8798
8983 void visitChildren(ASTVisitor visitor) { 8799 void visitChildren(AstVisitor visitor) {
8984 safelyVisitChild(_operand, visitor); 8800 safelyVisitChild(_operand, visitor);
8985 } 8801 }
8986 8802
8987 /** 8803 /**
8988 * If the AST structure has been resolved, and the function being invoked is k nown based on 8804 * If the AST structure has been resolved, and the function being invoked is k nown based on
8989 * propagated type information, then return the parameter element representing the parameter to 8805 * propagated type information, then return the parameter element representing the parameter to
8990 * which the value of the operand will be bound. Otherwise, return `null`. 8806 * which the value of the operand will be bound. Otherwise, return `null`.
8991 * 8807 *
8992 * This method is only intended to be used by [Expression#getPropagatedParamet erElement]. 8808 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
8993 * 8809 *
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
9027 } 8843 }
9028 } 8844 }
9029 8845
9030 /** 8846 /**
9031 * Instances of the class `PrefixExpression` represent a prefix unary expression . 8847 * Instances of the class `PrefixExpression` represent a prefix unary expression .
9032 * 8848 *
9033 * <pre> 8849 * <pre>
9034 * prefixExpression ::= 8850 * prefixExpression ::=
9035 * [Token] [Expression] 8851 * [Token] [Expression]
9036 * </pre> 8852 * </pre>
9037 *
9038 * @coverage dart.engine.ast
9039 */ 8853 */
9040 class PrefixExpression extends Expression { 8854 class PrefixExpression extends Expression {
9041 /** 8855 /**
9042 * The prefix operator being applied to the operand. 8856 * The prefix operator being applied to the operand.
9043 */ 8857 */
9044 Token operator; 8858 Token operator;
9045 8859
9046 /** 8860 /**
9047 * The expression computing the operand for the operator. 8861 * The expression computing the operand for the operator.
9048 */ 8862 */
(...skipping 16 matching lines...) Expand all
9065 /** 8879 /**
9066 * Initialize a newly created prefix expression. 8880 * Initialize a newly created prefix expression.
9067 * 8881 *
9068 * @param operator the prefix operator being applied to the operand 8882 * @param operator the prefix operator being applied to the operand
9069 * @param operand the expression computing the operand for the operator 8883 * @param operand the expression computing the operand for the operator
9070 */ 8884 */
9071 PrefixExpression(this.operator, Expression operand) { 8885 PrefixExpression(this.operator, Expression operand) {
9072 this._operand = becomeParentOf(operand); 8886 this._operand = becomeParentOf(operand);
9073 } 8887 }
9074 8888
9075 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); 8889 accept(AstVisitor visitor) => visitor.visitPrefixExpression(this);
9076 8890
9077 Token get beginToken => operator; 8891 Token get beginToken => operator;
9078 8892
9079 /** 8893 /**
9080 * Return the best element available for this operator. If resolution was able to find a better 8894 * Return the best element available for this operator. If resolution was able to find a better
9081 * element based on type propagation, that element will be returned. Otherwise , the element found 8895 * element based on type propagation, that element will be returned. Otherwise , the element found
9082 * using the result of static analysis will be returned. If resolution has not been performed, 8896 * using the result of static analysis will be returned. If resolution has not been performed,
9083 * then `null` will be returned. 8897 * then `null` will be returned.
9084 * 8898 *
9085 * @return the best element available for this operator 8899 * @return the best element available for this operator
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
9145 /** 8959 /**
9146 * Set the element associated with the operator based on the static type of th e operand to the 8960 * Set the element associated with the operator based on the static type of th e operand to the
9147 * given element. 8961 * given element.
9148 * 8962 *
9149 * @param element the static element to be associated with the operator 8963 * @param element the static element to be associated with the operator
9150 */ 8964 */
9151 void set staticElement(MethodElement element) { 8965 void set staticElement(MethodElement element) {
9152 _staticElement = element; 8966 _staticElement = element;
9153 } 8967 }
9154 8968
9155 void visitChildren(ASTVisitor visitor) { 8969 void visitChildren(AstVisitor visitor) {
9156 safelyVisitChild(_operand, visitor); 8970 safelyVisitChild(_operand, visitor);
9157 } 8971 }
9158 8972
9159 /** 8973 /**
9160 * If the AST structure has been resolved, and the function being invoked is k nown based on 8974 * If the AST structure has been resolved, and the function being invoked is k nown based on
9161 * propagated type information, then return the parameter element representing the parameter to 8975 * propagated type information, then return the parameter element representing the parameter to
9162 * which the value of the operand will be bound. Otherwise, return `null`. 8976 * which the value of the operand will be bound. Otherwise, return `null`.
9163 * 8977 *
9164 * This method is only intended to be used by [Expression#getPropagatedParamet erElement]. 8978 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
9165 * 8979 *
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
9201 9015
9202 /** 9016 /**
9203 * Instances of the class `PrefixedIdentifier` represent either an identifier th at is prefixed 9017 * Instances of the class `PrefixedIdentifier` represent either an identifier th at is prefixed
9204 * or an access to an object property where the target of the property access is a simple 9018 * or an access to an object property where the target of the property access is a simple
9205 * identifier. 9019 * identifier.
9206 * 9020 *
9207 * <pre> 9021 * <pre>
9208 * prefixedIdentifier ::= 9022 * prefixedIdentifier ::=
9209 * [SimpleIdentifier] '.' [SimpleIdentifier] 9023 * [SimpleIdentifier] '.' [SimpleIdentifier]
9210 * </pre> 9024 * </pre>
9211 *
9212 * @coverage dart.engine.ast
9213 */ 9025 */
9214 class PrefixedIdentifier extends Identifier { 9026 class PrefixedIdentifier extends Identifier {
9215 /** 9027 /**
9216 * The prefix associated with the library in which the identifier is defined. 9028 * The prefix associated with the library in which the identifier is defined.
9217 */ 9029 */
9218 SimpleIdentifier _prefix; 9030 SimpleIdentifier _prefix;
9219 9031
9220 /** 9032 /**
9221 * The period used to separate the prefix from the identifier. 9033 * The period used to separate the prefix from the identifier.
9222 */ 9034 */
9223 Token period; 9035 Token period;
9224 9036
9225 /** 9037 /**
9226 * The identifier being prefixed. 9038 * The identifier being prefixed.
9227 */ 9039 */
9228 SimpleIdentifier _identifier; 9040 SimpleIdentifier _identifier;
9229 9041
9230 /** 9042 /**
9231 * Initialize a newly created prefixed identifier. 9043 * Initialize a newly created prefixed identifier.
9232 * 9044 *
9233 * @param prefix the identifier being prefixed 9045 * @param prefix the identifier being prefixed
9234 * @param period the period used to separate the prefix from the identifier 9046 * @param period the period used to separate the prefix from the identifier
9235 * @param identifier the prefix associated with the library in which the ident ifier is defined 9047 * @param identifier the prefix associated with the library in which the ident ifier is defined
9236 */ 9048 */
9237 PrefixedIdentifier(SimpleIdentifier prefix, this.period, SimpleIdentifier iden tifier) { 9049 PrefixedIdentifier(SimpleIdentifier prefix, this.period, SimpleIdentifier iden tifier) {
9238 this._prefix = becomeParentOf(prefix); 9050 this._prefix = becomeParentOf(prefix);
9239 this._identifier = becomeParentOf(identifier); 9051 this._identifier = becomeParentOf(identifier);
9240 } 9052 }
9241 9053
9242 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); 9054 accept(AstVisitor visitor) => visitor.visitPrefixedIdentifier(this);
9243 9055
9244 Token get beginToken => _prefix.beginToken; 9056 Token get beginToken => _prefix.beginToken;
9245 9057
9246 Element get bestElement { 9058 Element get bestElement {
9247 if (_identifier == null) { 9059 if (_identifier == null) {
9248 return null; 9060 return null;
9249 } 9061 }
9250 return _identifier.bestElement; 9062 return _identifier.bestElement;
9251 } 9063 }
9252 9064
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
9296 /** 9108 /**
9297 * Set the prefix associated with the library in which the identifier is defin ed to the given 9109 * Set the prefix associated with the library in which the identifier is defin ed to the given
9298 * identifier. 9110 * identifier.
9299 * 9111 *
9300 * @param identifier the prefix associated with the library in which the ident ifier is defined 9112 * @param identifier the prefix associated with the library in which the ident ifier is defined
9301 */ 9113 */
9302 void set prefix(SimpleIdentifier identifier) { 9114 void set prefix(SimpleIdentifier identifier) {
9303 _prefix = becomeParentOf(identifier); 9115 _prefix = becomeParentOf(identifier);
9304 } 9116 }
9305 9117
9306 void visitChildren(ASTVisitor visitor) { 9118 void visitChildren(AstVisitor visitor) {
9307 safelyVisitChild(_prefix, visitor); 9119 safelyVisitChild(_prefix, visitor);
9308 safelyVisitChild(_identifier, visitor); 9120 safelyVisitChild(_identifier, visitor);
9309 } 9121 }
9310 } 9122 }
9311 9123
9312 /** 9124 /**
9313 * Instances of the class `PropertyAccess` represent the access of a property of an object. 9125 * Instances of the class `PropertyAccess` represent the access of a property of an object.
9314 * 9126 *
9315 * Note, however, that accesses to properties of objects can also be represented as 9127 * Note, however, that accesses to properties of objects can also be represented as
9316 * [PrefixedIdentifier] nodes in cases where the target is also a simple 9128 * [PrefixedIdentifier] nodes in cases where the target is also a simple
9317 * identifier. 9129 * identifier.
9318 * 9130 *
9319 * <pre> 9131 * <pre>
9320 * propertyAccess ::= 9132 * propertyAccess ::=
9321 * [Expression] '.' [SimpleIdentifier] 9133 * [Expression] '.' [SimpleIdentifier]
9322 * </pre> 9134 * </pre>
9323 *
9324 * @coverage dart.engine.ast
9325 */ 9135 */
9326 class PropertyAccess extends Expression { 9136 class PropertyAccess extends Expression {
9327 /** 9137 /**
9328 * The expression computing the object defining the property being accessed. 9138 * The expression computing the object defining the property being accessed.
9329 */ 9139 */
9330 Expression _target; 9140 Expression _target;
9331 9141
9332 /** 9142 /**
9333 * The property access operator. 9143 * The property access operator.
9334 */ 9144 */
9335 Token operator; 9145 Token operator;
9336 9146
9337 /** 9147 /**
9338 * The name of the property being accessed. 9148 * The name of the property being accessed.
9339 */ 9149 */
9340 SimpleIdentifier _propertyName; 9150 SimpleIdentifier _propertyName;
9341 9151
9342 /** 9152 /**
9343 * Initialize a newly created property access expression. 9153 * Initialize a newly created property access expression.
9344 * 9154 *
9345 * @param target the expression computing the object defining the property bei ng accessed 9155 * @param target the expression computing the object defining the property bei ng accessed
9346 * @param operator the property access operator 9156 * @param operator the property access operator
9347 * @param propertyName the name of the property being accessed 9157 * @param propertyName the name of the property being accessed
9348 */ 9158 */
9349 PropertyAccess(Expression target, this.operator, SimpleIdentifier propertyName ) { 9159 PropertyAccess(Expression target, this.operator, SimpleIdentifier propertyName ) {
9350 this._target = becomeParentOf(target); 9160 this._target = becomeParentOf(target);
9351 this._propertyName = becomeParentOf(propertyName); 9161 this._propertyName = becomeParentOf(propertyName);
9352 } 9162 }
9353 9163
9354 accept(ASTVisitor visitor) => visitor.visitPropertyAccess(this); 9164 accept(AstVisitor visitor) => visitor.visitPropertyAccess(this);
9355 9165
9356 Token get beginToken { 9166 Token get beginToken {
9357 if (_target != null) { 9167 if (_target != null) {
9358 return _target.beginToken; 9168 return _target.beginToken;
9359 } 9169 }
9360 return operator; 9170 return operator;
9361 } 9171 }
9362 9172
9363 Token get endToken => _propertyName.endToken; 9173 Token get endToken => _propertyName.endToken;
9364 9174
(...skipping 10 matching lines...) Expand all
9375 * Return the expression used to compute the receiver of the invocation. If th is invocation is not 9185 * Return the expression used to compute the receiver of the invocation. If th is invocation is not
9376 * part of a cascade expression, then this is the same as [getTarget]. If this invocation 9186 * part of a cascade expression, then this is the same as [getTarget]. If this invocation
9377 * is part of a cascade expression, then the target stored with the cascade ex pression is 9187 * is part of a cascade expression, then the target stored with the cascade ex pression is
9378 * returned. 9188 * returned.
9379 * 9189 *
9380 * @return the expression used to compute the receiver of the invocation 9190 * @return the expression used to compute the receiver of the invocation
9381 * @see #getTarget() 9191 * @see #getTarget()
9382 */ 9192 */
9383 Expression get realTarget { 9193 Expression get realTarget {
9384 if (isCascaded) { 9194 if (isCascaded) {
9385 ASTNode ancestor = parent; 9195 AstNode ancestor = parent;
9386 while (ancestor is! CascadeExpression) { 9196 while (ancestor is! CascadeExpression) {
9387 if (ancestor == null) { 9197 if (ancestor == null) {
9388 return _target; 9198 return _target;
9389 } 9199 }
9390 ancestor = ancestor.parent; 9200 ancestor = ancestor.parent;
9391 } 9201 }
9392 return (ancestor as CascadeExpression).target; 9202 return (ancestor as CascadeExpression).target;
9393 } 9203 }
9394 return _target; 9204 return _target;
9395 } 9205 }
(...skipping 30 matching lines...) Expand all
9426 /** 9236 /**
9427 * Set the expression computing the object defining the property being accesse d to the given 9237 * Set the expression computing the object defining the property being accesse d to the given
9428 * expression. 9238 * expression.
9429 * 9239 *
9430 * @param expression the expression computing the object defining the property being accessed 9240 * @param expression the expression computing the object defining the property being accessed
9431 */ 9241 */
9432 void set target(Expression expression) { 9242 void set target(Expression expression) {
9433 _target = becomeParentOf(expression); 9243 _target = becomeParentOf(expression);
9434 } 9244 }
9435 9245
9436 void visitChildren(ASTVisitor visitor) { 9246 void visitChildren(AstVisitor visitor) {
9437 safelyVisitChild(_target, visitor); 9247 safelyVisitChild(_target, visitor);
9438 safelyVisitChild(_propertyName, visitor); 9248 safelyVisitChild(_propertyName, visitor);
9439 } 9249 }
9440 } 9250 }
9441 9251
9442 /** 9252 /**
9443 * Instances of the class `RedirectingConstructorInvocation` represent the invoc ation of a 9253 * Instances of the class `RedirectingConstructorInvocation` represent the invoc ation of a
9444 * another constructor in the same class from within a constructor's initializat ion list. 9254 * another constructor in the same class from within a constructor's initializat ion list.
9445 * 9255 *
9446 * <pre> 9256 * <pre>
9447 * redirectingConstructorInvocation ::= 9257 * redirectingConstructorInvocation ::=
9448 * 'this' ('.' identifier)? arguments 9258 * 'this' ('.' identifier)? arguments
9449 * </pre> 9259 * </pre>
9450 *
9451 * @coverage dart.engine.ast
9452 */ 9260 */
9453 class RedirectingConstructorInvocation extends ConstructorInitializer { 9261 class RedirectingConstructorInvocation extends ConstructorInitializer {
9454 /** 9262 /**
9455 * The token for the 'this' keyword. 9263 * The token for the 'this' keyword.
9456 */ 9264 */
9457 Token keyword; 9265 Token keyword;
9458 9266
9459 /** 9267 /**
9460 * The token for the period before the name of the constructor that is being i nvoked, or 9268 * The token for the period before the name of the constructor that is being i nvoked, or
9461 * `null` if the unnamed constructor is being invoked. 9269 * `null` if the unnamed constructor is being invoked.
(...skipping 24 matching lines...) Expand all
9486 * @param keyword the token for the 'this' keyword 9294 * @param keyword the token for the 'this' keyword
9487 * @param period the token for the period before the name of the constructor t hat is being invoked 9295 * @param period the token for the period before the name of the constructor t hat is being invoked
9488 * @param constructorName the name of the constructor that is being invoked 9296 * @param constructorName the name of the constructor that is being invoked
9489 * @param argumentList the list of arguments to the constructor 9297 * @param argumentList the list of arguments to the constructor
9490 */ 9298 */
9491 RedirectingConstructorInvocation(this.keyword, this.period, SimpleIdentifier c onstructorName, ArgumentList argumentList) { 9299 RedirectingConstructorInvocation(this.keyword, this.period, SimpleIdentifier c onstructorName, ArgumentList argumentList) {
9492 this._constructorName = becomeParentOf(constructorName); 9300 this._constructorName = becomeParentOf(constructorName);
9493 this._argumentList = becomeParentOf(argumentList); 9301 this._argumentList = becomeParentOf(argumentList);
9494 } 9302 }
9495 9303
9496 accept(ASTVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th is); 9304 accept(AstVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th is);
9497 9305
9498 /** 9306 /**
9499 * Return the list of arguments to the constructor. 9307 * Return the list of arguments to the constructor.
9500 * 9308 *
9501 * @return the list of arguments to the constructor 9309 * @return the list of arguments to the constructor
9502 */ 9310 */
9503 ArgumentList get argumentList => _argumentList; 9311 ArgumentList get argumentList => _argumentList;
9504 9312
9505 Token get beginToken => keyword; 9313 Token get beginToken => keyword;
9506 9314
(...skipping 18 matching lines...) Expand all
9525 9333
9526 /** 9334 /**
9527 * Set the name of the constructor that is being invoked to the given identifi er. 9335 * Set the name of the constructor that is being invoked to the given identifi er.
9528 * 9336 *
9529 * @param identifier the name of the constructor that is being invoked 9337 * @param identifier the name of the constructor that is being invoked
9530 */ 9338 */
9531 void set constructorName(SimpleIdentifier identifier) { 9339 void set constructorName(SimpleIdentifier identifier) {
9532 _constructorName = becomeParentOf(identifier); 9340 _constructorName = becomeParentOf(identifier);
9533 } 9341 }
9534 9342
9535 void visitChildren(ASTVisitor visitor) { 9343 void visitChildren(AstVisitor visitor) {
9536 safelyVisitChild(_constructorName, visitor); 9344 safelyVisitChild(_constructorName, visitor);
9537 safelyVisitChild(_argumentList, visitor); 9345 safelyVisitChild(_argumentList, visitor);
9538 } 9346 }
9539 } 9347 }
9540 9348
9541 /** 9349 /**
9542 * Instances of the class `RethrowExpression` represent a rethrow expression. 9350 * Instances of the class `RethrowExpression` represent a rethrow expression.
9543 * 9351 *
9544 * <pre> 9352 * <pre>
9545 * rethrowExpression ::= 9353 * rethrowExpression ::=
9546 * 'rethrow' 9354 * 'rethrow'
9547 * </pre> 9355 * </pre>
9548 *
9549 * @coverage dart.engine.ast
9550 */ 9356 */
9551 class RethrowExpression extends Expression { 9357 class RethrowExpression extends Expression {
9552 /** 9358 /**
9553 * The token representing the 'rethrow' keyword. 9359 * The token representing the 'rethrow' keyword.
9554 */ 9360 */
9555 Token keyword; 9361 Token keyword;
9556 9362
9557 /** 9363 /**
9558 * Initialize a newly created rethrow expression. 9364 * Initialize a newly created rethrow expression.
9559 * 9365 *
9560 * @param keyword the token representing the 'rethrow' keyword 9366 * @param keyword the token representing the 'rethrow' keyword
9561 */ 9367 */
9562 RethrowExpression(this.keyword); 9368 RethrowExpression(this.keyword);
9563 9369
9564 accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this); 9370 accept(AstVisitor visitor) => visitor.visitRethrowExpression(this);
9565 9371
9566 Token get beginToken => keyword; 9372 Token get beginToken => keyword;
9567 9373
9568 Token get endToken => keyword; 9374 Token get endToken => keyword;
9569 9375
9570 int get precedence => 0; 9376 int get precedence => 0;
9571 9377
9572 void visitChildren(ASTVisitor visitor) { 9378 void visitChildren(AstVisitor visitor) {
9573 } 9379 }
9574 } 9380 }
9575 9381
9576 /** 9382 /**
9577 * Instances of the class `ReturnStatement` represent a return statement. 9383 * Instances of the class `ReturnStatement` represent a return statement.
9578 * 9384 *
9579 * <pre> 9385 * <pre>
9580 * returnStatement ::= 9386 * returnStatement ::=
9581 * 'return' [Expression]? ';' 9387 * 'return' [Expression]? ';'
9582 * </pre> 9388 * </pre>
9583 *
9584 * @coverage dart.engine.ast
9585 */ 9389 */
9586 class ReturnStatement extends Statement { 9390 class ReturnStatement extends Statement {
9587 /** 9391 /**
9588 * The token representing the 'return' keyword. 9392 * The token representing the 'return' keyword.
9589 */ 9393 */
9590 Token keyword; 9394 Token keyword;
9591 9395
9592 /** 9396 /**
9593 * The expression computing the value to be returned, or `null` if no explicit value was 9397 * The expression computing the value to be returned, or `null` if no explicit value was
9594 * provided. 9398 * provided.
9595 */ 9399 */
9596 Expression _expression; 9400 Expression _expression;
9597 9401
9598 /** 9402 /**
9599 * The semicolon terminating the statement. 9403 * The semicolon terminating the statement.
9600 */ 9404 */
9601 Token semicolon; 9405 Token semicolon;
9602 9406
9603 /** 9407 /**
9604 * Initialize a newly created return statement. 9408 * Initialize a newly created return statement.
9605 * 9409 *
9606 * @param keyword the token representing the 'return' keyword 9410 * @param keyword the token representing the 'return' keyword
9607 * @param expression the expression computing the value to be returned 9411 * @param expression the expression computing the value to be returned
9608 * @param semicolon the semicolon terminating the statement 9412 * @param semicolon the semicolon terminating the statement
9609 */ 9413 */
9610 ReturnStatement(this.keyword, Expression expression, this.semicolon) { 9414 ReturnStatement(this.keyword, Expression expression, this.semicolon) {
9611 this._expression = becomeParentOf(expression); 9415 this._expression = becomeParentOf(expression);
9612 } 9416 }
9613 9417
9614 accept(ASTVisitor visitor) => visitor.visitReturnStatement(this); 9418 accept(AstVisitor visitor) => visitor.visitReturnStatement(this);
9615 9419
9616 Token get beginToken => keyword; 9420 Token get beginToken => keyword;
9617 9421
9618 Token get endToken => semicolon; 9422 Token get endToken => semicolon;
9619 9423
9620 /** 9424 /**
9621 * Return the expression computing the value to be returned, or `null` if no e xplicit value 9425 * Return the expression computing the value to be returned, or `null` if no e xplicit value
9622 * was provided. 9426 * was provided.
9623 * 9427 *
9624 * @return the expression computing the value to be returned 9428 * @return the expression computing the value to be returned
9625 */ 9429 */
9626 Expression get expression => _expression; 9430 Expression get expression => _expression;
9627 9431
9628 /** 9432 /**
9629 * Set the expression computing the value to be returned to the given expressi on. 9433 * Set the expression computing the value to be returned to the given expressi on.
9630 * 9434 *
9631 * @param expression the expression computing the value to be returned 9435 * @param expression the expression computing the value to be returned
9632 */ 9436 */
9633 void set expression(Expression expression) { 9437 void set expression(Expression expression) {
9634 this._expression = becomeParentOf(expression); 9438 this._expression = becomeParentOf(expression);
9635 } 9439 }
9636 9440
9637 void visitChildren(ASTVisitor visitor) { 9441 void visitChildren(AstVisitor visitor) {
9638 safelyVisitChild(_expression, visitor); 9442 safelyVisitChild(_expression, visitor);
9639 } 9443 }
9640 } 9444 }
9641 9445
9642 /** 9446 /**
9643 * Instances of the class `ScriptTag` represent the script tag that can optional ly occur at 9447 * Instances of the class `ScriptTag` represent the script tag that can optional ly occur at
9644 * the beginning of a compilation unit. 9448 * the beginning of a compilation unit.
9645 * 9449 *
9646 * <pre> 9450 * <pre>
9647 * scriptTag ::= 9451 * scriptTag ::=
9648 * '#!' (~NEWLINE)* NEWLINE 9452 * '#!' (~NEWLINE)* NEWLINE
9649 * </pre> 9453 * </pre>
9650 *
9651 * @coverage dart.engine.ast
9652 */ 9454 */
9653 class ScriptTag extends ASTNode { 9455 class ScriptTag extends AstNode {
9654 /** 9456 /**
9655 * The token representing this script tag. 9457 * The token representing this script tag.
9656 */ 9458 */
9657 Token scriptTag; 9459 Token scriptTag;
9658 9460
9659 /** 9461 /**
9660 * Initialize a newly created script tag. 9462 * Initialize a newly created script tag.
9661 * 9463 *
9662 * @param scriptTag the token representing this script tag 9464 * @param scriptTag the token representing this script tag
9663 */ 9465 */
9664 ScriptTag(this.scriptTag); 9466 ScriptTag(this.scriptTag);
9665 9467
9666 accept(ASTVisitor visitor) => visitor.visitScriptTag(this); 9468 accept(AstVisitor visitor) => visitor.visitScriptTag(this);
9667 9469
9668 Token get beginToken => scriptTag; 9470 Token get beginToken => scriptTag;
9669 9471
9670 Token get endToken => scriptTag; 9472 Token get endToken => scriptTag;
9671 9473
9672 void visitChildren(ASTVisitor visitor) { 9474 void visitChildren(AstVisitor visitor) {
9673 } 9475 }
9674 } 9476 }
9675 9477
9676 /** 9478 /**
9677 * Instances of the class `ShowCombinator` represent a combinator that restricts the names 9479 * Instances of the class `ShowCombinator` represent a combinator that restricts the names
9678 * being imported to those in a given list. 9480 * being imported to those in a given list.
9679 * 9481 *
9680 * <pre> 9482 * <pre>
9681 * showCombinator ::= 9483 * showCombinator ::=
9682 * 'show' [SimpleIdentifier] (',' [SimpleIdentifier])* 9484 * 'show' [SimpleIdentifier] (',' [SimpleIdentifier])*
9683 * </pre> 9485 * </pre>
9684 *
9685 * @coverage dart.engine.ast
9686 */ 9486 */
9687 class ShowCombinator extends Combinator { 9487 class ShowCombinator extends Combinator {
9688 /** 9488 /**
9689 * The list of names from the library that are made visible by this combinator . 9489 * The list of names from the library that are made visible by this combinator .
9690 */ 9490 */
9691 NodeList<SimpleIdentifier> _shownNames; 9491 NodeList<SimpleIdentifier> _shownNames;
9692 9492
9693 /** 9493 /**
9694 * Initialize a newly created import show combinator. 9494 * Initialize a newly created import show combinator.
9695 * 9495 *
9696 * @param keyword the comma introducing the combinator 9496 * @param keyword the comma introducing the combinator
9697 * @param shownNames the list of names from the library that are made visible by this combinator 9497 * @param shownNames the list of names from the library that are made visible by this combinator
9698 */ 9498 */
9699 ShowCombinator(Token keyword, List<SimpleIdentifier> shownNames) : super(keywo rd) { 9499 ShowCombinator(Token keyword, List<SimpleIdentifier> shownNames) : super(keywo rd) {
9700 this._shownNames = new NodeList<SimpleIdentifier>(this); 9500 this._shownNames = new NodeList<SimpleIdentifier>(this);
9701 this._shownNames.addAll(shownNames); 9501 this._shownNames.addAll(shownNames);
9702 } 9502 }
9703 9503
9704 accept(ASTVisitor visitor) => visitor.visitShowCombinator(this); 9504 accept(AstVisitor visitor) => visitor.visitShowCombinator(this);
9705 9505
9706 Token get endToken => _shownNames.endToken; 9506 Token get endToken => _shownNames.endToken;
9707 9507
9708 /** 9508 /**
9709 * Return the list of names from the library that are made visible by this com binator. 9509 * Return the list of names from the library that are made visible by this com binator.
9710 * 9510 *
9711 * @return the list of names from the library that are made visible by this co mbinator 9511 * @return the list of names from the library that are made visible by this co mbinator
9712 */ 9512 */
9713 NodeList<SimpleIdentifier> get shownNames => _shownNames; 9513 NodeList<SimpleIdentifier> get shownNames => _shownNames;
9714 9514
9715 void visitChildren(ASTVisitor visitor) { 9515 void visitChildren(AstVisitor visitor) {
9716 _shownNames.accept(visitor); 9516 _shownNames.accept(visitor);
9717 } 9517 }
9718 } 9518 }
9719 9519
9720 /** 9520 /**
9721 * Instances of the class `SimpleFormalParameter` represent a simple formal para meter. 9521 * Instances of the class `SimpleFormalParameter` represent a simple formal para meter.
9722 * 9522 *
9723 * <pre> 9523 * <pre>
9724 * simpleFormalParameter ::= 9524 * simpleFormalParameter ::=
9725 * ('final' [TypeName] | 'var' | [TypeName])? [SimpleIdentifier] 9525 * ('final' [TypeName] | 'var' | [TypeName])? [SimpleIdentifier]
9726 * </pre> 9526 * </pre>
9727 *
9728 * @coverage dart.engine.ast
9729 */ 9527 */
9730 class SimpleFormalParameter extends NormalFormalParameter { 9528 class SimpleFormalParameter extends NormalFormalParameter {
9731 /** 9529 /**
9732 * The token representing either the 'final', 'const' or 'var' keyword, or `nu ll` if no 9530 * The token representing either the 'final', 'const' or 'var' keyword, or `nu ll` if no
9733 * keyword was used. 9531 * keyword was used.
9734 */ 9532 */
9735 Token keyword; 9533 Token keyword;
9736 9534
9737 /** 9535 /**
9738 * The name of the declared type of the parameter, or `null` if the parameter does not have 9536 * The name of the declared type of the parameter, or `null` if the parameter does not have
9739 * a declared type. 9537 * a declared type.
9740 */ 9538 */
9741 TypeName _type; 9539 TypeName _type;
9742 9540
9743 /** 9541 /**
9744 * Initialize a newly created formal parameter. 9542 * Initialize a newly created formal parameter.
9745 * 9543 *
9746 * @param comment the documentation comment associated with this parameter 9544 * @param comment the documentation comment associated with this parameter
9747 * @param metadata the annotations associated with this parameter 9545 * @param metadata the annotations associated with this parameter
9748 * @param keyword the token representing either the 'final', 'const' or 'var' keyword 9546 * @param keyword the token representing either the 'final', 'const' or 'var' keyword
9749 * @param type the name of the declared type of the parameter 9547 * @param type the name of the declared type of the parameter
9750 * @param identifier the name of the parameter being declared 9548 * @param identifier the name of the parameter being declared
9751 */ 9549 */
9752 SimpleFormalParameter(Comment comment, List<Annotation> metadata, this.keyword , TypeName type, SimpleIdentifier identifier) : super(comment, metadata, identif ier) { 9550 SimpleFormalParameter(Comment comment, List<Annotation> metadata, this.keyword , TypeName type, SimpleIdentifier identifier) : super(comment, metadata, identif ier) {
9753 this._type = becomeParentOf(type); 9551 this._type = becomeParentOf(type);
9754 } 9552 }
9755 9553
9756 accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this); 9554 accept(AstVisitor visitor) => visitor.visitSimpleFormalParameter(this);
9757 9555
9758 Token get beginToken { 9556 Token get beginToken {
9759 if (keyword != null) { 9557 if (keyword != null) {
9760 return keyword; 9558 return keyword;
9761 } else if (_type != null) { 9559 } else if (_type != null) {
9762 return _type.beginToken; 9560 return _type.beginToken;
9763 } 9561 }
9764 return identifier.beginToken; 9562 return identifier.beginToken;
9765 } 9563 }
9766 9564
(...skipping 13 matching lines...) Expand all
9780 9578
9781 /** 9579 /**
9782 * Set the name of the declared type of the parameter to the given type name. 9580 * Set the name of the declared type of the parameter to the given type name.
9783 * 9581 *
9784 * @param typeName the name of the declared type of the parameter 9582 * @param typeName the name of the declared type of the parameter
9785 */ 9583 */
9786 void set type(TypeName typeName) { 9584 void set type(TypeName typeName) {
9787 _type = becomeParentOf(typeName); 9585 _type = becomeParentOf(typeName);
9788 } 9586 }
9789 9587
9790 void visitChildren(ASTVisitor visitor) { 9588 void visitChildren(AstVisitor visitor) {
9791 super.visitChildren(visitor); 9589 super.visitChildren(visitor);
9792 safelyVisitChild(_type, visitor); 9590 safelyVisitChild(_type, visitor);
9793 safelyVisitChild(identifier, visitor); 9591 safelyVisitChild(identifier, visitor);
9794 } 9592 }
9795 } 9593 }
9796 9594
9797 /** 9595 /**
9798 * Instances of the class `SimpleIdentifier` represent a simple identifier. 9596 * Instances of the class `SimpleIdentifier` represent a simple identifier.
9799 * 9597 *
9800 * <pre> 9598 * <pre>
9801 * simpleIdentifier ::= 9599 * simpleIdentifier ::=
9802 * initialCharacter internalCharacter* 9600 * initialCharacter internalCharacter*
9803 * 9601 *
9804 * initialCharacter ::= '_' | '$' | letter 9602 * initialCharacter ::= '_' | '$' | letter
9805 * 9603 *
9806 * internalCharacter ::= '_' | '$' | letter | digit 9604 * internalCharacter ::= '_' | '$' | letter | digit
9807 * </pre> 9605 * </pre>
9808 *
9809 * @coverage dart.engine.ast
9810 */ 9606 */
9811 class SimpleIdentifier extends Identifier { 9607 class SimpleIdentifier extends Identifier {
9812 /** 9608 /**
9813 * The token representing the identifier. 9609 * The token representing the identifier.
9814 */ 9610 */
9815 Token token; 9611 Token token;
9816 9612
9817 /** 9613 /**
9818 * The element associated with this identifier based on static type informatio n, or `null` 9614 * The element associated with this identifier based on static type informatio n, or `null`
9819 * if the AST structure has not been resolved or if this identifier could not be resolved. 9615 * if the AST structure has not been resolved or if this identifier could not be resolved.
(...skipping 14 matching lines...) Expand all
9834 */ 9630 */
9835 AuxiliaryElements auxiliaryElements = null; 9631 AuxiliaryElements auxiliaryElements = null;
9836 9632
9837 /** 9633 /**
9838 * Initialize a newly created identifier. 9634 * Initialize a newly created identifier.
9839 * 9635 *
9840 * @param token the token representing the identifier 9636 * @param token the token representing the identifier
9841 */ 9637 */
9842 SimpleIdentifier(this.token); 9638 SimpleIdentifier(this.token);
9843 9639
9844 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); 9640 accept(AstVisitor visitor) => visitor.visitSimpleIdentifier(this);
9845 9641
9846 Token get beginToken => token; 9642 Token get beginToken => token;
9847 9643
9848 Element get bestElement { 9644 Element get bestElement {
9849 if (_propagatedElement == null) { 9645 if (_propagatedElement == null) {
9850 return _staticElement; 9646 return _staticElement;
9851 } 9647 }
9852 return _propagatedElement; 9648 return _propagatedElement;
9853 } 9649 }
9854 9650
9855 Token get endToken => token; 9651 Token get endToken => token;
9856 9652
9857 String get name => token.lexeme; 9653 String get name => token.lexeme;
9858 9654
9859 int get precedence => 16; 9655 int get precedence => 16;
9860 9656
9861 Element get propagatedElement => _propagatedElement; 9657 Element get propagatedElement => _propagatedElement;
9862 9658
9863 Element get staticElement => _staticElement; 9659 Element get staticElement => _staticElement;
9864 9660
9865 /** 9661 /**
9866 * Return `true` if this identifier is the name being declared in a declaratio n. 9662 * Return `true` if this identifier is the name being declared in a declaratio n.
9867 * 9663 *
9868 * @return `true` if this identifier is the name being declared in a declarati on 9664 * @return `true` if this identifier is the name being declared in a declarati on
9869 */ 9665 */
9870 bool inDeclarationContext() { 9666 bool inDeclarationContext() {
9871 ASTNode parent = this.parent; 9667 AstNode parent = this.parent;
9872 if (parent is CatchClause) { 9668 if (parent is CatchClause) {
9873 CatchClause clause = parent; 9669 CatchClause clause = parent;
9874 return identical(this, clause.exceptionParameter) || identical(this, claus e.stackTraceParameter); 9670 return identical(this, clause.exceptionParameter) || identical(this, claus e.stackTraceParameter);
9875 } else if (parent is ClassDeclaration) { 9671 } else if (parent is ClassDeclaration) {
9876 return identical(this, parent.name); 9672 return identical(this, parent.name);
9877 } else if (parent is ClassTypeAlias) { 9673 } else if (parent is ClassTypeAlias) {
9878 return identical(this, parent.name); 9674 return identical(this, parent.name);
9879 } else if (parent is ConstructorDeclaration) { 9675 } else if (parent is ConstructorDeclaration) {
9880 return identical(this, parent.name); 9676 return identical(this, parent.name);
9881 } else if (parent is DeclaredIdentifier) { 9677 } else if (parent is DeclaredIdentifier) {
(...skipping 19 matching lines...) Expand all
9901 /** 9697 /**
9902 * Return `true` if this expression is computing a right-hand value. 9698 * Return `true` if this expression is computing a right-hand value.
9903 * 9699 *
9904 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e 9700 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e
9905 * they mutually exclusive. In other words, it is possible for both methods to return `true` 9701 * they mutually exclusive. In other words, it is possible for both methods to return `true`
9906 * when invoked on the same node. 9702 * when invoked on the same node.
9907 * 9703 *
9908 * @return `true` if this expression is in a context where a getter will be in voked 9704 * @return `true` if this expression is in a context where a getter will be in voked
9909 */ 9705 */
9910 bool inGetterContext() { 9706 bool inGetterContext() {
9911 ASTNode parent = this.parent; 9707 AstNode parent = this.parent;
9912 ASTNode target = this; 9708 AstNode target = this;
9913 // skip prefix 9709 // skip prefix
9914 if (parent is PrefixedIdentifier) { 9710 if (parent is PrefixedIdentifier) {
9915 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; 9711 PrefixedIdentifier prefixed = parent as PrefixedIdentifier;
9916 if (identical(prefixed.prefix, this)) { 9712 if (identical(prefixed.prefix, this)) {
9917 return true; 9713 return true;
9918 } 9714 }
9919 parent = prefixed.parent; 9715 parent = prefixed.parent;
9920 target = prefixed; 9716 target = prefixed;
9921 } else if (parent is PropertyAccess) { 9717 } else if (parent is PropertyAccess) {
9922 PropertyAccess access = parent as PropertyAccess; 9718 PropertyAccess access = parent as PropertyAccess;
(...skipping 20 matching lines...) Expand all
9943 /** 9739 /**
9944 * Return `true` if this expression is computing a left-hand value. 9740 * Return `true` if this expression is computing a left-hand value.
9945 * 9741 *
9946 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e 9742 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e
9947 * they mutually exclusive. In other words, it is possible for both methods to return `true` 9743 * they mutually exclusive. In other words, it is possible for both methods to return `true`
9948 * when invoked on the same node. 9744 * when invoked on the same node.
9949 * 9745 *
9950 * @return `true` if this expression is in a context where a setter will be in voked 9746 * @return `true` if this expression is in a context where a setter will be in voked
9951 */ 9747 */
9952 bool inSetterContext() { 9748 bool inSetterContext() {
9953 ASTNode parent = this.parent; 9749 AstNode parent = this.parent;
9954 ASTNode target = this; 9750 AstNode target = this;
9955 // skip prefix 9751 // skip prefix
9956 if (parent is PrefixedIdentifier) { 9752 if (parent is PrefixedIdentifier) {
9957 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; 9753 PrefixedIdentifier prefixed = parent as PrefixedIdentifier;
9958 // if this is the prefix, then return false 9754 // if this is the prefix, then return false
9959 if (identical(prefixed.prefix, this)) { 9755 if (identical(prefixed.prefix, this)) {
9960 return false; 9756 return false;
9961 } 9757 }
9962 parent = prefixed.parent; 9758 parent = prefixed.parent;
9963 target = prefixed; 9759 target = prefixed;
9964 } else if (parent is PropertyAccess) { 9760 } else if (parent is PropertyAccess) {
(...skipping 30 matching lines...) Expand all
9995 /** 9791 /**
9996 * Set the element associated with this identifier based on static type inform ation to the given 9792 * Set the element associated with this identifier based on static type inform ation to the given
9997 * element. 9793 * element.
9998 * 9794 *
9999 * @param element the element to be associated with this identifier 9795 * @param element the element to be associated with this identifier
10000 */ 9796 */
10001 void set staticElement(Element element) { 9797 void set staticElement(Element element) {
10002 _staticElement = validateElement2(element); 9798 _staticElement = validateElement2(element);
10003 } 9799 }
10004 9800
10005 void visitChildren(ASTVisitor visitor) { 9801 void visitChildren(AstVisitor visitor) {
10006 } 9802 }
10007 9803
10008 /** 9804 /**
10009 * Return the given element if it is an appropriate element based on the paren t of this 9805 * Return the given element if it is an appropriate element based on the paren t of this
10010 * identifier, or `null` if it is not appropriate. 9806 * identifier, or `null` if it is not appropriate.
10011 * 9807 *
10012 * @param element the element to be associated with this identifier 9808 * @param element the element to be associated with this identifier
10013 * @return the element to be associated with this identifier 9809 * @return the element to be associated with this identifier
10014 */ 9810 */
10015 Element validateElement(ASTNode parent, Type expectedClass, Element element) { 9811 Element validateElement(AstNode parent, Type expectedClass, Element element) {
10016 if (!isInstanceOf(element, expectedClass)) { 9812 if (!isInstanceOf(element, expectedClass)) {
10017 AnalysisEngine.instance.logger.logInformation3("Internal error: attempting to set the name of a ${parent.runtimeType.toString()} to a ${element.runtimeTyp e.toString()}", new JavaException()); 9813 AnalysisEngine.instance.logger.logInformation3("Internal error: attempting to set the name of a ${parent.runtimeType.toString()} to a ${element.runtimeTyp e.toString()}", new JavaException());
10018 return null; 9814 return null;
10019 } 9815 }
10020 return element; 9816 return element;
10021 } 9817 }
10022 9818
10023 /** 9819 /**
10024 * Return the given element if it is an appropriate element based on the paren t of this 9820 * Return the given element if it is an appropriate element based on the paren t of this
10025 * identifier, or `null` if it is not appropriate. 9821 * identifier, or `null` if it is not appropriate.
10026 * 9822 *
10027 * @param element the element to be associated with this identifier 9823 * @param element the element to be associated with this identifier
10028 * @return the element to be associated with this identifier 9824 * @return the element to be associated with this identifier
10029 */ 9825 */
10030 Element validateElement2(Element element) { 9826 Element validateElement2(Element element) {
10031 if (element == null) { 9827 if (element == null) {
10032 return null; 9828 return null;
10033 } 9829 }
10034 ASTNode parent = this.parent; 9830 AstNode parent = this.parent;
10035 if (parent is ClassDeclaration && identical(parent.name, this)) { 9831 if (parent is ClassDeclaration && identical(parent.name, this)) {
10036 return validateElement(parent, ClassElement, element); 9832 return validateElement(parent, ClassElement, element);
10037 } else if (parent is ClassTypeAlias && identical(parent.name, this)) { 9833 } else if (parent is ClassTypeAlias && identical(parent.name, this)) {
10038 return validateElement(parent, ClassElement, element); 9834 return validateElement(parent, ClassElement, element);
10039 } else if (parent is DeclaredIdentifier && identical(parent.identifier, this )) { 9835 } else if (parent is DeclaredIdentifier && identical(parent.identifier, this )) {
10040 return validateElement(parent, LocalVariableElement, element); 9836 return validateElement(parent, LocalVariableElement, element);
10041 } else if (parent is FormalParameter && identical(parent.identifier, this)) { 9837 } else if (parent is FormalParameter && identical(parent.identifier, this)) {
10042 return validateElement(parent, ParameterElement, element); 9838 return validateElement(parent, ParameterElement, element);
10043 } else if (parent is FunctionDeclaration && identical(parent.name, this)) { 9839 } else if (parent is FunctionDeclaration && identical(parent.name, this)) {
10044 return validateElement(parent, ExecutableElement, element); 9840 return validateElement(parent, ExecutableElement, element);
(...skipping 27 matching lines...) Expand all
10072 * | singleLineStringLiteral 9868 * | singleLineStringLiteral
10073 * 9869 *
10074 * multiLineStringLiteral ::= 9870 * multiLineStringLiteral ::=
10075 * "'''" characters "'''" 9871 * "'''" characters "'''"
10076 * | '"""' characters '"""' 9872 * | '"""' characters '"""'
10077 * 9873 *
10078 * singleLineStringLiteral ::= 9874 * singleLineStringLiteral ::=
10079 * "'" characters "'" 9875 * "'" characters "'"
10080 * '"' characters '"' 9876 * '"' characters '"'
10081 * </pre> 9877 * </pre>
10082 *
10083 * @coverage dart.engine.ast
10084 */ 9878 */
10085 class SimpleStringLiteral extends StringLiteral { 9879 class SimpleStringLiteral extends StringLiteral {
10086 /** 9880 /**
10087 * The token representing the literal. 9881 * The token representing the literal.
10088 */ 9882 */
10089 Token literal; 9883 Token literal;
10090 9884
10091 /** 9885 /**
10092 * The value of the literal. 9886 * The value of the literal.
10093 */ 9887 */
10094 String _value; 9888 String _value;
10095 9889
10096 /** 9890 /**
10097 * The toolkit specific element associated with this literal, or `null`. 9891 * The toolkit specific element associated with this literal, or `null`.
10098 */ 9892 */
10099 Element _toolkitElement; 9893 Element _toolkitElement;
10100 9894
10101 /** 9895 /**
10102 * Initialize a newly created simple string literal. 9896 * Initialize a newly created simple string literal.
10103 * 9897 *
10104 * @param literal the token representing the literal 9898 * @param literal the token representing the literal
10105 * @param value the value of the literal 9899 * @param value the value of the literal
10106 */ 9900 */
10107 SimpleStringLiteral(this.literal, String value) { 9901 SimpleStringLiteral(this.literal, String value) {
10108 this._value = StringUtilities.intern(value); 9902 this._value = StringUtilities.intern(value);
10109 } 9903 }
10110 9904
10111 accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this); 9905 accept(AstVisitor visitor) => visitor.visitSimpleStringLiteral(this);
10112 9906
10113 Token get beginToken => literal; 9907 Token get beginToken => literal;
10114 9908
10115 Token get endToken => literal; 9909 Token get endToken => literal;
10116 9910
10117 /** 9911 /**
10118 * Return the toolkit specific, non-Dart, element associated with this literal , or `null`. 9912 * Return the toolkit specific, non-Dart, element associated with this literal , or `null`.
10119 * 9913 *
10120 * @return the element associated with this literal 9914 * @return the element associated with this literal
10121 */ 9915 */
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
10179 9973
10180 /** 9974 /**
10181 * Set the value of the literal to the given string. 9975 * Set the value of the literal to the given string.
10182 * 9976 *
10183 * @param string the value of the literal 9977 * @param string the value of the literal
10184 */ 9978 */
10185 void set value(String string) { 9979 void set value(String string) {
10186 _value = StringUtilities.intern(_value); 9980 _value = StringUtilities.intern(_value);
10187 } 9981 }
10188 9982
10189 void visitChildren(ASTVisitor visitor) { 9983 void visitChildren(AstVisitor visitor) {
10190 } 9984 }
10191 9985
10192 void appendStringValue(JavaStringBuilder builder) { 9986 void appendStringValue(JavaStringBuilder builder) {
10193 builder.append(value); 9987 builder.append(value);
10194 } 9988 }
10195 } 9989 }
10196 9990
10197 /** 9991 /**
10198 * Instances of the class `Statement` defines the behavior common to nodes that represent a 9992 * Instances of the class `Statement` defines the behavior common to nodes that represent a
10199 * statement. 9993 * statement.
10200 * 9994 *
10201 * <pre> 9995 * <pre>
10202 * statement ::= 9996 * statement ::=
10203 * [Block] 9997 * [Block]
10204 * | [VariableDeclarationStatement] 9998 * | [VariableDeclarationStatement]
10205 * | [ForStatement] 9999 * | [ForStatement]
10206 * | [ForEachStatement] 10000 * | [ForEachStatement]
10207 * | [WhileStatement] 10001 * | [WhileStatement]
10208 * | [DoStatement] 10002 * | [DoStatement]
10209 * | [SwitchStatement] 10003 * | [SwitchStatement]
10210 * | [IfStatement] 10004 * | [IfStatement]
10211 * | [TryStatement] 10005 * | [TryStatement]
10212 * | [BreakStatement] 10006 * | [BreakStatement]
10213 * | [ContinueStatement] 10007 * | [ContinueStatement]
10214 * | [ReturnStatement] 10008 * | [ReturnStatement]
10215 * | [ExpressionStatement] 10009 * | [ExpressionStatement]
10216 * | [FunctionDeclarationStatement] 10010 * | [FunctionDeclarationStatement]
10217 * </pre> 10011 * </pre>
10218 *
10219 * @coverage dart.engine.ast
10220 */ 10012 */
10221 abstract class Statement extends ASTNode { 10013 abstract class Statement extends AstNode {
10222 } 10014 }
10223 10015
10224 /** 10016 /**
10225 * Instances of the class `StringInterpolation` represent a string interpolation literal. 10017 * Instances of the class `StringInterpolation` represent a string interpolation literal.
10226 * 10018 *
10227 * <pre> 10019 * <pre>
10228 * stringInterpolation ::= 10020 * stringInterpolation ::=
10229 * ''' [InterpolationElement]* ''' 10021 * ''' [InterpolationElement]* '''
10230 * | '"' [InterpolationElement]* '"' 10022 * | '"' [InterpolationElement]* '"'
10231 * </pre> 10023 * </pre>
10232 *
10233 * @coverage dart.engine.ast
10234 */ 10024 */
10235 class StringInterpolation extends StringLiteral { 10025 class StringInterpolation extends StringLiteral {
10236 /** 10026 /**
10237 * The elements that will be composed to produce the resulting string. 10027 * The elements that will be composed to produce the resulting string.
10238 */ 10028 */
10239 NodeList<InterpolationElement> _elements; 10029 NodeList<InterpolationElement> _elements;
10240 10030
10241 /** 10031 /**
10242 * Initialize a newly created string interpolation expression. 10032 * Initialize a newly created string interpolation expression.
10243 * 10033 *
10244 * @param elements the elements that will be composed to produce the resulting string 10034 * @param elements the elements that will be composed to produce the resulting string
10245 */ 10035 */
10246 StringInterpolation(List<InterpolationElement> elements) { 10036 StringInterpolation(List<InterpolationElement> elements) {
10247 this._elements = new NodeList<InterpolationElement>(this); 10037 this._elements = new NodeList<InterpolationElement>(this);
10248 this._elements.addAll(elements); 10038 this._elements.addAll(elements);
10249 } 10039 }
10250 10040
10251 accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this); 10041 accept(AstVisitor visitor) => visitor.visitStringInterpolation(this);
10252 10042
10253 Token get beginToken => _elements.beginToken; 10043 Token get beginToken => _elements.beginToken;
10254 10044
10255 /** 10045 /**
10256 * Return the elements that will be composed to produce the resulting string. 10046 * Return the elements that will be composed to produce the resulting string.
10257 * 10047 *
10258 * @return the elements that will be composed to produce the resulting string 10048 * @return the elements that will be composed to produce the resulting string
10259 */ 10049 */
10260 NodeList<InterpolationElement> get elements => _elements; 10050 NodeList<InterpolationElement> get elements => _elements;
10261 10051
10262 Token get endToken => _elements.endToken; 10052 Token get endToken => _elements.endToken;
10263 10053
10264 void visitChildren(ASTVisitor visitor) { 10054 void visitChildren(AstVisitor visitor) {
10265 _elements.accept(visitor); 10055 _elements.accept(visitor);
10266 } 10056 }
10267 10057
10268 void appendStringValue(JavaStringBuilder builder) { 10058 void appendStringValue(JavaStringBuilder builder) {
10269 throw new IllegalArgumentException(); 10059 throw new IllegalArgumentException();
10270 } 10060 }
10271 } 10061 }
10272 10062
10273 /** 10063 /**
10274 * Instances of the class `StringLiteral` represent a string literal expression. 10064 * Instances of the class `StringLiteral` represent a string literal expression.
10275 * 10065 *
10276 * <pre> 10066 * <pre>
10277 * stringLiteral ::= 10067 * stringLiteral ::=
10278 * [SimpleStringLiteral] 10068 * [SimpleStringLiteral]
10279 * | [AdjacentStrings] 10069 * | [AdjacentStrings]
10280 * | [StringInterpolation] 10070 * | [StringInterpolation]
10281 * </pre> 10071 * </pre>
10282 *
10283 * @coverage dart.engine.ast
10284 */ 10072 */
10285 abstract class StringLiteral extends Literal { 10073 abstract class StringLiteral extends Literal {
10286 /** 10074 /**
10287 * Return the value of the string literal, or `null` if the string is not a co nstant string 10075 * Return the value of the string literal, or `null` if the string is not a co nstant string
10288 * without any string interpolation. 10076 * without any string interpolation.
10289 * 10077 *
10290 * @return the value of the string literal 10078 * @return the value of the string literal
10291 */ 10079 */
10292 String get stringValue { 10080 String get stringValue {
10293 JavaStringBuilder builder = new JavaStringBuilder(); 10081 JavaStringBuilder builder = new JavaStringBuilder();
(...skipping 16 matching lines...) Expand all
10310 } 10098 }
10311 10099
10312 /** 10100 /**
10313 * Instances of the class `SuperConstructorInvocation` represent the invocation of a 10101 * Instances of the class `SuperConstructorInvocation` represent the invocation of a
10314 * superclass' constructor from within a constructor's initialization list. 10102 * superclass' constructor from within a constructor's initialization list.
10315 * 10103 *
10316 * <pre> 10104 * <pre>
10317 * superInvocation ::= 10105 * superInvocation ::=
10318 * 'super' ('.' [SimpleIdentifier])? [ArgumentList] 10106 * 'super' ('.' [SimpleIdentifier])? [ArgumentList]
10319 * </pre> 10107 * </pre>
10320 *
10321 * @coverage dart.engine.ast
10322 */ 10108 */
10323 class SuperConstructorInvocation extends ConstructorInitializer { 10109 class SuperConstructorInvocation extends ConstructorInitializer {
10324 /** 10110 /**
10325 * The token for the 'super' keyword. 10111 * The token for the 'super' keyword.
10326 */ 10112 */
10327 Token keyword; 10113 Token keyword;
10328 10114
10329 /** 10115 /**
10330 * The token for the period before the name of the constructor that is being i nvoked, or 10116 * The token for the period before the name of the constructor that is being i nvoked, or
10331 * `null` if the unnamed constructor is being invoked. 10117 * `null` if the unnamed constructor is being invoked.
(...skipping 24 matching lines...) Expand all
10356 * @param keyword the token for the 'super' keyword 10142 * @param keyword the token for the 'super' keyword
10357 * @param period the token for the period before the name of the constructor t hat is being invoked 10143 * @param period the token for the period before the name of the constructor t hat is being invoked
10358 * @param constructorName the name of the constructor that is being invoked 10144 * @param constructorName the name of the constructor that is being invoked
10359 * @param argumentList the list of arguments to the constructor 10145 * @param argumentList the list of arguments to the constructor
10360 */ 10146 */
10361 SuperConstructorInvocation(this.keyword, this.period, SimpleIdentifier constru ctorName, ArgumentList argumentList) { 10147 SuperConstructorInvocation(this.keyword, this.period, SimpleIdentifier constru ctorName, ArgumentList argumentList) {
10362 this._constructorName = becomeParentOf(constructorName); 10148 this._constructorName = becomeParentOf(constructorName);
10363 this._argumentList = becomeParentOf(argumentList); 10149 this._argumentList = becomeParentOf(argumentList);
10364 } 10150 }
10365 10151
10366 accept(ASTVisitor visitor) => visitor.visitSuperConstructorInvocation(this); 10152 accept(AstVisitor visitor) => visitor.visitSuperConstructorInvocation(this);
10367 10153
10368 /** 10154 /**
10369 * Return the list of arguments to the constructor. 10155 * Return the list of arguments to the constructor.
10370 * 10156 *
10371 * @return the list of arguments to the constructor 10157 * @return the list of arguments to the constructor
10372 */ 10158 */
10373 ArgumentList get argumentList => _argumentList; 10159 ArgumentList get argumentList => _argumentList;
10374 10160
10375 Token get beginToken => keyword; 10161 Token get beginToken => keyword;
10376 10162
(...skipping 18 matching lines...) Expand all
10395 10181
10396 /** 10182 /**
10397 * Set the name of the constructor that is being invoked to the given identifi er. 10183 * Set the name of the constructor that is being invoked to the given identifi er.
10398 * 10184 *
10399 * @param identifier the name of the constructor that is being invoked 10185 * @param identifier the name of the constructor that is being invoked
10400 */ 10186 */
10401 void set constructorName(SimpleIdentifier identifier) { 10187 void set constructorName(SimpleIdentifier identifier) {
10402 _constructorName = becomeParentOf(identifier); 10188 _constructorName = becomeParentOf(identifier);
10403 } 10189 }
10404 10190
10405 void visitChildren(ASTVisitor visitor) { 10191 void visitChildren(AstVisitor visitor) {
10406 safelyVisitChild(_constructorName, visitor); 10192 safelyVisitChild(_constructorName, visitor);
10407 safelyVisitChild(_argumentList, visitor); 10193 safelyVisitChild(_argumentList, visitor);
10408 } 10194 }
10409 } 10195 }
10410 10196
10411 /** 10197 /**
10412 * Instances of the class `SuperExpression` represent a super expression. 10198 * Instances of the class `SuperExpression` represent a super expression.
10413 * 10199 *
10414 * <pre> 10200 * <pre>
10415 * superExpression ::= 10201 * superExpression ::=
10416 * 'super' 10202 * 'super'
10417 * </pre> 10203 * </pre>
10418 *
10419 * @coverage dart.engine.ast
10420 */ 10204 */
10421 class SuperExpression extends Expression { 10205 class SuperExpression extends Expression {
10422 /** 10206 /**
10423 * The token representing the keyword. 10207 * The token representing the keyword.
10424 */ 10208 */
10425 Token keyword; 10209 Token keyword;
10426 10210
10427 /** 10211 /**
10428 * Initialize a newly created super expression. 10212 * Initialize a newly created super expression.
10429 * 10213 *
10430 * @param keyword the token representing the keyword 10214 * @param keyword the token representing the keyword
10431 */ 10215 */
10432 SuperExpression(this.keyword); 10216 SuperExpression(this.keyword);
10433 10217
10434 accept(ASTVisitor visitor) => visitor.visitSuperExpression(this); 10218 accept(AstVisitor visitor) => visitor.visitSuperExpression(this);
10435 10219
10436 Token get beginToken => keyword; 10220 Token get beginToken => keyword;
10437 10221
10438 Token get endToken => keyword; 10222 Token get endToken => keyword;
10439 10223
10440 int get precedence => 16; 10224 int get precedence => 16;
10441 10225
10442 void visitChildren(ASTVisitor visitor) { 10226 void visitChildren(AstVisitor visitor) {
10443 } 10227 }
10444 } 10228 }
10445 10229
10446 /** 10230 /**
10447 * Instances of the class `SwitchCase` represent the case in a switch statement. 10231 * Instances of the class `SwitchCase` represent the case in a switch statement.
10448 * 10232 *
10449 * <pre> 10233 * <pre>
10450 * switchCase ::= 10234 * switchCase ::=
10451 * [SimpleIdentifier]* 'case' [Expression] ':' [Statement]* 10235 * [SimpleIdentifier]* 'case' [Expression] ':' [Statement]*
10452 * </pre> 10236 * </pre>
10453 *
10454 * @coverage dart.engine.ast
10455 */ 10237 */
10456 class SwitchCase extends SwitchMember { 10238 class SwitchCase extends SwitchMember {
10457 /** 10239 /**
10458 * The expression controlling whether the statements will be executed. 10240 * The expression controlling whether the statements will be executed.
10459 */ 10241 */
10460 Expression _expression; 10242 Expression _expression;
10461 10243
10462 /** 10244 /**
10463 * Initialize a newly created switch case. 10245 * Initialize a newly created switch case.
10464 * 10246 *
10465 * @param labels the labels associated with the switch member 10247 * @param labels the labels associated with the switch member
10466 * @param keyword the token representing the 'case' or 'default' keyword 10248 * @param keyword the token representing the 'case' or 'default' keyword
10467 * @param expression the expression controlling whether the statements will be executed 10249 * @param expression the expression controlling whether the statements will be executed
10468 * @param colon the colon separating the keyword or the expression from the st atements 10250 * @param colon the colon separating the keyword or the expression from the st atements
10469 * @param statements the statements that will be executed if this switch membe r is selected 10251 * @param statements the statements that will be executed if this switch membe r is selected
10470 */ 10252 */
10471 SwitchCase(List<Label> labels, Token keyword, Expression expression, Token col on, List<Statement> statements) : super(labels, keyword, colon, statements) { 10253 SwitchCase(List<Label> labels, Token keyword, Expression expression, Token col on, List<Statement> statements) : super(labels, keyword, colon, statements) {
10472 this._expression = becomeParentOf(expression); 10254 this._expression = becomeParentOf(expression);
10473 } 10255 }
10474 10256
10475 accept(ASTVisitor visitor) => visitor.visitSwitchCase(this); 10257 accept(AstVisitor visitor) => visitor.visitSwitchCase(this);
10476 10258
10477 /** 10259 /**
10478 * Return the expression controlling whether the statements will be executed. 10260 * Return the expression controlling whether the statements will be executed.
10479 * 10261 *
10480 * @return the expression controlling whether the statements will be executed 10262 * @return the expression controlling whether the statements will be executed
10481 */ 10263 */
10482 Expression get expression => _expression; 10264 Expression get expression => _expression;
10483 10265
10484 /** 10266 /**
10485 * Set the expression controlling whether the statements will be executed to t he given expression. 10267 * Set the expression controlling whether the statements will be executed to t he given expression.
10486 * 10268 *
10487 * @param expression the expression controlling whether the statements will be executed 10269 * @param expression the expression controlling whether the statements will be executed
10488 */ 10270 */
10489 void set expression(Expression expression) { 10271 void set expression(Expression expression) {
10490 this._expression = becomeParentOf(expression); 10272 this._expression = becomeParentOf(expression);
10491 } 10273 }
10492 10274
10493 void visitChildren(ASTVisitor visitor) { 10275 void visitChildren(AstVisitor visitor) {
10494 labels.accept(visitor); 10276 labels.accept(visitor);
10495 safelyVisitChild(_expression, visitor); 10277 safelyVisitChild(_expression, visitor);
10496 statements.accept(visitor); 10278 statements.accept(visitor);
10497 } 10279 }
10498 } 10280 }
10499 10281
10500 /** 10282 /**
10501 * Instances of the class `SwitchDefault` represent the default case in a switch statement. 10283 * Instances of the class `SwitchDefault` represent the default case in a switch statement.
10502 * 10284 *
10503 * <pre> 10285 * <pre>
10504 * switchDefault ::= 10286 * switchDefault ::=
10505 * [SimpleIdentifier]* 'default' ':' [Statement]* 10287 * [SimpleIdentifier]* 'default' ':' [Statement]*
10506 * </pre> 10288 * </pre>
10507 *
10508 * @coverage dart.engine.ast
10509 */ 10289 */
10510 class SwitchDefault extends SwitchMember { 10290 class SwitchDefault extends SwitchMember {
10511 /** 10291 /**
10512 * Initialize a newly created switch default. 10292 * Initialize a newly created switch default.
10513 * 10293 *
10514 * @param labels the labels associated with the switch member 10294 * @param labels the labels associated with the switch member
10515 * @param keyword the token representing the 'case' or 'default' keyword 10295 * @param keyword the token representing the 'case' or 'default' keyword
10516 * @param colon the colon separating the keyword or the expression from the st atements 10296 * @param colon the colon separating the keyword or the expression from the st atements
10517 * @param statements the statements that will be executed if this switch membe r is selected 10297 * @param statements the statements that will be executed if this switch membe r is selected
10518 */ 10298 */
10519 SwitchDefault(List<Label> labels, Token keyword, Token colon, List<Statement> statements) : super(labels, keyword, colon, statements); 10299 SwitchDefault(List<Label> labels, Token keyword, Token colon, List<Statement> statements) : super(labels, keyword, colon, statements);
10520 10300
10521 accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this); 10301 accept(AstVisitor visitor) => visitor.visitSwitchDefault(this);
10522 10302
10523 void visitChildren(ASTVisitor visitor) { 10303 void visitChildren(AstVisitor visitor) {
10524 labels.accept(visitor); 10304 labels.accept(visitor);
10525 statements.accept(visitor); 10305 statements.accept(visitor);
10526 } 10306 }
10527 } 10307 }
10528 10308
10529 /** 10309 /**
10530 * The abstract class `SwitchMember` defines the behavior common to objects repr esenting 10310 * The abstract class `SwitchMember` defines the behavior common to objects repr esenting
10531 * elements within a switch statement. 10311 * elements within a switch statement.
10532 * 10312 *
10533 * <pre> 10313 * <pre>
10534 * switchMember ::= 10314 * switchMember ::=
10535 * switchCase 10315 * switchCase
10536 * | switchDefault 10316 * | switchDefault
10537 * </pre> 10317 * </pre>
10538 *
10539 * @coverage dart.engine.ast
10540 */ 10318 */
10541 abstract class SwitchMember extends ASTNode { 10319 abstract class SwitchMember extends AstNode {
10542 /** 10320 /**
10543 * The labels associated with the switch member. 10321 * The labels associated with the switch member.
10544 */ 10322 */
10545 NodeList<Label> _labels; 10323 NodeList<Label> _labels;
10546 10324
10547 /** 10325 /**
10548 * The token representing the 'case' or 'default' keyword. 10326 * The token representing the 'case' or 'default' keyword.
10549 */ 10327 */
10550 Token keyword; 10328 Token keyword;
10551 10329
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
10603 NodeList<Statement> get statements => _statements; 10381 NodeList<Statement> get statements => _statements;
10604 } 10382 }
10605 10383
10606 /** 10384 /**
10607 * Instances of the class `SwitchStatement` represent a switch statement. 10385 * Instances of the class `SwitchStatement` represent a switch statement.
10608 * 10386 *
10609 * <pre> 10387 * <pre>
10610 * switchStatement ::= 10388 * switchStatement ::=
10611 * 'switch' '(' [Expression] ')' '{' [SwitchCase]* [SwitchDefault]? '}' 10389 * 'switch' '(' [Expression] ')' '{' [SwitchCase]* [SwitchDefault]? '}'
10612 * </pre> 10390 * </pre>
10613 *
10614 * @coverage dart.engine.ast
10615 */ 10391 */
10616 class SwitchStatement extends Statement { 10392 class SwitchStatement extends Statement {
10617 /** 10393 /**
10618 * The token representing the 'switch' keyword. 10394 * The token representing the 'switch' keyword.
10619 */ 10395 */
10620 Token keyword; 10396 Token keyword;
10621 10397
10622 /** 10398 /**
10623 * The left parenthesis. 10399 * The left parenthesis.
10624 */ 10400 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
10659 * @param leftBracket the left curly bracket 10435 * @param leftBracket the left curly bracket
10660 * @param members the switch members that can be selected by the expression 10436 * @param members the switch members that can be selected by the expression
10661 * @param rightBracket the right curly bracket 10437 * @param rightBracket the right curly bracket
10662 */ 10438 */
10663 SwitchStatement(this.keyword, this.leftParenthesis, Expression expression, thi s.rightParenthesis, this.leftBracket, List<SwitchMember> members, this.rightBrac ket) { 10439 SwitchStatement(this.keyword, this.leftParenthesis, Expression expression, thi s.rightParenthesis, this.leftBracket, List<SwitchMember> members, this.rightBrac ket) {
10664 this._members = new NodeList<SwitchMember>(this); 10440 this._members = new NodeList<SwitchMember>(this);
10665 this._expression = becomeParentOf(expression); 10441 this._expression = becomeParentOf(expression);
10666 this._members.addAll(members); 10442 this._members.addAll(members);
10667 } 10443 }
10668 10444
10669 accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this); 10445 accept(AstVisitor visitor) => visitor.visitSwitchStatement(this);
10670 10446
10671 Token get beginToken => keyword; 10447 Token get beginToken => keyword;
10672 10448
10673 Token get endToken => rightBracket; 10449 Token get endToken => rightBracket;
10674 10450
10675 /** 10451 /**
10676 * Return the expression used to determine which of the switch members will be selected. 10452 * Return the expression used to determine which of the switch members will be selected.
10677 * 10453 *
10678 * @return the expression used to determine which of the switch members will b e selected 10454 * @return the expression used to determine which of the switch members will b e selected
10679 */ 10455 */
10680 Expression get expression => _expression; 10456 Expression get expression => _expression;
10681 10457
10682 /** 10458 /**
10683 * Return the switch members that can be selected by the expression. 10459 * Return the switch members that can be selected by the expression.
10684 * 10460 *
10685 * @return the switch members that can be selected by the expression 10461 * @return the switch members that can be selected by the expression
10686 */ 10462 */
10687 NodeList<SwitchMember> get members => _members; 10463 NodeList<SwitchMember> get members => _members;
10688 10464
10689 /** 10465 /**
10690 * Set the expression used to determine which of the switch members will be se lected to the given 10466 * Set the expression used to determine which of the switch members will be se lected to the given
10691 * expression. 10467 * expression.
10692 * 10468 *
10693 * @param expression the expression used to determine which of the switch memb ers will be selected 10469 * @param expression the expression used to determine which of the switch memb ers will be selected
10694 */ 10470 */
10695 void set expression(Expression expression) { 10471 void set expression(Expression expression) {
10696 this._expression = becomeParentOf(expression); 10472 this._expression = becomeParentOf(expression);
10697 } 10473 }
10698 10474
10699 void visitChildren(ASTVisitor visitor) { 10475 void visitChildren(AstVisitor visitor) {
10700 safelyVisitChild(_expression, visitor); 10476 safelyVisitChild(_expression, visitor);
10701 _members.accept(visitor); 10477 _members.accept(visitor);
10702 } 10478 }
10703 } 10479 }
10704 10480
10705 /** 10481 /**
10706 * Instances of the class `SymbolLiteral` represent a symbol literal expression. 10482 * Instances of the class `SymbolLiteral` represent a symbol literal expression.
10707 * 10483 *
10708 * <pre> 10484 * <pre>
10709 * symbolLiteral ::= 10485 * symbolLiteral ::=
10710 * '#' (operator | (identifier ('.' identifier)*)) 10486 * '#' (operator | (identifier ('.' identifier)*))
10711 * </pre> 10487 * </pre>
10712 *
10713 * @coverage dart.engine.ast
10714 */ 10488 */
10715 class SymbolLiteral extends Literal { 10489 class SymbolLiteral extends Literal {
10716 /** 10490 /**
10717 * The token introducing the literal. 10491 * The token introducing the literal.
10718 */ 10492 */
10719 Token poundSign; 10493 Token poundSign;
10720 10494
10721 /** 10495 /**
10722 * The components of the literal. 10496 * The components of the literal.
10723 */ 10497 */
10724 final List<Token> components; 10498 final List<Token> components;
10725 10499
10726 /** 10500 /**
10727 * Initialize a newly created symbol literal. 10501 * Initialize a newly created symbol literal.
10728 * 10502 *
10729 * @param poundSign the token introducing the literal 10503 * @param poundSign the token introducing the literal
10730 * @param components the components of the literal 10504 * @param components the components of the literal
10731 */ 10505 */
10732 SymbolLiteral(this.poundSign, this.components); 10506 SymbolLiteral(this.poundSign, this.components);
10733 10507
10734 accept(ASTVisitor visitor) => visitor.visitSymbolLiteral(this); 10508 accept(AstVisitor visitor) => visitor.visitSymbolLiteral(this);
10735 10509
10736 Token get beginToken => poundSign; 10510 Token get beginToken => poundSign;
10737 10511
10738 Token get endToken => components[components.length - 1]; 10512 Token get endToken => components[components.length - 1];
10739 10513
10740 void visitChildren(ASTVisitor visitor) { 10514 void visitChildren(AstVisitor visitor) {
10741 } 10515 }
10742 } 10516 }
10743 10517
10744 /** 10518 /**
10745 * Instances of the class `ThisExpression` represent a this expression. 10519 * Instances of the class `ThisExpression` represent a this expression.
10746 * 10520 *
10747 * <pre> 10521 * <pre>
10748 * thisExpression ::= 10522 * thisExpression ::=
10749 * 'this' 10523 * 'this'
10750 * </pre> 10524 * </pre>
10751 *
10752 * @coverage dart.engine.ast
10753 */ 10525 */
10754 class ThisExpression extends Expression { 10526 class ThisExpression extends Expression {
10755 /** 10527 /**
10756 * The token representing the keyword. 10528 * The token representing the keyword.
10757 */ 10529 */
10758 Token keyword; 10530 Token keyword;
10759 10531
10760 /** 10532 /**
10761 * Initialize a newly created this expression. 10533 * Initialize a newly created this expression.
10762 * 10534 *
10763 * @param keyword the token representing the keyword 10535 * @param keyword the token representing the keyword
10764 */ 10536 */
10765 ThisExpression(this.keyword); 10537 ThisExpression(this.keyword);
10766 10538
10767 accept(ASTVisitor visitor) => visitor.visitThisExpression(this); 10539 accept(AstVisitor visitor) => visitor.visitThisExpression(this);
10768 10540
10769 Token get beginToken => keyword; 10541 Token get beginToken => keyword;
10770 10542
10771 Token get endToken => keyword; 10543 Token get endToken => keyword;
10772 10544
10773 int get precedence => 16; 10545 int get precedence => 16;
10774 10546
10775 void visitChildren(ASTVisitor visitor) { 10547 void visitChildren(AstVisitor visitor) {
10776 } 10548 }
10777 } 10549 }
10778 10550
10779 /** 10551 /**
10780 * Instances of the class `ThrowExpression` represent a throw expression. 10552 * Instances of the class `ThrowExpression` represent a throw expression.
10781 * 10553 *
10782 * <pre> 10554 * <pre>
10783 * throwExpression ::= 10555 * throwExpression ::=
10784 * 'throw' [Expression] 10556 * 'throw' [Expression]
10785 * </pre> 10557 * </pre>
10786 *
10787 * @coverage dart.engine.ast
10788 */ 10558 */
10789 class ThrowExpression extends Expression { 10559 class ThrowExpression extends Expression {
10790 /** 10560 /**
10791 * The token representing the 'throw' keyword. 10561 * The token representing the 'throw' keyword.
10792 */ 10562 */
10793 Token keyword; 10563 Token keyword;
10794 10564
10795 /** 10565 /**
10796 * The expression computing the exception to be thrown. 10566 * The expression computing the exception to be thrown.
10797 */ 10567 */
10798 Expression _expression; 10568 Expression _expression;
10799 10569
10800 /** 10570 /**
10801 * Initialize a newly created throw expression. 10571 * Initialize a newly created throw expression.
10802 * 10572 *
10803 * @param keyword the token representing the 'throw' keyword 10573 * @param keyword the token representing the 'throw' keyword
10804 * @param expression the expression computing the exception to be thrown 10574 * @param expression the expression computing the exception to be thrown
10805 */ 10575 */
10806 ThrowExpression(this.keyword, Expression expression) { 10576 ThrowExpression(this.keyword, Expression expression) {
10807 this._expression = becomeParentOf(expression); 10577 this._expression = becomeParentOf(expression);
10808 } 10578 }
10809 10579
10810 accept(ASTVisitor visitor) => visitor.visitThrowExpression(this); 10580 accept(AstVisitor visitor) => visitor.visitThrowExpression(this);
10811 10581
10812 Token get beginToken => keyword; 10582 Token get beginToken => keyword;
10813 10583
10814 Token get endToken { 10584 Token get endToken {
10815 if (_expression != null) { 10585 if (_expression != null) {
10816 return _expression.endToken; 10586 return _expression.endToken;
10817 } 10587 }
10818 return keyword; 10588 return keyword;
10819 } 10589 }
10820 10590
10821 /** 10591 /**
10822 * Return the expression computing the exception to be thrown. 10592 * Return the expression computing the exception to be thrown.
10823 * 10593 *
10824 * @return the expression computing the exception to be thrown 10594 * @return the expression computing the exception to be thrown
10825 */ 10595 */
10826 Expression get expression => _expression; 10596 Expression get expression => _expression;
10827 10597
10828 int get precedence => 0; 10598 int get precedence => 0;
10829 10599
10830 /** 10600 /**
10831 * Set the expression computing the exception to be thrown to the given expres sion. 10601 * Set the expression computing the exception to be thrown to the given expres sion.
10832 * 10602 *
10833 * @param expression the expression computing the exception to be thrown 10603 * @param expression the expression computing the exception to be thrown
10834 */ 10604 */
10835 void set expression(Expression expression) { 10605 void set expression(Expression expression) {
10836 this._expression = becomeParentOf(expression); 10606 this._expression = becomeParentOf(expression);
10837 } 10607 }
10838 10608
10839 void visitChildren(ASTVisitor visitor) { 10609 void visitChildren(AstVisitor visitor) {
10840 safelyVisitChild(_expression, visitor); 10610 safelyVisitChild(_expression, visitor);
10841 } 10611 }
10842 } 10612 }
10843 10613
10844 /** 10614 /**
10845 * Instances of the class `TopLevelVariableDeclaration` represent the declaratio n of one or 10615 * Instances of the class `TopLevelVariableDeclaration` represent the declaratio n of one or
10846 * more top-level variables of the same type. 10616 * more top-level variables of the same type.
10847 * 10617 *
10848 * <pre> 10618 * <pre>
10849 * topLevelVariableDeclaration ::= 10619 * topLevelVariableDeclaration ::=
10850 * ('final' | 'const') type? staticFinalDeclarationList ';' 10620 * ('final' | 'const') type? staticFinalDeclarationList ';'
10851 * | variableDeclaration ';' 10621 * | variableDeclaration ';'
10852 * </pre> 10622 * </pre>
10853 *
10854 * @coverage dart.engine.ast
10855 */ 10623 */
10856 class TopLevelVariableDeclaration extends CompilationUnitMember { 10624 class TopLevelVariableDeclaration extends CompilationUnitMember {
10857 /** 10625 /**
10858 * The top-level variables being declared. 10626 * The top-level variables being declared.
10859 */ 10627 */
10860 VariableDeclarationList _variableList; 10628 VariableDeclarationList _variableList;
10861 10629
10862 /** 10630 /**
10863 * The semicolon terminating the declaration. 10631 * The semicolon terminating the declaration.
10864 */ 10632 */
10865 Token semicolon; 10633 Token semicolon;
10866 10634
10867 /** 10635 /**
10868 * Initialize a newly created top-level variable declaration. 10636 * Initialize a newly created top-level variable declaration.
10869 * 10637 *
10870 * @param comment the documentation comment associated with this variable 10638 * @param comment the documentation comment associated with this variable
10871 * @param metadata the annotations associated with this variable 10639 * @param metadata the annotations associated with this variable
10872 * @param variableList the top-level variables being declared 10640 * @param variableList the top-level variables being declared
10873 * @param semicolon the semicolon terminating the declaration 10641 * @param semicolon the semicolon terminating the declaration
10874 */ 10642 */
10875 TopLevelVariableDeclaration(Comment comment, List<Annotation> metadata, Variab leDeclarationList variableList, this.semicolon) : super(comment, metadata) { 10643 TopLevelVariableDeclaration(Comment comment, List<Annotation> metadata, Variab leDeclarationList variableList, this.semicolon) : super(comment, metadata) {
10876 this._variableList = becomeParentOf(variableList); 10644 this._variableList = becomeParentOf(variableList);
10877 } 10645 }
10878 10646
10879 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); 10647 accept(AstVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this);
10880 10648
10881 Element get element => null; 10649 Element get element => null;
10882 10650
10883 Token get endToken => semicolon; 10651 Token get endToken => semicolon;
10884 10652
10885 /** 10653 /**
10886 * Return the top-level variables being declared. 10654 * Return the top-level variables being declared.
10887 * 10655 *
10888 * @return the top-level variables being declared 10656 * @return the top-level variables being declared
10889 */ 10657 */
10890 VariableDeclarationList get variables => _variableList; 10658 VariableDeclarationList get variables => _variableList;
10891 10659
10892 /** 10660 /**
10893 * Set the top-level variables being declared to the given list of variables. 10661 * Set the top-level variables being declared to the given list of variables.
10894 * 10662 *
10895 * @param variableList the top-level variables being declared 10663 * @param variableList the top-level variables being declared
10896 */ 10664 */
10897 void set variables(VariableDeclarationList variableList) { 10665 void set variables(VariableDeclarationList variableList) {
10898 variableList = becomeParentOf(variableList); 10666 variableList = becomeParentOf(variableList);
10899 } 10667 }
10900 10668
10901 void visitChildren(ASTVisitor visitor) { 10669 void visitChildren(AstVisitor visitor) {
10902 super.visitChildren(visitor); 10670 super.visitChildren(visitor);
10903 safelyVisitChild(_variableList, visitor); 10671 safelyVisitChild(_variableList, visitor);
10904 } 10672 }
10905 10673
10906 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; 10674 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken;
10907 } 10675 }
10908 10676
10909 /** 10677 /**
10910 * Instances of the class `TryStatement` represent a try statement. 10678 * Instances of the class `TryStatement` represent a try statement.
10911 * 10679 *
10912 * <pre> 10680 * <pre>
10913 * tryStatement ::= 10681 * tryStatement ::=
10914 * 'try' [Block] ([CatchClause]+ finallyClause? | finallyClause) 10682 * 'try' [Block] ([CatchClause]+ finallyClause? | finallyClause)
10915 * 10683 *
10916 * finallyClause ::= 10684 * finallyClause ::=
10917 * 'finally' [Block] 10685 * 'finally' [Block]
10918 * </pre> 10686 * </pre>
10919 *
10920 * @coverage dart.engine.ast
10921 */ 10687 */
10922 class TryStatement extends Statement { 10688 class TryStatement extends Statement {
10923 /** 10689 /**
10924 * The token representing the 'try' keyword. 10690 * The token representing the 'try' keyword.
10925 */ 10691 */
10926 Token tryKeyword; 10692 Token tryKeyword;
10927 10693
10928 /** 10694 /**
10929 * The body of the statement. 10695 * The body of the statement.
10930 */ 10696 */
(...skipping 25 matching lines...) Expand all
10956 * @param finallyKeyword the token representing the 'finally' keyword 10722 * @param finallyKeyword the token representing the 'finally' keyword
10957 * @param finallyBlock the finally block contained in the try statement 10723 * @param finallyBlock the finally block contained in the try statement
10958 */ 10724 */
10959 TryStatement(this.tryKeyword, Block body, List<CatchClause> catchClauses, this .finallyKeyword, Block finallyBlock) { 10725 TryStatement(this.tryKeyword, Block body, List<CatchClause> catchClauses, this .finallyKeyword, Block finallyBlock) {
10960 this._catchClauses = new NodeList<CatchClause>(this); 10726 this._catchClauses = new NodeList<CatchClause>(this);
10961 this._body = becomeParentOf(body); 10727 this._body = becomeParentOf(body);
10962 this._catchClauses.addAll(catchClauses); 10728 this._catchClauses.addAll(catchClauses);
10963 this._finallyBlock = becomeParentOf(finallyBlock); 10729 this._finallyBlock = becomeParentOf(finallyBlock);
10964 } 10730 }
10965 10731
10966 accept(ASTVisitor visitor) => visitor.visitTryStatement(this); 10732 accept(AstVisitor visitor) => visitor.visitTryStatement(this);
10967 10733
10968 Token get beginToken => tryKeyword; 10734 Token get beginToken => tryKeyword;
10969 10735
10970 /** 10736 /**
10971 * Return the body of the statement. 10737 * Return the body of the statement.
10972 * 10738 *
10973 * @return the body of the statement 10739 * @return the body of the statement
10974 */ 10740 */
10975 Block get body => _body; 10741 Block get body => _body;
10976 10742
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
11011 10777
11012 /** 10778 /**
11013 * Set the finally block contained in the try statement to the given block. 10779 * Set the finally block contained in the try statement to the given block.
11014 * 10780 *
11015 * @param block the finally block contained in the try statement 10781 * @param block the finally block contained in the try statement
11016 */ 10782 */
11017 void set finallyBlock(Block block) { 10783 void set finallyBlock(Block block) {
11018 _finallyBlock = becomeParentOf(block); 10784 _finallyBlock = becomeParentOf(block);
11019 } 10785 }
11020 10786
11021 void visitChildren(ASTVisitor visitor) { 10787 void visitChildren(AstVisitor visitor) {
11022 safelyVisitChild(_body, visitor); 10788 safelyVisitChild(_body, visitor);
11023 _catchClauses.accept(visitor); 10789 _catchClauses.accept(visitor);
11024 safelyVisitChild(_finallyBlock, visitor); 10790 safelyVisitChild(_finallyBlock, visitor);
11025 } 10791 }
11026 } 10792 }
11027 10793
11028 /** 10794 /**
11029 * The abstract class `TypeAlias` defines the behavior common to declarations of type aliases. 10795 * The abstract class `TypeAlias` defines the behavior common to declarations of type aliases.
11030 * 10796 *
11031 * <pre> 10797 * <pre>
11032 * typeAlias ::= 10798 * typeAlias ::=
11033 * 'typedef' typeAliasBody 10799 * 'typedef' typeAliasBody
11034 * 10800 *
11035 * typeAliasBody ::= 10801 * typeAliasBody ::=
11036 * classTypeAlias 10802 * classTypeAlias
11037 * | functionTypeAlias 10803 * | functionTypeAlias
11038 * </pre> 10804 * </pre>
11039 *
11040 * @coverage dart.engine.ast
11041 */ 10805 */
11042 abstract class TypeAlias extends CompilationUnitMember { 10806 abstract class TypeAlias extends CompilationUnitMember {
11043 /** 10807 /**
11044 * The token representing the 'typedef' keyword. 10808 * The token representing the 'typedef' keyword.
11045 */ 10809 */
11046 Token keyword; 10810 Token keyword;
11047 10811
11048 /** 10812 /**
11049 * The semicolon terminating the declaration. 10813 * The semicolon terminating the declaration.
11050 */ 10814 */
(...skipping 14 matching lines...) Expand all
11065 Token get firstTokenAfterCommentAndMetadata => keyword; 10829 Token get firstTokenAfterCommentAndMetadata => keyword;
11066 } 10830 }
11067 10831
11068 /** 10832 /**
11069 * Instances of the class `TypeArgumentList` represent a list of type arguments. 10833 * Instances of the class `TypeArgumentList` represent a list of type arguments.
11070 * 10834 *
11071 * <pre> 10835 * <pre>
11072 * typeArguments ::= 10836 * typeArguments ::=
11073 * '<' typeName (',' typeName)* '>' 10837 * '<' typeName (',' typeName)* '>'
11074 * </pre> 10838 * </pre>
11075 *
11076 * @coverage dart.engine.ast
11077 */ 10839 */
11078 class TypeArgumentList extends ASTNode { 10840 class TypeArgumentList extends AstNode {
11079 /** 10841 /**
11080 * The left bracket. 10842 * The left bracket.
11081 */ 10843 */
11082 Token leftBracket; 10844 Token leftBracket;
11083 10845
11084 /** 10846 /**
11085 * The type arguments associated with the type. 10847 * The type arguments associated with the type.
11086 */ 10848 */
11087 NodeList<TypeName> _arguments; 10849 NodeList<TypeName> _arguments;
11088 10850
11089 /** 10851 /**
11090 * The right bracket. 10852 * The right bracket.
11091 */ 10853 */
11092 Token rightBracket; 10854 Token rightBracket;
11093 10855
11094 /** 10856 /**
11095 * Initialize a newly created list of type arguments. 10857 * Initialize a newly created list of type arguments.
11096 * 10858 *
11097 * @param leftBracket the left bracket 10859 * @param leftBracket the left bracket
11098 * @param arguments the type arguments associated with the type 10860 * @param arguments the type arguments associated with the type
11099 * @param rightBracket the right bracket 10861 * @param rightBracket the right bracket
11100 */ 10862 */
11101 TypeArgumentList(this.leftBracket, List<TypeName> arguments, this.rightBracket ) { 10863 TypeArgumentList(this.leftBracket, List<TypeName> arguments, this.rightBracket ) {
11102 this._arguments = new NodeList<TypeName>(this); 10864 this._arguments = new NodeList<TypeName>(this);
11103 this._arguments.addAll(arguments); 10865 this._arguments.addAll(arguments);
11104 } 10866 }
11105 10867
11106 accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this); 10868 accept(AstVisitor visitor) => visitor.visitTypeArgumentList(this);
11107 10869
11108 /** 10870 /**
11109 * Return the type arguments associated with the type. 10871 * Return the type arguments associated with the type.
11110 * 10872 *
11111 * @return the type arguments associated with the type 10873 * @return the type arguments associated with the type
11112 */ 10874 */
11113 NodeList<TypeName> get arguments => _arguments; 10875 NodeList<TypeName> get arguments => _arguments;
11114 10876
11115 Token get beginToken => leftBracket; 10877 Token get beginToken => leftBracket;
11116 10878
11117 Token get endToken => rightBracket; 10879 Token get endToken => rightBracket;
11118 10880
11119 void visitChildren(ASTVisitor visitor) { 10881 void visitChildren(AstVisitor visitor) {
11120 _arguments.accept(visitor); 10882 _arguments.accept(visitor);
11121 } 10883 }
11122 } 10884 }
11123 10885
11124 /** 10886 /**
11125 * Instances of the class `TypeName` represent the name of a type, which can opt ionally 10887 * Instances of the class `TypeName` represent the name of a type, which can opt ionally
11126 * include type arguments. 10888 * include type arguments.
11127 * 10889 *
11128 * <pre> 10890 * <pre>
11129 * typeName ::= 10891 * typeName ::=
11130 * [Identifier] typeArguments? 10892 * [Identifier] typeArguments?
11131 * </pre> 10893 * </pre>
11132 *
11133 * @coverage dart.engine.ast
11134 */ 10894 */
11135 class TypeName extends ASTNode { 10895 class TypeName extends AstNode {
11136 /** 10896 /**
11137 * The name of the type. 10897 * The name of the type.
11138 */ 10898 */
11139 Identifier _name; 10899 Identifier _name;
11140 10900
11141 /** 10901 /**
11142 * The type arguments associated with the type, or `null` if there are no type arguments. 10902 * The type arguments associated with the type, or `null` if there are no type arguments.
11143 */ 10903 */
11144 TypeArgumentList _typeArguments; 10904 TypeArgumentList _typeArguments;
11145 10905
11146 /** 10906 /**
11147 * The type being named, or `null` if the AST structure has not been resolved. 10907 * The type being named, or `null` if the AST structure has not been resolved.
11148 */ 10908 */
11149 Type2 type; 10909 Type2 type;
11150 10910
11151 /** 10911 /**
11152 * Initialize a newly created type name. 10912 * Initialize a newly created type name.
11153 * 10913 *
11154 * @param name the name of the type 10914 * @param name the name of the type
11155 * @param typeArguments the type arguments associated with the type, or `null` if there are 10915 * @param typeArguments the type arguments associated with the type, or `null` if there are
11156 * no type arguments 10916 * no type arguments
11157 */ 10917 */
11158 TypeName(Identifier name, TypeArgumentList typeArguments) { 10918 TypeName(Identifier name, TypeArgumentList typeArguments) {
11159 this._name = becomeParentOf(name); 10919 this._name = becomeParentOf(name);
11160 this._typeArguments = becomeParentOf(typeArguments); 10920 this._typeArguments = becomeParentOf(typeArguments);
11161 } 10921 }
11162 10922
11163 accept(ASTVisitor visitor) => visitor.visitTypeName(this); 10923 accept(AstVisitor visitor) => visitor.visitTypeName(this);
11164 10924
11165 Token get beginToken => _name.beginToken; 10925 Token get beginToken => _name.beginToken;
11166 10926
11167 Token get endToken { 10927 Token get endToken {
11168 if (_typeArguments != null) { 10928 if (_typeArguments != null) {
11169 return _typeArguments.endToken; 10929 return _typeArguments.endToken;
11170 } 10930 }
11171 return _name.endToken; 10931 return _name.endToken;
11172 } 10932 }
11173 10933
(...skipping 25 matching lines...) Expand all
11199 10959
11200 /** 10960 /**
11201 * Set the type arguments associated with the type to the given type arguments . 10961 * Set the type arguments associated with the type to the given type arguments .
11202 * 10962 *
11203 * @param typeArguments the type arguments associated with the type 10963 * @param typeArguments the type arguments associated with the type
11204 */ 10964 */
11205 void set typeArguments(TypeArgumentList typeArguments) { 10965 void set typeArguments(TypeArgumentList typeArguments) {
11206 this._typeArguments = becomeParentOf(typeArguments); 10966 this._typeArguments = becomeParentOf(typeArguments);
11207 } 10967 }
11208 10968
11209 void visitChildren(ASTVisitor visitor) { 10969 void visitChildren(AstVisitor visitor) {
11210 safelyVisitChild(_name, visitor); 10970 safelyVisitChild(_name, visitor);
11211 safelyVisitChild(_typeArguments, visitor); 10971 safelyVisitChild(_typeArguments, visitor);
11212 } 10972 }
11213 } 10973 }
11214 10974
11215 /** 10975 /**
11216 * Instances of the class `TypeParameter` represent a type parameter. 10976 * Instances of the class `TypeParameter` represent a type parameter.
11217 * 10977 *
11218 * <pre> 10978 * <pre>
11219 * typeParameter ::= 10979 * typeParameter ::=
11220 * [SimpleIdentifier] ('extends' [TypeName])? 10980 * [SimpleIdentifier] ('extends' [TypeName])?
11221 * </pre> 10981 * </pre>
11222 *
11223 * @coverage dart.engine.ast
11224 */ 10982 */
11225 class TypeParameter extends Declaration { 10983 class TypeParameter extends Declaration {
11226 /** 10984 /**
11227 * The name of the type parameter. 10985 * The name of the type parameter.
11228 */ 10986 */
11229 SimpleIdentifier _name; 10987 SimpleIdentifier _name;
11230 10988
11231 /** 10989 /**
11232 * The token representing the 'extends' keyword, or `null` if there was no exp licit upper 10990 * The token representing the 'extends' keyword, or `null` if there was no exp licit upper
11233 * bound. 10991 * bound.
(...skipping 13 matching lines...) Expand all
11247 * @param metadata the annotations associated with the type parameter 11005 * @param metadata the annotations associated with the type parameter
11248 * @param name the name of the type parameter 11006 * @param name the name of the type parameter
11249 * @param keyword the token representing the 'extends' keyword 11007 * @param keyword the token representing the 'extends' keyword
11250 * @param bound the name of the upper bound for legal arguments 11008 * @param bound the name of the upper bound for legal arguments
11251 */ 11009 */
11252 TypeParameter(Comment comment, List<Annotation> metadata, SimpleIdentifier nam e, this.keyword, TypeName bound) : super(comment, metadata) { 11010 TypeParameter(Comment comment, List<Annotation> metadata, SimpleIdentifier nam e, this.keyword, TypeName bound) : super(comment, metadata) {
11253 this._name = becomeParentOf(name); 11011 this._name = becomeParentOf(name);
11254 this._bound = becomeParentOf(bound); 11012 this._bound = becomeParentOf(bound);
11255 } 11013 }
11256 11014
11257 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); 11015 accept(AstVisitor visitor) => visitor.visitTypeParameter(this);
11258 11016
11259 /** 11017 /**
11260 * Return the name of the upper bound for legal arguments, or `null` if there was no 11018 * Return the name of the upper bound for legal arguments, or `null` if there was no
11261 * explicit upper bound. 11019 * explicit upper bound.
11262 * 11020 *
11263 * @return the name of the upper bound for legal arguments 11021 * @return the name of the upper bound for legal arguments
11264 */ 11022 */
11265 TypeName get bound => _bound; 11023 TypeName get bound => _bound;
11266 11024
11267 TypeParameterElement get element => _name != null ? (_name.staticElement as Ty peParameterElement) : null; 11025 TypeParameterElement get element => _name != null ? (_name.staticElement as Ty peParameterElement) : null;
(...skipping 23 matching lines...) Expand all
11291 11049
11292 /** 11050 /**
11293 * Set the name of the type parameter to the given identifier. 11051 * Set the name of the type parameter to the given identifier.
11294 * 11052 *
11295 * @param identifier the name of the type parameter 11053 * @param identifier the name of the type parameter
11296 */ 11054 */
11297 void set name(SimpleIdentifier identifier) { 11055 void set name(SimpleIdentifier identifier) {
11298 _name = becomeParentOf(identifier); 11056 _name = becomeParentOf(identifier);
11299 } 11057 }
11300 11058
11301 void visitChildren(ASTVisitor visitor) { 11059 void visitChildren(AstVisitor visitor) {
11302 super.visitChildren(visitor); 11060 super.visitChildren(visitor);
11303 safelyVisitChild(_name, visitor); 11061 safelyVisitChild(_name, visitor);
11304 safelyVisitChild(_bound, visitor); 11062 safelyVisitChild(_bound, visitor);
11305 } 11063 }
11306 11064
11307 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; 11065 Token get firstTokenAfterCommentAndMetadata => _name.beginToken;
11308 } 11066 }
11309 11067
11310 /** 11068 /**
11311 * Instances of the class `TypeParameterList` represent type parameters within a declaration. 11069 * Instances of the class `TypeParameterList` represent type parameters within a declaration.
11312 * 11070 *
11313 * <pre> 11071 * <pre>
11314 * typeParameterList ::= 11072 * typeParameterList ::=
11315 * '<' [TypeParameter] (',' [TypeParameter])* '>' 11073 * '<' [TypeParameter] (',' [TypeParameter])* '>'
11316 * </pre> 11074 * </pre>
11317 *
11318 * @coverage dart.engine.ast
11319 */ 11075 */
11320 class TypeParameterList extends ASTNode { 11076 class TypeParameterList extends AstNode {
11321 /** 11077 /**
11322 * The left angle bracket. 11078 * The left angle bracket.
11323 */ 11079 */
11324 final Token leftBracket; 11080 final Token leftBracket;
11325 11081
11326 /** 11082 /**
11327 * The type parameters in the list. 11083 * The type parameters in the list.
11328 */ 11084 */
11329 NodeList<TypeParameter> _typeParameters; 11085 NodeList<TypeParameter> _typeParameters;
11330 11086
11331 /** 11087 /**
11332 * The right angle bracket. 11088 * The right angle bracket.
11333 */ 11089 */
11334 final Token rightBracket; 11090 final Token rightBracket;
11335 11091
11336 /** 11092 /**
11337 * Initialize a newly created list of type parameters. 11093 * Initialize a newly created list of type parameters.
11338 * 11094 *
11339 * @param leftBracket the left angle bracket 11095 * @param leftBracket the left angle bracket
11340 * @param typeParameters the type parameters in the list 11096 * @param typeParameters the type parameters in the list
11341 * @param rightBracket the right angle bracket 11097 * @param rightBracket the right angle bracket
11342 */ 11098 */
11343 TypeParameterList(this.leftBracket, List<TypeParameter> typeParameters, this.r ightBracket) { 11099 TypeParameterList(this.leftBracket, List<TypeParameter> typeParameters, this.r ightBracket) {
11344 this._typeParameters = new NodeList<TypeParameter>(this); 11100 this._typeParameters = new NodeList<TypeParameter>(this);
11345 this._typeParameters.addAll(typeParameters); 11101 this._typeParameters.addAll(typeParameters);
11346 } 11102 }
11347 11103
11348 accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this); 11104 accept(AstVisitor visitor) => visitor.visitTypeParameterList(this);
11349 11105
11350 Token get beginToken => leftBracket; 11106 Token get beginToken => leftBracket;
11351 11107
11352 Token get endToken => rightBracket; 11108 Token get endToken => rightBracket;
11353 11109
11354 /** 11110 /**
11355 * Return the type parameters for the type. 11111 * Return the type parameters for the type.
11356 * 11112 *
11357 * @return the type parameters for the type 11113 * @return the type parameters for the type
11358 */ 11114 */
11359 NodeList<TypeParameter> get typeParameters => _typeParameters; 11115 NodeList<TypeParameter> get typeParameters => _typeParameters;
11360 11116
11361 void visitChildren(ASTVisitor visitor) { 11117 void visitChildren(AstVisitor visitor) {
11362 _typeParameters.accept(visitor); 11118 _typeParameters.accept(visitor);
11363 } 11119 }
11364 } 11120 }
11365 11121
11366 /** 11122 /**
11367 * The abstract class `TypedLiteral` defines the behavior common to literals tha t have a type 11123 * The abstract class `TypedLiteral` defines the behavior common to literals tha t have a type
11368 * associated with them. 11124 * associated with them.
11369 * 11125 *
11370 * <pre> 11126 * <pre>
11371 * listLiteral ::= 11127 * listLiteral ::=
11372 * [ListLiteral] 11128 * [ListLiteral]
11373 * | [MapLiteral] 11129 * | [MapLiteral]
11374 * </pre> 11130 * </pre>
11375 *
11376 * @coverage dart.engine.ast
11377 */ 11131 */
11378 abstract class TypedLiteral extends Literal { 11132 abstract class TypedLiteral extends Literal {
11379 /** 11133 /**
11380 * The token representing the 'const' keyword, or `null` if the literal is not a constant. 11134 * The token representing the 'const' keyword, or `null` if the literal is not a constant.
11381 */ 11135 */
11382 Token constKeyword; 11136 Token constKeyword;
11383 11137
11384 /** 11138 /**
11385 * The type argument associated with this literal, or `null` if no type argume nts were 11139 * The type argument associated with this literal, or `null` if no type argume nts were
11386 * declared. 11140 * declared.
11387 */ 11141 */
11388 TypeArgumentList typeArguments; 11142 TypeArgumentList typeArguments;
11389 11143
11390 /** 11144 /**
11391 * Initialize a newly created typed literal. 11145 * Initialize a newly created typed literal.
11392 * 11146 *
11393 * @param constKeyword the token representing the 'const' keyword 11147 * @param constKeyword the token representing the 'const' keyword
11394 * @param typeArguments the type argument associated with this literal, or `nu ll` if no type 11148 * @param typeArguments the type argument associated with this literal, or `nu ll` if no type
11395 * arguments were declared 11149 * arguments were declared
11396 */ 11150 */
11397 TypedLiteral(this.constKeyword, TypeArgumentList typeArguments) { 11151 TypedLiteral(this.constKeyword, TypeArgumentList typeArguments) {
11398 this.typeArguments = becomeParentOf(typeArguments); 11152 this.typeArguments = becomeParentOf(typeArguments);
11399 } 11153 }
11400 11154
11401 void visitChildren(ASTVisitor visitor) { 11155 void visitChildren(AstVisitor visitor) {
11402 safelyVisitChild(typeArguments, visitor); 11156 safelyVisitChild(typeArguments, visitor);
11403 } 11157 }
11404 } 11158 }
11405 11159
11406 /** 11160 /**
11407 * The abstract class `UriBasedDirective` defines the behavior common to nodes t hat represent 11161 * The abstract class `UriBasedDirective` defines the behavior common to nodes t hat represent
11408 * a directive that references a URI. 11162 * a directive that references a URI.
11409 * 11163 *
11410 * <pre> 11164 * <pre>
11411 * uriBasedDirective ::= 11165 * uriBasedDirective ::=
11412 * [ExportDirective] 11166 * [ExportDirective]
11413 * | [ImportDirective] 11167 * | [ImportDirective]
11414 * | [PartDirective] 11168 * | [PartDirective]
11415 * </pre> 11169 * </pre>
11416 *
11417 * @coverage dart.engine.ast
11418 */ 11170 */
11419 abstract class UriBasedDirective extends Directive { 11171 abstract class UriBasedDirective extends Directive {
11420 /** 11172 /**
11421 * The URI referenced by this directive. 11173 * The URI referenced by this directive.
11422 */ 11174 */
11423 StringLiteral _uri; 11175 StringLiteral _uri;
11424 11176
11425 /** 11177 /**
11426 * Initialize a newly create URI-based directive. 11178 * Initialize a newly create URI-based directive.
11427 * 11179 *
(...skipping 23 matching lines...) Expand all
11451 11203
11452 /** 11204 /**
11453 * Set the URI referenced by this directive to the given URI. 11205 * Set the URI referenced by this directive to the given URI.
11454 * 11206 *
11455 * @param uri the URI referenced by this directive 11207 * @param uri the URI referenced by this directive
11456 */ 11208 */
11457 void set uri(StringLiteral uri) { 11209 void set uri(StringLiteral uri) {
11458 this._uri = becomeParentOf(uri); 11210 this._uri = becomeParentOf(uri);
11459 } 11211 }
11460 11212
11461 void visitChildren(ASTVisitor visitor) { 11213 void visitChildren(AstVisitor visitor) {
11462 super.visitChildren(visitor); 11214 super.visitChildren(visitor);
11463 safelyVisitChild(_uri, visitor); 11215 safelyVisitChild(_uri, visitor);
11464 } 11216 }
11465 } 11217 }
11466 11218
11467 /** 11219 /**
11468 * Instances of the class `VariableDeclaration` represent an identifier that has an initial 11220 * Instances of the class `VariableDeclaration` represent an identifier that has an initial
11469 * value associated with it. Instances of this class are always children of the class 11221 * value associated with it. Instances of this class are always children of the class
11470 * [VariableDeclarationList]. 11222 * [VariableDeclarationList].
11471 * 11223 *
11472 * <pre> 11224 * <pre>
11473 * variableDeclaration ::= 11225 * variableDeclaration ::=
11474 * [SimpleIdentifier] ('=' [Expression])? 11226 * [SimpleIdentifier] ('=' [Expression])?
11475 * </pre> 11227 * </pre>
11476 *
11477 * @coverage dart.engine.ast
11478 */ 11228 */
11479 class VariableDeclaration extends Declaration { 11229 class VariableDeclaration extends Declaration {
11480 /** 11230 /**
11481 * The name of the variable being declared. 11231 * The name of the variable being declared.
11482 */ 11232 */
11483 SimpleIdentifier _name; 11233 SimpleIdentifier _name;
11484 11234
11485 /** 11235 /**
11486 * The equal sign separating the variable name from the initial value, or `nul l` if the 11236 * The equal sign separating the variable name from the initial value, or `nul l` if the
11487 * initial value was not specified. 11237 * initial value was not specified.
(...skipping 13 matching lines...) Expand all
11501 * @param metadata the annotations associated with this member 11251 * @param metadata the annotations associated with this member
11502 * @param name the name of the variable being declared 11252 * @param name the name of the variable being declared
11503 * @param equals the equal sign separating the variable name from the initial value 11253 * @param equals the equal sign separating the variable name from the initial value
11504 * @param initializer the expression used to compute the initial value for the variable 11254 * @param initializer the expression used to compute the initial value for the variable
11505 */ 11255 */
11506 VariableDeclaration(Comment comment, List<Annotation> metadata, SimpleIdentifi er name, this.equals, Expression initializer) : super(comment, metadata) { 11256 VariableDeclaration(Comment comment, List<Annotation> metadata, SimpleIdentifi er name, this.equals, Expression initializer) : super(comment, metadata) {
11507 this._name = becomeParentOf(name); 11257 this._name = becomeParentOf(name);
11508 this._initializer = becomeParentOf(initializer); 11258 this._initializer = becomeParentOf(initializer);
11509 } 11259 }
11510 11260
11511 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); 11261 accept(AstVisitor visitor) => visitor.visitVariableDeclaration(this);
11512 11262
11513 /** 11263 /**
11514 * This overridden implementation of getDocumentationComment() looks in the gr andparent node for 11264 * This overridden implementation of getDocumentationComment() looks in the gr andparent node for
11515 * dartdoc comments if no documentation is specifically available on the node. 11265 * dartdoc comments if no documentation is specifically available on the node.
11516 */ 11266 */
11517 Comment get documentationComment { 11267 Comment get documentationComment {
11518 Comment comment = super.documentationComment; 11268 Comment comment = super.documentationComment;
11519 if (comment == null) { 11269 if (comment == null) {
11520 if (parent != null && parent.parent != null) { 11270 if (parent != null && parent.parent != null) {
11521 ASTNode node = parent.parent; 11271 AstNode node = parent.parent;
11522 if (node is AnnotatedNode) { 11272 if (node is AnnotatedNode) {
11523 return node.documentationComment; 11273 return node.documentationComment;
11524 } 11274 }
11525 } 11275 }
11526 } 11276 }
11527 return comment; 11277 return comment;
11528 } 11278 }
11529 11279
11530 VariableElement get element => _name != null ? (_name.staticElement as Variabl eElement) : null; 11280 VariableElement get element => _name != null ? (_name.staticElement as Variabl eElement) : null;
11531 11281
(...skipping 18 matching lines...) Expand all
11550 * @return the name of the variable being declared 11300 * @return the name of the variable being declared
11551 */ 11301 */
11552 SimpleIdentifier get name => _name; 11302 SimpleIdentifier get name => _name;
11553 11303
11554 /** 11304 /**
11555 * Return `true` if this variable was declared with the 'const' modifier. 11305 * Return `true` if this variable was declared with the 'const' modifier.
11556 * 11306 *
11557 * @return `true` if this variable was declared with the 'const' modifier 11307 * @return `true` if this variable was declared with the 'const' modifier
11558 */ 11308 */
11559 bool get isConst { 11309 bool get isConst {
11560 ASTNode parent = this.parent; 11310 AstNode parent = this.parent;
11561 return parent is VariableDeclarationList && parent.isConst; 11311 return parent is VariableDeclarationList && parent.isConst;
11562 } 11312 }
11563 11313
11564 /** 11314 /**
11565 * Return `true` if this variable was declared with the 'final' modifier. Vari ables that are 11315 * Return `true` if this variable was declared with the 'final' modifier. Vari ables that are
11566 * declared with the 'const' modifier will return `false` even though they are implicitly 11316 * declared with the 'const' modifier will return `false` even though they are implicitly
11567 * final. 11317 * final.
11568 * 11318 *
11569 * @return `true` if this variable was declared with the 'final' modifier 11319 * @return `true` if this variable was declared with the 'final' modifier
11570 */ 11320 */
11571 bool get isFinal { 11321 bool get isFinal {
11572 ASTNode parent = this.parent; 11322 AstNode parent = this.parent;
11573 return parent is VariableDeclarationList && parent.isFinal; 11323 return parent is VariableDeclarationList && parent.isFinal;
11574 } 11324 }
11575 11325
11576 /** 11326 /**
11577 * Set the expression used to compute the initial value for the variable to th e given expression. 11327 * Set the expression used to compute the initial value for the variable to th e given expression.
11578 * 11328 *
11579 * @param initializer the expression used to compute the initial value for the variable 11329 * @param initializer the expression used to compute the initial value for the variable
11580 */ 11330 */
11581 void set initializer(Expression initializer) { 11331 void set initializer(Expression initializer) {
11582 this._initializer = becomeParentOf(initializer); 11332 this._initializer = becomeParentOf(initializer);
11583 } 11333 }
11584 11334
11585 /** 11335 /**
11586 * Set the name of the variable being declared to the given identifier. 11336 * Set the name of the variable being declared to the given identifier.
11587 * 11337 *
11588 * @param name the name of the variable being declared 11338 * @param name the name of the variable being declared
11589 */ 11339 */
11590 void set name(SimpleIdentifier name) { 11340 void set name(SimpleIdentifier name) {
11591 this._name = becomeParentOf(name); 11341 this._name = becomeParentOf(name);
11592 } 11342 }
11593 11343
11594 void visitChildren(ASTVisitor visitor) { 11344 void visitChildren(AstVisitor visitor) {
11595 super.visitChildren(visitor); 11345 super.visitChildren(visitor);
11596 safelyVisitChild(_name, visitor); 11346 safelyVisitChild(_name, visitor);
11597 safelyVisitChild(_initializer, visitor); 11347 safelyVisitChild(_initializer, visitor);
11598 } 11348 }
11599 11349
11600 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; 11350 Token get firstTokenAfterCommentAndMetadata => _name.beginToken;
11601 } 11351 }
11602 11352
11603 /** 11353 /**
11604 * Instances of the class `VariableDeclarationList` represent the declaration of one or more 11354 * Instances of the class `VariableDeclarationList` represent the declaration of one or more
11605 * variables of the same type. 11355 * variables of the same type.
11606 * 11356 *
11607 * <pre> 11357 * <pre>
11608 * variableDeclarationList ::= 11358 * variableDeclarationList ::=
11609 * finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])* 11359 * finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])*
11610 * 11360 *
11611 * finalConstVarOrType ::= 11361 * finalConstVarOrType ::=
11612 * | 'final' [TypeName]? 11362 * | 'final' [TypeName]?
11613 * | 'const' [TypeName]? 11363 * | 'const' [TypeName]?
11614 * | 'var' 11364 * | 'var'
11615 * | [TypeName] 11365 * | [TypeName]
11616 * </pre> 11366 * </pre>
11617 *
11618 * @coverage dart.engine.ast
11619 */ 11367 */
11620 class VariableDeclarationList extends AnnotatedNode { 11368 class VariableDeclarationList extends AnnotatedNode {
11621 /** 11369 /**
11622 * The token representing the 'final', 'const' or 'var' keyword, or `null` if no keyword was 11370 * The token representing the 'final', 'const' or 'var' keyword, or `null` if no keyword was
11623 * included. 11371 * included.
11624 */ 11372 */
11625 Token keyword; 11373 Token keyword;
11626 11374
11627 /** 11375 /**
11628 * The type of the variables being declared, or `null` if no type was provided . 11376 * The type of the variables being declared, or `null` if no type was provided .
(...skipping 13 matching lines...) Expand all
11642 * @param keyword the token representing the 'final', 'const' or 'var' keyword 11390 * @param keyword the token representing the 'final', 'const' or 'var' keyword
11643 * @param type the type of the variables being declared 11391 * @param type the type of the variables being declared
11644 * @param variables a list containing the individual variables being declared 11392 * @param variables a list containing the individual variables being declared
11645 */ 11393 */
11646 VariableDeclarationList(Comment comment, List<Annotation> metadata, this.keywo rd, TypeName type, List<VariableDeclaration> variables) : super(comment, metadat a) { 11394 VariableDeclarationList(Comment comment, List<Annotation> metadata, this.keywo rd, TypeName type, List<VariableDeclaration> variables) : super(comment, metadat a) {
11647 this._variables = new NodeList<VariableDeclaration>(this); 11395 this._variables = new NodeList<VariableDeclaration>(this);
11648 this._type = becomeParentOf(type); 11396 this._type = becomeParentOf(type);
11649 this._variables.addAll(variables); 11397 this._variables.addAll(variables);
11650 } 11398 }
11651 11399
11652 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this); 11400 accept(AstVisitor visitor) => visitor.visitVariableDeclarationList(this);
11653 11401
11654 Token get endToken => _variables.endToken; 11402 Token get endToken => _variables.endToken;
11655 11403
11656 /** 11404 /**
11657 * Return the type of the variables being declared, or `null` if no type was p rovided. 11405 * Return the type of the variables being declared, or `null` if no type was p rovided.
11658 * 11406 *
11659 * @return the type of the variables being declared 11407 * @return the type of the variables being declared
11660 */ 11408 */
11661 TypeName get type => _type; 11409 TypeName get type => _type;
11662 11410
(...skipping 22 matching lines...) Expand all
11685 11433
11686 /** 11434 /**
11687 * Set the type of the variables being declared to the given type name. 11435 * Set the type of the variables being declared to the given type name.
11688 * 11436 *
11689 * @param typeName the type of the variables being declared 11437 * @param typeName the type of the variables being declared
11690 */ 11438 */
11691 void set type(TypeName typeName) { 11439 void set type(TypeName typeName) {
11692 _type = becomeParentOf(typeName); 11440 _type = becomeParentOf(typeName);
11693 } 11441 }
11694 11442
11695 void visitChildren(ASTVisitor visitor) { 11443 void visitChildren(AstVisitor visitor) {
11696 safelyVisitChild(_type, visitor); 11444 safelyVisitChild(_type, visitor);
11697 _variables.accept(visitor); 11445 _variables.accept(visitor);
11698 } 11446 }
11699 11447
11700 Token get firstTokenAfterCommentAndMetadata { 11448 Token get firstTokenAfterCommentAndMetadata {
11701 if (keyword != null) { 11449 if (keyword != null) {
11702 return keyword; 11450 return keyword;
11703 } else if (_type != null) { 11451 } else if (_type != null) {
11704 return _type.beginToken; 11452 return _type.beginToken;
11705 } 11453 }
11706 return _variables.beginToken; 11454 return _variables.beginToken;
11707 } 11455 }
11708 } 11456 }
11709 11457
11710 /** 11458 /**
11711 * Instances of the class `VariableDeclarationStatement` represent a list of var iables that 11459 * Instances of the class `VariableDeclarationStatement` represent a list of var iables that
11712 * are being declared in a context where a statement is required. 11460 * are being declared in a context where a statement is required.
11713 * 11461 *
11714 * <pre> 11462 * <pre>
11715 * variableDeclarationStatement ::= 11463 * variableDeclarationStatement ::=
11716 * [VariableDeclarationList] ';' 11464 * [VariableDeclarationList] ';'
11717 * </pre> 11465 * </pre>
11718 *
11719 * @coverage dart.engine.ast
11720 */ 11466 */
11721 class VariableDeclarationStatement extends Statement { 11467 class VariableDeclarationStatement extends Statement {
11722 /** 11468 /**
11723 * The variables being declared. 11469 * The variables being declared.
11724 */ 11470 */
11725 VariableDeclarationList _variableList; 11471 VariableDeclarationList _variableList;
11726 11472
11727 /** 11473 /**
11728 * The semicolon terminating the statement. 11474 * The semicolon terminating the statement.
11729 */ 11475 */
11730 Token semicolon; 11476 Token semicolon;
11731 11477
11732 /** 11478 /**
11733 * Initialize a newly created variable declaration statement. 11479 * Initialize a newly created variable declaration statement.
11734 * 11480 *
11735 * @param variableList the fields being declared 11481 * @param variableList the fields being declared
11736 * @param semicolon the semicolon terminating the statement 11482 * @param semicolon the semicolon terminating the statement
11737 */ 11483 */
11738 VariableDeclarationStatement(VariableDeclarationList variableList, this.semico lon) { 11484 VariableDeclarationStatement(VariableDeclarationList variableList, this.semico lon) {
11739 this._variableList = becomeParentOf(variableList); 11485 this._variableList = becomeParentOf(variableList);
11740 } 11486 }
11741 11487
11742 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this); 11488 accept(AstVisitor visitor) => visitor.visitVariableDeclarationStatement(this);
11743 11489
11744 Token get beginToken => _variableList.beginToken; 11490 Token get beginToken => _variableList.beginToken;
11745 11491
11746 Token get endToken => semicolon; 11492 Token get endToken => semicolon;
11747 11493
11748 /** 11494 /**
11749 * Return the variables being declared. 11495 * Return the variables being declared.
11750 * 11496 *
11751 * @return the variables being declared 11497 * @return the variables being declared
11752 */ 11498 */
11753 VariableDeclarationList get variables => _variableList; 11499 VariableDeclarationList get variables => _variableList;
11754 11500
11755 /** 11501 /**
11756 * Set the variables being declared to the given list of variables. 11502 * Set the variables being declared to the given list of variables.
11757 * 11503 *
11758 * @param variableList the variables being declared 11504 * @param variableList the variables being declared
11759 */ 11505 */
11760 void set variables(VariableDeclarationList variableList) { 11506 void set variables(VariableDeclarationList variableList) {
11761 this._variableList = becomeParentOf(variableList); 11507 this._variableList = becomeParentOf(variableList);
11762 } 11508 }
11763 11509
11764 void visitChildren(ASTVisitor visitor) { 11510 void visitChildren(AstVisitor visitor) {
11765 safelyVisitChild(_variableList, visitor); 11511 safelyVisitChild(_variableList, visitor);
11766 } 11512 }
11767 } 11513 }
11768 11514
11769 /** 11515 /**
11770 * Instances of the class `WhileStatement` represent a while statement. 11516 * Instances of the class `WhileStatement` represent a while statement.
11771 * 11517 *
11772 * <pre> 11518 * <pre>
11773 * whileStatement ::= 11519 * whileStatement ::=
11774 * 'while' '(' [Expression] ')' [Statement] 11520 * 'while' '(' [Expression] ')' [Statement]
11775 * </pre> 11521 * </pre>
11776 *
11777 * @coverage dart.engine.ast
11778 */ 11522 */
11779 class WhileStatement extends Statement { 11523 class WhileStatement extends Statement {
11780 /** 11524 /**
11781 * The token representing the 'while' keyword. 11525 * The token representing the 'while' keyword.
11782 */ 11526 */
11783 Token keyword; 11527 Token keyword;
11784 11528
11785 /** 11529 /**
11786 * The left parenthesis. 11530 * The left parenthesis.
11787 */ 11531 */
(...skipping 21 matching lines...) Expand all
11809 * @param leftParenthesis the left parenthesis 11553 * @param leftParenthesis the left parenthesis
11810 * @param condition the expression used to determine whether to execute the bo dy of the loop 11554 * @param condition the expression used to determine whether to execute the bo dy of the loop
11811 * @param rightParenthesis the right parenthesis 11555 * @param rightParenthesis the right parenthesis
11812 * @param body the body of the loop 11556 * @param body the body of the loop
11813 */ 11557 */
11814 WhileStatement(this.keyword, this.leftParenthesis, Expression condition, this. rightParenthesis, Statement body) { 11558 WhileStatement(this.keyword, this.leftParenthesis, Expression condition, this. rightParenthesis, Statement body) {
11815 this._condition = becomeParentOf(condition); 11559 this._condition = becomeParentOf(condition);
11816 this._body = becomeParentOf(body); 11560 this._body = becomeParentOf(body);
11817 } 11561 }
11818 11562
11819 accept(ASTVisitor visitor) => visitor.visitWhileStatement(this); 11563 accept(AstVisitor visitor) => visitor.visitWhileStatement(this);
11820 11564
11821 Token get beginToken => keyword; 11565 Token get beginToken => keyword;
11822 11566
11823 /** 11567 /**
11824 * Return the body of the loop. 11568 * Return the body of the loop.
11825 * 11569 *
11826 * @return the body of the loop 11570 * @return the body of the loop
11827 */ 11571 */
11828 Statement get body => _body; 11572 Statement get body => _body;
11829 11573
(...skipping 18 matching lines...) Expand all
11848 /** 11592 /**
11849 * Set the expression used to determine whether to execute the body of the loo p to the given 11593 * Set the expression used to determine whether to execute the body of the loo p to the given
11850 * expression. 11594 * expression.
11851 * 11595 *
11852 * @param expression the expression used to determine whether to execute the b ody of the loop 11596 * @param expression the expression used to determine whether to execute the b ody of the loop
11853 */ 11597 */
11854 void set condition(Expression expression) { 11598 void set condition(Expression expression) {
11855 _condition = becomeParentOf(expression); 11599 _condition = becomeParentOf(expression);
11856 } 11600 }
11857 11601
11858 void visitChildren(ASTVisitor visitor) { 11602 void visitChildren(AstVisitor visitor) {
11859 safelyVisitChild(_condition, visitor); 11603 safelyVisitChild(_condition, visitor);
11860 safelyVisitChild(_body, visitor); 11604 safelyVisitChild(_body, visitor);
11861 } 11605 }
11862 } 11606 }
11863 11607
11864 /** 11608 /**
11865 * Instances of the class `WithClause` represent the with clause in a class decl aration. 11609 * Instances of the class `WithClause` represent the with clause in a class decl aration.
11866 * 11610 *
11867 * <pre> 11611 * <pre>
11868 * withClause ::= 11612 * withClause ::=
11869 * 'with' [TypeName] (',' [TypeName])* 11613 * 'with' [TypeName] (',' [TypeName])*
11870 * </pre> 11614 * </pre>
11871 *
11872 * @coverage dart.engine.ast
11873 */ 11615 */
11874 class WithClause extends ASTNode { 11616 class WithClause extends AstNode {
11875 /** 11617 /**
11876 * The token representing the 'with' keyword. 11618 * The token representing the 'with' keyword.
11877 */ 11619 */
11878 Token _withKeyword; 11620 Token _withKeyword;
11879 11621
11880 /** 11622 /**
11881 * The names of the mixins that were specified. 11623 * The names of the mixins that were specified.
11882 */ 11624 */
11883 NodeList<TypeName> _mixinTypes; 11625 NodeList<TypeName> _mixinTypes;
11884 11626
11885 /** 11627 /**
11886 * Initialize a newly created with clause. 11628 * Initialize a newly created with clause.
11887 * 11629 *
11888 * @param withKeyword the token representing the 'with' keyword 11630 * @param withKeyword the token representing the 'with' keyword
11889 * @param mixinTypes the names of the mixins that were specified 11631 * @param mixinTypes the names of the mixins that were specified
11890 */ 11632 */
11891 WithClause(Token withKeyword, List<TypeName> mixinTypes) { 11633 WithClause(Token withKeyword, List<TypeName> mixinTypes) {
11892 this._mixinTypes = new NodeList<TypeName>(this); 11634 this._mixinTypes = new NodeList<TypeName>(this);
11893 this._withKeyword = withKeyword; 11635 this._withKeyword = withKeyword;
11894 this._mixinTypes.addAll(mixinTypes); 11636 this._mixinTypes.addAll(mixinTypes);
11895 } 11637 }
11896 11638
11897 accept(ASTVisitor visitor) => visitor.visitWithClause(this); 11639 accept(AstVisitor visitor) => visitor.visitWithClause(this);
11898 11640
11899 Token get beginToken => _withKeyword; 11641 Token get beginToken => _withKeyword;
11900 11642
11901 Token get endToken => _mixinTypes.endToken; 11643 Token get endToken => _mixinTypes.endToken;
11902 11644
11903 /** 11645 /**
11904 * Return the names of the mixins that were specified. 11646 * Return the names of the mixins that were specified.
11905 * 11647 *
11906 * @return the names of the mixins that were specified 11648 * @return the names of the mixins that were specified
11907 */ 11649 */
11908 NodeList<TypeName> get mixinTypes => _mixinTypes; 11650 NodeList<TypeName> get mixinTypes => _mixinTypes;
11909 11651
11910 /** 11652 /**
11911 * Return the token representing the 'with' keyword. 11653 * Return the token representing the 'with' keyword.
11912 * 11654 *
11913 * @return the token representing the 'with' keyword 11655 * @return the token representing the 'with' keyword
11914 */ 11656 */
11915 Token get withKeyword => _withKeyword; 11657 Token get withKeyword => _withKeyword;
11916 11658
11917 /** 11659 /**
11918 * Set the token representing the 'with' keyword to the given token. 11660 * Set the token representing the 'with' keyword to the given token.
11919 * 11661 *
11920 * @param withKeyword the token representing the 'with' keyword 11662 * @param withKeyword the token representing the 'with' keyword
11921 */ 11663 */
11922 void set mixinKeyword(Token withKeyword) { 11664 void set mixinKeyword(Token withKeyword) {
11923 this._withKeyword = withKeyword; 11665 this._withKeyword = withKeyword;
11924 } 11666 }
11925 11667
11926 void visitChildren(ASTVisitor visitor) { 11668 void visitChildren(AstVisitor visitor) {
11927 _mixinTypes.accept(visitor); 11669 _mixinTypes.accept(visitor);
11928 } 11670 }
11929 } 11671 }
11930 11672
11931 /** 11673 /**
11932 * Instances of the class `BreadthFirstVisitor` implement an AST visitor that wi ll recursively 11674 * Instances of the class `BreadthFirstVisitor` implement an AST visitor that wi ll recursively
11933 * visit all of the nodes in an AST structure, similar to [GeneralizingASTVisito r]. This 11675 * visit all of the nodes in an AST structure, similar to [GeneralizingAstVisito r]. This
11934 * visitor uses a breadth-first ordering rather than the depth-first ordering of 11676 * visitor uses a breadth-first ordering rather than the depth-first ordering of
11935 * [GeneralizingASTVisitor]. 11677 * [GeneralizingAstVisitor].
11936 * 11678 *
11937 * Subclasses that override a visit method must either invoke the overridden vis it method or 11679 * Subclasses that override a visit method must either invoke the overridden vis it method or
11938 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods 11680 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods
11939 * for superclasses of the node to not be invoked and will cause the children of the visited node to 11681 * for superclasses of the node to not be invoked and will cause the children of the visited node to
11940 * not be visited. 11682 * not be visited.
11941 * 11683 *
11942 * In addition, subclasses should <b>not</b> explicitly visit the children of a node, but should 11684 * In addition, subclasses should <b>not</b> explicitly visit the children of a node, but should
11943 * ensure that the method [visitNode] is used to visit the children (either dire ctly 11685 * ensure that the method [visitNode] is used to visit the children (either dire ctly
11944 * or indirectly). Failure to do will break the order in which nodes are visited . 11686 * or indirectly). Failure to do will break the order in which nodes are visited .
11945 *
11946 * @coverage dart.engine.ast
11947 */ 11687 */
11948 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> { 11688 class BreadthFirstVisitor<R> extends GeneralizingAstVisitor<R> {
11949 /** 11689 /**
11950 * A queue holding the nodes that have not yet been visited in the order in wh ich they ought to be 11690 * A queue holding the nodes that have not yet been visited in the order in wh ich they ought to be
11951 * visited. 11691 * visited.
11952 */ 11692 */
11953 Queue<ASTNode> _queue = new Queue<ASTNode>(); 11693 Queue<AstNode> _queue = new Queue<AstNode>();
11954 11694
11955 /** 11695 /**
11956 * A visitor, used to visit the children of the current node, that will add th e nodes it visits to 11696 * A visitor, used to visit the children of the current node, that will add th e nodes it visits to
11957 * the [queue]. 11697 * the [queue].
11958 */ 11698 */
11959 GeneralizingASTVisitor<Object> _childVisitor; 11699 GeneralizingAstVisitor<Object> _childVisitor;
11960 11700
11961 /** 11701 /**
11962 * Visit all nodes in the tree starting at the given `root` node, in breadth-f irst order. 11702 * Visit all nodes in the tree starting at the given `root` node, in breadth-f irst order.
11963 * 11703 *
11964 * @param root the root of the AST structure to be visited 11704 * @param root the root of the AST structure to be visited
11965 */ 11705 */
11966 void visitAllNodes(ASTNode root) { 11706 void visitAllNodes(AstNode root) {
11967 _queue.add(root); 11707 _queue.add(root);
11968 while (!_queue.isEmpty) { 11708 while (!_queue.isEmpty) {
11969 ASTNode next = _queue.removeFirst(); 11709 AstNode next = _queue.removeFirst();
11970 next.accept(this); 11710 next.accept(this);
11971 } 11711 }
11972 } 11712 }
11973 11713
11974 R visitNode(ASTNode node) { 11714 R visitNode(AstNode node) {
11975 node.visitChildren(_childVisitor); 11715 node.visitChildren(_childVisitor);
11976 return null; 11716 return null;
11977 } 11717 }
11978 11718
11979 BreadthFirstVisitor() { 11719 BreadthFirstVisitor() {
11980 this._childVisitor = new GeneralizingASTVisitor_BreadthFirstVisitor(this); 11720 this._childVisitor = new GeneralizingAstVisitor_BreadthFirstVisitor(this);
11981 } 11721 }
11982 } 11722 }
11983 11723
11984 class GeneralizingASTVisitor_BreadthFirstVisitor extends GeneralizingASTVisitor< Object> { 11724 class GeneralizingAstVisitor_BreadthFirstVisitor extends GeneralizingAstVisitor< Object> {
11985 final BreadthFirstVisitor BreadthFirstVisitor_this; 11725 final BreadthFirstVisitor BreadthFirstVisitor_this;
11986 11726
11987 GeneralizingASTVisitor_BreadthFirstVisitor(this.BreadthFirstVisitor_this) : su per(); 11727 GeneralizingAstVisitor_BreadthFirstVisitor(this.BreadthFirstVisitor_this) : su per();
11988 11728
11989 Object visitNode(ASTNode node) { 11729 Object visitNode(AstNode node) {
11990 BreadthFirstVisitor_this._queue.add(node); 11730 BreadthFirstVisitor_this._queue.add(node);
11991 return null; 11731 return null;
11992 } 11732 }
11993 } 11733 }
11994 11734
11995 /** 11735 /**
11996 * Instances of the class `ConstantEvaluator` evaluate constant expressions to p roduce their 11736 * Instances of the class `ConstantEvaluator` evaluate constant expressions to p roduce their
11997 * compile-time value. According to the Dart Language Specification: <blockquote > A constant 11737 * compile-time value. According to the Dart Language Specification: <blockquote > A constant
11998 * expression is one of the following: 11738 * expression is one of the following:
11999 *
12000 * * A literal number. 11739 * * A literal number.
12001 * * A literal boolean. 11740 * * A literal boolean.
12002 * * A literal string where any interpolated expression is a compile-time consta nt that evaluates 11741 * * A literal string where any interpolated expression is a compile-time consta nt that evaluates
12003 * to a numeric, string or boolean value or to `null`. 11742 * to a numeric, string or boolean value or to `null`.
12004 * * `null`. 11743 * * `null`.
12005 * * A reference to a static constant variable. 11744 * * A reference to a static constant variable.
12006 * * An identifier expression that denotes a constant variable, a class or a typ e parameter. 11745 * * An identifier expression that denotes a constant variable, a class or a typ e parameter.
12007 * * A constant constructor invocation. 11746 * * A constant constructor invocation.
12008 * * A constant list literal. 11747 * * A constant list literal.
12009 * * A constant map literal. 11748 * * A constant map literal.
12010 * * A simple or qualified identifier denoting a top-level function or a static method. 11749 * * A simple or qualified identifier denoting a top-level function or a static method.
12011 * * A parenthesized expression `(e)` where `e` is a constant expression. 11750 * * A parenthesized expression `(e)` where `e` is a constant expression.
12012 * * An expression of one of the forms `identical(e1, e2)`, `e1 == e2`, 11751 * * An expression of one of the forms `identical(e1, e2)`, `e1 == e2`,
12013 * `e1 != e2` where `e1` and `e2` are constant expressions that evaluate to a 11752 * `e1 != e2` where `e1` and `e2` are constant expressions that evaluate to a
12014 * numeric, string or boolean value or to `null`. 11753 * numeric, string or boolean value or to `null`.
12015 * * An expression of one of the forms `!e`, `e1 && e2` or `e1 || e2`, where 11754 * * An expression of one of the forms `!e`, `e1 && e2` or `e1 || e2`, where
12016 * `e`, `e1` and `e2` are constant expressions that evaluate to a boolean value or 11755 * `e`, `e1` and `e2` are constant expressions that evaluate to a boolean value or
12017 * to `null`. 11756 * to `null`.
12018 * * An expression of one of the forms `~e`, `e1 ^ e2`, `e1 & e2`, 11757 * * An expression of one of the forms `~e`, `e1 ^ e2`, `e1 & e2`,
12019 * `e1 | e2`, `e1 >> e2` or `e1 << e2`, where `e`, `e1` and `e2` 11758 * `e1 | e2`, `e1 >> e2` or `e1 << e2`, where `e`, `e1` and `e2`
12020 * are constant expressions that evaluate to an integer value or to `null`. 11759 * are constant expressions that evaluate to an integer value or to `null`.
12021 * * An expression of one of the forms `-e`, `e1 + e2`, `e1 - e2`, 11760 * * An expression of one of the forms `-e`, `e1 + e2`, `e1 - e2`,
12022 * `e1 * e2`, `e1 / e2`, `e1 ~/ e2`, `e1 > e2`, `e1 < e2`, 11761 * `e1 * e2`, `e1 / e2`, `e1 ~/ e2`, `e1 > e2`, `e1 < e2`,
12023 * `e1 >= e2`, `e1 <= e2` or `e1 % e2`, where `e`, `e1` and `e2` 11762 * `e1 >= e2`, `e1 <= e2` or `e1 % e2`, where `e`, `e1` and `e2`
12024 * are constant expressions that evaluate to a numeric value or to `null`. 11763 * are constant expressions that evaluate to a numeric value or to `null`.
12025 *
12026 * </blockquote> The values returned by instances of this class are therefore `n ull` and 11764 * </blockquote> The values returned by instances of this class are therefore `n ull` and
12027 * instances of the classes `Boolean`, `BigInteger`, `Double`, `String`, and 11765 * instances of the classes `Boolean`, `BigInteger`, `Double`, `String`, and
12028 * `DartObject`. 11766 * `DartObject`.
12029 * 11767 *
12030 * In addition, this class defines several values that can be returned to indica te various 11768 * In addition, this class defines several values that can be returned to indica te various
12031 * conditions encountered during evaluation. These are documented with the stati c field that define 11769 * conditions encountered during evaluation. These are documented with the stati c field that define
12032 * those values. 11770 * those values.
12033 *
12034 * @coverage dart.engine.ast
12035 */ 11771 */
12036 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { 11772 class ConstantEvaluator extends GeneralizingAstVisitor<Object> {
12037 /** 11773 /**
12038 * The value returned for expressions (or non-expression nodes) that are not c ompile-time constant 11774 * The value returned for expressions (or non-expression nodes) that are not c ompile-time constant
12039 * expressions. 11775 * expressions.
12040 */ 11776 */
12041 static Object NOT_A_CONSTANT = new Object(); 11777 static Object NOT_A_CONSTANT = new Object();
12042 11778
12043 Object visitAdjacentStrings(AdjacentStrings node) { 11779 Object visitAdjacentStrings(AdjacentStrings node) {
12044 JavaStringBuilder builder = new JavaStringBuilder(); 11780 JavaStringBuilder builder = new JavaStringBuilder();
12045 for (StringLiteral string in node.strings) { 11781 for (StringLiteral string in node.strings) {
12046 Object value = string.accept(this); 11782 Object value = string.accept(this);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
12241 if (key is! String || identical(value, NOT_A_CONSTANT)) { 11977 if (key is! String || identical(value, NOT_A_CONSTANT)) {
12242 return NOT_A_CONSTANT; 11978 return NOT_A_CONSTANT;
12243 } 11979 }
12244 map[(key as String)] = value; 11980 map[(key as String)] = value;
12245 } 11981 }
12246 return map; 11982 return map;
12247 } 11983 }
12248 11984
12249 Object visitMethodInvocation(MethodInvocation node) => visitNode(node); 11985 Object visitMethodInvocation(MethodInvocation node) => visitNode(node);
12250 11986
12251 Object visitNode(ASTNode node) => NOT_A_CONSTANT; 11987 Object visitNode(AstNode node) => NOT_A_CONSTANT;
12252 11988
12253 Object visitNullLiteral(NullLiteral node) => null; 11989 Object visitNullLiteral(NullLiteral node) => null;
12254 11990
12255 Object visitParenthesizedExpression(ParenthesizedExpression node) => node.expr ession.accept(this); 11991 Object visitParenthesizedExpression(ParenthesizedExpression node) => node.expr ession.accept(this);
12256 11992
12257 Object visitPrefixedIdentifier(PrefixedIdentifier node) => getConstantValue(nu ll); 11993 Object visitPrefixedIdentifier(PrefixedIdentifier node) => getConstantValue(nu ll);
12258 11994
12259 Object visitPrefixExpression(PrefixExpression node) { 11995 Object visitPrefixExpression(PrefixExpression node) {
12260 Object operand = node.operand.accept(this); 11996 Object operand = node.operand.accept(this);
12261 if (identical(operand, NOT_A_CONSTANT)) { 11997 if (identical(operand, NOT_A_CONSTANT)) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
12329 FieldElement field = element; 12065 FieldElement field = element;
12330 if (field.isStatic && field.isConst) { 12066 if (field.isStatic && field.isConst) {
12331 } 12067 }
12332 } 12068 }
12333 return NOT_A_CONSTANT; 12069 return NOT_A_CONSTANT;
12334 } 12070 }
12335 } 12071 }
12336 12072
12337 /** 12073 /**
12338 * Instances of the class `ElementLocator` locate the [Element] 12074 * Instances of the class `ElementLocator` locate the [Element]
12339 * associated with a given [ASTNode]. 12075 * associated with a given [AstNode].
12340 *
12341 * @coverage dart.engine.ast
12342 */ 12076 */
12343 class ElementLocator { 12077 class ElementLocator {
12344 /** 12078 /**
12345 * Locate the [Element] associated with the given [ASTNode]. 12079 * Locate the [Element] associated with the given [AstNode].
12346 * 12080 *
12347 * @param node the node (not `null`) 12081 * @param node the node (not `null`)
12348 * @return the associated element, or `null` if none is found 12082 * @return the associated element, or `null` if none is found
12349 */ 12083 */
12350 static Element locate(ASTNode node) { 12084 static Element locate(AstNode node) {
12351 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); 12085 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper();
12352 return node.accept(mapper); 12086 return node.accept(mapper);
12353 } 12087 }
12354 12088
12355 /** 12089 /**
12356 * Locate the [Element] associated with the given [ASTNode] and offset. 12090 * Locate the [Element] associated with the given [AstNode] and offset.
12357 * 12091 *
12358 * @param node the node (not `null`) 12092 * @param node the node (not `null`)
12359 * @param offset the offset relative to source 12093 * @param offset the offset relative to source
12360 * @return the associated element, or `null` if none is found 12094 * @return the associated element, or `null` if none is found
12361 */ 12095 */
12362 static Element locate2(ASTNode node, int offset) { 12096 static Element locate2(AstNode node, int offset) {
12363 // try to get Element from node 12097 // try to get Element from node
12364 { 12098 {
12365 Element nodeElement = locate(node); 12099 Element nodeElement = locate(node);
12366 if (nodeElement != null) { 12100 if (nodeElement != null) {
12367 return nodeElement; 12101 return nodeElement;
12368 } 12102 }
12369 } 12103 }
12370 // try to get Angular specific Element 12104 // try to get Angular specific Element
12371 { 12105 {
12372 Element element = null; 12106 Element element = null;
12373 if (element != null) { 12107 if (element != null) {
12374 return element; 12108 return element;
12375 } 12109 }
12376 } 12110 }
12377 // no Element 12111 // no Element
12378 return null; 12112 return null;
12379 } 12113 }
12380 } 12114 }
12381 12115
12382 /** 12116 /**
12383 * Visitor that maps nodes to elements. 12117 * Visitor that maps nodes to elements.
12384 */ 12118 */
12385 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { 12119 class ElementLocator_ElementMapper extends GeneralizingAstVisitor<Element> {
12386 Element visitAssignmentExpression(AssignmentExpression node) => node.bestEleme nt; 12120 Element visitAssignmentExpression(AssignmentExpression node) => node.bestEleme nt;
12387 12121
12388 Element visitBinaryExpression(BinaryExpression node) => node.bestElement; 12122 Element visitBinaryExpression(BinaryExpression node) => node.bestElement;
12389 12123
12390 Element visitClassDeclaration(ClassDeclaration node) => node.element; 12124 Element visitClassDeclaration(ClassDeclaration node) => node.element;
12391 12125
12392 Element visitCompilationUnit(CompilationUnit node) => node.element; 12126 Element visitCompilationUnit(CompilationUnit node) => node.element;
12393 12127
12394 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme nt; 12128 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme nt;
12395 12129
12396 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; 12130 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element;
12397 12131
12398 Element visitIdentifier(Identifier node) { 12132 Element visitIdentifier(Identifier node) {
12399 ASTNode parent = node.parent; 12133 AstNode parent = node.parent;
12400 // Type name in InstanceCreationExpression 12134 // Type name in InstanceCreationExpression
12401 { 12135 {
12402 ASTNode typeNameCandidate = parent; 12136 AstNode typeNameCandidate = parent;
12403 // new prefix.node[.constructorName]() 12137 // new prefix.node[.constructorName]()
12404 if (typeNameCandidate is PrefixedIdentifier) { 12138 if (typeNameCandidate is PrefixedIdentifier) {
12405 PrefixedIdentifier prefixedIdentifier = typeNameCandidate as PrefixedIde ntifier; 12139 PrefixedIdentifier prefixedIdentifier = typeNameCandidate as PrefixedIde ntifier;
12406 if (identical(prefixedIdentifier.identifier, node)) { 12140 if (identical(prefixedIdentifier.identifier, node)) {
12407 typeNameCandidate = prefixedIdentifier.parent; 12141 typeNameCandidate = prefixedIdentifier.parent;
12408 } 12142 }
12409 } 12143 }
12410 // new typeName[.constructorName]() 12144 // new typeName[.constructorName]()
12411 if (typeNameCandidate is TypeName) { 12145 if (typeNameCandidate is TypeName) {
12412 TypeName typeName = typeNameCandidate as TypeName; 12146 TypeName typeName = typeNameCandidate as TypeName;
(...skipping 12 matching lines...) Expand all
12425 if (name != null) { 12159 if (name != null) {
12426 return name.bestElement; 12160 return name.bestElement;
12427 } 12161 }
12428 Element element = node.bestElement; 12162 Element element = node.bestElement;
12429 if (element is ClassElement) { 12163 if (element is ClassElement) {
12430 return element.unnamedConstructor; 12164 return element.unnamedConstructor;
12431 } 12165 }
12432 } 12166 }
12433 } 12167 }
12434 if (parent is LibraryIdentifier) { 12168 if (parent is LibraryIdentifier) {
12435 ASTNode grandParent = parent.parent; 12169 AstNode grandParent = parent.parent;
12436 if (grandParent is PartOfDirective) { 12170 if (grandParent is PartOfDirective) {
12437 Element element = grandParent.element; 12171 Element element = grandParent.element;
12438 if (element is LibraryElement) { 12172 if (element is LibraryElement) {
12439 return element.definingCompilationUnit; 12173 return element.definingCompilationUnit;
12440 } 12174 }
12441 } 12175 }
12442 } 12176 }
12443 Element element = node.bestElement; 12177 Element element = node.bestElement;
12444 if (element == null) { 12178 if (element == null) {
12445 element = node.staticElement; 12179 element = node.staticElement;
(...skipping 13 matching lines...) Expand all
12459 12193
12460 Element visitMethodInvocation(MethodInvocation node) => node.methodName.bestEl ement; 12194 Element visitMethodInvocation(MethodInvocation node) => node.methodName.bestEl ement;
12461 12195
12462 Element visitPostfixExpression(PostfixExpression node) => node.bestElement; 12196 Element visitPostfixExpression(PostfixExpression node) => node.bestElement;
12463 12197
12464 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.bestElement; 12198 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.bestElement;
12465 12199
12466 Element visitPrefixExpression(PrefixExpression node) => node.bestElement; 12200 Element visitPrefixExpression(PrefixExpression node) => node.bestElement;
12467 12201
12468 Element visitStringLiteral(StringLiteral node) { 12202 Element visitStringLiteral(StringLiteral node) {
12469 ASTNode parent = node.parent; 12203 AstNode parent = node.parent;
12470 if (parent is UriBasedDirective) { 12204 if (parent is UriBasedDirective) {
12471 return parent.uriElement; 12205 return parent.uriElement;
12472 } 12206 }
12473 return null; 12207 return null;
12474 } 12208 }
12475 12209
12476 Element visitVariableDeclaration(VariableDeclaration node) => node.element; 12210 Element visitVariableDeclaration(VariableDeclaration node) => node.element;
12477 } 12211 }
12478 12212
12479 /** 12213 /**
12480 * Instances of the class `GeneralizingASTVisitor` implement an AST visitor that will 12214 * Instances of the class `GeneralizingAstVisitor` implement an AST visitor that will
12481 * recursively visit all of the nodes in an AST structure (like instances of the class 12215 * recursively visit all of the nodes in an AST structure (like instances of the class
12482 * [RecursiveASTVisitor]). In addition, when a node of a specific type is visite d not only 12216 * [RecursiveAstVisitor]). In addition, when a node of a specific type is visite d not only
12483 * will the visit method for that specific type of node be invoked, but addition al methods for the 12217 * will the visit method for that specific type of node be invoked, but addition al methods for the
12484 * superclasses of that node will also be invoked. For example, using an instanc e of this class to 12218 * superclasses of that node will also be invoked. For example, using an instanc e of this class to
12485 * visit a [Block] will cause the method [visitBlock] to be invoked but will 12219 * visit a [Block] will cause the method [visitBlock] to be invoked but will
12486 * also cause the methods [visitStatement] and [visitNode] to be 12220 * also cause the methods [visitStatement] and [visitNode] to be
12487 * subsequently invoked. This allows visitors to be written that visit all state ments without 12221 * subsequently invoked. This allows visitors to be written that visit all state ments without
12488 * needing to override the visit method for each of the specific subclasses of [ Statement]. 12222 * needing to override the visit method for each of the specific subclasses of [ Statement].
12489 * 12223 *
12490 * Subclasses that override a visit method must either invoke the overridden vis it method or 12224 * Subclasses that override a visit method must either invoke the overridden vis it method or
12491 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods 12225 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods
12492 * for superclasses of the node to not be invoked and will cause the children of the visited node to 12226 * for superclasses of the node to not be invoked and will cause the children of the visited node to
12493 * not be visited. 12227 * not be visited.
12494 *
12495 * @coverage dart.engine.ast
12496 */ 12228 */
12497 class GeneralizingASTVisitor<R> implements ASTVisitor<R> { 12229 class GeneralizingAstVisitor<R> implements AstVisitor<R> {
12498 R visitAdjacentStrings(AdjacentStrings node) => visitStringLiteral(node); 12230 R visitAdjacentStrings(AdjacentStrings node) => visitStringLiteral(node);
12499 12231
12500 R visitAnnotatedNode(AnnotatedNode node) => visitNode(node); 12232 R visitAnnotatedNode(AnnotatedNode node) => visitNode(node);
12501 12233
12502 R visitAnnotation(Annotation node) => visitNode(node); 12234 R visitAnnotation(Annotation node) => visitNode(node);
12503 12235
12504 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => visitExpression( node); 12236 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => visitExpression( node);
12505 12237
12506 R visitArgumentList(ArgumentList node) => visitNode(node); 12238 R visitArgumentList(ArgumentList node) => visitNode(node);
12507 12239
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
12650 R visitMethodInvocation(MethodInvocation node) => visitExpression(node); 12382 R visitMethodInvocation(MethodInvocation node) => visitExpression(node);
12651 12383
12652 R visitNamedExpression(NamedExpression node) => visitExpression(node); 12384 R visitNamedExpression(NamedExpression node) => visitExpression(node);
12653 12385
12654 R visitNamespaceDirective(NamespaceDirective node) => visitUriBasedDirective(n ode); 12386 R visitNamespaceDirective(NamespaceDirective node) => visitUriBasedDirective(n ode);
12655 12387
12656 R visitNativeClause(NativeClause node) => visitNode(node); 12388 R visitNativeClause(NativeClause node) => visitNode(node);
12657 12389
12658 R visitNativeFunctionBody(NativeFunctionBody node) => visitFunctionBody(node); 12390 R visitNativeFunctionBody(NativeFunctionBody node) => visitFunctionBody(node);
12659 12391
12660 R visitNode(ASTNode node) { 12392 R visitNode(AstNode node) {
12661 node.visitChildren(this); 12393 node.visitChildren(this);
12662 return null; 12394 return null;
12663 } 12395 }
12664 12396
12665 R visitNormalFormalParameter(NormalFormalParameter node) => visitFormalParamet er(node); 12397 R visitNormalFormalParameter(NormalFormalParameter node) => visitFormalParamet er(node);
12666 12398
12667 R visitNullLiteral(NullLiteral node) => visitLiteral(node); 12399 R visitNullLiteral(NullLiteral node) => visitLiteral(node);
12668 12400
12669 R visitParenthesizedExpression(ParenthesizedExpression node) => visitExpressio n(node); 12401 R visitParenthesizedExpression(ParenthesizedExpression node) => visitExpressio n(node);
12670 12402
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
12743 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node ); 12475 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node );
12744 12476
12745 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi tStatement(node); 12477 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi tStatement(node);
12746 12478
12747 R visitWhileStatement(WhileStatement node) => visitStatement(node); 12479 R visitWhileStatement(WhileStatement node) => visitStatement(node);
12748 12480
12749 R visitWithClause(WithClause node) => visitNode(node); 12481 R visitWithClause(WithClause node) => visitNode(node);
12750 } 12482 }
12751 12483
12752 /** 12484 /**
12753 * Instances of the class `NodeLocator` locate the [ASTNode] associated with a 12485 * Instances of the class `NodeLocator` locate the [AstNode] associated with a
12754 * source range, given the AST structure built from the source. More specificall y, they will return 12486 * source range, given the AST structure built from the source. More specificall y, they will return
12755 * the [ASTNode] with the shortest length whose source range completely encompas ses 12487 * the [AstNode] with the shortest length whose source range completely encompas ses
12756 * the specified range. 12488 * the specified range.
12757 *
12758 * @coverage dart.engine.ast
12759 */ 12489 */
12760 class NodeLocator extends UnifyingASTVisitor<Object> { 12490 class NodeLocator extends UnifyingAstVisitor<Object> {
12761 /** 12491 /**
12762 * The start offset of the range used to identify the node. 12492 * The start offset of the range used to identify the node.
12763 */ 12493 */
12764 int _startOffset = 0; 12494 int _startOffset = 0;
12765 12495
12766 /** 12496 /**
12767 * The end offset of the range used to identify the node. 12497 * The end offset of the range used to identify the node.
12768 */ 12498 */
12769 int _endOffset = 0; 12499 int _endOffset = 0;
12770 12500
12771 /** 12501 /**
12772 * The element that was found that corresponds to the given source range, or ` null` if there 12502 * The element that was found that corresponds to the given source range, or ` null` if there
12773 * is no such element. 12503 * is no such element.
12774 */ 12504 */
12775 ASTNode _foundNode; 12505 AstNode _foundNode;
12776 12506
12777 /** 12507 /**
12778 * Initialize a newly created locator to locate one or more [ASTNode] by locat ing 12508 * Initialize a newly created locator to locate one or more [AstNode] by locat ing
12779 * the node within an AST structure that corresponds to the given offset in th e source. 12509 * the node within an AST structure that corresponds to the given offset in th e source.
12780 * 12510 *
12781 * @param offset the offset used to identify the node 12511 * @param offset the offset used to identify the node
12782 */ 12512 */
12783 NodeLocator.con1(int offset) : this.con2(offset, offset); 12513 NodeLocator.con1(int offset) : this.con2(offset, offset);
12784 12514
12785 /** 12515 /**
12786 * Initialize a newly created locator to locate one or more [ASTNode] by locat ing 12516 * Initialize a newly created locator to locate one or more [AstNode] by locat ing
12787 * the node within an AST structure that corresponds to the given range of cha racters in the 12517 * the node within an AST structure that corresponds to the given range of cha racters in the
12788 * source. 12518 * source.
12789 * 12519 *
12790 * @param start the start offset of the range used to identify the node 12520 * @param start the start offset of the range used to identify the node
12791 * @param end the end offset of the range used to identify the node 12521 * @param end the end offset of the range used to identify the node
12792 */ 12522 */
12793 NodeLocator.con2(int start, int end) { 12523 NodeLocator.con2(int start, int end) {
12794 this._startOffset = start; 12524 this._startOffset = start;
12795 this._endOffset = end; 12525 this._endOffset = end;
12796 } 12526 }
12797 12527
12798 /** 12528 /**
12799 * Return the node that was found that corresponds to the given source range, or `null` if 12529 * Return the node that was found that corresponds to the given source range, or `null` if
12800 * there is no such node. 12530 * there is no such node.
12801 * 12531 *
12802 * @return the node that was found 12532 * @return the node that was found
12803 */ 12533 */
12804 ASTNode get foundNode => _foundNode; 12534 AstNode get foundNode => _foundNode;
12805 12535
12806 /** 12536 /**
12807 * Search within the given AST node for an identifier representing a [DartElem ent] in the specified source range. Return the element that was found, or `null` if 12537 * Search within the given AST node for an identifier representing a [DartElem ent] in the specified source range. Return the element that was found, or `null` if
12808 * no element was found. 12538 * no element was found.
12809 * 12539 *
12810 * @param node the AST node within which to search 12540 * @param node the AST node within which to search
12811 * @return the element that was found 12541 * @return the element that was found
12812 */ 12542 */
12813 ASTNode searchWithin(ASTNode node) { 12543 AstNode searchWithin(AstNode node) {
12814 if (node == null) { 12544 if (node == null) {
12815 return null; 12545 return null;
12816 } 12546 }
12817 try { 12547 try {
12818 node.accept(this); 12548 node.accept(this);
12819 } on NodeLocator_NodeFoundException catch (exception) { 12549 } on NodeLocator_NodeFoundException catch (exception) {
12820 } on JavaException catch (exception) { 12550 } on JavaException catch (exception) {
12821 AnalysisEngine.instance.logger.logInformation3("Unable to locate element a t offset (${_startOffset} - ${_endOffset})", exception); 12551 AnalysisEngine.instance.logger.logInformation3("Unable to locate element a t offset (${_startOffset} - ${_endOffset})", exception);
12822 return null; 12552 return null;
12823 } 12553 }
12824 return _foundNode; 12554 return _foundNode;
12825 } 12555 }
12826 12556
12827 Object visitNode(ASTNode node) { 12557 Object visitNode(AstNode node) {
12828 int start = node.offset; 12558 int start = node.offset;
12829 int end = start + node.length; 12559 int end = start + node.length;
12830 if (end < _startOffset) { 12560 if (end < _startOffset) {
12831 return null; 12561 return null;
12832 } 12562 }
12833 if (start > _endOffset) { 12563 if (start > _endOffset) {
12834 return null; 12564 return null;
12835 } 12565 }
12836 try { 12566 try {
12837 node.visitChildren(this); 12567 node.visitChildren(this);
(...skipping 13 matching lines...) Expand all
12851 12581
12852 /** 12582 /**
12853 * Instances of the class `NodeFoundException` are used to cancel visiting after a node has 12583 * Instances of the class `NodeFoundException` are used to cancel visiting after a node has
12854 * been found. 12584 * been found.
12855 */ 12585 */
12856 class NodeLocator_NodeFoundException extends RuntimeException { 12586 class NodeLocator_NodeFoundException extends RuntimeException {
12857 static int _serialVersionUID = 1; 12587 static int _serialVersionUID = 1;
12858 } 12588 }
12859 12589
12860 /** 12590 /**
12861 * Instances of the class `RecursiveASTVisitor` implement an AST visitor that wi ll recursively 12591 * Instances of the class `RecursiveAstVisitor` implement an AST visitor that wi ll recursively
12862 * visit all of the nodes in an AST structure. For example, using an instance of this class to visit 12592 * visit all of the nodes in an AST structure. For example, using an instance of this class to visit
12863 * a [Block] will also cause all of the statements in the block to be visited. 12593 * a [Block] will also cause all of the statements in the block to be visited.
12864 * 12594 *
12865 * Subclasses that override a visit method must either invoke the overridden vis it method or must 12595 * Subclasses that override a visit method must either invoke the overridden vis it method or must
12866 * explicitly ask the visited node to visit its children. Failure to do so will cause the children 12596 * explicitly ask the visited node to visit its children. Failure to do so will cause the children
12867 * of the visited node to not be visited. 12597 * of the visited node to not be visited.
12868 *
12869 * @coverage dart.engine.ast
12870 */ 12598 */
12871 class RecursiveASTVisitor<R> implements ASTVisitor<R> { 12599 class RecursiveAstVisitor<R> implements AstVisitor<R> {
12872 R visitAdjacentStrings(AdjacentStrings node) { 12600 R visitAdjacentStrings(AdjacentStrings node) {
12873 node.visitChildren(this); 12601 node.visitChildren(this);
12874 return null; 12602 return null;
12875 } 12603 }
12876 12604
12877 R visitAnnotation(Annotation node) { 12605 R visitAnnotation(Annotation node) {
12878 node.visitChildren(this); 12606 node.visitChildren(this);
12879 return null; 12607 return null;
12880 } 12608 }
12881 12609
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
13379 return null; 13107 return null;
13380 } 13108 }
13381 13109
13382 R visitWithClause(WithClause node) { 13110 R visitWithClause(WithClause node) {
13383 node.visitChildren(this); 13111 node.visitChildren(this);
13384 return null; 13112 return null;
13385 } 13113 }
13386 } 13114 }
13387 13115
13388 /** 13116 /**
13389 * Instances of the class `SimpleASTVisitor` implement an AST visitor that will do nothing 13117 * Instances of the class `SimpleAstVisitor` implement an AST visitor that will do nothing
13390 * when visiting an AST node. It is intended to be a superclass for classes that use the visitor 13118 * when visiting an AST node. It is intended to be a superclass for classes that use the visitor
13391 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel y visit a whole 13119 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel y visit a whole
13392 * structure) and that only need to visit a small number of node types. 13120 * structure) and that only need to visit a small number of node types.
13393 *
13394 * @coverage dart.engine.ast
13395 */ 13121 */
13396 class SimpleASTVisitor<R> implements ASTVisitor<R> { 13122 class SimpleAstVisitor<R> implements AstVisitor<R> {
13397 R visitAdjacentStrings(AdjacentStrings node) => null; 13123 R visitAdjacentStrings(AdjacentStrings node) => null;
13398 13124
13399 R visitAnnotation(Annotation node) => null; 13125 R visitAnnotation(Annotation node) => null;
13400 13126
13401 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => null; 13127 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => null;
13402 13128
13403 R visitArgumentList(ArgumentList node) => null; 13129 R visitArgumentList(ArgumentList node) => null;
13404 13130
13405 R visitAsExpression(AsExpression node) => null; 13131 R visitAsExpression(AsExpression node) => null;
13406 13132
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
13597 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null ; 13323 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null ;
13598 13324
13599 R visitWhileStatement(WhileStatement node) => null; 13325 R visitWhileStatement(WhileStatement node) => null;
13600 13326
13601 R visitWithClause(WithClause node) => null; 13327 R visitWithClause(WithClause node) => null;
13602 } 13328 }
13603 13329
13604 /** 13330 /**
13605 * Instances of the class `ToSourceVisitor` write a source representation of a v isited AST 13331 * Instances of the class `ToSourceVisitor` write a source representation of a v isited AST
13606 * node (and all of it's children) to a writer. 13332 * node (and all of it's children) to a writer.
13607 *
13608 * @coverage dart.engine.ast
13609 */ 13333 */
13610 class ToSourceVisitor implements ASTVisitor<Object> { 13334 class ToSourceVisitor implements AstVisitor<Object> {
13611 /** 13335 /**
13612 * The writer to which the source is to be written. 13336 * The writer to which the source is to be written.
13613 */ 13337 */
13614 PrintWriter _writer; 13338 PrintWriter _writer;
13615 13339
13616 /** 13340 /**
13617 * Initialize a newly created visitor to write source code representing the vi sited nodes to the 13341 * Initialize a newly created visitor to write source code representing the vi sited nodes to the
13618 * given writer. 13342 * given writer.
13619 * 13343 *
13620 * @param writer the writer to which the source is to be written 13344 * @param writer the writer to which the source is to be written
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
14429 _writer.print("with "); 14153 _writer.print("with ");
14430 visitList2(node.mixinTypes, ", "); 14154 visitList2(node.mixinTypes, ", ");
14431 return null; 14155 return null;
14432 } 14156 }
14433 14157
14434 /** 14158 /**
14435 * Safely visit the given node. 14159 * Safely visit the given node.
14436 * 14160 *
14437 * @param node the node to be visited 14161 * @param node the node to be visited
14438 */ 14162 */
14439 void visit(ASTNode node) { 14163 void visit(AstNode node) {
14440 if (node != null) { 14164 if (node != null) {
14441 node.accept(this); 14165 node.accept(this);
14442 } 14166 }
14443 } 14167 }
14444 14168
14445 /** 14169 /**
14446 * Safely visit the given node, printing the suffix after the node if it is no n-`null`. 14170 * Safely visit the given node, printing the suffix after the node if it is no n-`null`.
14447 * 14171 *
14448 * @param suffix the suffix to be printed if there is a node to visit 14172 * @param suffix the suffix to be printed if there is a node to visit
14449 * @param node the node to be visited 14173 * @param node the node to be visited
14450 */ 14174 */
14451 void visit2(ASTNode node, String suffix) { 14175 void visit2(AstNode node, String suffix) {
14452 if (node != null) { 14176 if (node != null) {
14453 node.accept(this); 14177 node.accept(this);
14454 _writer.print(suffix); 14178 _writer.print(suffix);
14455 } 14179 }
14456 } 14180 }
14457 14181
14458 /** 14182 /**
14459 * Safely visit the given node, printing the prefix before the node if it is n on-`null`. 14183 * Safely visit the given node, printing the prefix before the node if it is n on-`null`.
14460 * 14184 *
14461 * @param prefix the prefix to be printed if there is a node to visit 14185 * @param prefix the prefix to be printed if there is a node to visit
14462 * @param node the node to be visited 14186 * @param node the node to be visited
14463 */ 14187 */
14464 void visit3(String prefix, ASTNode node) { 14188 void visit3(String prefix, AstNode node) {
14465 if (node != null) { 14189 if (node != null) {
14466 _writer.print(prefix); 14190 _writer.print(prefix);
14467 node.accept(this); 14191 node.accept(this);
14468 } 14192 }
14469 } 14193 }
14470 14194
14471 /** 14195 /**
14472 * Visit the given function body, printing the prefix before if given body is not empty. 14196 * Visit the given function body, printing the prefix before if given body is not empty.
14473 * 14197 *
14474 * @param prefix the prefix to be printed if there is a node to visit 14198 * @param prefix the prefix to be printed if there is a node to visit
(...skipping 18 matching lines...) Expand all
14493 _writer.print(suffix); 14217 _writer.print(suffix);
14494 } 14218 }
14495 } 14219 }
14496 14220
14497 /** 14221 /**
14498 * Print a list of nodes without any separation. 14222 * Print a list of nodes without any separation.
14499 * 14223 *
14500 * @param nodes the nodes to be printed 14224 * @param nodes the nodes to be printed
14501 * @param separator the separator to be printed between adjacent nodes 14225 * @param separator the separator to be printed between adjacent nodes
14502 */ 14226 */
14503 void visitList(NodeList<ASTNode> nodes) { 14227 void visitList(NodeList<AstNode> nodes) {
14504 visitList2(nodes, ""); 14228 visitList2(nodes, "");
14505 } 14229 }
14506 14230
14507 /** 14231 /**
14508 * Print a list of nodes, separated by the given separator. 14232 * Print a list of nodes, separated by the given separator.
14509 * 14233 *
14510 * @param nodes the nodes to be printed 14234 * @param nodes the nodes to be printed
14511 * @param separator the separator to be printed between adjacent nodes 14235 * @param separator the separator to be printed between adjacent nodes
14512 */ 14236 */
14513 void visitList2(NodeList<ASTNode> nodes, String separator) { 14237 void visitList2(NodeList<AstNode> nodes, String separator) {
14514 if (nodes != null) { 14238 if (nodes != null) {
14515 int size = nodes.length; 14239 int size = nodes.length;
14516 for (int i = 0; i < size; i++) { 14240 for (int i = 0; i < size; i++) {
14517 if (i > 0) { 14241 if (i > 0) {
14518 _writer.print(separator); 14242 _writer.print(separator);
14519 } 14243 }
14520 nodes[i].accept(this); 14244 nodes[i].accept(this);
14521 } 14245 }
14522 } 14246 }
14523 } 14247 }
14524 14248
14525 /** 14249 /**
14526 * Print a list of nodes, separated by the given separator. 14250 * Print a list of nodes, separated by the given separator.
14527 * 14251 *
14528 * @param nodes the nodes to be printed 14252 * @param nodes the nodes to be printed
14529 * @param separator the separator to be printed between adjacent nodes 14253 * @param separator the separator to be printed between adjacent nodes
14530 * @param suffix the suffix to be printed if the list is not empty 14254 * @param suffix the suffix to be printed if the list is not empty
14531 */ 14255 */
14532 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { 14256 void visitList3(NodeList<AstNode> nodes, String separator, String suffix) {
14533 if (nodes != null) { 14257 if (nodes != null) {
14534 int size = nodes.length; 14258 int size = nodes.length;
14535 if (size > 0) { 14259 if (size > 0) {
14536 for (int i = 0; i < size; i++) { 14260 for (int i = 0; i < size; i++) {
14537 if (i > 0) { 14261 if (i > 0) {
14538 _writer.print(separator); 14262 _writer.print(separator);
14539 } 14263 }
14540 nodes[i].accept(this); 14264 nodes[i].accept(this);
14541 } 14265 }
14542 _writer.print(suffix); 14266 _writer.print(suffix);
14543 } 14267 }
14544 } 14268 }
14545 } 14269 }
14546 14270
14547 /** 14271 /**
14548 * Print a list of nodes, separated by the given separator. 14272 * Print a list of nodes, separated by the given separator.
14549 * 14273 *
14550 * @param prefix the prefix to be printed if the list is not empty 14274 * @param prefix the prefix to be printed if the list is not empty
14551 * @param nodes the nodes to be printed 14275 * @param nodes the nodes to be printed
14552 * @param separator the separator to be printed between adjacent nodes 14276 * @param separator the separator to be printed between adjacent nodes
14553 */ 14277 */
14554 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { 14278 void visitList4(String prefix, NodeList<AstNode> nodes, String separator) {
14555 if (nodes != null) { 14279 if (nodes != null) {
14556 int size = nodes.length; 14280 int size = nodes.length;
14557 if (size > 0) { 14281 if (size > 0) {
14558 _writer.print(prefix); 14282 _writer.print(prefix);
14559 for (int i = 0; i < size; i++) { 14283 for (int i = 0; i < size; i++) {
14560 if (i > 0) { 14284 if (i > 0) {
14561 _writer.print(separator); 14285 _writer.print(separator);
14562 } 14286 }
14563 nodes[i].accept(this); 14287 nodes[i].accept(this);
14564 } 14288 }
14565 } 14289 }
14566 } 14290 }
14567 } 14291 }
14568 } 14292 }
14569 14293
14570 /** 14294 /**
14571 * Instances of the class `UnifyingASTVisitor` implement an AST visitor that wil l recursively 14295 * Instances of the class `UnifyingAstVisitor` implement an AST visitor that wil l recursively
14572 * visit all of the nodes in an AST structure (like instances of the class 14296 * visit all of the nodes in an AST structure (like instances of the class
14573 * [RecursiveASTVisitor]). In addition, every node will also be visited by using a single 14297 * [RecursiveAstVisitor]). In addition, every node will also be visited by using a single
14574 * unified [visitNode] method. 14298 * unified [visitNode] method.
14575 * 14299 *
14576 * Subclasses that override a visit method must either invoke the overridden vis it method or 14300 * Subclasses that override a visit method must either invoke the overridden vis it method or
14577 * explicitly invoke the more general [visitNode] method. Failure to do so will 14301 * explicitly invoke the more general [visitNode] method. Failure to do so will
14578 * cause the children of the visited node to not be visited. 14302 * cause the children of the visited node to not be visited.
14579 *
14580 * @coverage dart.engine.ast
14581 */ 14303 */
14582 class UnifyingASTVisitor<R> implements ASTVisitor<R> { 14304 class UnifyingAstVisitor<R> implements AstVisitor<R> {
14583 R visitAdjacentStrings(AdjacentStrings node) => visitNode(node); 14305 R visitAdjacentStrings(AdjacentStrings node) => visitNode(node);
14584 14306
14585 R visitAnnotation(Annotation node) => visitNode(node); 14307 R visitAnnotation(Annotation node) => visitNode(node);
14586 14308
14587 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => visitNode(node); 14309 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => visitNode(node);
14588 14310
14589 R visitArgumentList(ArgumentList node) => visitNode(node); 14311 R visitArgumentList(ArgumentList node) => visitNode(node);
14590 14312
14591 R visitAsExpression(AsExpression node) => visitNode(node); 14313 R visitAsExpression(AsExpression node) => visitNode(node);
14592 14314
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
14707 R visitMethodDeclaration(MethodDeclaration node) => visitNode(node); 14429 R visitMethodDeclaration(MethodDeclaration node) => visitNode(node);
14708 14430
14709 R visitMethodInvocation(MethodInvocation node) => visitNode(node); 14431 R visitMethodInvocation(MethodInvocation node) => visitNode(node);
14710 14432
14711 R visitNamedExpression(NamedExpression node) => visitNode(node); 14433 R visitNamedExpression(NamedExpression node) => visitNode(node);
14712 14434
14713 R visitNativeClause(NativeClause node) => visitNode(node); 14435 R visitNativeClause(NativeClause node) => visitNode(node);
14714 14436
14715 R visitNativeFunctionBody(NativeFunctionBody node) => visitNode(node); 14437 R visitNativeFunctionBody(NativeFunctionBody node) => visitNode(node);
14716 14438
14717 R visitNode(ASTNode node) { 14439 R visitNode(AstNode node) {
14718 node.visitChildren(this); 14440 node.visitChildren(this);
14719 return null; 14441 return null;
14720 } 14442 }
14721 14443
14722 R visitNullLiteral(NullLiteral node) => visitNode(node); 14444 R visitNullLiteral(NullLiteral node) => visitNode(node);
14723 14445
14724 R visitParenthesizedExpression(ParenthesizedExpression node) => visitNode(node ); 14446 R visitParenthesizedExpression(ParenthesizedExpression node) => visitNode(node );
14725 14447
14726 R visitPartDirective(PartDirective node) => visitNode(node); 14448 R visitPartDirective(PartDirective node) => visitNode(node);
14727 14449
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
14786 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node ); 14508 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node );
14787 14509
14788 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi tNode(node); 14510 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi tNode(node);
14789 14511
14790 R visitWhileStatement(WhileStatement node) => visitNode(node); 14512 R visitWhileStatement(WhileStatement node) => visitNode(node);
14791 14513
14792 R visitWithClause(WithClause node) => visitNode(node); 14514 R visitWithClause(WithClause node) => visitNode(node);
14793 } 14515 }
14794 14516
14795 /** 14517 /**
14796 * Instances of the class `ASTCloner` implement an object that will clone any AS T structure 14518 * Instances of the class `AstCloner` implement an object that will clone any AS T structure
14797 * that it visits. The cloner will only clone the structure, it will not preserv e any resolution 14519 * that it visits. The cloner will only clone the structure, it will not preserv e any resolution
14798 * results or properties associated with the nodes. 14520 * results or properties associated with the nodes.
14799 */ 14521 */
14800 class ASTCloner implements ASTVisitor<ASTNode> { 14522 class AstCloner implements AstVisitor<AstNode> {
14801 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri ngs(clone3(node.strings)); 14523 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri ngs(clone3(node.strings));
14802 14524
14803 Annotation visitAnnotation(Annotation node) => new Annotation(node.atSign, clo ne2(node.name), node.period, clone2(node.constructorName), clone2(node.arguments )); 14525 Annotation visitAnnotation(Annotation node) => new Annotation(node.atSign, clo ne2(node.name), node.period, clone2(node.constructorName), clone2(node.arguments ));
14804 14526
14805 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node ) => new ArgumentDefinitionTest(node.question, clone2(node.identifier)); 14527 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node ) => new ArgumentDefinitionTest(node.question, clone2(node.identifier));
14806 14528
14807 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList(node.lef tParenthesis, clone3(node.arguments), node.rightParenthesis); 14529 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList(node.lef tParenthesis, clone3(node.arguments), node.rightParenthesis);
14808 14530
14809 AsExpression visitAsExpression(AsExpression node) => new AsExpression(clone2(n ode.expression), node.asOperator, clone2(node.type)); 14531 AsExpression visitAsExpression(AsExpression node) => new AsExpression(clone2(n ode.expression), node.asOperator, clone2(node.type));
14810 14532
14811 ASTNode visitAssertStatement(AssertStatement node) => new AssertStatement(node .keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, n ode.semicolon); 14533 AstNode visitAssertStatement(AssertStatement node) => new AssertStatement(node .keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, n ode.semicolon);
14812 14534
14813 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) => n ew AssignmentExpression(clone2(node.leftHandSide), node.operator, clone2(node.ri ghtHandSide)); 14535 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) => n ew AssignmentExpression(clone2(node.leftHandSide), node.operator, clone2(node.ri ghtHandSide));
14814 14536
14815 BinaryExpression visitBinaryExpression(BinaryExpression node) => new BinaryExp ression(clone2(node.leftOperand), node.operator, clone2(node.rightOperand)); 14537 BinaryExpression visitBinaryExpression(BinaryExpression node) => new BinaryExp ression(clone2(node.leftOperand), node.operator, clone2(node.rightOperand));
14816 14538
14817 Block visitBlock(Block node) => new Block(node.leftBracket, clone3(node.statem ents), node.rightBracket); 14539 Block visitBlock(Block node) => new Block(node.leftBracket, clone3(node.statem ents), node.rightBracket);
14818 14540
14819 BlockFunctionBody visitBlockFunctionBody(BlockFunctionBody node) => new BlockF unctionBody(clone2(node.block)); 14541 BlockFunctionBody visitBlockFunctionBody(BlockFunctionBody node) => new BlockF unctionBody(clone2(node.block));
14820 14542
14821 BooleanLiteral visitBooleanLiteral(BooleanLiteral node) => new BooleanLiteral( node.literal, node.value); 14543 BooleanLiteral visitBooleanLiteral(BooleanLiteral node) => new BooleanLiteral( node.literal, node.value);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
14949 MapLiteral visitMapLiteral(MapLiteral node) => new MapLiteral(node.constKeywor d, clone2(node.typeArguments), node.leftBracket, clone3(node.entries), node.righ tBracket); 14671 MapLiteral visitMapLiteral(MapLiteral node) => new MapLiteral(node.constKeywor d, clone2(node.typeArguments), node.leftBracket, clone3(node.entries), node.righ tBracket);
14950 14672
14951 MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) => new MapLiteralEn try(clone2(node.key), node.separator, clone2(node.value)); 14673 MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) => new MapLiteralEn try(clone2(node.key), node.separator, clone2(node.value));
14952 14674
14953 MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => new Method Declaration(clone2(node.documentationComment), clone3(node.metadata), node.exter nalKeyword, node.modifierKeyword, clone2(node.returnType), node.propertyKeyword, node.operatorKeyword, clone2(node.name), clone2(node.parameters), clone2(node.b ody)); 14675 MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => new Method Declaration(clone2(node.documentationComment), clone3(node.metadata), node.exter nalKeyword, node.modifierKeyword, clone2(node.returnType), node.propertyKeyword, node.operatorKeyword, clone2(node.name), clone2(node.parameters), clone2(node.b ody));
14954 14676
14955 MethodInvocation visitMethodInvocation(MethodInvocation node) => new MethodInv ocation(clone2(node.target), node.period, clone2(node.methodName), clone2(node.a rgumentList)); 14677 MethodInvocation visitMethodInvocation(MethodInvocation node) => new MethodInv ocation(clone2(node.target), node.period, clone2(node.methodName), clone2(node.a rgumentList));
14956 14678
14957 NamedExpression visitNamedExpression(NamedExpression node) => new NamedExpress ion(clone2(node.name), clone2(node.expression)); 14679 NamedExpression visitNamedExpression(NamedExpression node) => new NamedExpress ion(clone2(node.name), clone2(node.expression));
14958 14680
14959 ASTNode visitNativeClause(NativeClause node) => new NativeClause(node.keyword, clone2(node.name)); 14681 AstNode visitNativeClause(NativeClause node) => new NativeClause(node.keyword, clone2(node.name));
14960 14682
14961 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => new Nat iveFunctionBody(node.nativeToken, clone2(node.stringLiteral), node.semicolon); 14683 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => new Nat iveFunctionBody(node.nativeToken, clone2(node.stringLiteral), node.semicolon);
14962 14684
14963 NullLiteral visitNullLiteral(NullLiteral node) => new NullLiteral(node.literal ); 14685 NullLiteral visitNullLiteral(NullLiteral node) => new NullLiteral(node.literal );
14964 14686
14965 ParenthesizedExpression visitParenthesizedExpression(ParenthesizedExpression n ode) => new ParenthesizedExpression(node.leftParenthesis, clone2(node.expression ), node.rightParenthesis); 14687 ParenthesizedExpression visitParenthesizedExpression(ParenthesizedExpression n ode) => new ParenthesizedExpression(node.leftParenthesis, clone2(node.expression ), node.rightParenthesis);
14966 14688
14967 PartDirective visitPartDirective(PartDirective node) => new PartDirective(clon e2(node.documentationComment), clone3(node.metadata), node.partToken, clone2(nod e.uri), node.semicolon); 14689 PartDirective visitPartDirective(PartDirective node) => new PartDirective(clon e2(node.documentationComment), clone3(node.metadata), node.partToken, clone2(nod e.uri), node.semicolon);
14968 14690
14969 PartOfDirective visitPartOfDirective(PartOfDirective node) => new PartOfDirect ive(clone2(node.documentationComment), clone3(node.metadata), node.partToken, no de.ofToken, clone2(node.libraryName), node.semicolon); 14691 PartOfDirective visitPartOfDirective(PartOfDirective node) => new PartOfDirect ive(clone2(node.documentationComment), clone3(node.metadata), node.partToken, no de.ofToken, clone2(node.libraryName), node.semicolon);
(...skipping 27 matching lines...) Expand all
14997 SuperConstructorInvocation visitSuperConstructorInvocation(SuperConstructorInv ocation node) => new SuperConstructorInvocation(node.keyword, node.period, clone 2(node.constructorName), clone2(node.argumentList)); 14719 SuperConstructorInvocation visitSuperConstructorInvocation(SuperConstructorInv ocation node) => new SuperConstructorInvocation(node.keyword, node.period, clone 2(node.constructorName), clone2(node.argumentList));
14998 14720
14999 SuperExpression visitSuperExpression(SuperExpression node) => new SuperExpress ion(node.keyword); 14721 SuperExpression visitSuperExpression(SuperExpression node) => new SuperExpress ion(node.keyword);
15000 14722
15001 SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase(clone3(node.labe ls), node.keyword, clone2(node.expression), node.colon, clone3(node.statements)) ; 14723 SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase(clone3(node.labe ls), node.keyword, clone2(node.expression), node.colon, clone3(node.statements)) ;
15002 14724
15003 SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault(clon e3(node.labels), node.keyword, node.colon, clone3(node.statements)); 14725 SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault(clon e3(node.labels), node.keyword, node.colon, clone3(node.statements));
15004 14726
15005 SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatem ent(node.keyword, node.leftParenthesis, clone2(node.expression), node.rightParen thesis, node.leftBracket, clone3(node.members), node.rightBracket); 14727 SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatem ent(node.keyword, node.leftParenthesis, clone2(node.expression), node.rightParen thesis, node.leftBracket, clone3(node.members), node.rightBracket);
15006 14728
15007 ASTNode visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral(node.pound Sign, node.components); 14729 AstNode visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral(node.pound Sign, node.components);
15008 14730
15009 ThisExpression visitThisExpression(ThisExpression node) => new ThisExpression( node.keyword); 14731 ThisExpression visitThisExpression(ThisExpression node) => new ThisExpression( node.keyword);
15010 14732
15011 ThrowExpression visitThrowExpression(ThrowExpression node) => new ThrowExpress ion(node.keyword, clone2(node.expression)); 14733 ThrowExpression visitThrowExpression(ThrowExpression node) => new ThrowExpress ion(node.keyword, clone2(node.expression));
15012 14734
15013 TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableD eclaration node) => new TopLevelVariableDeclaration(clone2(node.documentationCom ment), clone3(node.metadata), clone2(node.variables), node.semicolon); 14735 TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableD eclaration node) => new TopLevelVariableDeclaration(clone2(node.documentationCom ment), clone3(node.metadata), clone2(node.variables), node.semicolon);
15014 14736
15015 TryStatement visitTryStatement(TryStatement node) => new TryStatement(node.try Keyword, clone2(node.body), clone3(node.catchClauses), node.finallyKeyword, clon e2(node.finallyBlock)); 14737 TryStatement visitTryStatement(TryStatement node) => new TryStatement(node.try Keyword, clone2(node.body), clone3(node.catchClauses), node.finallyKeyword, clon e2(node.finallyBlock));
15016 14738
15017 TypeArgumentList visitTypeArgumentList(TypeArgumentList node) => new TypeArgum entList(node.leftBracket, clone3(node.arguments), node.rightBracket); 14739 TypeArgumentList visitTypeArgumentList(TypeArgumentList node) => new TypeArgum entList(node.leftBracket, clone3(node.arguments), node.rightBracket);
15018 14740
15019 TypeName visitTypeName(TypeName node) => new TypeName(clone2(node.name), clone 2(node.typeArguments)); 14741 TypeName visitTypeName(TypeName node) => new TypeName(clone2(node.name), clone 2(node.typeArguments));
15020 14742
15021 TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter(clon e2(node.documentationComment), clone3(node.metadata), clone2(node.name), node.ke yword, clone2(node.bound)); 14743 TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter(clon e2(node.documentationComment), clone3(node.metadata), clone2(node.name), node.ke yword, clone2(node.bound));
15022 14744
15023 TypeParameterList visitTypeParameterList(TypeParameterList node) => new TypePa rameterList(node.leftBracket, clone3(node.typeParameters), node.rightBracket); 14745 TypeParameterList visitTypeParameterList(TypeParameterList node) => new TypePa rameterList(node.leftBracket, clone3(node.typeParameters), node.rightBracket);
15024 14746
15025 VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration(null, clone3(node.metadata), clone2(node.name), node.equals, clone2(node.initializer)); 14747 VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration(null, clone3(node.metadata), clone2(node.name), node.equals, clone2(node.initializer));
15026 14748
15027 VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList n ode) => new VariableDeclarationList(null, clone3(node.metadata), node.keyword, c lone2(node.type), clone3(node.variables)); 14749 VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList n ode) => new VariableDeclarationList(null, clone3(node.metadata), node.keyword, c lone2(node.type), clone3(node.variables));
15028 14750
15029 VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclara tionStatement node) => new VariableDeclarationStatement(clone2(node.variables), node.semicolon); 14751 VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclara tionStatement node) => new VariableDeclarationStatement(clone2(node.variables), node.semicolon);
15030 14752
15031 WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement( node.keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesi s, clone2(node.body)); 14753 WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement( node.keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesi s, clone2(node.body));
15032 14754
15033 WithClause visitWithClause(WithClause node) => new WithClause(node.withKeyword , clone3(node.mixinTypes)); 14755 WithClause visitWithClause(WithClause node) => new WithClause(node.withKeyword , clone3(node.mixinTypes));
15034 14756
15035 ASTNode clone2(ASTNode node) { 14757 AstNode clone2(AstNode node) {
15036 if (node == null) { 14758 if (node == null) {
15037 return null; 14759 return null;
15038 } 14760 }
15039 return node.accept(this) as ASTNode; 14761 return node.accept(this) as AstNode;
15040 } 14762 }
15041 14763
15042 List clone3(NodeList nodes) { 14764 List clone3(NodeList nodes) {
15043 int count = nodes.length; 14765 int count = nodes.length;
15044 List clonedNodes = new List(); 14766 List clonedNodes = new List();
15045 for (int i = 0; i < count; i++) { 14767 for (int i = 0; i < count; i++) {
15046 clonedNodes.add((nodes[i]).accept(this) as ASTNode); 14768 clonedNodes.add((nodes[i]).accept(this) as AstNode);
15047 } 14769 }
15048 return clonedNodes; 14770 return clonedNodes;
15049 } 14771 }
15050 } 14772 }
15051 14773
15052 /** 14774 /**
15053 * Instances of the class `ASTComparator` compare the structure of two ASTNodes to see whether 14775 * Instances of the class `AstComparator` compare the structure of two ASTNodes to see whether
15054 * they are equal. 14776 * they are equal.
15055 */ 14777 */
15056 class ASTComparator implements ASTVisitor<bool> { 14778 class AstComparator implements AstVisitor<bool> {
15057 /** 14779 /**
15058 * Return `true` if the two AST nodes are equal. 14780 * Return `true` if the two AST nodes are equal.
15059 * 14781 *
15060 * @param first the first node being compared 14782 * @param first the first node being compared
15061 * @param second the second node being compared 14783 * @param second the second node being compared
15062 * @return `true` if the two AST nodes are equal 14784 * @return `true` if the two AST nodes are equal
15063 */ 14785 */
15064 static bool equals4(CompilationUnit first, CompilationUnit second) { 14786 static bool equals4(CompilationUnit first, CompilationUnit second) {
15065 ASTComparator comparator = new ASTComparator(); 14787 AstComparator comparator = new AstComparator();
15066 return comparator.isEqual(first, second); 14788 return comparator.isEqual(first, second);
15067 } 14789 }
15068 14790
15069 /** 14791 /**
15070 * The AST node with which the node being visited is to be compared. This is o nly valid at the 14792 * The AST node with which the node being visited is to be compared. This is o nly valid at the
15071 * beginning of each visit method (until [isEqual] is invoked). 14793 * beginning of each visit method (until [isEqual] is invoked).
15072 */ 14794 */
15073 ASTNode _other; 14795 AstNode _other;
15074 14796
15075 bool visitAdjacentStrings(AdjacentStrings node) { 14797 bool visitAdjacentStrings(AdjacentStrings node) {
15076 AdjacentStrings other = this._other as AdjacentStrings; 14798 AdjacentStrings other = this._other as AdjacentStrings;
15077 return isEqual5(node.strings, other.strings); 14799 return isEqual5(node.strings, other.strings);
15078 } 14800 }
15079 14801
15080 bool visitAnnotation(Annotation node) { 14802 bool visitAnnotation(Annotation node) {
15081 Annotation other = this._other as Annotation; 14803 Annotation other = this._other as Annotation;
15082 return isEqual6(node.atSign, other.atSign) && isEqual(node.name, other.name) && isEqual6(node.period, other.period) && isEqual(node.constructorName, other.c onstructorName) && isEqual(node.arguments, other.arguments); 14804 return isEqual6(node.atSign, other.atSign) && isEqual(node.name, other.name) && isEqual6(node.period, other.period) && isEqual(node.constructorName, other.c onstructorName) && isEqual(node.arguments, other.arguments);
15083 } 14805 }
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
15587 return isEqual6(node.withKeyword, other.withKeyword) && isEqual5(node.mixinT ypes, other.mixinTypes); 15309 return isEqual6(node.withKeyword, other.withKeyword) && isEqual5(node.mixinT ypes, other.mixinTypes);
15588 } 15310 }
15589 15311
15590 /** 15312 /**
15591 * Return `true` if the given AST nodes have the same structure. 15313 * Return `true` if the given AST nodes have the same structure.
15592 * 15314 *
15593 * @param first the first node being compared 15315 * @param first the first node being compared
15594 * @param second the second node being compared 15316 * @param second the second node being compared
15595 * @return `true` if the given AST nodes have the same structure 15317 * @return `true` if the given AST nodes have the same structure
15596 */ 15318 */
15597 bool isEqual(ASTNode first, ASTNode second) { 15319 bool isEqual(AstNode first, AstNode second) {
15598 if (first == null) { 15320 if (first == null) {
15599 return second == null; 15321 return second == null;
15600 } else if (second == null) { 15322 } else if (second == null) {
15601 return false; 15323 return false;
15602 } else if (first.runtimeType != second.runtimeType) { 15324 } else if (first.runtimeType != second.runtimeType) {
15603 return false; 15325 return false;
15604 } 15326 }
15605 _other = second; 15327 _other = second;
15606 return first.accept(this); 15328 return first.accept(this);
15607 } 15329 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
15666 for (int i = 0; i < length; i++) { 15388 for (int i = 0; i < length; i++) {
15667 if (isEqual6(first[i], second[i])) { 15389 if (isEqual6(first[i], second[i])) {
15668 return false; 15390 return false;
15669 } 15391 }
15670 } 15392 }
15671 return true; 15393 return true;
15672 } 15394 }
15673 } 15395 }
15674 15396
15675 /** 15397 /**
15676 * Instances of the class `IncrementalASTCloner` implement an object that will c lone any AST 15398 * Instances of the class `IncrementalAstCloner` implement an object that will c lone any AST
15677 * structure that it visits. The cloner will clone the structure, replacing the specified ASTNode 15399 * structure that it visits. The cloner will clone the structure, replacing the specified ASTNode
15678 * with a new ASTNode, mapping the old token stream to a new token stream, and p reserving resolution 15400 * with a new ASTNode, mapping the old token stream to a new token stream, and p reserving resolution
15679 * results. 15401 * results.
15680 */ 15402 */
15681 class IncrementalASTCloner implements ASTVisitor<ASTNode> { 15403 class IncrementalAstCloner implements AstVisitor<AstNode> {
15682 /** 15404 /**
15683 * The node to be replaced during the cloning process. 15405 * The node to be replaced during the cloning process.
15684 */ 15406 */
15685 ASTNode _oldNode; 15407 AstNode _oldNode;
15686 15408
15687 /** 15409 /**
15688 * The replacement node used during the cloning process. 15410 * The replacement node used during the cloning process.
15689 */ 15411 */
15690 ASTNode _newNode; 15412 AstNode _newNode;
15691 15413
15692 /** 15414 /**
15693 * A mapping of old tokens to new tokens used during the cloning process. 15415 * A mapping of old tokens to new tokens used during the cloning process.
15694 */ 15416 */
15695 TokenMap _tokenMap; 15417 TokenMap _tokenMap;
15696 15418
15697 /** 15419 /**
15698 * Construct a new instance that will replace `oldNode` with `newNode` in the process 15420 * Construct a new instance that will replace `oldNode` with `newNode` in the process
15699 * of cloning an existing AST structure. 15421 * of cloning an existing AST structure.
15700 * 15422 *
15701 * @param oldNode the node to be replaced 15423 * @param oldNode the node to be replaced
15702 * @param newNode the replacement node 15424 * @param newNode the replacement node
15703 * @param tokenMap a mapping of old tokens to new tokens (not `null`) 15425 * @param tokenMap a mapping of old tokens to new tokens (not `null`)
15704 */ 15426 */
15705 IncrementalASTCloner(ASTNode oldNode, ASTNode newNode, TokenMap tokenMap) { 15427 IncrementalAstCloner(AstNode oldNode, AstNode newNode, TokenMap tokenMap) {
15706 this._oldNode = oldNode; 15428 this._oldNode = oldNode;
15707 this._newNode = newNode; 15429 this._newNode = newNode;
15708 this._tokenMap = tokenMap; 15430 this._tokenMap = tokenMap;
15709 } 15431 }
15710 15432
15711 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri ngs(clone5(node.strings)); 15433 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri ngs(clone5(node.strings));
15712 15434
15713 Annotation visitAnnotation(Annotation node) { 15435 Annotation visitAnnotation(Annotation node) {
15714 Annotation copy = new Annotation(map(node.atSign), clone4(node.name), map(no de.period), clone4(node.constructorName), clone4(node.arguments)); 15436 Annotation copy = new Annotation(map(node.atSign), clone4(node.name), map(no de.period), clone4(node.constructorName), clone4(node.arguments));
15715 copy.element = node.element; 15437 copy.element = node.element;
15716 return copy; 15438 return copy;
15717 } 15439 }
15718 15440
15719 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node ) { 15441 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node ) {
15720 ArgumentDefinitionTest copy = new ArgumentDefinitionTest(map(node.question), clone4(node.identifier)); 15442 ArgumentDefinitionTest copy = new ArgumentDefinitionTest(map(node.question), clone4(node.identifier));
15721 copy.propagatedType = node.propagatedType; 15443 copy.propagatedType = node.propagatedType;
15722 copy.staticType = node.staticType; 15444 copy.staticType = node.staticType;
15723 return copy; 15445 return copy;
15724 } 15446 }
15725 15447
15726 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList(map(node .leftParenthesis), clone5(node.arguments), map(node.rightParenthesis)); 15448 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList(map(node .leftParenthesis), clone5(node.arguments), map(node.rightParenthesis));
15727 15449
15728 AsExpression visitAsExpression(AsExpression node) { 15450 AsExpression visitAsExpression(AsExpression node) {
15729 AsExpression copy = new AsExpression(clone4(node.expression), map(node.asOpe rator), clone4(node.type)); 15451 AsExpression copy = new AsExpression(clone4(node.expression), map(node.asOpe rator), clone4(node.type));
15730 copy.propagatedType = node.propagatedType; 15452 copy.propagatedType = node.propagatedType;
15731 copy.staticType = node.staticType; 15453 copy.staticType = node.staticType;
15732 return copy; 15454 return copy;
15733 } 15455 }
15734 15456
15735 ASTNode visitAssertStatement(AssertStatement node) => new AssertStatement(map( node.keyword), map(node.leftParenthesis), clone4(node.condition), map(node.right Parenthesis), map(node.semicolon)); 15457 AstNode visitAssertStatement(AssertStatement node) => new AssertStatement(map( node.keyword), map(node.leftParenthesis), clone4(node.condition), map(node.right Parenthesis), map(node.semicolon));
15736 15458
15737 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) { 15459 AssignmentExpression visitAssignmentExpression(AssignmentExpression node) {
15738 AssignmentExpression copy = new AssignmentExpression(clone4(node.leftHandSid e), map(node.operator), clone4(node.rightHandSide)); 15460 AssignmentExpression copy = new AssignmentExpression(clone4(node.leftHandSid e), map(node.operator), clone4(node.rightHandSide));
15739 copy.propagatedElement = node.propagatedElement; 15461 copy.propagatedElement = node.propagatedElement;
15740 copy.propagatedType = node.propagatedType; 15462 copy.propagatedType = node.propagatedType;
15741 copy.staticElement = node.staticElement; 15463 copy.staticElement = node.staticElement;
15742 copy.staticType = node.staticType; 15464 copy.staticType = node.staticType;
15743 return copy; 15465 return copy;
15744 } 15466 }
15745 15467
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
15981 return copy; 15703 return copy;
15982 } 15704 }
15983 15705
15984 NamedExpression visitNamedExpression(NamedExpression node) { 15706 NamedExpression visitNamedExpression(NamedExpression node) {
15985 NamedExpression copy = new NamedExpression(clone4(node.name), clone4(node.ex pression)); 15707 NamedExpression copy = new NamedExpression(clone4(node.name), clone4(node.ex pression));
15986 copy.propagatedType = node.propagatedType; 15708 copy.propagatedType = node.propagatedType;
15987 copy.staticType = node.staticType; 15709 copy.staticType = node.staticType;
15988 return copy; 15710 return copy;
15989 } 15711 }
15990 15712
15991 ASTNode visitNativeClause(NativeClause node) => new NativeClause(map(node.keyw ord), clone4(node.name)); 15713 AstNode visitNativeClause(NativeClause node) => new NativeClause(map(node.keyw ord), clone4(node.name));
15992 15714
15993 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => new Nat iveFunctionBody(map(node.nativeToken), clone4(node.stringLiteral), map(node.semi colon)); 15715 NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => new Nat iveFunctionBody(map(node.nativeToken), clone4(node.stringLiteral), map(node.semi colon));
15994 15716
15995 NullLiteral visitNullLiteral(NullLiteral node) { 15717 NullLiteral visitNullLiteral(NullLiteral node) {
15996 NullLiteral copy = new NullLiteral(map(node.literal)); 15718 NullLiteral copy = new NullLiteral(map(node.literal));
15997 copy.propagatedType = node.propagatedType; 15719 copy.propagatedType = node.propagatedType;
15998 copy.staticType = node.staticType; 15720 copy.staticType = node.staticType;
15999 return copy; 15721 return copy;
16000 } 15722 }
16001 15723
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
16115 copy.staticType = node.staticType; 15837 copy.staticType = node.staticType;
16116 return copy; 15838 return copy;
16117 } 15839 }
16118 15840
16119 SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase(clone5(node.labe ls), map(node.keyword), clone4(node.expression), map(node.colon), clone5(node.st atements)); 15841 SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase(clone5(node.labe ls), map(node.keyword), clone4(node.expression), map(node.colon), clone5(node.st atements));
16120 15842
16121 SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault(clon e5(node.labels), map(node.keyword), map(node.colon), clone5(node.statements)); 15843 SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault(clon e5(node.labels), map(node.keyword), map(node.colon), clone5(node.statements));
16122 15844
16123 SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatem ent(map(node.keyword), map(node.leftParenthesis), clone4(node.expression), map(n ode.rightParenthesis), map(node.leftBracket), clone5(node.members), map(node.rig htBracket)); 15845 SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatem ent(map(node.keyword), map(node.leftParenthesis), clone4(node.expression), map(n ode.rightParenthesis), map(node.leftBracket), clone5(node.members), map(node.rig htBracket));
16124 15846
16125 ASTNode visitSymbolLiteral(SymbolLiteral node) { 15847 AstNode visitSymbolLiteral(SymbolLiteral node) {
16126 SymbolLiteral copy = new SymbolLiteral(map(node.poundSign), map2(node.compon ents)); 15848 SymbolLiteral copy = new SymbolLiteral(map(node.poundSign), map2(node.compon ents));
16127 copy.propagatedType = node.propagatedType; 15849 copy.propagatedType = node.propagatedType;
16128 copy.staticType = node.staticType; 15850 copy.staticType = node.staticType;
16129 return copy; 15851 return copy;
16130 } 15852 }
16131 15853
16132 ThisExpression visitThisExpression(ThisExpression node) { 15854 ThisExpression visitThisExpression(ThisExpression node) {
16133 ThisExpression copy = new ThisExpression(map(node.keyword)); 15855 ThisExpression copy = new ThisExpression(map(node.keyword));
16134 copy.propagatedType = node.propagatedType; 15856 copy.propagatedType = node.propagatedType;
16135 copy.staticType = node.staticType; 15857 copy.staticType = node.staticType;
(...skipping 26 matching lines...) Expand all
16162 VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration(null, clone5(node.metadata), clone4(node.name), map(node.equ als), clone4(node.initializer)); 15884 VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration(null, clone5(node.metadata), clone4(node.name), map(node.equ als), clone4(node.initializer));
16163 15885
16164 VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList n ode) => new VariableDeclarationList(null, clone5(node.metadata), map(node.keywor d), clone4(node.type), clone5(node.variables)); 15886 VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList n ode) => new VariableDeclarationList(null, clone5(node.metadata), map(node.keywor d), clone4(node.type), clone5(node.variables));
16165 15887
16166 VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclara tionStatement node) => new VariableDeclarationStatement(clone4(node.variables), map(node.semicolon)); 15888 VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclara tionStatement node) => new VariableDeclarationStatement(clone4(node.variables), map(node.semicolon));
16167 15889
16168 WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement( map(node.keyword), map(node.leftParenthesis), clone4(node.condition), map(node.r ightParenthesis), clone4(node.body)); 15890 WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement( map(node.keyword), map(node.leftParenthesis), clone4(node.condition), map(node.r ightParenthesis), clone4(node.body));
16169 15891
16170 WithClause visitWithClause(WithClause node) => new WithClause(map(node.withKey word), clone5(node.mixinTypes)); 15892 WithClause visitWithClause(WithClause node) => new WithClause(map(node.withKey word), clone5(node.mixinTypes));
16171 15893
16172 ASTNode clone4(ASTNode node) { 15894 AstNode clone4(AstNode node) {
16173 if (node == null) { 15895 if (node == null) {
16174 return null; 15896 return null;
16175 } 15897 }
16176 if (identical(node, _oldNode)) { 15898 if (identical(node, _oldNode)) {
16177 return _newNode; 15899 return _newNode;
16178 } 15900 }
16179 return node.accept(this) as ASTNode; 15901 return node.accept(this) as AstNode;
16180 } 15902 }
16181 15903
16182 List clone5(NodeList nodes) { 15904 List clone5(NodeList nodes) {
16183 List clonedNodes = new List(); 15905 List clonedNodes = new List();
16184 for (ASTNode node in nodes) { 15906 for (AstNode node in nodes) {
16185 clonedNodes.add(clone4(node)); 15907 clonedNodes.add(clone4(node));
16186 } 15908 }
16187 return clonedNodes; 15909 return clonedNodes;
16188 } 15910 }
16189 15911
16190 Token map(Token oldToken) { 15912 Token map(Token oldToken) {
16191 if (oldToken == null) { 15913 if (oldToken == null) {
16192 return null; 15914 return null;
16193 } 15915 }
16194 return _tokenMap.get(oldToken); 15916 return _tokenMap.get(oldToken);
16195 } 15917 }
16196 15918
16197 List<Token> map2(List<Token> oldTokens) { 15919 List<Token> map2(List<Token> oldTokens) {
16198 List<Token> newTokens = new List<Token>(oldTokens.length); 15920 List<Token> newTokens = new List<Token>(oldTokens.length);
16199 for (int index = 0; index < newTokens.length; index++) { 15921 for (int index = 0; index < newTokens.length; index++) {
16200 newTokens[index] = map(oldTokens[index]); 15922 newTokens[index] = map(oldTokens[index]);
16201 } 15923 }
16202 return newTokens; 15924 return newTokens;
16203 } 15925 }
16204 } 15926 }
16205 15927
16206 /** 15928 /**
16207 * Traverse the AST from initial child node to successive parents, building a co llection of local 15929 * Traverse the AST from initial child node to successive parents, building a co llection of local
16208 * variable and parameter names visible to the initial child node. In case of na me shadowing, the 15930 * variable and parameter names visible to the initial child node. In case of na me shadowing, the
16209 * first name seen is the most specific one so names are not redefined. 15931 * first name seen is the most specific one so names are not redefined.
16210 * 15932 *
16211 * Completion test code coverage is 95%. The two basic blocks that are not execu ted cannot be 15933 * Completion test code coverage is 95%. The two basic blocks that are not execu ted cannot be
16212 * executed. They are included for future reference. 15934 * executed. They are included for future reference.
16213 *
16214 * @coverage com.google.dart.engine.services.completion
16215 */ 15935 */
16216 class ScopedNameFinder extends GeneralizingASTVisitor<Object> { 15936 class ScopedNameFinder extends GeneralizingAstVisitor<Object> {
16217 Declaration _declarationNode; 15937 Declaration _declarationNode;
16218 15938
16219 ASTNode _immediateChild; 15939 AstNode _immediateChild;
16220 15940
16221 Map<String, SimpleIdentifier> _locals = new Map<String, SimpleIdentifier>(); 15941 Map<String, SimpleIdentifier> _locals = new Map<String, SimpleIdentifier>();
16222 15942
16223 int _position = 0; 15943 int _position = 0;
16224 15944
16225 bool _referenceIsWithinLocalFunction = false; 15945 bool _referenceIsWithinLocalFunction = false;
16226 15946
16227 ScopedNameFinder(int position) { 15947 ScopedNameFinder(int position) {
16228 this._position = position; 15948 this._position = position;
16229 } 15949 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
16295 _declarationNode = node; 16015 _declarationNode = node;
16296 if (node.parameters == null) { 16016 if (node.parameters == null) {
16297 return null; 16017 return null;
16298 } 16018 }
16299 if (_immediateChild != node.parameters) { 16019 if (_immediateChild != node.parameters) {
16300 addParameters(node.parameters.parameters); 16020 addParameters(node.parameters.parameters);
16301 } 16021 }
16302 return null; 16022 return null;
16303 } 16023 }
16304 16024
16305 Object visitNode(ASTNode node) { 16025 Object visitNode(AstNode node) {
16306 _immediateChild = node; 16026 _immediateChild = node;
16307 ASTNode parent = node.parent; 16027 AstNode parent = node.parent;
16308 if (parent != null) { 16028 if (parent != null) {
16309 parent.accept(this); 16029 parent.accept(this);
16310 } 16030 }
16311 return null; 16031 return null;
16312 } 16032 }
16313 16033
16314 Object visitSwitchMember(SwitchMember node) { 16034 Object visitSwitchMember(SwitchMember node) {
16315 checkStatements(node.statements); 16035 checkStatements(node.statements);
16316 return super.visitSwitchMember(node); 16036 return super.visitSwitchMember(node);
16317 } 16037 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
16358 return; 16078 return;
16359 } 16079 }
16360 if (stmt is VariableDeclarationStatement) { 16080 if (stmt is VariableDeclarationStatement) {
16361 addVariables(stmt.variables.variables); 16081 addVariables(stmt.variables.variables);
16362 } else if (stmt is FunctionDeclarationStatement && !_referenceIsWithinLoca lFunction) { 16082 } else if (stmt is FunctionDeclarationStatement && !_referenceIsWithinLoca lFunction) {
16363 addToScope(stmt.functionDeclaration.name); 16083 addToScope(stmt.functionDeclaration.name);
16364 } 16084 }
16365 } 16085 }
16366 } 16086 }
16367 16087
16368 bool isInRange(ASTNode node) { 16088 bool isInRange(AstNode node) {
16369 if (_position < 0) { 16089 if (_position < 0) {
16370 // if source position is not set then all nodes are in range 16090 // if source position is not set then all nodes are in range
16371 return true; 16091 return true;
16372 } 16092 }
16373 return node.end < _position; 16093 return node.end < _position;
16374 } 16094 }
16375 } 16095 }
16376 /** 16096 /**
16377 * Instances of the class {@code NodeList} represent a list of AST nodes that ha ve a common parent. 16097 * Instances of the class {@code NodeList} represent a list of AST nodes that ha ve a common parent.
16378 */ 16098 */
16379 class NodeList<E extends ASTNode> extends Object with ListMixin<E> { 16099 class NodeList<E extends AstNode> extends Object with ListMixin<E> {
16380 /** 16100 /**
16381 * Create an empty list with the given owner. This is a convenience method tha t allows the 16101 * Create an empty list with the given owner. This is a convenience method tha t allows the
16382 * compiler to determine the correct value of the type argument [E] without ne eding to 16102 * compiler to determine the correct value of the type argument [E] without ne eding to
16383 * explicitly specify it. 16103 * explicitly specify it.
16384 * 16104 *
16385 * @param owner the node that is the parent of each of the elements in the lis t 16105 * @param owner the node that is the parent of each of the elements in the lis t
16386 * @return the list that was created 16106 * @return the list that was created
16387 */ 16107 */
16388 static NodeList create(ASTNode owner) => new NodeList(owner); 16108 static NodeList create(AstNode owner) => new NodeList(owner);
16389 16109
16390 /** 16110 /**
16391 * The node that is the parent of each of the elements in the list. 16111 * The node that is the parent of each of the elements in the list.
16392 */ 16112 */
16393 ASTNode owner; 16113 AstNode owner;
16394 16114
16395 /** 16115 /**
16396 * The elements contained in the list. 16116 * The elements contained in the list.
16397 */ 16117 */
16398 List<E> _elements = <E> []; 16118 List<E> _elements = <E> [];
16399 16119
16400 /** 16120 /**
16401 * Initialize a newly created list of nodes to be empty. 16121 * Initialize a newly created list of nodes to be empty.
16402 * 16122 *
16403 * @param owner the node that is the parent of each of the elements in the lis t 16123 * @param owner the node that is the parent of each of the elements in the lis t
16404 */ 16124 */
16405 NodeList(this.owner); 16125 NodeList(this.owner);
16406 16126
16407 /** 16127 /**
16408 * Use the given visitor to visit each of the nodes in this list. 16128 * Use the given visitor to visit each of the nodes in this list.
16409 * 16129 *
16410 * @param visitor the visitor to be used to visit the elements of this list 16130 * @param visitor the visitor to be used to visit the elements of this list
16411 */ 16131 */
16412 accept(ASTVisitor visitor) { 16132 accept(AstVisitor visitor) {
16413 var length = _elements.length; 16133 var length = _elements.length;
16414 for (var i = 0; i < length; i++) { 16134 for (var i = 0; i < length; i++) {
16415 _elements[i].accept(visitor); 16135 _elements[i].accept(visitor);
16416 } 16136 }
16417 } 16137 }
16418 void add(E node) { 16138 void add(E node) {
16419 insert(length, node); 16139 insert(length, node);
16420 } 16140 }
16421 void insert(int index, E node) { 16141 void insert(int index, E node) {
16422 int length = _elements.length; 16142 int length = _elements.length;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
16470 } 16190 }
16471 return _elements[_elements.length - 1].endToken; 16191 return _elements[_elements.length - 1].endToken;
16472 } 16192 }
16473 E removeAt(int index) { 16193 E removeAt(int index) {
16474 if (index < 0 || index >= _elements.length) { 16194 if (index < 0 || index >= _elements.length) {
16475 throw new RangeError("Index: ${index}, Size: ${_elements.length}"); 16195 throw new RangeError("Index: ${index}, Size: ${_elements.length}");
16476 } 16196 }
16477 E removedNode = _elements[index] as E; 16197 E removedNode = _elements[index] as E;
16478 int length = _elements.length; 16198 int length = _elements.length;
16479 if (length == 1) { 16199 if (length == 1) {
16480 _elements = ASTNode.EMPTY_ARRAY; 16200 _elements = AstNode.EMPTY_ARRAY;
16481 return removedNode; 16201 return removedNode;
16482 } 16202 }
16483 _elements.removeAt(index); 16203 _elements.removeAt(index);
16484 return removedNode; 16204 return removedNode;
16485 } 16205 }
16486 void operator[]=(int index, E node) { 16206 void operator[]=(int index, E node) {
16487 if (index < 0 || index >= _elements.length) { 16207 if (index < 0 || index >= _elements.length) {
16488 throw new RangeError("Index: ${index}, Size: ${_elements.length}"); 16208 throw new RangeError("Index: ${index}, Size: ${_elements.length}");
16489 } 16209 }
16490 owner.becomeParentOf(node); 16210 owner.becomeParentOf(node);
16491 _elements[index] = node; 16211 _elements[index] = node;
16492 } 16212 }
16493 int get length => _elements.length; 16213 int get length => _elements.length;
16494 void set length(int value) { 16214 void set length(int value) {
16495 throw new UnsupportedError("Cannot resize NodeList."); 16215 throw new UnsupportedError("Cannot resize NodeList.");
16496 } 16216 }
16497 } 16217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698