OLD | NEW |
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 library engine.ast; | 3 library engine.ast; |
4 import 'dart:collection'; | 4 import 'dart:collection'; |
5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
7 import 'error.dart'; | 7 import 'error.dart'; |
8 import 'source.dart' show LineInfo; | 8 import 'source.dart' show LineInfo; |
9 import 'scanner.dart'; | 9 import 'scanner.dart'; |
10 import 'engine.dart' show AnalysisEngine; | 10 import 'engine.dart' show AnalysisEngine; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 * Return the last token included in this node's source range. | 74 * Return the last token included in this node's source range. |
75 * @return the last token included in this node's source range | 75 * @return the last token included in this node's source range |
76 */ | 76 */ |
77 Token get endToken; | 77 Token get endToken; |
78 | 78 |
79 /** | 79 /** |
80 * Return the number of characters in the node's source range. | 80 * Return the number of characters in the node's source range. |
81 * @return the number of characters in the node's source range | 81 * @return the number of characters in the node's source range |
82 */ | 82 */ |
83 int get length { | 83 int get length { |
84 Token beginToken2 = beginToken; | 84 Token beginToken = this.beginToken; |
85 Token endToken2 = endToken; | 85 Token endToken = this.endToken; |
86 if (beginToken2 == null || endToken2 == null) { | 86 if (beginToken == null || endToken == null) { |
87 return -1; | 87 return -1; |
88 } | 88 } |
89 return endToken2.offset + endToken2.length - beginToken2.offset; | 89 return endToken.offset + endToken.length - beginToken.offset; |
90 } | 90 } |
91 | 91 |
92 /** | 92 /** |
93 * Return the offset from the beginning of the file to the first character in
the node's source | 93 * Return the offset from the beginning of the file to the first character in
the node's source |
94 * range. | 94 * range. |
95 * @return the offset from the beginning of the file to the first character in
the node's source | 95 * @return the offset from the beginning of the file to the first character in
the node's source |
96 * range | 96 * range |
97 */ | 97 */ |
98 int get offset { | 98 int get offset { |
99 Token beginToken2 = beginToken; | 99 Token beginToken = this.beginToken; |
100 if (beginToken2 == null) { | 100 if (beginToken == null) { |
101 return -1; | 101 return -1; |
102 } | 102 } |
103 return beginToken.offset; | 103 return beginToken.offset; |
104 } | 104 } |
105 | 105 |
106 /** | 106 /** |
107 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. | 107 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. |
108 * <p> | 108 * <p> |
109 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime | 109 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime |
110 * of a node. | 110 * of a node. |
(...skipping 13 matching lines...) Expand all Loading... |
124 return _propertyMap[propertyName]; | 124 return _propertyMap[propertyName]; |
125 } | 125 } |
126 | 126 |
127 /** | 127 /** |
128 * Return the node at the root of this node's AST structure. Note that this me
thod's performance | 128 * Return the node at the root of this node's AST structure. Note that this me
thod's performance |
129 * is linear with respect to the depth of the node in the AST structure (O(dep
th)). | 129 * is linear with respect to the depth of the node in the AST structure (O(dep
th)). |
130 * @return the node at the root of this node's AST structure | 130 * @return the node at the root of this node's AST structure |
131 */ | 131 */ |
132 ASTNode get root { | 132 ASTNode get root { |
133 ASTNode root = this; | 133 ASTNode root = this; |
134 ASTNode parent2 = parent; | 134 ASTNode parent = this.parent; |
135 while (parent2 != null) { | 135 while (parent != null) { |
136 root = parent2; | 136 root = parent; |
137 parent2 = root.parent; | 137 parent = root.parent; |
138 } | 138 } |
139 return root; | 139 return root; |
140 } | 140 } |
141 | 141 |
142 /** | 142 /** |
143 * Return {@code true} if this node is a synthetic node. A synthetic node is a
node that was | 143 * Return {@code true} if this node is a synthetic node. A synthetic node is a
node that was |
144 * introduced by the parser in order to recover from an error in the code. Syn
thetic nodes always | 144 * introduced by the parser in order to recover from an error in the code. Syn
thetic nodes always |
145 * have a length of zero ({@code 0}). | 145 * have a length of zero ({@code 0}). |
146 * @return {@code true} if this node is a synthetic node | 146 * @return {@code true} if this node is a synthetic node |
147 */ | 147 */ |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 * which the value of the right operand will be bound. Otherwise, return {@cod
e null}. | 1453 * which the value of the right operand will be bound. Otherwise, return {@cod
e null}. |
1454 * <p> | 1454 * <p> |
1455 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 1455 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
1456 * @return the parameter element representing the parameter to which the value
of the right | 1456 * @return the parameter element representing the parameter to which the value
of the right |
1457 * operand will be bound | 1457 * operand will be bound |
1458 */ | 1458 */ |
1459 ParameterElement get propagatedParameterElementForRightOperand { | 1459 ParameterElement get propagatedParameterElementForRightOperand { |
1460 if (_propagatedElement == null) { | 1460 if (_propagatedElement == null) { |
1461 return null; | 1461 return null; |
1462 } | 1462 } |
1463 List<ParameterElement> parameters2 = _propagatedElement.parameters; | 1463 List<ParameterElement> parameters = _propagatedElement.parameters; |
1464 if (parameters2.length < 1) { | 1464 if (parameters.length < 1) { |
1465 return null; | 1465 return null; |
1466 } | 1466 } |
1467 return parameters2[0]; | 1467 return parameters[0]; |
1468 } | 1468 } |
1469 | 1469 |
1470 /** | 1470 /** |
1471 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 1471 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
1472 * type information, then return the parameter element representing the parame
ter to which the | 1472 * type information, then return the parameter element representing the parame
ter to which the |
1473 * value of the right operand will be bound. Otherwise, return {@code null}. | 1473 * value of the right operand will be bound. Otherwise, return {@code null}. |
1474 * <p> | 1474 * <p> |
1475 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. | 1475 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. |
1476 * @return the parameter element representing the parameter to which the value
of the right | 1476 * @return the parameter element representing the parameter to which the value
of the right |
1477 * operand will be bound | 1477 * operand will be bound |
1478 */ | 1478 */ |
1479 ParameterElement get staticParameterElementForRightOperand { | 1479 ParameterElement get staticParameterElementForRightOperand { |
1480 if (_staticElement == null) { | 1480 if (_staticElement == null) { |
1481 return null; | 1481 return null; |
1482 } | 1482 } |
1483 List<ParameterElement> parameters2 = _staticElement.parameters; | 1483 List<ParameterElement> parameters = _staticElement.parameters; |
1484 if (parameters2.length < 1) { | 1484 if (parameters.length < 1) { |
1485 return null; | 1485 return null; |
1486 } | 1486 } |
1487 return parameters2[0]; | 1487 return parameters[0]; |
1488 } | 1488 } |
1489 } | 1489 } |
1490 /** | 1490 /** |
1491 * Instances of the class {@code Block} represent a sequence of statements. | 1491 * Instances of the class {@code Block} represent a sequence of statements. |
1492 * <pre> | 1492 * <pre> |
1493 * block ::= | 1493 * block ::= |
1494 * '{' statement* '}' | 1494 * '{' statement* '}' |
1495 * </pre> | 1495 * </pre> |
1496 * @coverage dart.engine.ast | 1496 * @coverage dart.engine.ast |
1497 */ | 1497 */ |
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 } else if (parserErrors.length == 0) { | 2977 } else if (parserErrors.length == 0) { |
2978 return resolverErrors; | 2978 return resolverErrors; |
2979 } else { | 2979 } else { |
2980 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); | 2980 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); |
2981 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); | 2981 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); |
2982 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); | 2982 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); |
2983 return allErrors; | 2983 return allErrors; |
2984 } | 2984 } |
2985 } | 2985 } |
2986 int get length { | 2986 int get length { |
2987 Token endToken2 = endToken; | 2987 Token endToken = this.endToken; |
2988 if (endToken2 == null) { | 2988 if (endToken == null) { |
2989 return 0; | 2989 return 0; |
2990 } | 2990 } |
2991 return endToken2.offset + endToken2.length; | 2991 return endToken.offset + endToken.length; |
2992 } | 2992 } |
2993 | 2993 |
2994 /** | 2994 /** |
2995 * Get the {@link LineInfo} object for this compilation unit. | 2995 * Get the {@link LineInfo} object for this compilation unit. |
2996 * @return the associated {@link LineInfo} | 2996 * @return the associated {@link LineInfo} |
2997 */ | 2997 */ |
2998 LineInfo get lineInfo => _lineInfo; | 2998 LineInfo get lineInfo => _lineInfo; |
2999 int get offset => 0; | 2999 int get offset => 0; |
3000 | 3000 |
3001 /** | 3001 /** |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4077 * Initialize a newly created formal parameter. | 4077 * Initialize a newly created formal parameter. |
4078 * @param comment the documentation comment associated with this parameter | 4078 * @param comment the documentation comment associated with this parameter |
4079 * @param metadata the annotations associated with this parameter | 4079 * @param metadata the annotations associated with this parameter |
4080 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4080 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
4081 * @param type the name of the declared type of the parameter | 4081 * @param type the name of the declared type of the parameter |
4082 * @param identifier the name of the parameter being declared | 4082 * @param identifier the name of the parameter being declared |
4083 */ | 4083 */ |
4084 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); | 4084 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); |
4085 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); | 4085 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); |
4086 LocalVariableElement get element { | 4086 LocalVariableElement get element { |
4087 SimpleIdentifier identifier2 = identifier; | 4087 SimpleIdentifier identifier = this.identifier; |
4088 if (identifier2 == null) { | 4088 if (identifier == null) { |
4089 return null; | 4089 return null; |
4090 } | 4090 } |
4091 return identifier2.element as LocalVariableElement; | 4091 return identifier.element as LocalVariableElement; |
4092 } | 4092 } |
4093 Token get endToken => _identifier.endToken; | 4093 Token get endToken => _identifier.endToken; |
4094 | 4094 |
4095 /** | 4095 /** |
4096 * Return the name of the variable being declared. | 4096 * Return the name of the variable being declared. |
4097 * @return the name of the variable being declared | 4097 * @return the name of the variable being declared |
4098 */ | 4098 */ |
4099 SimpleIdentifier get identifier => _identifier; | 4099 SimpleIdentifier get identifier => _identifier; |
4100 | 4100 |
4101 /** | 4101 /** |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4733 * @param comment the documentation comment associated with this directive | 4733 * @param comment the documentation comment associated with this directive |
4734 * @param metadata the annotations associated with the directive | 4734 * @param metadata the annotations associated with the directive |
4735 * @param keyword the token representing the 'export' keyword | 4735 * @param keyword the token representing the 'export' keyword |
4736 * @param libraryUri the URI of the library being exported | 4736 * @param libraryUri the URI of the library being exported |
4737 * @param combinators the combinators used to control which names are exported | 4737 * @param combinators the combinators used to control which names are exported |
4738 * @param semicolon the semicolon terminating the directive | 4738 * @param semicolon the semicolon terminating the directive |
4739 */ | 4739 */ |
4740 ExportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : this.f
ull(comment, metadata, keyword, libraryUri, combinators, semicolon); | 4740 ExportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : this.f
ull(comment, metadata, keyword, libraryUri, combinators, semicolon); |
4741 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); | 4741 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); |
4742 LibraryElement get uriElement { | 4742 LibraryElement get uriElement { |
4743 Element element2 = element; | 4743 Element element = this.element; |
4744 if (element2 is ExportElement) { | 4744 if (element is ExportElement) { |
4745 return ((element2 as ExportElement)).exportedLibrary; | 4745 return ((element as ExportElement)).exportedLibrary; |
4746 } | 4746 } |
4747 return null; | 4747 return null; |
4748 } | 4748 } |
4749 void visitChildren(ASTVisitor<Object> visitor) { | 4749 void visitChildren(ASTVisitor<Object> visitor) { |
4750 super.visitChildren(visitor); | 4750 super.visitChildren(visitor); |
4751 combinators.accept(visitor); | 4751 combinators.accept(visitor); |
4752 } | 4752 } |
4753 } | 4753 } |
4754 /** | 4754 /** |
4755 * Instances of the class {@code Expression} defines the behavior common to node
s that represent an | 4755 * Instances of the class {@code Expression} defines the behavior common to node
s that represent an |
(...skipping 19 matching lines...) Expand all Loading... |
4775 /** | 4775 /** |
4776 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, | 4776 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, |
4777 * and the function being invoked is known based on propagated type informatio
n, and this | 4777 * and the function being invoked is known based on propagated type informatio
n, and this |
4778 * expression corresponds to one of the parameters of the function being invok
ed, then return the | 4778 * expression corresponds to one of the parameters of the function being invok
ed, then return the |
4779 * parameter element representing the parameter to which the value of this exp
ression will be | 4779 * parameter element representing the parameter to which the value of this exp
ression will be |
4780 * bound. Otherwise, return {@code null}. | 4780 * bound. Otherwise, return {@code null}. |
4781 * @return the parameter element representing the parameter to which the value
of this expression | 4781 * @return the parameter element representing the parameter to which the value
of this expression |
4782 * will be bound | 4782 * will be bound |
4783 */ | 4783 */ |
4784 ParameterElement get parameterElement { | 4784 ParameterElement get parameterElement { |
4785 ASTNode parent2 = parent; | 4785 ASTNode parent = this.parent; |
4786 if (parent2 is ArgumentList) { | 4786 if (parent is ArgumentList) { |
4787 return ((parent2 as ArgumentList)).getPropagatedParameterElementFor(this); | 4787 return ((parent as ArgumentList)).getPropagatedParameterElementFor(this); |
4788 } else if (parent2 is IndexExpression) { | 4788 } else if (parent is IndexExpression) { |
4789 IndexExpression indexExpression = parent2 as IndexExpression; | 4789 IndexExpression indexExpression = parent as IndexExpression; |
4790 if (identical(indexExpression.index, this)) { | 4790 if (identical(indexExpression.index, this)) { |
4791 return indexExpression.propagatedParameterElementForIndex; | 4791 return indexExpression.propagatedParameterElementForIndex; |
4792 } | 4792 } |
4793 } else if (parent2 is BinaryExpression) { | 4793 } else if (parent is BinaryExpression) { |
4794 BinaryExpression binaryExpression = parent2 as BinaryExpression; | 4794 BinaryExpression binaryExpression = parent as BinaryExpression; |
4795 if (identical(binaryExpression.rightOperand, this)) { | 4795 if (identical(binaryExpression.rightOperand, this)) { |
4796 return binaryExpression.propagatedParameterElementForRightOperand; | 4796 return binaryExpression.propagatedParameterElementForRightOperand; |
4797 } | 4797 } |
4798 } else if (parent2 is PrefixExpression) { | 4798 } else if (parent is PrefixExpression) { |
4799 return ((parent2 as PrefixExpression)).propagatedParameterElementForOperan
d; | 4799 return ((parent as PrefixExpression)).propagatedParameterElementForOperand
; |
4800 } else if (parent2 is PostfixExpression) { | 4800 } else if (parent is PostfixExpression) { |
4801 return ((parent2 as PostfixExpression)).propagatedParameterElementForOpera
nd; | 4801 return ((parent as PostfixExpression)).propagatedParameterElementForOperan
d; |
4802 } | 4802 } |
4803 return null; | 4803 return null; |
4804 } | 4804 } |
4805 | 4805 |
4806 /** | 4806 /** |
4807 * Return the propagated type of this expression, or {@code null} if type prop
agation has not been | 4807 * Return the propagated type of this expression, or {@code null} if type prop
agation has not been |
4808 * performed on the AST structure. | 4808 * performed on the AST structure. |
4809 * @return the propagated type of this expression | 4809 * @return the propagated type of this expression |
4810 */ | 4810 */ |
4811 Type2 get propagatedType => _propagatedType; | 4811 Type2 get propagatedType => _propagatedType; |
4812 | 4812 |
4813 /** | 4813 /** |
4814 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, | 4814 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, |
4815 * and the function being invoked is known based on static type information, a
nd this expression | 4815 * and the function being invoked is known based on static type information, a
nd this expression |
4816 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter | 4816 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter |
4817 * element representing the parameter to which the value of this expression wi
ll be bound. | 4817 * element representing the parameter to which the value of this expression wi
ll be bound. |
4818 * Otherwise, return {@code null}. | 4818 * Otherwise, return {@code null}. |
4819 * @return the parameter element representing the parameter to which the value
of this expression | 4819 * @return the parameter element representing the parameter to which the value
of this expression |
4820 * will be bound | 4820 * will be bound |
4821 */ | 4821 */ |
4822 ParameterElement get staticParameterElement { | 4822 ParameterElement get staticParameterElement { |
4823 ASTNode parent2 = parent; | 4823 ASTNode parent = this.parent; |
4824 if (parent2 is ArgumentList) { | 4824 if (parent is ArgumentList) { |
4825 return ((parent2 as ArgumentList)).getStaticParameterElementFor(this); | 4825 return ((parent as ArgumentList)).getStaticParameterElementFor(this); |
4826 } else if (parent2 is IndexExpression) { | 4826 } else if (parent is IndexExpression) { |
4827 IndexExpression indexExpression = parent2 as IndexExpression; | 4827 IndexExpression indexExpression = parent as IndexExpression; |
4828 if (identical(indexExpression.index, this)) { | 4828 if (identical(indexExpression.index, this)) { |
4829 return indexExpression.staticParameterElementForIndex; | 4829 return indexExpression.staticParameterElementForIndex; |
4830 } | 4830 } |
4831 } else if (parent2 is BinaryExpression) { | 4831 } else if (parent is BinaryExpression) { |
4832 BinaryExpression binaryExpression = parent2 as BinaryExpression; | 4832 BinaryExpression binaryExpression = parent as BinaryExpression; |
4833 if (identical(binaryExpression.rightOperand, this)) { | 4833 if (identical(binaryExpression.rightOperand, this)) { |
4834 return binaryExpression.staticParameterElementForRightOperand; | 4834 return binaryExpression.staticParameterElementForRightOperand; |
4835 } | 4835 } |
4836 } else if (parent2 is PrefixExpression) { | 4836 } else if (parent is PrefixExpression) { |
4837 return ((parent2 as PrefixExpression)).staticParameterElementForOperand; | 4837 return ((parent as PrefixExpression)).staticParameterElementForOperand; |
4838 } else if (parent2 is PostfixExpression) { | 4838 } else if (parent is PostfixExpression) { |
4839 return ((parent2 as PostfixExpression)).staticParameterElementForOperand; | 4839 return ((parent as PostfixExpression)).staticParameterElementForOperand; |
4840 } | 4840 } |
4841 return null; | 4841 return null; |
4842 } | 4842 } |
4843 | 4843 |
4844 /** | 4844 /** |
4845 * Return the static type of this expression, or {@code null} if the AST struc
ture has not been | 4845 * Return the static type of this expression, or {@code null} if the AST struc
ture has not been |
4846 * resolved. | 4846 * resolved. |
4847 * @return the static type of this expression | 4847 * @return the static type of this expression |
4848 */ | 4848 */ |
4849 Type2 get staticType => _staticType; | 4849 Type2 get staticType => _staticType; |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5804 * @coverage dart.engine.ast | 5804 * @coverage dart.engine.ast |
5805 */ | 5805 */ |
5806 abstract class FormalParameter extends ASTNode { | 5806 abstract class FormalParameter extends ASTNode { |
5807 | 5807 |
5808 /** | 5808 /** |
5809 * Return the element representing this parameter, or {@code null} if this par
ameter has not been | 5809 * Return the element representing this parameter, or {@code null} if this par
ameter has not been |
5810 * resolved. | 5810 * resolved. |
5811 * @return the element representing this parameter | 5811 * @return the element representing this parameter |
5812 */ | 5812 */ |
5813 ParameterElement get element { | 5813 ParameterElement get element { |
5814 SimpleIdentifier identifier2 = identifier; | 5814 SimpleIdentifier identifier = this.identifier; |
5815 if (identifier2 == null) { | 5815 if (identifier == null) { |
5816 return null; | 5816 return null; |
5817 } | 5817 } |
5818 return identifier2.element as ParameterElement; | 5818 return identifier.element as ParameterElement; |
5819 } | 5819 } |
5820 | 5820 |
5821 /** | 5821 /** |
5822 * Return the name of the parameter being declared. | 5822 * Return the name of the parameter being declared. |
5823 * @return the name of the parameter being declared | 5823 * @return the name of the parameter being declared |
5824 */ | 5824 */ |
5825 SimpleIdentifier get identifier; | 5825 SimpleIdentifier get identifier; |
5826 | 5826 |
5827 /** | 5827 /** |
5828 * Return the kind of this parameter. | 5828 * Return the kind of this parameter. |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7065 */ | 7065 */ |
7066 Token get asToken => _asToken; | 7066 Token get asToken => _asToken; |
7067 | 7067 |
7068 /** | 7068 /** |
7069 * Return the prefix to be used with the imported names, or {@code null} if th
e imported names are | 7069 * Return the prefix to be used with the imported names, or {@code null} if th
e imported names are |
7070 * not prefixed. | 7070 * not prefixed. |
7071 * @return the prefix to be used with the imported names | 7071 * @return the prefix to be used with the imported names |
7072 */ | 7072 */ |
7073 SimpleIdentifier get prefix => _prefix; | 7073 SimpleIdentifier get prefix => _prefix; |
7074 LibraryElement get uriElement { | 7074 LibraryElement get uriElement { |
7075 Element element2 = element; | 7075 Element element = this.element; |
7076 if (element2 is ImportElement) { | 7076 if (element is ImportElement) { |
7077 return ((element2 as ImportElement)).importedLibrary; | 7077 return ((element as ImportElement)).importedLibrary; |
7078 } | 7078 } |
7079 return null; | 7079 return null; |
7080 } | 7080 } |
7081 | 7081 |
7082 /** | 7082 /** |
7083 * Set the token representing the 'as' token to the given token. | 7083 * Set the token representing the 'as' token to the given token. |
7084 * @param asToken the token representing the 'as' token | 7084 * @param asToken the token representing the 'as' token |
7085 */ | 7085 */ |
7086 void set asToken(Token asToken2) { | 7086 void set asToken(Token asToken2) { |
7087 this._asToken = asToken2; | 7087 this._asToken = asToken2; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7280 MethodElement get staticElement => _staticElement; | 7280 MethodElement get staticElement => _staticElement; |
7281 | 7281 |
7282 /** | 7282 /** |
7283 * Return {@code true} if this expression is computing a right-hand value. | 7283 * Return {@code true} if this expression is computing a right-hand value. |
7284 * <p> | 7284 * <p> |
7285 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 7285 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
7286 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 7286 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
7287 * @return {@code true} if this expression is in a context where the operator
'\[\]' will be invoked | 7287 * @return {@code true} if this expression is in a context where the operator
'\[\]' will be invoked |
7288 */ | 7288 */ |
7289 bool inGetterContext() { | 7289 bool inGetterContext() { |
7290 ASTNode parent2 = parent; | 7290 ASTNode parent = this.parent; |
7291 if (parent2 is AssignmentExpression) { | 7291 if (parent is AssignmentExpression) { |
7292 AssignmentExpression assignment = parent2 as AssignmentExpression; | 7292 AssignmentExpression assignment = parent as AssignmentExpression; |
7293 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { | 7293 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { |
7294 return false; | 7294 return false; |
7295 } | 7295 } |
7296 } | 7296 } |
7297 return true; | 7297 return true; |
7298 } | 7298 } |
7299 | 7299 |
7300 /** | 7300 /** |
7301 * Return {@code true} if this expression is computing a left-hand value. | 7301 * Return {@code true} if this expression is computing a left-hand value. |
7302 * <p> | 7302 * <p> |
7303 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 7303 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
7304 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 7304 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
7305 * @return {@code true} if this expression is in a context where the operator
'\[\]=' will be | 7305 * @return {@code true} if this expression is in a context where the operator
'\[\]=' will be |
7306 * invoked | 7306 * invoked |
7307 */ | 7307 */ |
7308 bool inSetterContext() { | 7308 bool inSetterContext() { |
7309 ASTNode parent2 = parent; | 7309 ASTNode parent = this.parent; |
7310 if (parent2 is PrefixExpression) { | 7310 if (parent is PrefixExpression) { |
7311 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; | 7311 return ((parent as PrefixExpression)).operator.type.isIncrementOperator(); |
7312 } else if (parent2 is PostfixExpression) { | 7312 } else if (parent is PostfixExpression) { |
7313 return true; | 7313 return true; |
7314 } else if (parent2 is AssignmentExpression) { | 7314 } else if (parent is AssignmentExpression) { |
7315 return identical(((parent2 as AssignmentExpression)).leftHandSide, this); | 7315 return identical(((parent as AssignmentExpression)).leftHandSide, this); |
7316 } | 7316 } |
7317 return false; | 7317 return false; |
7318 } | 7318 } |
7319 bool isAssignable() => true; | 7319 bool isAssignable() => true; |
7320 | 7320 |
7321 /** | 7321 /** |
7322 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this | 7322 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this |
7323 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. | 7323 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. |
7324 * @return {@code true} if this expression is cascaded | 7324 * @return {@code true} if this expression is cascaded |
7325 */ | 7325 */ |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7393 * which the value of the index expression will be bound. Otherwise, return {@
code null}. | 7393 * which the value of the index expression will be bound. Otherwise, return {@
code null}. |
7394 * <p> | 7394 * <p> |
7395 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 7395 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
7396 * @return the parameter element representing the parameter to which the value
of the index | 7396 * @return the parameter element representing the parameter to which the value
of the index |
7397 * expression will be bound | 7397 * expression will be bound |
7398 */ | 7398 */ |
7399 ParameterElement get propagatedParameterElementForIndex { | 7399 ParameterElement get propagatedParameterElementForIndex { |
7400 if (_propagatedElement == null) { | 7400 if (_propagatedElement == null) { |
7401 return null; | 7401 return null; |
7402 } | 7402 } |
7403 List<ParameterElement> parameters2 = _propagatedElement.parameters; | 7403 List<ParameterElement> parameters = _propagatedElement.parameters; |
7404 if (parameters2.length < 1) { | 7404 if (parameters.length < 1) { |
7405 return null; | 7405 return null; |
7406 } | 7406 } |
7407 return parameters2[0]; | 7407 return parameters[0]; |
7408 } | 7408 } |
7409 | 7409 |
7410 /** | 7410 /** |
7411 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 7411 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
7412 * type information, then return the parameter element representing the parame
ter to which the | 7412 * type information, then return the parameter element representing the parame
ter to which the |
7413 * value of the index expression will be bound. Otherwise, return {@code null}
. | 7413 * value of the index expression will be bound. Otherwise, return {@code null}
. |
7414 * <p> | 7414 * <p> |
7415 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. | 7415 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. |
7416 * @return the parameter element representing the parameter to which the value
of the index | 7416 * @return the parameter element representing the parameter to which the value
of the index |
7417 * expression will be bound | 7417 * expression will be bound |
7418 */ | 7418 */ |
7419 ParameterElement get staticParameterElementForIndex { | 7419 ParameterElement get staticParameterElementForIndex { |
7420 if (_staticElement == null) { | 7420 if (_staticElement == null) { |
7421 return null; | 7421 return null; |
7422 } | 7422 } |
7423 List<ParameterElement> parameters2 = _staticElement.parameters; | 7423 List<ParameterElement> parameters = _staticElement.parameters; |
7424 if (parameters2.length < 1) { | 7424 if (parameters.length < 1) { |
7425 return null; | 7425 return null; |
7426 } | 7426 } |
7427 return parameters2[0]; | 7427 return parameters[0]; |
7428 } | 7428 } |
7429 } | 7429 } |
7430 /** | 7430 /** |
7431 * Instances of the class {@code InstanceCreationExpression} represent an instan
ce creation | 7431 * Instances of the class {@code InstanceCreationExpression} represent an instan
ce creation |
7432 * expression. | 7432 * expression. |
7433 * <pre> | 7433 * <pre> |
7434 * newExpression ::= | 7434 * newExpression ::= |
7435 * ('new' | 'const') {@link TypeName type} ('.' {@link SimpleIdentifier identifi
er})? {@link ArgumentList argumentList}</pre> | 7435 * ('new' | 'const') {@link TypeName type} ('.' {@link SimpleIdentifier identifi
er})? {@link ArgumentList argumentList}</pre> |
7436 * @coverage dart.engine.ast | 7436 * @coverage dart.engine.ast |
7437 */ | 7437 */ |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8284 * @param elements the expressions used to compute the elements of the list | 8284 * @param elements the expressions used to compute the elements of the list |
8285 * @param rightBracket the right square bracket | 8285 * @param rightBracket the right square bracket |
8286 */ | 8286 */ |
8287 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); | 8287 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); |
8288 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); | 8288 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); |
8289 Token get beginToken { | 8289 Token get beginToken { |
8290 Token token = modifier; | 8290 Token token = modifier; |
8291 if (token != null) { | 8291 if (token != null) { |
8292 return token; | 8292 return token; |
8293 } | 8293 } |
8294 TypeArgumentList typeArguments2 = typeArguments; | 8294 TypeArgumentList typeArguments = this.typeArguments; |
8295 if (typeArguments2 != null) { | 8295 if (typeArguments != null) { |
8296 return typeArguments2.beginToken; | 8296 return typeArguments.beginToken; |
8297 } | 8297 } |
8298 return _leftBracket; | 8298 return _leftBracket; |
8299 } | 8299 } |
8300 | 8300 |
8301 /** | 8301 /** |
8302 * Return the expressions used to compute the elements of the list. | 8302 * Return the expressions used to compute the elements of the list. |
8303 * @return the expressions used to compute the elements of the list | 8303 * @return the expressions used to compute the elements of the list |
8304 */ | 8304 */ |
8305 NodeList<Expression> get elements => _elements; | 8305 NodeList<Expression> get elements => _elements; |
8306 Token get endToken => _rightBracket; | 8306 Token get endToken => _rightBracket; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8396 * @param entries the entries in the map | 8396 * @param entries the entries in the map |
8397 * @param rightBracket the right curly bracket | 8397 * @param rightBracket the right curly bracket |
8398 */ | 8398 */ |
8399 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); | 8399 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); |
8400 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); | 8400 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); |
8401 Token get beginToken { | 8401 Token get beginToken { |
8402 Token token = modifier; | 8402 Token token = modifier; |
8403 if (token != null) { | 8403 if (token != null) { |
8404 return token; | 8404 return token; |
8405 } | 8405 } |
8406 TypeArgumentList typeArguments2 = typeArguments; | 8406 TypeArgumentList typeArguments = this.typeArguments; |
8407 if (typeArguments2 != null) { | 8407 if (typeArguments != null) { |
8408 return typeArguments2.beginToken; | 8408 return typeArguments.beginToken; |
8409 } | 8409 } |
8410 return _leftBracket; | 8410 return _leftBracket; |
8411 } | 8411 } |
8412 Token get endToken => _rightBracket; | 8412 Token get endToken => _rightBracket; |
8413 | 8413 |
8414 /** | 8414 /** |
8415 * Return the entries in the map. | 8415 * Return the entries in the map. |
8416 * @return the entries in the map | 8416 * @return the entries in the map |
8417 */ | 8417 */ |
8418 NodeList<MapLiteralEntry> get entries => _entries; | 8418 NodeList<MapLiteralEntry> get entries => _entries; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9012 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); | 9012 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); |
9013 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); | 9013 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); |
9014 Token get beginToken => _name.beginToken; | 9014 Token get beginToken => _name.beginToken; |
9015 | 9015 |
9016 /** | 9016 /** |
9017 * 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 | 9017 * 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 |
9018 * this expression. | 9018 * this expression. |
9019 * @return the element representing the parameter being named by this expressi
on | 9019 * @return the element representing the parameter being named by this expressi
on |
9020 */ | 9020 */ |
9021 ParameterElement get element { | 9021 ParameterElement get element { |
9022 Element element2 = _name.label.element; | 9022 Element element = _name.label.element; |
9023 if (element2 is ParameterElement) { | 9023 if (element is ParameterElement) { |
9024 return element2 as ParameterElement; | 9024 return element as ParameterElement; |
9025 } | 9025 } |
9026 return null; | 9026 return null; |
9027 } | 9027 } |
9028 Token get endToken => _expression.endToken; | 9028 Token get endToken => _expression.endToken; |
9029 | 9029 |
9030 /** | 9030 /** |
9031 * Return the expression with which the name is associated. | 9031 * Return the expression with which the name is associated. |
9032 * @return the expression with which the name is associated | 9032 * @return the expression with which the name is associated |
9033 */ | 9033 */ |
9034 Expression get expression => _expression; | 9034 Expression get expression => _expression; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9261 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); | 9261 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); |
9262 | 9262 |
9263 /** | 9263 /** |
9264 * Return the documentation comment associated with this parameter, or {@code
null} if this | 9264 * Return the documentation comment associated with this parameter, or {@code
null} if this |
9265 * parameter does not have a documentation comment associated with it. | 9265 * parameter does not have a documentation comment associated with it. |
9266 * @return the documentation comment associated with this parameter | 9266 * @return the documentation comment associated with this parameter |
9267 */ | 9267 */ |
9268 Comment get documentationComment => _comment; | 9268 Comment get documentationComment => _comment; |
9269 SimpleIdentifier get identifier => _identifier; | 9269 SimpleIdentifier get identifier => _identifier; |
9270 ParameterKind get kind { | 9270 ParameterKind get kind { |
9271 ASTNode parent2 = parent; | 9271 ASTNode parent = this.parent; |
9272 if (parent2 is DefaultFormalParameter) { | 9272 if (parent is DefaultFormalParameter) { |
9273 return ((parent2 as DefaultFormalParameter)).kind; | 9273 return ((parent as DefaultFormalParameter)).kind; |
9274 } | 9274 } |
9275 return ParameterKind.REQUIRED; | 9275 return ParameterKind.REQUIRED; |
9276 } | 9276 } |
9277 | 9277 |
9278 /** | 9278 /** |
9279 * Return the annotations associated with this parameter. | 9279 * Return the annotations associated with this parameter. |
9280 * @return the annotations associated with this parameter | 9280 * @return the annotations associated with this parameter |
9281 */ | 9281 */ |
9282 NodeList<Annotation> get metadata => _metadata; | 9282 NodeList<Annotation> get metadata => _metadata; |
9283 | 9283 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9805 * which the value of the operand will be bound. Otherwise, return {@code null
}. | 9805 * which the value of the operand will be bound. Otherwise, return {@code null
}. |
9806 * <p> | 9806 * <p> |
9807 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 9807 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
9808 * @return the parameter element representing the parameter to which the value
of the right | 9808 * @return the parameter element representing the parameter to which the value
of the right |
9809 * operand will be bound | 9809 * operand will be bound |
9810 */ | 9810 */ |
9811 ParameterElement get propagatedParameterElementForOperand { | 9811 ParameterElement get propagatedParameterElementForOperand { |
9812 if (_propagatedElement == null) { | 9812 if (_propagatedElement == null) { |
9813 return null; | 9813 return null; |
9814 } | 9814 } |
9815 List<ParameterElement> parameters2 = _propagatedElement.parameters; | 9815 List<ParameterElement> parameters = _propagatedElement.parameters; |
9816 if (parameters2.length < 1) { | 9816 if (parameters.length < 1) { |
9817 return null; | 9817 return null; |
9818 } | 9818 } |
9819 return parameters2[0]; | 9819 return parameters[0]; |
9820 } | 9820 } |
9821 | 9821 |
9822 /** | 9822 /** |
9823 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 9823 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
9824 * type information, then return the parameter element representing the parame
ter to which the | 9824 * type information, then return the parameter element representing the parame
ter to which the |
9825 * value of the operand will be bound. Otherwise, return {@code null}. | 9825 * value of the operand will be bound. Otherwise, return {@code null}. |
9826 * <p> | 9826 * <p> |
9827 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. | 9827 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. |
9828 * @return the parameter element representing the parameter to which the value
of the right | 9828 * @return the parameter element representing the parameter to which the value
of the right |
9829 * operand will be bound | 9829 * operand will be bound |
9830 */ | 9830 */ |
9831 ParameterElement get staticParameterElementForOperand { | 9831 ParameterElement get staticParameterElementForOperand { |
9832 if (_staticElement == null) { | 9832 if (_staticElement == null) { |
9833 return null; | 9833 return null; |
9834 } | 9834 } |
9835 List<ParameterElement> parameters2 = _staticElement.parameters; | 9835 List<ParameterElement> parameters = _staticElement.parameters; |
9836 if (parameters2.length < 1) { | 9836 if (parameters.length < 1) { |
9837 return null; | 9837 return null; |
9838 } | 9838 } |
9839 return parameters2[0]; | 9839 return parameters[0]; |
9840 } | 9840 } |
9841 } | 9841 } |
9842 /** | 9842 /** |
9843 * Instances of the class {@code PrefixExpression} represent a prefix unary expr
ession. | 9843 * Instances of the class {@code PrefixExpression} represent a prefix unary expr
ession. |
9844 * <pre> | 9844 * <pre> |
9845 * prefixExpression ::={@link Token operator} {@link Expression operand}</pre> | 9845 * prefixExpression ::={@link Token operator} {@link Expression operand}</pre> |
9846 * @coverage dart.engine.ast | 9846 * @coverage dart.engine.ast |
9847 */ | 9847 */ |
9848 class PrefixExpression extends Expression { | 9848 class PrefixExpression extends Expression { |
9849 | 9849 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9960 * which the value of the operand will be bound. Otherwise, return {@code null
}. | 9960 * which the value of the operand will be bound. Otherwise, return {@code null
}. |
9961 * <p> | 9961 * <p> |
9962 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 9962 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
9963 * @return the parameter element representing the parameter to which the value
of the right | 9963 * @return the parameter element representing the parameter to which the value
of the right |
9964 * operand will be bound | 9964 * operand will be bound |
9965 */ | 9965 */ |
9966 ParameterElement get propagatedParameterElementForOperand { | 9966 ParameterElement get propagatedParameterElementForOperand { |
9967 if (_propagatedElement == null) { | 9967 if (_propagatedElement == null) { |
9968 return null; | 9968 return null; |
9969 } | 9969 } |
9970 List<ParameterElement> parameters2 = _propagatedElement.parameters; | 9970 List<ParameterElement> parameters = _propagatedElement.parameters; |
9971 if (parameters2.length < 1) { | 9971 if (parameters.length < 1) { |
9972 return null; | 9972 return null; |
9973 } | 9973 } |
9974 return parameters2[0]; | 9974 return parameters[0]; |
9975 } | 9975 } |
9976 | 9976 |
9977 /** | 9977 /** |
9978 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 9978 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
9979 * type information, then return the parameter element representing the parame
ter to which the | 9979 * type information, then return the parameter element representing the parame
ter to which the |
9980 * value of the operand will be bound. Otherwise, return {@code null}. | 9980 * value of the operand will be bound. Otherwise, return {@code null}. |
9981 * <p> | 9981 * <p> |
9982 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. | 9982 * This method is only intended to be used by {@link Expression#getStaticParam
eterElement()}. |
9983 * @return the parameter element representing the parameter to which the value
of the right | 9983 * @return the parameter element representing the parameter to which the value
of the right |
9984 * operand will be bound | 9984 * operand will be bound |
9985 */ | 9985 */ |
9986 ParameterElement get staticParameterElementForOperand { | 9986 ParameterElement get staticParameterElementForOperand { |
9987 if (_staticElement == null) { | 9987 if (_staticElement == null) { |
9988 return null; | 9988 return null; |
9989 } | 9989 } |
9990 List<ParameterElement> parameters2 = _staticElement.parameters; | 9990 List<ParameterElement> parameters = _staticElement.parameters; |
9991 if (parameters2.length < 1) { | 9991 if (parameters.length < 1) { |
9992 return null; | 9992 return null; |
9993 } | 9993 } |
9994 return parameters2[0]; | 9994 return parameters[0]; |
9995 } | 9995 } |
9996 } | 9996 } |
9997 /** | 9997 /** |
9998 * Instances of the class {@code PrefixedIdentifier} represent either an identif
ier that is prefixed | 9998 * Instances of the class {@code PrefixedIdentifier} represent either an identif
ier that is prefixed |
9999 * or an access to an object property where the target of the property access is
a simple | 9999 * or an access to an object property where the target of the property access is
a simple |
10000 * identifier. | 10000 * identifier. |
10001 * <pre> | 10001 * <pre> |
10002 * prefixedIdentifier ::={@link SimpleIdentifier prefix} '.' {@link SimpleIdenti
fier identifier}</pre> | 10002 * prefixedIdentifier ::={@link SimpleIdentifier prefix} '.' {@link SimpleIdenti
fier identifier}</pre> |
10003 * @coverage dart.engine.ast | 10003 * @coverage dart.engine.ast |
10004 */ | 10004 */ |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10777 * Return the token representing the identifier. | 10777 * Return the token representing the identifier. |
10778 * @return the token representing the identifier | 10778 * @return the token representing the identifier |
10779 */ | 10779 */ |
10780 Token get token => _token; | 10780 Token get token => _token; |
10781 | 10781 |
10782 /** | 10782 /** |
10783 * Return {@code true} if this identifier is the name being declared in a decl
aration. | 10783 * Return {@code true} if this identifier is the name being declared in a decl
aration. |
10784 * @return {@code true} if this identifier is the name being declared in a dec
laration | 10784 * @return {@code true} if this identifier is the name being declared in a dec
laration |
10785 */ | 10785 */ |
10786 bool inDeclarationContext() { | 10786 bool inDeclarationContext() { |
10787 ASTNode parent2 = parent; | 10787 ASTNode parent = this.parent; |
10788 if (parent2 is CatchClause) { | 10788 if (parent is CatchClause) { |
10789 CatchClause clause = parent2 as CatchClause; | 10789 CatchClause clause = parent as CatchClause; |
10790 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); | 10790 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); |
10791 } else if (parent2 is ClassDeclaration) { | 10791 } else if (parent is ClassDeclaration) { |
10792 return identical(this, ((parent2 as ClassDeclaration)).name); | 10792 return identical(this, ((parent as ClassDeclaration)).name); |
10793 } else if (parent2 is ClassTypeAlias) { | 10793 } else if (parent is ClassTypeAlias) { |
10794 return identical(this, ((parent2 as ClassTypeAlias)).name); | 10794 return identical(this, ((parent as ClassTypeAlias)).name); |
10795 } else if (parent2 is ConstructorDeclaration) { | 10795 } else if (parent is ConstructorDeclaration) { |
10796 return identical(this, ((parent2 as ConstructorDeclaration)).name); | 10796 return identical(this, ((parent as ConstructorDeclaration)).name); |
10797 } else if (parent2 is FunctionDeclaration) { | 10797 } else if (parent is FunctionDeclaration) { |
10798 return identical(this, ((parent2 as FunctionDeclaration)).name); | 10798 return identical(this, ((parent as FunctionDeclaration)).name); |
10799 } else if (parent2 is FunctionTypeAlias) { | 10799 } else if (parent is FunctionTypeAlias) { |
10800 return identical(this, ((parent2 as FunctionTypeAlias)).name); | 10800 return identical(this, ((parent as FunctionTypeAlias)).name); |
10801 } else if (parent2 is Label) { | 10801 } else if (parent is Label) { |
10802 return identical(this, ((parent2 as Label)).label) && (parent2.parent is L
abeledStatement); | 10802 return identical(this, ((parent as Label)).label) && (parent.parent is Lab
eledStatement); |
10803 } else if (parent2 is MethodDeclaration) { | 10803 } else if (parent is MethodDeclaration) { |
10804 return identical(this, ((parent2 as MethodDeclaration)).name); | 10804 return identical(this, ((parent as MethodDeclaration)).name); |
10805 } else if (parent2 is FunctionTypedFormalParameter || parent2 is SimpleForma
lParameter) { | 10805 } else if (parent is FunctionTypedFormalParameter || parent is SimpleFormalP
arameter) { |
10806 return identical(this, ((parent2 as NormalFormalParameter)).identifier); | 10806 return identical(this, ((parent as NormalFormalParameter)).identifier); |
10807 } else if (parent2 is TypeParameter) { | 10807 } else if (parent is TypeParameter) { |
10808 return identical(this, ((parent2 as TypeParameter)).name); | 10808 return identical(this, ((parent as TypeParameter)).name); |
10809 } else if (parent2 is VariableDeclaration) { | 10809 } else if (parent is VariableDeclaration) { |
10810 return identical(this, ((parent2 as VariableDeclaration)).name); | 10810 return identical(this, ((parent as VariableDeclaration)).name); |
10811 } | 10811 } |
10812 return false; | 10812 return false; |
10813 } | 10813 } |
10814 | 10814 |
10815 /** | 10815 /** |
10816 * Return {@code true} if this expression is computing a right-hand value. | 10816 * Return {@code true} if this expression is computing a right-hand value. |
10817 * <p> | 10817 * <p> |
10818 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 10818 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
10819 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 10819 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
10820 * @return {@code true} if this expression is in a context where a getter will
be invoked | 10820 * @return {@code true} if this expression is in a context where a getter will
be invoked |
10821 */ | 10821 */ |
10822 bool inGetterContext() { | 10822 bool inGetterContext() { |
10823 ASTNode parent2 = parent; | 10823 ASTNode parent = this.parent; |
10824 ASTNode target = this; | 10824 ASTNode target = this; |
10825 if (parent2 is PrefixedIdentifier) { | 10825 if (parent is PrefixedIdentifier) { |
10826 PrefixedIdentifier prefixed = parent2 as PrefixedIdentifier; | 10826 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; |
10827 if (identical(prefixed.prefix, this)) { | 10827 if (identical(prefixed.prefix, this)) { |
10828 return true; | 10828 return true; |
10829 } | 10829 } |
10830 parent2 = prefixed.parent; | 10830 parent = prefixed.parent; |
10831 target = prefixed; | 10831 target = prefixed; |
10832 } else if (parent2 is PropertyAccess) { | 10832 } else if (parent is PropertyAccess) { |
10833 PropertyAccess access = parent2 as PropertyAccess; | 10833 PropertyAccess access = parent as PropertyAccess; |
10834 if (identical(access.target, this)) { | 10834 if (identical(access.target, this)) { |
10835 return true; | 10835 return true; |
10836 } | 10836 } |
10837 parent2 = access.parent; | 10837 parent = access.parent; |
10838 target = access; | 10838 target = access; |
10839 } | 10839 } |
10840 if (parent2 is Label) { | 10840 if (parent is Label) { |
10841 return false; | 10841 return false; |
10842 } | 10842 } |
10843 if (parent2 is AssignmentExpression) { | 10843 if (parent is AssignmentExpression) { |
10844 AssignmentExpression expr = parent2 as AssignmentExpression; | 10844 AssignmentExpression expr = parent as AssignmentExpression; |
10845 if (identical(expr.leftHandSide, target) && identical(expr.operator.type,
TokenType.EQ)) { | 10845 if (identical(expr.leftHandSide, target) && identical(expr.operator.type,
TokenType.EQ)) { |
10846 return false; | 10846 return false; |
10847 } | 10847 } |
10848 } | 10848 } |
10849 return true; | 10849 return true; |
10850 } | 10850 } |
10851 | 10851 |
10852 /** | 10852 /** |
10853 * Return {@code true} if this expression is computing a left-hand value. | 10853 * Return {@code true} if this expression is computing a left-hand value. |
10854 * <p> | 10854 * <p> |
10855 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 10855 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
10856 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 10856 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
10857 * @return {@code true} if this expression is in a context where a setter will
be invoked | 10857 * @return {@code true} if this expression is in a context where a setter will
be invoked |
10858 */ | 10858 */ |
10859 bool inSetterContext() { | 10859 bool inSetterContext() { |
10860 ASTNode parent2 = parent; | 10860 ASTNode parent = this.parent; |
10861 ASTNode target = this; | 10861 ASTNode target = this; |
10862 if (parent2 is PrefixedIdentifier) { | 10862 if (parent is PrefixedIdentifier) { |
10863 PrefixedIdentifier prefixed = parent2 as PrefixedIdentifier; | 10863 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; |
10864 if (identical(prefixed.prefix, this)) { | 10864 if (identical(prefixed.prefix, this)) { |
10865 return false; | 10865 return false; |
10866 } | 10866 } |
10867 parent2 = prefixed.parent; | 10867 parent = prefixed.parent; |
10868 target = prefixed; | 10868 target = prefixed; |
10869 } else if (parent2 is PropertyAccess) { | 10869 } else if (parent is PropertyAccess) { |
10870 PropertyAccess access = parent2 as PropertyAccess; | 10870 PropertyAccess access = parent as PropertyAccess; |
10871 if (identical(access.target, this)) { | 10871 if (identical(access.target, this)) { |
10872 return false; | 10872 return false; |
10873 } | 10873 } |
10874 parent2 = access.parent; | 10874 parent = access.parent; |
10875 target = access; | 10875 target = access; |
10876 } | 10876 } |
10877 if (parent2 is PrefixExpression) { | 10877 if (parent is PrefixExpression) { |
10878 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; | 10878 return ((parent as PrefixExpression)).operator.type.isIncrementOperator(); |
10879 } else if (parent2 is PostfixExpression) { | 10879 } else if (parent is PostfixExpression) { |
10880 return true; | 10880 return true; |
10881 } else if (parent2 is AssignmentExpression) { | 10881 } else if (parent is AssignmentExpression) { |
10882 return identical(((parent2 as AssignmentExpression)).leftHandSide, target)
; | 10882 return identical(((parent as AssignmentExpression)).leftHandSide, target); |
10883 } | 10883 } |
10884 return false; | 10884 return false; |
10885 } | 10885 } |
10886 bool isSynthetic() => _token.isSynthetic(); | 10886 bool isSynthetic() => _token.isSynthetic(); |
10887 | 10887 |
10888 /** | 10888 /** |
10889 * Set the element associated with this identifier based on propagated type in
formation to the | 10889 * Set the element associated with this identifier based on propagated type in
formation to the |
10890 * given element. | 10890 * given element. |
10891 * @param element the element to be associated with this identifier | 10891 * @param element the element to be associated with this identifier |
10892 */ | 10892 */ |
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12696 * Return the name of the variable being declared. | 12696 * Return the name of the variable being declared. |
12697 * @return the name of the variable being declared | 12697 * @return the name of the variable being declared |
12698 */ | 12698 */ |
12699 SimpleIdentifier get name => _name; | 12699 SimpleIdentifier get name => _name; |
12700 | 12700 |
12701 /** | 12701 /** |
12702 * Return {@code true} if this variable was declared with the 'const' modifier
. | 12702 * Return {@code true} if this variable was declared with the 'const' modifier
. |
12703 * @return {@code true} if this variable was declared with the 'const' modifie
r | 12703 * @return {@code true} if this variable was declared with the 'const' modifie
r |
12704 */ | 12704 */ |
12705 bool isConst() { | 12705 bool isConst() { |
12706 ASTNode parent2 = parent; | 12706 ASTNode parent = this.parent; |
12707 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isConst(); | 12707 return parent is VariableDeclarationList && ((parent as VariableDeclarationL
ist)).isConst(); |
12708 } | 12708 } |
12709 | 12709 |
12710 /** | 12710 /** |
12711 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are | 12711 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are |
12712 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly | 12712 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly |
12713 * final. | 12713 * final. |
12714 * @return {@code true} if this variable was declared with the 'final' modifie
r | 12714 * @return {@code true} if this variable was declared with the 'final' modifie
r |
12715 */ | 12715 */ |
12716 bool isFinal() { | 12716 bool isFinal() { |
12717 ASTNode parent2 = parent; | 12717 ASTNode parent = this.parent; |
12718 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isFinal(); | 12718 return parent is VariableDeclarationList && ((parent as VariableDeclarationL
ist)).isFinal(); |
12719 } | 12719 } |
12720 | 12720 |
12721 /** | 12721 /** |
12722 * Set the equal sign separating the variable name from the initial value to t
he given token. | 12722 * Set the equal sign separating the variable name from the initial value to t
he given token. |
12723 * @param equals the equal sign separating the variable name from the initial
value | 12723 * @param equals the equal sign separating the variable name from the initial
value |
12724 */ | 12724 */ |
12725 void set equals(Token equals2) { | 12725 void set equals(Token equals2) { |
12726 this._equals = equals2; | 12726 this._equals = equals2; |
12727 } | 12727 } |
12728 | 12728 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13221 for (StringLiteral string in node.strings) { | 13221 for (StringLiteral string in node.strings) { |
13222 Object value = string.accept(this); | 13222 Object value = string.accept(this); |
13223 if (identical(value, NOT_A_CONSTANT)) { | 13223 if (identical(value, NOT_A_CONSTANT)) { |
13224 return value; | 13224 return value; |
13225 } | 13225 } |
13226 builder.append(value); | 13226 builder.append(value); |
13227 } | 13227 } |
13228 return builder.toString(); | 13228 return builder.toString(); |
13229 } | 13229 } |
13230 Object visitBinaryExpression(BinaryExpression node) { | 13230 Object visitBinaryExpression(BinaryExpression node) { |
13231 Object leftOperand2 = node.leftOperand.accept(this); | 13231 Object leftOperand = node.leftOperand.accept(this); |
13232 if (identical(leftOperand2, NOT_A_CONSTANT)) { | 13232 if (identical(leftOperand, NOT_A_CONSTANT)) { |
13233 return leftOperand2; | 13233 return leftOperand; |
13234 } | 13234 } |
13235 Object rightOperand2 = node.rightOperand.accept(this); | 13235 Object rightOperand = node.rightOperand.accept(this); |
13236 if (identical(rightOperand2, NOT_A_CONSTANT)) { | 13236 if (identical(rightOperand, NOT_A_CONSTANT)) { |
13237 return rightOperand2; | 13237 return rightOperand; |
13238 } | 13238 } |
13239 while (true) { | 13239 while (true) { |
13240 if (node.operator.type == TokenType.AMPERSAND) { | 13240 if (node.operator.type == TokenType.AMPERSAND) { |
13241 if (leftOperand2 is int && rightOperand2 is int) { | 13241 if (leftOperand is int && rightOperand is int) { |
13242 return ((leftOperand2 as int)) & (rightOperand2 as int); | 13242 return ((leftOperand as int)) & (rightOperand as int); |
13243 } | 13243 } |
13244 } else if (node.operator.type == TokenType.AMPERSAND_AMPERSAND) { | 13244 } else if (node.operator.type == TokenType.AMPERSAND_AMPERSAND) { |
13245 if (leftOperand2 is bool && rightOperand2 is bool) { | 13245 if (leftOperand is bool && rightOperand is bool) { |
13246 return ((leftOperand2 as bool)) && ((rightOperand2 as bool)); | 13246 return ((leftOperand as bool)) && ((rightOperand as bool)); |
13247 } | 13247 } |
13248 } else if (node.operator.type == TokenType.BANG_EQ) { | 13248 } else if (node.operator.type == TokenType.BANG_EQ) { |
13249 if (leftOperand2 is bool && rightOperand2 is bool) { | 13249 if (leftOperand is bool && rightOperand is bool) { |
13250 return ((leftOperand2 as bool)) != ((rightOperand2 as bool)); | 13250 return ((leftOperand as bool)) != ((rightOperand as bool)); |
13251 } else if (leftOperand2 is int && rightOperand2 is int) { | 13251 } else if (leftOperand is int && rightOperand is int) { |
13252 return ((leftOperand2 as int)) != rightOperand2; | 13252 return ((leftOperand as int)) != rightOperand; |
13253 } else if (leftOperand2 is double && rightOperand2 is double) { | 13253 } else if (leftOperand is double && rightOperand is double) { |
13254 return ((leftOperand2 as double)) != rightOperand2; | 13254 return ((leftOperand as double)) != rightOperand; |
13255 } else if (leftOperand2 is String && rightOperand2 is String) { | 13255 } else if (leftOperand is String && rightOperand is String) { |
13256 return ((leftOperand2 as String)) != rightOperand2; | 13256 return ((leftOperand as String)) != rightOperand; |
13257 } | 13257 } |
13258 } else if (node.operator.type == TokenType.BAR) { | 13258 } else if (node.operator.type == TokenType.BAR) { |
13259 if (leftOperand2 is int && rightOperand2 is int) { | 13259 if (leftOperand is int && rightOperand is int) { |
13260 return ((leftOperand2 as int)) | (rightOperand2 as int); | 13260 return ((leftOperand as int)) | (rightOperand as int); |
13261 } | 13261 } |
13262 } else if (node.operator.type == TokenType.BAR_BAR) { | 13262 } else if (node.operator.type == TokenType.BAR_BAR) { |
13263 if (leftOperand2 is bool && rightOperand2 is bool) { | 13263 if (leftOperand is bool && rightOperand is bool) { |
13264 return ((leftOperand2 as bool)) || ((rightOperand2 as bool)); | 13264 return ((leftOperand as bool)) || ((rightOperand as bool)); |
13265 } | 13265 } |
13266 } else if (node.operator.type == TokenType.CARET) { | 13266 } else if (node.operator.type == TokenType.CARET) { |
13267 if (leftOperand2 is int && rightOperand2 is int) { | 13267 if (leftOperand is int && rightOperand is int) { |
13268 return ((leftOperand2 as int)) ^ (rightOperand2 as int); | 13268 return ((leftOperand as int)) ^ (rightOperand as int); |
13269 } | 13269 } |
13270 } else if (node.operator.type == TokenType.EQ_EQ) { | 13270 } else if (node.operator.type == TokenType.EQ_EQ) { |
13271 if (leftOperand2 is bool && rightOperand2 is bool) { | 13271 if (leftOperand is bool && rightOperand is bool) { |
13272 return identical(((leftOperand2 as bool)), ((rightOperand2 as bool))); | 13272 return identical(((leftOperand as bool)), ((rightOperand as bool))); |
13273 } else if (leftOperand2 is int && rightOperand2 is int) { | 13273 } else if (leftOperand is int && rightOperand is int) { |
13274 return ((leftOperand2 as int)) == rightOperand2; | 13274 return ((leftOperand as int)) == rightOperand; |
13275 } else if (leftOperand2 is double && rightOperand2 is double) { | 13275 } else if (leftOperand is double && rightOperand is double) { |
13276 return ((leftOperand2 as double)) == rightOperand2; | 13276 return ((leftOperand as double)) == rightOperand; |
13277 } else if (leftOperand2 is String && rightOperand2 is String) { | 13277 } else if (leftOperand is String && rightOperand is String) { |
13278 return ((leftOperand2 as String)) == rightOperand2; | 13278 return ((leftOperand as String)) == rightOperand; |
13279 } | 13279 } |
13280 } else if (node.operator.type == TokenType.GT) { | 13280 } else if (node.operator.type == TokenType.GT) { |
13281 if (leftOperand2 is int && rightOperand2 is int) { | 13281 if (leftOperand is int && rightOperand is int) { |
13282 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) > 0; | 13282 return ((leftOperand as int)).compareTo((rightOperand as int)) > 0; |
13283 } else if (leftOperand2 is double && rightOperand2 is double) { | 13283 } else if (leftOperand is double && rightOperand is double) { |
13284 return ((leftOperand2 as double)).compareTo((rightOperand2 as double))
> 0; | 13284 return ((leftOperand as double)).compareTo((rightOperand as double)) >
0; |
13285 } | 13285 } |
13286 } else if (node.operator.type == TokenType.GT_EQ) { | 13286 } else if (node.operator.type == TokenType.GT_EQ) { |
13287 if (leftOperand2 is int && rightOperand2 is int) { | 13287 if (leftOperand is int && rightOperand is int) { |
13288 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) >= 0; | 13288 return ((leftOperand as int)).compareTo((rightOperand as int)) >= 0; |
13289 } else if (leftOperand2 is double && rightOperand2 is double) { | 13289 } else if (leftOperand is double && rightOperand is double) { |
13290 return ((leftOperand2 as double)).compareTo((rightOperand2 as double))
>= 0; | 13290 return ((leftOperand as double)).compareTo((rightOperand as double)) >
= 0; |
13291 } | 13291 } |
13292 } else if (node.operator.type == TokenType.GT_GT) { | 13292 } else if (node.operator.type == TokenType.GT_GT) { |
13293 if (leftOperand2 is int && rightOperand2 is int) { | 13293 if (leftOperand is int && rightOperand is int) { |
13294 return ((leftOperand2 as int)) >> ((rightOperand2 as int)); | 13294 return ((leftOperand as int)) >> ((rightOperand as int)); |
13295 } | 13295 } |
13296 } else if (node.operator.type == TokenType.LT) { | 13296 } else if (node.operator.type == TokenType.LT) { |
13297 if (leftOperand2 is int && rightOperand2 is int) { | 13297 if (leftOperand is int && rightOperand is int) { |
13298 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) < 0; | 13298 return ((leftOperand as int)).compareTo((rightOperand as int)) < 0; |
13299 } else if (leftOperand2 is double && rightOperand2 is double) { | 13299 } else if (leftOperand is double && rightOperand is double) { |
13300 return ((leftOperand2 as double)).compareTo((rightOperand2 as double))
< 0; | 13300 return ((leftOperand as double)).compareTo((rightOperand as double)) <
0; |
13301 } | 13301 } |
13302 } else if (node.operator.type == TokenType.LT_EQ) { | 13302 } else if (node.operator.type == TokenType.LT_EQ) { |
13303 if (leftOperand2 is int && rightOperand2 is int) { | 13303 if (leftOperand is int && rightOperand is int) { |
13304 return ((leftOperand2 as int)).compareTo((rightOperand2 as int)) <= 0; | 13304 return ((leftOperand as int)).compareTo((rightOperand as int)) <= 0; |
13305 } else if (leftOperand2 is double && rightOperand2 is double) { | 13305 } else if (leftOperand is double && rightOperand is double) { |
13306 return ((leftOperand2 as double)).compareTo((rightOperand2 as double))
<= 0; | 13306 return ((leftOperand as double)).compareTo((rightOperand as double)) <
= 0; |
13307 } | 13307 } |
13308 } else if (node.operator.type == TokenType.LT_LT) { | 13308 } else if (node.operator.type == TokenType.LT_LT) { |
13309 if (leftOperand2 is int && rightOperand2 is int) { | 13309 if (leftOperand is int && rightOperand is int) { |
13310 return ((leftOperand2 as int)) << ((rightOperand2 as int)); | 13310 return ((leftOperand as int)) << ((rightOperand as int)); |
13311 } | 13311 } |
13312 } else if (node.operator.type == TokenType.MINUS) { | 13312 } else if (node.operator.type == TokenType.MINUS) { |
13313 if (leftOperand2 is int && rightOperand2 is int) { | 13313 if (leftOperand is int && rightOperand is int) { |
13314 return ((leftOperand2 as int)) - (rightOperand2 as int); | 13314 return ((leftOperand as int)) - (rightOperand as int); |
13315 } else if (leftOperand2 is double && rightOperand2 is double) { | 13315 } else if (leftOperand is double && rightOperand is double) { |
13316 return ((leftOperand2 as double)) - ((rightOperand2 as double)); | 13316 return ((leftOperand as double)) - ((rightOperand as double)); |
13317 } | 13317 } |
13318 } else if (node.operator.type == TokenType.PERCENT) { | 13318 } else if (node.operator.type == TokenType.PERCENT) { |
13319 if (leftOperand2 is int && rightOperand2 is int) { | 13319 if (leftOperand is int && rightOperand is int) { |
13320 return ((leftOperand2 as int)).remainder((rightOperand2 as int)); | 13320 return ((leftOperand as int)).remainder((rightOperand as int)); |
13321 } else if (leftOperand2 is double && rightOperand2 is double) { | 13321 } else if (leftOperand is double && rightOperand is double) { |
13322 return ((leftOperand2 as double)) % ((rightOperand2 as double)); | 13322 return ((leftOperand as double)) % ((rightOperand as double)); |
13323 } | 13323 } |
13324 } else if (node.operator.type == TokenType.PLUS) { | 13324 } else if (node.operator.type == TokenType.PLUS) { |
13325 if (leftOperand2 is int && rightOperand2 is int) { | 13325 if (leftOperand is int && rightOperand is int) { |
13326 return ((leftOperand2 as int)) + (rightOperand2 as int); | 13326 return ((leftOperand as int)) + (rightOperand as int); |
13327 } else if (leftOperand2 is double && rightOperand2 is double) { | 13327 } else if (leftOperand is double && rightOperand is double) { |
13328 return ((leftOperand2 as double)) + ((rightOperand2 as double)); | 13328 return ((leftOperand as double)) + ((rightOperand as double)); |
13329 } | 13329 } |
13330 } else if (node.operator.type == TokenType.STAR) { | 13330 } else if (node.operator.type == TokenType.STAR) { |
13331 if (leftOperand2 is int && rightOperand2 is int) { | 13331 if (leftOperand is int && rightOperand is int) { |
13332 return ((leftOperand2 as int)) * (rightOperand2 as int); | 13332 return ((leftOperand as int)) * (rightOperand as int); |
13333 } else if (leftOperand2 is double && rightOperand2 is double) { | 13333 } else if (leftOperand is double && rightOperand is double) { |
13334 return ((leftOperand2 as double)) * ((rightOperand2 as double)); | 13334 return ((leftOperand as double)) * ((rightOperand as double)); |
13335 } | 13335 } |
13336 } else if (node.operator.type == TokenType.SLASH) { | 13336 } else if (node.operator.type == TokenType.SLASH) { |
13337 if (leftOperand2 is int && rightOperand2 is int) { | 13337 if (leftOperand is int && rightOperand is int) { |
13338 if (rightOperand2 != 0) { | 13338 if (rightOperand != 0) { |
13339 return ((leftOperand2 as int)) ~/ (rightOperand2 as int); | 13339 return ((leftOperand as int)) ~/ (rightOperand as int); |
13340 } else { | 13340 } else { |
13341 return ((leftOperand2 as int)).toDouble() / ((rightOperand2 as int))
.toDouble(); | 13341 return ((leftOperand as int)).toDouble() / ((rightOperand as int)).t
oDouble(); |
13342 } | 13342 } |
13343 } else if (leftOperand2 is double && rightOperand2 is double) { | 13343 } else if (leftOperand is double && rightOperand is double) { |
13344 return ((leftOperand2 as double)) / ((rightOperand2 as double)); | 13344 return ((leftOperand as double)) / ((rightOperand as double)); |
13345 } | 13345 } |
13346 } else if (node.operator.type == TokenType.TILDE_SLASH) { | 13346 } else if (node.operator.type == TokenType.TILDE_SLASH) { |
13347 if (leftOperand2 is int && rightOperand2 is int) { | 13347 if (leftOperand is int && rightOperand is int) { |
13348 if (rightOperand2 != 0) { | 13348 if (rightOperand != 0) { |
13349 return ((leftOperand2 as int)) ~/ (rightOperand2 as int); | 13349 return ((leftOperand as int)) ~/ (rightOperand as int); |
13350 } else { | 13350 } else { |
13351 return 0; | 13351 return 0; |
13352 } | 13352 } |
13353 } else if (leftOperand2 is double && rightOperand2 is double) { | 13353 } else if (leftOperand is double && rightOperand is double) { |
13354 return ((leftOperand2 as double)) ~/ ((rightOperand2 as double)); | 13354 return ((leftOperand as double)) ~/ ((rightOperand as double)); |
13355 } | 13355 } |
13356 } | 13356 } |
13357 break; | 13357 break; |
13358 } | 13358 } |
13359 return visitExpression(node); | 13359 return visitExpression(node); |
13360 } | 13360 } |
13361 Object visitBooleanLiteral(BooleanLiteral node) => node.value ? true : false; | 13361 Object visitBooleanLiteral(BooleanLiteral node) => node.value ? true : false; |
13362 Object visitDoubleLiteral(DoubleLiteral node) => node.value; | 13362 Object visitDoubleLiteral(DoubleLiteral node) => node.value; |
13363 Object visitIntegerLiteral(IntegerLiteral node) => node.value; | 13363 Object visitIntegerLiteral(IntegerLiteral node) => node.value; |
13364 Object visitInterpolationExpression(InterpolationExpression node) { | 13364 Object visitInterpolationExpression(InterpolationExpression node) { |
(...skipping 11 matching lines...) Expand all Loading... |
13376 if (identical(value, NOT_A_CONSTANT)) { | 13376 if (identical(value, NOT_A_CONSTANT)) { |
13377 return value; | 13377 return value; |
13378 } | 13378 } |
13379 list.add(value); | 13379 list.add(value); |
13380 } | 13380 } |
13381 return list; | 13381 return list; |
13382 } | 13382 } |
13383 Object visitMapLiteral(MapLiteral node) { | 13383 Object visitMapLiteral(MapLiteral node) { |
13384 Map<String, Object> map = new Map<String, Object>(); | 13384 Map<String, Object> map = new Map<String, Object>(); |
13385 for (MapLiteralEntry entry in node.entries) { | 13385 for (MapLiteralEntry entry in node.entries) { |
13386 Object key2 = entry.key.accept(this); | 13386 Object key = entry.key.accept(this); |
13387 Object value2 = entry.value.accept(this); | 13387 Object value = entry.value.accept(this); |
13388 if (key2 is! String || identical(value2, NOT_A_CONSTANT)) { | 13388 if (key is! String || identical(value, NOT_A_CONSTANT)) { |
13389 return NOT_A_CONSTANT; | 13389 return NOT_A_CONSTANT; |
13390 } | 13390 } |
13391 map[(key2 as String)] = value2; | 13391 map[(key as String)] = value; |
13392 } | 13392 } |
13393 return map; | 13393 return map; |
13394 } | 13394 } |
13395 Object visitMethodInvocation(MethodInvocation node) => visitNode(node); | 13395 Object visitMethodInvocation(MethodInvocation node) => visitNode(node); |
13396 Object visitNode(ASTNode node) => NOT_A_CONSTANT; | 13396 Object visitNode(ASTNode node) => NOT_A_CONSTANT; |
13397 Object visitNullLiteral(NullLiteral node) => null; | 13397 Object visitNullLiteral(NullLiteral node) => null; |
13398 Object visitParenthesizedExpression(ParenthesizedExpression node) => node.expr
ession.accept(this); | 13398 Object visitParenthesizedExpression(ParenthesizedExpression node) => node.expr
ession.accept(this); |
13399 Object visitPrefixedIdentifier(PrefixedIdentifier node) => getConstantValue(nu
ll); | 13399 Object visitPrefixedIdentifier(PrefixedIdentifier node) => getConstantValue(nu
ll); |
13400 Object visitPrefixExpression(PrefixExpression node) { | 13400 Object visitPrefixExpression(PrefixExpression node) { |
13401 Object operand2 = node.operand.accept(this); | 13401 Object operand = node.operand.accept(this); |
13402 if (identical(operand2, NOT_A_CONSTANT)) { | 13402 if (identical(operand, NOT_A_CONSTANT)) { |
13403 return operand2; | 13403 return operand; |
13404 } | 13404 } |
13405 while (true) { | 13405 while (true) { |
13406 if (node.operator.type == TokenType.BANG) { | 13406 if (node.operator.type == TokenType.BANG) { |
13407 if (identical(operand2, true)) { | 13407 if (identical(operand, true)) { |
13408 return false; | 13408 return false; |
13409 } else if (identical(operand2, false)) { | 13409 } else if (identical(operand, false)) { |
13410 return true; | 13410 return true; |
13411 } | 13411 } |
13412 } else if (node.operator.type == TokenType.TILDE) { | 13412 } else if (node.operator.type == TokenType.TILDE) { |
13413 if (operand2 is int) { | 13413 if (operand is int) { |
13414 return ~((operand2 as int)); | 13414 return ~((operand as int)); |
13415 } | 13415 } |
13416 } else if (node.operator.type == TokenType.MINUS) { | 13416 } else if (node.operator.type == TokenType.MINUS) { |
13417 if (operand2 == null) { | 13417 if (operand == null) { |
13418 return null; | 13418 return null; |
13419 } else if (operand2 is int) { | 13419 } else if (operand is int) { |
13420 return -((operand2 as int)); | 13420 return -((operand as int)); |
13421 } else if (operand2 is double) { | 13421 } else if (operand is double) { |
13422 return -((operand2 as double)); | 13422 return -((operand as double)); |
13423 } | 13423 } |
13424 } | 13424 } |
13425 break; | 13425 break; |
13426 } | 13426 } |
13427 return NOT_A_CONSTANT; | 13427 return NOT_A_CONSTANT; |
13428 } | 13428 } |
13429 Object visitPropertyAccess(PropertyAccess node) => getConstantValue(null); | 13429 Object visitPropertyAccess(PropertyAccess node) => getConstantValue(null); |
13430 Object visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(null); | 13430 Object visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(null); |
13431 Object visitSimpleStringLiteral(SimpleStringLiteral node) => node.value; | 13431 Object visitSimpleStringLiteral(SimpleStringLiteral node) => node.value; |
13432 Object visitStringInterpolation(StringInterpolation node) { | 13432 Object visitStringInterpolation(StringInterpolation node) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13475 /** | 13475 /** |
13476 * Visitor that maps nodes to elements. | 13476 * Visitor that maps nodes to elements. |
13477 */ | 13477 */ |
13478 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { | 13478 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { |
13479 Element visitBinaryExpression(BinaryExpression node) => node.element; | 13479 Element visitBinaryExpression(BinaryExpression node) => node.element; |
13480 Element visitClassDeclaration(ClassDeclaration node) => node.element; | 13480 Element visitClassDeclaration(ClassDeclaration node) => node.element; |
13481 Element visitCompilationUnit(CompilationUnit node) => node.element; | 13481 Element visitCompilationUnit(CompilationUnit node) => node.element; |
13482 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme
nt; | 13482 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme
nt; |
13483 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; | 13483 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; |
13484 Element visitIdentifier(Identifier node) { | 13484 Element visitIdentifier(Identifier node) { |
13485 ASTNode parent2 = node.parent; | 13485 ASTNode parent = node.parent; |
13486 if (parent2 is ConstructorDeclaration) { | 13486 if (parent is ConstructorDeclaration) { |
13487 ConstructorDeclaration decl = parent2 as ConstructorDeclaration; | 13487 ConstructorDeclaration decl = parent as ConstructorDeclaration; |
13488 Identifier returnType2 = decl.returnType; | 13488 Identifier returnType = decl.returnType; |
13489 if (identical(returnType2, node)) { | 13489 if (identical(returnType, node)) { |
13490 SimpleIdentifier name2 = decl.name; | 13490 SimpleIdentifier name = decl.name; |
13491 if (name2 != null) { | 13491 if (name != null) { |
13492 return name2.element; | 13492 return name.element; |
13493 } | 13493 } |
13494 Element element2 = node.element; | 13494 Element element = node.element; |
13495 if (element2 is ClassElement) { | 13495 if (element is ClassElement) { |
13496 return ((element2 as ClassElement)).unnamedConstructor; | 13496 return ((element as ClassElement)).unnamedConstructor; |
13497 } | 13497 } |
13498 } | 13498 } |
13499 } | 13499 } |
13500 if (parent2 is LibraryIdentifier) { | 13500 if (parent is LibraryIdentifier) { |
13501 ASTNode grandParent = ((parent2 as LibraryIdentifier)).parent; | 13501 ASTNode grandParent = ((parent as LibraryIdentifier)).parent; |
13502 if (grandParent is PartOfDirective) { | 13502 if (grandParent is PartOfDirective) { |
13503 Element element3 = ((grandParent as PartOfDirective)).element; | 13503 Element element = ((grandParent as PartOfDirective)).element; |
13504 if (element3 is LibraryElement) { | 13504 if (element is LibraryElement) { |
13505 return ((element3 as LibraryElement)).definingCompilationUnit; | 13505 return ((element as LibraryElement)).definingCompilationUnit; |
13506 } | 13506 } |
13507 } | 13507 } |
13508 } | 13508 } |
13509 return node.element; | 13509 return node.element; |
13510 } | 13510 } |
13511 Element visitImportDirective(ImportDirective node) => node.element; | 13511 Element visitImportDirective(ImportDirective node) => node.element; |
13512 Element visitIndexExpression(IndexExpression node) => node.element; | 13512 Element visitIndexExpression(IndexExpression node) => node.element; |
13513 Element visitInstanceCreationExpression(InstanceCreationExpression node) => no
de.element; | 13513 Element visitInstanceCreationExpression(InstanceCreationExpression node) => no
de.element; |
13514 Element visitLibraryDirective(LibraryDirective node) => node.element; | 13514 Element visitLibraryDirective(LibraryDirective node) => node.element; |
13515 Element visitMethodDeclaration(MethodDeclaration node) => node.element; | 13515 Element visitMethodDeclaration(MethodDeclaration node) => node.element; |
13516 Element visitMethodInvocation(MethodInvocation node) => node.methodName.elemen
t; | 13516 Element visitMethodInvocation(MethodInvocation node) => node.methodName.elemen
t; |
13517 Element visitPostfixExpression(PostfixExpression node) => node.element; | 13517 Element visitPostfixExpression(PostfixExpression node) => node.element; |
13518 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element; | 13518 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element; |
13519 Element visitPrefixExpression(PrefixExpression node) => node.element; | 13519 Element visitPrefixExpression(PrefixExpression node) => node.element; |
13520 Element visitStringLiteral(StringLiteral node) { | 13520 Element visitStringLiteral(StringLiteral node) { |
13521 ASTNode parent2 = node.parent; | 13521 ASTNode parent = node.parent; |
13522 if (parent2 is UriBasedDirective) { | 13522 if (parent is UriBasedDirective) { |
13523 return ((parent2 as UriBasedDirective)).uriElement; | 13523 return ((parent as UriBasedDirective)).uriElement; |
13524 } | 13524 } |
13525 return null; | 13525 return null; |
13526 } | 13526 } |
13527 Element visitVariableDeclaration(VariableDeclaration node) => node.element; | 13527 Element visitVariableDeclaration(VariableDeclaration node) => node.element; |
13528 } | 13528 } |
13529 /** | 13529 /** |
13530 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito
r that will | 13530 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito
r that will |
13531 * 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 | 13531 * 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 |
13532 * will the visit method for that specific type of node be invoked, but addition
al methods for the | 13532 * will the visit method for that specific type of node be invoked, but addition
al methods for the |
13533 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to | 13533 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14436 } | 14436 } |
14437 visit(node.superclass); | 14437 visit(node.superclass); |
14438 visit3(" ", node.withClause); | 14438 visit3(" ", node.withClause); |
14439 visit3(" ", node.implementsClause); | 14439 visit3(" ", node.implementsClause); |
14440 _writer.print(";"); | 14440 _writer.print(";"); |
14441 return null; | 14441 return null; |
14442 } | 14442 } |
14443 Object visitComment(Comment node) => null; | 14443 Object visitComment(Comment node) => null; |
14444 Object visitCommentReference(CommentReference node) => null; | 14444 Object visitCommentReference(CommentReference node) => null; |
14445 Object visitCompilationUnit(CompilationUnit node) { | 14445 Object visitCompilationUnit(CompilationUnit node) { |
14446 ScriptTag scriptTag2 = node.scriptTag; | 14446 ScriptTag scriptTag = node.scriptTag; |
14447 NodeList<Directive> directives2 = node.directives; | 14447 NodeList<Directive> directives = node.directives; |
14448 visit(scriptTag2); | 14448 visit(scriptTag); |
14449 String prefix = scriptTag2 == null ? "" : " "; | 14449 String prefix = scriptTag == null ? "" : " "; |
14450 visitList4(prefix, directives2, " "); | 14450 visitList4(prefix, directives, " "); |
14451 prefix = scriptTag2 == null && directives2.isEmpty ? "" : " "; | 14451 prefix = scriptTag == null && directives.isEmpty ? "" : " "; |
14452 visitList4(prefix, node.declarations, " "); | 14452 visitList4(prefix, node.declarations, " "); |
14453 return null; | 14453 return null; |
14454 } | 14454 } |
14455 Object visitConditionalExpression(ConditionalExpression node) { | 14455 Object visitConditionalExpression(ConditionalExpression node) { |
14456 visit(node.condition); | 14456 visit(node.condition); |
14457 _writer.print(" ? "); | 14457 _writer.print(" ? "); |
14458 visit(node.thenExpression); | 14458 visit(node.thenExpression); |
14459 _writer.print(" : "); | 14459 _writer.print(" : "); |
14460 visit(node.elseExpression); | 14460 visit(node.elseExpression); |
14461 return null; | 14461 return null; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14568 visit(node.loopVariable); | 14568 visit(node.loopVariable); |
14569 _writer.print(" in "); | 14569 _writer.print(" in "); |
14570 visit(node.iterator); | 14570 visit(node.iterator); |
14571 _writer.print(") "); | 14571 _writer.print(") "); |
14572 visit(node.body); | 14572 visit(node.body); |
14573 return null; | 14573 return null; |
14574 } | 14574 } |
14575 Object visitFormalParameterList(FormalParameterList node) { | 14575 Object visitFormalParameterList(FormalParameterList node) { |
14576 String groupEnd = null; | 14576 String groupEnd = null; |
14577 _writer.print('('); | 14577 _writer.print('('); |
14578 NodeList<FormalParameter> parameters2 = node.parameters; | 14578 NodeList<FormalParameter> parameters = node.parameters; |
14579 int size2 = parameters2.length; | 14579 int size = parameters.length; |
14580 for (int i = 0; i < size2; i++) { | 14580 for (int i = 0; i < size; i++) { |
14581 FormalParameter parameter = parameters2[i]; | 14581 FormalParameter parameter = parameters[i]; |
14582 if (i > 0) { | 14582 if (i > 0) { |
14583 _writer.print(", "); | 14583 _writer.print(", "); |
14584 } | 14584 } |
14585 if (groupEnd == null && parameter is DefaultFormalParameter) { | 14585 if (groupEnd == null && parameter is DefaultFormalParameter) { |
14586 if (identical(parameter.kind, ParameterKind.NAMED)) { | 14586 if (identical(parameter.kind, ParameterKind.NAMED)) { |
14587 groupEnd = "}"; | 14587 groupEnd = "}"; |
14588 _writer.print('{'); | 14588 _writer.print('{'); |
14589 } else { | 14589 } else { |
14590 groupEnd = "]"; | 14590 groupEnd = "]"; |
14591 _writer.print('['); | 14591 _writer.print('['); |
14592 } | 14592 } |
14593 } | 14593 } |
14594 parameter.accept(this); | 14594 parameter.accept(this); |
14595 } | 14595 } |
14596 if (groupEnd != null) { | 14596 if (groupEnd != null) { |
14597 _writer.print(groupEnd); | 14597 _writer.print(groupEnd); |
14598 } | 14598 } |
14599 _writer.print(')'); | 14599 _writer.print(')'); |
14600 return null; | 14600 return null; |
14601 } | 14601 } |
14602 Object visitForStatement(ForStatement node) { | 14602 Object visitForStatement(ForStatement node) { |
14603 Expression initialization2 = node.initialization; | 14603 Expression initialization = node.initialization; |
14604 _writer.print("for ("); | 14604 _writer.print("for ("); |
14605 if (initialization2 != null) { | 14605 if (initialization != null) { |
14606 visit(initialization2); | 14606 visit(initialization); |
14607 } else { | 14607 } else { |
14608 visit(node.variables); | 14608 visit(node.variables); |
14609 } | 14609 } |
14610 _writer.print(";"); | 14610 _writer.print(";"); |
14611 visit3(" ", node.condition); | 14611 visit3(" ", node.condition); |
14612 _writer.print(";"); | 14612 _writer.print(";"); |
14613 visitList4(" ", node.updaters, ", "); | 14613 visitList4(" ", node.updaters, ", "); |
14614 _writer.print(") "); | 14614 _writer.print(") "); |
14615 visit(node.body); | 14615 visit(node.body); |
14616 return null; | 14616 return null; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14859 _writer.print("this"); | 14859 _writer.print("this"); |
14860 visit3(".", node.constructorName); | 14860 visit3(".", node.constructorName); |
14861 visit(node.argumentList); | 14861 visit(node.argumentList); |
14862 return null; | 14862 return null; |
14863 } | 14863 } |
14864 Object visitRethrowExpression(RethrowExpression node) { | 14864 Object visitRethrowExpression(RethrowExpression node) { |
14865 _writer.print("rethrow"); | 14865 _writer.print("rethrow"); |
14866 return null; | 14866 return null; |
14867 } | 14867 } |
14868 Object visitReturnStatement(ReturnStatement node) { | 14868 Object visitReturnStatement(ReturnStatement node) { |
14869 Expression expression2 = node.expression; | 14869 Expression expression = node.expression; |
14870 if (expression2 == null) { | 14870 if (expression == null) { |
14871 _writer.print("return;"); | 14871 _writer.print("return;"); |
14872 } else { | 14872 } else { |
14873 _writer.print("return "); | 14873 _writer.print("return "); |
14874 expression2.accept(this); | 14874 expression.accept(this); |
14875 _writer.print(";"); | 14875 _writer.print(";"); |
14876 } | 14876 } |
14877 return null; | 14877 return null; |
14878 } | 14878 } |
14879 Object visitScriptTag(ScriptTag node) { | 14879 Object visitScriptTag(ScriptTag node) { |
14880 _writer.print(node.scriptTag.lexeme); | 14880 _writer.print(node.scriptTag.lexeme); |
14881 return null; | 14881 return null; |
14882 } | 14882 } |
14883 Object visitShowCombinator(ShowCombinator node) { | 14883 Object visitShowCombinator(ShowCombinator node) { |
14884 _writer.print("show "); | 14884 _writer.print("show "); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15073 visitList2(nodes, ""); | 15073 visitList2(nodes, ""); |
15074 } | 15074 } |
15075 | 15075 |
15076 /** | 15076 /** |
15077 * Print a list of nodes, separated by the given separator. | 15077 * Print a list of nodes, separated by the given separator. |
15078 * @param nodes the nodes to be printed | 15078 * @param nodes the nodes to be printed |
15079 * @param separator the separator to be printed between adjacent nodes | 15079 * @param separator the separator to be printed between adjacent nodes |
15080 */ | 15080 */ |
15081 void visitList2(NodeList<ASTNode> nodes, String separator) { | 15081 void visitList2(NodeList<ASTNode> nodes, String separator) { |
15082 if (nodes != null) { | 15082 if (nodes != null) { |
15083 int size2 = nodes.length; | 15083 int size = nodes.length; |
15084 for (int i = 0; i < size2; i++) { | 15084 for (int i = 0; i < size; i++) { |
15085 if (i > 0) { | 15085 if (i > 0) { |
15086 _writer.print(separator); | 15086 _writer.print(separator); |
15087 } | 15087 } |
15088 nodes[i].accept(this); | 15088 nodes[i].accept(this); |
15089 } | 15089 } |
15090 } | 15090 } |
15091 } | 15091 } |
15092 | 15092 |
15093 /** | 15093 /** |
15094 * Print a list of nodes, separated by the given separator. | 15094 * Print a list of nodes, separated by the given separator. |
15095 * @param nodes the nodes to be printed | 15095 * @param nodes the nodes to be printed |
15096 * @param separator the separator to be printed between adjacent nodes | 15096 * @param separator the separator to be printed between adjacent nodes |
15097 * @param suffix the suffix to be printed if the list is not empty | 15097 * @param suffix the suffix to be printed if the list is not empty |
15098 */ | 15098 */ |
15099 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { | 15099 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { |
15100 if (nodes != null) { | 15100 if (nodes != null) { |
15101 int size2 = nodes.length; | 15101 int size = nodes.length; |
15102 if (size2 > 0) { | 15102 if (size > 0) { |
15103 for (int i = 0; i < size2; i++) { | 15103 for (int i = 0; i < size; i++) { |
15104 if (i > 0) { | 15104 if (i > 0) { |
15105 _writer.print(separator); | 15105 _writer.print(separator); |
15106 } | 15106 } |
15107 nodes[i].accept(this); | 15107 nodes[i].accept(this); |
15108 } | 15108 } |
15109 _writer.print(suffix); | 15109 _writer.print(suffix); |
15110 } | 15110 } |
15111 } | 15111 } |
15112 } | 15112 } |
15113 | 15113 |
15114 /** | 15114 /** |
15115 * Print a list of nodes, separated by the given separator. | 15115 * Print a list of nodes, separated by the given separator. |
15116 * @param prefix the prefix to be printed if the list is not empty | 15116 * @param prefix the prefix to be printed if the list is not empty |
15117 * @param nodes the nodes to be printed | 15117 * @param nodes the nodes to be printed |
15118 * @param separator the separator to be printed between adjacent nodes | 15118 * @param separator the separator to be printed between adjacent nodes |
15119 */ | 15119 */ |
15120 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { | 15120 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { |
15121 if (nodes != null) { | 15121 if (nodes != null) { |
15122 int size2 = nodes.length; | 15122 int size = nodes.length; |
15123 if (size2 > 0) { | 15123 if (size > 0) { |
15124 _writer.print(prefix); | 15124 _writer.print(prefix); |
15125 for (int i = 0; i < size2; i++) { | 15125 for (int i = 0; i < size; i++) { |
15126 if (i > 0) { | 15126 if (i > 0) { |
15127 _writer.print(separator); | 15127 _writer.print(separator); |
15128 } | 15128 } |
15129 nodes[i].accept(this); | 15129 nodes[i].accept(this); |
15130 } | 15130 } |
15131 } | 15131 } |
15132 } | 15132 } |
15133 } | 15133 } |
15134 } | 15134 } |
15135 /** | 15135 /** |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15194 FunctionDeclarationStatement visitFunctionDeclarationStatement(FunctionDeclara
tionStatement node) => new FunctionDeclarationStatement.full(clone2(node.functio
nDeclaration)); | 15194 FunctionDeclarationStatement visitFunctionDeclarationStatement(FunctionDeclara
tionStatement node) => new FunctionDeclarationStatement.full(clone2(node.functio
nDeclaration)); |
15195 FunctionExpression visitFunctionExpression(FunctionExpression node) => new Fun
ctionExpression.full(clone2(node.parameters), clone2(node.body)); | 15195 FunctionExpression visitFunctionExpression(FunctionExpression node) => new Fun
ctionExpression.full(clone2(node.parameters), clone2(node.body)); |
15196 FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpress
ionInvocation node) => new FunctionExpressionInvocation.full(clone2(node.functio
n), clone2(node.argumentList)); | 15196 FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpress
ionInvocation node) => new FunctionExpressionInvocation.full(clone2(node.functio
n), clone2(node.argumentList)); |
15197 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new Functi
onTypeAlias.full(clone2(node.documentationComment), clone3(node.metadata), node.
keyword, clone2(node.returnType), clone2(node.name), clone2(node.typeParameters)
, clone2(node.parameters), node.semicolon); | 15197 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new Functi
onTypeAlias.full(clone2(node.documentationComment), clone3(node.metadata), node.
keyword, clone2(node.returnType), clone2(node.name), clone2(node.typeParameters)
, clone2(node.parameters), node.semicolon); |
15198 FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFo
rmalParameter node) => new FunctionTypedFormalParameter.full(clone2(node.documen
tationComment), clone3(node.metadata), clone2(node.returnType), clone2(node.iden
tifier), clone2(node.parameters)); | 15198 FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFo
rmalParameter node) => new FunctionTypedFormalParameter.full(clone2(node.documen
tationComment), clone3(node.metadata), clone2(node.returnType), clone2(node.iden
tifier), clone2(node.parameters)); |
15199 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator.
full(node.keyword, clone3(node.hiddenNames)); | 15199 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator.
full(node.keyword, clone3(node.hiddenNames)); |
15200 IfStatement visitIfStatement(IfStatement node) => new IfStatement.full(node.if
Keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, cl
one2(node.thenStatement), node.elseKeyword, clone2(node.elseStatement)); | 15200 IfStatement visitIfStatement(IfStatement node) => new IfStatement.full(node.if
Keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, cl
one2(node.thenStatement), node.elseKeyword, clone2(node.elseStatement)); |
15201 ImplementsClause visitImplementsClause(ImplementsClause node) => new Implement
sClause.full(node.keyword, clone3(node.interfaces)); | 15201 ImplementsClause visitImplementsClause(ImplementsClause node) => new Implement
sClause.full(node.keyword, clone3(node.interfaces)); |
15202 ImportDirective visitImportDirective(ImportDirective node) => new ImportDirect
ive.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword,
clone2(node.uri), node.asToken, clone2(node.prefix), clone3(node.combinators),
node.semicolon); | 15202 ImportDirective visitImportDirective(ImportDirective node) => new ImportDirect
ive.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword,
clone2(node.uri), node.asToken, clone2(node.prefix), clone3(node.combinators),
node.semicolon); |
15203 IndexExpression visitIndexExpression(IndexExpression node) { | 15203 IndexExpression visitIndexExpression(IndexExpression node) { |
15204 Token period2 = node.period; | 15204 Token period = node.period; |
15205 if (period2 == null) { | 15205 if (period == null) { |
15206 return new IndexExpression.forTarget_full(clone2(node.array), node.leftBra
cket, clone2(node.index), node.rightBracket); | 15206 return new IndexExpression.forTarget_full(clone2(node.array), node.leftBra
cket, clone2(node.index), node.rightBracket); |
15207 } else { | 15207 } else { |
15208 return new IndexExpression.forCascade_full(period2, node.leftBracket, clon
e2(node.index), node.rightBracket); | 15208 return new IndexExpression.forCascade_full(period, node.leftBracket, clone
2(node.index), node.rightBracket); |
15209 } | 15209 } |
15210 } | 15210 } |
15211 InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExp
ression node) => new InstanceCreationExpression.full(node.keyword, clone2(node.c
onstructorName), clone2(node.argumentList)); | 15211 InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExp
ression node) => new InstanceCreationExpression.full(node.keyword, clone2(node.c
onstructorName), clone2(node.argumentList)); |
15212 IntegerLiteral visitIntegerLiteral(IntegerLiteral node) => new IntegerLiteral.
full(node.literal, node.value); | 15212 IntegerLiteral visitIntegerLiteral(IntegerLiteral node) => new IntegerLiteral.
full(node.literal, node.value); |
15213 InterpolationExpression visitInterpolationExpression(InterpolationExpression n
ode) => new InterpolationExpression.full(node.leftBracket, clone2(node.expressio
n), node.rightBracket); | 15213 InterpolationExpression visitInterpolationExpression(InterpolationExpression n
ode) => new InterpolationExpression.full(node.leftBracket, clone2(node.expressio
n), node.rightBracket); |
15214 InterpolationString visitInterpolationString(InterpolationString node) => new
InterpolationString.full(node.contents, node.value); | 15214 InterpolationString visitInterpolationString(InterpolationString node) => new
InterpolationString.full(node.contents, node.value); |
15215 IsExpression visitIsExpression(IsExpression node) => new IsExpression.full(clo
ne2(node.expression), node.isOperator, node.notOperator, clone2(node.type)); | 15215 IsExpression visitIsExpression(IsExpression node) => new IsExpression.full(clo
ne2(node.expression), node.isOperator, node.notOperator, clone2(node.type)); |
15216 Label visitLabel(Label node) => new Label.full(clone2(node.label), node.colon)
; | 15216 Label visitLabel(Label node) => new Label.full(clone2(node.label), node.colon)
; |
15217 LabeledStatement visitLabeledStatement(LabeledStatement node) => new LabeledSt
atement.full(clone3(node.labels), clone2(node.statement)); | 15217 LabeledStatement visitLabeledStatement(LabeledStatement node) => new LabeledSt
atement.full(clone3(node.labels), clone2(node.statement)); |
15218 LibraryDirective visitLibraryDirective(LibraryDirective node) => new LibraryDi
rective.full(clone2(node.documentationComment), clone3(node.metadata), node.libr
aryToken, clone2(node.name), node.semicolon); | 15218 LibraryDirective visitLibraryDirective(LibraryDirective node) => new LibraryDi
rective.full(clone2(node.documentationComment), clone3(node.metadata), node.libr
aryToken, clone2(node.name), node.semicolon); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15345 return null; | 15345 return null; |
15346 } | 15346 } |
15347 if (_immediateChild != node.parameters) { | 15347 if (_immediateChild != node.parameters) { |
15348 addParameters(node.parameters.parameters); | 15348 addParameters(node.parameters.parameters); |
15349 } | 15349 } |
15350 _declarationNode = node; | 15350 _declarationNode = node; |
15351 return null; | 15351 return null; |
15352 } | 15352 } |
15353 Object visitNode(ASTNode node) { | 15353 Object visitNode(ASTNode node) { |
15354 _immediateChild = node; | 15354 _immediateChild = node; |
15355 ASTNode parent2 = node.parent; | 15355 ASTNode parent = node.parent; |
15356 if (parent2 != null) { | 15356 if (parent != null) { |
15357 parent2.accept(this); | 15357 parent.accept(this); |
15358 } | 15358 } |
15359 return null; | 15359 return null; |
15360 } | 15360 } |
15361 Object visitSwitchMember(SwitchMember node) { | 15361 Object visitSwitchMember(SwitchMember node) { |
15362 checkStatements(node.statements); | 15362 checkStatements(node.statements); |
15363 return super.visitSwitchMember(node); | 15363 return super.visitSwitchMember(node); |
15364 } | 15364 } |
15365 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { | 15365 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { |
15366 _declarationNode = node; | 15366 _declarationNode = node; |
15367 return null; | 15367 return null; |
15368 } | 15368 } |
15369 Object visitTypeAlias(TypeAlias node) { | 15369 Object visitTypeAlias(TypeAlias node) { |
15370 _declarationNode = node; | 15370 _declarationNode = node; |
15371 return null; | 15371 return null; |
15372 } | 15372 } |
15373 void addParameters(NodeList<FormalParameter> vars) { | 15373 void addParameters(NodeList<FormalParameter> vars) { |
15374 for (FormalParameter var2 in vars) { | 15374 for (FormalParameter var2 in vars) { |
15375 addToScope(var2.identifier); | 15375 addToScope(var2.identifier); |
15376 } | 15376 } |
15377 } | 15377 } |
15378 void addToScope(SimpleIdentifier identifier) { | 15378 void addToScope(SimpleIdentifier identifier) { |
15379 if (identifier != null && isInRange(identifier)) { | 15379 if (identifier != null && isInRange(identifier)) { |
15380 String name2 = identifier.name; | 15380 String name = identifier.name; |
15381 if (!_locals.containsKey(name2)) { | 15381 if (!_locals.containsKey(name)) { |
15382 _locals[name2] = identifier; | 15382 _locals[name] = identifier; |
15383 } | 15383 } |
15384 } | 15384 } |
15385 } | 15385 } |
15386 void addVariables(NodeList<VariableDeclaration> vars) { | 15386 void addVariables(NodeList<VariableDeclaration> vars) { |
15387 for (VariableDeclaration var2 in vars) { | 15387 for (VariableDeclaration var2 in vars) { |
15388 addToScope(var2.name); | 15388 addToScope(var2.name); |
15389 } | 15389 } |
15390 } | 15390 } |
15391 | 15391 |
15392 /** | 15392 /** |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15472 return elements[elements.length - 1].endToken; | 15472 return elements[elements.length - 1].endToken; |
15473 } | 15473 } |
15474 /** | 15474 /** |
15475 * Return the node that is the parent of each of the elements in the list. | 15475 * Return the node that is the parent of each of the elements in the list. |
15476 * @return the node that is the parent of each of the elements in the list | 15476 * @return the node that is the parent of each of the elements in the list |
15477 */ | 15477 */ |
15478 ASTNode getOwner() { | 15478 ASTNode getOwner() { |
15479 return owner; | 15479 return owner; |
15480 } | 15480 } |
15481 } | 15481 } |
OLD | NEW |