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

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

Issue 12502002: Update analyzer-experimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « no previous file | pkg/analyzer-experimental/lib/src/generated/element.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.ast; 4 library engine.ast;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'java_core.dart'; 7 import 'java_core.dart';
8 import 'java_engine.dart'; 8 import 'java_engine.dart';
9 import 'error.dart'; 9 import 'error.dart';
10 import 'source.dart' show LineInfo;
10 import 'scanner.dart'; 11 import 'scanner.dart';
11 import 'engine.dart' show AnalysisEngine; 12 import 'engine.dart' show AnalysisEngine;
12 import 'utilities_dart.dart'; 13 import 'utilities_dart.dart';
13 import 'element.dart' hide Annotation; 14 import 'element.dart' hide Annotation;
14 15
15 /** 16 /**
16 * The abstract class {@code ASTNode} defines the behavior common to all nodes i n the AST structure 17 * The abstract class {@code ASTNode} defines the behavior common to all nodes i n the AST structure
17 * for a Dart program. 18 * for a Dart program.
18 */ 19 */
19 abstract class ASTNode { 20 abstract class ASTNode {
20 /** 21 /**
21 * The parent of the node, or {@code null} if the node is the root of an AST s tructure. 22 * The parent of the node, or {@code null} if the node is the root of an AST s tructure.
22 */ 23 */
23 ASTNode _parent; 24 ASTNode _parent;
24 /** 25 /**
26 * A table mapping the names of properties to their values, or {@code null} if this node does not
27 * have any properties associated with it.
28 */
29 Map<String, Object> _propertyMap;
30 /**
25 * A comparator that can be used to sort AST nodes in lexical order. In other words,{@code compare} will return a negative value if the offset of the first no de is less than the 31 * A comparator that can be used to sort AST nodes in lexical order. In other words,{@code compare} will return a negative value if the offset of the first no de is less than the
26 * offset of the second node, zero (0) if the nodes have the same offset, and a positive value if 32 * offset of the second node, zero (0) if the nodes have the same offset, and a positive value if
27 * if the offset of the first node is greater than the offset of the second no de. 33 * if the offset of the first node is greater than the offset of the second no de.
28 */ 34 */
29 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) => second.offset - first.offset; 35 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) => second.offset - first.offset;
30 /** 36 /**
31 * Use the given visitor to visit this node. 37 * Use the given visitor to visit this node.
32 * @param visitor the visitor that will visit this node 38 * @param visitor the visitor that will visit this node
33 * @return the value returned by the visitor as a result of visiting this node 39 * @return the value returned by the visitor as a result of visiting this node
34 */ 40 */
35 accept(ASTVisitor visitor); 41 accept(ASTVisitor visitor);
36 /** 42 /**
37 * @return the {@link ASTNode} of given {@link Class} which is {@link ASTNode} itself, or one of 43 * @return the {@link ASTNode} of given {@link Class} which is {@link ASTNode} itself, or one of
38 * its parents. 44 * its parents.
39 */ 45 */
40 ASTNode getAncestor(Type enclosingClass) { 46 ASTNode getAncestor(Type enclosingClass) {
41 ASTNode node = this; 47 ASTNode node = this;
42 while (node != null && !isInstanceOf(node, enclosingClass)) { 48 while (node != null && !isInstanceOf(node, enclosingClass)) {
43 node = node.parent; 49 node = node.parent;
44 } 50 }
45 ; 51 ;
46 return (node as ASTNode); 52 return node as ASTNode;
47 } 53 }
48 /** 54 /**
49 * Return the first token included in this node's source range. 55 * Return the first token included in this node's source range.
50 * @return the first token included in this node's source range 56 * @return the first token included in this node's source range
51 */ 57 */
52 Token get beginToken; 58 Token get beginToken;
53 /** 59 /**
54 * Return the offset of the character immediately following the last character of this node's 60 * Return the offset of the character immediately following the last character of this node's
55 * source range. This is equivalent to {@code node.getOffset() + node.getLengt h()}. For a 61 * source range. This is equivalent to {@code node.getOffset() + node.getLengt h()}. For a
56 * compilation unit this will be equal to the length of the unit's source. For synthetic nodes 62 * compilation unit this will be equal to the length of the unit's source. For synthetic nodes
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 96 }
91 /** 97 /**
92 * Return this node's parent node, or {@code null} if this node is the root of an AST structure. 98 * Return this node's parent node, or {@code null} if this node is the root of an AST structure.
93 * <p> 99 * <p>
94 * Note that the relationship between an AST node and its parent node may chan ge over the lifetime 100 * Note that the relationship between an AST node and its parent node may chan ge over the lifetime
95 * of a node. 101 * of a node.
96 * @return the parent of this node, or {@code null} if none 102 * @return the parent of this node, or {@code null} if none
97 */ 103 */
98 ASTNode get parent => _parent; 104 ASTNode get parent => _parent;
99 /** 105 /**
106 * Return the value of the property with the given name, or {@code null} if th is node does not
107 * have a property with the given name.
108 * @return the value of the property with the given name
109 */
110 Object getProperty(String propertyName) {
111 if (_propertyMap == null) {
112 return null;
113 }
114 return _propertyMap[propertyName];
115 }
116 /**
100 * Return the node at the root of this node's AST structure. Note that this me thod's performance 117 * Return the node at the root of this node's AST structure. Note that this me thod's performance
101 * is linear with respect to the depth of the node in the AST structure (O(dep th)). 118 * is linear with respect to the depth of the node in the AST structure (O(dep th)).
102 * @return the node at the root of this node's AST structure 119 * @return the node at the root of this node's AST structure
103 */ 120 */
104 ASTNode get root { 121 ASTNode get root {
105 ASTNode root = this; 122 ASTNode root = this;
106 ASTNode parent2 = parent; 123 ASTNode parent2 = parent;
107 while (parent2 != null) { 124 while (parent2 != null) {
108 root = parent2; 125 root = parent2;
109 parent2 = root.parent; 126 parent2 = root.parent;
110 } 127 }
111 return root; 128 return root;
112 } 129 }
113 /** 130 /**
114 * Return {@code true} if this node is a synthetic node. A synthetic node is a node that was 131 * Return {@code true} if this node is a synthetic node. A synthetic node is a node that was
115 * introduced by the parser in order to recover from an error in the code. Syn thetic nodes always 132 * introduced by the parser in order to recover from an error in the code. Syn thetic nodes always
116 * have a length of zero ({@code 0}). 133 * have a length of zero ({@code 0}).
117 * @return {@code true} if this node is a synthetic node 134 * @return {@code true} if this node is a synthetic node
118 */ 135 */
119 bool isSynthetic() => false; 136 bool isSynthetic() => false;
120 /** 137 /**
138 * Set the value of the property with the given name to the given value. If th e value is{@code null}, the property will effectively be removed.
139 * @param propertyName the name of the property whose value is to be set
140 * @param propertyValue the new value of the property
141 */
142 void setProperty(String propertyName, Object propertyValue) {
143 if (propertyValue == null) {
144 if (_propertyMap != null) {
145 _propertyMap.remove(propertyName);
146 if (_propertyMap.isEmpty) {
147 _propertyMap = null;
148 }
149 }
150 } else {
151 if (_propertyMap == null) {
152 _propertyMap = new Map<String, Object>();
153 }
154 _propertyMap[propertyName] = propertyValue;
155 }
156 }
157 /**
121 * Return a textual description of this node in a form approximating valid sou rce. The returned 158 * Return a textual description of this node in a form approximating valid sou rce. The returned
122 * string will not be valid source primarily in the case where the node itself is not well-formed. 159 * string will not be valid source primarily in the case where the node itself is not well-formed.
123 * @return the source code equivalent of this node 160 * @return the source code equivalent of this node
124 */ 161 */
125 String toSource() { 162 String toSource() {
126 PrintStringWriter writer = new PrintStringWriter(); 163 PrintStringWriter writer = new PrintStringWriter();
127 accept(new ToSourceVisitor(writer)); 164 accept(new ToSourceVisitor(writer));
128 return writer.toString(); 165 return writer.toString();
129 } 166 }
130 String toString() => toSource(); 167 String toString() => toSource();
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 SimpleIdentifier get identifier => _identifier; 641 SimpleIdentifier get identifier => _identifier;
605 /** 642 /**
606 * Return the token representing the question mark. 643 * Return the token representing the question mark.
607 * @return the token representing the question mark 644 * @return the token representing the question mark
608 */ 645 */
609 Token get question => _question; 646 Token get question => _question;
610 /** 647 /**
611 * Set the identifier representing the argument being tested to the given iden tifier. 648 * Set the identifier representing the argument being tested to the given iden tifier.
612 * @param identifier the identifier representing the argument being tested 649 * @param identifier the identifier representing the argument being tested
613 */ 650 */
614 void set identifier(SimpleIdentifier identifier5) { 651 void set identifier(SimpleIdentifier identifier7) {
615 this._identifier = becomeParentOf(identifier5); 652 this._identifier = becomeParentOf(identifier7);
616 } 653 }
617 /** 654 /**
618 * Set the token representing the question mark to the given token. 655 * Set the token representing the question mark to the given token.
619 * @param question the token representing the question mark 656 * @param question the token representing the question mark
620 */ 657 */
621 void set question(Token question2) { 658 void set question(Token question2) {
622 this._question = question2; 659 this._question = question2;
623 } 660 }
624 void visitChildren(ASTVisitor<Object> visitor) { 661 void visitChildren(ASTVisitor<Object> visitor) {
625 safelyVisitChild(_identifier, visitor); 662 safelyVisitChild(_identifier, visitor);
(...skipping 16 matching lines...) Expand all
642 Token _leftParenthesis; 679 Token _leftParenthesis;
643 /** 680 /**
644 * The expressions producing the values of the arguments. 681 * The expressions producing the values of the arguments.
645 */ 682 */
646 NodeList<Expression> _arguments; 683 NodeList<Expression> _arguments;
647 /** 684 /**
648 * The right parenthesis. 685 * The right parenthesis.
649 */ 686 */
650 Token _rightParenthesis; 687 Token _rightParenthesis;
651 /** 688 /**
689 * An array containing the elements representing the parameters corresponding to each of the
690 * arguments in this list, or {@code null} if the AST has not been resolved or if the function or
691 * method being invoked could not be determined. The array must be the same le ngth as the number
692 * of arguments, but can contain {@code null} entries if a given argument does not correspond to a
693 * formal parameter.
694 */
695 List<ParameterElement> _correspondingParameters;
696 /**
652 * Initialize a newly created list of arguments. 697 * Initialize a newly created list of arguments.
653 * @param leftParenthesis the left parenthesis 698 * @param leftParenthesis the left parenthesis
654 * @param arguments the expressions producing the values of the arguments 699 * @param arguments the expressions producing the values of the arguments
655 * @param rightParenthesis the right parenthesis 700 * @param rightParenthesis the right parenthesis
656 */ 701 */
657 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig htParenthesis) { 702 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig htParenthesis) {
658 this._arguments = new NodeList<Expression>(this); 703 this._arguments = new NodeList<Expression>(this);
659 this._leftParenthesis = leftParenthesis; 704 this._leftParenthesis = leftParenthesis;
660 this._arguments.addAll(arguments); 705 this._arguments.addAll(arguments);
661 this._rightParenthesis = rightParenthesis; 706 this._rightParenthesis = rightParenthesis;
(...skipping 19 matching lines...) Expand all
681 * Return the left parenthesis. 726 * Return the left parenthesis.
682 * @return the left parenthesis 727 * @return the left parenthesis
683 */ 728 */
684 Token get leftParenthesis => _leftParenthesis; 729 Token get leftParenthesis => _leftParenthesis;
685 /** 730 /**
686 * Return the right parenthesis. 731 * Return the right parenthesis.
687 * @return the right parenthesis 732 * @return the right parenthesis
688 */ 733 */
689 Token get rightParenthesis => _rightParenthesis; 734 Token get rightParenthesis => _rightParenthesis;
690 /** 735 /**
736 * Set the parameter elements corresponding to each of the arguments in this l ist to the given
737 * array of parameters. The array of parameters must be the same length as the number of
738 * arguments, but can contain {@code null} entries if a given argument does no t correspond to a
739 * formal parameter.
740 * @param parameters the parameter elements corresponding to the arguments
741 */
742 void set correspondingParameters(List<ParameterElement> parameters) {
743 if (parameters.length != _arguments.length) {
744 throw new IllegalArgumentException("Expected ${_arguments.length} paramete rs, not ${parameters.length}");
745 }
746 _correspondingParameters = parameters;
747 }
748 /**
691 * Set the left parenthesis to the given token. 749 * Set the left parenthesis to the given token.
692 * @param parenthesis the left parenthesis 750 * @param parenthesis the left parenthesis
693 */ 751 */
694 void set leftParenthesis(Token parenthesis) { 752 void set leftParenthesis(Token parenthesis) {
695 _leftParenthesis = parenthesis; 753 _leftParenthesis = parenthesis;
696 } 754 }
697 /** 755 /**
698 * Set the right parenthesis to the given token. 756 * Set the right parenthesis to the given token.
699 * @param parenthesis the right parenthesis 757 * @param parenthesis the right parenthesis
700 */ 758 */
701 void set rightParenthesis(Token parenthesis) { 759 void set rightParenthesis(Token parenthesis) {
702 _rightParenthesis = parenthesis; 760 _rightParenthesis = parenthesis;
703 } 761 }
704 void visitChildren(ASTVisitor<Object> visitor) { 762 void visitChildren(ASTVisitor<Object> visitor) {
705 _arguments.accept(visitor); 763 _arguments.accept(visitor);
706 } 764 }
765 /**
766 * If the given expression is a child of this list, and the AST structure has been resolved, and
767 * the function being invoked is known, and the expression corresponds to one of the parameters of
768 * the function being invoked, then return the parameter element representing the parameter to
769 * which the value of the given expression will be bound. Otherwise, return {@ code null}.
770 * <p>
771 * This method is only intended to be used by {@link Expression#getParameterEl ement()}.
772 * @param expression the expression corresponding to the parameter to be retur ned
773 * @return the parameter element representing the parameter to which the value of the expression
774 * will be bound
775 */
776 ParameterElement getParameterElementFor(Expression expression) {
777 if (_correspondingParameters == null) {
778 return null;
779 }
780 int index = _arguments.indexOf(expression);
781 if (index < 0) {
782 return null;
783 }
784 return _correspondingParameters[index];
785 }
707 } 786 }
708 /** 787 /**
709 * Instances of the class {@code AsExpression} represent an 'as' expression. 788 * Instances of the class {@code AsExpression} represent an 'as' expression.
710 * <pre> 789 * <pre>
711 * asExpression ::={@link Expression expression} 'as' {@link TypeName type}</pre > 790 * asExpression ::={@link Expression expression} 'as' {@link TypeName type}</pre >
712 */ 791 */
713 class AsExpression extends Expression { 792 class AsExpression extends Expression {
714 /** 793 /**
715 * The expression used to compute the value being cast. 794 * The expression used to compute the value being cast.
716 */ 795 */
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 /** 1815 /**
1737 * Return the 'abstract' keyword, or {@code null} if the keyword was absent. 1816 * Return the 'abstract' keyword, or {@code null} if the keyword was absent.
1738 * @return the 'abstract' keyword 1817 * @return the 'abstract' keyword
1739 */ 1818 */
1740 Token get abstractKeyword => _abstractKeyword; 1819 Token get abstractKeyword => _abstractKeyword;
1741 /** 1820 /**
1742 * Return the token representing the 'class' keyword. 1821 * Return the token representing the 'class' keyword.
1743 * @return the token representing the 'class' keyword 1822 * @return the token representing the 'class' keyword
1744 */ 1823 */
1745 Token get classKeyword => _classKeyword; 1824 Token get classKeyword => _classKeyword;
1746 /**
1747 * @return the {@link ClassElement} associated with this identifier, or {@code null} if the AST
1748 * structure has not been resolved or if this identifier could not be resolved .
1749 */
1750 ClassElement get element => _name != null ? (_name.element as ClassElement) : null; 1825 ClassElement get element => _name != null ? (_name.element as ClassElement) : null;
1751 Token get endToken => _rightBracket; 1826 Token get endToken => _rightBracket;
1752 /** 1827 /**
1753 * Return the extends clause for this class, or {@code null} if the class does not extend any 1828 * Return the extends clause for this class, or {@code null} if the class does not extend any
1754 * other class. 1829 * other class.
1755 * @return the extends clause for this class 1830 * @return the extends clause for this class
1756 */ 1831 */
1757 ExtendsClause get extendsClause => _extendsClause; 1832 ExtendsClause get extendsClause => _extendsClause;
1758 /** 1833 /**
1759 * Return the implements clause for the class, or {@code null} if the class do es not implement any 1834 * Return the implements clause for the class, or {@code null} if the class do es not implement any
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 * @param semicolon the semicolon terminating the declaration 2041 * @param semicolon the semicolon terminating the declaration
1967 */ 2042 */
1968 ClassTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Sim pleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstra ctKeyword, TypeName superclass, WithClause withClause, ImplementsClause implemen tsClause, Token semicolon}) : this.full(comment, metadata, keyword, name, typePa rameters, equals, abstractKeyword, superclass, withClause, implementsClause, sem icolon); 2043 ClassTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Sim pleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstra ctKeyword, TypeName superclass, WithClause withClause, ImplementsClause implemen tsClause, Token semicolon}) : this.full(comment, metadata, keyword, name, typePa rameters, equals, abstractKeyword, superclass, withClause, implementsClause, sem icolon);
1969 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); 2044 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this);
1970 /** 2045 /**
1971 * Return the token for the 'abstract' keyword, or {@code null} if this is not defining an 2046 * Return the token for the 'abstract' keyword, or {@code null} if this is not defining an
1972 * abstract class. 2047 * abstract class.
1973 * @return the token for the 'abstract' keyword 2048 * @return the token for the 'abstract' keyword
1974 */ 2049 */
1975 Token get abstractKeyword => _abstractKeyword; 2050 Token get abstractKeyword => _abstractKeyword;
1976 /**
1977 * Return the {@link ClassElement} associated with this type alias, or {@code null} if the AST
1978 * structure has not been resolved.
1979 * @return the {@link ClassElement} associated with this type alias
1980 */
1981 ClassElement get element => _name != null ? (_name.element as ClassElement) : null; 2051 ClassElement get element => _name != null ? (_name.element as ClassElement) : null;
1982 /** 2052 /**
1983 * Return the token for the '=' separating the name from the definition. 2053 * Return the token for the '=' separating the name from the definition.
1984 * @return the token for the '=' separating the name from the definition 2054 * @return the token for the '=' separating the name from the definition
1985 */ 2055 */
1986 Token get equals => _equals; 2056 Token get equals => _equals;
1987 /** 2057 /**
1988 * Return the implements clause for this class, or {@code null} if there is no implements clause. 2058 * Return the implements clause for this class, or {@code null} if there is no implements clause.
1989 * @return the implements clause for this class 2059 * @return the implements clause for this class
1990 */ 2060 */
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 Identifier get identifier => _identifier; 2346 Identifier get identifier => _identifier;
2277 /** 2347 /**
2278 * Return the token representing the 'new' keyword, or {@code null} if there w as no 'new' keyword. 2348 * Return the token representing the 'new' keyword, or {@code null} if there w as no 'new' keyword.
2279 * @return the token representing the 'new' keyword 2349 * @return the token representing the 'new' keyword
2280 */ 2350 */
2281 Token get newKeyword => _newKeyword; 2351 Token get newKeyword => _newKeyword;
2282 /** 2352 /**
2283 * Set the identifier being referenced to the given identifier. 2353 * Set the identifier being referenced to the given identifier.
2284 * @param identifier the identifier being referenced 2354 * @param identifier the identifier being referenced
2285 */ 2355 */
2286 void set identifier(Identifier identifier18) { 2356 void set identifier(Identifier identifier23) {
2287 identifier18 = becomeParentOf(identifier18); 2357 identifier23 = becomeParentOf(identifier23);
2288 } 2358 }
2289 /** 2359 /**
2290 * Set the token representing the 'new' keyword to the given token. 2360 * Set the token representing the 'new' keyword to the given token.
2291 * @param newKeyword the token representing the 'new' keyword 2361 * @param newKeyword the token representing the 'new' keyword
2292 */ 2362 */
2293 void set newKeyword(Token newKeyword2) { 2363 void set newKeyword(Token newKeyword2) {
2294 this._newKeyword = newKeyword2; 2364 this._newKeyword = newKeyword2;
2295 } 2365 }
2296 void visitChildren(ASTVisitor<Object> visitor) { 2366 void visitChildren(ASTVisitor<Object> visitor) {
2297 safelyVisitChild(_identifier, visitor); 2367 safelyVisitChild(_identifier, visitor);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 */ 2472 */
2403 List<AnalysisError> get errors { 2473 List<AnalysisError> get errors {
2404 List<AnalysisError> parserErrors = parsingErrors; 2474 List<AnalysisError> parserErrors = parsingErrors;
2405 List<AnalysisError> resolverErrors = resolutionErrors; 2475 List<AnalysisError> resolverErrors = resolutionErrors;
2406 if (resolverErrors.length == 0) { 2476 if (resolverErrors.length == 0) {
2407 return parserErrors; 2477 return parserErrors;
2408 } else if (parserErrors.length == 0) { 2478 } else if (parserErrors.length == 0) {
2409 return resolverErrors; 2479 return resolverErrors;
2410 } else { 2480 } else {
2411 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt h + resolverErrors.length); 2481 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt h + resolverErrors.length);
2412 System.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); 2482 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length);
2413 System.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, resolv erErrors.length); 2483 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re solverErrors.length);
2414 return allErrors; 2484 return allErrors;
2415 } 2485 }
2416 } 2486 }
2417 int get length { 2487 int get length {
2418 Token endToken3 = endToken; 2488 Token endToken3 = endToken;
2419 if (endToken3 == null) { 2489 if (endToken3 == null) {
2420 return 0; 2490 return 0;
2421 } 2491 }
2422 return endToken3.offset + endToken3.length - beginToken.offset; 2492 return endToken3.offset + endToken3.length - beginToken.offset;
2423 } 2493 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 * initializerList ::= 2754 * initializerList ::=
2685 * ':' {@link ConstructorInitializer initializer} (',' {@link ConstructorInitial izer initializer}) 2755 * ':' {@link ConstructorInitializer initializer} (',' {@link ConstructorInitial izer initializer})
2686 * </pre> 2756 * </pre>
2687 */ 2757 */
2688 class ConstructorDeclaration extends ClassMember { 2758 class ConstructorDeclaration extends ClassMember {
2689 /** 2759 /**
2690 * The token for the 'external' keyword, or {@code null} if the constructor is not external. 2760 * The token for the 'external' keyword, or {@code null} if the constructor is not external.
2691 */ 2761 */
2692 Token _externalKeyword; 2762 Token _externalKeyword;
2693 /** 2763 /**
2694 * The token for the 'const' keyword. 2764 * The token for the 'const' keyword, or {@code null} if the constructor is no t a const
2765 * constructor.
2695 */ 2766 */
2696 Token _constKeyword; 2767 Token _constKeyword;
2697 /** 2768 /**
2698 * The token for the 'factory' keyword. 2769 * The token for the 'factory' keyword, or {@code null} if the constructor is not a factory
2770 * constructor.
2699 */ 2771 */
2700 Token _factoryKeyword; 2772 Token _factoryKeyword;
2701 /** 2773 /**
2702 * The type of object being created. This can be different than the type in wh ich the constructor 2774 * The type of object being created. This can be different than the type in wh ich the constructor
2703 * is being declared if the constructor is the implementation of a factory con structor. 2775 * is being declared if the constructor is the implementation of a factory con structor.
2704 */ 2776 */
2705 Identifier _returnType; 2777 Identifier _returnType;
2706 /** 2778 /**
2707 * The token for the period before the constructor name, or {@code null} if th e constructor being 2779 * The token for the period before the constructor name, or {@code null} if th e constructor being
2708 * declared is unnamed. 2780 * declared is unnamed.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 /** 2864 /**
2793 * Return the body of the constructor, or {@code null} if the constructor does not have a body. 2865 * Return the body of the constructor, or {@code null} if the constructor does not have a body.
2794 * @return the body of the constructor 2866 * @return the body of the constructor
2795 */ 2867 */
2796 FunctionBody get body => _body; 2868 FunctionBody get body => _body;
2797 /** 2869 /**
2798 * Return the token for the 'const' keyword. 2870 * Return the token for the 'const' keyword.
2799 * @return the token for the 'const' keyword 2871 * @return the token for the 'const' keyword
2800 */ 2872 */
2801 Token get constKeyword => _constKeyword; 2873 Token get constKeyword => _constKeyword;
2802 /**
2803 * Return the element associated with this constructor , or {@code null} if th e AST structure has
2804 * not been resolved or if this constructor could not be resolved.
2805 * @return the element associated with this constructor
2806 */
2807 ConstructorElement get element => _element; 2874 ConstructorElement get element => _element;
2808 Token get endToken { 2875 Token get endToken {
2809 if (_body != null) { 2876 if (_body != null) {
2810 return _body.endToken; 2877 return _body.endToken;
2811 } else if (!_initializers.isEmpty) { 2878 } else if (!_initializers.isEmpty) {
2812 return _initializers.endToken; 2879 return _initializers.endToken;
2813 } 2880 }
2814 return _parameters.endToken; 2881 return _parameters.endToken;
2815 } 2882 }
2816 /** 2883 /**
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2941 */ 3008 */
2942 void set separator(Token separator2) { 3009 void set separator(Token separator2) {
2943 this._separator = separator2; 3010 this._separator = separator2;
2944 } 3011 }
2945 void visitChildren(ASTVisitor<Object> visitor) { 3012 void visitChildren(ASTVisitor<Object> visitor) {
2946 super.visitChildren(visitor); 3013 super.visitChildren(visitor);
2947 safelyVisitChild(_returnType, visitor); 3014 safelyVisitChild(_returnType, visitor);
2948 safelyVisitChild(_name, visitor); 3015 safelyVisitChild(_name, visitor);
2949 safelyVisitChild(_parameters, visitor); 3016 safelyVisitChild(_parameters, visitor);
2950 _initializers.accept(visitor); 3017 _initializers.accept(visitor);
3018 safelyVisitChild(_redirectedConstructor, visitor);
2951 safelyVisitChild(_body, visitor); 3019 safelyVisitChild(_body, visitor);
2952 } 3020 }
2953 Token get firstTokenAfterCommentAndMetadata { 3021 Token get firstTokenAfterCommentAndMetadata {
2954 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword ]); 3022 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword ]);
2955 if (leftMost2 != null) { 3023 if (leftMost2 != null) {
2956 return leftMost2; 3024 return leftMost2;
2957 } 3025 }
2958 return _returnType.beginToken; 3026 return _returnType.beginToken;
2959 } 3027 }
2960 /** 3028 /**
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
3313 * @param metadata the annotations associated with this declaration 3381 * @param metadata the annotations associated with this declaration
3314 */ 3382 */
3315 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm ent, metadata) { 3383 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm ent, metadata) {
3316 } 3384 }
3317 /** 3385 /**
3318 * Initialize a newly created declaration. 3386 * Initialize a newly created declaration.
3319 * @param comment the documentation comment associated with this declaration 3387 * @param comment the documentation comment associated with this declaration
3320 * @param metadata the annotations associated with this declaration 3388 * @param metadata the annotations associated with this declaration
3321 */ 3389 */
3322 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment, metadata); 3390 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment, metadata);
3391 /**
3392 * Return the element associated with this declaration, or {@code null} if eit her this node
3393 * corresponds to a list of declarations or if the AST structure has not been resolved.
3394 * @return the element associated with this declaration
3395 */
3396 Element get element;
3323 } 3397 }
3324 /** 3398 /**
3325 * Instances of the class {@code DefaultFormalParameter} represent a formal para meter with a default 3399 * Instances of the class {@code DefaultFormalParameter} represent a formal para meter with a default
3326 * value. There are two kinds of parameters that are both represented by this cl ass: named formal 3400 * value. There are two kinds of parameters that are both represented by this cl ass: named formal
3327 * parameters and positional formal parameters. 3401 * parameters and positional formal parameters.
3328 * <pre> 3402 * <pre>
3329 * defaultFormalParameter ::={@link NormalFormalParameter normalFormalParameter} ('=' {@link Expression defaultValue})? 3403 * defaultFormalParameter ::={@link NormalFormalParameter normalFormalParameter} ('=' {@link Expression defaultValue})?
3330 * defaultNamedParameter ::={@link NormalFormalParameter normalFormalParameter} (':' {@link Expression defaultValue})? 3404 * defaultNamedParameter ::={@link NormalFormalParameter normalFormalParameter} (':' {@link Expression defaultValue})?
3331 * </pre> 3405 * </pre>
3332 */ 3406 */
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3788 * Set the semicolon terminating the statement to the given token. 3862 * Set the semicolon terminating the statement to the given token.
3789 * @param semicolon the semicolon terminating the statement 3863 * @param semicolon the semicolon terminating the statement
3790 */ 3864 */
3791 void set semicolon(Token semicolon7) { 3865 void set semicolon(Token semicolon7) {
3792 this._semicolon = semicolon7; 3866 this._semicolon = semicolon7;
3793 } 3867 }
3794 void visitChildren(ASTVisitor<Object> visitor) { 3868 void visitChildren(ASTVisitor<Object> visitor) {
3795 } 3869 }
3796 } 3870 }
3797 /** 3871 /**
3872 * Ephemeral identifiers are created as needed to mimic the presence of an empty identifier.
3873 */
3874 class EphemeralIdentifier extends SimpleIdentifier {
3875 EphemeralIdentifier.full(ASTNode parent, int location) : super.full(new Token( TokenType.IDENTIFIER, location)) {
3876 parent.becomeParentOf(this);
3877 }
3878 EphemeralIdentifier({ASTNode parent, int location}) : this.full(parent, locati on);
3879 }
3880 /**
3798 * Instances of the class {@code ExportDirective} represent an export directive. 3881 * Instances of the class {@code ExportDirective} represent an export directive.
3799 * <pre> 3882 * <pre>
3800 * exportDirective ::={@link Annotation metadata} 'export' {@link StringLiteral libraryUri} {@link Combinator combinator}* ';' 3883 * exportDirective ::={@link Annotation metadata} 'export' {@link StringLiteral libraryUri} {@link Combinator combinator}* ';'
3801 * </pre> 3884 * </pre>
3802 */ 3885 */
3803 class ExportDirective extends NamespaceDirective { 3886 class ExportDirective extends NamespaceDirective {
3804 /** 3887 /**
3805 * Initialize a newly created export directive. 3888 * Initialize a newly created export directive.
3806 * @param comment the documentation comment associated with this directive 3889 * @param comment the documentation comment associated with this directive
3807 * @param metadata the annotations associated with the directive 3890 * @param metadata the annotations associated with the directive
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3839 /** 3922 /**
3840 * The static type of this expression, or {@code null} if the AST structure ha s not been resolved. 3923 * The static type of this expression, or {@code null} if the AST structure ha s not been resolved.
3841 */ 3924 */
3842 Type2 _staticType; 3925 Type2 _staticType;
3843 /** 3926 /**
3844 * The propagated type of this expression, or {@code null} if type propagation has not been 3927 * The propagated type of this expression, or {@code null} if type propagation has not been
3845 * performed on the AST structure. 3928 * performed on the AST structure.
3846 */ 3929 */
3847 Type2 _propagatedType; 3930 Type2 _propagatedType;
3848 /** 3931 /**
3932 * If this expression is an argument to an invocation, and the AST structure h as been resolved,
3933 * and the function being invoked is known, and this expression corresponds to one of the
3934 * parameters of the function being invoked, then return the parameter element representing the
3935 * parameter to which the value of this expression will be bound. Otherwise, r eturn {@code null}.
3936 * @return the parameter element representing the parameter to which the value of this expression
3937 * will be bound
3938 */
3939 ParameterElement get parameterElement {
3940 ASTNode parent3 = parent;
3941 if (parent3 is ArgumentList) {
3942 return ((parent3 as ArgumentList)).getParameterElementFor(this);
3943 }
3944 return null;
3945 }
3946 /**
3849 * Return the propagated type of this expression, or {@code null} if type prop agation has not been 3947 * Return the propagated type of this expression, or {@code null} if type prop agation has not been
3850 * performed on the AST structure. 3948 * performed on the AST structure.
3851 * @return the propagated type of this expression 3949 * @return the propagated type of this expression
3852 */ 3950 */
3853 Type2 get propagatedType => _propagatedType; 3951 Type2 get propagatedType => _propagatedType;
3854 /** 3952 /**
3855 * Return the static type of this expression, or {@code null} if the AST struc ture has not been 3953 * Return the static type of this expression, or {@code null} if the AST struc ture has not been
3856 * resolved. 3954 * resolved.
3857 * @return the static type of this expression 3955 * @return the static type of this expression
3858 */ 3956 */
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 /** 4232 /**
4135 * Initialize a newly created field declaration. 4233 * Initialize a newly created field declaration.
4136 * @param comment the documentation comment associated with this field 4234 * @param comment the documentation comment associated with this field
4137 * @param metadata the annotations associated with this field 4235 * @param metadata the annotations associated with this field
4138 * @param keyword the token representing the 'static' keyword 4236 * @param keyword the token representing the 'static' keyword
4139 * @param fieldList the fields being declared 4237 * @param fieldList the fields being declared
4140 * @param semicolon the semicolon terminating the declaration 4238 * @param semicolon the semicolon terminating the declaration
4141 */ 4239 */
4142 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat a, keyword, fieldList, semicolon); 4240 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat a, keyword, fieldList, semicolon);
4143 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); 4241 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this);
4242 Element get element => null;
4144 Token get endToken => _semicolon; 4243 Token get endToken => _semicolon;
4145 /** 4244 /**
4146 * Return the fields being declared. 4245 * Return the fields being declared.
4147 * @return the fields being declared 4246 * @return the fields being declared
4148 */ 4247 */
4149 VariableDeclarationList get fields => _fieldList; 4248 VariableDeclarationList get fields => _fieldList;
4150 /** 4249 /**
4151 * Return the token representing the 'static' keyword, or {@code null} if the fields are not 4250 * Return the token representing the 'static' keyword, or {@code null} if the fields are not
4152 * static. 4251 * static.
4153 * @return the token representing the 'static' keyword 4252 * @return the token representing the 'static' keyword
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 * <pre> 4788 * <pre>
4690 * formalParameter ::={@link NormalFormalParameter normalFormalParameter}| {@lin k DefaultFormalParameter namedFormalParameter}| {@link DefaultFormalParameter op tionalFormalParameter}</pre> 4789 * formalParameter ::={@link NormalFormalParameter normalFormalParameter}| {@lin k DefaultFormalParameter namedFormalParameter}| {@link DefaultFormalParameter op tionalFormalParameter}</pre>
4691 */ 4790 */
4692 abstract class FormalParameter extends ASTNode { 4791 abstract class FormalParameter extends ASTNode {
4693 /** 4792 /**
4694 * Return the element representing this parameter, or {@code null} if this par ameter has not been 4793 * Return the element representing this parameter, or {@code null} if this par ameter has not been
4695 * resolved. 4794 * resolved.
4696 * @return the element representing this parameter 4795 * @return the element representing this parameter
4697 */ 4796 */
4698 ParameterElement get element { 4797 ParameterElement get element {
4699 SimpleIdentifier identifier9 = identifier; 4798 SimpleIdentifier identifier11 = identifier;
4700 if (identifier9 == null) { 4799 if (identifier11 == null) {
4701 return null; 4800 return null;
4702 } 4801 }
4703 return (identifier9.element as ParameterElement); 4802 return identifier11.element as ParameterElement;
4704 } 4803 }
4705 /** 4804 /**
4706 * Return the name of the parameter being declared. 4805 * Return the name of the parameter being declared.
4707 * @return the name of the parameter being declared 4806 * @return the name of the parameter being declared
4708 */ 4807 */
4709 SimpleIdentifier get identifier; 4808 SimpleIdentifier get identifier;
4710 /** 4809 /**
4711 * Return the kind of this parameter. 4810 * Return the kind of this parameter.
4712 * @return the kind of this parameter 4811 * @return the kind of this parameter
4713 */ 4812 */
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
4922 * @param comment the documentation comment associated with this function 5021 * @param comment the documentation comment associated with this function
4923 * @param metadata the annotations associated with this function 5022 * @param metadata the annotations associated with this function
4924 * @param externalKeyword the token representing the 'external' keyword 5023 * @param externalKeyword the token representing the 'external' keyword
4925 * @param returnType the return type of the function 5024 * @param returnType the return type of the function
4926 * @param propertyKeyword the token representing the 'get' or 'set' keyword 5025 * @param propertyKeyword the token representing the 'get' or 'set' keyword
4927 * @param name the name of the function 5026 * @param name the name of the function
4928 * @param functionExpression the function expression being wrapped 5027 * @param functionExpression the function expression being wrapped
4929 */ 5028 */
4930 FunctionDeclaration({Comment comment, List<Annotation> metadata, Token externa lKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name, Fun ctionExpression functionExpression}) : this.full(comment, metadata, externalKeyw ord, returnType, propertyKeyword, name, functionExpression); 5029 FunctionDeclaration({Comment comment, List<Annotation> metadata, Token externa lKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name, Fun ctionExpression functionExpression}) : this.full(comment, metadata, externalKeyw ord, returnType, propertyKeyword, name, functionExpression);
4931 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); 5030 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this);
4932 /** 5031 ExecutableElement get element => _name != null ? (_name.element as ExecutableE lement) : null;
4933 * Return the {@link FunctionElement} associated with this function, or {@code null} if the AST
4934 * structure has not been resolved.
4935 * @return the {@link FunctionElement} associated with this function
4936 */
4937 FunctionElement get element => _name != null ? (_name.element as FunctionEleme nt) : null;
4938 Token get endToken => _functionExpression.endToken; 5032 Token get endToken => _functionExpression.endToken;
4939 /** 5033 /**
4940 * Return the token representing the 'external' keyword, or {@code null} if th is is not an 5034 * Return the token representing the 'external' keyword, or {@code null} if th is is not an
4941 * external function. 5035 * external function.
4942 * @return the token representing the 'external' keyword 5036 * @return the token representing the 'external' keyword
4943 */ 5037 */
4944 Token get externalKeyword => _externalKeyword; 5038 Token get externalKeyword => _externalKeyword;
4945 /** 5039 /**
4946 * Return the function expression being wrapped. 5040 * Return the function expression being wrapped.
4947 * @return the function expression being wrapped 5041 * @return the function expression being wrapped
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
5282 * @param metadata the annotations associated with this type alias 5376 * @param metadata the annotations associated with this type alias
5283 * @param keyword the token representing the 'typedef' keyword 5377 * @param keyword the token representing the 'typedef' keyword
5284 * @param returnType the name of the return type of the function type being de fined 5378 * @param returnType the name of the return type of the function type being de fined
5285 * @param name the name of the type being declared 5379 * @param name the name of the type being declared
5286 * @param typeParameters the type parameters for the type 5380 * @param typeParameters the type parameters for the type
5287 * @param parameters the parameters associated with the function 5381 * @param parameters the parameters associated with the function
5288 * @param semicolon the semicolon terminating the declaration 5382 * @param semicolon the semicolon terminating the declaration
5289 */ 5383 */
5290 FunctionTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, Fo rmalParameterList parameters, Token semicolon}) : this.full(comment, metadata, k eyword, returnType, name, typeParameters, parameters, semicolon); 5384 FunctionTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, Fo rmalParameterList parameters, Token semicolon}) : this.full(comment, metadata, k eyword, returnType, name, typeParameters, parameters, semicolon);
5291 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); 5385 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this);
5292 /**
5293 * Return the {@link TypeAliasElement} associated with this type alias, or {@c ode null} if the AST
5294 * structure has not been resolved.
5295 * @return the {@link TypeAliasElement} associated with this type alias
5296 */
5297 TypeAliasElement get element => _name != null ? (_name.element as TypeAliasEle ment) : null; 5386 TypeAliasElement get element => _name != null ? (_name.element as TypeAliasEle ment) : null;
5298 /** 5387 /**
5299 * Return the name of the function type being declared. 5388 * Return the name of the function type being declared.
5300 * @return the name of the function type being declared 5389 * @return the name of the function type being declared
5301 */ 5390 */
5302 SimpleIdentifier get name => _name; 5391 SimpleIdentifier get name => _name;
5303 /** 5392 /**
5304 * Return the parameters associated with the function type. 5393 * Return the parameters associated with the function type.
5305 * @return the parameters associated with the function type 5394 * @return the parameters associated with the function type
5306 */ 5395 */
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5480 */ 5569 */
5481 abstract class Identifier extends Expression { 5570 abstract class Identifier extends Expression {
5482 /** 5571 /**
5483 * Return {@code true} if the given name is visible only within the library in which it is 5572 * Return {@code true} if the given name is visible only within the library in which it is
5484 * declared. 5573 * declared.
5485 * @param name the name being tested 5574 * @param name the name being tested
5486 * @return {@code true} if the given name is private 5575 * @return {@code true} if the given name is private
5487 */ 5576 */
5488 static bool isPrivateName(String name) => name.startsWith("_"); 5577 static bool isPrivateName(String name) => name.startsWith("_");
5489 /** 5578 /**
5490 * The element associated with this identifier, or {@code null} if the AST str ucture has not been
5491 * resolved or if this identifier could not be resolved.
5492 */
5493 Element _element;
5494 /**
5495 * Return the element associated with this identifier, or {@code null} if the AST structure has 5579 * Return the element associated with this identifier, or {@code null} if the AST structure has
5496 * not been resolved or if this identifier could not be resolved. One example of the latter case 5580 * not been resolved or if this identifier could not be resolved. One example of the latter case
5497 * is an identifier that is not defined within the scope in which it appears. 5581 * is an identifier that is not defined within the scope in which it appears.
5498 * @return the element associated with this identifier 5582 * @return the element associated with this identifier
5499 */ 5583 */
5500 Element get element => _element; 5584 Element get element;
5501 /** 5585 /**
5502 * Return the lexical representation of the identifier. 5586 * Return the lexical representation of the identifier.
5503 * @return the lexical representation of the identifier 5587 * @return the lexical representation of the identifier
5504 */ 5588 */
5505 String get name; 5589 String get name;
5506 bool isAssignable() => true; 5590 bool isAssignable() => true;
5507 /**
5508 * Set the element associated with this identifier to the given element.
5509 * @param element the element associated with this identifier
5510 */
5511 void set element(Element element11) {
5512 this._element = element11;
5513 }
5514 } 5591 }
5515 /** 5592 /**
5516 * Instances of the class {@code IfStatement} represent an if statement. 5593 * Instances of the class {@code IfStatement} represent an if statement.
5517 * <pre> 5594 * <pre>
5518 * ifStatement ::= 5595 * ifStatement ::=
5519 * 'if' '(' {@link Expression expression} ')' {@link Statement thenStatement} (' else' {@link Statement elseStatement})? 5596 * 'if' '(' {@link Expression expression} ')' {@link Statement thenStatement} (' else' {@link Statement elseStatement})?
5520 * </pre> 5597 * </pre>
5521 */ 5598 */
5522 class IfStatement extends Statement { 5599 class IfStatement extends Statement {
5523 /** 5600 /**
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
5848 */ 5925 */
5849 MethodElement _element; 5926 MethodElement _element;
5850 /** 5927 /**
5851 * Initialize a newly created index expression. 5928 * Initialize a newly created index expression.
5852 * @param target the expression used to compute the object being indexed 5929 * @param target the expression used to compute the object being indexed
5853 * @param leftBracket the left square bracket 5930 * @param leftBracket the left square bracket
5854 * @param index the expression used to compute the index 5931 * @param index the expression used to compute the index
5855 * @param rightBracket the right square bracket 5932 * @param rightBracket the right square bracket
5856 */ 5933 */
5857 IndexExpression.forTarget_full(Expression target3, Token leftBracket4, Express ion index2, Token rightBracket4) { 5934 IndexExpression.forTarget_full(Expression target3, Token leftBracket4, Express ion index2, Token rightBracket4) {
5858 _jtd_constructor_56_impl(target3, leftBracket4, index2, rightBracket4); 5935 _jtd_constructor_57_impl(target3, leftBracket4, index2, rightBracket4);
5859 } 5936 }
5860 /** 5937 /**
5861 * Initialize a newly created index expression. 5938 * Initialize a newly created index expression.
5862 * @param target the expression used to compute the object being indexed 5939 * @param target the expression used to compute the object being indexed
5863 * @param leftBracket the left square bracket 5940 * @param leftBracket the left square bracket
5864 * @param index the expression used to compute the index 5941 * @param index the expression used to compute the index
5865 * @param rightBracket the right square bracket 5942 * @param rightBracket the right square bracket
5866 */ 5943 */
5867 IndexExpression.forTarget({Expression target3, Token leftBracket4, Expression index2, Token rightBracket4}) : this.forTarget_full(target3, leftBracket4, index 2, rightBracket4); 5944 IndexExpression.forTarget({Expression target3, Token leftBracket4, Expression index2, Token rightBracket4}) : this.forTarget_full(target3, leftBracket4, index 2, rightBracket4);
5868 _jtd_constructor_56_impl(Expression target3, Token leftBracket4, Expression in dex2, Token rightBracket4) { 5945 _jtd_constructor_57_impl(Expression target3, Token leftBracket4, Expression in dex2, Token rightBracket4) {
5869 this._target = becomeParentOf(target3); 5946 this._target = becomeParentOf(target3);
5870 this._leftBracket = leftBracket4; 5947 this._leftBracket = leftBracket4;
5871 this._index = becomeParentOf(index2); 5948 this._index = becomeParentOf(index2);
5872 this._rightBracket = rightBracket4; 5949 this._rightBracket = rightBracket4;
5873 } 5950 }
5874 /** 5951 /**
5875 * Initialize a newly created index expression. 5952 * Initialize a newly created index expression.
5876 * @param period the period ("..") before a cascaded index expression 5953 * @param period the period ("..") before a cascaded index expression
5877 * @param leftBracket the left square bracket 5954 * @param leftBracket the left square bracket
5878 * @param index the expression used to compute the index 5955 * @param index the expression used to compute the index
5879 * @param rightBracket the right square bracket 5956 * @param rightBracket the right square bracket
5880 */ 5957 */
5881 IndexExpression.forCascade_full(Token period7, Token leftBracket5, Expression index3, Token rightBracket5) { 5958 IndexExpression.forCascade_full(Token period7, Token leftBracket5, Expression index3, Token rightBracket5) {
5882 _jtd_constructor_57_impl(period7, leftBracket5, index3, rightBracket5); 5959 _jtd_constructor_58_impl(period7, leftBracket5, index3, rightBracket5);
5883 } 5960 }
5884 /** 5961 /**
5885 * Initialize a newly created index expression. 5962 * Initialize a newly created index expression.
5886 * @param period the period ("..") before a cascaded index expression 5963 * @param period the period ("..") before a cascaded index expression
5887 * @param leftBracket the left square bracket 5964 * @param leftBracket the left square bracket
5888 * @param index the expression used to compute the index 5965 * @param index the expression used to compute the index
5889 * @param rightBracket the right square bracket 5966 * @param rightBracket the right square bracket
5890 */ 5967 */
5891 IndexExpression.forCascade({Token period7, Token leftBracket5, Expression inde x3, Token rightBracket5}) : this.forCascade_full(period7, leftBracket5, index3, rightBracket5); 5968 IndexExpression.forCascade({Token period7, Token leftBracket5, Expression inde x3, Token rightBracket5}) : this.forCascade_full(period7, leftBracket5, index3, rightBracket5);
5892 _jtd_constructor_57_impl(Token period7, Token leftBracket5, Expression index3, Token rightBracket5) { 5969 _jtd_constructor_58_impl(Token period7, Token leftBracket5, Expression index3, Token rightBracket5) {
5893 this._period = period7; 5970 this._period = period7;
5894 this._leftBracket = leftBracket5; 5971 this._leftBracket = leftBracket5;
5895 this._index = becomeParentOf(index3); 5972 this._index = becomeParentOf(index3);
5896 this._rightBracket = rightBracket5; 5973 this._rightBracket = rightBracket5;
5897 } 5974 }
5898 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); 5975 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this);
5899 /** 5976 /**
5900 * Return the expression used to compute the object being indexed, or {@code n ull} if this index 5977 * Return the expression used to compute the object being indexed, or {@code n ull} if this index
5901 * expression is part of a cascade expression. 5978 * expression is part of a cascade expression.
5902 * @return the expression used to compute the object being indexed 5979 * @return the expression used to compute the object being indexed
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5960 */ 6037 */
5961 Token get rightBracket => _rightBracket; 6038 Token get rightBracket => _rightBracket;
5962 /** 6039 /**
5963 * Return {@code true} if this expression is computing a right-hand value. 6040 * Return {@code true} if this expression is computing a right-hand value.
5964 * <p> 6041 * <p>
5965 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are 6042 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are
5966 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node. 6043 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node.
5967 * @return {@code true} if this expression is in a context where the operator '[]' will be invoked 6044 * @return {@code true} if this expression is in a context where the operator '[]' will be invoked
5968 */ 6045 */
5969 bool inGetterContext() { 6046 bool inGetterContext() {
5970 ASTNode parent3 = parent; 6047 ASTNode parent4 = parent;
5971 if (parent3 is AssignmentExpression) { 6048 if (parent4 is AssignmentExpression) {
5972 AssignmentExpression assignment = (parent3 as AssignmentExpression); 6049 AssignmentExpression assignment = parent4 as AssignmentExpression;
5973 if (identical(assignment.leftHandSide, this) && identical(assignment.opera tor.type, TokenType.EQ)) { 6050 if (identical(assignment.leftHandSide, this) && identical(assignment.opera tor.type, TokenType.EQ)) {
5974 return false; 6051 return false;
5975 } 6052 }
5976 } 6053 }
5977 return true; 6054 return true;
5978 } 6055 }
5979 /** 6056 /**
5980 * Return {@code true} if this expression is computing a left-hand value. 6057 * Return {@code true} if this expression is computing a left-hand value.
5981 * <p> 6058 * <p>
5982 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are 6059 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are
5983 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node. 6060 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node.
5984 * @return {@code true} if this expression is in a context where the operator '[]=' will be 6061 * @return {@code true} if this expression is in a context where the operator '[]=' will be
5985 * invoked 6062 * invoked
5986 */ 6063 */
5987 bool inSetterContext() { 6064 bool inSetterContext() {
5988 ASTNode parent4 = parent; 6065 ASTNode parent5 = parent;
5989 if (parent4 is PrefixExpression) { 6066 if (parent5 is PrefixExpression) {
5990 return ((parent4 as PrefixExpression)).operator.type.isIncrementOperator() ; 6067 return ((parent5 as PrefixExpression)).operator.type.isIncrementOperator() ;
5991 } else if (parent4 is PostfixExpression) { 6068 } else if (parent5 is PostfixExpression) {
5992 return true; 6069 return true;
5993 } else if (parent4 is AssignmentExpression) { 6070 } else if (parent5 is AssignmentExpression) {
5994 return identical(((parent4 as AssignmentExpression)).leftHandSide, this); 6071 return identical(((parent5 as AssignmentExpression)).leftHandSide, this);
5995 } 6072 }
5996 return false; 6073 return false;
5997 } 6074 }
5998 bool isAssignable() => true; 6075 bool isAssignable() => true;
5999 /** 6076 /**
6000 * Return {@code true} if this expression is cascaded. If it is, then the targ et of this 6077 * Return {@code true} if this expression is cascaded. If it is, then the targ et of this
6001 * expression is not stored locally but is stored in the nearest ancestor that is a{@link CascadeExpression}. 6078 * expression is not stored locally but is stored in the nearest ancestor that is a{@link CascadeExpression}.
6002 * @return {@code true} if this expression is cascaded 6079 * @return {@code true} if this expression is cascaded
6003 */ 6080 */
6004 bool isCascaded() => _period != null; 6081 bool isCascaded() => _period != null;
6005 /** 6082 /**
6006 * Set the expression used to compute the object being indexed to the given ex pression. 6083 * Set the expression used to compute the object being indexed to the given ex pression.
6007 * @param expression the expression used to compute the object being indexed 6084 * @param expression the expression used to compute the object being indexed
6008 */ 6085 */
6009 void set array(Expression expression) { 6086 void set array(Expression expression) {
6010 _target = becomeParentOf(expression); 6087 _target = becomeParentOf(expression);
6011 } 6088 }
6012 /** 6089 /**
6013 * Set the element associated with the operator to the given element. 6090 * Set the element associated with the operator to the given element.
6014 * @param element the element associated with this operator 6091 * @param element the element associated with this operator
6015 */ 6092 */
6016 void set element(MethodElement element12) { 6093 void set element(MethodElement element11) {
6017 this._element = element12; 6094 this._element = element11;
6018 } 6095 }
6019 /** 6096 /**
6020 * Set the expression used to compute the index to the given expression. 6097 * Set the expression used to compute the index to the given expression.
6021 * @param expression the expression used to compute the index 6098 * @param expression the expression used to compute the index
6022 */ 6099 */
6023 void set index(Expression expression) { 6100 void set index(Expression expression) {
6024 _index = becomeParentOf(expression); 6101 _index = becomeParentOf(expression);
6025 } 6102 }
6026 /** 6103 /**
6027 * Set the left square bracket to the given token. 6104 * Set the left square bracket to the given token.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
6110 * @return the element associated with the constructor 6187 * @return the element associated with the constructor
6111 */ 6188 */
6112 ConstructorElement get element => _element; 6189 ConstructorElement get element => _element;
6113 Token get endToken => _argumentList.endToken; 6190 Token get endToken => _argumentList.endToken;
6114 /** 6191 /**
6115 * Return the keyword used to indicate how an object should be created. 6192 * Return the keyword used to indicate how an object should be created.
6116 * @return the keyword used to indicate how an object should be created 6193 * @return the keyword used to indicate how an object should be created
6117 */ 6194 */
6118 Token get keyword => _keyword; 6195 Token get keyword => _keyword;
6119 /** 6196 /**
6197 * Return {@code true} if this creation expression is used to invoke a constan t constructor.
6198 * @return {@code true} if this creation expression is used to invoke a consta nt constructor
6199 */
6200 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT oken)).keyword, Keyword.CONST);
6201 /**
6120 * Set the list of arguments to the constructor to the given list. 6202 * Set the list of arguments to the constructor to the given list.
6121 * @param argumentList the list of arguments to the constructor 6203 * @param argumentList the list of arguments to the constructor
6122 */ 6204 */
6123 void set argumentList(ArgumentList argumentList6) { 6205 void set argumentList(ArgumentList argumentList6) {
6124 this._argumentList = becomeParentOf(argumentList6); 6206 this._argumentList = becomeParentOf(argumentList6);
6125 } 6207 }
6126 /** 6208 /**
6127 * Set the name of the constructor to be invoked to the given name. 6209 * Set the name of the constructor to be invoked to the given name.
6128 * @param constructorName the name of the constructor to be invoked 6210 * @param constructorName the name of the constructor to be invoked
6129 */ 6211 */
6130 void set constructorName(ConstructorName constructorName3) { 6212 void set constructorName(ConstructorName constructorName3) {
6131 this._constructorName = constructorName3; 6213 this._constructorName = constructorName3;
6132 } 6214 }
6133 /** 6215 /**
6134 * Set the element associated with the constructor to the given element. 6216 * Set the element associated with the constructor to the given element.
6135 * @param element the element associated with the constructor 6217 * @param element the element associated with the constructor
6136 */ 6218 */
6137 void set element(ConstructorElement element13) { 6219 void set element(ConstructorElement element12) {
6138 this._element = element13; 6220 this._element = element12;
6139 } 6221 }
6140 /** 6222 /**
6141 * Set the keyword used to indicate how an object should be created to the giv en keyword. 6223 * Set the keyword used to indicate how an object should be created to the giv en keyword.
6142 * @param keyword the keyword used to indicate how an object should be created 6224 * @param keyword the keyword used to indicate how an object should be created
6143 */ 6225 */
6144 void set keyword(Token keyword12) { 6226 void set keyword(Token keyword12) {
6145 this._keyword = keyword12; 6227 this._keyword = keyword12;
6146 } 6228 }
6147 void visitChildren(ASTVisitor<Object> visitor) { 6229 void visitChildren(ASTVisitor<Object> visitor) {
6148 safelyVisitChild(_constructorName, visitor); 6230 safelyVisitChild(_constructorName, visitor);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
6521 * Set the colon that separates the label from the statement to the given toke n. 6603 * Set the colon that separates the label from the statement to the given toke n.
6522 * @param colon the colon that separates the label from the statement 6604 * @param colon the colon that separates the label from the statement
6523 */ 6605 */
6524 void set colon(Token colon3) { 6606 void set colon(Token colon3) {
6525 this._colon = colon3; 6607 this._colon = colon3;
6526 } 6608 }
6527 /** 6609 /**
6528 * Set the label being associated with the statement to the given label. 6610 * Set the label being associated with the statement to the given label.
6529 * @param label the label being associated with the statement 6611 * @param label the label being associated with the statement
6530 */ 6612 */
6531 void set label(SimpleIdentifier label2) { 6613 void set label(SimpleIdentifier label3) {
6532 this._label = becomeParentOf(label2); 6614 this._label = becomeParentOf(label3);
6533 } 6615 }
6534 void visitChildren(ASTVisitor<Object> visitor) { 6616 void visitChildren(ASTVisitor<Object> visitor) {
6535 safelyVisitChild(_label, visitor); 6617 safelyVisitChild(_label, visitor);
6536 } 6618 }
6537 } 6619 }
6538 /** 6620 /**
6539 * Instances of the class {@code LabeledStatement} represent a statement that ha s a label associated 6621 * Instances of the class {@code LabeledStatement} represent a statement that ha s a label associated
6540 * with them. 6622 * with them.
6541 * <pre> 6623 * <pre>
6542 * labeledStatement ::={@link Label label}+ {@link Statement statement}</pre> 6624 * labeledStatement ::={@link Label label}+ {@link Statement statement}</pre>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
6706 * @param components the components of the identifier 6788 * @param components the components of the identifier
6707 */ 6789 */
6708 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components) ; 6790 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components) ;
6709 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); 6791 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this);
6710 Token get beginToken => _components.beginToken; 6792 Token get beginToken => _components.beginToken;
6711 /** 6793 /**
6712 * Return the components of the identifier. 6794 * Return the components of the identifier.
6713 * @return the components of the identifier 6795 * @return the components of the identifier
6714 */ 6796 */
6715 NodeList<SimpleIdentifier> get components => _components; 6797 NodeList<SimpleIdentifier> get components => _components;
6798 Element get element => null;
6716 Token get endToken => _components.endToken; 6799 Token get endToken => _components.endToken;
6717 String get name { 6800 String get name {
6718 StringBuffer builder = new StringBuffer(); 6801 StringBuffer builder = new StringBuffer();
6719 bool needsPeriod = false; 6802 bool needsPeriod = false;
6720 for (SimpleIdentifier identifier in _components) { 6803 for (SimpleIdentifier identifier in _components) {
6721 if (needsPeriod) { 6804 if (needsPeriod) {
6722 builder.add("."); 6805 builder.write(".");
6723 } else { 6806 } else {
6724 needsPeriod = true; 6807 needsPeriod = true;
6725 } 6808 }
6726 builder.add(identifier.name); 6809 builder.write(identifier.name);
6727 } 6810 }
6728 return builder.toString(); 6811 return builder.toString();
6729 } 6812 }
6730 void visitChildren(ASTVisitor<Object> visitor) { 6813 void visitChildren(ASTVisitor<Object> visitor) {
6731 _components.accept(visitor); 6814 _components.accept(visitor);
6732 } 6815 }
6733 } 6816 }
6734 /** 6817 /**
6735 * Instances of the class {@code ListLiteral} represent a list literal. 6818 * Instances of the class {@code ListLiteral} represent a list literal.
6736 * <pre> 6819 * <pre>
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
7003 void visitChildren(ASTVisitor<Object> visitor) { 7086 void visitChildren(ASTVisitor<Object> visitor) {
7004 safelyVisitChild(_key, visitor); 7087 safelyVisitChild(_key, visitor);
7005 safelyVisitChild(_value, visitor); 7088 safelyVisitChild(_value, visitor);
7006 } 7089 }
7007 } 7090 }
7008 /** 7091 /**
7009 * Instances of the class {@code MethodDeclaration} represent a method declarati on. 7092 * Instances of the class {@code MethodDeclaration} represent a method declarati on.
7010 * <pre> 7093 * <pre>
7011 * methodDeclaration ::= 7094 * methodDeclaration ::=
7012 * methodSignature {@link FunctionBody body}methodSignature ::= 7095 * methodSignature {@link FunctionBody body}methodSignature ::=
7013 * 'external'? ('abstract' | 'static')? {@link Type returnType}? ('get' | 'set') ? methodName{@link FormalParameterList formalParameterList}methodName ::={@link SimpleIdentifier name} ('.' {@link SimpleIdentifier name})? 7096 * 'external'? ('abstract' | 'static')? {@link Type returnType}? ('get' | 'set') ? methodName{@link FormalParameterList formalParameterList}methodName ::={@link SimpleIdentifier name}| 'operator' {@link SimpleIdentifier operator}</pre>
7014 * | 'operator' {@link SimpleIdentifier operator}</pre>
7015 */ 7097 */
7016 class MethodDeclaration extends ClassMember { 7098 class MethodDeclaration extends ClassMember {
7017 /** 7099 /**
7018 * The token for the 'external' keyword, or {@code null} if the constructor is not external. 7100 * The token for the 'external' keyword, or {@code null} if the constructor is not external.
7019 */ 7101 */
7020 Token _externalKeyword; 7102 Token _externalKeyword;
7021 /** 7103 /**
7022 * The token representing the 'abstract' or 'static' keyword, or {@code null} if neither modifier 7104 * The token representing the 'abstract' or 'static' keyword, or {@code null} if neither modifier
7023 * was specified. 7105 * was specified.
7024 */ 7106 */
7025 Token _modifierKeyword; 7107 Token _modifierKeyword;
7026 /** 7108 /**
7027 * The return type of the method, or {@code null} if no return type was declar ed. 7109 * The return type of the method, or {@code null} if no return type was declar ed.
7028 */ 7110 */
7029 TypeName _returnType; 7111 TypeName _returnType;
7030 /** 7112 /**
7031 * The token representing the 'get' or 'set' keyword, or {@code null} if this is a method 7113 * The token representing the 'get' or 'set' keyword, or {@code null} if this is a method
7032 * declaration rather than a property declaration. 7114 * declaration rather than a property declaration.
7033 */ 7115 */
7034 Token _propertyKeyword; 7116 Token _propertyKeyword;
7035 /** 7117 /**
7036 * The token representing the 'operator' keyword, or {@code null} if this meth od does not declare 7118 * The token representing the 'operator' keyword, or {@code null} if this meth od does not declare
7037 * an operator. 7119 * an operator.
7038 */ 7120 */
7039 Token _operatorKeyword; 7121 Token _operatorKeyword;
7040 /** 7122 /**
7041 * The name of the method. 7123 * The name of the method.
7042 */ 7124 */
7043 Identifier _name; 7125 SimpleIdentifier _name;
7044 /** 7126 /**
7045 * The parameters associated with the method, or {@code null} if this method d eclares a getter. 7127 * The parameters associated with the method, or {@code null} if this method d eclares a getter.
7046 */ 7128 */
7047 FormalParameterList _parameters; 7129 FormalParameterList _parameters;
7048 /** 7130 /**
7049 * The body of the method. 7131 * The body of the method.
7050 */ 7132 */
7051 FunctionBody _body; 7133 FunctionBody _body;
7052 /** 7134 /**
7053 * Initialize a newly created method declaration. 7135 * Initialize a newly created method declaration.
7054 * @param externalKeyword the token for the 'external' keyword 7136 * @param externalKeyword the token for the 'external' keyword
7055 * @param comment the documentation comment associated with this method 7137 * @param comment the documentation comment associated with this method
7056 * @param metadata the annotations associated with this method 7138 * @param metadata the annotations associated with this method
7057 * @param modifierKeyword the token representing the 'abstract' or 'static' ke yword 7139 * @param modifierKeyword the token representing the 'abstract' or 'static' ke yword
7058 * @param returnType the return type of the method 7140 * @param returnType the return type of the method
7059 * @param propertyKeyword the token representing the 'get' or 'set' keyword 7141 * @param propertyKeyword the token representing the 'get' or 'set' keyword
7060 * @param operatorKeyword the token representing the 'operator' keyword 7142 * @param operatorKeyword the token representing the 'operator' keyword
7061 * @param name the name of the method 7143 * @param name the name of the method
7062 * @param parameters the parameters associated with the method, or {@code null } if this method 7144 * @param parameters the parameters associated with the method, or {@code null } if this method
7063 * declares a getter 7145 * declares a getter
7064 * @param body the body of the method 7146 * @param body the body of the method
7065 */ 7147 */
7066 MethodDeclaration.full(Comment comment, List<Annotation> metadata, Token exter nalKeyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, T oken operatorKeyword, Identifier name, FormalParameterList parameters, FunctionB ody body) : super.full(comment, metadata) { 7148 MethodDeclaration.full(Comment comment, List<Annotation> metadata, Token exter nalKeyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, T oken operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Fun ctionBody body) : super.full(comment, metadata) {
7067 this._externalKeyword = externalKeyword; 7149 this._externalKeyword = externalKeyword;
7068 this._modifierKeyword = modifierKeyword; 7150 this._modifierKeyword = modifierKeyword;
7069 this._returnType = becomeParentOf(returnType); 7151 this._returnType = becomeParentOf(returnType);
7070 this._propertyKeyword = propertyKeyword; 7152 this._propertyKeyword = propertyKeyword;
7071 this._operatorKeyword = operatorKeyword; 7153 this._operatorKeyword = operatorKeyword;
7072 this._name = becomeParentOf(name); 7154 this._name = becomeParentOf(name);
7073 this._parameters = becomeParentOf(parameters); 7155 this._parameters = becomeParentOf(parameters);
7074 this._body = becomeParentOf(body); 7156 this._body = becomeParentOf(body);
7075 } 7157 }
7076 /** 7158 /**
7077 * Initialize a newly created method declaration. 7159 * Initialize a newly created method declaration.
7078 * @param externalKeyword the token for the 'external' keyword 7160 * @param externalKeyword the token for the 'external' keyword
7079 * @param comment the documentation comment associated with this method 7161 * @param comment the documentation comment associated with this method
7080 * @param metadata the annotations associated with this method 7162 * @param metadata the annotations associated with this method
7081 * @param modifierKeyword the token representing the 'abstract' or 'static' ke yword 7163 * @param modifierKeyword the token representing the 'abstract' or 'static' ke yword
7082 * @param returnType the return type of the method 7164 * @param returnType the return type of the method
7083 * @param propertyKeyword the token representing the 'get' or 'set' keyword 7165 * @param propertyKeyword the token representing the 'get' or 'set' keyword
7084 * @param operatorKeyword the token representing the 'operator' keyword 7166 * @param operatorKeyword the token representing the 'operator' keyword
7085 * @param name the name of the method 7167 * @param name the name of the method
7086 * @param parameters the parameters associated with the method, or {@code null } if this method 7168 * @param parameters the parameters associated with the method, or {@code null } if this method
7087 * declares a getter 7169 * declares a getter
7088 * @param body the body of the method 7170 * @param body the body of the method
7089 */ 7171 */
7090 MethodDeclaration({Comment comment, List<Annotation> metadata, Token externalK eyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, Token operatorKeyword, Identifier name, FormalParameterList parameters, FunctionBody body}) : this.full(comment, metadata, externalKeyword, modifierKeyword, returnTy pe, propertyKeyword, operatorKeyword, name, parameters, body); 7172 MethodDeclaration({Comment comment, List<Annotation> metadata, Token externalK eyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, Token operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Functio nBody body}) : this.full(comment, metadata, externalKeyword, modifierKeyword, re turnType, propertyKeyword, operatorKeyword, name, parameters, body);
7091 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); 7173 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this);
7092 /** 7174 /**
7093 * Return the body of the method. 7175 * Return the body of the method.
7094 * @return the body of the method 7176 * @return the body of the method
7095 */ 7177 */
7096 FunctionBody get body => _body; 7178 FunctionBody get body => _body;
7097 /** 7179 /**
7098 * Return the element associated with this method, or {@code null} if the AST structure has not 7180 * Return the element associated with this method, or {@code null} if the AST structure has not
7099 * been resolved. The element can either be a {@link MethodElement}, if this r epresents the 7181 * been resolved. The element can either be a {@link MethodElement}, if this r epresents the
7100 * declaration of a normal method, or a {@link PropertyAccessorElement} if thi s represents the 7182 * declaration of a normal method, or a {@link PropertyAccessorElement} if thi s represents the
(...skipping 11 matching lines...) Expand all
7112 /** 7194 /**
7113 * Return the token representing the 'abstract' or 'static' keyword, or {@code null} if neither 7195 * Return the token representing the 'abstract' or 'static' keyword, or {@code null} if neither
7114 * modifier was specified. 7196 * modifier was specified.
7115 * @return the token representing the 'abstract' or 'static' keyword 7197 * @return the token representing the 'abstract' or 'static' keyword
7116 */ 7198 */
7117 Token get modifierKeyword => _modifierKeyword; 7199 Token get modifierKeyword => _modifierKeyword;
7118 /** 7200 /**
7119 * Return the name of the method. 7201 * Return the name of the method.
7120 * @return the name of the method 7202 * @return the name of the method
7121 */ 7203 */
7122 Identifier get name => _name; 7204 SimpleIdentifier get name => _name;
7123 /** 7205 /**
7124 * Return the token representing the 'operator' keyword, or {@code null} if th is method does not 7206 * Return the token representing the 'operator' keyword, or {@code null} if th is method does not
7125 * declare an operator. 7207 * declare an operator.
7126 * @return the token representing the 'operator' keyword 7208 * @return the token representing the 'operator' keyword
7127 */ 7209 */
7128 Token get operatorKeyword => _operatorKeyword; 7210 Token get operatorKeyword => _operatorKeyword;
7129 /** 7211 /**
7130 * Return the parameters associated with the method, or {@code null} if this m ethod declares a 7212 * Return the parameters associated with the method, or {@code null} if this m ethod declares a
7131 * getter. 7213 * getter.
7132 * @return the parameters associated with the method 7214 * @return the parameters associated with the method
7133 */ 7215 */
7134 FormalParameterList get parameters => _parameters; 7216 FormalParameterList get parameters => _parameters;
7135 /** 7217 /**
7136 * Return the token representing the 'get' or 'set' keyword, or {@code null} i f this is a method 7218 * Return the token representing the 'get' or 'set' keyword, or {@code null} i f this is a method
7137 * declaration rather than a property declaration. 7219 * declaration rather than a property declaration.
7138 * @return the token representing the 'get' or 'set' keyword 7220 * @return the token representing the 'get' or 'set' keyword
7139 */ 7221 */
7140 Token get propertyKeyword => _propertyKeyword; 7222 Token get propertyKeyword => _propertyKeyword;
7141 /** 7223 /**
7142 * Return the return type of the method, or {@code null} if no return type was declared. 7224 * Return the return type of the method, or {@code null} if no return type was declared.
7143 * @return the return type of the method 7225 * @return the return type of the method
7144 */ 7226 */
7145 TypeName get returnType => _returnType; 7227 TypeName get returnType => _returnType;
7146 /** 7228 /**
7229 * Return {@code true} if this method is declared to be an abstract method.
7230 * @return {@code true} if this method is declared to be an abstract method
7231 */
7232 bool isAbstract() => _modifierKeyword != null && identical(((_modifierKeyword as KeywordToken)).keyword, Keyword.ABSTRACT);
7233 /**
7147 * Return {@code true} if this method declares a getter. 7234 * Return {@code true} if this method declares a getter.
7148 * @return {@code true} if this method declares a getter 7235 * @return {@code true} if this method declares a getter
7149 */ 7236 */
7150 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.GET); 7237 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.GET);
7151 /** 7238 /**
7152 * Return {@code true} if this method declares an operator. 7239 * Return {@code true} if this method declares an operator.
7153 * @return {@code true} if this method declares an operator 7240 * @return {@code true} if this method declares an operator
7154 */ 7241 */
7155 bool isOperator() => _operatorKeyword != null; 7242 bool isOperator() => _operatorKeyword != null;
7156 /** 7243 /**
7157 * Return {@code true} if this method declares a setter. 7244 * Return {@code true} if this method declares a setter.
7158 * @return {@code true} if this method declares a setter 7245 * @return {@code true} if this method declares a setter
7159 */ 7246 */
7160 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.SET); 7247 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as KeywordToken)).keyword, Keyword.SET);
7161 /** 7248 /**
7249 * Return {@code true} if this method is declared to be a static method.
7250 * @return {@code true} if this method is declared to be a static method
7251 */
7252 bool isStatic() => _modifierKeyword != null && identical(((_modifierKeyword as KeywordToken)).keyword, Keyword.STATIC);
7253 /**
7162 * Set the body of the method to the given function body. 7254 * Set the body of the method to the given function body.
7163 * @param functionBody the body of the method 7255 * @param functionBody the body of the method
7164 */ 7256 */
7165 void set body(FunctionBody functionBody) { 7257 void set body(FunctionBody functionBody) {
7166 _body = becomeParentOf(functionBody); 7258 _body = becomeParentOf(functionBody);
7167 } 7259 }
7168 /** 7260 /**
7169 * Set the token for the 'external' keyword to the given token. 7261 * Set the token for the 'external' keyword to the given token.
7170 * @param externalKeyword the token for the 'external' keyword 7262 * @param externalKeyword the token for the 'external' keyword
7171 */ 7263 */
7172 void set externalKeyword(Token externalKeyword4) { 7264 void set externalKeyword(Token externalKeyword4) {
7173 this._externalKeyword = externalKeyword4; 7265 this._externalKeyword = externalKeyword4;
7174 } 7266 }
7175 /** 7267 /**
7176 * Set the token representing the 'abstract' or 'static' keyword to the given token. 7268 * Set the token representing the 'abstract' or 'static' keyword to the given token.
7177 * @param modifierKeyword the token representing the 'abstract' or 'static' ke yword 7269 * @param modifierKeyword the token representing the 'abstract' or 'static' ke yword
7178 */ 7270 */
7179 void set modifierKeyword(Token modifierKeyword2) { 7271 void set modifierKeyword(Token modifierKeyword2) {
7180 this._modifierKeyword = modifierKeyword2; 7272 this._modifierKeyword = modifierKeyword2;
7181 } 7273 }
7182 /** 7274 /**
7183 * Set the name of the method to the given identifier. 7275 * Set the name of the method to the given identifier.
7184 * @param identifier the name of the method 7276 * @param identifier the name of the method
7185 */ 7277 */
7186 void set name(Identifier identifier) { 7278 void set name(SimpleIdentifier identifier) {
7187 _name = becomeParentOf(identifier); 7279 _name = becomeParentOf(identifier);
7188 } 7280 }
7189 /** 7281 /**
7190 * Set the token representing the 'operator' keyword to the given token. 7282 * Set the token representing the 'operator' keyword to the given token.
7191 * @param operatorKeyword the token representing the 'operator' keyword 7283 * @param operatorKeyword the token representing the 'operator' keyword
7192 */ 7284 */
7193 void set operatorKeyword(Token operatorKeyword2) { 7285 void set operatorKeyword(Token operatorKeyword2) {
7194 this._operatorKeyword = operatorKeyword2; 7286 this._operatorKeyword = operatorKeyword2;
7195 } 7287 }
7196 /** 7288 /**
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
7400 this._expression = becomeParentOf(expression); 7492 this._expression = becomeParentOf(expression);
7401 } 7493 }
7402 /** 7494 /**
7403 * Initialize a newly created named expression. 7495 * Initialize a newly created named expression.
7404 * @param name the name associated with the expression 7496 * @param name the name associated with the expression
7405 * @param expression the expression with which the name is associated 7497 * @param expression the expression with which the name is associated
7406 */ 7498 */
7407 NamedExpression({Label name, Expression expression}) : this.full(name, express ion); 7499 NamedExpression({Label name, Expression expression}) : this.full(name, express ion);
7408 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); 7500 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this);
7409 Token get beginToken => _name.beginToken; 7501 Token get beginToken => _name.beginToken;
7502 /**
7503 * Return the element representing the parameter being named by this expressio n, or {@code null}if the AST structure has not been resolved or if there is no p arameter with the same name as
7504 * this expression.
7505 * @return the element representing the parameter being named by this expressi on
7506 */
7507 ParameterElement get element {
7508 Element element19 = _name.label.element;
7509 if (element19 is ParameterElement) {
7510 return element19 as ParameterElement;
7511 }
7512 return null;
7513 }
7410 Token get endToken => _expression.endToken; 7514 Token get endToken => _expression.endToken;
7411 /** 7515 /**
7412 * Return the expression with which the name is associated. 7516 * Return the expression with which the name is associated.
7413 * @return the expression with which the name is associated 7517 * @return the expression with which the name is associated
7414 */ 7518 */
7415 Expression get expression => _expression; 7519 Expression get expression => _expression;
7416 /** 7520 /**
7417 * Return the name associated with the expression. 7521 * Return the name associated with the expression.
7418 * @return the name associated with the expression 7522 * @return the name associated with the expression
7419 */ 7523 */
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
7549 */ 7653 */
7550 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent ifier identifier}) : this.full(comment, metadata, identifier); 7654 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent ifier identifier}) : this.full(comment, metadata, identifier);
7551 /** 7655 /**
7552 * Return the documentation comment associated with this parameter, or {@code null} if this 7656 * Return the documentation comment associated with this parameter, or {@code null} if this
7553 * parameter does not have a documentation comment associated with it. 7657 * parameter does not have a documentation comment associated with it.
7554 * @return the documentation comment associated with this parameter 7658 * @return the documentation comment associated with this parameter
7555 */ 7659 */
7556 Comment get documentationComment => _comment; 7660 Comment get documentationComment => _comment;
7557 SimpleIdentifier get identifier => _identifier; 7661 SimpleIdentifier get identifier => _identifier;
7558 ParameterKind get kind { 7662 ParameterKind get kind {
7559 ASTNode parent5 = parent; 7663 ASTNode parent6 = parent;
7560 if (parent5 is DefaultFormalParameter) { 7664 if (parent6 is DefaultFormalParameter) {
7561 return ((parent5 as DefaultFormalParameter)).kind; 7665 return ((parent6 as DefaultFormalParameter)).kind;
7562 } 7666 }
7563 return ParameterKind.REQUIRED; 7667 return ParameterKind.REQUIRED;
7564 } 7668 }
7565 /** 7669 /**
7566 * Return the annotations associated with this parameter. 7670 * Return the annotations associated with this parameter.
7567 * @return the annotations associated with this parameter 7671 * @return the annotations associated with this parameter
7568 */ 7672 */
7569 NodeList<Annotation> get metadata => _metadata; 7673 NodeList<Annotation> get metadata => _metadata;
7570 /** 7674 /**
7571 * Return {@code true} if this parameter is a const parameter. 7675 * Return {@code true} if this parameter is a const parameter.
7572 * @return {@code true} if this parameter is a const parameter 7676 * @return {@code true} if this parameter is a const parameter
7573 */ 7677 */
7574 bool isConst(); 7678 bool isConst();
7575 /** 7679 /**
7576 * Return {@code true} if this parameter is a final parameter. 7680 * Return {@code true} if this parameter is a final parameter.
7577 * @return {@code true} if this parameter is a final parameter 7681 * @return {@code true} if this parameter is a final parameter
7578 */ 7682 */
7579 bool isFinal(); 7683 bool isFinal();
7580 /** 7684 /**
7581 * Set the documentation comment associated with this parameter to the given c omment 7685 * Set the documentation comment associated with this parameter to the given c omment
7582 * @param comment the documentation comment to be associated with this paramet er 7686 * @param comment the documentation comment to be associated with this paramet er
7583 */ 7687 */
7584 void set documentationComment(Comment comment3) { 7688 void set documentationComment(Comment comment3) {
7585 this._comment = becomeParentOf(comment3); 7689 this._comment = becomeParentOf(comment3);
7586 } 7690 }
7587 /** 7691 /**
7588 * Set the name of the parameter being declared to the given identifier. 7692 * Set the name of the parameter being declared to the given identifier.
7589 * @param identifier the name of the parameter being declared 7693 * @param identifier the name of the parameter being declared
7590 */ 7694 */
7591 void set identifier(SimpleIdentifier identifier6) { 7695 void set identifier(SimpleIdentifier identifier8) {
7592 this._identifier = becomeParentOf(identifier6); 7696 this._identifier = becomeParentOf(identifier8);
7593 } 7697 }
7594 void visitChildren(ASTVisitor<Object> visitor) { 7698 void visitChildren(ASTVisitor<Object> visitor) {
7595 if (commentIsBeforeAnnotations()) { 7699 if (commentIsBeforeAnnotations()) {
7596 safelyVisitChild(_comment, visitor); 7700 safelyVisitChild(_comment, visitor);
7597 _metadata.accept(visitor); 7701 _metadata.accept(visitor);
7598 } else { 7702 } else {
7599 for (ASTNode child in sortedCommentAndAnnotations) { 7703 for (ASTNode child in sortedCommentAndAnnotations) {
7600 child.accept(visitor); 7704 child.accept(visitor);
7601 } 7705 }
7602 } 7706 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
7971 Expression get operand => _operand; 8075 Expression get operand => _operand;
7972 /** 8076 /**
7973 * Return the postfix operator being applied to the operand. 8077 * Return the postfix operator being applied to the operand.
7974 * @return the postfix operator being applied to the operand 8078 * @return the postfix operator being applied to the operand
7975 */ 8079 */
7976 Token get operator => _operator; 8080 Token get operator => _operator;
7977 /** 8081 /**
7978 * Set the element associated with the operator to the given element. 8082 * Set the element associated with the operator to the given element.
7979 * @param element the element associated with the operator 8083 * @param element the element associated with the operator
7980 */ 8084 */
7981 void set element(MethodElement element14) { 8085 void set element(MethodElement element13) {
7982 this._element = element14; 8086 this._element = element13;
7983 } 8087 }
7984 /** 8088 /**
7985 * Set the expression computing the operand for the operator to the given expr ession. 8089 * Set the expression computing the operand for the operator to the given expr ession.
7986 * @param expression the expression computing the operand for the operator 8090 * @param expression the expression computing the operand for the operator
7987 */ 8091 */
7988 void set operand(Expression expression) { 8092 void set operand(Expression expression) {
7989 _operand = becomeParentOf(expression); 8093 _operand = becomeParentOf(expression);
7990 } 8094 }
7991 /** 8095 /**
7992 * Set the postfix operator being applied to the operand to the given operator . 8096 * Set the postfix operator being applied to the operand to the given operator .
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
8050 Expression get operand => _operand; 8154 Expression get operand => _operand;
8051 /** 8155 /**
8052 * Return the prefix operator being applied to the operand. 8156 * Return the prefix operator being applied to the operand.
8053 * @return the prefix operator being applied to the operand 8157 * @return the prefix operator being applied to the operand
8054 */ 8158 */
8055 Token get operator => _operator; 8159 Token get operator => _operator;
8056 /** 8160 /**
8057 * Set the element associated with the operator to the given element. 8161 * Set the element associated with the operator to the given element.
8058 * @param element the element associated with the operator 8162 * @param element the element associated with the operator
8059 */ 8163 */
8060 void set element(MethodElement element15) { 8164 void set element(MethodElement element14) {
8061 this._element = element15; 8165 this._element = element14;
8062 } 8166 }
8063 /** 8167 /**
8064 * Set the expression computing the operand for the operator to the given expr ession. 8168 * Set the expression computing the operand for the operator to the given expr ession.
8065 * @param expression the expression computing the operand for the operator 8169 * @param expression the expression computing the operand for the operator
8066 */ 8170 */
8067 void set operand(Expression expression) { 8171 void set operand(Expression expression) {
8068 _operand = becomeParentOf(expression); 8172 _operand = becomeParentOf(expression);
8069 } 8173 }
8070 /** 8174 /**
8071 * Set the prefix operator being applied to the operand to the given operator. 8175 * Set the prefix operator being applied to the operand to the given operator.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
8111 } 8215 }
8112 /** 8216 /**
8113 * Initialize a newly created prefixed identifier. 8217 * Initialize a newly created prefixed identifier.
8114 * @param prefix the identifier being prefixed 8218 * @param prefix the identifier being prefixed
8115 * @param period the period used to separate the prefix from the identifier 8219 * @param period the period used to separate the prefix from the identifier
8116 * @param identifier the prefix associated with the library in which the ident ifier is defined 8220 * @param identifier the prefix associated with the library in which the ident ifier is defined
8117 */ 8221 */
8118 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id entifier}) : this.full(prefix, period, identifier); 8222 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id entifier}) : this.full(prefix, period, identifier);
8119 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); 8223 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this);
8120 Token get beginToken => _prefix.beginToken; 8224 Token get beginToken => _prefix.beginToken;
8225 Element get element {
8226 if (_identifier == null) {
8227 return null;
8228 }
8229 return _identifier.element;
8230 }
8121 Token get endToken => _identifier.endToken; 8231 Token get endToken => _identifier.endToken;
8122 /** 8232 /**
8123 * Return the identifier being prefixed. 8233 * Return the identifier being prefixed.
8124 * @return the identifier being prefixed 8234 * @return the identifier being prefixed
8125 */ 8235 */
8126 SimpleIdentifier get identifier => _identifier; 8236 SimpleIdentifier get identifier => _identifier;
8127 String get name => "${_prefix.name}.${_identifier.name}"; 8237 String get name => "${_prefix.name}.${_identifier.name}";
8128 /** 8238 /**
8129 * Return the period used to separate the prefix from the identifier. 8239 * Return the period used to separate the prefix from the identifier.
8130 * @return the period used to separate the prefix from the identifier 8240 * @return the period used to separate the prefix from the identifier
8131 */ 8241 */
8132 Token get period => _period; 8242 Token get period => _period;
8133 /** 8243 /**
8134 * Return the prefix associated with the library in which the identifier is de fined. 8244 * Return the prefix associated with the library in which the identifier is de fined.
8135 * @return the prefix associated with the library in which the identifier is d efined 8245 * @return the prefix associated with the library in which the identifier is d efined
8136 */ 8246 */
8137 SimpleIdentifier get prefix => _prefix; 8247 SimpleIdentifier get prefix => _prefix;
8138 /** 8248 /**
8139 * Set the identifier being prefixed to the given identifier. 8249 * Set the identifier being prefixed to the given identifier.
8140 * @param identifier the identifier being prefixed 8250 * @param identifier the identifier being prefixed
8141 */ 8251 */
8142 void set identifier(SimpleIdentifier identifier7) { 8252 void set identifier(SimpleIdentifier identifier9) {
8143 this._identifier = becomeParentOf(identifier7); 8253 this._identifier = becomeParentOf(identifier9);
8144 } 8254 }
8145 /** 8255 /**
8146 * Set the period used to separate the prefix from the identifier to the given token. 8256 * Set the period used to separate the prefix from the identifier to the given token.
8147 * @param period the period used to separate the prefix from the identifier 8257 * @param period the period used to separate the prefix from the identifier
8148 */ 8258 */
8149 void set period(Token period10) { 8259 void set period(Token period10) {
8150 this._period = period10; 8260 this._period = period10;
8151 } 8261 }
8152 /** 8262 /**
8153 * Set the prefix associated with the library in which the identifier is defin ed to the given 8263 * Set the prefix associated with the library in which the identifier is defin ed to the given
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
8375 * Set the name of the constructor that is being invoked to the given identifi er. 8485 * Set the name of the constructor that is being invoked to the given identifi er.
8376 * @param identifier the name of the constructor that is being invoked 8486 * @param identifier the name of the constructor that is being invoked
8377 */ 8487 */
8378 void set constructorName(SimpleIdentifier identifier) { 8488 void set constructorName(SimpleIdentifier identifier) {
8379 _constructorName = becomeParentOf(identifier); 8489 _constructorName = becomeParentOf(identifier);
8380 } 8490 }
8381 /** 8491 /**
8382 * Set the element associated with the constructor to the given element. 8492 * Set the element associated with the constructor to the given element.
8383 * @param element the element associated with the constructor 8493 * @param element the element associated with the constructor
8384 */ 8494 */
8385 void set element(ConstructorElement element16) { 8495 void set element(ConstructorElement element15) {
8386 this._element = element16; 8496 this._element = element15;
8387 } 8497 }
8388 /** 8498 /**
8389 * Set the token for the 'this' keyword to the given token. 8499 * Set the token for the 'this' keyword to the given token.
8390 * @param keyword the token for the 'this' keyword 8500 * @param keyword the token for the 'this' keyword
8391 */ 8501 */
8392 void set keyword(Token keyword13) { 8502 void set keyword(Token keyword13) {
8393 this._keyword = keyword13; 8503 this._keyword = keyword13;
8394 } 8504 }
8395 /** 8505 /**
8396 * Set the token for the period before the name of the constructor that is bei ng invoked to the 8506 * Set the token for the period before the name of the constructor that is bei ng invoked to the
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
8659 * initialCharacter ::= '_' | '$' | letter 8769 * initialCharacter ::= '_' | '$' | letter
8660 * internalCharacter ::= '_' | '$' | letter | digit 8770 * internalCharacter ::= '_' | '$' | letter | digit
8661 * </pre> 8771 * </pre>
8662 */ 8772 */
8663 class SimpleIdentifier extends Identifier { 8773 class SimpleIdentifier extends Identifier {
8664 /** 8774 /**
8665 * The token representing the identifier. 8775 * The token representing the identifier.
8666 */ 8776 */
8667 Token _token; 8777 Token _token;
8668 /** 8778 /**
8779 * The element associated with this identifier, or {@code null} if the AST str ucture has not been
8780 * resolved or if this identifier could not be resolved.
8781 */
8782 Element _element;
8783 /**
8669 * Initialize a newly created identifier. 8784 * Initialize a newly created identifier.
8670 * @param token the token representing the identifier 8785 * @param token the token representing the identifier
8671 */ 8786 */
8672 SimpleIdentifier.full(Token token) { 8787 SimpleIdentifier.full(Token token) {
8673 this._token = token; 8788 this._token = token;
8674 } 8789 }
8675 /** 8790 /**
8676 * Initialize a newly created identifier. 8791 * Initialize a newly created identifier.
8677 * @param token the token representing the identifier 8792 * @param token the token representing the identifier
8678 */ 8793 */
8679 SimpleIdentifier({Token token}) : this.full(token); 8794 SimpleIdentifier({Token token}) : this.full(token);
8680 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); 8795 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this);
8681 Token get beginToken => _token; 8796 Token get beginToken => _token;
8797 Element get element => _element;
8682 Token get endToken => _token; 8798 Token get endToken => _token;
8683 String get name => _token.lexeme; 8799 String get name => _token.lexeme;
8684 /** 8800 /**
8685 * Return the token representing the identifier. 8801 * Return the token representing the identifier.
8686 * @return the token representing the identifier 8802 * @return the token representing the identifier
8687 */ 8803 */
8688 Token get token => _token; 8804 Token get token => _token;
8689 /** 8805 /**
8806 * Return {@code true} if this identifier is the name being declared in a decl aration.
8807 * @return {@code true} if this identifier is the name being declared in a dec laration
8808 */
8809 bool inDeclarationContext() {
8810 ASTNode parent7 = parent;
8811 if (parent7 is CatchClause) {
8812 CatchClause clause = parent7 as CatchClause;
8813 return identical(this, clause.exceptionParameter) || identical(this, claus e.stackTraceParameter);
8814 } else if (parent7 is ClassDeclaration) {
8815 return identical(this, ((parent7 as ClassDeclaration)).name);
8816 } else if (parent7 is ClassTypeAlias) {
8817 return identical(this, ((parent7 as ClassTypeAlias)).name);
8818 } else if (parent7 is ConstructorDeclaration) {
8819 return identical(this, ((parent7 as ConstructorDeclaration)).name);
8820 } else if (parent7 is FunctionDeclaration) {
8821 return identical(this, ((parent7 as FunctionDeclaration)).name);
8822 } else if (parent7 is FunctionTypeAlias) {
8823 return identical(this, ((parent7 as FunctionTypeAlias)).name);
8824 } else if (parent7 is Label) {
8825 return identical(this, ((parent7 as Label)).label) && (parent7.parent is L abeledStatement);
8826 } else if (parent7 is MethodDeclaration) {
8827 return identical(this, ((parent7 as MethodDeclaration)).name);
8828 } else if (parent7 is NormalFormalParameter) {
8829 return identical(this, ((parent7 as NormalFormalParameter)).identifier);
8830 } else if (parent7 is TypeParameter) {
8831 return identical(this, ((parent7 as TypeParameter)).name);
8832 } else if (parent7 is VariableDeclaration) {
8833 return identical(this, ((parent7 as VariableDeclaration)).name);
8834 }
8835 return false;
8836 }
8837 /**
8690 * Return {@code true} if this expression is computing a right-hand value. 8838 * Return {@code true} if this expression is computing a right-hand value.
8691 * <p> 8839 * <p>
8692 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are 8840 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are
8693 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node. 8841 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node.
8694 * @return {@code true} if this expression is in a context where a getter will be invoked 8842 * @return {@code true} if this expression is in a context where a getter will be invoked
8695 */ 8843 */
8696 bool inGetterContext() { 8844 bool inGetterContext() {
8697 ASTNode parent6 = parent; 8845 ASTNode parent8 = parent;
8698 ASTNode target = this; 8846 ASTNode target = this;
8699 if (parent6 is PrefixedIdentifier) { 8847 if (parent8 is PrefixedIdentifier) {
8700 PrefixedIdentifier prefixed = (parent6 as PrefixedIdentifier); 8848 PrefixedIdentifier prefixed = parent8 as PrefixedIdentifier;
8701 if (identical(prefixed.prefix, this)) { 8849 if (identical(prefixed.prefix, this)) {
8702 return true; 8850 return true;
8703 } 8851 }
8704 parent6 = prefixed.parent; 8852 parent8 = prefixed.parent;
8705 target = prefixed; 8853 target = prefixed;
8854 } else if (parent8 is PropertyAccess) {
8855 PropertyAccess access = parent8 as PropertyAccess;
8856 if (identical(access.target, this)) {
8857 return true;
8858 }
8859 parent8 = access.parent;
8860 target = access;
8706 } 8861 }
8707 if (parent6 is AssignmentExpression) { 8862 if (parent8 is AssignmentExpression) {
8708 AssignmentExpression expr = (parent6 as AssignmentExpression); 8863 AssignmentExpression expr = parent8 as AssignmentExpression;
8709 if (identical(expr.leftHandSide, target) && identical(expr.operator.type, TokenType.EQ)) { 8864 if (identical(expr.leftHandSide, target) && identical(expr.operator.type, TokenType.EQ)) {
8710 return false; 8865 return false;
8711 } 8866 }
8712 } 8867 }
8713 return true; 8868 return true;
8714 } 8869 }
8715 /** 8870 /**
8716 * Return {@code true} if this expression is computing a left-hand value. 8871 * Return {@code true} if this expression is computing a left-hand value.
8717 * <p> 8872 * <p>
8718 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are 8873 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not opposites, nor are
8719 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node. 8874 * they mutually exclusive. In other words, it is possible for both methods to return {@code true}when invoked on the same node.
8720 * @return {@code true} if this expression is in a context where a setter will be invoked 8875 * @return {@code true} if this expression is in a context where a setter will be invoked
8721 */ 8876 */
8722 bool inSetterContext() { 8877 bool inSetterContext() {
8723 ASTNode parent7 = parent; 8878 ASTNode parent9 = parent;
8724 ASTNode target = this; 8879 ASTNode target = this;
8725 if (parent7 is PrefixedIdentifier) { 8880 if (parent9 is PrefixedIdentifier) {
8726 PrefixedIdentifier prefixed = (parent7 as PrefixedIdentifier); 8881 PrefixedIdentifier prefixed = parent9 as PrefixedIdentifier;
8727 if (identical(prefixed.prefix, this)) { 8882 if (identical(prefixed.prefix, this)) {
8728 return false; 8883 return false;
8729 } 8884 }
8730 parent7 = prefixed.parent; 8885 parent9 = prefixed.parent;
8731 target = prefixed; 8886 target = prefixed;
8887 } else if (parent9 is PropertyAccess) {
8888 PropertyAccess access = parent9 as PropertyAccess;
8889 if (identical(access.target, this)) {
8890 return false;
8891 }
8892 parent9 = access.parent;
8893 target = access;
8732 } 8894 }
8733 if (parent7 is PrefixExpression) { 8895 if (parent9 is PrefixExpression) {
8734 return ((parent7 as PrefixExpression)).operator.type.isIncrementOperator() ; 8896 return ((parent9 as PrefixExpression)).operator.type.isIncrementOperator() ;
8735 } else if (parent7 is PostfixExpression) { 8897 } else if (parent9 is PostfixExpression) {
8736 return true; 8898 return true;
8737 } else if (parent7 is AssignmentExpression) { 8899 } else if (parent9 is AssignmentExpression) {
8738 return identical(((parent7 as AssignmentExpression)).leftHandSide, target) ; 8900 return identical(((parent9 as AssignmentExpression)).leftHandSide, target) ;
8739 } 8901 }
8740 return false; 8902 return false;
8741 } 8903 }
8742 bool isSynthetic() => _token.isSynthetic(); 8904 bool isSynthetic() => _token.isSynthetic();
8743 /** 8905 /**
8906 * Set the element associated with this identifier to the given element.
8907 * @param element the element associated with this identifier
8908 */
8909 void set element(Element element16) {
8910 this._element = element16;
8911 }
8912 /**
8744 * Set the token representing the identifier to the given token. 8913 * Set the token representing the identifier to the given token.
8745 * @param token the token representing the literal 8914 * @param token the token representing the literal
8746 */ 8915 */
8747 void set token(Token token12) { 8916 void set token(Token token12) {
8748 this._token = token12; 8917 this._token = token12;
8749 } 8918 }
8750 void visitChildren(ASTVisitor<Object> visitor) { 8919 void visitChildren(ASTVisitor<Object> visitor) {
8751 } 8920 }
8752 } 8921 }
8753 /** 8922 /**
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
9530 } 9699 }
9531 /** 9700 /**
9532 * Initialize a newly created top-level variable declaration. 9701 * Initialize a newly created top-level variable declaration.
9533 * @param comment the documentation comment associated with this variable 9702 * @param comment the documentation comment associated with this variable
9534 * @param metadata the annotations associated with this variable 9703 * @param metadata the annotations associated with this variable
9535 * @param variableList the top-level variables being declared 9704 * @param variableList the top-level variables being declared
9536 * @param semicolon the semicolon terminating the declaration 9705 * @param semicolon the semicolon terminating the declaration
9537 */ 9706 */
9538 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata , variableList, semicolon); 9707 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata , variableList, semicolon);
9539 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); 9708 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this);
9709 Element get element => null;
9540 Token get endToken => _semicolon; 9710 Token get endToken => _semicolon;
9541 /** 9711 /**
9542 * Return the semicolon terminating the declaration. 9712 * Return the semicolon terminating the declaration.
9543 * @return the semicolon terminating the declaration 9713 * @return the semicolon terminating the declaration
9544 */ 9714 */
9545 Token get semicolon => _semicolon; 9715 Token get semicolon => _semicolon;
9546 /** 9716 /**
9547 * Return the top-level variables being declared. 9717 * Return the top-level variables being declared.
9548 * @return the top-level variables being declared 9718 * @return the top-level variables being declared
9549 */ 9719 */
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
9968 * @param bound the name of the upper bound for legal arguments 10138 * @param bound the name of the upper bound for legal arguments
9969 */ 10139 */
9970 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword , bound); 10140 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword , bound);
9971 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); 10141 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this);
9972 /** 10142 /**
9973 * Return the name of the upper bound for legal arguments, or {@code null} if there was no 10143 * Return the name of the upper bound for legal arguments, or {@code null} if there was no
9974 * explicit upper bound. 10144 * explicit upper bound.
9975 * @return the name of the upper bound for legal arguments 10145 * @return the name of the upper bound for legal arguments
9976 */ 10146 */
9977 TypeName get bound => _bound; 10147 TypeName get bound => _bound;
10148 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria bleElement) : null;
9978 Token get endToken { 10149 Token get endToken {
9979 if (_bound == null) { 10150 if (_bound == null) {
9980 return _name.endToken; 10151 return _name.endToken;
9981 } 10152 }
9982 return _bound.endToken; 10153 return _bound.endToken;
9983 } 10154 }
9984 /** 10155 /**
9985 * Return the token representing the 'assert' keyword. 10156 * Return the token representing the 'assert' keyword.
9986 * @return the token representing the 'assert' keyword 10157 * @return the token representing the 'assert' keyword
9987 */ 10158 */
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
10225 /** 10396 /**
10226 * Initialize a newly created variable declaration. 10397 * Initialize a newly created variable declaration.
10227 * @param comment the documentation comment associated with this declaration 10398 * @param comment the documentation comment associated with this declaration
10228 * @param metadata the annotations associated with this member 10399 * @param metadata the annotations associated with this member
10229 * @param name the name of the variable being declared 10400 * @param name the name of the variable being declared
10230 * @param equals the equal sign separating the variable name from the initial value 10401 * @param equals the equal sign separating the variable name from the initial value
10231 * @param initializer the expression used to compute the initial value for the variable 10402 * @param initializer the expression used to compute the initial value for the variable
10232 */ 10403 */
10233 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif ier name, Token equals, Expression initializer}) : this.full(comment, metadata, name, equals, initializer); 10404 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif ier name, Token equals, Expression initializer}) : this.full(comment, metadata, name, equals, initializer);
10234 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); 10405 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this);
10235 /**
10236 * Return the {@link VariableElement} associated with this variable, or {@code null} if the AST
10237 * structure has not been resolved.
10238 * @return the {@link VariableElement} associated with this variable
10239 */
10240 VariableElement get element => _name != null ? (_name.element as VariableEleme nt) : null; 10406 VariableElement get element => _name != null ? (_name.element as VariableEleme nt) : null;
10241 Token get endToken { 10407 Token get endToken {
10242 if (_initializer != null) { 10408 if (_initializer != null) {
10243 return _initializer.endToken; 10409 return _initializer.endToken;
10244 } 10410 }
10245 return _name.endToken; 10411 return _name.endToken;
10246 } 10412 }
10247 /** 10413 /**
10248 * Return the equal sign separating the variable name from the initial value, or {@code null} if 10414 * Return the equal sign separating the variable name from the initial value, or {@code null} if
10249 * the initial value was not specified. 10415 * the initial value was not specified.
10250 * @return the equal sign separating the variable name from the initial value 10416 * @return the equal sign separating the variable name from the initial value
10251 */ 10417 */
10252 Token get equals => _equals; 10418 Token get equals => _equals;
10253 /** 10419 /**
10254 * Return the expression used to compute the initial value for the variable, o r {@code null} if 10420 * Return the expression used to compute the initial value for the variable, o r {@code null} if
10255 * the initial value was not specified. 10421 * the initial value was not specified.
10256 * @return the expression used to compute the initial value for the variable 10422 * @return the expression used to compute the initial value for the variable
10257 */ 10423 */
10258 Expression get initializer => _initializer; 10424 Expression get initializer => _initializer;
10259 /** 10425 /**
10260 * Return the name of the variable being declared. 10426 * Return the name of the variable being declared.
10261 * @return the name of the variable being declared 10427 * @return the name of the variable being declared
10262 */ 10428 */
10263 SimpleIdentifier get name => _name; 10429 SimpleIdentifier get name => _name;
10264 /** 10430 /**
10431 * Return {@code true} if this variable declaration is declared to be a const variable.
10432 * @return {@code true} if this variable is declared to be a const variable
10433 */
10434 bool isConst() {
10435 ASTNode parent10 = parent;
10436 return parent10 is VariableDeclarationList && ((parent10 as VariableDeclarat ionList)).isConst();
10437 }
10438 /**
10439 * Return {@code true} if this variable declaration is declared to be a final variable.
10440 * @return {@code true} if this variable is declared to be a final variable
10441 */
10442 bool isFinal() {
10443 ASTNode parent11 = parent;
10444 return parent11 is VariableDeclarationList && ((parent11 as VariableDeclarat ionList)).isFinal();
10445 }
10446 /**
10265 * Set the equal sign separating the variable name from the initial value to t he given token. 10447 * Set the equal sign separating the variable name from the initial value to t he given token.
10266 * @param equals the equal sign separating the variable name from the initial value 10448 * @param equals the equal sign separating the variable name from the initial value
10267 */ 10449 */
10268 void set equals(Token equals6) { 10450 void set equals(Token equals6) {
10269 this._equals = equals6; 10451 this._equals = equals6;
10270 } 10452 }
10271 /** 10453 /**
10272 * Set the expression used to compute the initial value for the variable to th e given expression. 10454 * Set the expression used to compute the initial value for the variable to th e given expression.
10273 * @param initializer the expression used to compute the initial value for the variable 10455 * @param initializer the expression used to compute the initial value for the variable
10274 */ 10456 */
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
10354 * Return the type of the variables being declared, or {@code null} if no type was provided. 10536 * Return the type of the variables being declared, or {@code null} if no type was provided.
10355 * @return the type of the variables being declared 10537 * @return the type of the variables being declared
10356 */ 10538 */
10357 TypeName get type => _type; 10539 TypeName get type => _type;
10358 /** 10540 /**
10359 * Return a list containing the individual variables being declared. 10541 * Return a list containing the individual variables being declared.
10360 * @return a list containing the individual variables being declared 10542 * @return a list containing the individual variables being declared
10361 */ 10543 */
10362 NodeList<VariableDeclaration> get variables => _variables; 10544 NodeList<VariableDeclaration> get variables => _variables;
10363 /** 10545 /**
10546 * Return {@code true} if the variable declarations in this list are declared to be const
10547 * variables.
10548 * @return {@code true} if the variables in this list are declared to be const variables
10549 */
10550 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT oken)).keyword, Keyword.CONST);
10551 /**
10552 * Return {@code true} if the variable declarations in this list are declared to be final
10553 * variables.
10554 * @return {@code true} if the variables in this list are declared to be final variables
10555 */
10556 bool isFinal() => _keyword is KeywordToken && identical(((_keyword as KeywordT oken)).keyword, Keyword.FINAL);
10557 /**
10364 * Set the token representing the 'final', 'const' or 'var' keyword to the giv en token. 10558 * Set the token representing the 'final', 'const' or 'var' keyword to the giv en token.
10365 * @param keyword the token representing the 'final', 'const' or 'var' keyword 10559 * @param keyword the token representing the 'final', 'const' or 'var' keyword
10366 */ 10560 */
10367 void set keyword(Token keyword24) { 10561 void set keyword(Token keyword24) {
10368 this._keyword = keyword24; 10562 this._keyword = keyword24;
10369 } 10563 }
10370 /** 10564 /**
10371 * Set the type of the variables being declared to the given type name. 10565 * Set the type of the variables being declared to the given type name.
10372 * @param typeName the type of the variables being declared 10566 * @param typeName the type of the variables being declared
10373 */ 10567 */
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
10654 * expressions. 10848 * expressions.
10655 */ 10849 */
10656 static Object NOT_A_CONSTANT = new Object(); 10850 static Object NOT_A_CONSTANT = new Object();
10657 Object visitAdjacentStrings(AdjacentStrings node) { 10851 Object visitAdjacentStrings(AdjacentStrings node) {
10658 StringBuffer builder = new StringBuffer(); 10852 StringBuffer builder = new StringBuffer();
10659 for (StringLiteral string in node.strings) { 10853 for (StringLiteral string in node.strings) {
10660 Object value = string.accept(this); 10854 Object value = string.accept(this);
10661 if (identical(value, NOT_A_CONSTANT)) { 10855 if (identical(value, NOT_A_CONSTANT)) {
10662 return value; 10856 return value;
10663 } 10857 }
10664 builder.add(value); 10858 builder.write(value);
10665 } 10859 }
10666 return builder.toString(); 10860 return builder.toString();
10667 } 10861 }
10668 Object visitBinaryExpression(BinaryExpression node) { 10862 Object visitBinaryExpression(BinaryExpression node) {
10669 Object leftOperand2 = node.leftOperand.accept(this); 10863 Object leftOperand2 = node.leftOperand.accept(this);
10670 if (identical(leftOperand2, NOT_A_CONSTANT)) { 10864 if (identical(leftOperand2, NOT_A_CONSTANT)) {
10671 return leftOperand2; 10865 return leftOperand2;
10672 } 10866 }
10673 Object rightOperand2 = node.rightOperand.accept(this); 10867 Object rightOperand2 = node.rightOperand.accept(this);
10674 if (identical(rightOperand2, NOT_A_CONSTANT)) { 10868 if (identical(rightOperand2, NOT_A_CONSTANT)) {
10675 return rightOperand2; 10869 return rightOperand2;
10676 } 10870 }
10677 if (node.operator.type == TokenType.AMPERSAND) { 10871 while (true) {
10678 if (leftOperand2 is int && rightOperand2 is int) { 10872 if (node.operator.type == TokenType.AMPERSAND) {
10679 return ((leftOperand2 as int)) & (rightOperand2 as int); 10873 if (leftOperand2 is int && rightOperand2 is int) {
10874 return ((leftOperand2 as int)) & (rightOperand2 as int);
10875 }
10876 } else if (node.operator.type == TokenType.AMPERSAND_AMPERSAND) {
10877 if (leftOperand2 is bool && rightOperand2 is bool) {
10878 return ((leftOperand2 as bool)) && ((rightOperand2 as bool));
10879 }
10880 } else if (node.operator.type == TokenType.BANG_EQ) {
10881 if (leftOperand2 is bool && rightOperand2 is bool) {
10882 return ((leftOperand2 as bool)) != ((rightOperand2 as bool));
10883 } else if (leftOperand2 is int && rightOperand2 is int) {
10884 return ((leftOperand2 as int)) != rightOperand2;
10885 } else if (leftOperand2 is double && rightOperand2 is double) {
10886 return ((leftOperand2 as double)) != rightOperand2;
10887 } else if (leftOperand2 is String && rightOperand2 is String) {
10888 return ((leftOperand2 as String)) != rightOperand2;
10889 }
10890 } else if (node.operator.type == TokenType.BAR) {
10891 if (leftOperand2 is int && rightOperand2 is int) {
10892 return ((leftOperand2 as int)) | (rightOperand2 as int);
10893 }
10894 } else if (node.operator.type == TokenType.BAR_BAR) {
10895 if (leftOperand2 is bool && rightOperand2 is bool) {
10896 return ((leftOperand2 as bool)) || ((rightOperand2 as bool));
10897 }
10898 } else if (node.operator.type == TokenType.CARET) {
10899 if (leftOperand2 is int && rightOperand2 is int) {
10900 return ((leftOperand2 as int)) ^ (rightOperand2 as int);
10901 }
10902 } else if (node.operator.type == TokenType.EQ_EQ) {
10903 if (leftOperand2 is bool && rightOperand2 is bool) {
10904 return identical(((leftOperand2 as bool)), ((rightOperand2 as bool)));
10905 } else if (leftOperand2 is int && rightOperand2 is int) {
10906 return ((leftOperand2 as int)) == rightOperand2;
10907 } else if (leftOperand2 is double && rightOperand2 is double) {
10908 return ((leftOperand2 as double)) == rightOperand2;
10909 } else if (leftOperand2 is String && rightOperand2 is String) {
10910 return ((leftOperand2 as String)) == rightOperand2;
10911 }
10912 } else if (node.operator.type == TokenType.GT) {
10913 if (leftOperand2 is int && rightOperand2 is int) {
10914 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) > 0;
10915 } else if (leftOperand2 is double && rightOperand2 is double) {
10916 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) > 0;
10917 }
10918 } else if (node.operator.type == TokenType.GT_EQ) {
10919 if (leftOperand2 is int && rightOperand2 is int) {
10920 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) >= 0;
10921 } else if (leftOperand2 is double && rightOperand2 is double) {
10922 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) >= 0;
10923 }
10924 } else if (node.operator.type == TokenType.GT_GT) {
10925 if (leftOperand2 is int && rightOperand2 is int) {
10926 return ((leftOperand2 as int)) >> ((rightOperand2 as int));
10927 }
10928 } else if (node.operator.type == TokenType.LT) {
10929 if (leftOperand2 is int && rightOperand2 is int) {
10930 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) < 0;
10931 } else if (leftOperand2 is double && rightOperand2 is double) {
10932 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) < 0;
10933 }
10934 } else if (node.operator.type == TokenType.LT_EQ) {
10935 if (leftOperand2 is int && rightOperand2 is int) {
10936 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) <= 0;
10937 } else if (leftOperand2 is double && rightOperand2 is double) {
10938 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) <= 0;
10939 }
10940 } else if (node.operator.type == TokenType.LT_LT) {
10941 if (leftOperand2 is int && rightOperand2 is int) {
10942 return ((leftOperand2 as int)) << ((rightOperand2 as int));
10943 }
10944 } else if (node.operator.type == TokenType.MINUS) {
10945 if (leftOperand2 is int && rightOperand2 is int) {
10946 return ((leftOperand2 as int)) - (rightOperand2 as int);
10947 } else if (leftOperand2 is double && rightOperand2 is double) {
10948 return ((leftOperand2 as double)) - ((rightOperand2 as double));
10949 }
10950 } else if (node.operator.type == TokenType.PERCENT) {
10951 if (leftOperand2 is int && rightOperand2 is int) {
10952 return ((leftOperand2 as int)).remainder((rightOperand2 as int));
10953 } else if (leftOperand2 is double && rightOperand2 is double) {
10954 return ((leftOperand2 as double)) % ((rightOperand2 as double));
10955 }
10956 } else if (node.operator.type == TokenType.PLUS) {
10957 if (leftOperand2 is int && rightOperand2 is int) {
10958 return ((leftOperand2 as int)) + (rightOperand2 as int);
10959 } else if (leftOperand2 is double && rightOperand2 is double) {
10960 return ((leftOperand2 as double)) + ((rightOperand2 as double));
10961 }
10962 } else if (node.operator.type == TokenType.STAR) {
10963 if (leftOperand2 is int && rightOperand2 is int) {
10964 return ((leftOperand2 as int)) * (rightOperand2 as int);
10965 } else if (leftOperand2 is double && rightOperand2 is double) {
10966 return ((leftOperand2 as double)) * ((rightOperand2 as double));
10967 }
10968 } else if (node.operator.type == TokenType.SLASH) {
10969 if (leftOperand2 is int && rightOperand2 is int) {
10970 return ((leftOperand2 as int)) ~/ (rightOperand2 as int);
10971 } else if (leftOperand2 is double && rightOperand2 is double) {
10972 return ((leftOperand2 as double)) / ((rightOperand2 as double));
10973 }
10974 } else if (node.operator.type == TokenType.TILDE_SLASH) {
10975 if (leftOperand2 is int && rightOperand2 is int) {
10976 return ((leftOperand2 as int)) ~/ (rightOperand2 as int);
10977 } else if (leftOperand2 is double && rightOperand2 is double) {
10978 return ((leftOperand2 as double)) ~/ ((rightOperand2 as double));
10979 }
10680 } 10980 }
10681 } else if (node.operator.type == TokenType.AMPERSAND_AMPERSAND) { 10981 break;
10682 if (leftOperand2 is bool && rightOperand2 is bool) {
10683 return ((leftOperand2 as bool)) && ((rightOperand2 as bool));
10684 }
10685 } else if (node.operator.type == TokenType.BANG_EQ) {
10686 if (leftOperand2 is bool && rightOperand2 is bool) {
10687 return ((leftOperand2 as bool)) != ((rightOperand2 as bool));
10688 } else if (leftOperand2 is int && rightOperand2 is int) {
10689 return ((leftOperand2 as int)) != rightOperand2;
10690 } else if (leftOperand2 is double && rightOperand2 is double) {
10691 return ((leftOperand2 as double)) != rightOperand2;
10692 } else if (leftOperand2 is String && rightOperand2 is String) {
10693 return ((leftOperand2 as String)) != rightOperand2;
10694 }
10695 } else if (node.operator.type == TokenType.BAR) {
10696 if (leftOperand2 is int && rightOperand2 is int) {
10697 return ((leftOperand2 as int)) | (rightOperand2 as int);
10698 }
10699 } else if (node.operator.type == TokenType.BAR_BAR) {
10700 if (leftOperand2 is bool && rightOperand2 is bool) {
10701 return ((leftOperand2 as bool)) || ((rightOperand2 as bool));
10702 }
10703 } else if (node.operator.type == TokenType.CARET) {
10704 if (leftOperand2 is int && rightOperand2 is int) {
10705 return ((leftOperand2 as int)) ^ (rightOperand2 as int);
10706 }
10707 } else if (node.operator.type == TokenType.EQ_EQ) {
10708 if (leftOperand2 is bool && rightOperand2 is bool) {
10709 return identical(((leftOperand2 as bool)), ((rightOperand2 as bool)));
10710 } else if (leftOperand2 is int && rightOperand2 is int) {
10711 return ((leftOperand2 as int)) == rightOperand2;
10712 } else if (leftOperand2 is double && rightOperand2 is double) {
10713 return ((leftOperand2 as double)) == rightOperand2;
10714 } else if (leftOperand2 is String && rightOperand2 is String) {
10715 return ((leftOperand2 as String)) == rightOperand2;
10716 }
10717 } else if (node.operator.type == TokenType.GT) {
10718 if (leftOperand2 is int && rightOperand2 is int) {
10719 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) > 0;
10720 } else if (leftOperand2 is double && rightOperand2 is double) {
10721 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) > 0;
10722 }
10723 } else if (node.operator.type == TokenType.GT_EQ) {
10724 if (leftOperand2 is int && rightOperand2 is int) {
10725 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) >= 0;
10726 } else if (leftOperand2 is double && rightOperand2 is double) {
10727 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) > = 0;
10728 }
10729 } else if (node.operator.type == TokenType.GT_GT) {
10730 if (leftOperand2 is int && rightOperand2 is int) {
10731 return ((leftOperand2 as int)) >> ((rightOperand2 as int));
10732 }
10733 } else if (node.operator.type == TokenType.LT) {
10734 if (leftOperand2 is int && rightOperand2 is int) {
10735 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) < 0;
10736 } else if (leftOperand2 is double && rightOperand2 is double) {
10737 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) < 0;
10738 }
10739 } else if (node.operator.type == TokenType.LT_EQ) {
10740 if (leftOperand2 is int && rightOperand2 is int) {
10741 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) <= 0;
10742 } else if (leftOperand2 is double && rightOperand2 is double) {
10743 return ((leftOperand2 as double)).compareTo((rightOperand2 as double)) < = 0;
10744 }
10745 } else if (node.operator.type == TokenType.LT_LT) {
10746 if (leftOperand2 is int && rightOperand2 is int) {
10747 return ((leftOperand2 as int)) << ((rightOperand2 as int));
10748 }
10749 } else if (node.operator.type == TokenType.MINUS) {
10750 if (leftOperand2 is int && rightOperand2 is int) {
10751 return ((leftOperand2 as int)) - (rightOperand2 as int);
10752 } else if (leftOperand2 is double && rightOperand2 is double) {
10753 return ((leftOperand2 as double)) - ((rightOperand2 as double));
10754 }
10755 } else if (node.operator.type == TokenType.PERCENT) {
10756 if (leftOperand2 is int && rightOperand2 is int) {
10757 return ((leftOperand2 as int)).remainder((rightOperand2 as int));
10758 } else if (leftOperand2 is double && rightOperand2 is double) {
10759 return ((leftOperand2 as double)) % ((rightOperand2 as double));
10760 }
10761 } else if (node.operator.type == TokenType.PLUS) {
10762 if (leftOperand2 is int && rightOperand2 is int) {
10763 return ((leftOperand2 as int)) + (rightOperand2 as int);
10764 } else if (leftOperand2 is double && rightOperand2 is double) {
10765 return ((leftOperand2 as double)) + ((rightOperand2 as double));
10766 }
10767 } else if (node.operator.type == TokenType.STAR) {
10768 if (leftOperand2 is int && rightOperand2 is int) {
10769 return ((leftOperand2 as int)) * (rightOperand2 as int);
10770 } else if (leftOperand2 is double && rightOperand2 is double) {
10771 return ((leftOperand2 as double)) * ((rightOperand2 as double));
10772 }
10773 } else if (node.operator.type == TokenType.SLASH) {
10774 if (leftOperand2 is int && rightOperand2 is int) {
10775 return ((leftOperand2 as int)) ~/ (rightOperand2 as int);
10776 } else if (leftOperand2 is double && rightOperand2 is double) {
10777 return ((leftOperand2 as double)) / ((rightOperand2 as double));
10778 }
10779 } else if (node.operator.type == TokenType.TILDE_SLASH) {
10780 if (leftOperand2 is int && rightOperand2 is int) {
10781 return ((leftOperand2 as int)) ~/ (rightOperand2 as int);
10782 } else if (leftOperand2 is double && rightOperand2 is double) {
10783 return ((leftOperand2 as double)) ~/ ((rightOperand2 as double));
10784 }
10785 } 10982 }
10786 return visitExpression(node); 10983 return visitExpression(node);
10787 } 10984 }
10788 Object visitBooleanLiteral(BooleanLiteral node) => node.value ? true : false; 10985 Object visitBooleanLiteral(BooleanLiteral node) => node.value ? true : false;
10789 Object visitDoubleLiteral(DoubleLiteral node) => node.value; 10986 Object visitDoubleLiteral(DoubleLiteral node) => node.value;
10790 Object visitIntegerLiteral(IntegerLiteral node) => node.value; 10987 Object visitIntegerLiteral(IntegerLiteral node) => node.value;
10791 Object visitInterpolationExpression(InterpolationExpression node) { 10988 Object visitInterpolationExpression(InterpolationExpression node) {
10792 Object value = node.expression.accept(this); 10989 Object value = node.expression.accept(this);
10793 if (value == null || value is bool || value is String || value is int || val ue is double) { 10990 if (value == null || value is bool || value is String || value is int || val ue is double) {
10794 return value; 10991 return value;
10795 } 10992 }
10796 return NOT_A_CONSTANT; 10993 return NOT_A_CONSTANT;
10797 } 10994 }
10798 Object visitInterpolationString(InterpolationString node) => node.value; 10995 Object visitInterpolationString(InterpolationString node) => node.value;
10799 Object visitListLiteral(ListLiteral node) { 10996 Object visitListLiteral(ListLiteral node) {
10800 List<Object> list = new List<Object>(); 10997 List<Object> list = new List<Object>();
10801 for (Expression element in node.elements) { 10998 for (Expression element in node.elements) {
10802 Object value = element.accept(this); 10999 Object value = element.accept(this);
10803 if (identical(value, NOT_A_CONSTANT)) { 11000 if (identical(value, NOT_A_CONSTANT)) {
10804 return value; 11001 return value;
10805 } 11002 }
10806 list.add(value); 11003 list.add(value);
10807 } 11004 }
10808 return list; 11005 return list;
10809 } 11006 }
10810 Object visitMapLiteral(MapLiteral node) { 11007 Object visitMapLiteral(MapLiteral node) {
10811 Map<String, Object> map = new Map<String, Object>(); 11008 Map<String, Object> map = new Map<String, Object>();
10812 for (MapLiteralEntry entry in node.entries) { 11009 for (MapLiteralEntry entry in node.entries) {
10813 Object key2 = entry.key.accept(this); 11010 Object key2 = entry.key.accept(this);
10814 Object value7 = entry.value.accept(this); 11011 Object value8 = entry.value.accept(this);
10815 if (key2 is! String || identical(value7, NOT_A_CONSTANT)) { 11012 if (key2 is! String || identical(value8, NOT_A_CONSTANT)) {
10816 return NOT_A_CONSTANT; 11013 return NOT_A_CONSTANT;
10817 } 11014 }
10818 map[(key2 as String)] = value7; 11015 map[(key2 as String)] = value8;
10819 } 11016 }
10820 return map; 11017 return map;
10821 } 11018 }
10822 Object visitMethodInvocation(MethodInvocation node) => visitNode(node); 11019 Object visitMethodInvocation(MethodInvocation node) => visitNode(node);
10823 Object visitNode(ASTNode node) => NOT_A_CONSTANT; 11020 Object visitNode(ASTNode node) => NOT_A_CONSTANT;
10824 Object visitNullLiteral(NullLiteral node) => null; 11021 Object visitNullLiteral(NullLiteral node) => null;
10825 Object visitParenthesizedExpression(ParenthesizedExpression node) => node.expr ession.accept(this); 11022 Object visitParenthesizedExpression(ParenthesizedExpression node) => node.expr ession.accept(this);
10826 Object visitPrefixedIdentifier(PrefixedIdentifier node) => getConstantValue(nu ll); 11023 Object visitPrefixedIdentifier(PrefixedIdentifier node) => getConstantValue(nu ll);
10827 Object visitPrefixExpression(PrefixExpression node) { 11024 Object visitPrefixExpression(PrefixExpression node) {
10828 Object operand2 = node.operand.accept(this); 11025 Object operand2 = node.operand.accept(this);
10829 if (identical(operand2, NOT_A_CONSTANT)) { 11026 if (identical(operand2, NOT_A_CONSTANT)) {
10830 return operand2; 11027 return operand2;
10831 } 11028 }
10832 if (node.operator.type == TokenType.BANG) { 11029 while (true) {
10833 if (identical(operand2, true)) { 11030 if (node.operator.type == TokenType.BANG) {
10834 return false; 11031 if (identical(operand2, true)) {
10835 } else if (identical(operand2, false)) { 11032 return false;
10836 return true; 11033 } else if (identical(operand2, false)) {
11034 return true;
11035 }
11036 } else if (node.operator.type == TokenType.TILDE) {
11037 if (operand2 is int) {
11038 return ~((operand2 as int));
11039 }
11040 } else if (node.operator.type == TokenType.MINUS) {
11041 if (operand2 == null) {
11042 return null;
11043 } else if (operand2 is int) {
11044 return -((operand2 as int));
11045 } else if (operand2 is double) {
11046 return -((operand2 as double));
11047 }
10837 } 11048 }
10838 } else if (node.operator.type == TokenType.TILDE) { 11049 break;
10839 if (operand2 is int) {
10840 return ~((operand2 as int));
10841 }
10842 } else if (node.operator.type == TokenType.MINUS) {
10843 if (operand2 == null) {
10844 return null;
10845 } else if (operand2 is int) {
10846 return -((operand2 as int));
10847 } else if (operand2 is double) {
10848 return -((operand2 as double));
10849 }
10850 } 11050 }
10851 return NOT_A_CONSTANT; 11051 return NOT_A_CONSTANT;
10852 } 11052 }
10853 Object visitPropertyAccess(PropertyAccess node) => getConstantValue(null); 11053 Object visitPropertyAccess(PropertyAccess node) => getConstantValue(null);
10854 Object visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(null); 11054 Object visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(null);
10855 Object visitSimpleStringLiteral(SimpleStringLiteral node) => node.value; 11055 Object visitSimpleStringLiteral(SimpleStringLiteral node) => node.value;
10856 Object visitStringInterpolation(StringInterpolation node) { 11056 Object visitStringInterpolation(StringInterpolation node) {
10857 StringBuffer builder = new StringBuffer(); 11057 StringBuffer builder = new StringBuffer();
10858 for (InterpolationElement element in node.elements) { 11058 for (InterpolationElement element in node.elements) {
10859 Object value = element.accept(this); 11059 Object value = element.accept(this);
10860 if (identical(value, NOT_A_CONSTANT)) { 11060 if (identical(value, NOT_A_CONSTANT)) {
10861 return value; 11061 return value;
10862 } 11062 }
10863 builder.add(value); 11063 builder.write(value);
10864 } 11064 }
10865 return builder.toString(); 11065 return builder.toString();
10866 } 11066 }
10867 /** 11067 /**
10868 * Return the constant value of the static constant represented by the given e lement. 11068 * Return the constant value of the static constant represented by the given e lement.
10869 * @param element the element whose value is to be returned 11069 * @param element the element whose value is to be returned
10870 * @return the constant value of the static constant 11070 * @return the constant value of the static constant
10871 */ 11071 */
10872 Object getConstantValue(Element element) { 11072 Object getConstantValue(Element element) {
10873 if (element is FieldElement) { 11073 if (element is FieldElement) {
10874 FieldElement field = (element as FieldElement); 11074 FieldElement field = element as FieldElement;
10875 if (field.isStatic() && field.isConst()) { 11075 if (field.isStatic() && field.isConst()) {
10876 } 11076 }
10877 } 11077 }
10878 return NOT_A_CONSTANT; 11078 return NOT_A_CONSTANT;
10879 } 11079 }
10880 } 11080 }
10881 /** 11081 /**
11082 * Instances of the class {@code ElementLocator} locate the {@link Element Dart model element}associated with a given {@link ASTNode AST node}.
11083 */
11084 class ElementLocator {
11085 /**
11086 * Locate the {@link Element Dart model element} associated with the given {@l ink ASTNode AST
11087 * node}.
11088 * @param node the node (not {@code null})
11089 * @return the associated element, or {@code null} if none is found
11090 */
11091 static Element locate(ASTNode node) {
11092 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper();
11093 return node.accept(mapper);
11094 }
11095 /**
11096 * Clients should use {@link #locate(ASTNode)}.
11097 */
11098 ElementLocator() {
11099 }
11100 }
11101 /**
11102 * Visitor that maps nodes to elements.
11103 */
11104 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> {
11105 Element visitBinaryExpression(BinaryExpression node) => node.element;
11106 Element visitIdentifier(Identifier node) => node.element;
11107 Element visitImportDirective(ImportDirective node) => node.element;
11108 Element visitIndexExpression(IndexExpression node) => node.element;
11109 Element visitLibraryDirective(LibraryDirective node) => node.element;
11110 Element visitPostfixExpression(PostfixExpression node) => node.element;
11111 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element;
11112 Element visitPrefixExpression(PrefixExpression node) => node.element;
11113 Element visitStringLiteral(StringLiteral node) {
11114 ASTNode parent12 = node.parent;
11115 if (parent12 is UriBasedDirective) {
11116 return ((parent12 as UriBasedDirective)).element;
11117 }
11118 return null;
11119 }
11120 }
11121 /**
10882 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito r that will 11122 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito r that will
10883 * recursively visit all of the nodes in an AST structure (like instances of the class{@link RecursiveASTVisitor}). In addition, when a node of a specific type is visited not only 11123 * recursively visit all of the nodes in an AST structure (like instances of the class{@link RecursiveASTVisitor}). In addition, when a node of a specific type is visited not only
10884 * will the visit method for that specific type of node be invoked, but addition al methods for the 11124 * will the visit method for that specific type of node be invoked, but addition al methods for the
10885 * superclasses of that node will also be invoked. For example, using an instanc e of this class to 11125 * superclasses of that node will also be invoked. For example, using an instanc e of this class to
10886 * visit a {@link Block} will cause the method {@link #visitBlock(Block)} to be invoked but will 11126 * visit a {@link Block} will cause the method {@link #visitBlock(Block)} to be invoked but will
10887 * also cause the methods {@link #visitStatement(Statement)} and {@link #visitNo de(ASTNode)} to be 11127 * also cause the methods {@link #visitStatement(Statement)} and {@link #visitNo de(ASTNode)} to be
10888 * subsequently invoked. This allows visitors to be written that visit all state ments without 11128 * subsequently invoked. This allows visitors to be written that visit all state ments without
10889 * needing to override the visit method for each of the specific subclasses of { @link Statement}. 11129 * needing to override the visit method for each of the specific subclasses of { @link Statement}.
10890 * <p> 11130 * <p>
10891 * Subclasses that override a visit method must either invoke the overridden vis it method or 11131 * Subclasses that override a visit method must either invoke the overridden vis it method or
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
10962 R visitIsExpression(IsExpression node) => visitExpression(node); 11202 R visitIsExpression(IsExpression node) => visitExpression(node);
10963 R visitLabel(Label node) => visitNode(node); 11203 R visitLabel(Label node) => visitNode(node);
10964 R visitLabeledStatement(LabeledStatement node) => visitStatement(node); 11204 R visitLabeledStatement(LabeledStatement node) => visitStatement(node);
10965 R visitLibraryDirective(LibraryDirective node) => visitDirective(node); 11205 R visitLibraryDirective(LibraryDirective node) => visitDirective(node);
10966 R visitLibraryIdentifier(LibraryIdentifier node) => visitIdentifier(node); 11206 R visitLibraryIdentifier(LibraryIdentifier node) => visitIdentifier(node);
10967 R visitListLiteral(ListLiteral node) => visitTypedLiteral(node); 11207 R visitListLiteral(ListLiteral node) => visitTypedLiteral(node);
10968 R visitLiteral(Literal node) => visitExpression(node); 11208 R visitLiteral(Literal node) => visitExpression(node);
10969 R visitMapLiteral(MapLiteral node) => visitTypedLiteral(node); 11209 R visitMapLiteral(MapLiteral node) => visitTypedLiteral(node);
10970 R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node); 11210 R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node);
10971 R visitMethodDeclaration(MethodDeclaration node) => visitClassMember(node); 11211 R visitMethodDeclaration(MethodDeclaration node) => visitClassMember(node);
10972 R visitMethodInvocation(MethodInvocation node) => visitNode(node); 11212 R visitMethodInvocation(MethodInvocation node) => visitExpression(node);
10973 R visitNamedExpression(NamedExpression node) => visitExpression(node); 11213 R visitNamedExpression(NamedExpression node) => visitExpression(node);
10974 R visitNamespaceDirective(NamespaceDirective node) => visitUriBasedDirective(n ode); 11214 R visitNamespaceDirective(NamespaceDirective node) => visitUriBasedDirective(n ode);
10975 R visitNode(ASTNode node) { 11215 R visitNode(ASTNode node) {
10976 node.visitChildren(this); 11216 node.visitChildren(this);
10977 return null; 11217 return null;
10978 } 11218 }
10979 R visitNormalFormalParameter(NormalFormalParameter node) => visitFormalParamet er(node); 11219 R visitNormalFormalParameter(NormalFormalParameter node) => visitFormalParamet er(node);
10980 R visitNullLiteral(NullLiteral node) => visitLiteral(node); 11220 R visitNullLiteral(NullLiteral node) => visitLiteral(node);
10981 R visitParenthesizedExpression(ParenthesizedExpression node) => visitExpressio n(node); 11221 R visitParenthesizedExpression(ParenthesizedExpression node) => visitExpressio n(node);
10982 R visitPartDirective(PartDirective node) => visitUriBasedDirective(node); 11222 R visitPartDirective(PartDirective node) => visitUriBasedDirective(node);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
11037 * The element that was found that corresponds to the given source range, or { @code null} if there 11277 * The element that was found that corresponds to the given source range, or { @code null} if there
11038 * is no such element. 11278 * is no such element.
11039 */ 11279 */
11040 ASTNode _foundNode; 11280 ASTNode _foundNode;
11041 /** 11281 /**
11042 * Initialize a newly created locator to locate one or more {@link ASTNode AST nodes} by locating 11282 * Initialize a newly created locator to locate one or more {@link ASTNode AST nodes} by locating
11043 * the node within an AST structure that corresponds to the given offset in th e source. 11283 * the node within an AST structure that corresponds to the given offset in th e source.
11044 * @param offset the offset used to identify the node 11284 * @param offset the offset used to identify the node
11045 */ 11285 */
11046 NodeLocator.con1(int offset) { 11286 NodeLocator.con1(int offset) {
11047 _jtd_constructor_114_impl(offset); 11287 _jtd_constructor_116_impl(offset);
11048 } 11288 }
11049 _jtd_constructor_114_impl(int offset) { 11289 _jtd_constructor_116_impl(int offset) {
11050 _jtd_constructor_115_impl(offset, offset); 11290 _jtd_constructor_117_impl(offset, offset);
11051 } 11291 }
11052 /** 11292 /**
11053 * Initialize a newly created locator to locate one or more {@link ASTNode AST nodes} by locating 11293 * Initialize a newly created locator to locate one or more {@link ASTNode AST nodes} by locating
11054 * the node within an AST structure that corresponds to the given range of cha racters in the 11294 * the node within an AST structure that corresponds to the given range of cha racters in the
11055 * source. 11295 * source.
11056 * @param start the start offset of the range used to identify the node 11296 * @param start the start offset of the range used to identify the node
11057 * @param end the end offset of the range used to identify the node 11297 * @param end the end offset of the range used to identify the node
11058 */ 11298 */
11059 NodeLocator.con2(int start, int end) { 11299 NodeLocator.con2(int start, int end) {
11060 _jtd_constructor_115_impl(start, end); 11300 _jtd_constructor_117_impl(start, end);
11061 } 11301 }
11062 _jtd_constructor_115_impl(int start, int end) { 11302 _jtd_constructor_117_impl(int start, int end) {
11063 this._startOffset = start; 11303 this._startOffset = start;
11064 this._endOffset = end; 11304 this._endOffset = end;
11065 } 11305 }
11066 /** 11306 /**
11067 * Return the node that was found that corresponds to the given source range, or {@code null} if 11307 * Return the node that was found that corresponds to the given source range, or {@code null} if
11068 * there is no such node. 11308 * there is no such node.
11069 * @return the node that was found 11309 * @return the node that was found
11070 */ 11310 */
11071 ASTNode get foundNode => _foundNode; 11311 ASTNode get foundNode => _foundNode;
11072 /** 11312 /**
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
12446 for (E element in elements) { 12686 for (E element in elements) {
12447 element.accept(visitor); 12687 element.accept(visitor);
12448 } 12688 }
12449 } 12689 }
12450 void add(E node) { 12690 void add(E node) {
12451 owner.becomeParentOf(node); 12691 owner.becomeParentOf(node);
12452 elements.add(node); 12692 elements.add(node);
12453 } 12693 }
12454 bool addAll(Collection<E> nodes) { 12694 bool addAll(Collection<E> nodes) {
12455 if (nodes != null) { 12695 if (nodes != null) {
12456 super.addAll(nodes); 12696 for (E node in nodes) {
12697 add(node);
12698 }
12457 return true; 12699 return true;
12458 } 12700 }
12459 return false; 12701 return false;
12460 } 12702 }
12461 /** 12703 /**
12462 * Return the first token included in this node's source range. 12704 * Return the first token included in this node's source range.
12463 * @return the first token included in this node's source range 12705 * @return the first token included in this node's source range
12464 */ 12706 */
12465 Token get beginToken { 12707 Token get beginToken {
12466 if (elements.isEmpty) { 12708 if (elements.isEmpty) {
(...skipping 12 matching lines...) Expand all
12479 return elements[elements.length - 1].endToken; 12721 return elements[elements.length - 1].endToken;
12480 } 12722 }
12481 /** 12723 /**
12482 * Return the node that is the parent of each of the elements in the list. 12724 * Return the node that is the parent of each of the elements in the list.
12483 * @return the node that is the parent of each of the elements in the list 12725 * @return the node that is the parent of each of the elements in the list
12484 */ 12726 */
12485 ASTNode getOwner() { 12727 ASTNode getOwner() {
12486 return owner; 12728 return owner;
12487 } 12729 }
12488 } 12730 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer-experimental/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698