| 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 | |
| 4 library engine.ast; | 3 library engine.ast; |
| 5 | |
| 6 import 'dart:collection'; | 4 import 'dart:collection'; |
| 7 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 8 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 9 import 'error.dart'; | 7 import 'error.dart'; |
| 10 import 'source.dart' show LineInfo; | 8 import 'source.dart' show LineInfo; |
| 11 import 'scanner.dart'; | 9 import 'scanner.dart'; |
| 12 import 'engine.dart' show AnalysisEngine; | 10 import 'engine.dart' show AnalysisEngine; |
| 13 import 'utilities_dart.dart'; | 11 import 'utilities_dart.dart'; |
| 14 import 'element.dart' hide Annotation; | 12 import 'element.dart' hide Annotation; |
| 15 | |
| 16 | |
| 17 /** | 13 /** |
| 18 * The abstract class {@code ASTNode} defines the behavior common to all nodes i
n the AST structure | 14 * The abstract class {@code ASTNode} defines the behavior common to all nodes i
n the AST structure |
| 19 * for a Dart program. | 15 * for a Dart program. |
| 20 * @coverage dart.engine.ast | 16 * @coverage dart.engine.ast |
| 21 */ | 17 */ |
| 22 abstract class ASTNode { | 18 abstract class ASTNode { |
| 23 | 19 |
| 24 /** | 20 /** |
| 25 * The parent of the node, or {@code null} if the node is the root of an AST s
tructure. | 21 * The parent of the node, or {@code null} if the node is the root of an AST s
tructure. |
| 26 */ | 22 */ |
| 27 ASTNode _parent; | 23 ASTNode _parent; |
| 28 | 24 |
| 29 /** | 25 /** |
| 30 * A table mapping the names of properties to their values, or {@code null} if
this node does not | 26 * A table mapping the names of properties to their values, or {@code null} if
this node does not |
| 31 * have any properties associated with it. | 27 * have any properties associated with it. |
| 32 */ | 28 */ |
| 33 Map<String, Object> _propertyMap; | 29 Map<String, Object> _propertyMap; |
| 34 | 30 |
| 35 /** | 31 /** |
| 36 * A comparator that can be used to sort AST nodes in lexical order. In other
words,{@code compare} will return a negative value if the offset of the first no
de is less than the | 32 * A comparator that can be used to sort AST nodes in lexical order. In other
words,{@code compare} will return a negative value if the offset of the first no
de is less than the |
| 37 * offset of the second node, zero (0) if the nodes have the same offset, and
a positive value if | 33 * offset of the second node, zero (0) if the nodes have the same offset, and
a positive value if |
| 38 * if the offset of the first node is greater than the offset of the second no
de. | 34 * if the offset of the first node is greater than the offset of the second no
de. |
| 39 */ | 35 */ |
| 40 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) =>
second.offset - first.offset; | 36 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) =>
second.offset - first.offset; |
| 41 | 37 |
| 42 /** | 38 /** |
| 43 * Use the given visitor to visit this node. | 39 * Use the given visitor to visit this node. |
| 44 * @param visitor the visitor that will visit this node | 40 * @param visitor the visitor that will visit this node |
| 45 * @return the value returned by the visitor as a result of visiting this node | 41 * @return the value returned by the visitor as a result of visiting this node |
| 46 */ | 42 */ |
| 47 accept(ASTVisitor visitor); | 43 accept(ASTVisitor visitor); |
| 48 | 44 |
| 49 /** | 45 /** |
| 50 * @return the {@link ASTNode} of given {@link Class} which is {@link ASTNode}
itself, or one of | 46 * @return the {@link ASTNode} of given {@link Class} which is {@link ASTNode}
itself, or one of |
| 51 * its parents. | 47 * its parents. |
| 52 */ | 48 */ |
| 53 ASTNode getAncestor(Type enclosingClass) { | 49 ASTNode getAncestor(Type enclosingClass) { |
| 54 ASTNode node = this; | 50 ASTNode node = this; |
| 55 while (node != null && !isInstanceOf(node, enclosingClass)) { | 51 while (node != null && !isInstanceOf(node, enclosingClass)) { |
| 56 node = node.parent; | 52 node = node.parent; |
| 57 } | 53 } |
| 58 ; | 54 ; |
| 59 return node as ASTNode; | 55 return node as ASTNode; |
| 60 } | 56 } |
| 61 | 57 |
| 62 /** | 58 /** |
| 63 * Return the first token included in this node's source range. | 59 * Return the first token included in this node's source range. |
| 64 * @return the first token included in this node's source range | 60 * @return the first token included in this node's source range |
| 65 */ | 61 */ |
| 66 Token get beginToken; | 62 Token get beginToken; |
| 67 | 63 |
| 68 /** | 64 /** |
| 69 * Return the offset of the character immediately following the last character
of this node's | 65 * Return the offset of the character immediately following the last character
of this node's |
| 70 * source range. This is equivalent to {@code node.getOffset() + node.getLengt
h()}. For a | 66 * source range. This is equivalent to {@code node.getOffset() + node.getLengt
h()}. For a |
| 71 * compilation unit this will be equal to the length of the unit's source. For
synthetic nodes | 67 * compilation unit this will be equal to the length of the unit's source. For
synthetic nodes |
| 72 * this will be equivalent to the node's offset (because the length is zero (0
) by definition). | 68 * this will be equivalent to the node's offset (because the length is zero (0
) by definition). |
| 73 * @return the offset of the character just past the node's source range | 69 * @return the offset of the character just past the node's source range |
| 74 */ | 70 */ |
| 75 int get end => offset + length; | 71 int get end => offset + length; |
| 76 | 72 |
| 77 /** | 73 /** |
| 78 * Return the last token included in this node's source range. | 74 * Return the last token included in this node's source range. |
| 79 * @return the last token included in this node's source range | 75 * @return the last token included in this node's source range |
| 80 */ | 76 */ |
| 81 Token get endToken; | 77 Token get endToken; |
| 82 | 78 |
| 83 /** | 79 /** |
| 84 * Return the number of characters in the node's source range. | 80 * Return the number of characters in the node's source range. |
| 85 * @return the number of characters in the node's source range | 81 * @return the number of characters in the node's source range |
| 86 */ | 82 */ |
| 87 int get length { | 83 int get length { |
| 88 Token beginToken2 = beginToken; | 84 Token beginToken2 = beginToken; |
| 89 Token endToken2 = endToken; | 85 Token endToken2 = endToken; |
| 90 if (beginToken2 == null || endToken2 == null) { | 86 if (beginToken2 == null || endToken2 == null) { |
| 91 return -1; | 87 return -1; |
| 92 } | 88 } |
| 93 return endToken2.offset + endToken2.length - beginToken2.offset; | 89 return endToken2.offset + endToken2.length - beginToken2.offset; |
| 94 } | 90 } |
| 95 | 91 |
| 96 /** | 92 /** |
| 97 * 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 |
| 98 * range. | 94 * range. |
| 99 * @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 |
| 100 * range | 96 * range |
| 101 */ | 97 */ |
| 102 int get offset { | 98 int get offset { |
| 103 Token beginToken2 = beginToken; | 99 Token beginToken2 = beginToken; |
| 104 if (beginToken2 == null) { | 100 if (beginToken2 == null) { |
| 105 return -1; | 101 return -1; |
| 106 } | 102 } |
| 107 return beginToken.offset; | 103 return beginToken.offset; |
| 108 } | 104 } |
| 109 | 105 |
| 110 /** | 106 /** |
| 111 * 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. |
| 112 * <p> | 108 * <p> |
| 113 * 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 |
| 114 * of a node. | 110 * of a node. |
| 115 * @return the parent of this node, or {@code null} if none | 111 * @return the parent of this node, or {@code null} if none |
| 116 */ | 112 */ |
| 117 ASTNode get parent => _parent; | 113 ASTNode get parent => _parent; |
| 118 | 114 |
| 119 /** | 115 /** |
| 120 * Return the value of the property with the given name, or {@code null} if th
is node does not | 116 * Return the value of the property with the given name, or {@code null} if th
is node does not |
| 121 * have a property with the given name. | 117 * have a property with the given name. |
| 122 * @return the value of the property with the given name | 118 * @return the value of the property with the given name |
| 123 */ | 119 */ |
| 124 Object getProperty(String propertyName) { | 120 Object getProperty(String propertyName) { |
| 125 if (_propertyMap == null) { | 121 if (_propertyMap == null) { |
| 126 return null; | 122 return null; |
| 127 } | 123 } |
| 128 return _propertyMap[propertyName]; | 124 return _propertyMap[propertyName]; |
| 129 } | 125 } |
| 130 | 126 |
| 131 /** | 127 /** |
| 132 * 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 |
| 133 * 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)). |
| 134 * @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 |
| 135 */ | 131 */ |
| 136 ASTNode get root { | 132 ASTNode get root { |
| 137 ASTNode root = this; | 133 ASTNode root = this; |
| 138 ASTNode parent2 = parent; | 134 ASTNode parent2 = parent; |
| 139 while (parent2 != null) { | 135 while (parent2 != null) { |
| 140 root = parent2; | 136 root = parent2; |
| 141 parent2 = root.parent; | 137 parent2 = root.parent; |
| 142 } | 138 } |
| 143 return root; | 139 return root; |
| 144 } | 140 } |
| 145 | 141 |
| 146 /** | 142 /** |
| 147 * 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 |
| 148 * 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 |
| 149 * have a length of zero ({@code 0}). | 145 * have a length of zero ({@code 0}). |
| 150 * @return {@code true} if this node is a synthetic node | 146 * @return {@code true} if this node is a synthetic node |
| 151 */ | 147 */ |
| 152 bool isSynthetic() => false; | 148 bool isSynthetic() => false; |
| 153 | 149 |
| 154 /** | 150 /** |
| 155 * Set the value of the property with the given name to the given value. If th
e value is{@code null}, the property will effectively be removed. | 151 * Set the value of the property with the given name to the given value. If th
e value is{@code null}, the property will effectively be removed. |
| 156 * @param propertyName the name of the property whose value is to be set | 152 * @param propertyName the name of the property whose value is to be set |
| 157 * @param propertyValue the new value of the property | 153 * @param propertyValue the new value of the property |
| 158 */ | 154 */ |
| 159 void setProperty(String propertyName, Object propertyValue) { | 155 void setProperty(String propertyName, Object propertyValue) { |
| 160 if (propertyValue == null) { | 156 if (propertyValue == null) { |
| 161 if (_propertyMap != null) { | 157 if (_propertyMap != null) { |
| 162 _propertyMap.remove(propertyName); | 158 _propertyMap.remove(propertyName); |
| 163 if (_propertyMap.isEmpty) { | 159 if (_propertyMap.isEmpty) { |
| 164 _propertyMap = null; | 160 _propertyMap = null; |
| 165 } | 161 } |
| 166 } | 162 } |
| 167 } else { | 163 } else { |
| 168 if (_propertyMap == null) { | 164 if (_propertyMap == null) { |
| 169 _propertyMap = new Map<String, Object>(); | 165 _propertyMap = new Map<String, Object>(); |
| 170 } | 166 } |
| 171 _propertyMap[propertyName] = propertyValue; | 167 _propertyMap[propertyName] = propertyValue; |
| 172 } | 168 } |
| 173 } | 169 } |
| 174 | 170 |
| 175 /** | 171 /** |
| 176 * Return a textual description of this node in a form approximating valid sou
rce. The returned | 172 * Return a textual description of this node in a form approximating valid sou
rce. The returned |
| 177 * string will not be valid source primarily in the case where the node itself
is not well-formed. | 173 * string will not be valid source primarily in the case where the node itself
is not well-formed. |
| 178 * @return the source code equivalent of this node | 174 * @return the source code equivalent of this node |
| 179 */ | 175 */ |
| 180 String toSource() { | 176 String toSource() { |
| 181 PrintStringWriter writer = new PrintStringWriter(); | 177 PrintStringWriter writer = new PrintStringWriter(); |
| 182 accept(new ToSourceVisitor(writer)); | 178 accept(new ToSourceVisitor(writer)); |
| 183 return writer.toString(); | 179 return writer.toString(); |
| 184 } | 180 } |
| 185 String toString() => toSource(); | 181 String toString() => toSource(); |
| 186 | 182 |
| 187 /** | 183 /** |
| 188 * Use the given visitor to visit all of the children of this node. The childr
en will be visited | 184 * Use the given visitor to visit all of the children of this node. The childr
en will be visited |
| 189 * in source order. | 185 * in source order. |
| 190 * @param visitor the visitor that will be used to visit the children of this
node | 186 * @param visitor the visitor that will be used to visit the children of this
node |
| 191 */ | 187 */ |
| 192 void visitChildren(ASTVisitor<Object> visitor); | 188 void visitChildren(ASTVisitor<Object> visitor); |
| 193 | 189 |
| 194 /** | 190 /** |
| 195 * Make this node the parent of the given child node. | 191 * Make this node the parent of the given child node. |
| 196 * @param child the node that will become a child of this node | 192 * @param child the node that will become a child of this node |
| 197 * @return the node that was made a child of this node | 193 * @return the node that was made a child of this node |
| 198 */ | 194 */ |
| 199 ASTNode becomeParentOf(ASTNode child) { | 195 ASTNode becomeParentOf(ASTNode child) { |
| 200 if (child != null) { | 196 if (child != null) { |
| 201 ASTNode node = child; | 197 ASTNode node = child; |
| 202 node.parent = this; | 198 node.parent = this; |
| 203 } | 199 } |
| 204 return child; | 200 return child; |
| 205 } | 201 } |
| 206 | 202 |
| 207 /** | 203 /** |
| 208 * If the given child is not {@code null}, use the given visitor to visit it. | 204 * If the given child is not {@code null}, use the given visitor to visit it. |
| 209 * @param child the child to be visited | 205 * @param child the child to be visited |
| 210 * @param visitor the visitor that will be used to visit the child | 206 * @param visitor the visitor that will be used to visit the child |
| 211 */ | 207 */ |
| 212 void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) { | 208 void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) { |
| 213 if (child != null) { | 209 if (child != null) { |
| 214 child.accept(visitor); | 210 child.accept(visitor); |
| 215 } | 211 } |
| 216 } | 212 } |
| 217 | 213 |
| 218 /** | 214 /** |
| 219 * Set the parent of this node to the given node. | 215 * Set the parent of this node to the given node. |
| 220 * @param newParent the node that is to be made the parent of this node | 216 * @param newParent the node that is to be made the parent of this node |
| 221 */ | 217 */ |
| 222 void set parent(ASTNode newParent) { | 218 void set parent(ASTNode newParent) { |
| 223 _parent = newParent; | 219 _parent = newParent; |
| 224 } | 220 } |
| 225 static int _hashCodeGenerator = 0; | 221 static int _hashCodeGenerator = 0; |
| 226 final int hashCode = ++_hashCodeGenerator; | 222 final int hashCode = ++_hashCodeGenerator; |
| 227 } | 223 } |
| 228 | |
| 229 /** | 224 /** |
| 230 * The interface {@code ASTVisitor} defines the behavior of objects that can be
used to visit an AST | 225 * The interface {@code ASTVisitor} defines the behavior of objects that can be
used to visit an AST |
| 231 * structure. | 226 * structure. |
| 232 * @coverage dart.engine.ast | 227 * @coverage dart.engine.ast |
| 233 */ | 228 */ |
| 234 abstract class ASTVisitor<R> { | 229 abstract class ASTVisitor<R> { |
| 235 R visitAdjacentStrings(AdjacentStrings node); | 230 R visitAdjacentStrings(AdjacentStrings node); |
| 236 R visitAnnotation(Annotation node); | 231 R visitAnnotation(Annotation node); |
| 237 R visitArgumentDefinitionTest(ArgumentDefinitionTest node); | 232 R visitArgumentDefinitionTest(ArgumentDefinitionTest node); |
| 238 R visitArgumentList(ArgumentList node); | 233 R visitArgumentList(ArgumentList node); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 R visitTypeArgumentList(TypeArgumentList node); | 322 R visitTypeArgumentList(TypeArgumentList node); |
| 328 R visitTypeName(TypeName node); | 323 R visitTypeName(TypeName node); |
| 329 R visitTypeParameter(TypeParameter node); | 324 R visitTypeParameter(TypeParameter node); |
| 330 R visitTypeParameterList(TypeParameterList node); | 325 R visitTypeParameterList(TypeParameterList node); |
| 331 R visitVariableDeclaration(VariableDeclaration node); | 326 R visitVariableDeclaration(VariableDeclaration node); |
| 332 R visitVariableDeclarationList(VariableDeclarationList node); | 327 R visitVariableDeclarationList(VariableDeclarationList node); |
| 333 R visitVariableDeclarationStatement(VariableDeclarationStatement node); | 328 R visitVariableDeclarationStatement(VariableDeclarationStatement node); |
| 334 R visitWhileStatement(WhileStatement node); | 329 R visitWhileStatement(WhileStatement node); |
| 335 R visitWithClause(WithClause node); | 330 R visitWithClause(WithClause node); |
| 336 } | 331 } |
| 337 | |
| 338 /** | 332 /** |
| 339 * Instances of the class {@code AdjacentStrings} represents two or more string
literals that are | 333 * Instances of the class {@code AdjacentStrings} represents two or more string
literals that are |
| 340 * implicitly concatenated because of being adjacent (separated only by whitespa
ce). | 334 * implicitly concatenated because of being adjacent (separated only by whitespa
ce). |
| 341 * <p> | 335 * <p> |
| 342 * While the grammar only allows adjacent strings when all of the strings are of
the same kind | 336 * While the grammar only allows adjacent strings when all of the strings are of
the same kind |
| 343 * (single line or multi-line), this class doesn't enforce that restriction. | 337 * (single line or multi-line), this class doesn't enforce that restriction. |
| 344 * <pre> | 338 * <pre> |
| 345 * adjacentStrings ::={@link StringLiteral string} {@link StringLiteral string}+ | 339 * adjacentStrings ::={@link StringLiteral string} {@link StringLiteral string}+ |
| 346 * </pre> | 340 * </pre> |
| 347 * @coverage dart.engine.ast | 341 * @coverage dart.engine.ast |
| 348 */ | 342 */ |
| 349 class AdjacentStrings extends StringLiteral { | 343 class AdjacentStrings extends StringLiteral { |
| 350 | 344 |
| 351 /** | 345 /** |
| 352 * The strings that are implicitly concatenated. | 346 * The strings that are implicitly concatenated. |
| 353 */ | 347 */ |
| 354 NodeList<StringLiteral> _strings; | 348 NodeList<StringLiteral> _strings; |
| 355 | 349 |
| 356 /** | 350 /** |
| 357 * Initialize a newly created list of adjacent strings. | 351 * Initialize a newly created list of adjacent strings. |
| 358 * @param strings the strings that are implicitly concatenated | 352 * @param strings the strings that are implicitly concatenated |
| 359 */ | 353 */ |
| 360 AdjacentStrings.full(List<StringLiteral> strings) { | 354 AdjacentStrings.full(List<StringLiteral> strings) { |
| 361 this._strings = new NodeList<StringLiteral>(this); | 355 this._strings = new NodeList<StringLiteral>(this); |
| 362 this._strings.addAll(strings); | 356 this._strings.addAll(strings); |
| 363 } | 357 } |
| 364 | 358 |
| 365 /** | 359 /** |
| 366 * Initialize a newly created list of adjacent strings. | 360 * Initialize a newly created list of adjacent strings. |
| 367 * @param strings the strings that are implicitly concatenated | 361 * @param strings the strings that are implicitly concatenated |
| 368 */ | 362 */ |
| 369 AdjacentStrings({List<StringLiteral> strings}) : this.full(strings); | 363 AdjacentStrings({List<StringLiteral> strings}) : this.full(strings); |
| 370 accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this); | 364 accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this); |
| 371 Token get beginToken => _strings.beginToken; | 365 Token get beginToken => _strings.beginToken; |
| 372 Token get endToken => _strings.endToken; | 366 Token get endToken => _strings.endToken; |
| 373 | 367 |
| 374 /** | 368 /** |
| 375 * Return the strings that are implicitly concatenated. | 369 * Return the strings that are implicitly concatenated. |
| 376 * @return the strings that are implicitly concatenated | 370 * @return the strings that are implicitly concatenated |
| 377 */ | 371 */ |
| 378 NodeList<StringLiteral> get strings => _strings; | 372 NodeList<StringLiteral> get strings => _strings; |
| 379 void visitChildren(ASTVisitor<Object> visitor) { | 373 void visitChildren(ASTVisitor<Object> visitor) { |
| 380 _strings.accept(visitor); | 374 _strings.accept(visitor); |
| 381 } | 375 } |
| 382 void appendStringValue(JavaStringBuilder builder) { | 376 void appendStringValue(JavaStringBuilder builder) { |
| 383 for (StringLiteral stringLiteral in strings) { | 377 for (StringLiteral stringLiteral in strings) { |
| 384 stringLiteral.appendStringValue(builder); | 378 stringLiteral.appendStringValue(builder); |
| 385 } | 379 } |
| 386 } | 380 } |
| 387 } | 381 } |
| 388 | |
| 389 /** | 382 /** |
| 390 * The abstract class {@code AnnotatedNode} defines the behavior of nodes that c
an be annotated with | 383 * The abstract class {@code AnnotatedNode} defines the behavior of nodes that c
an be annotated with |
| 391 * both a comment and metadata. | 384 * both a comment and metadata. |
| 392 * @coverage dart.engine.ast | 385 * @coverage dart.engine.ast |
| 393 */ | 386 */ |
| 394 abstract class AnnotatedNode extends ASTNode { | 387 abstract class AnnotatedNode extends ASTNode { |
| 395 | 388 |
| 396 /** | 389 /** |
| 397 * The documentation comment associated with this node, or {@code null} if thi
s node does not have | 390 * The documentation comment associated with this node, or {@code null} if thi
s node does not have |
| 398 * a documentation comment associated with it. | 391 * a documentation comment associated with it. |
| 399 */ | 392 */ |
| 400 Comment _comment; | 393 Comment _comment; |
| 401 | 394 |
| 402 /** | 395 /** |
| 403 * The annotations associated with this node. | 396 * The annotations associated with this node. |
| 404 */ | 397 */ |
| 405 NodeList<Annotation> _metadata; | 398 NodeList<Annotation> _metadata; |
| 406 | 399 |
| 407 /** | 400 /** |
| 408 * Initialize a newly created node. | 401 * Initialize a newly created node. |
| 409 * @param comment the documentation comment associated with this node | 402 * @param comment the documentation comment associated with this node |
| 410 * @param metadata the annotations associated with this node | 403 * @param metadata the annotations associated with this node |
| 411 */ | 404 */ |
| 412 AnnotatedNode.full(Comment comment, List<Annotation> metadata) { | 405 AnnotatedNode.full(Comment comment, List<Annotation> metadata) { |
| 413 this._metadata = new NodeList<Annotation>(this); | 406 this._metadata = new NodeList<Annotation>(this); |
| 414 this._comment = becomeParentOf(comment); | 407 this._comment = becomeParentOf(comment); |
| 415 this._metadata.addAll(metadata); | 408 this._metadata.addAll(metadata); |
| 416 } | 409 } |
| 417 | 410 |
| 418 /** | 411 /** |
| 419 * Initialize a newly created node. | 412 * Initialize a newly created node. |
| 420 * @param comment the documentation comment associated with this node | 413 * @param comment the documentation comment associated with this node |
| 421 * @param metadata the annotations associated with this node | 414 * @param metadata the annotations associated with this node |
| 422 */ | 415 */ |
| 423 AnnotatedNode({Comment comment, List<Annotation> metadata}) : this.full(commen
t, metadata); | 416 AnnotatedNode({Comment comment, List<Annotation> metadata}) : this.full(commen
t, metadata); |
| 424 Token get beginToken { | 417 Token get beginToken { |
| 425 if (_comment == null) { | 418 if (_comment == null) { |
| 426 if (_metadata.isEmpty) { | 419 if (_metadata.isEmpty) { |
| 427 return firstTokenAfterCommentAndMetadata; | 420 return firstTokenAfterCommentAndMetadata; |
| 428 } else { | 421 } else { |
| 429 return _metadata.beginToken; | 422 return _metadata.beginToken; |
| 430 } | 423 } |
| 431 } else if (_metadata.isEmpty) { | 424 } else if (_metadata.isEmpty) { |
| 432 return _comment.beginToken; | 425 return _comment.beginToken; |
| 433 } | 426 } |
| 434 Token commentToken = _comment.beginToken; | 427 Token commentToken = _comment.beginToken; |
| 435 Token metadataToken = _metadata.beginToken; | 428 Token metadataToken = _metadata.beginToken; |
| 436 if (commentToken.offset < metadataToken.offset) { | 429 if (commentToken.offset < metadataToken.offset) { |
| 437 return commentToken; | 430 return commentToken; |
| 438 } | 431 } |
| 439 return metadataToken; | 432 return metadataToken; |
| 440 } | 433 } |
| 441 | 434 |
| 442 /** | 435 /** |
| 443 * Return the documentation comment associated with this node, or {@code null}
if this node does | 436 * Return the documentation comment associated with this node, or {@code null}
if this node does |
| 444 * not have a documentation comment associated with it. | 437 * not have a documentation comment associated with it. |
| 445 * @return the documentation comment associated with this node | 438 * @return the documentation comment associated with this node |
| 446 */ | 439 */ |
| 447 Comment get documentationComment => _comment; | 440 Comment get documentationComment => _comment; |
| 448 | 441 |
| 449 /** | 442 /** |
| 450 * Return the annotations associated with this node. | 443 * Return the annotations associated with this node. |
| 451 * @return the annotations associated with this node | 444 * @return the annotations associated with this node |
| 452 */ | 445 */ |
| 453 NodeList<Annotation> get metadata => _metadata; | 446 NodeList<Annotation> get metadata => _metadata; |
| 454 | 447 |
| 455 /** | 448 /** |
| 456 * Set the documentation comment associated with this node to the given commen
t. | 449 * Set the documentation comment associated with this node to the given commen
t. |
| 457 * @param comment the documentation comment to be associated with this node | 450 * @param comment the documentation comment to be associated with this node |
| 458 */ | 451 */ |
| 459 void set documentationComment(Comment comment2) { | 452 void set documentationComment(Comment comment2) { |
| 460 this._comment = becomeParentOf(comment2); | 453 this._comment = becomeParentOf(comment2); |
| 461 } | 454 } |
| 462 | 455 |
| 463 /** | 456 /** |
| 464 * Set the metadata associated with this node to the given metadata. | 457 * Set the metadata associated with this node to the given metadata. |
| 465 * @param metadata the metadata to be associated with this node | 458 * @param metadata the metadata to be associated with this node |
| 466 */ | 459 */ |
| 467 void set metadata(List<Annotation> metadata2) { | 460 void set metadata(List<Annotation> metadata2) { |
| 468 this._metadata.clear(); | 461 this._metadata.clear(); |
| 469 this._metadata.addAll(metadata2); | 462 this._metadata.addAll(metadata2); |
| 470 } | 463 } |
| 471 void visitChildren(ASTVisitor<Object> visitor) { | 464 void visitChildren(ASTVisitor<Object> visitor) { |
| 472 if (commentIsBeforeAnnotations()) { | 465 if (commentIsBeforeAnnotations()) { |
| 473 safelyVisitChild(_comment, visitor); | 466 safelyVisitChild(_comment, visitor); |
| 474 _metadata.accept(visitor); | 467 _metadata.accept(visitor); |
| 475 } else { | 468 } else { |
| 476 for (ASTNode child in sortedCommentAndAnnotations) { | 469 for (ASTNode child in sortedCommentAndAnnotations) { |
| 477 child.accept(visitor); | 470 child.accept(visitor); |
| 478 } | 471 } |
| 479 } | 472 } |
| 480 } | 473 } |
| 481 | 474 |
| 482 /** | 475 /** |
| 483 * Return the first token following the comment and metadata. | 476 * Return the first token following the comment and metadata. |
| 484 * @return the first token following the comment and metadata | 477 * @return the first token following the comment and metadata |
| 485 */ | 478 */ |
| 486 Token get firstTokenAfterCommentAndMetadata; | 479 Token get firstTokenAfterCommentAndMetadata; |
| 487 | 480 |
| 488 /** | 481 /** |
| 489 * Return {@code true} if the comment is lexically before any annotations. | 482 * Return {@code true} if the comment is lexically before any annotations. |
| 490 * @return {@code true} if the comment is lexically before any annotations | 483 * @return {@code true} if the comment is lexically before any annotations |
| 491 */ | 484 */ |
| 492 bool commentIsBeforeAnnotations() { | 485 bool commentIsBeforeAnnotations() { |
| 493 if (_comment == null || _metadata.isEmpty) { | 486 if (_comment == null || _metadata.isEmpty) { |
| 494 return true; | 487 return true; |
| 495 } | 488 } |
| 496 Annotation firstAnnotation = _metadata[0]; | 489 Annotation firstAnnotation = _metadata[0]; |
| 497 return _comment.offset < firstAnnotation.offset; | 490 return _comment.offset < firstAnnotation.offset; |
| 498 } | 491 } |
| 499 | 492 |
| 500 /** | 493 /** |
| 501 * Return an array containing the comment and annotations associated with this
node, sorted in | 494 * Return an array containing the comment and annotations associated with this
node, sorted in |
| 502 * lexical order. | 495 * lexical order. |
| 503 * @return the comment and annotations associated with this node in the order
in which they | 496 * @return the comment and annotations associated with this node in the order
in which they |
| 504 * appeared in the original source | 497 * appeared in the original source |
| 505 */ | 498 */ |
| 506 List<ASTNode> get sortedCommentAndAnnotations { | 499 List<ASTNode> get sortedCommentAndAnnotations { |
| 507 List<ASTNode> childList = new List<ASTNode>(); | 500 List<ASTNode> childList = new List<ASTNode>(); |
| 508 childList.add(_comment); | 501 childList.add(_comment); |
| 509 childList.addAll(_metadata); | 502 childList.addAll(_metadata); |
| 510 List<ASTNode> children = new List.from(childList); | 503 List<ASTNode> children = new List.from(childList); |
| 511 children.sort(); | 504 children.sort(); |
| 512 return children; | 505 return children; |
| 513 } | 506 } |
| 514 } | 507 } |
| 515 | |
| 516 /** | 508 /** |
| 517 * Instances of the class {@code Annotation} represent an annotation that can be
associated with an | 509 * Instances of the class {@code Annotation} represent an annotation that can be
associated with an |
| 518 * AST node. | 510 * AST node. |
| 519 * <pre> | 511 * <pre> |
| 520 * metadata ::= | 512 * metadata ::= |
| 521 * annotation | 513 * annotation |
| 522 * annotation ::= | 514 * annotation ::= |
| 523 * '@' {@link Identifier qualified} ('.' {@link SimpleIdentifier identifier})? {
@link ArgumentList arguments}? | 515 * '@' {@link Identifier qualified} ('.' {@link SimpleIdentifier identifier})? {
@link ArgumentList arguments}? |
| 524 * </pre> | 516 * </pre> |
| 525 * @coverage dart.engine.ast | 517 * @coverage dart.engine.ast |
| 526 */ | 518 */ |
| 527 class Annotation extends ASTNode { | 519 class Annotation extends ASTNode { |
| 528 | 520 |
| 529 /** | 521 /** |
| 530 * The at sign that introduced the annotation. | 522 * The at sign that introduced the annotation. |
| 531 */ | 523 */ |
| 532 Token _atSign; | 524 Token _atSign; |
| 533 | 525 |
| 534 /** | 526 /** |
| 535 * The name of the class defining the constructor that is being invoked or the
name of the field | 527 * The name of the class defining the constructor that is being invoked or the
name of the field |
| 536 * that is being referenced. | 528 * that is being referenced. |
| 537 */ | 529 */ |
| 538 Identifier _name; | 530 Identifier _name; |
| 539 | 531 |
| 540 /** | 532 /** |
| 541 * The period before the constructor name, or {@code null} if this annotation
is not the | 533 * The period before the constructor name, or {@code null} if this annotation
is not the |
| 542 * invocation of a named constructor. | 534 * invocation of a named constructor. |
| 543 */ | 535 */ |
| 544 Token _period; | 536 Token _period; |
| 545 | 537 |
| 546 /** | 538 /** |
| 547 * The name of the constructor being invoked, or {@code null} if this annotati
on is not the | 539 * The name of the constructor being invoked, or {@code null} if this annotati
on is not the |
| 548 * invocation of a named constructor. | 540 * invocation of a named constructor. |
| 549 */ | 541 */ |
| 550 SimpleIdentifier _constructorName; | 542 SimpleIdentifier _constructorName; |
| 551 | 543 |
| 552 /** | 544 /** |
| 553 * The arguments to the constructor being invoked, or {@code null} if this ann
otation is not the | 545 * The arguments to the constructor being invoked, or {@code null} if this ann
otation is not the |
| 554 * invocation of a constructor. | 546 * invocation of a constructor. |
| 555 */ | 547 */ |
| 556 ArgumentList _arguments; | 548 ArgumentList _arguments; |
| 557 | 549 |
| 558 /** | 550 /** |
| 559 * Initialize a newly created annotation. | 551 * Initialize a newly created annotation. |
| 560 * @param atSign the at sign that introduced the annotation | 552 * @param atSign the at sign that introduced the annotation |
| 561 * @param name the name of the class defining the constructor that is being in
voked or the name of | 553 * @param name the name of the class defining the constructor that is being in
voked or the name of |
| 562 * the field that is being referenced | 554 * the field that is being referenced |
| 563 * @param period the period before the constructor name, or {@code null} if th
is annotation is not | 555 * @param period the period before the constructor name, or {@code null} if th
is annotation is not |
| 564 * the invocation of a named constructor | 556 * the invocation of a named constructor |
| 565 * @param constructorName the name of the constructor being invoked, or {@code
null} if this | 557 * @param constructorName the name of the constructor being invoked, or {@code
null} if this |
| 566 * annotation is not the invocation of a named constructor | 558 * annotation is not the invocation of a named constructor |
| 567 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this | 559 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this |
| 568 * annotation is not the invocation of a constructor | 560 * annotation is not the invocation of a constructor |
| 569 */ | 561 */ |
| 570 Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier
constructorName, ArgumentList arguments) { | 562 Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier
constructorName, ArgumentList arguments) { |
| 571 this._atSign = atSign; | 563 this._atSign = atSign; |
| 572 this._name = becomeParentOf(name); | 564 this._name = becomeParentOf(name); |
| 573 this._period = period; | 565 this._period = period; |
| 574 this._constructorName = becomeParentOf(constructorName); | 566 this._constructorName = becomeParentOf(constructorName); |
| 575 this._arguments = becomeParentOf(arguments); | 567 this._arguments = becomeParentOf(arguments); |
| 576 } | 568 } |
| 577 | 569 |
| 578 /** | 570 /** |
| 579 * Initialize a newly created annotation. | 571 * Initialize a newly created annotation. |
| 580 * @param atSign the at sign that introduced the annotation | 572 * @param atSign the at sign that introduced the annotation |
| 581 * @param name the name of the class defining the constructor that is being in
voked or the name of | 573 * @param name the name of the class defining the constructor that is being in
voked or the name of |
| 582 * the field that is being referenced | 574 * the field that is being referenced |
| 583 * @param period the period before the constructor name, or {@code null} if th
is annotation is not | 575 * @param period the period before the constructor name, or {@code null} if th
is annotation is not |
| 584 * the invocation of a named constructor | 576 * the invocation of a named constructor |
| 585 * @param constructorName the name of the constructor being invoked, or {@code
null} if this | 577 * @param constructorName the name of the constructor being invoked, or {@code
null} if this |
| 586 * annotation is not the invocation of a named constructor | 578 * annotation is not the invocation of a named constructor |
| 587 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this | 579 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this |
| 588 * annotation is not the invocation of a constructor | 580 * annotation is not the invocation of a constructor |
| 589 */ | 581 */ |
| 590 Annotation({Token atSign, Identifier name, Token period, SimpleIdentifier cons
tructorName, ArgumentList arguments}) : this.full(atSign, name, period, construc
torName, arguments); | 582 Annotation({Token atSign, Identifier name, Token period, SimpleIdentifier cons
tructorName, ArgumentList arguments}) : this.full(atSign, name, period, construc
torName, arguments); |
| 591 accept(ASTVisitor visitor) => visitor.visitAnnotation(this); | 583 accept(ASTVisitor visitor) => visitor.visitAnnotation(this); |
| 592 | 584 |
| 593 /** | 585 /** |
| 594 * Return the arguments to the constructor being invoked, or {@code null} if t
his annotation is | 586 * Return the arguments to the constructor being invoked, or {@code null} if t
his annotation is |
| 595 * not the invocation of a constructor. | 587 * not the invocation of a constructor. |
| 596 * @return the arguments to the constructor being invoked | 588 * @return the arguments to the constructor being invoked |
| 597 */ | 589 */ |
| 598 ArgumentList get arguments => _arguments; | 590 ArgumentList get arguments => _arguments; |
| 599 | 591 |
| 600 /** | 592 /** |
| 601 * Return the at sign that introduced the annotation. | 593 * Return the at sign that introduced the annotation. |
| 602 * @return the at sign that introduced the annotation | 594 * @return the at sign that introduced the annotation |
| 603 */ | 595 */ |
| 604 Token get atSign => _atSign; | 596 Token get atSign => _atSign; |
| 605 Token get beginToken => _atSign; | 597 Token get beginToken => _atSign; |
| 606 | 598 |
| 607 /** | 599 /** |
| 608 * Return the name of the constructor being invoked, or {@code null} if this a
nnotation is not the | 600 * Return the name of the constructor being invoked, or {@code null} if this a
nnotation is not the |
| 609 * invocation of a named constructor. | 601 * invocation of a named constructor. |
| 610 * @return the name of the constructor being invoked | 602 * @return the name of the constructor being invoked |
| 611 */ | 603 */ |
| 612 SimpleIdentifier get constructorName => _constructorName; | 604 SimpleIdentifier get constructorName => _constructorName; |
| 613 | 605 |
| 614 /** | 606 /** |
| 615 * Return the element associated with this annotation, or {@code null} if the
AST structure has | 607 * Return the element associated with this annotation, or {@code null} if the
AST structure has |
| 616 * not been resolved or if this annotation could not be resolved. | 608 * not been resolved or if this annotation could not be resolved. |
| 617 * @return the element associated with this annotation | 609 * @return the element associated with this annotation |
| 618 */ | 610 */ |
| 619 Element get element { | 611 Element get element { |
| 620 if (_constructorName != null) { | 612 if (_constructorName != null) { |
| 621 return _constructorName.element; | 613 return _constructorName.element; |
| 622 } else if (_name != null) { | 614 } else if (_name != null) { |
| 623 return _name.element; | 615 return _name.element; |
| 624 } | 616 } |
| 625 return null; | 617 return null; |
| 626 } | 618 } |
| 627 Token get endToken { | 619 Token get endToken { |
| 628 if (_arguments != null) { | 620 if (_arguments != null) { |
| 629 return _arguments.endToken; | 621 return _arguments.endToken; |
| 630 } else if (_constructorName != null) { | 622 } else if (_constructorName != null) { |
| 631 return _constructorName.endToken; | 623 return _constructorName.endToken; |
| 632 } | 624 } |
| 633 return _name.endToken; | 625 return _name.endToken; |
| 634 } | 626 } |
| 635 | 627 |
| 636 /** | 628 /** |
| 637 * Return the name of the class defining the constructor that is being invoked
or the name of the | 629 * Return the name of the class defining the constructor that is being invoked
or the name of the |
| 638 * field that is being referenced. | 630 * field that is being referenced. |
| 639 * @return the name of the constructor being invoked or the name of the field
being referenced | 631 * @return the name of the constructor being invoked or the name of the field
being referenced |
| 640 */ | 632 */ |
| 641 Identifier get name => _name; | 633 Identifier get name => _name; |
| 642 | 634 |
| 643 /** | 635 /** |
| 644 * Return the period before the constructor name, or {@code null} if this anno
tation is not the | 636 * Return the period before the constructor name, or {@code null} if this anno
tation is not the |
| 645 * invocation of a named constructor. | 637 * invocation of a named constructor. |
| 646 * @return the period before the constructor name | 638 * @return the period before the constructor name |
| 647 */ | 639 */ |
| 648 Token get period => _period; | 640 Token get period => _period; |
| 649 | 641 |
| 650 /** | 642 /** |
| 651 * Set the arguments to the constructor being invoked to the given arguments. | 643 * Set the arguments to the constructor being invoked to the given arguments. |
| 652 * @param arguments the arguments to the constructor being invoked | 644 * @param arguments the arguments to the constructor being invoked |
| 653 */ | 645 */ |
| 654 void set arguments(ArgumentList arguments2) { | 646 void set arguments(ArgumentList arguments2) { |
| 655 this._arguments = becomeParentOf(arguments2); | 647 this._arguments = becomeParentOf(arguments2); |
| 656 } | 648 } |
| 657 | 649 |
| 658 /** | 650 /** |
| 659 * Set the at sign that introduced the annotation to the given token. | 651 * Set the at sign that introduced the annotation to the given token. |
| 660 * @param atSign the at sign that introduced the annotation | 652 * @param atSign the at sign that introduced the annotation |
| 661 */ | 653 */ |
| 662 void set atSign(Token atSign2) { | 654 void set atSign(Token atSign2) { |
| 663 this._atSign = atSign2; | 655 this._atSign = atSign2; |
| 664 } | 656 } |
| 665 | 657 |
| 666 /** | 658 /** |
| 667 * Set the name of the constructor being invoked to the given name. | 659 * Set the name of the constructor being invoked to the given name. |
| 668 * @param constructorName the name of the constructor being invoked | 660 * @param constructorName the name of the constructor being invoked |
| 669 */ | 661 */ |
| 670 void set constructorName(SimpleIdentifier constructorName2) { | 662 void set constructorName(SimpleIdentifier constructorName2) { |
| 671 this._constructorName = becomeParentOf(constructorName2); | 663 this._constructorName = becomeParentOf(constructorName2); |
| 672 } | 664 } |
| 673 | 665 |
| 674 /** | 666 /** |
| 675 * Set the name of the class defining the constructor that is being invoked or
the name of the | 667 * Set the name of the class defining the constructor that is being invoked or
the name of the |
| 676 * field that is being referenced to the given name. | 668 * field that is being referenced to the given name. |
| 677 * @param name the name of the constructor being invoked or the name of the fi
eld being referenced | 669 * @param name the name of the constructor being invoked or the name of the fi
eld being referenced |
| 678 */ | 670 */ |
| 679 void set name(Identifier name2) { | 671 void set name(Identifier name2) { |
| 680 this._name = becomeParentOf(name2); | 672 this._name = becomeParentOf(name2); |
| 681 } | 673 } |
| 682 | 674 |
| 683 /** | 675 /** |
| 684 * Set the period before the constructor name to the given token. | 676 * Set the period before the constructor name to the given token. |
| 685 * @param period the period before the constructor name | 677 * @param period the period before the constructor name |
| 686 */ | 678 */ |
| 687 void set period(Token period2) { | 679 void set period(Token period2) { |
| 688 this._period = period2; | 680 this._period = period2; |
| 689 } | 681 } |
| 690 void visitChildren(ASTVisitor<Object> visitor) { | 682 void visitChildren(ASTVisitor<Object> visitor) { |
| 691 safelyVisitChild(_name, visitor); | 683 safelyVisitChild(_name, visitor); |
| 692 safelyVisitChild(_constructorName, visitor); | 684 safelyVisitChild(_constructorName, visitor); |
| 693 safelyVisitChild(_arguments, visitor); | 685 safelyVisitChild(_arguments, visitor); |
| 694 } | 686 } |
| 695 } | 687 } |
| 696 | |
| 697 /** | 688 /** |
| 698 * Instances of the class {@code ArgumentDefinitionTest} represent an argument d
efinition test. | 689 * Instances of the class {@code ArgumentDefinitionTest} represent an argument d
efinition test. |
| 699 * <pre> | 690 * <pre> |
| 700 * argumentDefinitionTest ::= | 691 * argumentDefinitionTest ::= |
| 701 * '?' {@link SimpleIdentifier identifier}</pre> | 692 * '?' {@link SimpleIdentifier identifier}</pre> |
| 702 * @coverage dart.engine.ast | 693 * @coverage dart.engine.ast |
| 703 */ | 694 */ |
| 704 class ArgumentDefinitionTest extends Expression { | 695 class ArgumentDefinitionTest extends Expression { |
| 705 | 696 |
| 706 /** | 697 /** |
| 707 * The token representing the question mark. | 698 * The token representing the question mark. |
| 708 */ | 699 */ |
| 709 Token _question; | 700 Token _question; |
| 710 | 701 |
| 711 /** | 702 /** |
| 712 * The identifier representing the argument being tested. | 703 * The identifier representing the argument being tested. |
| 713 */ | 704 */ |
| 714 SimpleIdentifier _identifier; | 705 SimpleIdentifier _identifier; |
| 715 | 706 |
| 716 /** | 707 /** |
| 717 * Initialize a newly created argument definition test. | 708 * Initialize a newly created argument definition test. |
| 718 * @param question the token representing the question mark | 709 * @param question the token representing the question mark |
| 719 * @param identifier the identifier representing the argument being tested | 710 * @param identifier the identifier representing the argument being tested |
| 720 */ | 711 */ |
| 721 ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) { | 712 ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) { |
| 722 this._question = question; | 713 this._question = question; |
| 723 this._identifier = becomeParentOf(identifier); | 714 this._identifier = becomeParentOf(identifier); |
| 724 } | 715 } |
| 725 | 716 |
| 726 /** | 717 /** |
| 727 * Initialize a newly created argument definition test. | 718 * Initialize a newly created argument definition test. |
| 728 * @param question the token representing the question mark | 719 * @param question the token representing the question mark |
| 729 * @param identifier the identifier representing the argument being tested | 720 * @param identifier the identifier representing the argument being tested |
| 730 */ | 721 */ |
| 731 ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.f
ull(question, identifier); | 722 ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.f
ull(question, identifier); |
| 732 accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this); | 723 accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this); |
| 733 Token get beginToken => _question; | 724 Token get beginToken => _question; |
| 734 Token get endToken => _identifier.endToken; | 725 Token get endToken => _identifier.endToken; |
| 735 | 726 |
| 736 /** | 727 /** |
| 737 * Return the identifier representing the argument being tested. | 728 * Return the identifier representing the argument being tested. |
| 738 * @return the identifier representing the argument being tested | 729 * @return the identifier representing the argument being tested |
| 739 */ | 730 */ |
| 740 SimpleIdentifier get identifier => _identifier; | 731 SimpleIdentifier get identifier => _identifier; |
| 741 | 732 |
| 742 /** | 733 /** |
| 743 * Return the token representing the question mark. | 734 * Return the token representing the question mark. |
| 744 * @return the token representing the question mark | 735 * @return the token representing the question mark |
| 745 */ | 736 */ |
| 746 Token get question => _question; | 737 Token get question => _question; |
| 747 | 738 |
| 748 /** | 739 /** |
| 749 * Set the identifier representing the argument being tested to the given iden
tifier. | 740 * Set the identifier representing the argument being tested to the given iden
tifier. |
| 750 * @param identifier the identifier representing the argument being tested | 741 * @param identifier the identifier representing the argument being tested |
| 751 */ | 742 */ |
| 752 void set identifier(SimpleIdentifier identifier2) { | 743 void set identifier(SimpleIdentifier identifier2) { |
| 753 this._identifier = becomeParentOf(identifier2); | 744 this._identifier = becomeParentOf(identifier2); |
| 754 } | 745 } |
| 755 | 746 |
| 756 /** | 747 /** |
| 757 * Set the token representing the question mark to the given token. | 748 * Set the token representing the question mark to the given token. |
| 758 * @param question the token representing the question mark | 749 * @param question the token representing the question mark |
| 759 */ | 750 */ |
| 760 void set question(Token question2) { | 751 void set question(Token question2) { |
| 761 this._question = question2; | 752 this._question = question2; |
| 762 } | 753 } |
| 763 void visitChildren(ASTVisitor<Object> visitor) { | 754 void visitChildren(ASTVisitor<Object> visitor) { |
| 764 safelyVisitChild(_identifier, visitor); | 755 safelyVisitChild(_identifier, visitor); |
| 765 } | 756 } |
| 766 } | 757 } |
| 767 | |
| 768 /** | 758 /** |
| 769 * Instances of the class {@code ArgumentList} represent a list of arguments in
the invocation of a | 759 * Instances of the class {@code ArgumentList} represent a list of arguments in
the invocation of a |
| 770 * executable element: a function, method, or constructor. | 760 * executable element: a function, method, or constructor. |
| 771 * <pre> | 761 * <pre> |
| 772 * argumentList ::= | 762 * argumentList ::= |
| 773 * '(' arguments? ')' | 763 * '(' arguments? ')' |
| 774 * arguments ::={@link NamedExpression namedArgument} (',' {@link NamedExpressio
n namedArgument}) | 764 * arguments ::={@link NamedExpression namedArgument} (',' {@link NamedExpressio
n namedArgument}) |
| 775 * | {@link Expression expressionList} (',' {@link NamedExpression namedArgument
}) | 765 * | {@link Expression expressionList} (',' {@link NamedExpression namedArgument
}) |
| 776 * </pre> | 766 * </pre> |
| 777 * @coverage dart.engine.ast | 767 * @coverage dart.engine.ast |
| 778 */ | 768 */ |
| 779 class ArgumentList extends ASTNode { | 769 class ArgumentList extends ASTNode { |
| 780 | 770 |
| 781 /** | 771 /** |
| 782 * The left parenthesis. | 772 * The left parenthesis. |
| 783 */ | 773 */ |
| 784 Token _leftParenthesis; | 774 Token _leftParenthesis; |
| 785 | 775 |
| 786 /** | 776 /** |
| 787 * The expressions producing the values of the arguments. | 777 * The expressions producing the values of the arguments. |
| 788 */ | 778 */ |
| 789 NodeList<Expression> _arguments; | 779 NodeList<Expression> _arguments; |
| 790 | 780 |
| 791 /** | 781 /** |
| 792 * The right parenthesis. | 782 * The right parenthesis. |
| 793 */ | 783 */ |
| 794 Token _rightParenthesis; | 784 Token _rightParenthesis; |
| 795 | 785 |
| 796 /** | 786 /** |
| 797 * An array containing the elements representing the parameters corresponding
to each of the | 787 * An array containing the elements representing the parameters corresponding
to each of the |
| 798 * arguments in this list, or {@code null} if the AST has not been resolved or
if the function or | 788 * arguments in this list, or {@code null} if the AST has not been resolved or
if the function or |
| 799 * method being invoked could not be determined. The array must be the same le
ngth as the number | 789 * method being invoked could not be determined. The array must be the same le
ngth as the number |
| 800 * of arguments, but can contain {@code null} entries if a given argument does
not correspond to a | 790 * of arguments, but can contain {@code null} entries if a given argument does
not correspond to a |
| 801 * formal parameter. | 791 * formal parameter. |
| 802 */ | 792 */ |
| 803 List<ParameterElement> _correspondingParameters; | 793 List<ParameterElement> _correspondingParameters; |
| 804 | 794 |
| 805 /** | 795 /** |
| 806 * Initialize a newly created list of arguments. | 796 * Initialize a newly created list of arguments. |
| 807 * @param leftParenthesis the left parenthesis | 797 * @param leftParenthesis the left parenthesis |
| 808 * @param arguments the expressions producing the values of the arguments | 798 * @param arguments the expressions producing the values of the arguments |
| 809 * @param rightParenthesis the right parenthesis | 799 * @param rightParenthesis the right parenthesis |
| 810 */ | 800 */ |
| 811 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig
htParenthesis) { | 801 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig
htParenthesis) { |
| 812 this._arguments = new NodeList<Expression>(this); | 802 this._arguments = new NodeList<Expression>(this); |
| 813 this._leftParenthesis = leftParenthesis; | 803 this._leftParenthesis = leftParenthesis; |
| 814 this._arguments.addAll(arguments); | 804 this._arguments.addAll(arguments); |
| 815 this._rightParenthesis = rightParenthesis; | 805 this._rightParenthesis = rightParenthesis; |
| 816 } | 806 } |
| 817 | 807 |
| 818 /** | 808 /** |
| 819 * Initialize a newly created list of arguments. | 809 * Initialize a newly created list of arguments. |
| 820 * @param leftParenthesis the left parenthesis | 810 * @param leftParenthesis the left parenthesis |
| 821 * @param arguments the expressions producing the values of the arguments | 811 * @param arguments the expressions producing the values of the arguments |
| 822 * @param rightParenthesis the right parenthesis | 812 * @param rightParenthesis the right parenthesis |
| 823 */ | 813 */ |
| 824 ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightPa
renthesis}) : this.full(leftParenthesis, arguments, rightParenthesis); | 814 ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightPa
renthesis}) : this.full(leftParenthesis, arguments, rightParenthesis); |
| 825 accept(ASTVisitor visitor) => visitor.visitArgumentList(this); | 815 accept(ASTVisitor visitor) => visitor.visitArgumentList(this); |
| 826 | 816 |
| 827 /** | 817 /** |
| 828 * Return the expressions producing the values of the arguments. Although the
language requires | 818 * Return the expressions producing the values of the arguments. Although the
language requires |
| 829 * that positional arguments appear before named arguments, this class allows
them to be | 819 * that positional arguments appear before named arguments, this class allows
them to be |
| 830 * intermixed. | 820 * intermixed. |
| 831 * @return the expressions producing the values of the arguments | 821 * @return the expressions producing the values of the arguments |
| 832 */ | 822 */ |
| 833 NodeList<Expression> get arguments => _arguments; | 823 NodeList<Expression> get arguments => _arguments; |
| 834 Token get beginToken => _leftParenthesis; | 824 Token get beginToken => _leftParenthesis; |
| 835 Token get endToken => _rightParenthesis; | 825 Token get endToken => _rightParenthesis; |
| 836 | 826 |
| 837 /** | 827 /** |
| 838 * Return the left parenthesis. | 828 * Return the left parenthesis. |
| 839 * @return the left parenthesis | 829 * @return the left parenthesis |
| 840 */ | 830 */ |
| 841 Token get leftParenthesis => _leftParenthesis; | 831 Token get leftParenthesis => _leftParenthesis; |
| 842 | 832 |
| 843 /** | 833 /** |
| 844 * Return the right parenthesis. | 834 * Return the right parenthesis. |
| 845 * @return the right parenthesis | 835 * @return the right parenthesis |
| 846 */ | 836 */ |
| 847 Token get rightParenthesis => _rightParenthesis; | 837 Token get rightParenthesis => _rightParenthesis; |
| 848 | 838 |
| 849 /** | 839 /** |
| 850 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given | 840 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given |
| 851 * array of parameters. The array of parameters must be the same length as the
number of | 841 * array of parameters. The array of parameters must be the same length as the
number of |
| 852 * arguments, but can contain {@code null} entries if a given argument does no
t correspond to a | 842 * arguments, but can contain {@code null} entries if a given argument does no
t correspond to a |
| 853 * formal parameter. | 843 * formal parameter. |
| 854 * @param parameters the parameter elements corresponding to the arguments | 844 * @param parameters the parameter elements corresponding to the arguments |
| 855 */ | 845 */ |
| 856 void set correspondingParameters(List<ParameterElement> parameters) { | 846 void set correspondingParameters(List<ParameterElement> parameters) { |
| 857 if (parameters.length != _arguments.length) { | 847 if (parameters.length != _arguments.length) { |
| 858 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); | 848 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); |
| 859 } | 849 } |
| 860 _correspondingParameters = parameters; | 850 _correspondingParameters = parameters; |
| 861 } | 851 } |
| 862 | 852 |
| 863 /** | 853 /** |
| 864 * Set the left parenthesis to the given token. | 854 * Set the left parenthesis to the given token. |
| 865 * @param parenthesis the left parenthesis | 855 * @param parenthesis the left parenthesis |
| 866 */ | 856 */ |
| 867 void set leftParenthesis(Token parenthesis) { | 857 void set leftParenthesis(Token parenthesis) { |
| 868 _leftParenthesis = parenthesis; | 858 _leftParenthesis = parenthesis; |
| 869 } | 859 } |
| 870 | 860 |
| 871 /** | 861 /** |
| 872 * Set the right parenthesis to the given token. | 862 * Set the right parenthesis to the given token. |
| 873 * @param parenthesis the right parenthesis | 863 * @param parenthesis the right parenthesis |
| 874 */ | 864 */ |
| 875 void set rightParenthesis(Token parenthesis) { | 865 void set rightParenthesis(Token parenthesis) { |
| 876 _rightParenthesis = parenthesis; | 866 _rightParenthesis = parenthesis; |
| 877 } | 867 } |
| 878 void visitChildren(ASTVisitor<Object> visitor) { | 868 void visitChildren(ASTVisitor<Object> visitor) { |
| 879 _arguments.accept(visitor); | 869 _arguments.accept(visitor); |
| 880 } | 870 } |
| 881 | 871 |
| 882 /** | 872 /** |
| 883 * If the given expression is a child of this list, and the AST structure has
been resolved, and | 873 * If the given expression is a child of this list, and the AST structure has
been resolved, and |
| 884 * the function being invoked is known, and the expression corresponds to one
of the parameters of | 874 * the function being invoked is known, and the expression corresponds to one
of the parameters of |
| 885 * the function being invoked, then return the parameter element representing
the parameter to | 875 * the function being invoked, then return the parameter element representing
the parameter to |
| 886 * which the value of the given expression will be bound. Otherwise, return {@
code null}. | 876 * which the value of the given expression will be bound. Otherwise, return {@
code null}. |
| 887 * <p> | 877 * <p> |
| 888 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 878 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
| 889 * @param expression the expression corresponding to the parameter to be retur
ned | 879 * @param expression the expression corresponding to the parameter to be retur
ned |
| 890 * @return the parameter element representing the parameter to which the value
of the expression | 880 * @return the parameter element representing the parameter to which the value
of the expression |
| 891 * will be bound | 881 * will be bound |
| 892 */ | 882 */ |
| 893 ParameterElement getParameterElementFor(Expression expression) { | 883 ParameterElement getParameterElementFor(Expression expression) { |
| 894 if (_correspondingParameters == null) { | 884 if (_correspondingParameters == null) { |
| 895 return null; | 885 return null; |
| 896 } | 886 } |
| 897 int index = _arguments.indexOf(expression); | 887 int index = _arguments.indexOf(expression); |
| 898 if (index < 0) { | 888 if (index < 0) { |
| 899 return null; | 889 return null; |
| 900 } | 890 } |
| 901 return _correspondingParameters[index]; | 891 return _correspondingParameters[index]; |
| 902 } | 892 } |
| 903 } | 893 } |
| 904 | |
| 905 /** | 894 /** |
| 906 * Instances of the class {@code AsExpression} represent an 'as' expression. | 895 * Instances of the class {@code AsExpression} represent an 'as' expression. |
| 907 * <pre> | 896 * <pre> |
| 908 * asExpression ::={@link Expression expression} 'as' {@link TypeName type}</pre
> | 897 * asExpression ::={@link Expression expression} 'as' {@link TypeName type}</pre
> |
| 909 * @coverage dart.engine.ast | 898 * @coverage dart.engine.ast |
| 910 */ | 899 */ |
| 911 class AsExpression extends Expression { | 900 class AsExpression extends Expression { |
| 912 | 901 |
| 913 /** | 902 /** |
| 914 * The expression used to compute the value being cast. | 903 * The expression used to compute the value being cast. |
| 915 */ | 904 */ |
| 916 Expression _expression; | 905 Expression _expression; |
| 917 | 906 |
| 918 /** | 907 /** |
| 919 * The as operator. | 908 * The as operator. |
| 920 */ | 909 */ |
| 921 Token _asOperator; | 910 Token _asOperator; |
| 922 | 911 |
| 923 /** | 912 /** |
| 924 * The name of the type being cast to. | 913 * The name of the type being cast to. |
| 925 */ | 914 */ |
| 926 TypeName _type; | 915 TypeName _type; |
| 927 | 916 |
| 928 /** | 917 /** |
| 929 * Initialize a newly created as expression. | 918 * Initialize a newly created as expression. |
| 930 * @param expression the expression used to compute the value being cast | 919 * @param expression the expression used to compute the value being cast |
| 931 * @param isOperator the is operator | 920 * @param isOperator the is operator |
| 932 * @param type the name of the type being cast to | 921 * @param type the name of the type being cast to |
| 933 */ | 922 */ |
| 934 AsExpression.full(Expression expression, Token isOperator, TypeName type) { | 923 AsExpression.full(Expression expression, Token isOperator, TypeName type) { |
| 935 this._expression = becomeParentOf(expression); | 924 this._expression = becomeParentOf(expression); |
| 936 this._asOperator = isOperator; | 925 this._asOperator = isOperator; |
| 937 this._type = becomeParentOf(type); | 926 this._type = becomeParentOf(type); |
| 938 } | 927 } |
| 939 | 928 |
| 940 /** | 929 /** |
| 941 * Initialize a newly created as expression. | 930 * Initialize a newly created as expression. |
| 942 * @param expression the expression used to compute the value being cast | 931 * @param expression the expression used to compute the value being cast |
| 943 * @param isOperator the is operator | 932 * @param isOperator the is operator |
| 944 * @param type the name of the type being cast to | 933 * @param type the name of the type being cast to |
| 945 */ | 934 */ |
| 946 AsExpression({Expression expression, Token isOperator, TypeName type}) : this.
full(expression, isOperator, type); | 935 AsExpression({Expression expression, Token isOperator, TypeName type}) : this.
full(expression, isOperator, type); |
| 947 accept(ASTVisitor visitor) => visitor.visitAsExpression(this); | 936 accept(ASTVisitor visitor) => visitor.visitAsExpression(this); |
| 948 | 937 |
| 949 /** | 938 /** |
| 950 * Return the is operator being applied. | 939 * Return the is operator being applied. |
| 951 * @return the is operator being applied | 940 * @return the is operator being applied |
| 952 */ | 941 */ |
| 953 Token get asOperator => _asOperator; | 942 Token get asOperator => _asOperator; |
| 954 Token get beginToken => _expression.beginToken; | 943 Token get beginToken => _expression.beginToken; |
| 955 Token get endToken => _type.endToken; | 944 Token get endToken => _type.endToken; |
| 956 | 945 |
| 957 /** | 946 /** |
| 958 * Return the expression used to compute the value being cast. | 947 * Return the expression used to compute the value being cast. |
| 959 * @return the expression used to compute the value being cast | 948 * @return the expression used to compute the value being cast |
| 960 */ | 949 */ |
| 961 Expression get expression => _expression; | 950 Expression get expression => _expression; |
| 962 | 951 |
| 963 /** | 952 /** |
| 964 * Return the name of the type being cast to. | 953 * Return the name of the type being cast to. |
| 965 * @return the name of the type being cast to | 954 * @return the name of the type being cast to |
| 966 */ | 955 */ |
| 967 TypeName get type => _type; | 956 TypeName get type => _type; |
| 968 | 957 |
| 969 /** | 958 /** |
| 970 * Set the is operator being applied to the given operator. | 959 * Set the is operator being applied to the given operator. |
| 971 * @param asOperator the is operator being applied | 960 * @param asOperator the is operator being applied |
| 972 */ | 961 */ |
| 973 void set asOperator(Token asOperator2) { | 962 void set asOperator(Token asOperator2) { |
| 974 this._asOperator = asOperator2; | 963 this._asOperator = asOperator2; |
| 975 } | 964 } |
| 976 | 965 |
| 977 /** | 966 /** |
| 978 * Set the expression used to compute the value being cast to the given expres
sion. | 967 * Set the expression used to compute the value being cast to the given expres
sion. |
| 979 * @param expression the expression used to compute the value being cast | 968 * @param expression the expression used to compute the value being cast |
| 980 */ | 969 */ |
| 981 void set expression(Expression expression2) { | 970 void set expression(Expression expression2) { |
| 982 this._expression = becomeParentOf(expression2); | 971 this._expression = becomeParentOf(expression2); |
| 983 } | 972 } |
| 984 | 973 |
| 985 /** | 974 /** |
| 986 * Set the name of the type being cast to to the given name. | 975 * Set the name of the type being cast to to the given name. |
| 987 * @param name the name of the type being cast to | 976 * @param name the name of the type being cast to |
| 988 */ | 977 */ |
| 989 void set type(TypeName name) { | 978 void set type(TypeName name) { |
| 990 this._type = becomeParentOf(name); | 979 this._type = becomeParentOf(name); |
| 991 } | 980 } |
| 992 void visitChildren(ASTVisitor<Object> visitor) { | 981 void visitChildren(ASTVisitor<Object> visitor) { |
| 993 safelyVisitChild(_expression, visitor); | 982 safelyVisitChild(_expression, visitor); |
| 994 safelyVisitChild(_type, visitor); | 983 safelyVisitChild(_type, visitor); |
| 995 } | 984 } |
| 996 } | 985 } |
| 997 | |
| 998 /** | 986 /** |
| 999 * Instances of the class {@code AssertStatement} represent an assert statement. | 987 * Instances of the class {@code AssertStatement} represent an assert statement. |
| 1000 * <pre> | 988 * <pre> |
| 1001 * assertStatement ::= | 989 * assertStatement ::= |
| 1002 * 'assert' '(' {@link Expression conditionalExpression} ')' ';' | 990 * 'assert' '(' {@link Expression conditionalExpression} ')' ';' |
| 1003 * </pre> | 991 * </pre> |
| 1004 * @coverage dart.engine.ast | 992 * @coverage dart.engine.ast |
| 1005 */ | 993 */ |
| 1006 class AssertStatement extends Statement { | 994 class AssertStatement extends Statement { |
| 1007 | 995 |
| 1008 /** | 996 /** |
| 1009 * The token representing the 'assert' keyword. | 997 * The token representing the 'assert' keyword. |
| 1010 */ | 998 */ |
| 1011 Token _keyword; | 999 Token _keyword; |
| 1012 | 1000 |
| 1013 /** | 1001 /** |
| 1014 * The left parenthesis. | 1002 * The left parenthesis. |
| 1015 */ | 1003 */ |
| 1016 Token _leftParenthesis; | 1004 Token _leftParenthesis; |
| 1017 | 1005 |
| 1018 /** | 1006 /** |
| 1019 * The condition that is being asserted to be {@code true}. | 1007 * The condition that is being asserted to be {@code true}. |
| 1020 */ | 1008 */ |
| 1021 Expression _condition; | 1009 Expression _condition; |
| 1022 | 1010 |
| 1023 /** | 1011 /** |
| 1024 * The right parenthesis. | 1012 * The right parenthesis. |
| 1025 */ | 1013 */ |
| 1026 Token _rightParenthesis; | 1014 Token _rightParenthesis; |
| 1027 | 1015 |
| 1028 /** | 1016 /** |
| 1029 * The semicolon terminating the statement. | 1017 * The semicolon terminating the statement. |
| 1030 */ | 1018 */ |
| 1031 Token _semicolon; | 1019 Token _semicolon; |
| 1032 | 1020 |
| 1033 /** | 1021 /** |
| 1034 * Initialize a newly created assert statement. | 1022 * Initialize a newly created assert statement. |
| 1035 * @param keyword the token representing the 'assert' keyword | 1023 * @param keyword the token representing the 'assert' keyword |
| 1036 * @param leftParenthesis the left parenthesis | 1024 * @param leftParenthesis the left parenthesis |
| 1037 * @param condition the condition that is being asserted to be {@code true} | 1025 * @param condition the condition that is being asserted to be {@code true} |
| 1038 * @param rightParenthesis the right parenthesis | 1026 * @param rightParenthesis the right parenthesis |
| 1039 * @param semicolon the semicolon terminating the statement | 1027 * @param semicolon the semicolon terminating the statement |
| 1040 */ | 1028 */ |
| 1041 AssertStatement.full(Token keyword, Token leftParenthesis, Expression conditio
n, Token rightParenthesis, Token semicolon) { | 1029 AssertStatement.full(Token keyword, Token leftParenthesis, Expression conditio
n, Token rightParenthesis, Token semicolon) { |
| 1042 this._keyword = keyword; | 1030 this._keyword = keyword; |
| 1043 this._leftParenthesis = leftParenthesis; | 1031 this._leftParenthesis = leftParenthesis; |
| 1044 this._condition = becomeParentOf(condition); | 1032 this._condition = becomeParentOf(condition); |
| 1045 this._rightParenthesis = rightParenthesis; | 1033 this._rightParenthesis = rightParenthesis; |
| 1046 this._semicolon = semicolon; | 1034 this._semicolon = semicolon; |
| 1047 } | 1035 } |
| 1048 | 1036 |
| 1049 /** | 1037 /** |
| 1050 * Initialize a newly created assert statement. | 1038 * Initialize a newly created assert statement. |
| 1051 * @param keyword the token representing the 'assert' keyword | 1039 * @param keyword the token representing the 'assert' keyword |
| 1052 * @param leftParenthesis the left parenthesis | 1040 * @param leftParenthesis the left parenthesis |
| 1053 * @param condition the condition that is being asserted to be {@code true} | 1041 * @param condition the condition that is being asserted to be {@code true} |
| 1054 * @param rightParenthesis the right parenthesis | 1042 * @param rightParenthesis the right parenthesis |
| 1055 * @param semicolon the semicolon terminating the statement | 1043 * @param semicolon the semicolon terminating the statement |
| 1056 */ | 1044 */ |
| 1057 AssertStatement({Token keyword, Token leftParenthesis, Expression condition, T
oken rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, c
ondition, rightParenthesis, semicolon); | 1045 AssertStatement({Token keyword, Token leftParenthesis, Expression condition, T
oken rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, c
ondition, rightParenthesis, semicolon); |
| 1058 accept(ASTVisitor visitor) => visitor.visitAssertStatement(this); | 1046 accept(ASTVisitor visitor) => visitor.visitAssertStatement(this); |
| 1059 Token get beginToken => _keyword; | 1047 Token get beginToken => _keyword; |
| 1060 | 1048 |
| 1061 /** | 1049 /** |
| 1062 * Return the condition that is being asserted to be {@code true}. | 1050 * Return the condition that is being asserted to be {@code true}. |
| 1063 * @return the condition that is being asserted to be {@code true} | 1051 * @return the condition that is being asserted to be {@code true} |
| 1064 */ | 1052 */ |
| 1065 Expression get condition => _condition; | 1053 Expression get condition => _condition; |
| 1066 Token get endToken => _semicolon; | 1054 Token get endToken => _semicolon; |
| 1067 | 1055 |
| 1068 /** | 1056 /** |
| 1069 * Return the token representing the 'assert' keyword. | 1057 * Return the token representing the 'assert' keyword. |
| 1070 * @return the token representing the 'assert' keyword | 1058 * @return the token representing the 'assert' keyword |
| 1071 */ | 1059 */ |
| 1072 Token get keyword => _keyword; | 1060 Token get keyword => _keyword; |
| 1073 | 1061 |
| 1074 /** | 1062 /** |
| 1075 * Return the left parenthesis. | 1063 * Return the left parenthesis. |
| 1076 * @return the left parenthesis | 1064 * @return the left parenthesis |
| 1077 */ | 1065 */ |
| 1078 Token get leftParenthesis => _leftParenthesis; | 1066 Token get leftParenthesis => _leftParenthesis; |
| 1079 | 1067 |
| 1080 /** | 1068 /** |
| 1081 * Return the right parenthesis. | 1069 * Return the right parenthesis. |
| 1082 * @return the right parenthesis | 1070 * @return the right parenthesis |
| 1083 */ | 1071 */ |
| 1084 Token get rightParenthesis => _rightParenthesis; | 1072 Token get rightParenthesis => _rightParenthesis; |
| 1085 | 1073 |
| 1086 /** | 1074 /** |
| 1087 * Return the semicolon terminating the statement. | 1075 * Return the semicolon terminating the statement. |
| 1088 * @return the semicolon terminating the statement | 1076 * @return the semicolon terminating the statement |
| 1089 */ | 1077 */ |
| 1090 Token get semicolon => _semicolon; | 1078 Token get semicolon => _semicolon; |
| 1091 | 1079 |
| 1092 /** | 1080 /** |
| 1093 * Set the condition that is being asserted to be {@code true} to the given ex
pression. | 1081 * Set the condition that is being asserted to be {@code true} to the given ex
pression. |
| 1094 * @param the condition that is being asserted to be {@code true} | 1082 * @param the condition that is being asserted to be {@code true} |
| 1095 */ | 1083 */ |
| 1096 void set condition(Expression condition2) { | 1084 void set condition(Expression condition2) { |
| 1097 this._condition = becomeParentOf(condition2); | 1085 this._condition = becomeParentOf(condition2); |
| 1098 } | 1086 } |
| 1099 | 1087 |
| 1100 /** | 1088 /** |
| 1101 * Set the token representing the 'assert' keyword to the given token. | 1089 * Set the token representing the 'assert' keyword to the given token. |
| 1102 * @param keyword the token representing the 'assert' keyword | 1090 * @param keyword the token representing the 'assert' keyword |
| 1103 */ | 1091 */ |
| 1104 void set keyword(Token keyword2) { | 1092 void set keyword(Token keyword2) { |
| 1105 this._keyword = keyword2; | 1093 this._keyword = keyword2; |
| 1106 } | 1094 } |
| 1107 | 1095 |
| 1108 /** | 1096 /** |
| 1109 * Set the left parenthesis to the given token. | 1097 * Set the left parenthesis to the given token. |
| 1110 * @param the left parenthesis | 1098 * @param the left parenthesis |
| 1111 */ | 1099 */ |
| 1112 void set leftParenthesis(Token leftParenthesis2) { | 1100 void set leftParenthesis(Token leftParenthesis2) { |
| 1113 this._leftParenthesis = leftParenthesis2; | 1101 this._leftParenthesis = leftParenthesis2; |
| 1114 } | 1102 } |
| 1115 | 1103 |
| 1116 /** | 1104 /** |
| 1117 * Set the right parenthesis to the given token. | 1105 * Set the right parenthesis to the given token. |
| 1118 * @param rightParenthesis the right parenthesis | 1106 * @param rightParenthesis the right parenthesis |
| 1119 */ | 1107 */ |
| 1120 void set rightParenthesis(Token rightParenthesis2) { | 1108 void set rightParenthesis(Token rightParenthesis2) { |
| 1121 this._rightParenthesis = rightParenthesis2; | 1109 this._rightParenthesis = rightParenthesis2; |
| 1122 } | 1110 } |
| 1123 | 1111 |
| 1124 /** | 1112 /** |
| 1125 * Set the semicolon terminating the statement to the given token. | 1113 * Set the semicolon terminating the statement to the given token. |
| 1126 * @param semicolon the semicolon terminating the statement | 1114 * @param semicolon the semicolon terminating the statement |
| 1127 */ | 1115 */ |
| 1128 void set semicolon(Token semicolon2) { | 1116 void set semicolon(Token semicolon2) { |
| 1129 this._semicolon = semicolon2; | 1117 this._semicolon = semicolon2; |
| 1130 } | 1118 } |
| 1131 void visitChildren(ASTVisitor<Object> visitor) { | 1119 void visitChildren(ASTVisitor<Object> visitor) { |
| 1132 safelyVisitChild(_condition, visitor); | 1120 safelyVisitChild(_condition, visitor); |
| 1133 } | 1121 } |
| 1134 } | 1122 } |
| 1135 | |
| 1136 /** | 1123 /** |
| 1137 * Instances of the class {@code AssignmentExpression} represent an assignment e
xpression. | 1124 * Instances of the class {@code AssignmentExpression} represent an assignment e
xpression. |
| 1138 * <pre> | 1125 * <pre> |
| 1139 * assignmentExpression ::={@link Expression leftHandSide} {@link Token operator
} {@link Expression rightHandSide}</pre> | 1126 * assignmentExpression ::={@link Expression leftHandSide} {@link Token operator
} {@link Expression rightHandSide}</pre> |
| 1140 * @coverage dart.engine.ast | 1127 * @coverage dart.engine.ast |
| 1141 */ | 1128 */ |
| 1142 class AssignmentExpression extends Expression { | 1129 class AssignmentExpression extends Expression { |
| 1143 | 1130 |
| 1144 /** | 1131 /** |
| 1145 * The expression used to compute the left hand side. | 1132 * The expression used to compute the left hand side. |
| 1146 */ | 1133 */ |
| 1147 Expression _leftHandSide; | 1134 Expression _leftHandSide; |
| 1148 | 1135 |
| 1149 /** | 1136 /** |
| 1150 * The assignment operator being applied. | 1137 * The assignment operator being applied. |
| 1151 */ | 1138 */ |
| 1152 Token _operator; | 1139 Token _operator; |
| 1153 | 1140 |
| 1154 /** | 1141 /** |
| 1155 * The expression used to compute the right hand side. | 1142 * The expression used to compute the right hand side. |
| 1156 */ | 1143 */ |
| 1157 Expression _rightHandSide; | 1144 Expression _rightHandSide; |
| 1158 | 1145 |
| 1159 /** | 1146 /** |
| 1160 * The element associated with the operator based on the static type of the le
ft-hand-side, or{@code null} if the AST structure has not been resolved, if the
operator is not a compound | 1147 * The element associated with the operator based on the static type of the le
ft-hand-side, or{@code null} if the AST structure has not been resolved, if the
operator is not a compound |
| 1161 * operator, or if the operator could not be resolved. | 1148 * operator, or if the operator could not be resolved. |
| 1162 */ | 1149 */ |
| 1163 MethodElement _staticElement; | 1150 MethodElement _staticElement; |
| 1164 | 1151 |
| 1165 /** | 1152 /** |
| 1166 * The element associated with the operator based on the propagated type of th
e left-hand-side, or{@code null} if the AST structure has not been resolved, if
the operator is not a compound | 1153 * The element associated with the operator based on the propagated type of th
e left-hand-side, or{@code null} if the AST structure has not been resolved, if
the operator is not a compound |
| 1167 * operator, or if the operator could not be resolved. | 1154 * operator, or if the operator could not be resolved. |
| 1168 */ | 1155 */ |
| 1169 MethodElement _propagatedElement; | 1156 MethodElement _propagatedElement; |
| 1170 | 1157 |
| 1171 /** | 1158 /** |
| 1172 * Initialize a newly created assignment expression. | 1159 * Initialize a newly created assignment expression. |
| 1173 * @param leftHandSide the expression used to compute the left hand side | 1160 * @param leftHandSide the expression used to compute the left hand side |
| 1174 * @param operator the assignment operator being applied | 1161 * @param operator the assignment operator being applied |
| 1175 * @param rightHandSide the expression used to compute the right hand side | 1162 * @param rightHandSide the expression used to compute the right hand side |
| 1176 */ | 1163 */ |
| 1177 AssignmentExpression.full(Expression leftHandSide, Token operator, Expression
rightHandSide) { | 1164 AssignmentExpression.full(Expression leftHandSide, Token operator, Expression
rightHandSide) { |
| 1178 this._leftHandSide = becomeParentOf(leftHandSide); | 1165 this._leftHandSide = becomeParentOf(leftHandSide); |
| 1179 this._operator = operator; | 1166 this._operator = operator; |
| 1180 this._rightHandSide = becomeParentOf(rightHandSide); | 1167 this._rightHandSide = becomeParentOf(rightHandSide); |
| 1181 } | 1168 } |
| 1182 | 1169 |
| 1183 /** | 1170 /** |
| 1184 * Initialize a newly created assignment expression. | 1171 * Initialize a newly created assignment expression. |
| 1185 * @param leftHandSide the expression used to compute the left hand side | 1172 * @param leftHandSide the expression used to compute the left hand side |
| 1186 * @param operator the assignment operator being applied | 1173 * @param operator the assignment operator being applied |
| 1187 * @param rightHandSide the expression used to compute the right hand side | 1174 * @param rightHandSide the expression used to compute the right hand side |
| 1188 */ | 1175 */ |
| 1189 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ
tHandSide}) : this.full(leftHandSide, operator, rightHandSide); | 1176 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ
tHandSide}) : this.full(leftHandSide, operator, rightHandSide); |
| 1190 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this); | 1177 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this); |
| 1191 Token get beginToken => _leftHandSide.beginToken; | 1178 Token get beginToken => _leftHandSide.beginToken; |
| 1192 | 1179 |
| 1193 /** | 1180 /** |
| 1194 * Return the element associated with the operator based on the propagated typ
e of the | 1181 * Return the element associated with the operator based on the propagated typ
e of the |
| 1195 * left-hand-side, or {@code null} if the AST structure has not been resolved,
if the operator is | 1182 * left-hand-side, or {@code null} if the AST structure has not been resolved,
if the operator is |
| 1196 * not a compound operator, or if the operator could not be resolved. One exam
ple of the latter | 1183 * not a compound operator, or if the operator could not be resolved. One exam
ple of the latter |
| 1197 * case is an operator that is not defined for the type of the left-hand opera
nd. | 1184 * case is an operator that is not defined for the type of the left-hand opera
nd. |
| 1198 * @return the element associated with the operator | 1185 * @return the element associated with the operator |
| 1199 */ | 1186 */ |
| 1200 MethodElement get element => _propagatedElement; | 1187 MethodElement get element => _propagatedElement; |
| 1201 Token get endToken => _rightHandSide.endToken; | 1188 Token get endToken => _rightHandSide.endToken; |
| 1202 | 1189 |
| 1203 /** | 1190 /** |
| 1204 * Set the expression used to compute the left hand side to the given expressi
on. | 1191 * Set the expression used to compute the left hand side to the given expressi
on. |
| 1205 * @return the expression used to compute the left hand side | 1192 * @return the expression used to compute the left hand side |
| 1206 */ | 1193 */ |
| 1207 Expression get leftHandSide => _leftHandSide; | 1194 Expression get leftHandSide => _leftHandSide; |
| 1208 | 1195 |
| 1209 /** | 1196 /** |
| 1210 * Return the assignment operator being applied. | 1197 * Return the assignment operator being applied. |
| 1211 * @return the assignment operator being applied | 1198 * @return the assignment operator being applied |
| 1212 */ | 1199 */ |
| 1213 Token get operator => _operator; | 1200 Token get operator => _operator; |
| 1214 | 1201 |
| 1215 /** | 1202 /** |
| 1216 * Return the expression used to compute the right hand side. | 1203 * Return the expression used to compute the right hand side. |
| 1217 * @return the expression used to compute the right hand side | 1204 * @return the expression used to compute the right hand side |
| 1218 */ | 1205 */ |
| 1219 Expression get rightHandSide => _rightHandSide; | 1206 Expression get rightHandSide => _rightHandSide; |
| 1220 | 1207 |
| 1221 /** | 1208 /** |
| 1222 * Return the element associated with the operator based on the static type of
the left-hand-side, | 1209 * Return the element associated with the operator based on the static type of
the left-hand-side, |
| 1223 * or {@code null} if the AST structure has not been resolved, if the operator
is not a compound | 1210 * or {@code null} if the AST structure has not been resolved, if the operator
is not a compound |
| 1224 * operator, or if the operator could not be resolved. One example of the latt
er case is an | 1211 * operator, or if the operator could not be resolved. One example of the latt
er case is an |
| 1225 * operator that is not defined for the type of the left-hand operand. | 1212 * operator that is not defined for the type of the left-hand operand. |
| 1226 * @return the element associated with the operator | 1213 * @return the element associated with the operator |
| 1227 */ | 1214 */ |
| 1228 MethodElement get staticElement => _staticElement; | 1215 MethodElement get staticElement => _staticElement; |
| 1229 | 1216 |
| 1230 /** | 1217 /** |
| 1231 * Set the element associated with the operator based on the propagated type o
f the left-hand-side | 1218 * Set the element associated with the operator based on the propagated type o
f the left-hand-side |
| 1232 * to the given element. | 1219 * to the given element. |
| 1233 * @param element the element to be associated with the operator | 1220 * @param element the element to be associated with the operator |
| 1234 */ | 1221 */ |
| 1235 void set element(MethodElement element2) { | 1222 void set element(MethodElement element2) { |
| 1236 _propagatedElement = element2; | 1223 _propagatedElement = element2; |
| 1237 } | 1224 } |
| 1238 | 1225 |
| 1239 /** | 1226 /** |
| 1240 * Return the expression used to compute the left hand side. | 1227 * Return the expression used to compute the left hand side. |
| 1241 * @param expression the expression used to compute the left hand side | 1228 * @param expression the expression used to compute the left hand side |
| 1242 */ | 1229 */ |
| 1243 void set leftHandSide(Expression expression) { | 1230 void set leftHandSide(Expression expression) { |
| 1244 _leftHandSide = becomeParentOf(expression); | 1231 _leftHandSide = becomeParentOf(expression); |
| 1245 } | 1232 } |
| 1246 | 1233 |
| 1247 /** | 1234 /** |
| 1248 * Set the assignment operator being applied to the given operator. | 1235 * Set the assignment operator being applied to the given operator. |
| 1249 * @param operator the assignment operator being applied | 1236 * @param operator the assignment operator being applied |
| 1250 */ | 1237 */ |
| 1251 void set operator(Token operator2) { | 1238 void set operator(Token operator2) { |
| 1252 this._operator = operator2; | 1239 this._operator = operator2; |
| 1253 } | 1240 } |
| 1254 | 1241 |
| 1255 /** | 1242 /** |
| 1256 * Set the expression used to compute the left hand side to the given expressi
on. | 1243 * Set the expression used to compute the left hand side to the given expressi
on. |
| 1257 * @param expression the expression used to compute the left hand side | 1244 * @param expression the expression used to compute the left hand side |
| 1258 */ | 1245 */ |
| 1259 void set rightHandSide(Expression expression) { | 1246 void set rightHandSide(Expression expression) { |
| 1260 _rightHandSide = becomeParentOf(expression); | 1247 _rightHandSide = becomeParentOf(expression); |
| 1261 } | 1248 } |
| 1262 | 1249 |
| 1263 /** | 1250 /** |
| 1264 * Set the element associated with the operator based on the static type of th
e left-hand-side to | 1251 * Set the element associated with the operator based on the static type of th
e left-hand-side to |
| 1265 * the given element. | 1252 * the given element. |
| 1266 * @param element the static element to be associated with the operator | 1253 * @param element the static element to be associated with the operator |
| 1267 */ | 1254 */ |
| 1268 void set staticElement(MethodElement element) { | 1255 void set staticElement(MethodElement element) { |
| 1269 _staticElement = element; | 1256 _staticElement = element; |
| 1270 } | 1257 } |
| 1271 void visitChildren(ASTVisitor<Object> visitor) { | 1258 void visitChildren(ASTVisitor<Object> visitor) { |
| 1272 safelyVisitChild(_leftHandSide, visitor); | 1259 safelyVisitChild(_leftHandSide, visitor); |
| 1273 safelyVisitChild(_rightHandSide, visitor); | 1260 safelyVisitChild(_rightHandSide, visitor); |
| 1274 } | 1261 } |
| 1275 } | 1262 } |
| 1276 | |
| 1277 /** | 1263 /** |
| 1278 * Instances of the class {@code BinaryExpression} represent a binary (infix) ex
pression. | 1264 * Instances of the class {@code BinaryExpression} represent a binary (infix) ex
pression. |
| 1279 * <pre> | 1265 * <pre> |
| 1280 * binaryExpression ::={@link Expression leftOperand} {@link Token operator} {@l
ink Expression rightOperand}</pre> | 1266 * binaryExpression ::={@link Expression leftOperand} {@link Token operator} {@l
ink Expression rightOperand}</pre> |
| 1281 * @coverage dart.engine.ast | 1267 * @coverage dart.engine.ast |
| 1282 */ | 1268 */ |
| 1283 class BinaryExpression extends Expression { | 1269 class BinaryExpression extends Expression { |
| 1284 | 1270 |
| 1285 /** | 1271 /** |
| 1286 * The expression used to compute the left operand. | 1272 * The expression used to compute the left operand. |
| 1287 */ | 1273 */ |
| 1288 Expression _leftOperand; | 1274 Expression _leftOperand; |
| 1289 | 1275 |
| 1290 /** | 1276 /** |
| 1291 * The binary operator being applied. | 1277 * The binary operator being applied. |
| 1292 */ | 1278 */ |
| 1293 Token _operator; | 1279 Token _operator; |
| 1294 | 1280 |
| 1295 /** | 1281 /** |
| 1296 * The expression used to compute the right operand. | 1282 * The expression used to compute the right operand. |
| 1297 */ | 1283 */ |
| 1298 Expression _rightOperand; | 1284 Expression _rightOperand; |
| 1299 | 1285 |
| 1300 /** | 1286 /** |
| 1301 * The element associated with the operator based on the static type of the le
ft operand, or{@code null} if the AST structure has not been resolved, if the op
erator is not user definable, | 1287 * The element associated with the operator based on the static type of the le
ft operand, or{@code null} if the AST structure has not been resolved, if the op
erator is not user definable, |
| 1302 * or if the operator could not be resolved. | 1288 * or if the operator could not be resolved. |
| 1303 */ | 1289 */ |
| 1304 MethodElement _staticElement; | 1290 MethodElement _staticElement; |
| 1305 | 1291 |
| 1306 /** | 1292 /** |
| 1307 * The element associated with the operator based on the propagated type of th
e left operand, or{@code null} if the AST structure has not been resolved, if th
e operator is not user definable, | 1293 * The element associated with the operator based on the propagated type of th
e left operand, or{@code null} if the AST structure has not been resolved, if th
e operator is not user definable, |
| 1308 * or if the operator could not be resolved. | 1294 * or if the operator could not be resolved. |
| 1309 */ | 1295 */ |
| 1310 MethodElement _propagatedElement; | 1296 MethodElement _propagatedElement; |
| 1311 | 1297 |
| 1312 /** | 1298 /** |
| 1313 * Initialize a newly created binary expression. | 1299 * Initialize a newly created binary expression. |
| 1314 * @param leftOperand the expression used to compute the left operand | 1300 * @param leftOperand the expression used to compute the left operand |
| 1315 * @param operator the binary operator being applied | 1301 * @param operator the binary operator being applied |
| 1316 * @param rightOperand the expression used to compute the right operand | 1302 * @param rightOperand the expression used to compute the right operand |
| 1317 */ | 1303 */ |
| 1318 BinaryExpression.full(Expression leftOperand, Token operator, Expression right
Operand) { | 1304 BinaryExpression.full(Expression leftOperand, Token operator, Expression right
Operand) { |
| 1319 this._leftOperand = becomeParentOf(leftOperand); | 1305 this._leftOperand = becomeParentOf(leftOperand); |
| 1320 this._operator = operator; | 1306 this._operator = operator; |
| 1321 this._rightOperand = becomeParentOf(rightOperand); | 1307 this._rightOperand = becomeParentOf(rightOperand); |
| 1322 } | 1308 } |
| 1323 | 1309 |
| 1324 /** | 1310 /** |
| 1325 * Initialize a newly created binary expression. | 1311 * Initialize a newly created binary expression. |
| 1326 * @param leftOperand the expression used to compute the left operand | 1312 * @param leftOperand the expression used to compute the left operand |
| 1327 * @param operator the binary operator being applied | 1313 * @param operator the binary operator being applied |
| 1328 * @param rightOperand the expression used to compute the right operand | 1314 * @param rightOperand the expression used to compute the right operand |
| 1329 */ | 1315 */ |
| 1330 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper
and}) : this.full(leftOperand, operator, rightOperand); | 1316 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper
and}) : this.full(leftOperand, operator, rightOperand); |
| 1331 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); | 1317 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); |
| 1332 Token get beginToken => _leftOperand.beginToken; | 1318 Token get beginToken => _leftOperand.beginToken; |
| 1333 | 1319 |
| 1334 /** | 1320 /** |
| 1335 * Return the element associated with the operator based on the propagated typ
e of the left | 1321 * Return the element associated with the operator based on the propagated typ
e of the left |
| 1336 * operand, or {@code null} if the AST structure has not been resolved, if the
operator is not | 1322 * operand, or {@code null} if the AST structure has not been resolved, if the
operator is not |
| 1337 * user definable, or if the operator could not be resolved. One example of th
e latter case is an | 1323 * user definable, or if the operator could not be resolved. One example of th
e latter case is an |
| 1338 * operator that is not defined for the type of the left-hand operand. | 1324 * operator that is not defined for the type of the left-hand operand. |
| 1339 * @return the element associated with the operator | 1325 * @return the element associated with the operator |
| 1340 */ | 1326 */ |
| 1341 MethodElement get element => _propagatedElement; | 1327 MethodElement get element => _propagatedElement; |
| 1342 Token get endToken => _rightOperand.endToken; | 1328 Token get endToken => _rightOperand.endToken; |
| 1343 | 1329 |
| 1344 /** | 1330 /** |
| 1345 * Return the expression used to compute the left operand. | 1331 * Return the expression used to compute the left operand. |
| 1346 * @return the expression used to compute the left operand | 1332 * @return the expression used to compute the left operand |
| 1347 */ | 1333 */ |
| 1348 Expression get leftOperand => _leftOperand; | 1334 Expression get leftOperand => _leftOperand; |
| 1349 | 1335 |
| 1350 /** | 1336 /** |
| 1351 * Return the binary operator being applied. | 1337 * Return the binary operator being applied. |
| 1352 * @return the binary operator being applied | 1338 * @return the binary operator being applied |
| 1353 */ | 1339 */ |
| 1354 Token get operator => _operator; | 1340 Token get operator => _operator; |
| 1355 | 1341 |
| 1356 /** | 1342 /** |
| 1357 * Return the expression used to compute the right operand. | 1343 * Return the expression used to compute the right operand. |
| 1358 * @return the expression used to compute the right operand | 1344 * @return the expression used to compute the right operand |
| 1359 */ | 1345 */ |
| 1360 Expression get rightOperand => _rightOperand; | 1346 Expression get rightOperand => _rightOperand; |
| 1361 | 1347 |
| 1362 /** | 1348 /** |
| 1363 * Return the element associated with the operator based on the static type of
the left operand, | 1349 * Return the element associated with the operator based on the static type of
the left operand, |
| 1364 * or {@code null} if the AST structure has not been resolved, if the operator
is not user | 1350 * or {@code null} if the AST structure has not been resolved, if the operator
is not user |
| 1365 * definable, or if the operator could not be resolved. One example of the lat
ter case is an | 1351 * definable, or if the operator could not be resolved. One example of the lat
ter case is an |
| 1366 * operator that is not defined for the type of the left operand. | 1352 * operator that is not defined for the type of the left operand. |
| 1367 * @return the element associated with the operator | 1353 * @return the element associated with the operator |
| 1368 */ | 1354 */ |
| 1369 MethodElement get staticElement => _staticElement; | 1355 MethodElement get staticElement => _staticElement; |
| 1370 | 1356 |
| 1371 /** | 1357 /** |
| 1372 * Set the element associated with the operator based on the propagated type o
f the left operand | 1358 * Set the element associated with the operator based on the propagated type o
f the left operand |
| 1373 * to the given element. | 1359 * to the given element. |
| 1374 * @param element the element to be associated with the operator | 1360 * @param element the element to be associated with the operator |
| 1375 */ | 1361 */ |
| 1376 void set element(MethodElement element2) { | 1362 void set element(MethodElement element2) { |
| 1377 _propagatedElement = element2; | 1363 _propagatedElement = element2; |
| 1378 } | 1364 } |
| 1379 | 1365 |
| 1380 /** | 1366 /** |
| 1381 * Set the expression used to compute the left operand to the given expression
. | 1367 * Set the expression used to compute the left operand to the given expression
. |
| 1382 * @param expression the expression used to compute the left operand | 1368 * @param expression the expression used to compute the left operand |
| 1383 */ | 1369 */ |
| 1384 void set leftOperand(Expression expression) { | 1370 void set leftOperand(Expression expression) { |
| 1385 _leftOperand = becomeParentOf(expression); | 1371 _leftOperand = becomeParentOf(expression); |
| 1386 } | 1372 } |
| 1387 | 1373 |
| 1388 /** | 1374 /** |
| 1389 * Set the binary operator being applied to the given operator. | 1375 * Set the binary operator being applied to the given operator. |
| 1390 * @return the binary operator being applied | 1376 * @return the binary operator being applied |
| 1391 */ | 1377 */ |
| 1392 void set operator(Token operator2) { | 1378 void set operator(Token operator2) { |
| 1393 this._operator = operator2; | 1379 this._operator = operator2; |
| 1394 } | 1380 } |
| 1395 | 1381 |
| 1396 /** | 1382 /** |
| 1397 * Set the expression used to compute the right operand to the given expressio
n. | 1383 * Set the expression used to compute the right operand to the given expressio
n. |
| 1398 * @param expression the expression used to compute the right operand | 1384 * @param expression the expression used to compute the right operand |
| 1399 */ | 1385 */ |
| 1400 void set rightOperand(Expression expression) { | 1386 void set rightOperand(Expression expression) { |
| 1401 _rightOperand = becomeParentOf(expression); | 1387 _rightOperand = becomeParentOf(expression); |
| 1402 } | 1388 } |
| 1403 | 1389 |
| 1404 /** | 1390 /** |
| 1405 * Set the element associated with the operator based on the static type of th
e left operand to | 1391 * Set the element associated with the operator based on the static type of th
e left operand to |
| 1406 * the given element. | 1392 * the given element. |
| 1407 * @param element the static element to be associated with the operator | 1393 * @param element the static element to be associated with the operator |
| 1408 */ | 1394 */ |
| 1409 void set staticElement(MethodElement element) { | 1395 void set staticElement(MethodElement element) { |
| 1410 _staticElement = element; | 1396 _staticElement = element; |
| 1411 } | 1397 } |
| 1412 void visitChildren(ASTVisitor<Object> visitor) { | 1398 void visitChildren(ASTVisitor<Object> visitor) { |
| 1413 safelyVisitChild(_leftOperand, visitor); | 1399 safelyVisitChild(_leftOperand, visitor); |
| 1414 safelyVisitChild(_rightOperand, visitor); | 1400 safelyVisitChild(_rightOperand, visitor); |
| 1415 } | 1401 } |
| 1416 | 1402 |
| 1417 /** | 1403 /** |
| 1418 * Return the parameter element representing the parameter to which the value
of the right operand | 1404 * Return the parameter element representing the parameter to which the value
of the right operand |
| 1419 * will be bound. May be {@code null}. | 1405 * will be bound. May be {@code null}. |
| 1420 * <p> | 1406 * <p> |
| 1421 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 1407 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
| 1422 * @return the parameter element representing the parameter to which the value
of the right | 1408 * @return the parameter element representing the parameter to which the value
of the right |
| 1423 * operand will be bound | 1409 * operand will be bound |
| 1424 */ | 1410 */ |
| 1425 ParameterElement get parameterElementForRightOperand { | 1411 ParameterElement get parameterElementForRightOperand { |
| 1426 if (_propagatedElement == null) { | 1412 if (_propagatedElement == null) { |
| 1427 return null; | 1413 return null; |
| 1428 } | 1414 } |
| 1429 List<ParameterElement> parameters2 = _propagatedElement.parameters; | 1415 List<ParameterElement> parameters2 = _propagatedElement.parameters; |
| 1430 if (parameters2.length < 1) { | 1416 if (parameters2.length < 1) { |
| 1431 return null; | 1417 return null; |
| 1432 } | 1418 } |
| 1433 return parameters2[0]; | 1419 return parameters2[0]; |
| 1434 } | 1420 } |
| 1435 } | 1421 } |
| 1436 | |
| 1437 /** | 1422 /** |
| 1438 * Instances of the class {@code Block} represent a sequence of statements. | 1423 * Instances of the class {@code Block} represent a sequence of statements. |
| 1439 * <pre> | 1424 * <pre> |
| 1440 * block ::= | 1425 * block ::= |
| 1441 * '{' statement* '}' | 1426 * '{' statement* '}' |
| 1442 * </pre> | 1427 * </pre> |
| 1443 * @coverage dart.engine.ast | 1428 * @coverage dart.engine.ast |
| 1444 */ | 1429 */ |
| 1445 class Block extends Statement { | 1430 class Block extends Statement { |
| 1446 | 1431 |
| 1447 /** | 1432 /** |
| 1448 * The left curly bracket. | 1433 * The left curly bracket. |
| 1449 */ | 1434 */ |
| 1450 Token _leftBracket; | 1435 Token _leftBracket; |
| 1451 | 1436 |
| 1452 /** | 1437 /** |
| 1453 * The statements contained in the block. | 1438 * The statements contained in the block. |
| 1454 */ | 1439 */ |
| 1455 NodeList<Statement> _statements; | 1440 NodeList<Statement> _statements; |
| 1456 | 1441 |
| 1457 /** | 1442 /** |
| 1458 * The right curly bracket. | 1443 * The right curly bracket. |
| 1459 */ | 1444 */ |
| 1460 Token _rightBracket; | 1445 Token _rightBracket; |
| 1461 | 1446 |
| 1462 /** | 1447 /** |
| 1463 * Initialize a newly created block of code. | 1448 * Initialize a newly created block of code. |
| 1464 * @param leftBracket the left curly bracket | 1449 * @param leftBracket the left curly bracket |
| 1465 * @param statements the statements contained in the block | 1450 * @param statements the statements contained in the block |
| 1466 * @param rightBracket the right curly bracket | 1451 * @param rightBracket the right curly bracket |
| 1467 */ | 1452 */ |
| 1468 Block.full(Token leftBracket, List<Statement> statements, Token rightBracket)
{ | 1453 Block.full(Token leftBracket, List<Statement> statements, Token rightBracket)
{ |
| 1469 this._statements = new NodeList<Statement>(this); | 1454 this._statements = new NodeList<Statement>(this); |
| 1470 this._leftBracket = leftBracket; | 1455 this._leftBracket = leftBracket; |
| 1471 this._statements.addAll(statements); | 1456 this._statements.addAll(statements); |
| 1472 this._rightBracket = rightBracket; | 1457 this._rightBracket = rightBracket; |
| 1473 } | 1458 } |
| 1474 | 1459 |
| 1475 /** | 1460 /** |
| 1476 * Initialize a newly created block of code. | 1461 * Initialize a newly created block of code. |
| 1477 * @param leftBracket the left curly bracket | 1462 * @param leftBracket the left curly bracket |
| 1478 * @param statements the statements contained in the block | 1463 * @param statements the statements contained in the block |
| 1479 * @param rightBracket the right curly bracket | 1464 * @param rightBracket the right curly bracket |
| 1480 */ | 1465 */ |
| 1481 Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : t
his.full(leftBracket, statements, rightBracket); | 1466 Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : t
his.full(leftBracket, statements, rightBracket); |
| 1482 accept(ASTVisitor visitor) => visitor.visitBlock(this); | 1467 accept(ASTVisitor visitor) => visitor.visitBlock(this); |
| 1483 Token get beginToken => _leftBracket; | 1468 Token get beginToken => _leftBracket; |
| 1484 Token get endToken => _rightBracket; | 1469 Token get endToken => _rightBracket; |
| 1485 | 1470 |
| 1486 /** | 1471 /** |
| 1487 * Return the left curly bracket. | 1472 * Return the left curly bracket. |
| 1488 * @return the left curly bracket | 1473 * @return the left curly bracket |
| 1489 */ | 1474 */ |
| 1490 Token get leftBracket => _leftBracket; | 1475 Token get leftBracket => _leftBracket; |
| 1491 | 1476 |
| 1492 /** | 1477 /** |
| 1493 * Return the right curly bracket. | 1478 * Return the right curly bracket. |
| 1494 * @return the right curly bracket | 1479 * @return the right curly bracket |
| 1495 */ | 1480 */ |
| 1496 Token get rightBracket => _rightBracket; | 1481 Token get rightBracket => _rightBracket; |
| 1497 | 1482 |
| 1498 /** | 1483 /** |
| 1499 * Return the statements contained in the block. | 1484 * Return the statements contained in the block. |
| 1500 * @return the statements contained in the block | 1485 * @return the statements contained in the block |
| 1501 */ | 1486 */ |
| 1502 NodeList<Statement> get statements => _statements; | 1487 NodeList<Statement> get statements => _statements; |
| 1503 | 1488 |
| 1504 /** | 1489 /** |
| 1505 * Set the left curly bracket to the given token. | 1490 * Set the left curly bracket to the given token. |
| 1506 * @param leftBracket the left curly bracket | 1491 * @param leftBracket the left curly bracket |
| 1507 */ | 1492 */ |
| 1508 void set leftBracket(Token leftBracket2) { | 1493 void set leftBracket(Token leftBracket2) { |
| 1509 this._leftBracket = leftBracket2; | 1494 this._leftBracket = leftBracket2; |
| 1510 } | 1495 } |
| 1511 | 1496 |
| 1512 /** | 1497 /** |
| 1513 * Set the right curly bracket to the given token. | 1498 * Set the right curly bracket to the given token. |
| 1514 * @param rightBracket the right curly bracket | 1499 * @param rightBracket the right curly bracket |
| 1515 */ | 1500 */ |
| 1516 void set rightBracket(Token rightBracket2) { | 1501 void set rightBracket(Token rightBracket2) { |
| 1517 this._rightBracket = rightBracket2; | 1502 this._rightBracket = rightBracket2; |
| 1518 } | 1503 } |
| 1519 void visitChildren(ASTVisitor<Object> visitor) { | 1504 void visitChildren(ASTVisitor<Object> visitor) { |
| 1520 _statements.accept(visitor); | 1505 _statements.accept(visitor); |
| 1521 } | 1506 } |
| 1522 } | 1507 } |
| 1523 | |
| 1524 /** | 1508 /** |
| 1525 * Instances of the class {@code BlockFunctionBody} represent a function body th
at consists of a | 1509 * Instances of the class {@code BlockFunctionBody} represent a function body th
at consists of a |
| 1526 * block of statements. | 1510 * block of statements. |
| 1527 * <pre> | 1511 * <pre> |
| 1528 * blockFunctionBody ::={@link Block block}</pre> | 1512 * blockFunctionBody ::={@link Block block}</pre> |
| 1529 * @coverage dart.engine.ast | 1513 * @coverage dart.engine.ast |
| 1530 */ | 1514 */ |
| 1531 class BlockFunctionBody extends FunctionBody { | 1515 class BlockFunctionBody extends FunctionBody { |
| 1532 | 1516 |
| 1533 /** | 1517 /** |
| 1534 * The block representing the body of the function. | 1518 * The block representing the body of the function. |
| 1535 */ | 1519 */ |
| 1536 Block _block; | 1520 Block _block; |
| 1537 | 1521 |
| 1538 /** | 1522 /** |
| 1539 * Initialize a newly created function body consisting of a block of statement
s. | 1523 * Initialize a newly created function body consisting of a block of statement
s. |
| 1540 * @param block the block representing the body of the function | 1524 * @param block the block representing the body of the function |
| 1541 */ | 1525 */ |
| 1542 BlockFunctionBody.full(Block block) { | 1526 BlockFunctionBody.full(Block block) { |
| 1543 this._block = becomeParentOf(block); | 1527 this._block = becomeParentOf(block); |
| 1544 } | 1528 } |
| 1545 | 1529 |
| 1546 /** | 1530 /** |
| 1547 * Initialize a newly created function body consisting of a block of statement
s. | 1531 * Initialize a newly created function body consisting of a block of statement
s. |
| 1548 * @param block the block representing the body of the function | 1532 * @param block the block representing the body of the function |
| 1549 */ | 1533 */ |
| 1550 BlockFunctionBody({Block block}) : this.full(block); | 1534 BlockFunctionBody({Block block}) : this.full(block); |
| 1551 accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this); | 1535 accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this); |
| 1552 Token get beginToken => _block.beginToken; | 1536 Token get beginToken => _block.beginToken; |
| 1553 | 1537 |
| 1554 /** | 1538 /** |
| 1555 * Return the block representing the body of the function. | 1539 * Return the block representing the body of the function. |
| 1556 * @return the block representing the body of the function | 1540 * @return the block representing the body of the function |
| 1557 */ | 1541 */ |
| 1558 Block get block => _block; | 1542 Block get block => _block; |
| 1559 Token get endToken => _block.endToken; | 1543 Token get endToken => _block.endToken; |
| 1560 | 1544 |
| 1561 /** | 1545 /** |
| 1562 * Set the block representing the body of the function to the given block. | 1546 * Set the block representing the body of the function to the given block. |
| 1563 * @param block the block representing the body of the function | 1547 * @param block the block representing the body of the function |
| 1564 */ | 1548 */ |
| 1565 void set block(Block block2) { | 1549 void set block(Block block2) { |
| 1566 this._block = becomeParentOf(block2); | 1550 this._block = becomeParentOf(block2); |
| 1567 } | 1551 } |
| 1568 void visitChildren(ASTVisitor<Object> visitor) { | 1552 void visitChildren(ASTVisitor<Object> visitor) { |
| 1569 safelyVisitChild(_block, visitor); | 1553 safelyVisitChild(_block, visitor); |
| 1570 } | 1554 } |
| 1571 } | 1555 } |
| 1572 | |
| 1573 /** | 1556 /** |
| 1574 * Instances of the class {@code BooleanLiteral} represent a boolean literal exp
ression. | 1557 * Instances of the class {@code BooleanLiteral} represent a boolean literal exp
ression. |
| 1575 * <pre> | 1558 * <pre> |
| 1576 * booleanLiteral ::= | 1559 * booleanLiteral ::= |
| 1577 * 'false' | 'true' | 1560 * 'false' | 'true' |
| 1578 * </pre> | 1561 * </pre> |
| 1579 * @coverage dart.engine.ast | 1562 * @coverage dart.engine.ast |
| 1580 */ | 1563 */ |
| 1581 class BooleanLiteral extends Literal { | 1564 class BooleanLiteral extends Literal { |
| 1582 | 1565 |
| 1583 /** | 1566 /** |
| 1584 * The token representing the literal. | 1567 * The token representing the literal. |
| 1585 */ | 1568 */ |
| 1586 Token _literal; | 1569 Token _literal; |
| 1587 | 1570 |
| 1588 /** | 1571 /** |
| 1589 * The value of the literal. | 1572 * The value of the literal. |
| 1590 */ | 1573 */ |
| 1591 bool _value = false; | 1574 bool _value = false; |
| 1592 | 1575 |
| 1593 /** | 1576 /** |
| 1594 * Initialize a newly created boolean literal. | 1577 * Initialize a newly created boolean literal. |
| 1595 * @param literal the token representing the literal | 1578 * @param literal the token representing the literal |
| 1596 * @param value the value of the literal | 1579 * @param value the value of the literal |
| 1597 */ | 1580 */ |
| 1598 BooleanLiteral.full(Token literal, bool value) { | 1581 BooleanLiteral.full(Token literal, bool value) { |
| 1599 this._literal = literal; | 1582 this._literal = literal; |
| 1600 this._value = value; | 1583 this._value = value; |
| 1601 } | 1584 } |
| 1602 | 1585 |
| 1603 /** | 1586 /** |
| 1604 * Initialize a newly created boolean literal. | 1587 * Initialize a newly created boolean literal. |
| 1605 * @param literal the token representing the literal | 1588 * @param literal the token representing the literal |
| 1606 * @param value the value of the literal | 1589 * @param value the value of the literal |
| 1607 */ | 1590 */ |
| 1608 BooleanLiteral({Token literal, bool value}) : this.full(literal, value); | 1591 BooleanLiteral({Token literal, bool value}) : this.full(literal, value); |
| 1609 accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this); | 1592 accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this); |
| 1610 Token get beginToken => _literal; | 1593 Token get beginToken => _literal; |
| 1611 Token get endToken => _literal; | 1594 Token get endToken => _literal; |
| 1612 | 1595 |
| 1613 /** | 1596 /** |
| 1614 * Return the token representing the literal. | 1597 * Return the token representing the literal. |
| 1615 * @return the token representing the literal | 1598 * @return the token representing the literal |
| 1616 */ | 1599 */ |
| 1617 Token get literal => _literal; | 1600 Token get literal => _literal; |
| 1618 | 1601 |
| 1619 /** | 1602 /** |
| 1620 * Return the value of the literal. | 1603 * Return the value of the literal. |
| 1621 * @return the value of the literal | 1604 * @return the value of the literal |
| 1622 */ | 1605 */ |
| 1623 bool get value => _value; | 1606 bool get value => _value; |
| 1624 bool isSynthetic() => _literal.isSynthetic(); | 1607 bool isSynthetic() => _literal.isSynthetic(); |
| 1625 | 1608 |
| 1626 /** | 1609 /** |
| 1627 * Set the token representing the literal to the given token. | 1610 * Set the token representing the literal to the given token. |
| 1628 * @param literal the token representing the literal | 1611 * @param literal the token representing the literal |
| 1629 */ | 1612 */ |
| 1630 void set literal(Token literal2) { | 1613 void set literal(Token literal2) { |
| 1631 this._literal = literal2; | 1614 this._literal = literal2; |
| 1632 } | 1615 } |
| 1633 | 1616 |
| 1634 /** | 1617 /** |
| 1635 * Set the value of the literal to the given value. | 1618 * Set the value of the literal to the given value. |
| 1636 * @param value the value of the literal | 1619 * @param value the value of the literal |
| 1637 */ | 1620 */ |
| 1638 void set value(bool value2) { | 1621 void set value(bool value2) { |
| 1639 this._value = value2; | 1622 this._value = value2; |
| 1640 } | 1623 } |
| 1641 void visitChildren(ASTVisitor<Object> visitor) { | 1624 void visitChildren(ASTVisitor<Object> visitor) { |
| 1642 } | 1625 } |
| 1643 } | 1626 } |
| 1644 | |
| 1645 /** | 1627 /** |
| 1646 * Instances of the class {@code BreakStatement} represent a break statement. | 1628 * Instances of the class {@code BreakStatement} represent a break statement. |
| 1647 * <pre> | 1629 * <pre> |
| 1648 * breakStatement ::= | 1630 * breakStatement ::= |
| 1649 * 'break' {@link SimpleIdentifier label}? ';' | 1631 * 'break' {@link SimpleIdentifier label}? ';' |
| 1650 * </pre> | 1632 * </pre> |
| 1651 * @coverage dart.engine.ast | 1633 * @coverage dart.engine.ast |
| 1652 */ | 1634 */ |
| 1653 class BreakStatement extends Statement { | 1635 class BreakStatement extends Statement { |
| 1654 | 1636 |
| 1655 /** | 1637 /** |
| 1656 * The token representing the 'break' keyword. | 1638 * The token representing the 'break' keyword. |
| 1657 */ | 1639 */ |
| 1658 Token _keyword; | 1640 Token _keyword; |
| 1659 | 1641 |
| 1660 /** | 1642 /** |
| 1661 * The label associated with the statement, or {@code null} if there is no lab
el. | 1643 * The label associated with the statement, or {@code null} if there is no lab
el. |
| 1662 */ | 1644 */ |
| 1663 SimpleIdentifier _label; | 1645 SimpleIdentifier _label; |
| 1664 | 1646 |
| 1665 /** | 1647 /** |
| 1666 * The semicolon terminating the statement. | 1648 * The semicolon terminating the statement. |
| 1667 */ | 1649 */ |
| 1668 Token _semicolon; | 1650 Token _semicolon; |
| 1669 | 1651 |
| 1670 /** | 1652 /** |
| 1671 * Initialize a newly created break statement. | 1653 * Initialize a newly created break statement. |
| 1672 * @param keyword the token representing the 'break' keyword | 1654 * @param keyword the token representing the 'break' keyword |
| 1673 * @param label the label associated with the statement | 1655 * @param label the label associated with the statement |
| 1674 * @param semicolon the semicolon terminating the statement | 1656 * @param semicolon the semicolon terminating the statement |
| 1675 */ | 1657 */ |
| 1676 BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) { | 1658 BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) { |
| 1677 this._keyword = keyword; | 1659 this._keyword = keyword; |
| 1678 this._label = becomeParentOf(label); | 1660 this._label = becomeParentOf(label); |
| 1679 this._semicolon = semicolon; | 1661 this._semicolon = semicolon; |
| 1680 } | 1662 } |
| 1681 | 1663 |
| 1682 /** | 1664 /** |
| 1683 * Initialize a newly created break statement. | 1665 * Initialize a newly created break statement. |
| 1684 * @param keyword the token representing the 'break' keyword | 1666 * @param keyword the token representing the 'break' keyword |
| 1685 * @param label the label associated with the statement | 1667 * @param label the label associated with the statement |
| 1686 * @param semicolon the semicolon terminating the statement | 1668 * @param semicolon the semicolon terminating the statement |
| 1687 */ | 1669 */ |
| 1688 BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : thi
s.full(keyword, label, semicolon); | 1670 BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : thi
s.full(keyword, label, semicolon); |
| 1689 accept(ASTVisitor visitor) => visitor.visitBreakStatement(this); | 1671 accept(ASTVisitor visitor) => visitor.visitBreakStatement(this); |
| 1690 Token get beginToken => _keyword; | 1672 Token get beginToken => _keyword; |
| 1691 Token get endToken => _semicolon; | 1673 Token get endToken => _semicolon; |
| 1692 | 1674 |
| 1693 /** | 1675 /** |
| 1694 * Return the token representing the 'break' keyword. | 1676 * Return the token representing the 'break' keyword. |
| 1695 * @return the token representing the 'break' keyword | 1677 * @return the token representing the 'break' keyword |
| 1696 */ | 1678 */ |
| 1697 Token get keyword => _keyword; | 1679 Token get keyword => _keyword; |
| 1698 | 1680 |
| 1699 /** | 1681 /** |
| 1700 * Return the label associated with the statement, or {@code null} if there is
no label. | 1682 * Return the label associated with the statement, or {@code null} if there is
no label. |
| 1701 * @return the label associated with the statement | 1683 * @return the label associated with the statement |
| 1702 */ | 1684 */ |
| 1703 SimpleIdentifier get label => _label; | 1685 SimpleIdentifier get label => _label; |
| 1704 | 1686 |
| 1705 /** | 1687 /** |
| 1706 * Return the semicolon terminating the statement. | 1688 * Return the semicolon terminating the statement. |
| 1707 * @return the semicolon terminating the statement | 1689 * @return the semicolon terminating the statement |
| 1708 */ | 1690 */ |
| 1709 Token get semicolon => _semicolon; | 1691 Token get semicolon => _semicolon; |
| 1710 | 1692 |
| 1711 /** | 1693 /** |
| 1712 * Set the token representing the 'break' keyword to the given token. | 1694 * Set the token representing the 'break' keyword to the given token. |
| 1713 * @param keyword the token representing the 'break' keyword | 1695 * @param keyword the token representing the 'break' keyword |
| 1714 */ | 1696 */ |
| 1715 void set keyword(Token keyword2) { | 1697 void set keyword(Token keyword2) { |
| 1716 this._keyword = keyword2; | 1698 this._keyword = keyword2; |
| 1717 } | 1699 } |
| 1718 | 1700 |
| 1719 /** | 1701 /** |
| 1720 * Set the label associated with the statement to the given identifier. | 1702 * Set the label associated with the statement to the given identifier. |
| 1721 * @param identifier the label associated with the statement | 1703 * @param identifier the label associated with the statement |
| 1722 */ | 1704 */ |
| 1723 void set label(SimpleIdentifier identifier) { | 1705 void set label(SimpleIdentifier identifier) { |
| 1724 _label = becomeParentOf(identifier); | 1706 _label = becomeParentOf(identifier); |
| 1725 } | 1707 } |
| 1726 | 1708 |
| 1727 /** | 1709 /** |
| 1728 * Set the semicolon terminating the statement to the given token. | 1710 * Set the semicolon terminating the statement to the given token. |
| 1729 * @param semicolon the semicolon terminating the statement | 1711 * @param semicolon the semicolon terminating the statement |
| 1730 */ | 1712 */ |
| 1731 void set semicolon(Token semicolon2) { | 1713 void set semicolon(Token semicolon2) { |
| 1732 this._semicolon = semicolon2; | 1714 this._semicolon = semicolon2; |
| 1733 } | 1715 } |
| 1734 void visitChildren(ASTVisitor<Object> visitor) { | 1716 void visitChildren(ASTVisitor<Object> visitor) { |
| 1735 safelyVisitChild(_label, visitor); | 1717 safelyVisitChild(_label, visitor); |
| 1736 } | 1718 } |
| 1737 } | 1719 } |
| 1738 | |
| 1739 /** | 1720 /** |
| 1740 * Instances of the class {@code CascadeExpression} represent a sequence of casc
aded expressions: | 1721 * Instances of the class {@code CascadeExpression} represent a sequence of casc
aded expressions: |
| 1741 * expressions that share a common target. There are three kinds of expressions
that can be used in | 1722 * expressions that share a common target. There are three kinds of expressions
that can be used in |
| 1742 * a cascade expression: {@link IndexExpression}, {@link MethodInvocation} and{@
link PropertyAccess}. | 1723 * a cascade expression: {@link IndexExpression}, {@link MethodInvocation} and{@
link PropertyAccess}. |
| 1743 * <pre> | 1724 * <pre> |
| 1744 * cascadeExpression ::={@link Expression conditionalExpression} cascadeSection | 1725 * cascadeExpression ::={@link Expression conditionalExpression} cascadeSection |
| 1745 * cascadeSection ::= | 1726 * cascadeSection ::= |
| 1746 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assignme
ntOperator expressionWithoutCascade)? | 1727 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assignme
ntOperator expressionWithoutCascade)? |
| 1747 * cascadeSelector ::= | 1728 * cascadeSelector ::= |
| 1748 * '\[ ' expression '\] ' | 1729 * '\[ ' expression '\] ' |
| 1749 * | identifier | 1730 * | identifier |
| 1750 * </pre> | 1731 * </pre> |
| 1751 * @coverage dart.engine.ast | 1732 * @coverage dart.engine.ast |
| 1752 */ | 1733 */ |
| 1753 class CascadeExpression extends Expression { | 1734 class CascadeExpression extends Expression { |
| 1754 | 1735 |
| 1755 /** | 1736 /** |
| 1756 * The target of the cascade sections. | 1737 * The target of the cascade sections. |
| 1757 */ | 1738 */ |
| 1758 Expression _target; | 1739 Expression _target; |
| 1759 | 1740 |
| 1760 /** | 1741 /** |
| 1761 * The cascade sections sharing the common target. | 1742 * The cascade sections sharing the common target. |
| 1762 */ | 1743 */ |
| 1763 NodeList<Expression> _cascadeSections; | 1744 NodeList<Expression> _cascadeSections; |
| 1764 | 1745 |
| 1765 /** | 1746 /** |
| 1766 * Initialize a newly created cascade expression. | 1747 * Initialize a newly created cascade expression. |
| 1767 * @param target the target of the cascade sections | 1748 * @param target the target of the cascade sections |
| 1768 * @param cascadeSections the cascade sections sharing the common target | 1749 * @param cascadeSections the cascade sections sharing the common target |
| 1769 */ | 1750 */ |
| 1770 CascadeExpression.full(Expression target, List<Expression> cascadeSections) { | 1751 CascadeExpression.full(Expression target, List<Expression> cascadeSections) { |
| 1771 this._cascadeSections = new NodeList<Expression>(this); | 1752 this._cascadeSections = new NodeList<Expression>(this); |
| 1772 this._target = becomeParentOf(target); | 1753 this._target = becomeParentOf(target); |
| 1773 this._cascadeSections.addAll(cascadeSections); | 1754 this._cascadeSections.addAll(cascadeSections); |
| 1774 } | 1755 } |
| 1775 | 1756 |
| 1776 /** | 1757 /** |
| 1777 * Initialize a newly created cascade expression. | 1758 * Initialize a newly created cascade expression. |
| 1778 * @param target the target of the cascade sections | 1759 * @param target the target of the cascade sections |
| 1779 * @param cascadeSections the cascade sections sharing the common target | 1760 * @param cascadeSections the cascade sections sharing the common target |
| 1780 */ | 1761 */ |
| 1781 CascadeExpression({Expression target, List<Expression> cascadeSections}) : thi
s.full(target, cascadeSections); | 1762 CascadeExpression({Expression target, List<Expression> cascadeSections}) : thi
s.full(target, cascadeSections); |
| 1782 accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this); | 1763 accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this); |
| 1783 Token get beginToken => _target.beginToken; | 1764 Token get beginToken => _target.beginToken; |
| 1784 | 1765 |
| 1785 /** | 1766 /** |
| 1786 * Return the cascade sections sharing the common target. | 1767 * Return the cascade sections sharing the common target. |
| 1787 * @return the cascade sections sharing the common target | 1768 * @return the cascade sections sharing the common target |
| 1788 */ | 1769 */ |
| 1789 NodeList<Expression> get cascadeSections => _cascadeSections; | 1770 NodeList<Expression> get cascadeSections => _cascadeSections; |
| 1790 Token get endToken => _cascadeSections.endToken; | 1771 Token get endToken => _cascadeSections.endToken; |
| 1791 | 1772 |
| 1792 /** | 1773 /** |
| 1793 * Return the target of the cascade sections. | 1774 * Return the target of the cascade sections. |
| 1794 * @return the target of the cascade sections | 1775 * @return the target of the cascade sections |
| 1795 */ | 1776 */ |
| 1796 Expression get target => _target; | 1777 Expression get target => _target; |
| 1797 | 1778 |
| 1798 /** | 1779 /** |
| 1799 * Set the target of the cascade sections to the given expression. | 1780 * Set the target of the cascade sections to the given expression. |
| 1800 * @param target the target of the cascade sections | 1781 * @param target the target of the cascade sections |
| 1801 */ | 1782 */ |
| 1802 void set target(Expression target2) { | 1783 void set target(Expression target2) { |
| 1803 this._target = becomeParentOf(target2); | 1784 this._target = becomeParentOf(target2); |
| 1804 } | 1785 } |
| 1805 void visitChildren(ASTVisitor<Object> visitor) { | 1786 void visitChildren(ASTVisitor<Object> visitor) { |
| 1806 safelyVisitChild(_target, visitor); | 1787 safelyVisitChild(_target, visitor); |
| 1807 _cascadeSections.accept(visitor); | 1788 _cascadeSections.accept(visitor); |
| 1808 } | 1789 } |
| 1809 } | 1790 } |
| 1810 | |
| 1811 /** | 1791 /** |
| 1812 * Instances of the class {@code CatchClause} represent a catch clause within a
try statement. | 1792 * Instances of the class {@code CatchClause} represent a catch clause within a
try statement. |
| 1813 * <pre> | 1793 * <pre> |
| 1814 * onPart ::= | 1794 * onPart ::= |
| 1815 * catchPart {@link Block block}| 'on' type catchPart? {@link Block block}catchP
art ::= | 1795 * catchPart {@link Block block}| 'on' type catchPart? {@link Block block}catchP
art ::= |
| 1816 * 'catch' '(' {@link SimpleIdentifier exceptionParameter} (',' {@link SimpleIde
ntifier stackTraceParameter})? ')' | 1796 * 'catch' '(' {@link SimpleIdentifier exceptionParameter} (',' {@link SimpleIde
ntifier stackTraceParameter})? ')' |
| 1817 * </pre> | 1797 * </pre> |
| 1818 * @coverage dart.engine.ast | 1798 * @coverage dart.engine.ast |
| 1819 */ | 1799 */ |
| 1820 class CatchClause extends ASTNode { | 1800 class CatchClause extends ASTNode { |
| 1821 | 1801 |
| 1822 /** | 1802 /** |
| 1823 * The token representing the 'on' keyword, or {@code null} if there is no 'on
' keyword. | 1803 * The token representing the 'on' keyword, or {@code null} if there is no 'on
' keyword. |
| 1824 */ | 1804 */ |
| 1825 Token _onKeyword; | 1805 Token _onKeyword; |
| 1826 | 1806 |
| 1827 /** | 1807 /** |
| 1828 * The type of exceptions caught by this catch clause, or {@code null} if this
catch clause | 1808 * The type of exceptions caught by this catch clause, or {@code null} if this
catch clause |
| 1829 * catches every type of exception. | 1809 * catches every type of exception. |
| 1830 */ | 1810 */ |
| 1831 TypeName _exceptionType; | 1811 TypeName _exceptionType; |
| 1832 | 1812 |
| 1833 /** | 1813 /** |
| 1834 * The token representing the 'catch' keyword, or {@code null} if there is no
'catch' keyword. | 1814 * The token representing the 'catch' keyword, or {@code null} if there is no
'catch' keyword. |
| 1835 */ | 1815 */ |
| 1836 Token _catchKeyword; | 1816 Token _catchKeyword; |
| 1837 | 1817 |
| 1838 /** | 1818 /** |
| 1839 * The left parenthesis. | 1819 * The left parenthesis. |
| 1840 */ | 1820 */ |
| 1841 Token _leftParenthesis; | 1821 Token _leftParenthesis; |
| 1842 | 1822 |
| 1843 /** | 1823 /** |
| 1844 * The parameter whose value will be the exception that was thrown. | 1824 * The parameter whose value will be the exception that was thrown. |
| 1845 */ | 1825 */ |
| 1846 SimpleIdentifier _exceptionParameter; | 1826 SimpleIdentifier _exceptionParameter; |
| 1847 | 1827 |
| 1848 /** | 1828 /** |
| 1849 * The comma separating the exception parameter from the stack trace parameter
. | 1829 * The comma separating the exception parameter from the stack trace parameter
. |
| 1850 */ | 1830 */ |
| 1851 Token _comma; | 1831 Token _comma; |
| 1852 | 1832 |
| 1853 /** | 1833 /** |
| 1854 * The parameter whose value will be the stack trace associated with the excep
tion. | 1834 * The parameter whose value will be the stack trace associated with the excep
tion. |
| 1855 */ | 1835 */ |
| 1856 SimpleIdentifier _stackTraceParameter; | 1836 SimpleIdentifier _stackTraceParameter; |
| 1857 | 1837 |
| 1858 /** | 1838 /** |
| 1859 * The right parenthesis. | 1839 * The right parenthesis. |
| 1860 */ | 1840 */ |
| 1861 Token _rightParenthesis; | 1841 Token _rightParenthesis; |
| 1862 | 1842 |
| 1863 /** | 1843 /** |
| 1864 * The body of the catch block. | 1844 * The body of the catch block. |
| 1865 */ | 1845 */ |
| 1866 Block _body; | 1846 Block _body; |
| 1867 | 1847 |
| 1868 /** | 1848 /** |
| 1869 * Initialize a newly created catch clause. | 1849 * Initialize a newly created catch clause. |
| 1870 * @param onKeyword the token representing the 'on' keyword | 1850 * @param onKeyword the token representing the 'on' keyword |
| 1871 * @param exceptionType the type of exceptions caught by this catch clause | 1851 * @param exceptionType the type of exceptions caught by this catch clause |
| 1872 * @param leftParenthesis the left parenthesis | 1852 * @param leftParenthesis the left parenthesis |
| 1873 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown | 1853 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown |
| 1874 * @param comma the comma separating the exception parameter from the stack tr
ace parameter | 1854 * @param comma the comma separating the exception parameter from the stack tr
ace parameter |
| 1875 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with | 1855 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with |
| 1876 * the exception | 1856 * the exception |
| 1877 * @param rightParenthesis the right parenthesis | 1857 * @param rightParenthesis the right parenthesis |
| 1878 * @param body the body of the catch block | 1858 * @param body the body of the catch block |
| 1879 */ | 1859 */ |
| 1880 CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword,
Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleI
dentifier stackTraceParameter, Token rightParenthesis, Block body) { | 1860 CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword,
Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleI
dentifier stackTraceParameter, Token rightParenthesis, Block body) { |
| 1881 this._onKeyword = onKeyword; | 1861 this._onKeyword = onKeyword; |
| 1882 this._exceptionType = becomeParentOf(exceptionType); | 1862 this._exceptionType = becomeParentOf(exceptionType); |
| 1883 this._catchKeyword = catchKeyword; | 1863 this._catchKeyword = catchKeyword; |
| 1884 this._leftParenthesis = leftParenthesis; | 1864 this._leftParenthesis = leftParenthesis; |
| 1885 this._exceptionParameter = becomeParentOf(exceptionParameter); | 1865 this._exceptionParameter = becomeParentOf(exceptionParameter); |
| 1886 this._comma = comma; | 1866 this._comma = comma; |
| 1887 this._stackTraceParameter = becomeParentOf(stackTraceParameter); | 1867 this._stackTraceParameter = becomeParentOf(stackTraceParameter); |
| 1888 this._rightParenthesis = rightParenthesis; | 1868 this._rightParenthesis = rightParenthesis; |
| 1889 this._body = becomeParentOf(body); | 1869 this._body = becomeParentOf(body); |
| 1890 } | 1870 } |
| 1891 | 1871 |
| 1892 /** | 1872 /** |
| 1893 * Initialize a newly created catch clause. | 1873 * Initialize a newly created catch clause. |
| 1894 * @param onKeyword the token representing the 'on' keyword | 1874 * @param onKeyword the token representing the 'on' keyword |
| 1895 * @param exceptionType the type of exceptions caught by this catch clause | 1875 * @param exceptionType the type of exceptions caught by this catch clause |
| 1896 * @param leftParenthesis the left parenthesis | 1876 * @param leftParenthesis the left parenthesis |
| 1897 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown | 1877 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown |
| 1898 * @param comma the comma separating the exception parameter from the stack tr
ace parameter | 1878 * @param comma the comma separating the exception parameter from the stack tr
ace parameter |
| 1899 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with | 1879 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with |
| 1900 * the exception | 1880 * the exception |
| 1901 * @param rightParenthesis the right parenthesis | 1881 * @param rightParenthesis the right parenthesis |
| 1902 * @param body the body of the catch block | 1882 * @param body the body of the catch block |
| 1903 */ | 1883 */ |
| 1904 CatchClause({Token onKeyword, TypeName exceptionType, Token catchKeyword, Toke
n leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleIdent
ifier stackTraceParameter, Token rightParenthesis, Block body}) : this.full(onKe
yword, exceptionType, catchKeyword, leftParenthesis, exceptionParameter, comma,
stackTraceParameter, rightParenthesis, body); | 1884 CatchClause({Token onKeyword, TypeName exceptionType, Token catchKeyword, Toke
n leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleIdent
ifier stackTraceParameter, Token rightParenthesis, Block body}) : this.full(onKe
yword, exceptionType, catchKeyword, leftParenthesis, exceptionParameter, comma,
stackTraceParameter, rightParenthesis, body); |
| 1905 accept(ASTVisitor visitor) => visitor.visitCatchClause(this); | 1885 accept(ASTVisitor visitor) => visitor.visitCatchClause(this); |
| 1906 Token get beginToken { | 1886 Token get beginToken { |
| 1907 if (_onKeyword != null) { | 1887 if (_onKeyword != null) { |
| 1908 return _onKeyword; | 1888 return _onKeyword; |
| 1909 } | 1889 } |
| 1910 return _catchKeyword; | 1890 return _catchKeyword; |
| 1911 } | 1891 } |
| 1912 | 1892 |
| 1913 /** | 1893 /** |
| 1914 * Return the body of the catch block. | 1894 * Return the body of the catch block. |
| 1915 * @return the body of the catch block | 1895 * @return the body of the catch block |
| 1916 */ | 1896 */ |
| 1917 Block get body => _body; | 1897 Block get body => _body; |
| 1918 | 1898 |
| 1919 /** | 1899 /** |
| 1920 * Return the token representing the 'catch' keyword, or {@code null} if there
is no 'catch' | 1900 * Return the token representing the 'catch' keyword, or {@code null} if there
is no 'catch' |
| 1921 * keyword. | 1901 * keyword. |
| 1922 * @return the token representing the 'catch' keyword | 1902 * @return the token representing the 'catch' keyword |
| 1923 */ | 1903 */ |
| 1924 Token get catchKeyword => _catchKeyword; | 1904 Token get catchKeyword => _catchKeyword; |
| 1925 | 1905 |
| 1926 /** | 1906 /** |
| 1927 * Return the comma. | 1907 * Return the comma. |
| 1928 * @return the comma | 1908 * @return the comma |
| 1929 */ | 1909 */ |
| 1930 Token get comma => _comma; | 1910 Token get comma => _comma; |
| 1931 Token get endToken => _body.endToken; | 1911 Token get endToken => _body.endToken; |
| 1932 | 1912 |
| 1933 /** | 1913 /** |
| 1934 * Return the parameter whose value will be the exception that was thrown. | 1914 * Return the parameter whose value will be the exception that was thrown. |
| 1935 * @return the parameter whose value will be the exception that was thrown | 1915 * @return the parameter whose value will be the exception that was thrown |
| 1936 */ | 1916 */ |
| 1937 SimpleIdentifier get exceptionParameter => _exceptionParameter; | 1917 SimpleIdentifier get exceptionParameter => _exceptionParameter; |
| 1938 | 1918 |
| 1939 /** | 1919 /** |
| 1940 * Return the type of exceptions caught by this catch clause, or {@code null}
if this catch clause | 1920 * Return the type of exceptions caught by this catch clause, or {@code null}
if this catch clause |
| 1941 * catches every type of exception. | 1921 * catches every type of exception. |
| 1942 * @return the type of exceptions caught by this catch clause | 1922 * @return the type of exceptions caught by this catch clause |
| 1943 */ | 1923 */ |
| 1944 TypeName get exceptionType => _exceptionType; | 1924 TypeName get exceptionType => _exceptionType; |
| 1945 | 1925 |
| 1946 /** | 1926 /** |
| 1947 * Return the left parenthesis. | 1927 * Return the left parenthesis. |
| 1948 * @return the left parenthesis | 1928 * @return the left parenthesis |
| 1949 */ | 1929 */ |
| 1950 Token get leftParenthesis => _leftParenthesis; | 1930 Token get leftParenthesis => _leftParenthesis; |
| 1951 | 1931 |
| 1952 /** | 1932 /** |
| 1953 * Return the token representing the 'on' keyword, or {@code null} if there is
no 'on' keyword. | 1933 * Return the token representing the 'on' keyword, or {@code null} if there is
no 'on' keyword. |
| 1954 * @return the token representing the 'on' keyword | 1934 * @return the token representing the 'on' keyword |
| 1955 */ | 1935 */ |
| 1956 Token get onKeyword => _onKeyword; | 1936 Token get onKeyword => _onKeyword; |
| 1957 | 1937 |
| 1958 /** | 1938 /** |
| 1959 * Return the right parenthesis. | 1939 * Return the right parenthesis. |
| 1960 * @return the right parenthesis | 1940 * @return the right parenthesis |
| 1961 */ | 1941 */ |
| 1962 Token get rightParenthesis => _rightParenthesis; | 1942 Token get rightParenthesis => _rightParenthesis; |
| 1963 | 1943 |
| 1964 /** | 1944 /** |
| 1965 * Return the parameter whose value will be the stack trace associated with th
e exception. | 1945 * Return the parameter whose value will be the stack trace associated with th
e exception. |
| 1966 * @return the parameter whose value will be the stack trace associated with t
he exception | 1946 * @return the parameter whose value will be the stack trace associated with t
he exception |
| 1967 */ | 1947 */ |
| 1968 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; | 1948 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; |
| 1969 | 1949 |
| 1970 /** | 1950 /** |
| 1971 * Set the body of the catch block to the given block. | 1951 * Set the body of the catch block to the given block. |
| 1972 * @param block the body of the catch block | 1952 * @param block the body of the catch block |
| 1973 */ | 1953 */ |
| 1974 void set body(Block block) { | 1954 void set body(Block block) { |
| 1975 _body = becomeParentOf(block); | 1955 _body = becomeParentOf(block); |
| 1976 } | 1956 } |
| 1977 | 1957 |
| 1978 /** | 1958 /** |
| 1979 * Set the token representing the 'catch' keyword to the given token. | 1959 * Set the token representing the 'catch' keyword to the given token. |
| 1980 * @param catchKeyword the token representing the 'catch' keyword | 1960 * @param catchKeyword the token representing the 'catch' keyword |
| 1981 */ | 1961 */ |
| 1982 void set catchKeyword(Token catchKeyword2) { | 1962 void set catchKeyword(Token catchKeyword2) { |
| 1983 this._catchKeyword = catchKeyword2; | 1963 this._catchKeyword = catchKeyword2; |
| 1984 } | 1964 } |
| 1985 | 1965 |
| 1986 /** | 1966 /** |
| 1987 * Set the comma to the given token. | 1967 * Set the comma to the given token. |
| 1988 * @param comma the comma | 1968 * @param comma the comma |
| 1989 */ | 1969 */ |
| 1990 void set comma(Token comma2) { | 1970 void set comma(Token comma2) { |
| 1991 this._comma = comma2; | 1971 this._comma = comma2; |
| 1992 } | 1972 } |
| 1993 | 1973 |
| 1994 /** | 1974 /** |
| 1995 * Set the parameter whose value will be the exception that was thrown to the
given parameter. | 1975 * Set the parameter whose value will be the exception that was thrown to the
given parameter. |
| 1996 * @param parameter the parameter whose value will be the exception that was t
hrown | 1976 * @param parameter the parameter whose value will be the exception that was t
hrown |
| 1997 */ | 1977 */ |
| 1998 void set exceptionParameter(SimpleIdentifier parameter) { | 1978 void set exceptionParameter(SimpleIdentifier parameter) { |
| 1999 _exceptionParameter = becomeParentOf(parameter); | 1979 _exceptionParameter = becomeParentOf(parameter); |
| 2000 } | 1980 } |
| 2001 | 1981 |
| 2002 /** | 1982 /** |
| 2003 * Set the type of exceptions caught by this catch clause to the given type. | 1983 * Set the type of exceptions caught by this catch clause to the given type. |
| 2004 * @param exceptionType the type of exceptions caught by this catch clause | 1984 * @param exceptionType the type of exceptions caught by this catch clause |
| 2005 */ | 1985 */ |
| 2006 void set exceptionType(TypeName exceptionType2) { | 1986 void set exceptionType(TypeName exceptionType2) { |
| 2007 this._exceptionType = exceptionType2; | 1987 this._exceptionType = exceptionType2; |
| 2008 } | 1988 } |
| 2009 | 1989 |
| 2010 /** | 1990 /** |
| 2011 * Set the left parenthesis to the given token. | 1991 * Set the left parenthesis to the given token. |
| 2012 * @param parenthesis the left parenthesis | 1992 * @param parenthesis the left parenthesis |
| 2013 */ | 1993 */ |
| 2014 void set leftParenthesis(Token parenthesis) { | 1994 void set leftParenthesis(Token parenthesis) { |
| 2015 _leftParenthesis = parenthesis; | 1995 _leftParenthesis = parenthesis; |
| 2016 } | 1996 } |
| 2017 | 1997 |
| 2018 /** | 1998 /** |
| 2019 * Set the token representing the 'on' keyword to the given keyword. | 1999 * Set the token representing the 'on' keyword to the given keyword. |
| 2020 * @param onKeyword the token representing the 'on' keyword | 2000 * @param onKeyword the token representing the 'on' keyword |
| 2021 */ | 2001 */ |
| 2022 void set onKeyword(Token onKeyword2) { | 2002 void set onKeyword(Token onKeyword2) { |
| 2023 this._onKeyword = onKeyword2; | 2003 this._onKeyword = onKeyword2; |
| 2024 } | 2004 } |
| 2025 | 2005 |
| 2026 /** | 2006 /** |
| 2027 * Set the right parenthesis to the given token. | 2007 * Set the right parenthesis to the given token. |
| 2028 * @param parenthesis the right parenthesis | 2008 * @param parenthesis the right parenthesis |
| 2029 */ | 2009 */ |
| 2030 void set rightParenthesis(Token parenthesis) { | 2010 void set rightParenthesis(Token parenthesis) { |
| 2031 _rightParenthesis = parenthesis; | 2011 _rightParenthesis = parenthesis; |
| 2032 } | 2012 } |
| 2033 | 2013 |
| 2034 /** | 2014 /** |
| 2035 * Set the parameter whose value will be the stack trace associated with the e
xception to the | 2015 * Set the parameter whose value will be the stack trace associated with the e
xception to the |
| 2036 * given parameter. | 2016 * given parameter. |
| 2037 * @param parameter the parameter whose value will be the stack trace associat
ed with the | 2017 * @param parameter the parameter whose value will be the stack trace associat
ed with the |
| 2038 * exception | 2018 * exception |
| 2039 */ | 2019 */ |
| 2040 void set stackTraceParameter(SimpleIdentifier parameter) { | 2020 void set stackTraceParameter(SimpleIdentifier parameter) { |
| 2041 _stackTraceParameter = becomeParentOf(parameter); | 2021 _stackTraceParameter = becomeParentOf(parameter); |
| 2042 } | 2022 } |
| 2043 void visitChildren(ASTVisitor<Object> visitor) { | 2023 void visitChildren(ASTVisitor<Object> visitor) { |
| 2044 safelyVisitChild(_exceptionType, visitor); | 2024 safelyVisitChild(_exceptionType, visitor); |
| 2045 safelyVisitChild(_exceptionParameter, visitor); | 2025 safelyVisitChild(_exceptionParameter, visitor); |
| 2046 safelyVisitChild(_stackTraceParameter, visitor); | 2026 safelyVisitChild(_stackTraceParameter, visitor); |
| 2047 safelyVisitChild(_body, visitor); | 2027 safelyVisitChild(_body, visitor); |
| 2048 } | 2028 } |
| 2049 } | 2029 } |
| 2050 | |
| 2051 /** | 2030 /** |
| 2052 * Instances of the class {@code ClassDeclaration} represent the declaration of
a class. | 2031 * Instances of the class {@code ClassDeclaration} represent the declaration of
a class. |
| 2053 * <pre> | 2032 * <pre> |
| 2054 * classDeclaration ::= | 2033 * classDeclaration ::= |
| 2055 * 'abstract'? 'class' {@link SimpleIdentifier name} {@link TypeParameterList ty
peParameterList}? | 2034 * 'abstract'? 'class' {@link SimpleIdentifier name} {@link TypeParameterList ty
peParameterList}? |
| 2056 * ({@link ExtendsClause extendsClause} {@link WithClause withClause}?)?{@link I
mplementsClause implementsClause}? | 2035 * ({@link ExtendsClause extendsClause} {@link WithClause withClause}?)?{@link I
mplementsClause implementsClause}? |
| 2057 * '{' {@link ClassMember classMember}* '}' | 2036 * '{' {@link ClassMember classMember}* '}' |
| 2058 * </pre> | 2037 * </pre> |
| 2059 * @coverage dart.engine.ast | 2038 * @coverage dart.engine.ast |
| 2060 */ | 2039 */ |
| 2061 class ClassDeclaration extends CompilationUnitMember { | 2040 class ClassDeclaration extends CompilationUnitMember { |
| 2062 | 2041 |
| 2063 /** | 2042 /** |
| 2064 * The 'abstract' keyword, or {@code null} if the keyword was absent. | 2043 * The 'abstract' keyword, or {@code null} if the keyword was absent. |
| 2065 */ | 2044 */ |
| 2066 Token _abstractKeyword; | 2045 Token _abstractKeyword; |
| 2067 | 2046 |
| 2068 /** | 2047 /** |
| 2069 * The token representing the 'class' keyword. | 2048 * The token representing the 'class' keyword. |
| 2070 */ | 2049 */ |
| 2071 Token _classKeyword; | 2050 Token _classKeyword; |
| 2072 | 2051 |
| 2073 /** | 2052 /** |
| 2074 * The name of the class being declared. | 2053 * The name of the class being declared. |
| 2075 */ | 2054 */ |
| 2076 SimpleIdentifier _name; | 2055 SimpleIdentifier _name; |
| 2077 | 2056 |
| 2078 /** | 2057 /** |
| 2079 * The type parameters for the class, or {@code null} if the class does not ha
ve any type | 2058 * The type parameters for the class, or {@code null} if the class does not ha
ve any type |
| 2080 * parameters. | 2059 * parameters. |
| 2081 */ | 2060 */ |
| 2082 TypeParameterList _typeParameters; | 2061 TypeParameterList _typeParameters; |
| 2083 | 2062 |
| 2084 /** | 2063 /** |
| 2085 * The extends clause for the class, or {@code null} if the class does not ext
end any other class. | 2064 * The extends clause for the class, or {@code null} if the class does not ext
end any other class. |
| 2086 */ | 2065 */ |
| 2087 ExtendsClause _extendsClause; | 2066 ExtendsClause _extendsClause; |
| 2088 | 2067 |
| 2089 /** | 2068 /** |
| 2090 * The with clause for the class, or {@code null} if the class does not have a
with clause. | 2069 * The with clause for the class, or {@code null} if the class does not have a
with clause. |
| 2091 */ | 2070 */ |
| 2092 WithClause _withClause; | 2071 WithClause _withClause; |
| 2093 | 2072 |
| 2094 /** | 2073 /** |
| 2095 * The implements clause for the class, or {@code null} if the class does not
implement any | 2074 * The implements clause for the class, or {@code null} if the class does not
implement any |
| 2096 * interfaces. | 2075 * interfaces. |
| 2097 */ | 2076 */ |
| 2098 ImplementsClause _implementsClause; | 2077 ImplementsClause _implementsClause; |
| 2099 | 2078 |
| 2100 /** | 2079 /** |
| 2101 * The left curly bracket. | 2080 * The left curly bracket. |
| 2102 */ | 2081 */ |
| 2103 Token _leftBracket; | 2082 Token _leftBracket; |
| 2104 | 2083 |
| 2105 /** | 2084 /** |
| 2106 * The members defined by the class. | 2085 * The members defined by the class. |
| 2107 */ | 2086 */ |
| 2108 NodeList<ClassMember> _members; | 2087 NodeList<ClassMember> _members; |
| 2109 | 2088 |
| 2110 /** | 2089 /** |
| 2111 * The right curly bracket. | 2090 * The right curly bracket. |
| 2112 */ | 2091 */ |
| 2113 Token _rightBracket; | 2092 Token _rightBracket; |
| 2114 | 2093 |
| 2115 /** | 2094 /** |
| 2116 * Initialize a newly created class declaration. | 2095 * Initialize a newly created class declaration. |
| 2117 * @param comment the documentation comment associated with this class | 2096 * @param comment the documentation comment associated with this class |
| 2118 * @param metadata the annotations associated with this class | 2097 * @param metadata the annotations associated with this class |
| 2119 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent | 2098 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent |
| 2120 * @param classKeyword the token representing the 'class' keyword | 2099 * @param classKeyword the token representing the 'class' keyword |
| 2121 * @param name the name of the class being declared | 2100 * @param name the name of the class being declared |
| 2122 * @param typeParameters the type parameters for the class | 2101 * @param typeParameters the type parameters for the class |
| 2123 * @param extendsClause the extends clause for the class | 2102 * @param extendsClause the extends clause for the class |
| 2124 * @param withClause the with clause for the class | 2103 * @param withClause the with clause for the class |
| 2125 * @param implementsClause the implements clause for the class | 2104 * @param implementsClause the implements clause for the class |
| 2126 * @param leftBracket the left curly bracket | 2105 * @param leftBracket the left curly bracket |
| 2127 * @param members the members defined by the class | 2106 * @param members the members defined by the class |
| 2128 * @param rightBracket the right curly bracket | 2107 * @param rightBracket the right curly bracket |
| 2129 */ | 2108 */ |
| 2130 ClassDeclaration.full(Comment comment, List<Annotation> metadata, Token abstra
ctKeyword, Token classKeyword, SimpleIdentifier name, TypeParameterList typePara
meters, ExtendsClause extendsClause, WithClause withClause, ImplementsClause imp
lementsClause, Token leftBracket, List<ClassMember> members, Token rightBracket)
: super.full(comment, metadata) { | 2109 ClassDeclaration.full(Comment comment, List<Annotation> metadata, Token abstra
ctKeyword, Token classKeyword, SimpleIdentifier name, TypeParameterList typePara
meters, ExtendsClause extendsClause, WithClause withClause, ImplementsClause imp
lementsClause, Token leftBracket, List<ClassMember> members, Token rightBracket)
: super.full(comment, metadata) { |
| 2131 this._members = new NodeList<ClassMember>(this); | 2110 this._members = new NodeList<ClassMember>(this); |
| 2132 this._abstractKeyword = abstractKeyword; | 2111 this._abstractKeyword = abstractKeyword; |
| 2133 this._classKeyword = classKeyword; | 2112 this._classKeyword = classKeyword; |
| 2134 this._name = becomeParentOf(name); | 2113 this._name = becomeParentOf(name); |
| 2135 this._typeParameters = becomeParentOf(typeParameters); | 2114 this._typeParameters = becomeParentOf(typeParameters); |
| 2136 this._extendsClause = becomeParentOf(extendsClause); | 2115 this._extendsClause = becomeParentOf(extendsClause); |
| 2137 this._withClause = becomeParentOf(withClause); | 2116 this._withClause = becomeParentOf(withClause); |
| 2138 this._implementsClause = becomeParentOf(implementsClause); | 2117 this._implementsClause = becomeParentOf(implementsClause); |
| 2139 this._leftBracket = leftBracket; | 2118 this._leftBracket = leftBracket; |
| 2140 this._members.addAll(members); | 2119 this._members.addAll(members); |
| 2141 this._rightBracket = rightBracket; | 2120 this._rightBracket = rightBracket; |
| 2142 } | 2121 } |
| 2143 | 2122 |
| 2144 /** | 2123 /** |
| 2145 * Initialize a newly created class declaration. | 2124 * Initialize a newly created class declaration. |
| 2146 * @param comment the documentation comment associated with this class | 2125 * @param comment the documentation comment associated with this class |
| 2147 * @param metadata the annotations associated with this class | 2126 * @param metadata the annotations associated with this class |
| 2148 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent | 2127 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent |
| 2149 * @param classKeyword the token representing the 'class' keyword | 2128 * @param classKeyword the token representing the 'class' keyword |
| 2150 * @param name the name of the class being declared | 2129 * @param name the name of the class being declared |
| 2151 * @param typeParameters the type parameters for the class | 2130 * @param typeParameters the type parameters for the class |
| 2152 * @param extendsClause the extends clause for the class | 2131 * @param extendsClause the extends clause for the class |
| 2153 * @param withClause the with clause for the class | 2132 * @param withClause the with clause for the class |
| 2154 * @param implementsClause the implements clause for the class | 2133 * @param implementsClause the implements clause for the class |
| 2155 * @param leftBracket the left curly bracket | 2134 * @param leftBracket the left curly bracket |
| 2156 * @param members the members defined by the class | 2135 * @param members the members defined by the class |
| 2157 * @param rightBracket the right curly bracket | 2136 * @param rightBracket the right curly bracket |
| 2158 */ | 2137 */ |
| 2159 ClassDeclaration({Comment comment, List<Annotation> metadata, Token abstractKe
yword, Token classKeyword, SimpleIdentifier name, TypeParameterList typeParamete
rs, ExtendsClause extendsClause, WithClause withClause, ImplementsClause impleme
ntsClause, Token leftBracket, List<ClassMember> members, Token rightBracket}) :
this.full(comment, metadata, abstractKeyword, classKeyword, name, typeParameters
, extendsClause, withClause, implementsClause, leftBracket, members, rightBracke
t); | 2138 ClassDeclaration({Comment comment, List<Annotation> metadata, Token abstractKe
yword, Token classKeyword, SimpleIdentifier name, TypeParameterList typeParamete
rs, ExtendsClause extendsClause, WithClause withClause, ImplementsClause impleme
ntsClause, Token leftBracket, List<ClassMember> members, Token rightBracket}) :
this.full(comment, metadata, abstractKeyword, classKeyword, name, typeParameters
, extendsClause, withClause, implementsClause, leftBracket, members, rightBracke
t); |
| 2160 accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); | 2139 accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); |
| 2161 | 2140 |
| 2162 /** | 2141 /** |
| 2163 * Return the 'abstract' keyword, or {@code null} if the keyword was absent. | 2142 * Return the 'abstract' keyword, or {@code null} if the keyword was absent. |
| 2164 * @return the 'abstract' keyword | 2143 * @return the 'abstract' keyword |
| 2165 */ | 2144 */ |
| 2166 Token get abstractKeyword => _abstractKeyword; | 2145 Token get abstractKeyword => _abstractKeyword; |
| 2167 | 2146 |
| 2168 /** | 2147 /** |
| 2169 * Return the token representing the 'class' keyword. | 2148 * Return the token representing the 'class' keyword. |
| 2170 * @return the token representing the 'class' keyword | 2149 * @return the token representing the 'class' keyword |
| 2171 */ | 2150 */ |
| 2172 Token get classKeyword => _classKeyword; | 2151 Token get classKeyword => _classKeyword; |
| 2173 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; | 2152 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; |
| 2174 Token get endToken => _rightBracket; | 2153 Token get endToken => _rightBracket; |
| 2175 | 2154 |
| 2176 /** | 2155 /** |
| 2177 * Return the extends clause for this class, or {@code null} if the class does
not extend any | 2156 * Return the extends clause for this class, or {@code null} if the class does
not extend any |
| 2178 * other class. | 2157 * other class. |
| 2179 * @return the extends clause for this class | 2158 * @return the extends clause for this class |
| 2180 */ | 2159 */ |
| 2181 ExtendsClause get extendsClause => _extendsClause; | 2160 ExtendsClause get extendsClause => _extendsClause; |
| 2182 | 2161 |
| 2183 /** | 2162 /** |
| 2184 * Return the implements clause for the class, or {@code null} if the class do
es not implement any | 2163 * Return the implements clause for the class, or {@code null} if the class do
es not implement any |
| 2185 * interfaces. | 2164 * interfaces. |
| 2186 * @return the implements clause for the class | 2165 * @return the implements clause for the class |
| 2187 */ | 2166 */ |
| 2188 ImplementsClause get implementsClause => _implementsClause; | 2167 ImplementsClause get implementsClause => _implementsClause; |
| 2189 | 2168 |
| 2190 /** | 2169 /** |
| 2191 * Return the left curly bracket. | 2170 * Return the left curly bracket. |
| 2192 * @return the left curly bracket | 2171 * @return the left curly bracket |
| 2193 */ | 2172 */ |
| 2194 Token get leftBracket => _leftBracket; | 2173 Token get leftBracket => _leftBracket; |
| 2195 | 2174 |
| 2196 /** | 2175 /** |
| 2197 * Return the members defined by the class. | 2176 * Return the members defined by the class. |
| 2198 * @return the members defined by the class | 2177 * @return the members defined by the class |
| 2199 */ | 2178 */ |
| 2200 NodeList<ClassMember> get members => _members; | 2179 NodeList<ClassMember> get members => _members; |
| 2201 | 2180 |
| 2202 /** | 2181 /** |
| 2203 * Return the name of the class being declared. | 2182 * Return the name of the class being declared. |
| 2204 * @return the name of the class being declared | 2183 * @return the name of the class being declared |
| 2205 */ | 2184 */ |
| 2206 SimpleIdentifier get name => _name; | 2185 SimpleIdentifier get name => _name; |
| 2207 | 2186 |
| 2208 /** | 2187 /** |
| 2209 * Return the right curly bracket. | 2188 * Return the right curly bracket. |
| 2210 * @return the right curly bracket | 2189 * @return the right curly bracket |
| 2211 */ | 2190 */ |
| 2212 Token get rightBracket => _rightBracket; | 2191 Token get rightBracket => _rightBracket; |
| 2213 | 2192 |
| 2214 /** | 2193 /** |
| 2215 * Return the type parameters for the class, or {@code null} if the class does
not have any type | 2194 * Return the type parameters for the class, or {@code null} if the class does
not have any type |
| 2216 * parameters. | 2195 * parameters. |
| 2217 * @return the type parameters for the class | 2196 * @return the type parameters for the class |
| 2218 */ | 2197 */ |
| 2219 TypeParameterList get typeParameters => _typeParameters; | 2198 TypeParameterList get typeParameters => _typeParameters; |
| 2220 | 2199 |
| 2221 /** | 2200 /** |
| 2222 * Return the with clause for the class, or {@code null} if the class does not
have a with clause. | 2201 * Return the with clause for the class, or {@code null} if the class does not
have a with clause. |
| 2223 * @return the with clause for the class | 2202 * @return the with clause for the class |
| 2224 */ | 2203 */ |
| 2225 WithClause get withClause => _withClause; | 2204 WithClause get withClause => _withClause; |
| 2226 | 2205 |
| 2227 /** | 2206 /** |
| 2228 * Set the 'abstract' keyword to the given keyword. | 2207 * Set the 'abstract' keyword to the given keyword. |
| 2229 * @param abstractKeyword the 'abstract' keyword | 2208 * @param abstractKeyword the 'abstract' keyword |
| 2230 */ | 2209 */ |
| 2231 void set abstractKeyword(Token abstractKeyword2) { | 2210 void set abstractKeyword(Token abstractKeyword2) { |
| 2232 this._abstractKeyword = abstractKeyword2; | 2211 this._abstractKeyword = abstractKeyword2; |
| 2233 } | 2212 } |
| 2234 | 2213 |
| 2235 /** | 2214 /** |
| 2236 * Set the token representing the 'class' keyword to the given token. | 2215 * Set the token representing the 'class' keyword to the given token. |
| 2237 * @param classKeyword the token representing the 'class' keyword | 2216 * @param classKeyword the token representing the 'class' keyword |
| 2238 */ | 2217 */ |
| 2239 void set classKeyword(Token classKeyword2) { | 2218 void set classKeyword(Token classKeyword2) { |
| 2240 this._classKeyword = classKeyword2; | 2219 this._classKeyword = classKeyword2; |
| 2241 } | 2220 } |
| 2242 | 2221 |
| 2243 /** | 2222 /** |
| 2244 * Set the extends clause for this class to the given clause. | 2223 * Set the extends clause for this class to the given clause. |
| 2245 * @param extendsClause the extends clause for this class | 2224 * @param extendsClause the extends clause for this class |
| 2246 */ | 2225 */ |
| 2247 void set extendsClause(ExtendsClause extendsClause2) { | 2226 void set extendsClause(ExtendsClause extendsClause2) { |
| 2248 this._extendsClause = becomeParentOf(extendsClause2); | 2227 this._extendsClause = becomeParentOf(extendsClause2); |
| 2249 } | 2228 } |
| 2250 | 2229 |
| 2251 /** | 2230 /** |
| 2252 * Set the implements clause for the class to the given clause. | 2231 * Set the implements clause for the class to the given clause. |
| 2253 * @param implementsClause the implements clause for the class | 2232 * @param implementsClause the implements clause for the class |
| 2254 */ | 2233 */ |
| 2255 void set implementsClause(ImplementsClause implementsClause2) { | 2234 void set implementsClause(ImplementsClause implementsClause2) { |
| 2256 this._implementsClause = becomeParentOf(implementsClause2); | 2235 this._implementsClause = becomeParentOf(implementsClause2); |
| 2257 } | 2236 } |
| 2258 | 2237 |
| 2259 /** | 2238 /** |
| 2260 * Set the left curly bracket to the given token. | 2239 * Set the left curly bracket to the given token. |
| 2261 * @param leftBracket the left curly bracket | 2240 * @param leftBracket the left curly bracket |
| 2262 */ | 2241 */ |
| 2263 void set leftBracket(Token leftBracket2) { | 2242 void set leftBracket(Token leftBracket2) { |
| 2264 this._leftBracket = leftBracket2; | 2243 this._leftBracket = leftBracket2; |
| 2265 } | 2244 } |
| 2266 | 2245 |
| 2267 /** | 2246 /** |
| 2268 * Set the name of the class being declared to the given identifier. | 2247 * Set the name of the class being declared to the given identifier. |
| 2269 * @param identifier the name of the class being declared | 2248 * @param identifier the name of the class being declared |
| 2270 */ | 2249 */ |
| 2271 void set name(SimpleIdentifier identifier) { | 2250 void set name(SimpleIdentifier identifier) { |
| 2272 _name = becomeParentOf(identifier); | 2251 _name = becomeParentOf(identifier); |
| 2273 } | 2252 } |
| 2274 | 2253 |
| 2275 /** | 2254 /** |
| 2276 * Set the right curly bracket to the given token. | 2255 * Set the right curly bracket to the given token. |
| 2277 * @param rightBracket the right curly bracket | 2256 * @param rightBracket the right curly bracket |
| 2278 */ | 2257 */ |
| 2279 void set rightBracket(Token rightBracket2) { | 2258 void set rightBracket(Token rightBracket2) { |
| 2280 this._rightBracket = rightBracket2; | 2259 this._rightBracket = rightBracket2; |
| 2281 } | 2260 } |
| 2282 | 2261 |
| 2283 /** | 2262 /** |
| 2284 * Set the type parameters for the class to the given list of type parameters. | 2263 * Set the type parameters for the class to the given list of type parameters. |
| 2285 * @param typeParameters the type parameters for the class | 2264 * @param typeParameters the type parameters for the class |
| 2286 */ | 2265 */ |
| 2287 void set typeParameters(TypeParameterList typeParameters2) { | 2266 void set typeParameters(TypeParameterList typeParameters2) { |
| 2288 this._typeParameters = typeParameters2; | 2267 this._typeParameters = typeParameters2; |
| 2289 } | 2268 } |
| 2290 | 2269 |
| 2291 /** | 2270 /** |
| 2292 * Set the with clause for the class to the given clause. | 2271 * Set the with clause for the class to the given clause. |
| 2293 * @param withClause the with clause for the class | 2272 * @param withClause the with clause for the class |
| 2294 */ | 2273 */ |
| 2295 void set withClause(WithClause withClause2) { | 2274 void set withClause(WithClause withClause2) { |
| 2296 this._withClause = becomeParentOf(withClause2); | 2275 this._withClause = becomeParentOf(withClause2); |
| 2297 } | 2276 } |
| 2298 void visitChildren(ASTVisitor<Object> visitor) { | 2277 void visitChildren(ASTVisitor<Object> visitor) { |
| 2299 super.visitChildren(visitor); | 2278 super.visitChildren(visitor); |
| 2300 safelyVisitChild(_name, visitor); | 2279 safelyVisitChild(_name, visitor); |
| 2301 safelyVisitChild(_typeParameters, visitor); | 2280 safelyVisitChild(_typeParameters, visitor); |
| 2302 safelyVisitChild(_extendsClause, visitor); | 2281 safelyVisitChild(_extendsClause, visitor); |
| 2303 safelyVisitChild(_withClause, visitor); | 2282 safelyVisitChild(_withClause, visitor); |
| 2304 safelyVisitChild(_implementsClause, visitor); | 2283 safelyVisitChild(_implementsClause, visitor); |
| 2305 members.accept(visitor); | 2284 members.accept(visitor); |
| 2306 } | 2285 } |
| 2307 Token get firstTokenAfterCommentAndMetadata { | 2286 Token get firstTokenAfterCommentAndMetadata { |
| 2308 if (_abstractKeyword != null) { | 2287 if (_abstractKeyword != null) { |
| 2309 return _abstractKeyword; | 2288 return _abstractKeyword; |
| 2310 } | 2289 } |
| 2311 return _classKeyword; | 2290 return _classKeyword; |
| 2312 } | 2291 } |
| 2313 } | 2292 } |
| 2314 | |
| 2315 /** | 2293 /** |
| 2316 * The abstract class {@code ClassMember} defines the behavior common to nodes t
hat declare a name | 2294 * The abstract class {@code ClassMember} defines the behavior common to nodes t
hat declare a name |
| 2317 * within the scope of a class. | 2295 * within the scope of a class. |
| 2318 * @coverage dart.engine.ast | 2296 * @coverage dart.engine.ast |
| 2319 */ | 2297 */ |
| 2320 abstract class ClassMember extends Declaration { | 2298 abstract class ClassMember extends Declaration { |
| 2321 | 2299 |
| 2322 /** | 2300 /** |
| 2323 * Initialize a newly created member of a class. | 2301 * Initialize a newly created member of a class. |
| 2324 * @param comment the documentation comment associated with this member | 2302 * @param comment the documentation comment associated with this member |
| 2325 * @param metadata the annotations associated with this member | 2303 * @param metadata the annotations associated with this member |
| 2326 */ | 2304 */ |
| 2327 ClassMember.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { | 2305 ClassMember.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { |
| 2328 } | 2306 } |
| 2329 | 2307 |
| 2330 /** | 2308 /** |
| 2331 * Initialize a newly created member of a class. | 2309 * Initialize a newly created member of a class. |
| 2332 * @param comment the documentation comment associated with this member | 2310 * @param comment the documentation comment associated with this member |
| 2333 * @param metadata the annotations associated with this member | 2311 * @param metadata the annotations associated with this member |
| 2334 */ | 2312 */ |
| 2335 ClassMember({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); | 2313 ClassMember({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); |
| 2336 } | 2314 } |
| 2337 | |
| 2338 /** | 2315 /** |
| 2339 * Instances of the class {@code ClassTypeAlias} represent a class type alias. | 2316 * Instances of the class {@code ClassTypeAlias} represent a class type alias. |
| 2340 * <pre> | 2317 * <pre> |
| 2341 * classTypeAlias ::={@link SimpleIdentifier identifier} {@link TypeParameterLis
t typeParameters}? '=' 'abstract'? mixinApplication | 2318 * classTypeAlias ::={@link SimpleIdentifier identifier} {@link TypeParameterLis
t typeParameters}? '=' 'abstract'? mixinApplication |
| 2342 * mixinApplication ::={@link TypeName superclass} {@link WithClause withClause}
{@link ImplementsClause implementsClause}? ';' | 2319 * mixinApplication ::={@link TypeName superclass} {@link WithClause withClause}
{@link ImplementsClause implementsClause}? ';' |
| 2343 * </pre> | 2320 * </pre> |
| 2344 * @coverage dart.engine.ast | 2321 * @coverage dart.engine.ast |
| 2345 */ | 2322 */ |
| 2346 class ClassTypeAlias extends TypeAlias { | 2323 class ClassTypeAlias extends TypeAlias { |
| 2347 | 2324 |
| 2348 /** | 2325 /** |
| 2349 * The name of the class being declared. | 2326 * The name of the class being declared. |
| 2350 */ | 2327 */ |
| 2351 SimpleIdentifier _name; | 2328 SimpleIdentifier _name; |
| 2352 | 2329 |
| 2353 /** | 2330 /** |
| 2354 * The type parameters for the class, or {@code null} if the class does not ha
ve any type | 2331 * The type parameters for the class, or {@code null} if the class does not ha
ve any type |
| 2355 * parameters. | 2332 * parameters. |
| 2356 */ | 2333 */ |
| 2357 TypeParameterList _typeParameters; | 2334 TypeParameterList _typeParameters; |
| 2358 | 2335 |
| 2359 /** | 2336 /** |
| 2360 * The token for the '=' separating the name from the definition. | 2337 * The token for the '=' separating the name from the definition. |
| 2361 */ | 2338 */ |
| 2362 Token _equals; | 2339 Token _equals; |
| 2363 | 2340 |
| 2364 /** | 2341 /** |
| 2365 * The token for the 'abstract' keyword, or {@code null} if this is not defini
ng an abstract | 2342 * The token for the 'abstract' keyword, or {@code null} if this is not defini
ng an abstract |
| 2366 * class. | 2343 * class. |
| 2367 */ | 2344 */ |
| 2368 Token _abstractKeyword; | 2345 Token _abstractKeyword; |
| 2369 | 2346 |
| 2370 /** | 2347 /** |
| 2371 * The name of the superclass of the class being declared. | 2348 * The name of the superclass of the class being declared. |
| 2372 */ | 2349 */ |
| 2373 TypeName _superclass; | 2350 TypeName _superclass; |
| 2374 | 2351 |
| 2375 /** | 2352 /** |
| 2376 * The with clause for this class. | 2353 * The with clause for this class. |
| 2377 */ | 2354 */ |
| 2378 WithClause _withClause; | 2355 WithClause _withClause; |
| 2379 | 2356 |
| 2380 /** | 2357 /** |
| 2381 * The implements clause for this class, or {@code null} if there is no implem
ents clause. | 2358 * The implements clause for this class, or {@code null} if there is no implem
ents clause. |
| 2382 */ | 2359 */ |
| 2383 ImplementsClause _implementsClause; | 2360 ImplementsClause _implementsClause; |
| 2384 | 2361 |
| 2385 /** | 2362 /** |
| 2386 * Initialize a newly created class type alias. | 2363 * Initialize a newly created class type alias. |
| 2387 * @param comment the documentation comment associated with this type alias | 2364 * @param comment the documentation comment associated with this type alias |
| 2388 * @param metadata the annotations associated with this type alias | 2365 * @param metadata the annotations associated with this type alias |
| 2389 * @param keyword the token representing the 'typedef' keyword | 2366 * @param keyword the token representing the 'typedef' keyword |
| 2390 * @param name the name of the class being declared | 2367 * @param name the name of the class being declared |
| 2391 * @param typeParameters the type parameters for the class | 2368 * @param typeParameters the type parameters for the class |
| 2392 * @param equals the token for the '=' separating the name from the definition | 2369 * @param equals the token for the '=' separating the name from the definition |
| 2393 * @param abstractKeyword the token for the 'abstract' keyword | 2370 * @param abstractKeyword the token for the 'abstract' keyword |
| 2394 * @param superclass the name of the superclass of the class being declared | 2371 * @param superclass the name of the superclass of the class being declared |
| 2395 * @param withClause the with clause for this class | 2372 * @param withClause the with clause for this class |
| 2396 * @param implementsClause the implements clause for this class | 2373 * @param implementsClause the implements clause for this class |
| 2397 * @param semicolon the semicolon terminating the declaration | 2374 * @param semicolon the semicolon terminating the declaration |
| 2398 */ | 2375 */ |
| 2399 ClassTypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword,
SimpleIdentifier name, TypeParameterList typeParameters, Token equals, Token ab
stractKeyword, TypeName superclass, WithClause withClause, ImplementsClause impl
ementsClause, Token semicolon) : super.full(comment, metadata, keyword, semicolo
n) { | 2376 ClassTypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword,
SimpleIdentifier name, TypeParameterList typeParameters, Token equals, Token ab
stractKeyword, TypeName superclass, WithClause withClause, ImplementsClause impl
ementsClause, Token semicolon) : super.full(comment, metadata, keyword, semicolo
n) { |
| 2400 this._name = becomeParentOf(name); | 2377 this._name = becomeParentOf(name); |
| 2401 this._typeParameters = becomeParentOf(typeParameters); | 2378 this._typeParameters = becomeParentOf(typeParameters); |
| 2402 this._equals = equals; | 2379 this._equals = equals; |
| 2403 this._abstractKeyword = abstractKeyword; | 2380 this._abstractKeyword = abstractKeyword; |
| 2404 this._superclass = becomeParentOf(superclass); | 2381 this._superclass = becomeParentOf(superclass); |
| 2405 this._withClause = becomeParentOf(withClause); | 2382 this._withClause = becomeParentOf(withClause); |
| 2406 this._implementsClause = becomeParentOf(implementsClause); | 2383 this._implementsClause = becomeParentOf(implementsClause); |
| 2407 } | 2384 } |
| 2408 | 2385 |
| 2409 /** | 2386 /** |
| 2410 * Initialize a newly created class type alias. | 2387 * Initialize a newly created class type alias. |
| 2411 * @param comment the documentation comment associated with this type alias | 2388 * @param comment the documentation comment associated with this type alias |
| 2412 * @param metadata the annotations associated with this type alias | 2389 * @param metadata the annotations associated with this type alias |
| 2413 * @param keyword the token representing the 'typedef' keyword | 2390 * @param keyword the token representing the 'typedef' keyword |
| 2414 * @param name the name of the class being declared | 2391 * @param name the name of the class being declared |
| 2415 * @param typeParameters the type parameters for the class | 2392 * @param typeParameters the type parameters for the class |
| 2416 * @param equals the token for the '=' separating the name from the definition | 2393 * @param equals the token for the '=' separating the name from the definition |
| 2417 * @param abstractKeyword the token for the 'abstract' keyword | 2394 * @param abstractKeyword the token for the 'abstract' keyword |
| 2418 * @param superclass the name of the superclass of the class being declared | 2395 * @param superclass the name of the superclass of the class being declared |
| 2419 * @param withClause the with clause for this class | 2396 * @param withClause the with clause for this class |
| 2420 * @param implementsClause the implements clause for this class | 2397 * @param implementsClause the implements clause for this class |
| 2421 * @param semicolon the semicolon terminating the declaration | 2398 * @param semicolon the semicolon terminating the declaration |
| 2422 */ | 2399 */ |
| 2423 ClassTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Sim
pleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstra
ctKeyword, TypeName superclass, WithClause withClause, ImplementsClause implemen
tsClause, Token semicolon}) : this.full(comment, metadata, keyword, name, typePa
rameters, equals, abstractKeyword, superclass, withClause, implementsClause, sem
icolon); | 2400 ClassTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Sim
pleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstra
ctKeyword, TypeName superclass, WithClause withClause, ImplementsClause implemen
tsClause, Token semicolon}) : this.full(comment, metadata, keyword, name, typePa
rameters, equals, abstractKeyword, superclass, withClause, implementsClause, sem
icolon); |
| 2424 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); | 2401 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); |
| 2425 | 2402 |
| 2426 /** | 2403 /** |
| 2427 * Return the token for the 'abstract' keyword, or {@code null} if this is not
defining an | 2404 * Return the token for the 'abstract' keyword, or {@code null} if this is not
defining an |
| 2428 * abstract class. | 2405 * abstract class. |
| 2429 * @return the token for the 'abstract' keyword | 2406 * @return the token for the 'abstract' keyword |
| 2430 */ | 2407 */ |
| 2431 Token get abstractKeyword => _abstractKeyword; | 2408 Token get abstractKeyword => _abstractKeyword; |
| 2432 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; | 2409 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; |
| 2433 | 2410 |
| 2434 /** | 2411 /** |
| 2435 * Return the token for the '=' separating the name from the definition. | 2412 * Return the token for the '=' separating the name from the definition. |
| 2436 * @return the token for the '=' separating the name from the definition | 2413 * @return the token for the '=' separating the name from the definition |
| 2437 */ | 2414 */ |
| 2438 Token get equals => _equals; | 2415 Token get equals => _equals; |
| 2439 | 2416 |
| 2440 /** | 2417 /** |
| 2441 * Return the implements clause for this class, or {@code null} if there is no
implements clause. | 2418 * Return the implements clause for this class, or {@code null} if there is no
implements clause. |
| 2442 * @return the implements clause for this class | 2419 * @return the implements clause for this class |
| 2443 */ | 2420 */ |
| 2444 ImplementsClause get implementsClause => _implementsClause; | 2421 ImplementsClause get implementsClause => _implementsClause; |
| 2445 | 2422 |
| 2446 /** | 2423 /** |
| 2447 * Return the name of the class being declared. | 2424 * Return the name of the class being declared. |
| 2448 * @return the name of the class being declared | 2425 * @return the name of the class being declared |
| 2449 */ | 2426 */ |
| 2450 SimpleIdentifier get name => _name; | 2427 SimpleIdentifier get name => _name; |
| 2451 | 2428 |
| 2452 /** | 2429 /** |
| 2453 * Return the name of the superclass of the class being declared. | 2430 * Return the name of the superclass of the class being declared. |
| 2454 * @return the name of the superclass of the class being declared | 2431 * @return the name of the superclass of the class being declared |
| 2455 */ | 2432 */ |
| 2456 TypeName get superclass => _superclass; | 2433 TypeName get superclass => _superclass; |
| 2457 | 2434 |
| 2458 /** | 2435 /** |
| 2459 * Return the type parameters for the class, or {@code null} if the class does
not have any type | 2436 * Return the type parameters for the class, or {@code null} if the class does
not have any type |
| 2460 * parameters. | 2437 * parameters. |
| 2461 * @return the type parameters for the class | 2438 * @return the type parameters for the class |
| 2462 */ | 2439 */ |
| 2463 TypeParameterList get typeParameters => _typeParameters; | 2440 TypeParameterList get typeParameters => _typeParameters; |
| 2464 | 2441 |
| 2465 /** | 2442 /** |
| 2466 * Return the with clause for this class. | 2443 * Return the with clause for this class. |
| 2467 * @return the with clause for this class | 2444 * @return the with clause for this class |
| 2468 */ | 2445 */ |
| 2469 WithClause get withClause => _withClause; | 2446 WithClause get withClause => _withClause; |
| 2470 | 2447 |
| 2471 /** | 2448 /** |
| 2472 * Set the token for the 'abstract' keyword to the given token. | 2449 * Set the token for the 'abstract' keyword to the given token. |
| 2473 * @param abstractKeyword the token for the 'abstract' keyword | 2450 * @param abstractKeyword the token for the 'abstract' keyword |
| 2474 */ | 2451 */ |
| 2475 void set abstractKeyword(Token abstractKeyword2) { | 2452 void set abstractKeyword(Token abstractKeyword2) { |
| 2476 this._abstractKeyword = abstractKeyword2; | 2453 this._abstractKeyword = abstractKeyword2; |
| 2477 } | 2454 } |
| 2478 | 2455 |
| 2479 /** | 2456 /** |
| 2480 * Set the token for the '=' separating the name from the definition to the gi
ven token. | 2457 * Set the token for the '=' separating the name from the definition to the gi
ven token. |
| 2481 * @param equals the token for the '=' separating the name from the definition | 2458 * @param equals the token for the '=' separating the name from the definition |
| 2482 */ | 2459 */ |
| 2483 void set equals(Token equals2) { | 2460 void set equals(Token equals2) { |
| 2484 this._equals = equals2; | 2461 this._equals = equals2; |
| 2485 } | 2462 } |
| 2486 | 2463 |
| 2487 /** | 2464 /** |
| 2488 * Set the implements clause for this class to the given implements clause. | 2465 * Set the implements clause for this class to the given implements clause. |
| 2489 * @param implementsClause the implements clause for this class | 2466 * @param implementsClause the implements clause for this class |
| 2490 */ | 2467 */ |
| 2491 void set implementsClause(ImplementsClause implementsClause2) { | 2468 void set implementsClause(ImplementsClause implementsClause2) { |
| 2492 this._implementsClause = becomeParentOf(implementsClause2); | 2469 this._implementsClause = becomeParentOf(implementsClause2); |
| 2493 } | 2470 } |
| 2494 | 2471 |
| 2495 /** | 2472 /** |
| 2496 * Set the name of the class being declared to the given identifier. | 2473 * Set the name of the class being declared to the given identifier. |
| 2497 * @param name the name of the class being declared | 2474 * @param name the name of the class being declared |
| 2498 */ | 2475 */ |
| 2499 void set name(SimpleIdentifier name2) { | 2476 void set name(SimpleIdentifier name2) { |
| 2500 this._name = becomeParentOf(name2); | 2477 this._name = becomeParentOf(name2); |
| 2501 } | 2478 } |
| 2502 | 2479 |
| 2503 /** | 2480 /** |
| 2504 * Set the name of the superclass of the class being declared to the given nam
e. | 2481 * Set the name of the superclass of the class being declared to the given nam
e. |
| 2505 * @param superclass the name of the superclass of the class being declared | 2482 * @param superclass the name of the superclass of the class being declared |
| 2506 */ | 2483 */ |
| 2507 void set superclass(TypeName superclass2) { | 2484 void set superclass(TypeName superclass2) { |
| 2508 this._superclass = becomeParentOf(superclass2); | 2485 this._superclass = becomeParentOf(superclass2); |
| 2509 } | 2486 } |
| 2510 | 2487 |
| 2511 /** | 2488 /** |
| 2512 * Set the type parameters for the class to the given list of parameters. | 2489 * Set the type parameters for the class to the given list of parameters. |
| 2513 * @param typeParameters the type parameters for the class | 2490 * @param typeParameters the type parameters for the class |
| 2514 */ | 2491 */ |
| 2515 void set typeParameters(TypeParameterList typeParameters2) { | 2492 void set typeParameters(TypeParameterList typeParameters2) { |
| 2516 this._typeParameters = becomeParentOf(typeParameters2); | 2493 this._typeParameters = becomeParentOf(typeParameters2); |
| 2517 } | 2494 } |
| 2518 | 2495 |
| 2519 /** | 2496 /** |
| 2520 * Set the with clause for this class to the given with clause. | 2497 * Set the with clause for this class to the given with clause. |
| 2521 * @param withClause the with clause for this class | 2498 * @param withClause the with clause for this class |
| 2522 */ | 2499 */ |
| 2523 void set withClause(WithClause withClause2) { | 2500 void set withClause(WithClause withClause2) { |
| 2524 this._withClause = becomeParentOf(withClause2); | 2501 this._withClause = becomeParentOf(withClause2); |
| 2525 } | 2502 } |
| 2526 void visitChildren(ASTVisitor<Object> visitor) { | 2503 void visitChildren(ASTVisitor<Object> visitor) { |
| 2527 super.visitChildren(visitor); | 2504 super.visitChildren(visitor); |
| 2528 safelyVisitChild(_name, visitor); | 2505 safelyVisitChild(_name, visitor); |
| 2529 safelyVisitChild(_typeParameters, visitor); | 2506 safelyVisitChild(_typeParameters, visitor); |
| 2530 safelyVisitChild(_superclass, visitor); | 2507 safelyVisitChild(_superclass, visitor); |
| 2531 safelyVisitChild(_withClause, visitor); | 2508 safelyVisitChild(_withClause, visitor); |
| 2532 safelyVisitChild(_implementsClause, visitor); | 2509 safelyVisitChild(_implementsClause, visitor); |
| 2533 } | 2510 } |
| 2534 } | 2511 } |
| 2535 | |
| 2536 /** | 2512 /** |
| 2537 * Instances of the class {@code Combinator} represent the combinator associated
with an import | 2513 * Instances of the class {@code Combinator} represent the combinator associated
with an import |
| 2538 * directive. | 2514 * directive. |
| 2539 * <pre> | 2515 * <pre> |
| 2540 * combinator ::={@link HideCombinator hideCombinator}| {@link ShowCombinator sh
owCombinator}</pre> | 2516 * combinator ::={@link HideCombinator hideCombinator}| {@link ShowCombinator sh
owCombinator}</pre> |
| 2541 * @coverage dart.engine.ast | 2517 * @coverage dart.engine.ast |
| 2542 */ | 2518 */ |
| 2543 abstract class Combinator extends ASTNode { | 2519 abstract class Combinator extends ASTNode { |
| 2544 | 2520 |
| 2545 /** | 2521 /** |
| 2546 * The keyword specifying what kind of processing is to be done on the importe
d names. | 2522 * The keyword specifying what kind of processing is to be done on the importe
d names. |
| 2547 */ | 2523 */ |
| 2548 Token _keyword; | 2524 Token _keyword; |
| 2549 | 2525 |
| 2550 /** | 2526 /** |
| 2551 * Initialize a newly created import combinator. | 2527 * Initialize a newly created import combinator. |
| 2552 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2528 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
| 2553 * names | 2529 * names |
| 2554 */ | 2530 */ |
| 2555 Combinator.full(Token keyword) { | 2531 Combinator.full(Token keyword) { |
| 2556 this._keyword = keyword; | 2532 this._keyword = keyword; |
| 2557 } | 2533 } |
| 2558 | 2534 |
| 2559 /** | 2535 /** |
| 2560 * Initialize a newly created import combinator. | 2536 * Initialize a newly created import combinator. |
| 2561 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2537 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
| 2562 * names | 2538 * names |
| 2563 */ | 2539 */ |
| 2564 Combinator({Token keyword}) : this.full(keyword); | 2540 Combinator({Token keyword}) : this.full(keyword); |
| 2565 Token get beginToken => _keyword; | 2541 Token get beginToken => _keyword; |
| 2566 | 2542 |
| 2567 /** | 2543 /** |
| 2568 * Return the keyword specifying what kind of processing is to be done on the
imported names. | 2544 * Return the keyword specifying what kind of processing is to be done on the
imported names. |
| 2569 * @return the keyword specifying what kind of processing is to be done on the
imported names | 2545 * @return the keyword specifying what kind of processing is to be done on the
imported names |
| 2570 */ | 2546 */ |
| 2571 Token get keyword => _keyword; | 2547 Token get keyword => _keyword; |
| 2572 | 2548 |
| 2573 /** | 2549 /** |
| 2574 * Set the keyword specifying what kind of processing is to be done on the imp
orted names to the | 2550 * Set the keyword specifying what kind of processing is to be done on the imp
orted names to the |
| 2575 * given token. | 2551 * given token. |
| 2576 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2552 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
| 2577 * names | 2553 * names |
| 2578 */ | 2554 */ |
| 2579 void set keyword(Token keyword2) { | 2555 void set keyword(Token keyword2) { |
| 2580 this._keyword = keyword2; | 2556 this._keyword = keyword2; |
| 2581 } | 2557 } |
| 2582 } | 2558 } |
| 2583 | |
| 2584 /** | 2559 /** |
| 2585 * Instances of the class {@code Comment} represent a comment within the source
code. | 2560 * Instances of the class {@code Comment} represent a comment within the source
code. |
| 2586 * <pre> | 2561 * <pre> |
| 2587 * comment ::= | 2562 * comment ::= |
| 2588 * endOfLineComment | 2563 * endOfLineComment |
| 2589 * | blockComment | 2564 * | blockComment |
| 2590 * | documentationComment | 2565 * | documentationComment |
| 2591 * endOfLineComment ::= | 2566 * endOfLineComment ::= |
| 2592 * '//' (CHARACTER - EOL)* EOL | 2567 * '//' (CHARACTER - EOL)* EOL |
| 2593 * blockComment ::= | 2568 * blockComment ::= |
| 2594 * '/ *' CHARACTER* '*/' | 2569 * '/ *' CHARACTER* '*/' |
| 2595 * documentationComment ::= | 2570 * documentationComment ::= |
| 2596 * '/ **' (CHARACTER | {@link CommentReference commentReference})* '*/' | 2571 * '/ **' (CHARACTER | {@link CommentReference commentReference})* '*/' |
| 2597 * | ('///' (CHARACTER - EOL)* EOL)+ | 2572 * | ('///' (CHARACTER - EOL)* EOL)+ |
| 2598 * </pre> | 2573 * </pre> |
| 2599 * @coverage dart.engine.ast | 2574 * @coverage dart.engine.ast |
| 2600 */ | 2575 */ |
| 2601 class Comment extends ASTNode { | 2576 class Comment extends ASTNode { |
| 2602 | 2577 |
| 2603 /** | 2578 /** |
| 2604 * Create a block comment. | 2579 * Create a block comment. |
| 2605 * @param tokens the tokens representing the comment | 2580 * @param tokens the tokens representing the comment |
| 2606 * @return the block comment that was created | 2581 * @return the block comment that was created |
| 2607 */ | 2582 */ |
| 2608 static Comment createBlockComment(List<Token> tokens) => new Comment.full(toke
ns, CommentType.BLOCK, null); | 2583 static Comment createBlockComment(List<Token> tokens) => new Comment.full(toke
ns, CommentType.BLOCK, null); |
| 2609 | 2584 |
| 2610 /** | 2585 /** |
| 2611 * Create a documentation comment. | 2586 * Create a documentation comment. |
| 2612 * @param tokens the tokens representing the comment | 2587 * @param tokens the tokens representing the comment |
| 2613 * @return the documentation comment that was created | 2588 * @return the documentation comment that was created |
| 2614 */ | 2589 */ |
| 2615 static Comment createDocumentationComment(List<Token> tokens) => new Comment.f
ull(tokens, CommentType.DOCUMENTATION, new List<CommentReference>()); | 2590 static Comment createDocumentationComment(List<Token> tokens) => new Comment.f
ull(tokens, CommentType.DOCUMENTATION, new List<CommentReference>()); |
| 2616 | 2591 |
| 2617 /** | 2592 /** |
| 2618 * Create a documentation comment. | 2593 * Create a documentation comment. |
| 2619 * @param tokens the tokens representing the comment | 2594 * @param tokens the tokens representing the comment |
| 2620 * @param references the references embedded within the documentation comment | 2595 * @param references the references embedded within the documentation comment |
| 2621 * @return the documentation comment that was created | 2596 * @return the documentation comment that was created |
| 2622 */ | 2597 */ |
| 2623 static Comment createDocumentationComment2(List<Token> tokens, List<CommentRef
erence> references) => new Comment.full(tokens, CommentType.DOCUMENTATION, refer
ences); | 2598 static Comment createDocumentationComment2(List<Token> tokens, List<CommentRef
erence> references) => new Comment.full(tokens, CommentType.DOCUMENTATION, refer
ences); |
| 2624 | 2599 |
| 2625 /** | 2600 /** |
| 2626 * Create an end-of-line comment. | 2601 * Create an end-of-line comment. |
| 2627 * @param tokens the tokens representing the comment | 2602 * @param tokens the tokens representing the comment |
| 2628 * @return the end-of-line comment that was created | 2603 * @return the end-of-line comment that was created |
| 2629 */ | 2604 */ |
| 2630 static Comment createEndOfLineComment(List<Token> tokens) => new Comment.full(
tokens, CommentType.END_OF_LINE, null); | 2605 static Comment createEndOfLineComment(List<Token> tokens) => new Comment.full(
tokens, CommentType.END_OF_LINE, null); |
| 2631 | 2606 |
| 2632 /** | 2607 /** |
| 2633 * The tokens representing the comment. | 2608 * The tokens representing the comment. |
| 2634 */ | 2609 */ |
| 2635 List<Token> _tokens; | 2610 List<Token> _tokens; |
| 2636 | 2611 |
| 2637 /** | 2612 /** |
| 2638 * The type of the comment. | 2613 * The type of the comment. |
| 2639 */ | 2614 */ |
| 2640 CommentType _type; | 2615 CommentType _type; |
| 2641 | 2616 |
| 2642 /** | 2617 /** |
| 2643 * The references embedded within the documentation comment. This list will be
empty unless this | 2618 * The references embedded within the documentation comment. This list will be
empty unless this |
| 2644 * is a documentation comment that has references embedded within it. | 2619 * is a documentation comment that has references embedded within it. |
| 2645 */ | 2620 */ |
| 2646 NodeList<CommentReference> _references; | 2621 NodeList<CommentReference> _references; |
| 2647 | 2622 |
| 2648 /** | 2623 /** |
| 2649 * Initialize a newly created comment. | 2624 * Initialize a newly created comment. |
| 2650 * @param tokens the tokens representing the comment | 2625 * @param tokens the tokens representing the comment |
| 2651 * @param type the type of the comment | 2626 * @param type the type of the comment |
| 2652 * @param references the references embedded within the documentation comment | 2627 * @param references the references embedded within the documentation comment |
| 2653 */ | 2628 */ |
| 2654 Comment.full(List<Token> tokens, CommentType type, List<CommentReference> refe
rences) { | 2629 Comment.full(List<Token> tokens, CommentType type, List<CommentReference> refe
rences) { |
| 2655 this._references = new NodeList<CommentReference>(this); | 2630 this._references = new NodeList<CommentReference>(this); |
| 2656 this._tokens = tokens; | 2631 this._tokens = tokens; |
| 2657 this._type = type; | 2632 this._type = type; |
| 2658 this._references.addAll(references); | 2633 this._references.addAll(references); |
| 2659 } | 2634 } |
| 2660 | 2635 |
| 2661 /** | 2636 /** |
| 2662 * Initialize a newly created comment. | 2637 * Initialize a newly created comment. |
| 2663 * @param tokens the tokens representing the comment | 2638 * @param tokens the tokens representing the comment |
| 2664 * @param type the type of the comment | 2639 * @param type the type of the comment |
| 2665 * @param references the references embedded within the documentation comment | 2640 * @param references the references embedded within the documentation comment |
| 2666 */ | 2641 */ |
| 2667 Comment({List<Token> tokens, CommentType type, List<CommentReference> referenc
es}) : this.full(tokens, type, references); | 2642 Comment({List<Token> tokens, CommentType type, List<CommentReference> referenc
es}) : this.full(tokens, type, references); |
| 2668 accept(ASTVisitor visitor) => visitor.visitComment(this); | 2643 accept(ASTVisitor visitor) => visitor.visitComment(this); |
| 2669 Token get beginToken => _tokens[0]; | 2644 Token get beginToken => _tokens[0]; |
| 2670 Token get endToken => _tokens[_tokens.length - 1]; | 2645 Token get endToken => _tokens[_tokens.length - 1]; |
| 2671 | 2646 |
| 2672 /** | 2647 /** |
| 2673 * Return the references embedded within the documentation comment. | 2648 * Return the references embedded within the documentation comment. |
| 2674 * @return the references embedded within the documentation comment | 2649 * @return the references embedded within the documentation comment |
| 2675 */ | 2650 */ |
| 2676 NodeList<CommentReference> get references => _references; | 2651 NodeList<CommentReference> get references => _references; |
| 2677 | 2652 |
| 2678 /** | 2653 /** |
| 2679 * Return the tokens representing the comment. | 2654 * Return the tokens representing the comment. |
| 2680 * @return the tokens representing the comment | 2655 * @return the tokens representing the comment |
| 2681 */ | 2656 */ |
| 2682 List<Token> get tokens => _tokens; | 2657 List<Token> get tokens => _tokens; |
| 2683 | 2658 |
| 2684 /** | 2659 /** |
| 2685 * Return {@code true} if this is a block comment. | 2660 * Return {@code true} if this is a block comment. |
| 2686 * @return {@code true} if this is a block comment | 2661 * @return {@code true} if this is a block comment |
| 2687 */ | 2662 */ |
| 2688 bool isBlock() => identical(_type, CommentType.BLOCK); | 2663 bool isBlock() => identical(_type, CommentType.BLOCK); |
| 2689 | 2664 |
| 2690 /** | 2665 /** |
| 2691 * Return {@code true} if this is a documentation comment. | 2666 * Return {@code true} if this is a documentation comment. |
| 2692 * @return {@code true} if this is a documentation comment | 2667 * @return {@code true} if this is a documentation comment |
| 2693 */ | 2668 */ |
| 2694 bool isDocumentation() => identical(_type, CommentType.DOCUMENTATION); | 2669 bool isDocumentation() => identical(_type, CommentType.DOCUMENTATION); |
| 2695 | 2670 |
| 2696 /** | 2671 /** |
| 2697 * Return {@code true} if this is an end-of-line comment. | 2672 * Return {@code true} if this is an end-of-line comment. |
| 2698 * @return {@code true} if this is an end-of-line comment | 2673 * @return {@code true} if this is an end-of-line comment |
| 2699 */ | 2674 */ |
| 2700 bool isEndOfLine() => identical(_type, CommentType.END_OF_LINE); | 2675 bool isEndOfLine() => identical(_type, CommentType.END_OF_LINE); |
| 2701 void visitChildren(ASTVisitor<Object> visitor) { | 2676 void visitChildren(ASTVisitor<Object> visitor) { |
| 2702 _references.accept(visitor); | 2677 _references.accept(visitor); |
| 2703 } | 2678 } |
| 2704 } | 2679 } |
| 2705 | |
| 2706 /** | 2680 /** |
| 2707 * The enumeration {@code CommentType} encodes all the different types of commen
ts that are | 2681 * The enumeration {@code CommentType} encodes all the different types of commen
ts that are |
| 2708 * recognized by the parser. | 2682 * recognized by the parser. |
| 2709 */ | 2683 */ |
| 2710 class CommentType implements Comparable<CommentType> { | 2684 class CommentType implements Comparable<CommentType> { |
| 2711 | 2685 |
| 2712 /** | 2686 /** |
| 2713 * An end-of-line comment. | 2687 * An end-of-line comment. |
| 2714 */ | 2688 */ |
| 2715 static final CommentType END_OF_LINE = new CommentType('END_OF_LINE', 0); | 2689 static final CommentType END_OF_LINE = new CommentType('END_OF_LINE', 0); |
| 2716 | 2690 |
| 2717 /** | 2691 /** |
| 2718 * A block comment. | 2692 * A block comment. |
| 2719 */ | 2693 */ |
| 2720 static final CommentType BLOCK = new CommentType('BLOCK', 1); | 2694 static final CommentType BLOCK = new CommentType('BLOCK', 1); |
| 2721 | 2695 |
| 2722 /** | 2696 /** |
| 2723 * A documentation comment. | 2697 * A documentation comment. |
| 2724 */ | 2698 */ |
| 2725 static final CommentType DOCUMENTATION = new CommentType('DOCUMENTATION', 2); | 2699 static final CommentType DOCUMENTATION = new CommentType('DOCUMENTATION', 2); |
| 2726 static final List<CommentType> values = [END_OF_LINE, BLOCK, DOCUMENTATION]; | 2700 static final List<CommentType> values = [END_OF_LINE, BLOCK, DOCUMENTATION]; |
| 2727 | 2701 |
| 2728 /// The name of this enum constant, as declared in the enum declaration. | 2702 /// The name of this enum constant, as declared in the enum declaration. |
| 2729 final String name; | 2703 final String name; |
| 2730 | 2704 |
| 2731 /// The position in the enum declaration. | 2705 /// The position in the enum declaration. |
| 2732 final int ordinal; | 2706 final int ordinal; |
| 2733 CommentType(this.name, this.ordinal) { | 2707 CommentType(this.name, this.ordinal) { |
| 2734 } | 2708 } |
| 2735 int compareTo(CommentType other) => ordinal - other.ordinal; | 2709 int compareTo(CommentType other) => ordinal - other.ordinal; |
| 2736 String toString() => name; | 2710 String toString() => name; |
| 2737 } | 2711 } |
| 2738 | |
| 2739 /** | 2712 /** |
| 2740 * Instances of the class {@code CommentReference} represent a reference to a Da
rt element that is | 2713 * Instances of the class {@code CommentReference} represent a reference to a Da
rt element that is |
| 2741 * found within a documentation comment. | 2714 * found within a documentation comment. |
| 2742 * <pre> | 2715 * <pre> |
| 2743 * commentReference ::= | 2716 * commentReference ::= |
| 2744 * '\[' 'new'? {@link Identifier identifier} '\]' | 2717 * '\[' 'new'? {@link Identifier identifier} '\]' |
| 2745 * </pre> | 2718 * </pre> |
| 2746 * @coverage dart.engine.ast | 2719 * @coverage dart.engine.ast |
| 2747 */ | 2720 */ |
| 2748 class CommentReference extends ASTNode { | 2721 class CommentReference extends ASTNode { |
| 2749 | 2722 |
| 2750 /** | 2723 /** |
| 2751 * The token representing the 'new' keyword, or {@code null} if there was no '
new' keyword. | 2724 * The token representing the 'new' keyword, or {@code null} if there was no '
new' keyword. |
| 2752 */ | 2725 */ |
| 2753 Token _newKeyword; | 2726 Token _newKeyword; |
| 2754 | 2727 |
| 2755 /** | 2728 /** |
| 2756 * The identifier being referenced. | 2729 * The identifier being referenced. |
| 2757 */ | 2730 */ |
| 2758 Identifier _identifier; | 2731 Identifier _identifier; |
| 2759 | 2732 |
| 2760 /** | 2733 /** |
| 2761 * Initialize a newly created reference to a Dart element. | 2734 * Initialize a newly created reference to a Dart element. |
| 2762 * @param newKeyword the token representing the 'new' keyword | 2735 * @param newKeyword the token representing the 'new' keyword |
| 2763 * @param identifier the identifier being referenced | 2736 * @param identifier the identifier being referenced |
| 2764 */ | 2737 */ |
| 2765 CommentReference.full(Token newKeyword, Identifier identifier) { | 2738 CommentReference.full(Token newKeyword, Identifier identifier) { |
| 2766 this._newKeyword = newKeyword; | 2739 this._newKeyword = newKeyword; |
| 2767 this._identifier = becomeParentOf(identifier); | 2740 this._identifier = becomeParentOf(identifier); |
| 2768 } | 2741 } |
| 2769 | 2742 |
| 2770 /** | 2743 /** |
| 2771 * Initialize a newly created reference to a Dart element. | 2744 * Initialize a newly created reference to a Dart element. |
| 2772 * @param newKeyword the token representing the 'new' keyword | 2745 * @param newKeyword the token representing the 'new' keyword |
| 2773 * @param identifier the identifier being referenced | 2746 * @param identifier the identifier being referenced |
| 2774 */ | 2747 */ |
| 2775 CommentReference({Token newKeyword, Identifier identifier}) : this.full(newKey
word, identifier); | 2748 CommentReference({Token newKeyword, Identifier identifier}) : this.full(newKey
word, identifier); |
| 2776 accept(ASTVisitor visitor) => visitor.visitCommentReference(this); | 2749 accept(ASTVisitor visitor) => visitor.visitCommentReference(this); |
| 2777 Token get beginToken => _identifier.beginToken; | 2750 Token get beginToken => _identifier.beginToken; |
| 2778 Token get endToken => _identifier.endToken; | 2751 Token get endToken => _identifier.endToken; |
| 2779 | 2752 |
| 2780 /** | 2753 /** |
| 2781 * Return the identifier being referenced. | 2754 * Return the identifier being referenced. |
| 2782 * @return the identifier being referenced | 2755 * @return the identifier being referenced |
| 2783 */ | 2756 */ |
| 2784 Identifier get identifier => _identifier; | 2757 Identifier get identifier => _identifier; |
| 2785 | 2758 |
| 2786 /** | 2759 /** |
| 2787 * Return the token representing the 'new' keyword, or {@code null} if there w
as no 'new' keyword. | 2760 * Return the token representing the 'new' keyword, or {@code null} if there w
as no 'new' keyword. |
| 2788 * @return the token representing the 'new' keyword | 2761 * @return the token representing the 'new' keyword |
| 2789 */ | 2762 */ |
| 2790 Token get newKeyword => _newKeyword; | 2763 Token get newKeyword => _newKeyword; |
| 2791 | 2764 |
| 2792 /** | 2765 /** |
| 2793 * Set the identifier being referenced to the given identifier. | 2766 * Set the identifier being referenced to the given identifier. |
| 2794 * @param identifier the identifier being referenced | 2767 * @param identifier the identifier being referenced |
| 2795 */ | 2768 */ |
| 2796 void set identifier(Identifier identifier2) { | 2769 void set identifier(Identifier identifier2) { |
| 2797 identifier2 = becomeParentOf(identifier2); | 2770 identifier2 = becomeParentOf(identifier2); |
| 2798 } | 2771 } |
| 2799 | 2772 |
| 2800 /** | 2773 /** |
| 2801 * Set the token representing the 'new' keyword to the given token. | 2774 * Set the token representing the 'new' keyword to the given token. |
| 2802 * @param newKeyword the token representing the 'new' keyword | 2775 * @param newKeyword the token representing the 'new' keyword |
| 2803 */ | 2776 */ |
| 2804 void set newKeyword(Token newKeyword2) { | 2777 void set newKeyword(Token newKeyword2) { |
| 2805 this._newKeyword = newKeyword2; | 2778 this._newKeyword = newKeyword2; |
| 2806 } | 2779 } |
| 2807 void visitChildren(ASTVisitor<Object> visitor) { | 2780 void visitChildren(ASTVisitor<Object> visitor) { |
| 2808 safelyVisitChild(_identifier, visitor); | 2781 safelyVisitChild(_identifier, visitor); |
| 2809 } | 2782 } |
| 2810 } | 2783 } |
| 2811 | |
| 2812 /** | 2784 /** |
| 2813 * Instances of the class {@code CompilationUnit} represent a compilation unit. | 2785 * Instances of the class {@code CompilationUnit} represent a compilation unit. |
| 2814 * <p> | 2786 * <p> |
| 2815 * While the grammar restricts the order of the directives and declarations with
in a compilation | 2787 * While the grammar restricts the order of the directives and declarations with
in a compilation |
| 2816 * unit, this class does not enforce those restrictions. In particular, the chil
dren of a | 2788 * unit, this class does not enforce those restrictions. In particular, the chil
dren of a |
| 2817 * compilation unit will be visited in lexical order even if lexical order does
not conform to the | 2789 * compilation unit will be visited in lexical order even if lexical order does
not conform to the |
| 2818 * restrictions of the grammar. | 2790 * restrictions of the grammar. |
| 2819 * <pre> | 2791 * <pre> |
| 2820 * compilationUnit ::= | 2792 * compilationUnit ::= |
| 2821 * directives declarations | 2793 * directives declarations |
| 2822 * directives ::={@link ScriptTag scriptTag}? {@link LibraryDirective libraryDir
ective}? namespaceDirective* {@link PartDirective partDirective}| {@link PartOfD
irective partOfDirective}namespaceDirective ::={@link ImportDirective importDire
ctive}| {@link ExportDirective exportDirective}declarations ::={@link Compilatio
nUnitMember compilationUnitMember}</pre> | 2794 * directives ::={@link ScriptTag scriptTag}? {@link LibraryDirective libraryDir
ective}? namespaceDirective* {@link PartDirective partDirective}| {@link PartOfD
irective partOfDirective}namespaceDirective ::={@link ImportDirective importDire
ctive}| {@link ExportDirective exportDirective}declarations ::={@link Compilatio
nUnitMember compilationUnitMember}</pre> |
| 2823 * @coverage dart.engine.ast | 2795 * @coverage dart.engine.ast |
| 2824 */ | 2796 */ |
| 2825 class CompilationUnit extends ASTNode { | 2797 class CompilationUnit extends ASTNode { |
| 2826 | 2798 |
| 2827 /** | 2799 /** |
| 2828 * The first token in the token stream that was parsed to form this compilatio
n unit. | 2800 * The first token in the token stream that was parsed to form this compilatio
n unit. |
| 2829 */ | 2801 */ |
| 2830 Token _beginToken; | 2802 Token _beginToken; |
| 2831 | 2803 |
| 2832 /** | 2804 /** |
| 2833 * The script tag at the beginning of the compilation unit, or {@code null} if
there is no script | 2805 * The script tag at the beginning of the compilation unit, or {@code null} if
there is no script |
| 2834 * tag in this compilation unit. | 2806 * tag in this compilation unit. |
| 2835 */ | 2807 */ |
| 2836 ScriptTag _scriptTag; | 2808 ScriptTag _scriptTag; |
| 2837 | 2809 |
| 2838 /** | 2810 /** |
| 2839 * The directives contained in this compilation unit. | 2811 * The directives contained in this compilation unit. |
| 2840 */ | 2812 */ |
| 2841 NodeList<Directive> _directives; | 2813 NodeList<Directive> _directives; |
| 2842 | 2814 |
| 2843 /** | 2815 /** |
| 2844 * The declarations contained in this compilation unit. | 2816 * The declarations contained in this compilation unit. |
| 2845 */ | 2817 */ |
| 2846 NodeList<CompilationUnitMember> _declarations; | 2818 NodeList<CompilationUnitMember> _declarations; |
| 2847 | 2819 |
| 2848 /** | 2820 /** |
| 2849 * The last token in the token stream that was parsed to form this compilation
unit. This token | 2821 * The last token in the token stream that was parsed to form this compilation
unit. This token |
| 2850 * should always have a type of {@link TokenType.EOF}. | 2822 * should always have a type of {@link TokenType.EOF}. |
| 2851 */ | 2823 */ |
| 2852 Token _endToken; | 2824 Token _endToken; |
| 2853 | 2825 |
| 2854 /** | 2826 /** |
| 2855 * The element associated with this compilation unit, or {@code null} if the A
ST structure has not | 2827 * The element associated with this compilation unit, or {@code null} if the A
ST structure has not |
| 2856 * been resolved. | 2828 * been resolved. |
| 2857 */ | 2829 */ |
| 2858 CompilationUnitElement _element; | 2830 CompilationUnitElement _element; |
| 2859 | 2831 |
| 2860 /** | 2832 /** |
| 2861 * The {@link LineInfo} for this {@link CompilationUnit}. | 2833 * The {@link LineInfo} for this {@link CompilationUnit}. |
| 2862 */ | 2834 */ |
| 2863 LineInfo _lineInfo; | 2835 LineInfo _lineInfo; |
| 2864 | 2836 |
| 2865 /** | 2837 /** |
| 2866 * The parsing errors encountered when the receiver was parsed. | 2838 * The parsing errors encountered when the receiver was parsed. |
| 2867 */ | 2839 */ |
| 2868 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; | 2840 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; |
| 2869 | 2841 |
| 2870 /** | 2842 /** |
| 2871 * The resolution errors encountered when the receiver was resolved. | 2843 * The resolution errors encountered when the receiver was resolved. |
| 2872 */ | 2844 */ |
| 2873 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 2845 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2874 | 2846 |
| 2875 /** | 2847 /** |
| 2876 * Initialize a newly created compilation unit to have the given directives an
d declarations. | 2848 * Initialize a newly created compilation unit to have the given directives an
d declarations. |
| 2877 * @param beginToken the first token in the token stream | 2849 * @param beginToken the first token in the token stream |
| 2878 * @param scriptTag the script tag at the beginning of the compilation unit | 2850 * @param scriptTag the script tag at the beginning of the compilation unit |
| 2879 * @param directives the directives contained in this compilation unit | 2851 * @param directives the directives contained in this compilation unit |
| 2880 * @param declarations the declarations contained in this compilation unit | 2852 * @param declarations the declarations contained in this compilation unit |
| 2881 * @param endToken the last token in the token stream | 2853 * @param endToken the last token in the token stream |
| 2882 */ | 2854 */ |
| 2883 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di
rectives, List<CompilationUnitMember> declarations, Token endToken) { | 2855 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di
rectives, List<CompilationUnitMember> declarations, Token endToken) { |
| 2884 this._directives = new NodeList<Directive>(this); | 2856 this._directives = new NodeList<Directive>(this); |
| 2885 this._declarations = new NodeList<CompilationUnitMember>(this); | 2857 this._declarations = new NodeList<CompilationUnitMember>(this); |
| 2886 this._beginToken = beginToken; | 2858 this._beginToken = beginToken; |
| 2887 this._scriptTag = becomeParentOf(scriptTag); | 2859 this._scriptTag = becomeParentOf(scriptTag); |
| 2888 this._directives.addAll(directives); | 2860 this._directives.addAll(directives); |
| 2889 this._declarations.addAll(declarations); | 2861 this._declarations.addAll(declarations); |
| 2890 this._endToken = endToken; | 2862 this._endToken = endToken; |
| 2891 } | 2863 } |
| 2892 | 2864 |
| 2893 /** | 2865 /** |
| 2894 * Initialize a newly created compilation unit to have the given directives an
d declarations. | 2866 * Initialize a newly created compilation unit to have the given directives an
d declarations. |
| 2895 * @param beginToken the first token in the token stream | 2867 * @param beginToken the first token in the token stream |
| 2896 * @param scriptTag the script tag at the beginning of the compilation unit | 2868 * @param scriptTag the script tag at the beginning of the compilation unit |
| 2897 * @param directives the directives contained in this compilation unit | 2869 * @param directives the directives contained in this compilation unit |
| 2898 * @param declarations the declarations contained in this compilation unit | 2870 * @param declarations the declarations contained in this compilation unit |
| 2899 * @param endToken the last token in the token stream | 2871 * @param endToken the last token in the token stream |
| 2900 */ | 2872 */ |
| 2901 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct
ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg
inToken, scriptTag, directives, declarations, endToken); | 2873 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct
ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg
inToken, scriptTag, directives, declarations, endToken); |
| 2902 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); | 2874 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); |
| 2903 Token get beginToken => _beginToken; | 2875 Token get beginToken => _beginToken; |
| 2904 | 2876 |
| 2905 /** | 2877 /** |
| 2906 * Return the declarations contained in this compilation unit. | 2878 * Return the declarations contained in this compilation unit. |
| 2907 * @return the declarations contained in this compilation unit | 2879 * @return the declarations contained in this compilation unit |
| 2908 */ | 2880 */ |
| 2909 NodeList<CompilationUnitMember> get declarations => _declarations; | 2881 NodeList<CompilationUnitMember> get declarations => _declarations; |
| 2910 | 2882 |
| 2911 /** | 2883 /** |
| 2912 * Return the directives contained in this compilation unit. | 2884 * Return the directives contained in this compilation unit. |
| 2913 * @return the directives contained in this compilation unit | 2885 * @return the directives contained in this compilation unit |
| 2914 */ | 2886 */ |
| 2915 NodeList<Directive> get directives => _directives; | 2887 NodeList<Directive> get directives => _directives; |
| 2916 | 2888 |
| 2917 /** | 2889 /** |
| 2918 * Return the element associated with this compilation unit, or {@code null} i
f the AST structure | 2890 * Return the element associated with this compilation unit, or {@code null} i
f the AST structure |
| 2919 * has not been resolved. | 2891 * has not been resolved. |
| 2920 * @return the element associated with this compilation unit | 2892 * @return the element associated with this compilation unit |
| 2921 */ | 2893 */ |
| 2922 CompilationUnitElement get element => _element; | 2894 CompilationUnitElement get element => _element; |
| 2923 Token get endToken => _endToken; | 2895 Token get endToken => _endToken; |
| 2924 | 2896 |
| 2925 /** | 2897 /** |
| 2926 * Return an array containing all of the errors associated with the receiver.
If the receiver has | 2898 * Return an array containing all of the errors associated with the receiver.
If the receiver has |
| 2927 * not been resolved, then return {@code null}. | 2899 * not been resolved, then return {@code null}. |
| 2928 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not | 2900 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not |
| 2929 * been resolved | 2901 * been resolved |
| 2930 */ | 2902 */ |
| 2931 List<AnalysisError> get errors { | 2903 List<AnalysisError> get errors { |
| 2932 List<AnalysisError> parserErrors = parsingErrors; | 2904 List<AnalysisError> parserErrors = parsingErrors; |
| 2933 List<AnalysisError> resolverErrors = resolutionErrors; | 2905 List<AnalysisError> resolverErrors = resolutionErrors; |
| 2934 if (resolverErrors.length == 0) { | 2906 if (resolverErrors.length == 0) { |
| 2935 return parserErrors; | 2907 return parserErrors; |
| 2936 } else if (parserErrors.length == 0) { | 2908 } else if (parserErrors.length == 0) { |
| 2937 return resolverErrors; | 2909 return resolverErrors; |
| 2938 } else { | 2910 } else { |
| 2939 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); | 2911 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); |
| 2940 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); | 2912 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); |
| 2941 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); | 2913 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); |
| 2942 return allErrors; | 2914 return allErrors; |
| 2943 } | 2915 } |
| 2944 } | 2916 } |
| 2945 int get length { | 2917 int get length { |
| 2946 Token endToken2 = endToken; | 2918 Token endToken2 = endToken; |
| 2947 if (endToken2 == null) { | 2919 if (endToken2 == null) { |
| 2948 return 0; | 2920 return 0; |
| 2949 } | 2921 } |
| 2950 return endToken2.offset + endToken2.length; | 2922 return endToken2.offset + endToken2.length; |
| 2951 } | 2923 } |
| 2952 | 2924 |
| 2953 /** | 2925 /** |
| 2954 * Get the {@link LineInfo} object for this compilation unit. | 2926 * Get the {@link LineInfo} object for this compilation unit. |
| 2955 * @return the associated {@link LineInfo} | 2927 * @return the associated {@link LineInfo} |
| 2956 */ | 2928 */ |
| 2957 LineInfo get lineInfo => _lineInfo; | 2929 LineInfo get lineInfo => _lineInfo; |
| 2958 int get offset => 0; | 2930 int get offset => 0; |
| 2959 | 2931 |
| 2960 /** | 2932 /** |
| 2961 * Return an array containing all of the parsing errors associated with the re
ceiver. | 2933 * Return an array containing all of the parsing errors associated with the re
ceiver. |
| 2962 * @return an array of errors (not {@code null}, contains no {@code null}s). | 2934 * @return an array of errors (not {@code null}, contains no {@code null}s). |
| 2963 */ | 2935 */ |
| 2964 List<AnalysisError> get parsingErrors => _parsingErrors; | 2936 List<AnalysisError> get parsingErrors => _parsingErrors; |
| 2965 | 2937 |
| 2966 /** | 2938 /** |
| 2967 * Return an array containing all of the resolution errors associated with the
receiver. If the | 2939 * Return an array containing all of the resolution errors associated with the
receiver. If the |
| 2968 * receiver has not been resolved, then return {@code null}. | 2940 * receiver has not been resolved, then return {@code null}. |
| 2969 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not | 2941 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not |
| 2970 * been resolved | 2942 * been resolved |
| 2971 */ | 2943 */ |
| 2972 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 2944 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 2973 | 2945 |
| 2974 /** | 2946 /** |
| 2975 * Return the script tag at the beginning of the compilation unit, or {@code n
ull} if there is no | 2947 * Return the script tag at the beginning of the compilation unit, or {@code n
ull} if there is no |
| 2976 * script tag in this compilation unit. | 2948 * script tag in this compilation unit. |
| 2977 * @return the script tag at the beginning of the compilation unit | 2949 * @return the script tag at the beginning of the compilation unit |
| 2978 */ | 2950 */ |
| 2979 ScriptTag get scriptTag => _scriptTag; | 2951 ScriptTag get scriptTag => _scriptTag; |
| 2980 | 2952 |
| 2981 /** | 2953 /** |
| 2982 * Set the element associated with this compilation unit to the given element. | 2954 * Set the element associated with this compilation unit to the given element. |
| 2983 * @param element the element associated with this compilation unit | 2955 * @param element the element associated with this compilation unit |
| 2984 */ | 2956 */ |
| 2985 void set element(CompilationUnitElement element2) { | 2957 void set element(CompilationUnitElement element2) { |
| 2986 this._element = element2; | 2958 this._element = element2; |
| 2987 } | 2959 } |
| 2988 | 2960 |
| 2989 /** | 2961 /** |
| 2990 * Set the {@link LineInfo} object for this compilation unit. | 2962 * Set the {@link LineInfo} object for this compilation unit. |
| 2991 * @param errors LineInfo to associate with this compilation unit | 2963 * @param errors LineInfo to associate with this compilation unit |
| 2992 */ | 2964 */ |
| 2993 void set lineInfo(LineInfo lineInfo2) { | 2965 void set lineInfo(LineInfo lineInfo2) { |
| 2994 this._lineInfo = lineInfo2; | 2966 this._lineInfo = lineInfo2; |
| 2995 } | 2967 } |
| 2996 | 2968 |
| 2997 /** | 2969 /** |
| 2998 * Called to cache the parsing errors when the unit is parsed. | 2970 * Called to cache the parsing errors when the unit is parsed. |
| 2999 * @param errors an array of parsing errors, if {@code null} is passed, the er
ror array is set to | 2971 * @param errors an array of parsing errors, if {@code null} is passed, the er
ror array is set to |
| 3000 * an empty array, {@link AnalysisError#NO_ERRORS} | 2972 * an empty array, {@link AnalysisError#NO_ERRORS} |
| 3001 */ | 2973 */ |
| 3002 void set parsingErrors(List<AnalysisError> errors) { | 2974 void set parsingErrors(List<AnalysisError> errors) { |
| 3003 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; | 2975 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; |
| 3004 } | 2976 } |
| 3005 | 2977 |
| 3006 /** | 2978 /** |
| 3007 * Called to cache the resolution errors when the unit is resolved. | 2979 * Called to cache the resolution errors when the unit is resolved. |
| 3008 * @param errors an array of resolution errors, if {@code null} is passed, the
error array is set | 2980 * @param errors an array of resolution errors, if {@code null} is passed, the
error array is set |
| 3009 * to an empty array, {@link AnalysisError#NO_ERRORS} | 2981 * to an empty array, {@link AnalysisError#NO_ERRORS} |
| 3010 */ | 2982 */ |
| 3011 void set resolutionErrors(List<AnalysisError> errors) { | 2983 void set resolutionErrors(List<AnalysisError> errors) { |
| 3012 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors; | 2984 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors; |
| 3013 } | 2985 } |
| 3014 | 2986 |
| 3015 /** | 2987 /** |
| 3016 * Set the script tag at the beginning of the compilation unit to the given sc
ript tag. | 2988 * Set the script tag at the beginning of the compilation unit to the given sc
ript tag. |
| 3017 * @param scriptTag the script tag at the beginning of the compilation unit | 2989 * @param scriptTag the script tag at the beginning of the compilation unit |
| 3018 */ | 2990 */ |
| 3019 void set scriptTag(ScriptTag scriptTag2) { | 2991 void set scriptTag(ScriptTag scriptTag2) { |
| 3020 this._scriptTag = becomeParentOf(scriptTag2); | 2992 this._scriptTag = becomeParentOf(scriptTag2); |
| 3021 } | 2993 } |
| 3022 void visitChildren(ASTVisitor<Object> visitor) { | 2994 void visitChildren(ASTVisitor<Object> visitor) { |
| 3023 safelyVisitChild(_scriptTag, visitor); | 2995 safelyVisitChild(_scriptTag, visitor); |
| 3024 if (directivesAreBeforeDeclarations()) { | 2996 if (directivesAreBeforeDeclarations()) { |
| 3025 _directives.accept(visitor); | 2997 _directives.accept(visitor); |
| 3026 _declarations.accept(visitor); | 2998 _declarations.accept(visitor); |
| 3027 } else { | 2999 } else { |
| 3028 for (ASTNode child in sortedDirectivesAndDeclarations) { | 3000 for (ASTNode child in sortedDirectivesAndDeclarations) { |
| 3029 child.accept(visitor); | 3001 child.accept(visitor); |
| 3030 } | 3002 } |
| 3031 } | 3003 } |
| 3032 } | 3004 } |
| 3033 | 3005 |
| 3034 /** | 3006 /** |
| 3035 * Return {@code true} if all of the directives are lexically before any decla
rations. | 3007 * Return {@code true} if all of the directives are lexically before any decla
rations. |
| 3036 * @return {@code true} if all of the directives are lexically before any decl
arations | 3008 * @return {@code true} if all of the directives are lexically before any decl
arations |
| 3037 */ | 3009 */ |
| 3038 bool directivesAreBeforeDeclarations() { | 3010 bool directivesAreBeforeDeclarations() { |
| 3039 if (_directives.isEmpty || _declarations.isEmpty) { | 3011 if (_directives.isEmpty || _declarations.isEmpty) { |
| 3040 return true; | 3012 return true; |
| 3041 } | 3013 } |
| 3042 Directive lastDirective = _directives[_directives.length - 1]; | 3014 Directive lastDirective = _directives[_directives.length - 1]; |
| 3043 CompilationUnitMember firstDeclaration = _declarations[0]; | 3015 CompilationUnitMember firstDeclaration = _declarations[0]; |
| 3044 return lastDirective.offset < firstDeclaration.offset; | 3016 return lastDirective.offset < firstDeclaration.offset; |
| 3045 } | 3017 } |
| 3046 | 3018 |
| 3047 /** | 3019 /** |
| 3048 * Return an array containing all of the directives and declarations in this c
ompilation unit, | 3020 * Return an array containing all of the directives and declarations in this c
ompilation unit, |
| 3049 * sorted in lexical order. | 3021 * sorted in lexical order. |
| 3050 * @return the directives and declarations in this compilation unit in the ord
er in which they | 3022 * @return the directives and declarations in this compilation unit in the ord
er in which they |
| 3051 * appeared in the original source | 3023 * appeared in the original source |
| 3052 */ | 3024 */ |
| 3053 List<ASTNode> get sortedDirectivesAndDeclarations { | 3025 List<ASTNode> get sortedDirectivesAndDeclarations { |
| 3054 List<ASTNode> childList = new List<ASTNode>(); | 3026 List<ASTNode> childList = new List<ASTNode>(); |
| 3055 childList.addAll(_directives); | 3027 childList.addAll(_directives); |
| 3056 childList.addAll(_declarations); | 3028 childList.addAll(_declarations); |
| 3057 List<ASTNode> children = new List.from(childList); | 3029 List<ASTNode> children = new List.from(childList); |
| 3058 children.sort(); | 3030 children.sort(); |
| 3059 return children; | 3031 return children; |
| 3060 } | 3032 } |
| 3061 } | 3033 } |
| 3062 | |
| 3063 /** | 3034 /** |
| 3064 * Instances of the class {@code CompilationUnitMember} defines the behavior com
mon to nodes that | 3035 * Instances of the class {@code CompilationUnitMember} defines the behavior com
mon to nodes that |
| 3065 * declare a name within the scope of a compilation unit. | 3036 * declare a name within the scope of a compilation unit. |
| 3066 * <pre> | 3037 * <pre> |
| 3067 * compilationUnitMember ::={@link ClassDeclaration classDeclaration}| {@link Ty
peAlias typeAlias}| {@link FunctionDeclaration functionDeclaration}| {@link Meth
odDeclaration getOrSetDeclaration}| {@link VariableDeclaration constantsDeclarat
ion}| {@link VariableDeclaration variablesDeclaration}</pre> | 3038 * compilationUnitMember ::={@link ClassDeclaration classDeclaration}| {@link Ty
peAlias typeAlias}| {@link FunctionDeclaration functionDeclaration}| {@link Meth
odDeclaration getOrSetDeclaration}| {@link VariableDeclaration constantsDeclarat
ion}| {@link VariableDeclaration variablesDeclaration}</pre> |
| 3068 * @coverage dart.engine.ast | 3039 * @coverage dart.engine.ast |
| 3069 */ | 3040 */ |
| 3070 abstract class CompilationUnitMember extends Declaration { | 3041 abstract class CompilationUnitMember extends Declaration { |
| 3071 | 3042 |
| 3072 /** | 3043 /** |
| 3073 * Initialize a newly created generic compilation unit member. | 3044 * Initialize a newly created generic compilation unit member. |
| 3074 * @param comment the documentation comment associated with this member | 3045 * @param comment the documentation comment associated with this member |
| 3075 * @param metadata the annotations associated with this member | 3046 * @param metadata the annotations associated with this member |
| 3076 */ | 3047 */ |
| 3077 CompilationUnitMember.full(Comment comment, List<Annotation> metadata) : super
.full(comment, metadata) { | 3048 CompilationUnitMember.full(Comment comment, List<Annotation> metadata) : super
.full(comment, metadata) { |
| 3078 } | 3049 } |
| 3079 | 3050 |
| 3080 /** | 3051 /** |
| 3081 * Initialize a newly created generic compilation unit member. | 3052 * Initialize a newly created generic compilation unit member. |
| 3082 * @param comment the documentation comment associated with this member | 3053 * @param comment the documentation comment associated with this member |
| 3083 * @param metadata the annotations associated with this member | 3054 * @param metadata the annotations associated with this member |
| 3084 */ | 3055 */ |
| 3085 CompilationUnitMember({Comment comment, List<Annotation> metadata}) : this.ful
l(comment, metadata); | 3056 CompilationUnitMember({Comment comment, List<Annotation> metadata}) : this.ful
l(comment, metadata); |
| 3086 } | 3057 } |
| 3087 | |
| 3088 /** | 3058 /** |
| 3089 * Instances of the class {@code ConditionalExpression} represent a conditional
expression. | 3059 * Instances of the class {@code ConditionalExpression} represent a conditional
expression. |
| 3090 * <pre> | 3060 * <pre> |
| 3091 * conditionalExpression ::={@link Expression condition} '?' {@link Expression t
henExpression} ':' {@link Expression elseExpression}</pre> | 3061 * conditionalExpression ::={@link Expression condition} '?' {@link Expression t
henExpression} ':' {@link Expression elseExpression}</pre> |
| 3092 * @coverage dart.engine.ast | 3062 * @coverage dart.engine.ast |
| 3093 */ | 3063 */ |
| 3094 class ConditionalExpression extends Expression { | 3064 class ConditionalExpression extends Expression { |
| 3095 | 3065 |
| 3096 /** | 3066 /** |
| 3097 * The condition used to determine which of the expressions is executed next. | 3067 * The condition used to determine which of the expressions is executed next. |
| 3098 */ | 3068 */ |
| 3099 Expression _condition; | 3069 Expression _condition; |
| 3100 | 3070 |
| 3101 /** | 3071 /** |
| 3102 * The token used to separate the condition from the then expression. | 3072 * The token used to separate the condition from the then expression. |
| 3103 */ | 3073 */ |
| 3104 Token _question; | 3074 Token _question; |
| 3105 | 3075 |
| 3106 /** | 3076 /** |
| 3107 * The expression that is executed if the condition evaluates to {@code true}. | 3077 * The expression that is executed if the condition evaluates to {@code true}. |
| 3108 */ | 3078 */ |
| 3109 Expression _thenExpression; | 3079 Expression _thenExpression; |
| 3110 | 3080 |
| 3111 /** | 3081 /** |
| 3112 * The token used to separate the then expression from the else expression. | 3082 * The token used to separate the then expression from the else expression. |
| 3113 */ | 3083 */ |
| 3114 Token _colon; | 3084 Token _colon; |
| 3115 | 3085 |
| 3116 /** | 3086 /** |
| 3117 * The expression that is executed if the condition evaluates to {@code false}
. | 3087 * The expression that is executed if the condition evaluates to {@code false}
. |
| 3118 */ | 3088 */ |
| 3119 Expression _elseExpression; | 3089 Expression _elseExpression; |
| 3120 | 3090 |
| 3121 /** | 3091 /** |
| 3122 * Initialize a newly created conditional expression. | 3092 * Initialize a newly created conditional expression. |
| 3123 * @param condition the condition used to determine which expression is execut
ed next | 3093 * @param condition the condition used to determine which expression is execut
ed next |
| 3124 * @param question the token used to separate the condition from the then expr
ession | 3094 * @param question the token used to separate the condition from the then expr
ession |
| 3125 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} | 3095 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} |
| 3126 * @param colon the token used to separate the then expression from the else e
xpression | 3096 * @param colon the token used to separate the then expression from the else e
xpression |
| 3127 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} | 3097 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} |
| 3128 */ | 3098 */ |
| 3129 ConditionalExpression.full(Expression condition, Token question, Expression th
enExpression, Token colon, Expression elseExpression) { | 3099 ConditionalExpression.full(Expression condition, Token question, Expression th
enExpression, Token colon, Expression elseExpression) { |
| 3130 this._condition = becomeParentOf(condition); | 3100 this._condition = becomeParentOf(condition); |
| 3131 this._question = question; | 3101 this._question = question; |
| 3132 this._thenExpression = becomeParentOf(thenExpression); | 3102 this._thenExpression = becomeParentOf(thenExpression); |
| 3133 this._colon = colon; | 3103 this._colon = colon; |
| 3134 this._elseExpression = becomeParentOf(elseExpression); | 3104 this._elseExpression = becomeParentOf(elseExpression); |
| 3135 } | 3105 } |
| 3136 | 3106 |
| 3137 /** | 3107 /** |
| 3138 * Initialize a newly created conditional expression. | 3108 * Initialize a newly created conditional expression. |
| 3139 * @param condition the condition used to determine which expression is execut
ed next | 3109 * @param condition the condition used to determine which expression is execut
ed next |
| 3140 * @param question the token used to separate the condition from the then expr
ession | 3110 * @param question the token used to separate the condition from the then expr
ession |
| 3141 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} | 3111 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} |
| 3142 * @param colon the token used to separate the then expression from the else e
xpression | 3112 * @param colon the token used to separate the then expression from the else e
xpression |
| 3143 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} | 3113 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} |
| 3144 */ | 3114 */ |
| 3145 ConditionalExpression({Expression condition, Token question, Expression thenEx
pression, Token colon, Expression elseExpression}) : this.full(condition, questi
on, thenExpression, colon, elseExpression); | 3115 ConditionalExpression({Expression condition, Token question, Expression thenEx
pression, Token colon, Expression elseExpression}) : this.full(condition, questi
on, thenExpression, colon, elseExpression); |
| 3146 accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this); | 3116 accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this); |
| 3147 Token get beginToken => _condition.beginToken; | 3117 Token get beginToken => _condition.beginToken; |
| 3148 | 3118 |
| 3149 /** | 3119 /** |
| 3150 * Return the token used to separate the then expression from the else express
ion. | 3120 * Return the token used to separate the then expression from the else express
ion. |
| 3151 * @return the token used to separate the then expression from the else expres
sion | 3121 * @return the token used to separate the then expression from the else expres
sion |
| 3152 */ | 3122 */ |
| 3153 Token get colon => _colon; | 3123 Token get colon => _colon; |
| 3154 | 3124 |
| 3155 /** | 3125 /** |
| 3156 * Return the condition used to determine which of the expressions is executed
next. | 3126 * Return the condition used to determine which of the expressions is executed
next. |
| 3157 * @return the condition used to determine which expression is executed next | 3127 * @return the condition used to determine which expression is executed next |
| 3158 */ | 3128 */ |
| 3159 Expression get condition => _condition; | 3129 Expression get condition => _condition; |
| 3160 | 3130 |
| 3161 /** | 3131 /** |
| 3162 * Return the expression that is executed if the condition evaluates to {@code
false}. | 3132 * Return the expression that is executed if the condition evaluates to {@code
false}. |
| 3163 * @return the expression that is executed if the condition evaluates to {@cod
e false} | 3133 * @return the expression that is executed if the condition evaluates to {@cod
e false} |
| 3164 */ | 3134 */ |
| 3165 Expression get elseExpression => _elseExpression; | 3135 Expression get elseExpression => _elseExpression; |
| 3166 Token get endToken => _elseExpression.endToken; | 3136 Token get endToken => _elseExpression.endToken; |
| 3167 | 3137 |
| 3168 /** | 3138 /** |
| 3169 * Return the token used to separate the condition from the then expression. | 3139 * Return the token used to separate the condition from the then expression. |
| 3170 * @return the token used to separate the condition from the then expression | 3140 * @return the token used to separate the condition from the then expression |
| 3171 */ | 3141 */ |
| 3172 Token get question => _question; | 3142 Token get question => _question; |
| 3173 | 3143 |
| 3174 /** | 3144 /** |
| 3175 * Return the expression that is executed if the condition evaluates to {@code
true}. | 3145 * Return the expression that is executed if the condition evaluates to {@code
true}. |
| 3176 * @return the expression that is executed if the condition evaluates to {@cod
e true} | 3146 * @return the expression that is executed if the condition evaluates to {@cod
e true} |
| 3177 */ | 3147 */ |
| 3178 Expression get thenExpression => _thenExpression; | 3148 Expression get thenExpression => _thenExpression; |
| 3179 | 3149 |
| 3180 /** | 3150 /** |
| 3181 * Set the token used to separate the then expression from the else expression
to the given token. | 3151 * Set the token used to separate the then expression from the else expression
to the given token. |
| 3182 * @param colon the token used to separate the then expression from the else e
xpression | 3152 * @param colon the token used to separate the then expression from the else e
xpression |
| 3183 */ | 3153 */ |
| 3184 void set colon(Token colon2) { | 3154 void set colon(Token colon2) { |
| 3185 this._colon = colon2; | 3155 this._colon = colon2; |
| 3186 } | 3156 } |
| 3187 | 3157 |
| 3188 /** | 3158 /** |
| 3189 * Set the condition used to determine which of the expressions is executed ne
xt to the given | 3159 * Set the condition used to determine which of the expressions is executed ne
xt to the given |
| 3190 * expression. | 3160 * expression. |
| 3191 * @param expression the condition used to determine which expression is execu
ted next | 3161 * @param expression the condition used to determine which expression is execu
ted next |
| 3192 */ | 3162 */ |
| 3193 void set condition(Expression expression) { | 3163 void set condition(Expression expression) { |
| 3194 _condition = becomeParentOf(expression); | 3164 _condition = becomeParentOf(expression); |
| 3195 } | 3165 } |
| 3196 | 3166 |
| 3197 /** | 3167 /** |
| 3198 * Set the expression that is executed if the condition evaluates to {@code fa
lse} to the given | 3168 * Set the expression that is executed if the condition evaluates to {@code fa
lse} to the given |
| 3199 * expression. | 3169 * expression. |
| 3200 * @param expression the expression that is executed if the condition evaluate
s to {@code false} | 3170 * @param expression the expression that is executed if the condition evaluate
s to {@code false} |
| 3201 */ | 3171 */ |
| 3202 void set elseExpression(Expression expression) { | 3172 void set elseExpression(Expression expression) { |
| 3203 _elseExpression = becomeParentOf(expression); | 3173 _elseExpression = becomeParentOf(expression); |
| 3204 } | 3174 } |
| 3205 | 3175 |
| 3206 /** | 3176 /** |
| 3207 * Set the token used to separate the condition from the then expression to th
e given token. | 3177 * Set the token used to separate the condition from the then expression to th
e given token. |
| 3208 * @param question the token used to separate the condition from the then expr
ession | 3178 * @param question the token used to separate the condition from the then expr
ession |
| 3209 */ | 3179 */ |
| 3210 void set question(Token question2) { | 3180 void set question(Token question2) { |
| 3211 this._question = question2; | 3181 this._question = question2; |
| 3212 } | 3182 } |
| 3213 | 3183 |
| 3214 /** | 3184 /** |
| 3215 * Set the expression that is executed if the condition evaluates to {@code tr
ue} to the given | 3185 * Set the expression that is executed if the condition evaluates to {@code tr
ue} to the given |
| 3216 * expression. | 3186 * expression. |
| 3217 * @param expression the expression that is executed if the condition evaluate
s to {@code true} | 3187 * @param expression the expression that is executed if the condition evaluate
s to {@code true} |
| 3218 */ | 3188 */ |
| 3219 void set thenExpression(Expression expression) { | 3189 void set thenExpression(Expression expression) { |
| 3220 _thenExpression = becomeParentOf(expression); | 3190 _thenExpression = becomeParentOf(expression); |
| 3221 } | 3191 } |
| 3222 void visitChildren(ASTVisitor<Object> visitor) { | 3192 void visitChildren(ASTVisitor<Object> visitor) { |
| 3223 safelyVisitChild(_condition, visitor); | 3193 safelyVisitChild(_condition, visitor); |
| 3224 safelyVisitChild(_thenExpression, visitor); | 3194 safelyVisitChild(_thenExpression, visitor); |
| 3225 safelyVisitChild(_elseExpression, visitor); | 3195 safelyVisitChild(_elseExpression, visitor); |
| 3226 } | 3196 } |
| 3227 } | 3197 } |
| 3228 | |
| 3229 /** | 3198 /** |
| 3230 * Instances of the class {@code ConstructorDeclaration} represent a constructor
declaration. | 3199 * Instances of the class {@code ConstructorDeclaration} represent a constructor
declaration. |
| 3231 * <pre> | 3200 * <pre> |
| 3232 * constructorDeclaration ::= | 3201 * constructorDeclaration ::= |
| 3233 * constructorSignature {@link FunctionBody body}? | 3202 * constructorSignature {@link FunctionBody body}? |
| 3234 * | constructorName formalParameterList ':' 'this' ('.' {@link SimpleIdentifier
name})? arguments | 3203 * | constructorName formalParameterList ':' 'this' ('.' {@link SimpleIdentifier
name})? arguments |
| 3235 * constructorSignature ::= | 3204 * constructorSignature ::= |
| 3236 * 'external'? constructorName formalParameterList initializerList? | 3205 * 'external'? constructorName formalParameterList initializerList? |
| 3237 * | 'external'? 'factory' factoryName formalParameterList initializerList? | 3206 * | 'external'? 'factory' factoryName formalParameterList initializerList? |
| 3238 * | 'external'? 'const' constructorName formalParameterList initializerList? | 3207 * | 'external'? 'const' constructorName formalParameterList initializerList? |
| 3239 * constructorName ::={@link SimpleIdentifier returnType} ('.' {@link SimpleIden
tifier name})? | 3208 * constructorName ::={@link SimpleIdentifier returnType} ('.' {@link SimpleIden
tifier name})? |
| 3240 * factoryName ::={@link Identifier returnType} ('.' {@link SimpleIdentifier nam
e})? | 3209 * factoryName ::={@link Identifier returnType} ('.' {@link SimpleIdentifier nam
e})? |
| 3241 * initializerList ::= | 3210 * initializerList ::= |
| 3242 * ':' {@link ConstructorInitializer initializer} (',' {@link ConstructorInitial
izer initializer}) | 3211 * ':' {@link ConstructorInitializer initializer} (',' {@link ConstructorInitial
izer initializer}) |
| 3243 * </pre> | 3212 * </pre> |
| 3244 * @coverage dart.engine.ast | 3213 * @coverage dart.engine.ast |
| 3245 */ | 3214 */ |
| 3246 class ConstructorDeclaration extends ClassMember { | 3215 class ConstructorDeclaration extends ClassMember { |
| 3247 | 3216 |
| 3248 /** | 3217 /** |
| 3249 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. | 3218 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. |
| 3250 */ | 3219 */ |
| 3251 Token _externalKeyword; | 3220 Token _externalKeyword; |
| 3252 | 3221 |
| 3253 /** | 3222 /** |
| 3254 * The token for the 'const' keyword, or {@code null} if the constructor is no
t a const | 3223 * The token for the 'const' keyword, or {@code null} if the constructor is no
t a const |
| 3255 * constructor. | 3224 * constructor. |
| 3256 */ | 3225 */ |
| 3257 Token _constKeyword; | 3226 Token _constKeyword; |
| 3258 | 3227 |
| 3259 /** | 3228 /** |
| 3260 * The token for the 'factory' keyword, or {@code null} if the constructor is
not a factory | 3229 * The token for the 'factory' keyword, or {@code null} if the constructor is
not a factory |
| 3261 * constructor. | 3230 * constructor. |
| 3262 */ | 3231 */ |
| 3263 Token _factoryKeyword; | 3232 Token _factoryKeyword; |
| 3264 | 3233 |
| 3265 /** | 3234 /** |
| 3266 * The type of object being created. This can be different than the type in wh
ich the constructor | 3235 * The type of object being created. This can be different than the type in wh
ich the constructor |
| 3267 * is being declared if the constructor is the implementation of a factory con
structor. | 3236 * is being declared if the constructor is the implementation of a factory con
structor. |
| 3268 */ | 3237 */ |
| 3269 Identifier _returnType; | 3238 Identifier _returnType; |
| 3270 | 3239 |
| 3271 /** | 3240 /** |
| 3272 * The token for the period before the constructor name, or {@code null} if th
e constructor being | 3241 * The token for the period before the constructor name, or {@code null} if th
e constructor being |
| 3273 * declared is unnamed. | 3242 * declared is unnamed. |
| 3274 */ | 3243 */ |
| 3275 Token _period; | 3244 Token _period; |
| 3276 | 3245 |
| 3277 /** | 3246 /** |
| 3278 * The name of the constructor, or {@code null} if the constructor being decla
red is unnamed. | 3247 * The name of the constructor, or {@code null} if the constructor being decla
red is unnamed. |
| 3279 */ | 3248 */ |
| 3280 SimpleIdentifier _name; | 3249 SimpleIdentifier _name; |
| 3281 | 3250 |
| 3282 /** | 3251 /** |
| 3283 * The element associated with this constructor, or {@code null} if the AST st
ructure has not been | 3252 * The element associated with this constructor, or {@code null} if the AST st
ructure has not been |
| 3284 * resolved or if this constructor could not be resolved. | 3253 * resolved or if this constructor could not be resolved. |
| 3285 */ | 3254 */ |
| 3286 ConstructorElement _element; | 3255 ConstructorElement _element; |
| 3287 | 3256 |
| 3288 /** | 3257 /** |
| 3289 * The parameters associated with the constructor. | 3258 * The parameters associated with the constructor. |
| 3290 */ | 3259 */ |
| 3291 FormalParameterList _parameters; | 3260 FormalParameterList _parameters; |
| 3292 | 3261 |
| 3293 /** | 3262 /** |
| 3294 * The token for the separator (colon or equals) before the initializers, or {
@code null} if there | 3263 * The token for the separator (colon or equals) before the initializers, or {
@code null} if there |
| 3295 * are no initializers. | 3264 * are no initializers. |
| 3296 */ | 3265 */ |
| 3297 Token _separator; | 3266 Token _separator; |
| 3298 | 3267 |
| 3299 /** | 3268 /** |
| 3300 * The initializers associated with the constructor. | 3269 * The initializers associated with the constructor. |
| 3301 */ | 3270 */ |
| 3302 NodeList<ConstructorInitializer> _initializers; | 3271 NodeList<ConstructorInitializer> _initializers; |
| 3303 | 3272 |
| 3304 /** | 3273 /** |
| 3305 * The name of the constructor to which this constructor will be redirected, o
r {@code null} if | 3274 * The name of the constructor to which this constructor will be redirected, o
r {@code null} if |
| 3306 * this is not a redirecting factory constructor. | 3275 * this is not a redirecting factory constructor. |
| 3307 */ | 3276 */ |
| 3308 ConstructorName _redirectedConstructor; | 3277 ConstructorName _redirectedConstructor; |
| 3309 | 3278 |
| 3310 /** | 3279 /** |
| 3311 * The body of the constructor, or {@code null} if the constructor does not ha
ve a body. | 3280 * The body of the constructor, or {@code null} if the constructor does not ha
ve a body. |
| 3312 */ | 3281 */ |
| 3313 FunctionBody _body; | 3282 FunctionBody _body; |
| 3314 | 3283 |
| 3315 /** | 3284 /** |
| 3316 * Initialize a newly created constructor declaration. | 3285 * Initialize a newly created constructor declaration. |
| 3317 * @param externalKeyword the token for the 'external' keyword | 3286 * @param externalKeyword the token for the 'external' keyword |
| 3318 * @param comment the documentation comment associated with this constructor | 3287 * @param comment the documentation comment associated with this constructor |
| 3319 * @param metadata the annotations associated with this constructor | 3288 * @param metadata the annotations associated with this constructor |
| 3320 * @param constKeyword the token for the 'const' keyword | 3289 * @param constKeyword the token for the 'const' keyword |
| 3321 * @param factoryKeyword the token for the 'factory' keyword | 3290 * @param factoryKeyword the token for the 'factory' keyword |
| 3322 * @param returnType the return type of the constructor | 3291 * @param returnType the return type of the constructor |
| 3323 * @param period the token for the period before the constructor name | 3292 * @param period the token for the period before the constructor name |
| 3324 * @param name the name of the constructor | 3293 * @param name the name of the constructor |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3336 this._factoryKeyword = factoryKeyword; | 3305 this._factoryKeyword = factoryKeyword; |
| 3337 this._returnType = becomeParentOf(returnType); | 3306 this._returnType = becomeParentOf(returnType); |
| 3338 this._period = period; | 3307 this._period = period; |
| 3339 this._name = becomeParentOf(name); | 3308 this._name = becomeParentOf(name); |
| 3340 this._parameters = becomeParentOf(parameters); | 3309 this._parameters = becomeParentOf(parameters); |
| 3341 this._separator = separator; | 3310 this._separator = separator; |
| 3342 this._initializers.addAll(initializers); | 3311 this._initializers.addAll(initializers); |
| 3343 this._redirectedConstructor = becomeParentOf(redirectedConstructor); | 3312 this._redirectedConstructor = becomeParentOf(redirectedConstructor); |
| 3344 this._body = becomeParentOf(body); | 3313 this._body = becomeParentOf(body); |
| 3345 } | 3314 } |
| 3346 | 3315 |
| 3347 /** | 3316 /** |
| 3348 * Initialize a newly created constructor declaration. | 3317 * Initialize a newly created constructor declaration. |
| 3349 * @param externalKeyword the token for the 'external' keyword | 3318 * @param externalKeyword the token for the 'external' keyword |
| 3350 * @param comment the documentation comment associated with this constructor | 3319 * @param comment the documentation comment associated with this constructor |
| 3351 * @param metadata the annotations associated with this constructor | 3320 * @param metadata the annotations associated with this constructor |
| 3352 * @param constKeyword the token for the 'const' keyword | 3321 * @param constKeyword the token for the 'const' keyword |
| 3353 * @param factoryKeyword the token for the 'factory' keyword | 3322 * @param factoryKeyword the token for the 'factory' keyword |
| 3354 * @param returnType the return type of the constructor | 3323 * @param returnType the return type of the constructor |
| 3355 * @param period the token for the period before the constructor name | 3324 * @param period the token for the period before the constructor name |
| 3356 * @param name the name of the constructor | 3325 * @param name the name of the constructor |
| 3357 * @param parameters the parameters associated with the constructor | 3326 * @param parameters the parameters associated with the constructor |
| 3358 * @param separator the token for the colon or equals before the initializers | 3327 * @param separator the token for the colon or equals before the initializers |
| 3359 * @param initializers the initializers associated with the constructor | 3328 * @param initializers the initializers associated with the constructor |
| 3360 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be | 3329 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be |
| 3361 * redirected | 3330 * redirected |
| 3362 * @param body the body of the constructor | 3331 * @param body the body of the constructor |
| 3363 */ | 3332 */ |
| 3364 ConstructorDeclaration({Comment comment, List<Annotation> metadata, Token exte
rnalKeyword, Token constKeyword, Token factoryKeyword, Identifier returnType, To
ken period, SimpleIdentifier name, FormalParameterList parameters, Token separat
or, List<ConstructorInitializer> initializers, ConstructorName redirectedConstru
ctor, FunctionBody body}) : this.full(comment, metadata, externalKeyword, constK
eyword, factoryKeyword, returnType, period, name, parameters, separator, initial
izers, redirectedConstructor, body); | 3333 ConstructorDeclaration({Comment comment, List<Annotation> metadata, Token exte
rnalKeyword, Token constKeyword, Token factoryKeyword, Identifier returnType, To
ken period, SimpleIdentifier name, FormalParameterList parameters, Token separat
or, List<ConstructorInitializer> initializers, ConstructorName redirectedConstru
ctor, FunctionBody body}) : this.full(comment, metadata, externalKeyword, constK
eyword, factoryKeyword, returnType, period, name, parameters, separator, initial
izers, redirectedConstructor, body); |
| 3365 accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this); | 3334 accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this); |
| 3366 | 3335 |
| 3367 /** | 3336 /** |
| 3368 * Return the body of the constructor, or {@code null} if the constructor does
not have a body. | 3337 * Return the body of the constructor, or {@code null} if the constructor does
not have a body. |
| 3369 * @return the body of the constructor | 3338 * @return the body of the constructor |
| 3370 */ | 3339 */ |
| 3371 FunctionBody get body => _body; | 3340 FunctionBody get body => _body; |
| 3372 | 3341 |
| 3373 /** | 3342 /** |
| 3374 * Return the token for the 'const' keyword. | 3343 * Return the token for the 'const' keyword. |
| 3375 * @return the token for the 'const' keyword | 3344 * @return the token for the 'const' keyword |
| 3376 */ | 3345 */ |
| 3377 Token get constKeyword => _constKeyword; | 3346 Token get constKeyword => _constKeyword; |
| 3378 ConstructorElement get element => _element; | 3347 ConstructorElement get element => _element; |
| 3379 Token get endToken { | 3348 Token get endToken { |
| 3380 if (_body != null) { | 3349 if (_body != null) { |
| 3381 return _body.endToken; | 3350 return _body.endToken; |
| 3382 } else if (!_initializers.isEmpty) { | 3351 } else if (!_initializers.isEmpty) { |
| 3383 return _initializers.endToken; | 3352 return _initializers.endToken; |
| 3384 } | 3353 } |
| 3385 return _parameters.endToken; | 3354 return _parameters.endToken; |
| 3386 } | 3355 } |
| 3387 | 3356 |
| 3388 /** | 3357 /** |
| 3389 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not | 3358 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not |
| 3390 * external. | 3359 * external. |
| 3391 * @return the token for the 'external' keyword | 3360 * @return the token for the 'external' keyword |
| 3392 */ | 3361 */ |
| 3393 Token get externalKeyword => _externalKeyword; | 3362 Token get externalKeyword => _externalKeyword; |
| 3394 | 3363 |
| 3395 /** | 3364 /** |
| 3396 * Return the token for the 'factory' keyword. | 3365 * Return the token for the 'factory' keyword. |
| 3397 * @return the token for the 'factory' keyword | 3366 * @return the token for the 'factory' keyword |
| 3398 */ | 3367 */ |
| 3399 Token get factoryKeyword => _factoryKeyword; | 3368 Token get factoryKeyword => _factoryKeyword; |
| 3400 | 3369 |
| 3401 /** | 3370 /** |
| 3402 * Return the initializers associated with the constructor. | 3371 * Return the initializers associated with the constructor. |
| 3403 * @return the initializers associated with the constructor | 3372 * @return the initializers associated with the constructor |
| 3404 */ | 3373 */ |
| 3405 NodeList<ConstructorInitializer> get initializers => _initializers; | 3374 NodeList<ConstructorInitializer> get initializers => _initializers; |
| 3406 | 3375 |
| 3407 /** | 3376 /** |
| 3408 * Return the name of the constructor, or {@code null} if the constructor bein
g declared is | 3377 * Return the name of the constructor, or {@code null} if the constructor bein
g declared is |
| 3409 * unnamed. | 3378 * unnamed. |
| 3410 * @return the name of the constructor | 3379 * @return the name of the constructor |
| 3411 */ | 3380 */ |
| 3412 SimpleIdentifier get name => _name; | 3381 SimpleIdentifier get name => _name; |
| 3413 | 3382 |
| 3414 /** | 3383 /** |
| 3415 * Return the parameters associated with the constructor. | 3384 * Return the parameters associated with the constructor. |
| 3416 * @return the parameters associated with the constructor | 3385 * @return the parameters associated with the constructor |
| 3417 */ | 3386 */ |
| 3418 FormalParameterList get parameters => _parameters; | 3387 FormalParameterList get parameters => _parameters; |
| 3419 | 3388 |
| 3420 /** | 3389 /** |
| 3421 * Return the token for the period before the constructor name, or {@code null
} if the constructor | 3390 * Return the token for the period before the constructor name, or {@code null
} if the constructor |
| 3422 * being declared is unnamed. | 3391 * being declared is unnamed. |
| 3423 * @return the token for the period before the constructor name | 3392 * @return the token for the period before the constructor name |
| 3424 */ | 3393 */ |
| 3425 Token get period => _period; | 3394 Token get period => _period; |
| 3426 | 3395 |
| 3427 /** | 3396 /** |
| 3428 * Return the name of the constructor to which this constructor will be redire
cted, or{@code null} if this is not a redirecting factory constructor. | 3397 * Return the name of the constructor to which this constructor will be redire
cted, or{@code null} if this is not a redirecting factory constructor. |
| 3429 * @return the name of the constructor to which this constructor will be redir
ected | 3398 * @return the name of the constructor to which this constructor will be redir
ected |
| 3430 */ | 3399 */ |
| 3431 ConstructorName get redirectedConstructor => _redirectedConstructor; | 3400 ConstructorName get redirectedConstructor => _redirectedConstructor; |
| 3432 | 3401 |
| 3433 /** | 3402 /** |
| 3434 * Return the type of object being created. This can be different than the typ
e in which the | 3403 * Return the type of object being created. This can be different than the typ
e in which the |
| 3435 * constructor is being declared if the constructor is the implementation of a
factory | 3404 * constructor is being declared if the constructor is the implementation of a
factory |
| 3436 * constructor. | 3405 * constructor. |
| 3437 * @return the type of object being created | 3406 * @return the type of object being created |
| 3438 */ | 3407 */ |
| 3439 Identifier get returnType => _returnType; | 3408 Identifier get returnType => _returnType; |
| 3440 | 3409 |
| 3441 /** | 3410 /** |
| 3442 * Return the token for the separator (colon or equals) before the initializer
s, or {@code null}if there are no initializers. | 3411 * Return the token for the separator (colon or equals) before the initializer
s, or {@code null}if there are no initializers. |
| 3443 * @return the token for the separator (colon or equals) before the initialize
rs | 3412 * @return the token for the separator (colon or equals) before the initialize
rs |
| 3444 */ | 3413 */ |
| 3445 Token get separator => _separator; | 3414 Token get separator => _separator; |
| 3446 | 3415 |
| 3447 /** | 3416 /** |
| 3448 * Set the body of the constructor to the given function body. | 3417 * Set the body of the constructor to the given function body. |
| 3449 * @param functionBody the body of the constructor | 3418 * @param functionBody the body of the constructor |
| 3450 */ | 3419 */ |
| 3451 void set body(FunctionBody functionBody) { | 3420 void set body(FunctionBody functionBody) { |
| 3452 _body = becomeParentOf(functionBody); | 3421 _body = becomeParentOf(functionBody); |
| 3453 } | 3422 } |
| 3454 | 3423 |
| 3455 /** | 3424 /** |
| 3456 * Set the token for the 'const' keyword to the given token. | 3425 * Set the token for the 'const' keyword to the given token. |
| 3457 * @param constKeyword the token for the 'const' keyword | 3426 * @param constKeyword the token for the 'const' keyword |
| 3458 */ | 3427 */ |
| 3459 void set constKeyword(Token constKeyword2) { | 3428 void set constKeyword(Token constKeyword2) { |
| 3460 this._constKeyword = constKeyword2; | 3429 this._constKeyword = constKeyword2; |
| 3461 } | 3430 } |
| 3462 | 3431 |
| 3463 /** | 3432 /** |
| 3464 * Set the element associated with this constructor to the given element. | 3433 * Set the element associated with this constructor to the given element. |
| 3465 * @param element the element associated with this constructor | 3434 * @param element the element associated with this constructor |
| 3466 */ | 3435 */ |
| 3467 void set element(ConstructorElement element2) { | 3436 void set element(ConstructorElement element2) { |
| 3468 this._element = element2; | 3437 this._element = element2; |
| 3469 } | 3438 } |
| 3470 | 3439 |
| 3471 /** | 3440 /** |
| 3472 * Set the token for the 'external' keyword to the given token. | 3441 * Set the token for the 'external' keyword to the given token. |
| 3473 * @param externalKeyword the token for the 'external' keyword | 3442 * @param externalKeyword the token for the 'external' keyword |
| 3474 */ | 3443 */ |
| 3475 void set externalKeyword(Token externalKeyword2) { | 3444 void set externalKeyword(Token externalKeyword2) { |
| 3476 this._externalKeyword = externalKeyword2; | 3445 this._externalKeyword = externalKeyword2; |
| 3477 } | 3446 } |
| 3478 | 3447 |
| 3479 /** | 3448 /** |
| 3480 * Set the token for the 'factory' keyword to the given token. | 3449 * Set the token for the 'factory' keyword to the given token. |
| 3481 * @param factoryKeyword the token for the 'factory' keyword | 3450 * @param factoryKeyword the token for the 'factory' keyword |
| 3482 */ | 3451 */ |
| 3483 void set factoryKeyword(Token factoryKeyword2) { | 3452 void set factoryKeyword(Token factoryKeyword2) { |
| 3484 this._factoryKeyword = factoryKeyword2; | 3453 this._factoryKeyword = factoryKeyword2; |
| 3485 } | 3454 } |
| 3486 | 3455 |
| 3487 /** | 3456 /** |
| 3488 * Set the name of the constructor to the given identifier. | 3457 * Set the name of the constructor to the given identifier. |
| 3489 * @param identifier the name of the constructor | 3458 * @param identifier the name of the constructor |
| 3490 */ | 3459 */ |
| 3491 void set name(SimpleIdentifier identifier) { | 3460 void set name(SimpleIdentifier identifier) { |
| 3492 _name = becomeParentOf(identifier); | 3461 _name = becomeParentOf(identifier); |
| 3493 } | 3462 } |
| 3494 | 3463 |
| 3495 /** | 3464 /** |
| 3496 * Set the parameters associated with the constructor to the given list of par
ameters. | 3465 * Set the parameters associated with the constructor to the given list of par
ameters. |
| 3497 * @param parameters the parameters associated with the constructor | 3466 * @param parameters the parameters associated with the constructor |
| 3498 */ | 3467 */ |
| 3499 void set parameters(FormalParameterList parameters2) { | 3468 void set parameters(FormalParameterList parameters2) { |
| 3500 this._parameters = becomeParentOf(parameters2); | 3469 this._parameters = becomeParentOf(parameters2); |
| 3501 } | 3470 } |
| 3502 | 3471 |
| 3503 /** | 3472 /** |
| 3504 * Set the token for the period before the constructor name to the given token
. | 3473 * Set the token for the period before the constructor name to the given token
. |
| 3505 * @param period the token for the period before the constructor name | 3474 * @param period the token for the period before the constructor name |
| 3506 */ | 3475 */ |
| 3507 void set period(Token period2) { | 3476 void set period(Token period2) { |
| 3508 this._period = period2; | 3477 this._period = period2; |
| 3509 } | 3478 } |
| 3510 | 3479 |
| 3511 /** | 3480 /** |
| 3512 * Set the name of the constructor to which this constructor will be redirecte
d to the given | 3481 * Set the name of the constructor to which this constructor will be redirecte
d to the given |
| 3513 * constructor name. | 3482 * constructor name. |
| 3514 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be | 3483 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be |
| 3515 * redirected | 3484 * redirected |
| 3516 */ | 3485 */ |
| 3517 void set redirectedConstructor(ConstructorName redirectedConstructor2) { | 3486 void set redirectedConstructor(ConstructorName redirectedConstructor2) { |
| 3518 this._redirectedConstructor = becomeParentOf(redirectedConstructor2); | 3487 this._redirectedConstructor = becomeParentOf(redirectedConstructor2); |
| 3519 } | 3488 } |
| 3520 | 3489 |
| 3521 /** | 3490 /** |
| 3522 * Set the type of object being created to the given type name. | 3491 * Set the type of object being created to the given type name. |
| 3523 * @param typeName the type of object being created | 3492 * @param typeName the type of object being created |
| 3524 */ | 3493 */ |
| 3525 void set returnType(Identifier typeName) { | 3494 void set returnType(Identifier typeName) { |
| 3526 _returnType = becomeParentOf(typeName); | 3495 _returnType = becomeParentOf(typeName); |
| 3527 } | 3496 } |
| 3528 | 3497 |
| 3529 /** | 3498 /** |
| 3530 * Set the token for the separator (colon or equals) before the initializers t
o the given token. | 3499 * Set the token for the separator (colon or equals) before the initializers t
o the given token. |
| 3531 * @param separator the token for the separator (colon or equals) before the i
nitializers | 3500 * @param separator the token for the separator (colon or equals) before the i
nitializers |
| 3532 */ | 3501 */ |
| 3533 void set separator(Token separator2) { | 3502 void set separator(Token separator2) { |
| 3534 this._separator = separator2; | 3503 this._separator = separator2; |
| 3535 } | 3504 } |
| 3536 void visitChildren(ASTVisitor<Object> visitor) { | 3505 void visitChildren(ASTVisitor<Object> visitor) { |
| 3537 super.visitChildren(visitor); | 3506 super.visitChildren(visitor); |
| 3538 safelyVisitChild(_returnType, visitor); | 3507 safelyVisitChild(_returnType, visitor); |
| 3539 safelyVisitChild(_name, visitor); | 3508 safelyVisitChild(_name, visitor); |
| 3540 safelyVisitChild(_parameters, visitor); | 3509 safelyVisitChild(_parameters, visitor); |
| 3541 _initializers.accept(visitor); | 3510 _initializers.accept(visitor); |
| 3542 safelyVisitChild(_redirectedConstructor, visitor); | 3511 safelyVisitChild(_redirectedConstructor, visitor); |
| 3543 safelyVisitChild(_body, visitor); | 3512 safelyVisitChild(_body, visitor); |
| 3544 } | 3513 } |
| 3545 Token get firstTokenAfterCommentAndMetadata { | 3514 Token get firstTokenAfterCommentAndMetadata { |
| 3546 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword
]); | 3515 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword
]); |
| 3547 if (leftMost2 != null) { | 3516 if (leftMost2 != null) { |
| 3548 return leftMost2; | 3517 return leftMost2; |
| 3549 } | 3518 } |
| 3550 return _returnType.beginToken; | 3519 return _returnType.beginToken; |
| 3551 } | 3520 } |
| 3552 | 3521 |
| 3553 /** | 3522 /** |
| 3554 * Return the left-most of the given tokens, or {@code null} if there are no t
okens given or if | 3523 * Return the left-most of the given tokens, or {@code null} if there are no t
okens given or if |
| 3555 * all of the given tokens are {@code null}. | 3524 * all of the given tokens are {@code null}. |
| 3556 * @param tokens the tokens being compared to find the left-most token | 3525 * @param tokens the tokens being compared to find the left-most token |
| 3557 * @return the left-most of the given tokens | 3526 * @return the left-most of the given tokens |
| 3558 */ | 3527 */ |
| 3559 Token leftMost(List<Token> tokens) { | 3528 Token leftMost(List<Token> tokens) { |
| 3560 Token leftMost = null; | 3529 Token leftMost = null; |
| 3561 int offset = 2147483647; | 3530 int offset = 2147483647; |
| 3562 for (Token token in tokens) { | 3531 for (Token token in tokens) { |
| 3563 if (token != null && token.offset < offset) { | 3532 if (token != null && token.offset < offset) { |
| 3564 leftMost = token; | 3533 leftMost = token; |
| 3565 } | 3534 } |
| 3566 } | 3535 } |
| 3567 return leftMost; | 3536 return leftMost; |
| 3568 } | 3537 } |
| 3569 } | 3538 } |
| 3570 | |
| 3571 /** | 3539 /** |
| 3572 * Instances of the class {@code ConstructorFieldInitializer} represent the init
ialization of a | 3540 * Instances of the class {@code ConstructorFieldInitializer} represent the init
ialization of a |
| 3573 * field within a constructor's initialization list. | 3541 * field within a constructor's initialization list. |
| 3574 * <pre> | 3542 * <pre> |
| 3575 * fieldInitializer ::= | 3543 * fieldInitializer ::= |
| 3576 * ('this' '.')? {@link SimpleIdentifier fieldName} '=' {@link Expression condit
ionalExpression cascadeSection*}</pre> | 3544 * ('this' '.')? {@link SimpleIdentifier fieldName} '=' {@link Expression condit
ionalExpression cascadeSection*}</pre> |
| 3577 * @coverage dart.engine.ast | 3545 * @coverage dart.engine.ast |
| 3578 */ | 3546 */ |
| 3579 class ConstructorFieldInitializer extends ConstructorInitializer { | 3547 class ConstructorFieldInitializer extends ConstructorInitializer { |
| 3580 | 3548 |
| 3581 /** | 3549 /** |
| 3582 * The token for the 'this' keyword, or {@code null} if there is no 'this' key
word. | 3550 * The token for the 'this' keyword, or {@code null} if there is no 'this' key
word. |
| 3583 */ | 3551 */ |
| 3584 Token _keyword; | 3552 Token _keyword; |
| 3585 | 3553 |
| 3586 /** | 3554 /** |
| 3587 * The token for the period after the 'this' keyword, or {@code null} if there
is no 'this' | 3555 * The token for the period after the 'this' keyword, or {@code null} if there
is no 'this' |
| 3588 * keyword. | 3556 * keyword. |
| 3589 */ | 3557 */ |
| 3590 Token _period; | 3558 Token _period; |
| 3591 | 3559 |
| 3592 /** | 3560 /** |
| 3593 * The name of the field being initialized. | 3561 * The name of the field being initialized. |
| 3594 */ | 3562 */ |
| 3595 SimpleIdentifier _fieldName; | 3563 SimpleIdentifier _fieldName; |
| 3596 | 3564 |
| 3597 /** | 3565 /** |
| 3598 * The token for the equal sign between the field name and the expression. | 3566 * The token for the equal sign between the field name and the expression. |
| 3599 */ | 3567 */ |
| 3600 Token _equals; | 3568 Token _equals; |
| 3601 | 3569 |
| 3602 /** | 3570 /** |
| 3603 * The expression computing the value to which the field will be initialized. | 3571 * The expression computing the value to which the field will be initialized. |
| 3604 */ | 3572 */ |
| 3605 Expression _expression; | 3573 Expression _expression; |
| 3606 | 3574 |
| 3607 /** | 3575 /** |
| 3608 * Initialize a newly created field initializer to initialize the field with t
he given name to the | 3576 * Initialize a newly created field initializer to initialize the field with t
he given name to the |
| 3609 * value of the given expression. | 3577 * value of the given expression. |
| 3610 * @param keyword the token for the 'this' keyword | 3578 * @param keyword the token for the 'this' keyword |
| 3611 * @param period the token for the period after the 'this' keyword | 3579 * @param period the token for the period after the 'this' keyword |
| 3612 * @param fieldName the name of the field being initialized | 3580 * @param fieldName the name of the field being initialized |
| 3613 * @param equals the token for the equal sign between the field name and the e
xpression | 3581 * @param equals the token for the equal sign between the field name and the e
xpression |
| 3614 * @param expression the expression computing the value to which the field wil
l be initialized | 3582 * @param expression the expression computing the value to which the field wil
l be initialized |
| 3615 */ | 3583 */ |
| 3616 ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier
fieldName, Token equals, Expression expression) { | 3584 ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier
fieldName, Token equals, Expression expression) { |
| 3617 this._keyword = keyword; | 3585 this._keyword = keyword; |
| 3618 this._period = period; | 3586 this._period = period; |
| 3619 this._fieldName = becomeParentOf(fieldName); | 3587 this._fieldName = becomeParentOf(fieldName); |
| 3620 this._equals = equals; | 3588 this._equals = equals; |
| 3621 this._expression = becomeParentOf(expression); | 3589 this._expression = becomeParentOf(expression); |
| 3622 } | 3590 } |
| 3623 | 3591 |
| 3624 /** | 3592 /** |
| 3625 * Initialize a newly created field initializer to initialize the field with t
he given name to the | 3593 * Initialize a newly created field initializer to initialize the field with t
he given name to the |
| 3626 * value of the given expression. | 3594 * value of the given expression. |
| 3627 * @param keyword the token for the 'this' keyword | 3595 * @param keyword the token for the 'this' keyword |
| 3628 * @param period the token for the period after the 'this' keyword | 3596 * @param period the token for the period after the 'this' keyword |
| 3629 * @param fieldName the name of the field being initialized | 3597 * @param fieldName the name of the field being initialized |
| 3630 * @param equals the token for the equal sign between the field name and the e
xpression | 3598 * @param equals the token for the equal sign between the field name and the e
xpression |
| 3631 * @param expression the expression computing the value to which the field wil
l be initialized | 3599 * @param expression the expression computing the value to which the field wil
l be initialized |
| 3632 */ | 3600 */ |
| 3633 ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fie
ldName, Token equals, Expression expression}) : this.full(keyword, period, field
Name, equals, expression); | 3601 ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fie
ldName, Token equals, Expression expression}) : this.full(keyword, period, field
Name, equals, expression); |
| 3634 accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this); | 3602 accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this); |
| 3635 Token get beginToken { | 3603 Token get beginToken { |
| 3636 if (_keyword != null) { | 3604 if (_keyword != null) { |
| 3637 return _keyword; | 3605 return _keyword; |
| 3638 } | 3606 } |
| 3639 return _fieldName.beginToken; | 3607 return _fieldName.beginToken; |
| 3640 } | 3608 } |
| 3641 Token get endToken => _expression.endToken; | 3609 Token get endToken => _expression.endToken; |
| 3642 | 3610 |
| 3643 /** | 3611 /** |
| 3644 * Return the token for the equal sign between the field name and the expressi
on. | 3612 * Return the token for the equal sign between the field name and the expressi
on. |
| 3645 * @return the token for the equal sign between the field name and the express
ion | 3613 * @return the token for the equal sign between the field name and the express
ion |
| 3646 */ | 3614 */ |
| 3647 Token get equals => _equals; | 3615 Token get equals => _equals; |
| 3648 | 3616 |
| 3649 /** | 3617 /** |
| 3650 * Return the expression computing the value to which the field will be initia
lized. | 3618 * Return the expression computing the value to which the field will be initia
lized. |
| 3651 * @return the expression computing the value to which the field will be initi
alized | 3619 * @return the expression computing the value to which the field will be initi
alized |
| 3652 */ | 3620 */ |
| 3653 Expression get expression => _expression; | 3621 Expression get expression => _expression; |
| 3654 | 3622 |
| 3655 /** | 3623 /** |
| 3656 * Return the name of the field being initialized. | 3624 * Return the name of the field being initialized. |
| 3657 * @return the name of the field being initialized | 3625 * @return the name of the field being initialized |
| 3658 */ | 3626 */ |
| 3659 SimpleIdentifier get fieldName => _fieldName; | 3627 SimpleIdentifier get fieldName => _fieldName; |
| 3660 | 3628 |
| 3661 /** | 3629 /** |
| 3662 * Return the token for the 'this' keyword, or {@code null} if there is no 'th
is' keyword. | 3630 * Return the token for the 'this' keyword, or {@code null} if there is no 'th
is' keyword. |
| 3663 * @return the token for the 'this' keyword | 3631 * @return the token for the 'this' keyword |
| 3664 */ | 3632 */ |
| 3665 Token get keyword => _keyword; | 3633 Token get keyword => _keyword; |
| 3666 | 3634 |
| 3667 /** | 3635 /** |
| 3668 * Return the token for the period after the 'this' keyword, or {@code null} i
f there is no 'this' | 3636 * Return the token for the period after the 'this' keyword, or {@code null} i
f there is no 'this' |
| 3669 * keyword. | 3637 * keyword. |
| 3670 * @return the token for the period after the 'this' keyword | 3638 * @return the token for the period after the 'this' keyword |
| 3671 */ | 3639 */ |
| 3672 Token get period => _period; | 3640 Token get period => _period; |
| 3673 | 3641 |
| 3674 /** | 3642 /** |
| 3675 * Set the token for the equal sign between the field name and the expression
to the given token. | 3643 * Set the token for the equal sign between the field name and the expression
to the given token. |
| 3676 * @param equals the token for the equal sign between the field name and the e
xpression | 3644 * @param equals the token for the equal sign between the field name and the e
xpression |
| 3677 */ | 3645 */ |
| 3678 void set equals(Token equals2) { | 3646 void set equals(Token equals2) { |
| 3679 this._equals = equals2; | 3647 this._equals = equals2; |
| 3680 } | 3648 } |
| 3681 | 3649 |
| 3682 /** | 3650 /** |
| 3683 * Set the expression computing the value to which the field will be initializ
ed to the given | 3651 * Set the expression computing the value to which the field will be initializ
ed to the given |
| 3684 * expression. | 3652 * expression. |
| 3685 * @param expression the expression computing the value to which the field wil
l be initialized | 3653 * @param expression the expression computing the value to which the field wil
l be initialized |
| 3686 */ | 3654 */ |
| 3687 void set expression(Expression expression2) { | 3655 void set expression(Expression expression2) { |
| 3688 this._expression = becomeParentOf(expression2); | 3656 this._expression = becomeParentOf(expression2); |
| 3689 } | 3657 } |
| 3690 | 3658 |
| 3691 /** | 3659 /** |
| 3692 * Set the name of the field being initialized to the given identifier. | 3660 * Set the name of the field being initialized to the given identifier. |
| 3693 * @param identifier the name of the field being initialized | 3661 * @param identifier the name of the field being initialized |
| 3694 */ | 3662 */ |
| 3695 void set fieldName(SimpleIdentifier identifier) { | 3663 void set fieldName(SimpleIdentifier identifier) { |
| 3696 _fieldName = becomeParentOf(identifier); | 3664 _fieldName = becomeParentOf(identifier); |
| 3697 } | 3665 } |
| 3698 | 3666 |
| 3699 /** | 3667 /** |
| 3700 * Set the token for the 'this' keyword to the given token. | 3668 * Set the token for the 'this' keyword to the given token. |
| 3701 * @param keyword the token for the 'this' keyword | 3669 * @param keyword the token for the 'this' keyword |
| 3702 */ | 3670 */ |
| 3703 void set keyword(Token keyword2) { | 3671 void set keyword(Token keyword2) { |
| 3704 this._keyword = keyword2; | 3672 this._keyword = keyword2; |
| 3705 } | 3673 } |
| 3706 | 3674 |
| 3707 /** | 3675 /** |
| 3708 * Set the token for the period after the 'this' keyword to the given token. | 3676 * Set the token for the period after the 'this' keyword to the given token. |
| 3709 * @param period the token for the period after the 'this' keyword | 3677 * @param period the token for the period after the 'this' keyword |
| 3710 */ | 3678 */ |
| 3711 void set period(Token period2) { | 3679 void set period(Token period2) { |
| 3712 this._period = period2; | 3680 this._period = period2; |
| 3713 } | 3681 } |
| 3714 void visitChildren(ASTVisitor<Object> visitor) { | 3682 void visitChildren(ASTVisitor<Object> visitor) { |
| 3715 safelyVisitChild(_fieldName, visitor); | 3683 safelyVisitChild(_fieldName, visitor); |
| 3716 safelyVisitChild(_expression, visitor); | 3684 safelyVisitChild(_expression, visitor); |
| 3717 } | 3685 } |
| 3718 } | 3686 } |
| 3719 | |
| 3720 /** | 3687 /** |
| 3721 * Instances of the class {@code ConstructorInitializer} defines the behavior of
nodes that can | 3688 * Instances of the class {@code ConstructorInitializer} defines the behavior of
nodes that can |
| 3722 * occur in the initializer list of a constructor declaration. | 3689 * occur in the initializer list of a constructor declaration. |
| 3723 * <pre> | 3690 * <pre> |
| 3724 * constructorInitializer ::={@link SuperConstructorInvocation superInvocation}|
{@link ConstructorFieldInitializer fieldInitializer}</pre> | 3691 * constructorInitializer ::={@link SuperConstructorInvocation superInvocation}|
{@link ConstructorFieldInitializer fieldInitializer}</pre> |
| 3725 * @coverage dart.engine.ast | 3692 * @coverage dart.engine.ast |
| 3726 */ | 3693 */ |
| 3727 abstract class ConstructorInitializer extends ASTNode { | 3694 abstract class ConstructorInitializer extends ASTNode { |
| 3728 } | 3695 } |
| 3729 | |
| 3730 /** | 3696 /** |
| 3731 * Instances of the class {@code ConstructorName} represent the name of the cons
tructor. | 3697 * Instances of the class {@code ConstructorName} represent the name of the cons
tructor. |
| 3732 * <pre> | 3698 * <pre> |
| 3733 * constructorName: | 3699 * constructorName: |
| 3734 * type ('.' identifier)? | 3700 * type ('.' identifier)? |
| 3735 * </pre> | 3701 * </pre> |
| 3736 * @coverage dart.engine.ast | 3702 * @coverage dart.engine.ast |
| 3737 */ | 3703 */ |
| 3738 class ConstructorName extends ASTNode { | 3704 class ConstructorName extends ASTNode { |
| 3739 | 3705 |
| 3740 /** | 3706 /** |
| 3741 * The name of the type defining the constructor. | 3707 * The name of the type defining the constructor. |
| 3742 */ | 3708 */ |
| 3743 TypeName _type; | 3709 TypeName _type; |
| 3744 | 3710 |
| 3745 /** | 3711 /** |
| 3746 * The token for the period before the constructor name, or {@code null} if th
e specified | 3712 * The token for the period before the constructor name, or {@code null} if th
e specified |
| 3747 * constructor is the unnamed constructor. | 3713 * constructor is the unnamed constructor. |
| 3748 */ | 3714 */ |
| 3749 Token _period; | 3715 Token _period; |
| 3750 | 3716 |
| 3751 /** | 3717 /** |
| 3752 * The name of the constructor, or {@code null} if the specified constructor i
s the unnamed | 3718 * The name of the constructor, or {@code null} if the specified constructor i
s the unnamed |
| 3753 * constructor. | 3719 * constructor. |
| 3754 */ | 3720 */ |
| 3755 SimpleIdentifier _name; | 3721 SimpleIdentifier _name; |
| 3756 | 3722 |
| 3757 /** | 3723 /** |
| 3758 * The element associated with this constructor name based on static type info
rmation, or{@code null} if the AST structure has not been resolved or if this co
nstructor name could not | 3724 * The element associated with this constructor name based on static type info
rmation, or{@code null} if the AST structure has not been resolved or if this co
nstructor name could not |
| 3759 * be resolved. | 3725 * be resolved. |
| 3760 */ | 3726 */ |
| 3761 ConstructorElement _staticElement; | 3727 ConstructorElement _staticElement; |
| 3762 | 3728 |
| 3763 /** | 3729 /** |
| 3764 * The element associated with this constructor name based on propagated type
information, or{@code null} if the AST structure has not been resolved or if thi
s constructor name could not | 3730 * The element associated with this constructor name based on propagated type
information, or{@code null} if the AST structure has not been resolved or if thi
s constructor name could not |
| 3765 * be resolved. | 3731 * be resolved. |
| 3766 */ | 3732 */ |
| 3767 ConstructorElement _propagatedElement; | 3733 ConstructorElement _propagatedElement; |
| 3768 | 3734 |
| 3769 /** | 3735 /** |
| 3770 * Initialize a newly created constructor name. | 3736 * Initialize a newly created constructor name. |
| 3771 * @param type the name of the type defining the constructor | 3737 * @param type the name of the type defining the constructor |
| 3772 * @param period the token for the period before the constructor name | 3738 * @param period the token for the period before the constructor name |
| 3773 * @param name the name of the constructor | 3739 * @param name the name of the constructor |
| 3774 */ | 3740 */ |
| 3775 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) { | 3741 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) { |
| 3776 this._type = becomeParentOf(type); | 3742 this._type = becomeParentOf(type); |
| 3777 this._period = period; | 3743 this._period = period; |
| 3778 this._name = becomeParentOf(name); | 3744 this._name = becomeParentOf(name); |
| 3779 } | 3745 } |
| 3780 | 3746 |
| 3781 /** | 3747 /** |
| 3782 * Initialize a newly created constructor name. | 3748 * Initialize a newly created constructor name. |
| 3783 * @param type the name of the type defining the constructor | 3749 * @param type the name of the type defining the constructor |
| 3784 * @param period the token for the period before the constructor name | 3750 * @param period the token for the period before the constructor name |
| 3785 * @param name the name of the constructor | 3751 * @param name the name of the constructor |
| 3786 */ | 3752 */ |
| 3787 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f
ull(type, period, name); | 3753 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f
ull(type, period, name); |
| 3788 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); | 3754 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); |
| 3789 Token get beginToken => _type.beginToken; | 3755 Token get beginToken => _type.beginToken; |
| 3790 | 3756 |
| 3791 /** | 3757 /** |
| 3792 * Return the element associated with this constructor name based on propagate
d type information, | 3758 * Return the element associated with this constructor name based on propagate
d type information, |
| 3793 * or {@code null} if the AST structure has not been resolved or if this const
ructor name could | 3759 * or {@code null} if the AST structure has not been resolved or if this const
ructor name could |
| 3794 * not be resolved. | 3760 * not be resolved. |
| 3795 * @return the element associated with this constructor name | 3761 * @return the element associated with this constructor name |
| 3796 */ | 3762 */ |
| 3797 ConstructorElement get element => _propagatedElement; | 3763 ConstructorElement get element => _propagatedElement; |
| 3798 Token get endToken { | 3764 Token get endToken { |
| 3799 if (_name != null) { | 3765 if (_name != null) { |
| 3800 return _name.endToken; | 3766 return _name.endToken; |
| 3801 } | 3767 } |
| 3802 return _type.endToken; | 3768 return _type.endToken; |
| 3803 } | 3769 } |
| 3804 | 3770 |
| 3805 /** | 3771 /** |
| 3806 * Return the name of the constructor, or {@code null} if the specified constr
uctor is the unnamed | 3772 * Return the name of the constructor, or {@code null} if the specified constr
uctor is the unnamed |
| 3807 * constructor. | 3773 * constructor. |
| 3808 * @return the name of the constructor | 3774 * @return the name of the constructor |
| 3809 */ | 3775 */ |
| 3810 SimpleIdentifier get name => _name; | 3776 SimpleIdentifier get name => _name; |
| 3811 | 3777 |
| 3812 /** | 3778 /** |
| 3813 * Return the token for the period before the constructor name, or {@code null
} if the specified | 3779 * Return the token for the period before the constructor name, or {@code null
} if the specified |
| 3814 * constructor is the unnamed constructor. | 3780 * constructor is the unnamed constructor. |
| 3815 * @return the token for the period before the constructor name | 3781 * @return the token for the period before the constructor name |
| 3816 */ | 3782 */ |
| 3817 Token get period => _period; | 3783 Token get period => _period; |
| 3818 | 3784 |
| 3819 /** | 3785 /** |
| 3820 * Return the element associated with this constructor name based on static ty
pe information, or{@code null} if the AST structure has not been resolved or if
this constructor name could not | 3786 * Return the element associated with this constructor name based on static ty
pe information, or{@code null} if the AST structure has not been resolved or if
this constructor name could not |
| 3821 * be resolved. | 3787 * be resolved. |
| 3822 * @return the element associated with this constructor name | 3788 * @return the element associated with this constructor name |
| 3823 */ | 3789 */ |
| 3824 ConstructorElement get staticElement => _staticElement; | 3790 ConstructorElement get staticElement => _staticElement; |
| 3825 | 3791 |
| 3826 /** | 3792 /** |
| 3827 * Return the name of the type defining the constructor. | 3793 * Return the name of the type defining the constructor. |
| 3828 * @return the name of the type defining the constructor | 3794 * @return the name of the type defining the constructor |
| 3829 */ | 3795 */ |
| 3830 TypeName get type => _type; | 3796 TypeName get type => _type; |
| 3831 | 3797 |
| 3832 /** | 3798 /** |
| 3833 * Set the element associated with this constructor name based on propagated t
ype information to | 3799 * Set the element associated with this constructor name based on propagated t
ype information to |
| 3834 * the given element. | 3800 * the given element. |
| 3835 * @param element the element to be associated with this constructor name | 3801 * @param element the element to be associated with this constructor name |
| 3836 */ | 3802 */ |
| 3837 void set element(ConstructorElement element2) { | 3803 void set element(ConstructorElement element2) { |
| 3838 _propagatedElement = element2; | 3804 _propagatedElement = element2; |
| 3839 } | 3805 } |
| 3840 | 3806 |
| 3841 /** | 3807 /** |
| 3842 * Set the name of the constructor to the given name. | 3808 * Set the name of the constructor to the given name. |
| 3843 * @param name the name of the constructor | 3809 * @param name the name of the constructor |
| 3844 */ | 3810 */ |
| 3845 void set name(SimpleIdentifier name2) { | 3811 void set name(SimpleIdentifier name2) { |
| 3846 this._name = becomeParentOf(name2); | 3812 this._name = becomeParentOf(name2); |
| 3847 } | 3813 } |
| 3848 | 3814 |
| 3849 /** | 3815 /** |
| 3850 * Return the token for the period before the constructor name to the given to
ken. | 3816 * Return the token for the period before the constructor name to the given to
ken. |
| 3851 * @param period the token for the period before the constructor name | 3817 * @param period the token for the period before the constructor name |
| 3852 */ | 3818 */ |
| 3853 void set period(Token period2) { | 3819 void set period(Token period2) { |
| 3854 this._period = period2; | 3820 this._period = period2; |
| 3855 } | 3821 } |
| 3856 | 3822 |
| 3857 /** | 3823 /** |
| 3858 * Set the element associated with this constructor name based on static type
information to the | 3824 * Set the element associated with this constructor name based on static type
information to the |
| 3859 * given element. | 3825 * given element. |
| 3860 * @param element the element to be associated with this constructor name | 3826 * @param element the element to be associated with this constructor name |
| 3861 */ | 3827 */ |
| 3862 void set staticElement(ConstructorElement element) { | 3828 void set staticElement(ConstructorElement element) { |
| 3863 _staticElement = element; | 3829 _staticElement = element; |
| 3864 } | 3830 } |
| 3865 | 3831 |
| 3866 /** | 3832 /** |
| 3867 * Set the name of the type defining the constructor to the given type name. | 3833 * Set the name of the type defining the constructor to the given type name. |
| 3868 * @param type the name of the type defining the constructor | 3834 * @param type the name of the type defining the constructor |
| 3869 */ | 3835 */ |
| 3870 void set type(TypeName type2) { | 3836 void set type(TypeName type2) { |
| 3871 this._type = becomeParentOf(type2); | 3837 this._type = becomeParentOf(type2); |
| 3872 } | 3838 } |
| 3873 void visitChildren(ASTVisitor<Object> visitor) { | 3839 void visitChildren(ASTVisitor<Object> visitor) { |
| 3874 safelyVisitChild(_type, visitor); | 3840 safelyVisitChild(_type, visitor); |
| 3875 safelyVisitChild(_name, visitor); | 3841 safelyVisitChild(_name, visitor); |
| 3876 } | 3842 } |
| 3877 } | 3843 } |
| 3878 | |
| 3879 /** | 3844 /** |
| 3880 * Instances of the class {@code ContinueStatement} represent a continue stateme
nt. | 3845 * Instances of the class {@code ContinueStatement} represent a continue stateme
nt. |
| 3881 * <pre> | 3846 * <pre> |
| 3882 * continueStatement ::= | 3847 * continueStatement ::= |
| 3883 * 'continue' {@link SimpleIdentifier label}? ';' | 3848 * 'continue' {@link SimpleIdentifier label}? ';' |
| 3884 * </pre> | 3849 * </pre> |
| 3885 * @coverage dart.engine.ast | 3850 * @coverage dart.engine.ast |
| 3886 */ | 3851 */ |
| 3887 class ContinueStatement extends Statement { | 3852 class ContinueStatement extends Statement { |
| 3888 | 3853 |
| 3889 /** | 3854 /** |
| 3890 * The token representing the 'continue' keyword. | 3855 * The token representing the 'continue' keyword. |
| 3891 */ | 3856 */ |
| 3892 Token _keyword; | 3857 Token _keyword; |
| 3893 | 3858 |
| 3894 /** | 3859 /** |
| 3895 * The label associated with the statement, or {@code null} if there is no lab
el. | 3860 * The label associated with the statement, or {@code null} if there is no lab
el. |
| 3896 */ | 3861 */ |
| 3897 SimpleIdentifier _label; | 3862 SimpleIdentifier _label; |
| 3898 | 3863 |
| 3899 /** | 3864 /** |
| 3900 * The semicolon terminating the statement. | 3865 * The semicolon terminating the statement. |
| 3901 */ | 3866 */ |
| 3902 Token _semicolon; | 3867 Token _semicolon; |
| 3903 | 3868 |
| 3904 /** | 3869 /** |
| 3905 * Initialize a newly created continue statement. | 3870 * Initialize a newly created continue statement. |
| 3906 * @param keyword the token representing the 'continue' keyword | 3871 * @param keyword the token representing the 'continue' keyword |
| 3907 * @param label the label associated with the statement | 3872 * @param label the label associated with the statement |
| 3908 * @param semicolon the semicolon terminating the statement | 3873 * @param semicolon the semicolon terminating the statement |
| 3909 */ | 3874 */ |
| 3910 ContinueStatement.full(Token keyword, SimpleIdentifier label, Token semicolon)
{ | 3875 ContinueStatement.full(Token keyword, SimpleIdentifier label, Token semicolon)
{ |
| 3911 this._keyword = keyword; | 3876 this._keyword = keyword; |
| 3912 this._label = becomeParentOf(label); | 3877 this._label = becomeParentOf(label); |
| 3913 this._semicolon = semicolon; | 3878 this._semicolon = semicolon; |
| 3914 } | 3879 } |
| 3915 | 3880 |
| 3916 /** | 3881 /** |
| 3917 * Initialize a newly created continue statement. | 3882 * Initialize a newly created continue statement. |
| 3918 * @param keyword the token representing the 'continue' keyword | 3883 * @param keyword the token representing the 'continue' keyword |
| 3919 * @param label the label associated with the statement | 3884 * @param label the label associated with the statement |
| 3920 * @param semicolon the semicolon terminating the statement | 3885 * @param semicolon the semicolon terminating the statement |
| 3921 */ | 3886 */ |
| 3922 ContinueStatement({Token keyword, SimpleIdentifier label, Token semicolon}) :
this.full(keyword, label, semicolon); | 3887 ContinueStatement({Token keyword, SimpleIdentifier label, Token semicolon}) :
this.full(keyword, label, semicolon); |
| 3923 accept(ASTVisitor visitor) => visitor.visitContinueStatement(this); | 3888 accept(ASTVisitor visitor) => visitor.visitContinueStatement(this); |
| 3924 Token get beginToken => _keyword; | 3889 Token get beginToken => _keyword; |
| 3925 Token get endToken => _semicolon; | 3890 Token get endToken => _semicolon; |
| 3926 | 3891 |
| 3927 /** | 3892 /** |
| 3928 * Return the token representing the 'continue' keyword. | 3893 * Return the token representing the 'continue' keyword. |
| 3929 * @return the token representing the 'continue' keyword | 3894 * @return the token representing the 'continue' keyword |
| 3930 */ | 3895 */ |
| 3931 Token get keyword => _keyword; | 3896 Token get keyword => _keyword; |
| 3932 | 3897 |
| 3933 /** | 3898 /** |
| 3934 * Return the label associated with the statement, or {@code null} if there is
no label. | 3899 * Return the label associated with the statement, or {@code null} if there is
no label. |
| 3935 * @return the label associated with the statement | 3900 * @return the label associated with the statement |
| 3936 */ | 3901 */ |
| 3937 SimpleIdentifier get label => _label; | 3902 SimpleIdentifier get label => _label; |
| 3938 | 3903 |
| 3939 /** | 3904 /** |
| 3940 * Return the semicolon terminating the statement. | 3905 * Return the semicolon terminating the statement. |
| 3941 * @return the semicolon terminating the statement | 3906 * @return the semicolon terminating the statement |
| 3942 */ | 3907 */ |
| 3943 Token get semicolon => _semicolon; | 3908 Token get semicolon => _semicolon; |
| 3944 | 3909 |
| 3945 /** | 3910 /** |
| 3946 * Set the token representing the 'continue' keyword to the given token. | 3911 * Set the token representing the 'continue' keyword to the given token. |
| 3947 * @param keyword the token representing the 'continue' keyword | 3912 * @param keyword the token representing the 'continue' keyword |
| 3948 */ | 3913 */ |
| 3949 void set keyword(Token keyword2) { | 3914 void set keyword(Token keyword2) { |
| 3950 this._keyword = keyword2; | 3915 this._keyword = keyword2; |
| 3951 } | 3916 } |
| 3952 | 3917 |
| 3953 /** | 3918 /** |
| 3954 * Set the label associated with the statement to the given label. | 3919 * Set the label associated with the statement to the given label. |
| 3955 * @param identifier the label associated with the statement | 3920 * @param identifier the label associated with the statement |
| 3956 */ | 3921 */ |
| 3957 void set label(SimpleIdentifier identifier) { | 3922 void set label(SimpleIdentifier identifier) { |
| 3958 _label = becomeParentOf(identifier); | 3923 _label = becomeParentOf(identifier); |
| 3959 } | 3924 } |
| 3960 | 3925 |
| 3961 /** | 3926 /** |
| 3962 * Set the semicolon terminating the statement to the given token. | 3927 * Set the semicolon terminating the statement to the given token. |
| 3963 * @param semicolon the semicolon terminating the statement | 3928 * @param semicolon the semicolon terminating the statement |
| 3964 */ | 3929 */ |
| 3965 void set semicolon(Token semicolon2) { | 3930 void set semicolon(Token semicolon2) { |
| 3966 this._semicolon = semicolon2; | 3931 this._semicolon = semicolon2; |
| 3967 } | 3932 } |
| 3968 void visitChildren(ASTVisitor<Object> visitor) { | 3933 void visitChildren(ASTVisitor<Object> visitor) { |
| 3969 safelyVisitChild(_label, visitor); | 3934 safelyVisitChild(_label, visitor); |
| 3970 } | 3935 } |
| 3971 } | 3936 } |
| 3972 | |
| 3973 /** | 3937 /** |
| 3974 * The abstract class {@code Declaration} defines the behavior common to nodes t
hat represent the | 3938 * The abstract class {@code Declaration} defines the behavior common to nodes t
hat represent the |
| 3975 * declaration of a name. Each declared name is visible within a name scope. | 3939 * declaration of a name. Each declared name is visible within a name scope. |
| 3976 * @coverage dart.engine.ast | 3940 * @coverage dart.engine.ast |
| 3977 */ | 3941 */ |
| 3978 abstract class Declaration extends AnnotatedNode { | 3942 abstract class Declaration extends AnnotatedNode { |
| 3979 | 3943 |
| 3980 /** | 3944 /** |
| 3981 * Initialize a newly created declaration. | 3945 * Initialize a newly created declaration. |
| 3982 * @param comment the documentation comment associated with this declaration | 3946 * @param comment the documentation comment associated with this declaration |
| 3983 * @param metadata the annotations associated with this declaration | 3947 * @param metadata the annotations associated with this declaration |
| 3984 */ | 3948 */ |
| 3985 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { | 3949 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { |
| 3986 } | 3950 } |
| 3987 | 3951 |
| 3988 /** | 3952 /** |
| 3989 * Initialize a newly created declaration. | 3953 * Initialize a newly created declaration. |
| 3990 * @param comment the documentation comment associated with this declaration | 3954 * @param comment the documentation comment associated with this declaration |
| 3991 * @param metadata the annotations associated with this declaration | 3955 * @param metadata the annotations associated with this declaration |
| 3992 */ | 3956 */ |
| 3993 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); | 3957 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); |
| 3994 | 3958 |
| 3995 /** | 3959 /** |
| 3996 * Return the element associated with this declaration, or {@code null} if eit
her this node | 3960 * Return the element associated with this declaration, or {@code null} if eit
her this node |
| 3997 * corresponds to a list of declarations or if the AST structure has not been
resolved. | 3961 * corresponds to a list of declarations or if the AST structure has not been
resolved. |
| 3998 * @return the element associated with this declaration | 3962 * @return the element associated with this declaration |
| 3999 */ | 3963 */ |
| 4000 Element get element; | 3964 Element get element; |
| 4001 } | 3965 } |
| 4002 | |
| 4003 /** | 3966 /** |
| 4004 * Instances of the class {@code DeclaredIdentifier} represent the declaration o
f a single | 3967 * Instances of the class {@code DeclaredIdentifier} represent the declaration o
f a single |
| 4005 * identifier. | 3968 * identifier. |
| 4006 * <pre> | 3969 * <pre> |
| 4007 * declaredIdentifier ::= | 3970 * declaredIdentifier ::= |
| 4008 * ({@link Annotation metadata} finalConstVarOrType {@link SimpleIdentifier iden
tifier}</pre> | 3971 * ({@link Annotation metadata} finalConstVarOrType {@link SimpleIdentifier iden
tifier}</pre> |
| 4009 * @coverage dart.engine.ast | 3972 * @coverage dart.engine.ast |
| 4010 */ | 3973 */ |
| 4011 class DeclaredIdentifier extends Declaration { | 3974 class DeclaredIdentifier extends Declaration { |
| 4012 | 3975 |
| 4013 /** | 3976 /** |
| 4014 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 3977 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
| 4015 * keyword was used. | 3978 * keyword was used. |
| 4016 */ | 3979 */ |
| 4017 Token _keyword; | 3980 Token _keyword; |
| 4018 | 3981 |
| 4019 /** | 3982 /** |
| 4020 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have | 3983 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have |
| 4021 * a declared type. | 3984 * a declared type. |
| 4022 */ | 3985 */ |
| 4023 TypeName _type; | 3986 TypeName _type; |
| 4024 | 3987 |
| 4025 /** | 3988 /** |
| 4026 * The name of the variable being declared. | 3989 * The name of the variable being declared. |
| 4027 */ | 3990 */ |
| 4028 SimpleIdentifier _identifier; | 3991 SimpleIdentifier _identifier; |
| 4029 | 3992 |
| 4030 /** | 3993 /** |
| 4031 * Initialize a newly created formal parameter. | 3994 * Initialize a newly created formal parameter. |
| 4032 * @param comment the documentation comment associated with this parameter | 3995 * @param comment the documentation comment associated with this parameter |
| 4033 * @param metadata the annotations associated with this parameter | 3996 * @param metadata the annotations associated with this parameter |
| 4034 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 3997 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 4035 * @param type the name of the declared type of the parameter | 3998 * @param type the name of the declared type of the parameter |
| 4036 * @param identifier the name of the parameter being declared | 3999 * @param identifier the name of the parameter being declared |
| 4037 */ | 4000 */ |
| 4038 DeclaredIdentifier.full(Comment comment, List<Annotation> metadata, Token keyw
ord, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata)
{ | 4001 DeclaredIdentifier.full(Comment comment, List<Annotation> metadata, Token keyw
ord, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata)
{ |
| 4039 this._keyword = keyword; | 4002 this._keyword = keyword; |
| 4040 this._type = becomeParentOf(type); | 4003 this._type = becomeParentOf(type); |
| 4041 this._identifier = becomeParentOf(identifier); | 4004 this._identifier = becomeParentOf(identifier); |
| 4042 } | 4005 } |
| 4043 | 4006 |
| 4044 /** | 4007 /** |
| 4045 * Initialize a newly created formal parameter. | 4008 * Initialize a newly created formal parameter. |
| 4046 * @param comment the documentation comment associated with this parameter | 4009 * @param comment the documentation comment associated with this parameter |
| 4047 * @param metadata the annotations associated with this parameter | 4010 * @param metadata the annotations associated with this parameter |
| 4048 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4011 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 4049 * @param type the name of the declared type of the parameter | 4012 * @param type the name of the declared type of the parameter |
| 4050 * @param identifier the name of the parameter being declared | 4013 * @param identifier the name of the parameter being declared |
| 4051 */ | 4014 */ |
| 4052 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); | 4015 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); |
| 4053 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); | 4016 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); |
| 4054 LocalVariableElement get element { | 4017 LocalVariableElement get element { |
| 4055 SimpleIdentifier identifier2 = identifier; | 4018 SimpleIdentifier identifier2 = identifier; |
| 4056 if (identifier2 == null) { | 4019 if (identifier2 == null) { |
| 4057 return null; | 4020 return null; |
| 4058 } | 4021 } |
| 4059 return identifier2.element as LocalVariableElement; | 4022 return identifier2.element as LocalVariableElement; |
| 4060 } | 4023 } |
| 4061 Token get endToken => _identifier.endToken; | 4024 Token get endToken => _identifier.endToken; |
| 4062 | 4025 |
| 4063 /** | 4026 /** |
| 4064 * Return the name of the variable being declared. | 4027 * Return the name of the variable being declared. |
| 4065 * @return the name of the variable being declared | 4028 * @return the name of the variable being declared |
| 4066 */ | 4029 */ |
| 4067 SimpleIdentifier get identifier => _identifier; | 4030 SimpleIdentifier get identifier => _identifier; |
| 4068 | 4031 |
| 4069 /** | 4032 /** |
| 4070 * Return the token representing either the 'final', 'const' or 'var' keyword. | 4033 * Return the token representing either the 'final', 'const' or 'var' keyword. |
| 4071 * @return the token representing either the 'final', 'const' or 'var' keyword | 4034 * @return the token representing either the 'final', 'const' or 'var' keyword |
| 4072 */ | 4035 */ |
| 4073 Token get keyword => _keyword; | 4036 Token get keyword => _keyword; |
| 4074 | 4037 |
| 4075 /** | 4038 /** |
| 4076 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does | 4039 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does |
| 4077 * not have a declared type. | 4040 * not have a declared type. |
| 4078 * @return the name of the declared type of the parameter | 4041 * @return the name of the declared type of the parameter |
| 4079 */ | 4042 */ |
| 4080 TypeName get type => _type; | 4043 TypeName get type => _type; |
| 4081 | 4044 |
| 4082 /** | 4045 /** |
| 4083 * Return {@code true} if this variable was declared with the 'const' modifier
. | 4046 * Return {@code true} if this variable was declared with the 'const' modifier
. |
| 4084 * @return {@code true} if this variable was declared with the 'const' modifie
r | 4047 * @return {@code true} if this variable was declared with the 'const' modifie
r |
| 4085 */ | 4048 */ |
| 4086 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 4049 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
| 4087 | 4050 |
| 4088 /** | 4051 /** |
| 4089 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are | 4052 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are |
| 4090 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly | 4053 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly |
| 4091 * final. | 4054 * final. |
| 4092 * @return {@code true} if this variable was declared with the 'final' modifie
r | 4055 * @return {@code true} if this variable was declared with the 'final' modifie
r |
| 4093 */ | 4056 */ |
| 4094 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); | 4057 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); |
| 4095 | 4058 |
| 4096 /** | 4059 /** |
| 4097 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 4060 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
| 4098 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4061 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 4099 */ | 4062 */ |
| 4100 void set keyword(Token keyword2) { | 4063 void set keyword(Token keyword2) { |
| 4101 this._keyword = keyword2; | 4064 this._keyword = keyword2; |
| 4102 } | 4065 } |
| 4103 | 4066 |
| 4104 /** | 4067 /** |
| 4105 * Set the name of the declared type of the parameter to the given type name. | 4068 * Set the name of the declared type of the parameter to the given type name. |
| 4106 * @param typeName the name of the declared type of the parameter | 4069 * @param typeName the name of the declared type of the parameter |
| 4107 */ | 4070 */ |
| 4108 void set type(TypeName typeName) { | 4071 void set type(TypeName typeName) { |
| 4109 _type = becomeParentOf(typeName); | 4072 _type = becomeParentOf(typeName); |
| 4110 } | 4073 } |
| 4111 void visitChildren(ASTVisitor<Object> visitor) { | 4074 void visitChildren(ASTVisitor<Object> visitor) { |
| 4112 super.visitChildren(visitor); | 4075 super.visitChildren(visitor); |
| 4113 safelyVisitChild(_type, visitor); | 4076 safelyVisitChild(_type, visitor); |
| 4114 safelyVisitChild(_identifier, visitor); | 4077 safelyVisitChild(_identifier, visitor); |
| 4115 } | 4078 } |
| 4116 Token get firstTokenAfterCommentAndMetadata { | 4079 Token get firstTokenAfterCommentAndMetadata { |
| 4117 if (_keyword != null) { | 4080 if (_keyword != null) { |
| 4118 return _keyword; | 4081 return _keyword; |
| 4119 } else if (_type != null) { | 4082 } else if (_type != null) { |
| 4120 return _type.beginToken; | 4083 return _type.beginToken; |
| 4121 } | 4084 } |
| 4122 return _identifier.beginToken; | 4085 return _identifier.beginToken; |
| 4123 } | 4086 } |
| 4124 } | 4087 } |
| 4125 | |
| 4126 /** | 4088 /** |
| 4127 * Instances of the class {@code DefaultFormalParameter} represent a formal para
meter with a default | 4089 * Instances of the class {@code DefaultFormalParameter} represent a formal para
meter with a default |
| 4128 * value. There are two kinds of parameters that are both represented by this cl
ass: named formal | 4090 * value. There are two kinds of parameters that are both represented by this cl
ass: named formal |
| 4129 * parameters and positional formal parameters. | 4091 * parameters and positional formal parameters. |
| 4130 * <pre> | 4092 * <pre> |
| 4131 * defaultFormalParameter ::={@link NormalFormalParameter normalFormalParameter}
('=' {@link Expression defaultValue})? | 4093 * defaultFormalParameter ::={@link NormalFormalParameter normalFormalParameter}
('=' {@link Expression defaultValue})? |
| 4132 * defaultNamedParameter ::={@link NormalFormalParameter normalFormalParameter}
(':' {@link Expression defaultValue})? | 4094 * defaultNamedParameter ::={@link NormalFormalParameter normalFormalParameter}
(':' {@link Expression defaultValue})? |
| 4133 * </pre> | 4095 * </pre> |
| 4134 * @coverage dart.engine.ast | 4096 * @coverage dart.engine.ast |
| 4135 */ | 4097 */ |
| 4136 class DefaultFormalParameter extends FormalParameter { | 4098 class DefaultFormalParameter extends FormalParameter { |
| 4137 | 4099 |
| 4138 /** | 4100 /** |
| 4139 * The formal parameter with which the default value is associated. | 4101 * The formal parameter with which the default value is associated. |
| 4140 */ | 4102 */ |
| 4141 NormalFormalParameter _parameter; | 4103 NormalFormalParameter _parameter; |
| 4142 | 4104 |
| 4143 /** | 4105 /** |
| 4144 * The kind of this parameter. | 4106 * The kind of this parameter. |
| 4145 */ | 4107 */ |
| 4146 ParameterKind _kind; | 4108 ParameterKind _kind; |
| 4147 | 4109 |
| 4148 /** | 4110 /** |
| 4149 * The token separating the parameter from the default value, or {@code null}
if there is no | 4111 * The token separating the parameter from the default value, or {@code null}
if there is no |
| 4150 * default value. | 4112 * default value. |
| 4151 */ | 4113 */ |
| 4152 Token _separator; | 4114 Token _separator; |
| 4153 | 4115 |
| 4154 /** | 4116 /** |
| 4155 * The expression computing the default value for the parameter, or {@code nul
l} if there is no | 4117 * The expression computing the default value for the parameter, or {@code nul
l} if there is no |
| 4156 * default value. | 4118 * default value. |
| 4157 */ | 4119 */ |
| 4158 Expression _defaultValue; | 4120 Expression _defaultValue; |
| 4159 | 4121 |
| 4160 /** | 4122 /** |
| 4161 * Initialize a newly created default formal parameter. | 4123 * Initialize a newly created default formal parameter. |
| 4162 * @param parameter the formal parameter with which the default value is assoc
iated | 4124 * @param parameter the formal parameter with which the default value is assoc
iated |
| 4163 * @param kind the kind of this parameter | 4125 * @param kind the kind of this parameter |
| 4164 * @param separator the token separating the parameter from the default value | 4126 * @param separator the token separating the parameter from the default value |
| 4165 * @param defaultValue the expression computing the default value for the para
meter | 4127 * @param defaultValue the expression computing the default value for the para
meter |
| 4166 */ | 4128 */ |
| 4167 DefaultFormalParameter.full(NormalFormalParameter parameter, ParameterKind kin
d, Token separator, Expression defaultValue) { | 4129 DefaultFormalParameter.full(NormalFormalParameter parameter, ParameterKind kin
d, Token separator, Expression defaultValue) { |
| 4168 this._parameter = becomeParentOf(parameter); | 4130 this._parameter = becomeParentOf(parameter); |
| 4169 this._kind = kind; | 4131 this._kind = kind; |
| 4170 this._separator = separator; | 4132 this._separator = separator; |
| 4171 this._defaultValue = becomeParentOf(defaultValue); | 4133 this._defaultValue = becomeParentOf(defaultValue); |
| 4172 } | 4134 } |
| 4173 | 4135 |
| 4174 /** | 4136 /** |
| 4175 * Initialize a newly created default formal parameter. | 4137 * Initialize a newly created default formal parameter. |
| 4176 * @param parameter the formal parameter with which the default value is assoc
iated | 4138 * @param parameter the formal parameter with which the default value is assoc
iated |
| 4177 * @param kind the kind of this parameter | 4139 * @param kind the kind of this parameter |
| 4178 * @param separator the token separating the parameter from the default value | 4140 * @param separator the token separating the parameter from the default value |
| 4179 * @param defaultValue the expression computing the default value for the para
meter | 4141 * @param defaultValue the expression computing the default value for the para
meter |
| 4180 */ | 4142 */ |
| 4181 DefaultFormalParameter({NormalFormalParameter parameter, ParameterKind kind, T
oken separator, Expression defaultValue}) : this.full(parameter, kind, separator
, defaultValue); | 4143 DefaultFormalParameter({NormalFormalParameter parameter, ParameterKind kind, T
oken separator, Expression defaultValue}) : this.full(parameter, kind, separator
, defaultValue); |
| 4182 accept(ASTVisitor visitor) => visitor.visitDefaultFormalParameter(this); | 4144 accept(ASTVisitor visitor) => visitor.visitDefaultFormalParameter(this); |
| 4183 Token get beginToken => _parameter.beginToken; | 4145 Token get beginToken => _parameter.beginToken; |
| 4184 | 4146 |
| 4185 /** | 4147 /** |
| 4186 * Return the expression computing the default value for the parameter, or {@c
ode null} if there | 4148 * Return the expression computing the default value for the parameter, or {@c
ode null} if there |
| 4187 * is no default value. | 4149 * is no default value. |
| 4188 * @return the expression computing the default value for the parameter | 4150 * @return the expression computing the default value for the parameter |
| 4189 */ | 4151 */ |
| 4190 Expression get defaultValue => _defaultValue; | 4152 Expression get defaultValue => _defaultValue; |
| 4191 Token get endToken { | 4153 Token get endToken { |
| 4192 if (_defaultValue != null) { | 4154 if (_defaultValue != null) { |
| 4193 return _defaultValue.endToken; | 4155 return _defaultValue.endToken; |
| 4194 } | 4156 } |
| 4195 return _parameter.endToken; | 4157 return _parameter.endToken; |
| 4196 } | 4158 } |
| 4197 SimpleIdentifier get identifier => _parameter.identifier; | 4159 SimpleIdentifier get identifier => _parameter.identifier; |
| 4198 ParameterKind get kind => _kind; | 4160 ParameterKind get kind => _kind; |
| 4199 | 4161 |
| 4200 /** | 4162 /** |
| 4201 * Return the formal parameter with which the default value is associated. | 4163 * Return the formal parameter with which the default value is associated. |
| 4202 * @return the formal parameter with which the default value is associated | 4164 * @return the formal parameter with which the default value is associated |
| 4203 */ | 4165 */ |
| 4204 NormalFormalParameter get parameter => _parameter; | 4166 NormalFormalParameter get parameter => _parameter; |
| 4205 | 4167 |
| 4206 /** | 4168 /** |
| 4207 * Return the token separating the parameter from the default value, or {@code
null} if there is | 4169 * Return the token separating the parameter from the default value, or {@code
null} if there is |
| 4208 * no default value. | 4170 * no default value. |
| 4209 * @return the token separating the parameter from the default value | 4171 * @return the token separating the parameter from the default value |
| 4210 */ | 4172 */ |
| 4211 Token get separator => _separator; | 4173 Token get separator => _separator; |
| 4212 | 4174 |
| 4213 /** | 4175 /** |
| 4214 * Return {@code true} if this parameter was declared with the 'const' modifie
r. | 4176 * Return {@code true} if this parameter was declared with the 'const' modifie
r. |
| 4215 * @return {@code true} if this parameter was declared with the 'const' modifi
er | 4177 * @return {@code true} if this parameter was declared with the 'const' modifi
er |
| 4216 */ | 4178 */ |
| 4217 bool isConst() => _parameter != null && _parameter.isConst(); | 4179 bool isConst() => _parameter != null && _parameter.isConst(); |
| 4218 | 4180 |
| 4219 /** | 4181 /** |
| 4220 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that | 4182 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that |
| 4221 * are declared with the 'const' modifier will return {@code false} even thoug
h they are | 4183 * are declared with the 'const' modifier will return {@code false} even thoug
h they are |
| 4222 * implicitly final. | 4184 * implicitly final. |
| 4223 * @return {@code true} if this parameter was declared with the 'final' modifi
er | 4185 * @return {@code true} if this parameter was declared with the 'final' modifi
er |
| 4224 */ | 4186 */ |
| 4225 bool isFinal() => _parameter != null && _parameter.isFinal(); | 4187 bool isFinal() => _parameter != null && _parameter.isFinal(); |
| 4226 | 4188 |
| 4227 /** | 4189 /** |
| 4228 * Set the expression computing the default value for the parameter to the giv
en expression. | 4190 * Set the expression computing the default value for the parameter to the giv
en expression. |
| 4229 * @param expression the expression computing the default value for the parame
ter | 4191 * @param expression the expression computing the default value for the parame
ter |
| 4230 */ | 4192 */ |
| 4231 void set defaultValue(Expression expression) { | 4193 void set defaultValue(Expression expression) { |
| 4232 _defaultValue = becomeParentOf(expression); | 4194 _defaultValue = becomeParentOf(expression); |
| 4233 } | 4195 } |
| 4234 | 4196 |
| 4235 /** | 4197 /** |
| 4236 * Set the kind of this parameter to the given kind. | 4198 * Set the kind of this parameter to the given kind. |
| 4237 * @param kind the kind of this parameter | 4199 * @param kind the kind of this parameter |
| 4238 */ | 4200 */ |
| 4239 void set kind(ParameterKind kind2) { | 4201 void set kind(ParameterKind kind2) { |
| 4240 this._kind = kind2; | 4202 this._kind = kind2; |
| 4241 } | 4203 } |
| 4242 | 4204 |
| 4243 /** | 4205 /** |
| 4244 * Set the formal parameter with which the default value is associated to the
given parameter. | 4206 * Set the formal parameter with which the default value is associated to the
given parameter. |
| 4245 * @param formalParameter the formal parameter with which the default value is
associated | 4207 * @param formalParameter the formal parameter with which the default value is
associated |
| 4246 */ | 4208 */ |
| 4247 void set parameter(NormalFormalParameter formalParameter) { | 4209 void set parameter(NormalFormalParameter formalParameter) { |
| 4248 _parameter = becomeParentOf(formalParameter); | 4210 _parameter = becomeParentOf(formalParameter); |
| 4249 } | 4211 } |
| 4250 | 4212 |
| 4251 /** | 4213 /** |
| 4252 * Set the token separating the parameter from the default value to the given
token. | 4214 * Set the token separating the parameter from the default value to the given
token. |
| 4253 * @param separator the token separating the parameter from the default value | 4215 * @param separator the token separating the parameter from the default value |
| 4254 */ | 4216 */ |
| 4255 void set separator(Token separator2) { | 4217 void set separator(Token separator2) { |
| 4256 this._separator = separator2; | 4218 this._separator = separator2; |
| 4257 } | 4219 } |
| 4258 void visitChildren(ASTVisitor<Object> visitor) { | 4220 void visitChildren(ASTVisitor<Object> visitor) { |
| 4259 safelyVisitChild(_parameter, visitor); | 4221 safelyVisitChild(_parameter, visitor); |
| 4260 safelyVisitChild(_defaultValue, visitor); | 4222 safelyVisitChild(_defaultValue, visitor); |
| 4261 } | 4223 } |
| 4262 } | 4224 } |
| 4263 | |
| 4264 /** | 4225 /** |
| 4265 * The abstract class {@code Directive} defines the behavior common to nodes tha
t represent a | 4226 * The abstract class {@code Directive} defines the behavior common to nodes tha
t represent a |
| 4266 * directive. | 4227 * directive. |
| 4267 * <pre> | 4228 * <pre> |
| 4268 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}| {@link LibraryDirective libraryDirective}| {@link PartDirectiv
e partDirective}| {@link PartOfDirective partOfDirective}</pre> | 4229 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}| {@link LibraryDirective libraryDirective}| {@link PartDirectiv
e partDirective}| {@link PartOfDirective partOfDirective}</pre> |
| 4269 * @coverage dart.engine.ast | 4230 * @coverage dart.engine.ast |
| 4270 */ | 4231 */ |
| 4271 abstract class Directive extends AnnotatedNode { | 4232 abstract class Directive extends AnnotatedNode { |
| 4272 | 4233 |
| 4273 /** | 4234 /** |
| 4274 * The element associated with this directive, or {@code null} if the AST stru
cture has not been | 4235 * The element associated with this directive, or {@code null} if the AST stru
cture has not been |
| 4275 * resolved or if this directive could not be resolved. | 4236 * resolved or if this directive could not be resolved. |
| 4276 */ | 4237 */ |
| 4277 Element _element; | 4238 Element _element; |
| 4278 | 4239 |
| 4279 /** | 4240 /** |
| 4280 * Initialize a newly create directive. | 4241 * Initialize a newly create directive. |
| 4281 * @param comment the documentation comment associated with this directive | 4242 * @param comment the documentation comment associated with this directive |
| 4282 * @param metadata the annotations associated with the directive | 4243 * @param metadata the annotations associated with the directive |
| 4283 */ | 4244 */ |
| 4284 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen
t, metadata) { | 4245 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen
t, metadata) { |
| 4285 } | 4246 } |
| 4286 | 4247 |
| 4287 /** | 4248 /** |
| 4288 * Initialize a newly create directive. | 4249 * Initialize a newly create directive. |
| 4289 * @param comment the documentation comment associated with this directive | 4250 * @param comment the documentation comment associated with this directive |
| 4290 * @param metadata the annotations associated with the directive | 4251 * @param metadata the annotations associated with the directive |
| 4291 */ | 4252 */ |
| 4292 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m
etadata); | 4253 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m
etadata); |
| 4293 | 4254 |
| 4294 /** | 4255 /** |
| 4295 * Return the element associated with this directive, or {@code null} if the A
ST structure has not | 4256 * Return the element associated with this directive, or {@code null} if the A
ST structure has not |
| 4296 * been resolved or if this directive could not be resolved. Examples of the l
atter case include a | 4257 * been resolved or if this directive could not be resolved. Examples of the l
atter case include a |
| 4297 * directive that contains an invalid URL or a URL that does not exist. | 4258 * directive that contains an invalid URL or a URL that does not exist. |
| 4298 * @return the element associated with this directive | 4259 * @return the element associated with this directive |
| 4299 */ | 4260 */ |
| 4300 Element get element => _element; | 4261 Element get element => _element; |
| 4301 | 4262 |
| 4302 /** | 4263 /** |
| 4303 * Return the token representing the keyword that introduces this directive ('
import', 'export', | 4264 * Return the token representing the keyword that introduces this directive ('
import', 'export', |
| 4304 * 'library' or 'part'). | 4265 * 'library' or 'part'). |
| 4305 * @return the token representing the keyword that introduces this directive | 4266 * @return the token representing the keyword that introduces this directive |
| 4306 */ | 4267 */ |
| 4307 Token get keyword; | 4268 Token get keyword; |
| 4308 | 4269 |
| 4309 /** | 4270 /** |
| 4310 * Set the element associated with this directive to the given element. | 4271 * Set the element associated with this directive to the given element. |
| 4311 * @param element the element associated with this directive | 4272 * @param element the element associated with this directive |
| 4312 */ | 4273 */ |
| 4313 void set element(Element element2) { | 4274 void set element(Element element2) { |
| 4314 this._element = element2; | 4275 this._element = element2; |
| 4315 } | 4276 } |
| 4316 } | 4277 } |
| 4317 | |
| 4318 /** | 4278 /** |
| 4319 * Instances of the class {@code DoStatement} represent a do statement. | 4279 * Instances of the class {@code DoStatement} represent a do statement. |
| 4320 * <pre> | 4280 * <pre> |
| 4321 * doStatement ::= | 4281 * doStatement ::= |
| 4322 * 'do' {@link Statement body} 'while' '(' {@link Expression condition} ')' ';' | 4282 * 'do' {@link Statement body} 'while' '(' {@link Expression condition} ')' ';' |
| 4323 * </pre> | 4283 * </pre> |
| 4324 * @coverage dart.engine.ast | 4284 * @coverage dart.engine.ast |
| 4325 */ | 4285 */ |
| 4326 class DoStatement extends Statement { | 4286 class DoStatement extends Statement { |
| 4327 | 4287 |
| 4328 /** | 4288 /** |
| 4329 * The token representing the 'do' keyword. | 4289 * The token representing the 'do' keyword. |
| 4330 */ | 4290 */ |
| 4331 Token _doKeyword; | 4291 Token _doKeyword; |
| 4332 | 4292 |
| 4333 /** | 4293 /** |
| 4334 * The body of the loop. | 4294 * The body of the loop. |
| 4335 */ | 4295 */ |
| 4336 Statement _body; | 4296 Statement _body; |
| 4337 | 4297 |
| 4338 /** | 4298 /** |
| 4339 * The token representing the 'while' keyword. | 4299 * The token representing the 'while' keyword. |
| 4340 */ | 4300 */ |
| 4341 Token _whileKeyword; | 4301 Token _whileKeyword; |
| 4342 | 4302 |
| 4343 /** | 4303 /** |
| 4344 * The left parenthesis. | 4304 * The left parenthesis. |
| 4345 */ | 4305 */ |
| 4346 Token _leftParenthesis; | 4306 Token _leftParenthesis; |
| 4347 | 4307 |
| 4348 /** | 4308 /** |
| 4349 * The condition that determines when the loop will terminate. | 4309 * The condition that determines when the loop will terminate. |
| 4350 */ | 4310 */ |
| 4351 Expression _condition; | 4311 Expression _condition; |
| 4352 | 4312 |
| 4353 /** | 4313 /** |
| 4354 * The right parenthesis. | 4314 * The right parenthesis. |
| 4355 */ | 4315 */ |
| 4356 Token _rightParenthesis; | 4316 Token _rightParenthesis; |
| 4357 | 4317 |
| 4358 /** | 4318 /** |
| 4359 * The semicolon terminating the statement. | 4319 * The semicolon terminating the statement. |
| 4360 */ | 4320 */ |
| 4361 Token _semicolon; | 4321 Token _semicolon; |
| 4362 | 4322 |
| 4363 /** | 4323 /** |
| 4364 * Initialize a newly created do loop. | 4324 * Initialize a newly created do loop. |
| 4365 * @param doKeyword the token representing the 'do' keyword | 4325 * @param doKeyword the token representing the 'do' keyword |
| 4366 * @param body the body of the loop | 4326 * @param body the body of the loop |
| 4367 * @param whileKeyword the token representing the 'while' keyword | 4327 * @param whileKeyword the token representing the 'while' keyword |
| 4368 * @param leftParenthesis the left parenthesis | 4328 * @param leftParenthesis the left parenthesis |
| 4369 * @param condition the condition that determines when the loop will terminate | 4329 * @param condition the condition that determines when the loop will terminate |
| 4370 * @param rightParenthesis the right parenthesis | 4330 * @param rightParenthesis the right parenthesis |
| 4371 * @param semicolon the semicolon terminating the statement | 4331 * @param semicolon the semicolon terminating the statement |
| 4372 */ | 4332 */ |
| 4373 DoStatement.full(Token doKeyword, Statement body, Token whileKeyword, Token le
ftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) { | 4333 DoStatement.full(Token doKeyword, Statement body, Token whileKeyword, Token le
ftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) { |
| 4374 this._doKeyword = doKeyword; | 4334 this._doKeyword = doKeyword; |
| 4375 this._body = becomeParentOf(body); | 4335 this._body = becomeParentOf(body); |
| 4376 this._whileKeyword = whileKeyword; | 4336 this._whileKeyword = whileKeyword; |
| 4377 this._leftParenthesis = leftParenthesis; | 4337 this._leftParenthesis = leftParenthesis; |
| 4378 this._condition = becomeParentOf(condition); | 4338 this._condition = becomeParentOf(condition); |
| 4379 this._rightParenthesis = rightParenthesis; | 4339 this._rightParenthesis = rightParenthesis; |
| 4380 this._semicolon = semicolon; | 4340 this._semicolon = semicolon; |
| 4381 } | 4341 } |
| 4382 | 4342 |
| 4383 /** | 4343 /** |
| 4384 * Initialize a newly created do loop. | 4344 * Initialize a newly created do loop. |
| 4385 * @param doKeyword the token representing the 'do' keyword | 4345 * @param doKeyword the token representing the 'do' keyword |
| 4386 * @param body the body of the loop | 4346 * @param body the body of the loop |
| 4387 * @param whileKeyword the token representing the 'while' keyword | 4347 * @param whileKeyword the token representing the 'while' keyword |
| 4388 * @param leftParenthesis the left parenthesis | 4348 * @param leftParenthesis the left parenthesis |
| 4389 * @param condition the condition that determines when the loop will terminate | 4349 * @param condition the condition that determines when the loop will terminate |
| 4390 * @param rightParenthesis the right parenthesis | 4350 * @param rightParenthesis the right parenthesis |
| 4391 * @param semicolon the semicolon terminating the statement | 4351 * @param semicolon the semicolon terminating the statement |
| 4392 */ | 4352 */ |
| 4393 DoStatement({Token doKeyword, Statement body, Token whileKeyword, Token leftPa
renthesis, Expression condition, Token rightParenthesis, Token semicolon}) : thi
s.full(doKeyword, body, whileKeyword, leftParenthesis, condition, rightParenthes
is, semicolon); | 4353 DoStatement({Token doKeyword, Statement body, Token whileKeyword, Token leftPa
renthesis, Expression condition, Token rightParenthesis, Token semicolon}) : thi
s.full(doKeyword, body, whileKeyword, leftParenthesis, condition, rightParenthes
is, semicolon); |
| 4394 accept(ASTVisitor visitor) => visitor.visitDoStatement(this); | 4354 accept(ASTVisitor visitor) => visitor.visitDoStatement(this); |
| 4395 Token get beginToken => _doKeyword; | 4355 Token get beginToken => _doKeyword; |
| 4396 | 4356 |
| 4397 /** | 4357 /** |
| 4398 * Return the body of the loop. | 4358 * Return the body of the loop. |
| 4399 * @return the body of the loop | 4359 * @return the body of the loop |
| 4400 */ | 4360 */ |
| 4401 Statement get body => _body; | 4361 Statement get body => _body; |
| 4402 | 4362 |
| 4403 /** | 4363 /** |
| 4404 * Return the condition that determines when the loop will terminate. | 4364 * Return the condition that determines when the loop will terminate. |
| 4405 * @return the condition that determines when the loop will terminate | 4365 * @return the condition that determines when the loop will terminate |
| 4406 */ | 4366 */ |
| 4407 Expression get condition => _condition; | 4367 Expression get condition => _condition; |
| 4408 | 4368 |
| 4409 /** | 4369 /** |
| 4410 * Return the token representing the 'do' keyword. | 4370 * Return the token representing the 'do' keyword. |
| 4411 * @return the token representing the 'do' keyword | 4371 * @return the token representing the 'do' keyword |
| 4412 */ | 4372 */ |
| 4413 Token get doKeyword => _doKeyword; | 4373 Token get doKeyword => _doKeyword; |
| 4414 Token get endToken => _semicolon; | 4374 Token get endToken => _semicolon; |
| 4415 | 4375 |
| 4416 /** | 4376 /** |
| 4417 * Return the left parenthesis. | 4377 * Return the left parenthesis. |
| 4418 * @return the left parenthesis | 4378 * @return the left parenthesis |
| 4419 */ | 4379 */ |
| 4420 Token get leftParenthesis => _leftParenthesis; | 4380 Token get leftParenthesis => _leftParenthesis; |
| 4421 | 4381 |
| 4422 /** | 4382 /** |
| 4423 * Return the right parenthesis. | 4383 * Return the right parenthesis. |
| 4424 * @return the right parenthesis | 4384 * @return the right parenthesis |
| 4425 */ | 4385 */ |
| 4426 Token get rightParenthesis => _rightParenthesis; | 4386 Token get rightParenthesis => _rightParenthesis; |
| 4427 | 4387 |
| 4428 /** | 4388 /** |
| 4429 * Return the semicolon terminating the statement. | 4389 * Return the semicolon terminating the statement. |
| 4430 * @return the semicolon terminating the statement | 4390 * @return the semicolon terminating the statement |
| 4431 */ | 4391 */ |
| 4432 Token get semicolon => _semicolon; | 4392 Token get semicolon => _semicolon; |
| 4433 | 4393 |
| 4434 /** | 4394 /** |
| 4435 * Return the token representing the 'while' keyword. | 4395 * Return the token representing the 'while' keyword. |
| 4436 * @return the token representing the 'while' keyword | 4396 * @return the token representing the 'while' keyword |
| 4437 */ | 4397 */ |
| 4438 Token get whileKeyword => _whileKeyword; | 4398 Token get whileKeyword => _whileKeyword; |
| 4439 | 4399 |
| 4440 /** | 4400 /** |
| 4441 * Set the body of the loop to the given statement. | 4401 * Set the body of the loop to the given statement. |
| 4442 * @param statement the body of the loop | 4402 * @param statement the body of the loop |
| 4443 */ | 4403 */ |
| 4444 void set body(Statement statement) { | 4404 void set body(Statement statement) { |
| 4445 _body = becomeParentOf(statement); | 4405 _body = becomeParentOf(statement); |
| 4446 } | 4406 } |
| 4447 | 4407 |
| 4448 /** | 4408 /** |
| 4449 * Set the condition that determines when the loop will terminate to the given
expression. | 4409 * Set the condition that determines when the loop will terminate to the given
expression. |
| 4450 * @param expression the condition that determines when the loop will terminat
e | 4410 * @param expression the condition that determines when the loop will terminat
e |
| 4451 */ | 4411 */ |
| 4452 void set condition(Expression expression) { | 4412 void set condition(Expression expression) { |
| 4453 _condition = becomeParentOf(expression); | 4413 _condition = becomeParentOf(expression); |
| 4454 } | 4414 } |
| 4455 | 4415 |
| 4456 /** | 4416 /** |
| 4457 * Set the token representing the 'do' keyword to the given token. | 4417 * Set the token representing the 'do' keyword to the given token. |
| 4458 * @param doKeyword the token representing the 'do' keyword | 4418 * @param doKeyword the token representing the 'do' keyword |
| 4459 */ | 4419 */ |
| 4460 void set doKeyword(Token doKeyword2) { | 4420 void set doKeyword(Token doKeyword2) { |
| 4461 this._doKeyword = doKeyword2; | 4421 this._doKeyword = doKeyword2; |
| 4462 } | 4422 } |
| 4463 | 4423 |
| 4464 /** | 4424 /** |
| 4465 * Set the left parenthesis to the given token. | 4425 * Set the left parenthesis to the given token. |
| 4466 * @param parenthesis the left parenthesis | 4426 * @param parenthesis the left parenthesis |
| 4467 */ | 4427 */ |
| 4468 void set leftParenthesis(Token parenthesis) { | 4428 void set leftParenthesis(Token parenthesis) { |
| 4469 _leftParenthesis = parenthesis; | 4429 _leftParenthesis = parenthesis; |
| 4470 } | 4430 } |
| 4471 | 4431 |
| 4472 /** | 4432 /** |
| 4473 * Set the right parenthesis to the given token. | 4433 * Set the right parenthesis to the given token. |
| 4474 * @param parenthesis the right parenthesis | 4434 * @param parenthesis the right parenthesis |
| 4475 */ | 4435 */ |
| 4476 void set rightParenthesis(Token parenthesis) { | 4436 void set rightParenthesis(Token parenthesis) { |
| 4477 _rightParenthesis = parenthesis; | 4437 _rightParenthesis = parenthesis; |
| 4478 } | 4438 } |
| 4479 | 4439 |
| 4480 /** | 4440 /** |
| 4481 * Set the semicolon terminating the statement to the given token. | 4441 * Set the semicolon terminating the statement to the given token. |
| 4482 * @param semicolon the semicolon terminating the statement | 4442 * @param semicolon the semicolon terminating the statement |
| 4483 */ | 4443 */ |
| 4484 void set semicolon(Token semicolon2) { | 4444 void set semicolon(Token semicolon2) { |
| 4485 this._semicolon = semicolon2; | 4445 this._semicolon = semicolon2; |
| 4486 } | 4446 } |
| 4487 | 4447 |
| 4488 /** | 4448 /** |
| 4489 * Set the token representing the 'while' keyword to the given token. | 4449 * Set the token representing the 'while' keyword to the given token. |
| 4490 * @param whileKeyword the token representing the 'while' keyword | 4450 * @param whileKeyword the token representing the 'while' keyword |
| 4491 */ | 4451 */ |
| 4492 void set whileKeyword(Token whileKeyword2) { | 4452 void set whileKeyword(Token whileKeyword2) { |
| 4493 this._whileKeyword = whileKeyword2; | 4453 this._whileKeyword = whileKeyword2; |
| 4494 } | 4454 } |
| 4495 void visitChildren(ASTVisitor<Object> visitor) { | 4455 void visitChildren(ASTVisitor<Object> visitor) { |
| 4496 safelyVisitChild(_body, visitor); | 4456 safelyVisitChild(_body, visitor); |
| 4497 safelyVisitChild(_condition, visitor); | 4457 safelyVisitChild(_condition, visitor); |
| 4498 } | 4458 } |
| 4499 } | 4459 } |
| 4500 | |
| 4501 /** | 4460 /** |
| 4502 * Instances of the class {@code DoubleLiteral} represent a floating point liter
al expression. | 4461 * Instances of the class {@code DoubleLiteral} represent a floating point liter
al expression. |
| 4503 * <pre> | 4462 * <pre> |
| 4504 * doubleLiteral ::= | 4463 * doubleLiteral ::= |
| 4505 * decimalDigit+ ('.' decimalDigit*)? exponent? | 4464 * decimalDigit+ ('.' decimalDigit*)? exponent? |
| 4506 * | '.' decimalDigit+ exponent? | 4465 * | '.' decimalDigit+ exponent? |
| 4507 * exponent ::= | 4466 * exponent ::= |
| 4508 * ('e' | 'E') ('+' | '-')? decimalDigit+ | 4467 * ('e' | 'E') ('+' | '-')? decimalDigit+ |
| 4509 * </pre> | 4468 * </pre> |
| 4510 * @coverage dart.engine.ast | 4469 * @coverage dart.engine.ast |
| 4511 */ | 4470 */ |
| 4512 class DoubleLiteral extends Literal { | 4471 class DoubleLiteral extends Literal { |
| 4513 | 4472 |
| 4514 /** | 4473 /** |
| 4515 * The token representing the literal. | 4474 * The token representing the literal. |
| 4516 */ | 4475 */ |
| 4517 Token _literal; | 4476 Token _literal; |
| 4518 | 4477 |
| 4519 /** | 4478 /** |
| 4520 * The value of the literal. | 4479 * The value of the literal. |
| 4521 */ | 4480 */ |
| 4522 double _value = 0.0; | 4481 double _value = 0.0; |
| 4523 | 4482 |
| 4524 /** | 4483 /** |
| 4525 * Initialize a newly created floating point literal. | 4484 * Initialize a newly created floating point literal. |
| 4526 * @param literal the token representing the literal | 4485 * @param literal the token representing the literal |
| 4527 * @param value the value of the literal | 4486 * @param value the value of the literal |
| 4528 */ | 4487 */ |
| 4529 DoubleLiteral.full(Token literal, double value) { | 4488 DoubleLiteral.full(Token literal, double value) { |
| 4530 this._literal = literal; | 4489 this._literal = literal; |
| 4531 this._value = value; | 4490 this._value = value; |
| 4532 } | 4491 } |
| 4533 | 4492 |
| 4534 /** | 4493 /** |
| 4535 * Initialize a newly created floating point literal. | 4494 * Initialize a newly created floating point literal. |
| 4536 * @param literal the token representing the literal | 4495 * @param literal the token representing the literal |
| 4537 * @param value the value of the literal | 4496 * @param value the value of the literal |
| 4538 */ | 4497 */ |
| 4539 DoubleLiteral({Token literal, double value}) : this.full(literal, value); | 4498 DoubleLiteral({Token literal, double value}) : this.full(literal, value); |
| 4540 accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this); | 4499 accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this); |
| 4541 Token get beginToken => _literal; | 4500 Token get beginToken => _literal; |
| 4542 Token get endToken => _literal; | 4501 Token get endToken => _literal; |
| 4543 | 4502 |
| 4544 /** | 4503 /** |
| 4545 * Return the token representing the literal. | 4504 * Return the token representing the literal. |
| 4546 * @return the token representing the literal | 4505 * @return the token representing the literal |
| 4547 */ | 4506 */ |
| 4548 Token get literal => _literal; | 4507 Token get literal => _literal; |
| 4549 | 4508 |
| 4550 /** | 4509 /** |
| 4551 * Return the value of the literal. | 4510 * Return the value of the literal. |
| 4552 * @return the value of the literal | 4511 * @return the value of the literal |
| 4553 */ | 4512 */ |
| 4554 double get value => _value; | 4513 double get value => _value; |
| 4555 | 4514 |
| 4556 /** | 4515 /** |
| 4557 * Set the token representing the literal to the given token. | 4516 * Set the token representing the literal to the given token. |
| 4558 * @param literal the token representing the literal | 4517 * @param literal the token representing the literal |
| 4559 */ | 4518 */ |
| 4560 void set literal(Token literal2) { | 4519 void set literal(Token literal2) { |
| 4561 this._literal = literal2; | 4520 this._literal = literal2; |
| 4562 } | 4521 } |
| 4563 | 4522 |
| 4564 /** | 4523 /** |
| 4565 * Set the value of the literal to the given value. | 4524 * Set the value of the literal to the given value. |
| 4566 * @param value the value of the literal | 4525 * @param value the value of the literal |
| 4567 */ | 4526 */ |
| 4568 void set value(double value2) { | 4527 void set value(double value2) { |
| 4569 this._value = value2; | 4528 this._value = value2; |
| 4570 } | 4529 } |
| 4571 void visitChildren(ASTVisitor<Object> visitor) { | 4530 void visitChildren(ASTVisitor<Object> visitor) { |
| 4572 } | 4531 } |
| 4573 } | 4532 } |
| 4574 | |
| 4575 /** | 4533 /** |
| 4576 * Instances of the class {@code EmptyFunctionBody} represent an empty function
body, which can only | 4534 * Instances of the class {@code EmptyFunctionBody} represent an empty function
body, which can only |
| 4577 * appear in constructors or abstract methods. | 4535 * appear in constructors or abstract methods. |
| 4578 * <pre> | 4536 * <pre> |
| 4579 * emptyFunctionBody ::= | 4537 * emptyFunctionBody ::= |
| 4580 * ';' | 4538 * ';' |
| 4581 * </pre> | 4539 * </pre> |
| 4582 * @coverage dart.engine.ast | 4540 * @coverage dart.engine.ast |
| 4583 */ | 4541 */ |
| 4584 class EmptyFunctionBody extends FunctionBody { | 4542 class EmptyFunctionBody extends FunctionBody { |
| 4585 | 4543 |
| 4586 /** | 4544 /** |
| 4587 * The token representing the semicolon that marks the end of the function bod
y. | 4545 * The token representing the semicolon that marks the end of the function bod
y. |
| 4588 */ | 4546 */ |
| 4589 Token _semicolon; | 4547 Token _semicolon; |
| 4590 | 4548 |
| 4591 /** | 4549 /** |
| 4592 * Initialize a newly created function body. | 4550 * Initialize a newly created function body. |
| 4593 * @param semicolon the token representing the semicolon that marks the end of
the function body | 4551 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 4594 */ | 4552 */ |
| 4595 EmptyFunctionBody.full(Token semicolon) { | 4553 EmptyFunctionBody.full(Token semicolon) { |
| 4596 this._semicolon = semicolon; | 4554 this._semicolon = semicolon; |
| 4597 } | 4555 } |
| 4598 | 4556 |
| 4599 /** | 4557 /** |
| 4600 * Initialize a newly created function body. | 4558 * Initialize a newly created function body. |
| 4601 * @param semicolon the token representing the semicolon that marks the end of
the function body | 4559 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 4602 */ | 4560 */ |
| 4603 EmptyFunctionBody({Token semicolon}) : this.full(semicolon); | 4561 EmptyFunctionBody({Token semicolon}) : this.full(semicolon); |
| 4604 accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this); | 4562 accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this); |
| 4605 Token get beginToken => _semicolon; | 4563 Token get beginToken => _semicolon; |
| 4606 Token get endToken => _semicolon; | 4564 Token get endToken => _semicolon; |
| 4607 | 4565 |
| 4608 /** | 4566 /** |
| 4609 * Return the token representing the semicolon that marks the end of the funct
ion body. | 4567 * Return the token representing the semicolon that marks the end of the funct
ion body. |
| 4610 * @return the token representing the semicolon that marks the end of the func
tion body | 4568 * @return the token representing the semicolon that marks the end of the func
tion body |
| 4611 */ | 4569 */ |
| 4612 Token get semicolon => _semicolon; | 4570 Token get semicolon => _semicolon; |
| 4613 | 4571 |
| 4614 /** | 4572 /** |
| 4615 * Set the token representing the semicolon that marks the end of the function
body to the given | 4573 * Set the token representing the semicolon that marks the end of the function
body to the given |
| 4616 * token. | 4574 * token. |
| 4617 * @param semicolon the token representing the semicolon that marks the end of
the function body | 4575 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 4618 */ | 4576 */ |
| 4619 void set semicolon(Token semicolon2) { | 4577 void set semicolon(Token semicolon2) { |
| 4620 this._semicolon = semicolon2; | 4578 this._semicolon = semicolon2; |
| 4621 } | 4579 } |
| 4622 void visitChildren(ASTVisitor<Object> visitor) { | 4580 void visitChildren(ASTVisitor<Object> visitor) { |
| 4623 } | 4581 } |
| 4624 } | 4582 } |
| 4625 | |
| 4626 /** | 4583 /** |
| 4627 * Instances of the class {@code EmptyStatement} represent an empty statement. | 4584 * Instances of the class {@code EmptyStatement} represent an empty statement. |
| 4628 * <pre> | 4585 * <pre> |
| 4629 * emptyStatement ::= | 4586 * emptyStatement ::= |
| 4630 * ';' | 4587 * ';' |
| 4631 * </pre> | 4588 * </pre> |
| 4632 * @coverage dart.engine.ast | 4589 * @coverage dart.engine.ast |
| 4633 */ | 4590 */ |
| 4634 class EmptyStatement extends Statement { | 4591 class EmptyStatement extends Statement { |
| 4635 | 4592 |
| 4636 /** | 4593 /** |
| 4637 * The semicolon terminating the statement. | 4594 * The semicolon terminating the statement. |
| 4638 */ | 4595 */ |
| 4639 Token _semicolon; | 4596 Token _semicolon; |
| 4640 | 4597 |
| 4641 /** | 4598 /** |
| 4642 * Initialize a newly created empty statement. | 4599 * Initialize a newly created empty statement. |
| 4643 * @param semicolon the semicolon terminating the statement | 4600 * @param semicolon the semicolon terminating the statement |
| 4644 */ | 4601 */ |
| 4645 EmptyStatement.full(Token semicolon) { | 4602 EmptyStatement.full(Token semicolon) { |
| 4646 this._semicolon = semicolon; | 4603 this._semicolon = semicolon; |
| 4647 } | 4604 } |
| 4648 | 4605 |
| 4649 /** | 4606 /** |
| 4650 * Initialize a newly created empty statement. | 4607 * Initialize a newly created empty statement. |
| 4651 * @param semicolon the semicolon terminating the statement | 4608 * @param semicolon the semicolon terminating the statement |
| 4652 */ | 4609 */ |
| 4653 EmptyStatement({Token semicolon}) : this.full(semicolon); | 4610 EmptyStatement({Token semicolon}) : this.full(semicolon); |
| 4654 accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this); | 4611 accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this); |
| 4655 Token get beginToken => _semicolon; | 4612 Token get beginToken => _semicolon; |
| 4656 Token get endToken => _semicolon; | 4613 Token get endToken => _semicolon; |
| 4657 | 4614 |
| 4658 /** | 4615 /** |
| 4659 * Return the semicolon terminating the statement. | 4616 * Return the semicolon terminating the statement. |
| 4660 * @return the semicolon terminating the statement | 4617 * @return the semicolon terminating the statement |
| 4661 */ | 4618 */ |
| 4662 Token get semicolon => _semicolon; | 4619 Token get semicolon => _semicolon; |
| 4663 | 4620 |
| 4664 /** | 4621 /** |
| 4665 * Set the semicolon terminating the statement to the given token. | 4622 * Set the semicolon terminating the statement to the given token. |
| 4666 * @param semicolon the semicolon terminating the statement | 4623 * @param semicolon the semicolon terminating the statement |
| 4667 */ | 4624 */ |
| 4668 void set semicolon(Token semicolon2) { | 4625 void set semicolon(Token semicolon2) { |
| 4669 this._semicolon = semicolon2; | 4626 this._semicolon = semicolon2; |
| 4670 } | 4627 } |
| 4671 void visitChildren(ASTVisitor<Object> visitor) { | 4628 void visitChildren(ASTVisitor<Object> visitor) { |
| 4672 } | 4629 } |
| 4673 } | 4630 } |
| 4674 | |
| 4675 /** | 4631 /** |
| 4676 * Ephemeral identifiers are created as needed to mimic the presence of an empty
identifier. | 4632 * Ephemeral identifiers are created as needed to mimic the presence of an empty
identifier. |
| 4677 * @coverage dart.engine.ast | 4633 * @coverage dart.engine.ast |
| 4678 */ | 4634 */ |
| 4679 class EphemeralIdentifier extends SimpleIdentifier { | 4635 class EphemeralIdentifier extends SimpleIdentifier { |
| 4680 EphemeralIdentifier.full(ASTNode parent, int location) : super.full(new Token(
TokenType.IDENTIFIER, location)) { | 4636 EphemeralIdentifier.full(ASTNode parent, int location) : super.full(new Token(
TokenType.IDENTIFIER, location)) { |
| 4681 parent.becomeParentOf(this); | 4637 parent.becomeParentOf(this); |
| 4682 } | 4638 } |
| 4683 EphemeralIdentifier({ASTNode parent, int location}) : this.full(parent, locati
on); | 4639 EphemeralIdentifier({ASTNode parent, int location}) : this.full(parent, locati
on); |
| 4684 } | 4640 } |
| 4685 | |
| 4686 /** | 4641 /** |
| 4687 * Instances of the class {@code ExportDirective} represent an export directive. | 4642 * Instances of the class {@code ExportDirective} represent an export directive. |
| 4688 * <pre> | 4643 * <pre> |
| 4689 * exportDirective ::={@link Annotation metadata} 'export' {@link StringLiteral
libraryUri} {@link Combinator combinator}* ';' | 4644 * exportDirective ::={@link Annotation metadata} 'export' {@link StringLiteral
libraryUri} {@link Combinator combinator}* ';' |
| 4690 * </pre> | 4645 * </pre> |
| 4691 * @coverage dart.engine.ast | 4646 * @coverage dart.engine.ast |
| 4692 */ | 4647 */ |
| 4693 class ExportDirective extends NamespaceDirective { | 4648 class ExportDirective extends NamespaceDirective { |
| 4694 | 4649 |
| 4695 /** | 4650 /** |
| 4696 * Initialize a newly created export directive. | 4651 * Initialize a newly created export directive. |
| 4697 * @param comment the documentation comment associated with this directive | 4652 * @param comment the documentation comment associated with this directive |
| 4698 * @param metadata the annotations associated with the directive | 4653 * @param metadata the annotations associated with the directive |
| 4699 * @param keyword the token representing the 'export' keyword | 4654 * @param keyword the token representing the 'export' keyword |
| 4700 * @param libraryUri the URI of the library being exported | 4655 * @param libraryUri the URI of the library being exported |
| 4701 * @param combinators the combinators used to control which names are exported | 4656 * @param combinators the combinators used to control which names are exported |
| 4702 * @param semicolon the semicolon terminating the directive | 4657 * @param semicolon the semicolon terminating the directive |
| 4703 */ | 4658 */ |
| 4704 ExportDirective.full(Comment comment, List<Annotation> metadata, Token keyword
, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) : sup
er.full(comment, metadata, keyword, libraryUri, combinators, semicolon) { | 4659 ExportDirective.full(Comment comment, List<Annotation> metadata, Token keyword
, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) : sup
er.full(comment, metadata, keyword, libraryUri, combinators, semicolon) { |
| 4705 } | 4660 } |
| 4706 | 4661 |
| 4707 /** | 4662 /** |
| 4708 * Initialize a newly created export directive. | 4663 * Initialize a newly created export directive. |
| 4709 * @param comment the documentation comment associated with this directive | 4664 * @param comment the documentation comment associated with this directive |
| 4710 * @param metadata the annotations associated with the directive | 4665 * @param metadata the annotations associated with the directive |
| 4711 * @param keyword the token representing the 'export' keyword | 4666 * @param keyword the token representing the 'export' keyword |
| 4712 * @param libraryUri the URI of the library being exported | 4667 * @param libraryUri the URI of the library being exported |
| 4713 * @param combinators the combinators used to control which names are exported | 4668 * @param combinators the combinators used to control which names are exported |
| 4714 * @param semicolon the semicolon terminating the directive | 4669 * @param semicolon the semicolon terminating the directive |
| 4715 */ | 4670 */ |
| 4716 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); | 4671 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); |
| 4717 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); | 4672 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); |
| 4718 LibraryElement get uriElement { | 4673 LibraryElement get uriElement { |
| 4719 Element element2 = element; | 4674 Element element2 = element; |
| 4720 if (element2 is ExportElement) { | 4675 if (element2 is ExportElement) { |
| 4721 return ((element2 as ExportElement)).exportedLibrary; | 4676 return ((element2 as ExportElement)).exportedLibrary; |
| 4722 } | 4677 } |
| 4723 return null; | 4678 return null; |
| 4724 } | 4679 } |
| 4725 void visitChildren(ASTVisitor<Object> visitor) { | 4680 void visitChildren(ASTVisitor<Object> visitor) { |
| 4726 super.visitChildren(visitor); | 4681 super.visitChildren(visitor); |
| 4727 combinators.accept(visitor); | 4682 combinators.accept(visitor); |
| 4728 } | 4683 } |
| 4729 } | 4684 } |
| 4730 | |
| 4731 /** | 4685 /** |
| 4732 * Instances of the class {@code Expression} defines the behavior common to node
s that represent an | 4686 * Instances of the class {@code Expression} defines the behavior common to node
s that represent an |
| 4733 * expression. | 4687 * expression. |
| 4734 * <pre> | 4688 * <pre> |
| 4735 * expression ::={@link AssignmentExpression assignmentExpression}| {@link Condi
tionalExpression conditionalExpression} cascadeSection | 4689 * expression ::={@link AssignmentExpression assignmentExpression}| {@link Condi
tionalExpression conditionalExpression} cascadeSection |
| 4736 * | {@link ThrowExpression throwExpression}</pre> | 4690 * | {@link ThrowExpression throwExpression}</pre> |
| 4737 * @coverage dart.engine.ast | 4691 * @coverage dart.engine.ast |
| 4738 */ | 4692 */ |
| 4739 abstract class Expression extends ASTNode { | 4693 abstract class Expression extends ASTNode { |
| 4740 | 4694 |
| 4741 /** | 4695 /** |
| 4742 * The static type of this expression, or {@code null} if the AST structure ha
s not been resolved. | 4696 * The static type of this expression, or {@code null} if the AST structure ha
s not been resolved. |
| 4743 */ | 4697 */ |
| 4744 Type2 _staticType; | 4698 Type2 _staticType; |
| 4745 | 4699 |
| 4746 /** | 4700 /** |
| 4747 * The propagated type of this expression, or {@code null} if type propagation
has not been | 4701 * The propagated type of this expression, or {@code null} if type propagation
has not been |
| 4748 * performed on the AST structure. | 4702 * performed on the AST structure. |
| 4749 */ | 4703 */ |
| 4750 Type2 _propagatedType; | 4704 Type2 _propagatedType; |
| 4751 | 4705 |
| 4752 /** | 4706 /** |
| 4753 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, | 4707 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, |
| 4754 * and the function being invoked is known, and this expression corresponds to
one of the | 4708 * and the function being invoked is known, and this expression corresponds to
one of the |
| 4755 * parameters of the function being invoked, then return the parameter element
representing the | 4709 * parameters of the function being invoked, then return the parameter element
representing the |
| 4756 * parameter to which the value of this expression will be bound. Otherwise, r
eturn {@code null}. | 4710 * parameter to which the value of this expression will be bound. Otherwise, r
eturn {@code null}. |
| 4757 * @return the parameter element representing the parameter to which the value
of this expression | 4711 * @return the parameter element representing the parameter to which the value
of this expression |
| 4758 * will be bound | 4712 * will be bound |
| 4759 */ | 4713 */ |
| 4760 ParameterElement get parameterElement { | 4714 ParameterElement get parameterElement { |
| 4761 ASTNode parent2 = parent; | 4715 ASTNode parent2 = parent; |
| 4762 if (parent2 is ArgumentList) { | 4716 if (parent2 is ArgumentList) { |
| 4763 return ((parent2 as ArgumentList)).getParameterElementFor(this); | 4717 return ((parent2 as ArgumentList)).getParameterElementFor(this); |
| 4764 } | 4718 } |
| 4765 if (parent2 is IndexExpression) { | 4719 if (parent2 is IndexExpression) { |
| 4766 IndexExpression indexExpression = parent2 as IndexExpression; | 4720 IndexExpression indexExpression = parent2 as IndexExpression; |
| 4767 if (identical(indexExpression.index, this)) { | 4721 if (identical(indexExpression.index, this)) { |
| 4768 return indexExpression.parameterElementForIndex; | 4722 return indexExpression.parameterElementForIndex; |
| 4769 } | 4723 } |
| 4770 } | 4724 } |
| 4771 if (parent2 is BinaryExpression) { | 4725 if (parent2 is BinaryExpression) { |
| 4772 BinaryExpression binaryExpression = parent2 as BinaryExpression; | 4726 BinaryExpression binaryExpression = parent2 as BinaryExpression; |
| 4773 if (identical(binaryExpression.rightOperand, this)) { | 4727 if (identical(binaryExpression.rightOperand, this)) { |
| 4774 return binaryExpression.parameterElementForRightOperand; | 4728 return binaryExpression.parameterElementForRightOperand; |
| 4775 } | 4729 } |
| 4776 } | 4730 } |
| 4777 return null; | 4731 return null; |
| 4778 } | 4732 } |
| 4779 | 4733 |
| 4780 /** | 4734 /** |
| 4781 * Return the propagated type of this expression, or {@code null} if type prop
agation has not been | 4735 * Return the propagated type of this expression, or {@code null} if type prop
agation has not been |
| 4782 * performed on the AST structure. | 4736 * performed on the AST structure. |
| 4783 * @return the propagated type of this expression | 4737 * @return the propagated type of this expression |
| 4784 */ | 4738 */ |
| 4785 Type2 get propagatedType => _propagatedType; | 4739 Type2 get propagatedType => _propagatedType; |
| 4786 | 4740 |
| 4787 /** | 4741 /** |
| 4788 * Return the static type of this expression, or {@code null} if the AST struc
ture has not been | 4742 * Return the static type of this expression, or {@code null} if the AST struc
ture has not been |
| 4789 * resolved. | 4743 * resolved. |
| 4790 * @return the static type of this expression | 4744 * @return the static type of this expression |
| 4791 */ | 4745 */ |
| 4792 Type2 get staticType => _staticType; | 4746 Type2 get staticType => _staticType; |
| 4793 | 4747 |
| 4794 /** | 4748 /** |
| 4795 * Return {@code true} if this expression is syntactically valid for the LHS o
f an{@link AssignmentExpression assignment expression}. | 4749 * Return {@code true} if this expression is syntactically valid for the LHS o
f an{@link AssignmentExpression assignment expression}. |
| 4796 * @return {@code true} if this expression matches the {@code assignableExpres
sion} production | 4750 * @return {@code true} if this expression matches the {@code assignableExpres
sion} production |
| 4797 */ | 4751 */ |
| 4798 bool isAssignable() => false; | 4752 bool isAssignable() => false; |
| 4799 | 4753 |
| 4800 /** | 4754 /** |
| 4801 * Set the propagated type of this expression to the given type. | 4755 * Set the propagated type of this expression to the given type. |
| 4802 * @param propagatedType the propagated type of this expression | 4756 * @param propagatedType the propagated type of this expression |
| 4803 */ | 4757 */ |
| 4804 void set propagatedType(Type2 propagatedType2) { | 4758 void set propagatedType(Type2 propagatedType2) { |
| 4805 this._propagatedType = propagatedType2; | 4759 this._propagatedType = propagatedType2; |
| 4806 } | 4760 } |
| 4807 | 4761 |
| 4808 /** | 4762 /** |
| 4809 * Set the static type of this expression to the given type. | 4763 * Set the static type of this expression to the given type. |
| 4810 * @param staticType the static type of this expression | 4764 * @param staticType the static type of this expression |
| 4811 */ | 4765 */ |
| 4812 void set staticType(Type2 staticType2) { | 4766 void set staticType(Type2 staticType2) { |
| 4813 this._staticType = staticType2; | 4767 this._staticType = staticType2; |
| 4814 } | 4768 } |
| 4815 } | 4769 } |
| 4816 | |
| 4817 /** | 4770 /** |
| 4818 * Instances of the class {@code ExpressionFunctionBody} represent a function bo
dy consisting of a | 4771 * Instances of the class {@code ExpressionFunctionBody} represent a function bo
dy consisting of a |
| 4819 * single expression. | 4772 * single expression. |
| 4820 * <pre> | 4773 * <pre> |
| 4821 * expressionFunctionBody ::= | 4774 * expressionFunctionBody ::= |
| 4822 * '=>' {@link Expression expression} ';' | 4775 * '=>' {@link Expression expression} ';' |
| 4823 * </pre> | 4776 * </pre> |
| 4824 * @coverage dart.engine.ast | 4777 * @coverage dart.engine.ast |
| 4825 */ | 4778 */ |
| 4826 class ExpressionFunctionBody extends FunctionBody { | 4779 class ExpressionFunctionBody extends FunctionBody { |
| 4827 | 4780 |
| 4828 /** | 4781 /** |
| 4829 * The token introducing the expression that represents the body of the functi
on. | 4782 * The token introducing the expression that represents the body of the functi
on. |
| 4830 */ | 4783 */ |
| 4831 Token _functionDefinition; | 4784 Token _functionDefinition; |
| 4832 | 4785 |
| 4833 /** | 4786 /** |
| 4834 * The expression representing the body of the function. | 4787 * The expression representing the body of the function. |
| 4835 */ | 4788 */ |
| 4836 Expression _expression; | 4789 Expression _expression; |
| 4837 | 4790 |
| 4838 /** | 4791 /** |
| 4839 * The semicolon terminating the statement. | 4792 * The semicolon terminating the statement. |
| 4840 */ | 4793 */ |
| 4841 Token _semicolon; | 4794 Token _semicolon; |
| 4842 | 4795 |
| 4843 /** | 4796 /** |
| 4844 * Initialize a newly created function body consisting of a block of statement
s. | 4797 * Initialize a newly created function body consisting of a block of statement
s. |
| 4845 * @param functionDefinition the token introducing the expression that represe
nts the body of the | 4798 * @param functionDefinition the token introducing the expression that represe
nts the body of the |
| 4846 * function | 4799 * function |
| 4847 * @param expression the expression representing the body of the function | 4800 * @param expression the expression representing the body of the function |
| 4848 * @param semicolon the semicolon terminating the statement | 4801 * @param semicolon the semicolon terminating the statement |
| 4849 */ | 4802 */ |
| 4850 ExpressionFunctionBody.full(Token functionDefinition, Expression expression, T
oken semicolon) { | 4803 ExpressionFunctionBody.full(Token functionDefinition, Expression expression, T
oken semicolon) { |
| 4851 this._functionDefinition = functionDefinition; | 4804 this._functionDefinition = functionDefinition; |
| 4852 this._expression = becomeParentOf(expression); | 4805 this._expression = becomeParentOf(expression); |
| 4853 this._semicolon = semicolon; | 4806 this._semicolon = semicolon; |
| 4854 } | 4807 } |
| 4855 | 4808 |
| 4856 /** | 4809 /** |
| 4857 * Initialize a newly created function body consisting of a block of statement
s. | 4810 * Initialize a newly created function body consisting of a block of statement
s. |
| 4858 * @param functionDefinition the token introducing the expression that represe
nts the body of the | 4811 * @param functionDefinition the token introducing the expression that represe
nts the body of the |
| 4859 * function | 4812 * function |
| 4860 * @param expression the expression representing the body of the function | 4813 * @param expression the expression representing the body of the function |
| 4861 * @param semicolon the semicolon terminating the statement | 4814 * @param semicolon the semicolon terminating the statement |
| 4862 */ | 4815 */ |
| 4863 ExpressionFunctionBody({Token functionDefinition, Expression expression, Token
semicolon}) : this.full(functionDefinition, expression, semicolon); | 4816 ExpressionFunctionBody({Token functionDefinition, Expression expression, Token
semicolon}) : this.full(functionDefinition, expression, semicolon); |
| 4864 accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this); | 4817 accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this); |
| 4865 Token get beginToken => _functionDefinition; | 4818 Token get beginToken => _functionDefinition; |
| 4866 Token get endToken { | 4819 Token get endToken { |
| 4867 if (_semicolon != null) { | 4820 if (_semicolon != null) { |
| 4868 return _semicolon; | 4821 return _semicolon; |
| 4869 } | 4822 } |
| 4870 return _expression.endToken; | 4823 return _expression.endToken; |
| 4871 } | 4824 } |
| 4872 | 4825 |
| 4873 /** | 4826 /** |
| 4874 * Return the expression representing the body of the function. | 4827 * Return the expression representing the body of the function. |
| 4875 * @return the expression representing the body of the function | 4828 * @return the expression representing the body of the function |
| 4876 */ | 4829 */ |
| 4877 Expression get expression => _expression; | 4830 Expression get expression => _expression; |
| 4878 | 4831 |
| 4879 /** | 4832 /** |
| 4880 * Return the token introducing the expression that represents the body of the
function. | 4833 * Return the token introducing the expression that represents the body of the
function. |
| 4881 * @return the function definition token | 4834 * @return the function definition token |
| 4882 */ | 4835 */ |
| 4883 Token get functionDefinition => _functionDefinition; | 4836 Token get functionDefinition => _functionDefinition; |
| 4884 | 4837 |
| 4885 /** | 4838 /** |
| 4886 * Return the semicolon terminating the statement. | 4839 * Return the semicolon terminating the statement. |
| 4887 * @return the semicolon terminating the statement | 4840 * @return the semicolon terminating the statement |
| 4888 */ | 4841 */ |
| 4889 Token get semicolon => _semicolon; | 4842 Token get semicolon => _semicolon; |
| 4890 | 4843 |
| 4891 /** | 4844 /** |
| 4892 * Set the expression representing the body of the function to the given expre
ssion. | 4845 * Set the expression representing the body of the function to the given expre
ssion. |
| 4893 * @param expression the expression representing the body of the function | 4846 * @param expression the expression representing the body of the function |
| 4894 */ | 4847 */ |
| 4895 void set expression(Expression expression2) { | 4848 void set expression(Expression expression2) { |
| 4896 this._expression = becomeParentOf(expression2); | 4849 this._expression = becomeParentOf(expression2); |
| 4897 } | 4850 } |
| 4898 | 4851 |
| 4899 /** | 4852 /** |
| 4900 * Set the token introducing the expression that represents the body of the fu
nction to the given | 4853 * Set the token introducing the expression that represents the body of the fu
nction to the given |
| 4901 * token. | 4854 * token. |
| 4902 * @param functionDefinition the function definition token | 4855 * @param functionDefinition the function definition token |
| 4903 */ | 4856 */ |
| 4904 void set functionDefinition(Token functionDefinition2) { | 4857 void set functionDefinition(Token functionDefinition2) { |
| 4905 this._functionDefinition = functionDefinition2; | 4858 this._functionDefinition = functionDefinition2; |
| 4906 } | 4859 } |
| 4907 | 4860 |
| 4908 /** | 4861 /** |
| 4909 * Set the semicolon terminating the statement to the given token. | 4862 * Set the semicolon terminating the statement to the given token. |
| 4910 * @param semicolon the semicolon terminating the statement | 4863 * @param semicolon the semicolon terminating the statement |
| 4911 */ | 4864 */ |
| 4912 void set semicolon(Token semicolon2) { | 4865 void set semicolon(Token semicolon2) { |
| 4913 this._semicolon = semicolon2; | 4866 this._semicolon = semicolon2; |
| 4914 } | 4867 } |
| 4915 void visitChildren(ASTVisitor<Object> visitor) { | 4868 void visitChildren(ASTVisitor<Object> visitor) { |
| 4916 safelyVisitChild(_expression, visitor); | 4869 safelyVisitChild(_expression, visitor); |
| 4917 } | 4870 } |
| 4918 } | 4871 } |
| 4919 | |
| 4920 /** | 4872 /** |
| 4921 * Instances of the class {@code ExpressionStatement} wrap an expression as a st
atement. | 4873 * Instances of the class {@code ExpressionStatement} wrap an expression as a st
atement. |
| 4922 * <pre> | 4874 * <pre> |
| 4923 * expressionStatement ::={@link Expression expression}? ';' | 4875 * expressionStatement ::={@link Expression expression}? ';' |
| 4924 * </pre> | 4876 * </pre> |
| 4925 * @coverage dart.engine.ast | 4877 * @coverage dart.engine.ast |
| 4926 */ | 4878 */ |
| 4927 class ExpressionStatement extends Statement { | 4879 class ExpressionStatement extends Statement { |
| 4928 | 4880 |
| 4929 /** | 4881 /** |
| 4930 * The expression that comprises the statement. | 4882 * The expression that comprises the statement. |
| 4931 */ | 4883 */ |
| 4932 Expression _expression; | 4884 Expression _expression; |
| 4933 | 4885 |
| 4934 /** | 4886 /** |
| 4935 * The semicolon terminating the statement, or {@code null} if the expression
is a function | 4887 * The semicolon terminating the statement, or {@code null} if the expression
is a function |
| 4936 * expression and isn't followed by a semicolon. | 4888 * expression and isn't followed by a semicolon. |
| 4937 */ | 4889 */ |
| 4938 Token _semicolon; | 4890 Token _semicolon; |
| 4939 | 4891 |
| 4940 /** | 4892 /** |
| 4941 * Initialize a newly created expression statement. | 4893 * Initialize a newly created expression statement. |
| 4942 * @param expression the expression that comprises the statement | 4894 * @param expression the expression that comprises the statement |
| 4943 * @param semicolon the semicolon terminating the statement | 4895 * @param semicolon the semicolon terminating the statement |
| 4944 */ | 4896 */ |
| 4945 ExpressionStatement.full(Expression expression, Token semicolon) { | 4897 ExpressionStatement.full(Expression expression, Token semicolon) { |
| 4946 this._expression = becomeParentOf(expression); | 4898 this._expression = becomeParentOf(expression); |
| 4947 this._semicolon = semicolon; | 4899 this._semicolon = semicolon; |
| 4948 } | 4900 } |
| 4949 | 4901 |
| 4950 /** | 4902 /** |
| 4951 * Initialize a newly created expression statement. | 4903 * Initialize a newly created expression statement. |
| 4952 * @param expression the expression that comprises the statement | 4904 * @param expression the expression that comprises the statement |
| 4953 * @param semicolon the semicolon terminating the statement | 4905 * @param semicolon the semicolon terminating the statement |
| 4954 */ | 4906 */ |
| 4955 ExpressionStatement({Expression expression, Token semicolon}) : this.full(expr
ession, semicolon); | 4907 ExpressionStatement({Expression expression, Token semicolon}) : this.full(expr
ession, semicolon); |
| 4956 accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this); | 4908 accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this); |
| 4957 Token get beginToken => _expression.beginToken; | 4909 Token get beginToken => _expression.beginToken; |
| 4958 Token get endToken { | 4910 Token get endToken { |
| 4959 if (_semicolon != null) { | 4911 if (_semicolon != null) { |
| 4960 return _semicolon; | 4912 return _semicolon; |
| 4961 } | 4913 } |
| 4962 return _expression.endToken; | 4914 return _expression.endToken; |
| 4963 } | 4915 } |
| 4964 | 4916 |
| 4965 /** | 4917 /** |
| 4966 * Return the expression that comprises the statement. | 4918 * Return the expression that comprises the statement. |
| 4967 * @return the expression that comprises the statement | 4919 * @return the expression that comprises the statement |
| 4968 */ | 4920 */ |
| 4969 Expression get expression => _expression; | 4921 Expression get expression => _expression; |
| 4970 | 4922 |
| 4971 /** | 4923 /** |
| 4972 * Return the semicolon terminating the statement. | 4924 * Return the semicolon terminating the statement. |
| 4973 * @return the semicolon terminating the statement | 4925 * @return the semicolon terminating the statement |
| 4974 */ | 4926 */ |
| 4975 Token get semicolon => _semicolon; | 4927 Token get semicolon => _semicolon; |
| 4976 bool isSynthetic() => _expression.isSynthetic() && _semicolon.isSynthetic(); | 4928 bool isSynthetic() => _expression.isSynthetic() && _semicolon.isSynthetic(); |
| 4977 | 4929 |
| 4978 /** | 4930 /** |
| 4979 * Set the expression that comprises the statement to the given expression. | 4931 * Set the expression that comprises the statement to the given expression. |
| 4980 * @param expression the expression that comprises the statement | 4932 * @param expression the expression that comprises the statement |
| 4981 */ | 4933 */ |
| 4982 void set expression(Expression expression2) { | 4934 void set expression(Expression expression2) { |
| 4983 this._expression = becomeParentOf(expression2); | 4935 this._expression = becomeParentOf(expression2); |
| 4984 } | 4936 } |
| 4985 | 4937 |
| 4986 /** | 4938 /** |
| 4987 * Set the semicolon terminating the statement to the given token. | 4939 * Set the semicolon terminating the statement to the given token. |
| 4988 * @param semicolon the semicolon terminating the statement | 4940 * @param semicolon the semicolon terminating the statement |
| 4989 */ | 4941 */ |
| 4990 void set semicolon(Token semicolon2) { | 4942 void set semicolon(Token semicolon2) { |
| 4991 this._semicolon = semicolon2; | 4943 this._semicolon = semicolon2; |
| 4992 } | 4944 } |
| 4993 void visitChildren(ASTVisitor<Object> visitor) { | 4945 void visitChildren(ASTVisitor<Object> visitor) { |
| 4994 safelyVisitChild(_expression, visitor); | 4946 safelyVisitChild(_expression, visitor); |
| 4995 } | 4947 } |
| 4996 } | 4948 } |
| 4997 | |
| 4998 /** | 4949 /** |
| 4999 * Instances of the class {@code ExtendsClause} represent the "extends" clause i
n a class | 4950 * Instances of the class {@code ExtendsClause} represent the "extends" clause i
n a class |
| 5000 * declaration. | 4951 * declaration. |
| 5001 * <pre> | 4952 * <pre> |
| 5002 * extendsClause ::= | 4953 * extendsClause ::= |
| 5003 * 'extends' {@link TypeName superclass}</pre> | 4954 * 'extends' {@link TypeName superclass}</pre> |
| 5004 * @coverage dart.engine.ast | 4955 * @coverage dart.engine.ast |
| 5005 */ | 4956 */ |
| 5006 class ExtendsClause extends ASTNode { | 4957 class ExtendsClause extends ASTNode { |
| 5007 | 4958 |
| 5008 /** | 4959 /** |
| 5009 * The token representing the 'extends' keyword. | 4960 * The token representing the 'extends' keyword. |
| 5010 */ | 4961 */ |
| 5011 Token _keyword; | 4962 Token _keyword; |
| 5012 | 4963 |
| 5013 /** | 4964 /** |
| 5014 * The name of the class that is being extended. | 4965 * The name of the class that is being extended. |
| 5015 */ | 4966 */ |
| 5016 TypeName _superclass; | 4967 TypeName _superclass; |
| 5017 | 4968 |
| 5018 /** | 4969 /** |
| 5019 * Initialize a newly created extends clause. | 4970 * Initialize a newly created extends clause. |
| 5020 * @param keyword the token representing the 'extends' keyword | 4971 * @param keyword the token representing the 'extends' keyword |
| 5021 * @param superclass the name of the class that is being extended | 4972 * @param superclass the name of the class that is being extended |
| 5022 */ | 4973 */ |
| 5023 ExtendsClause.full(Token keyword, TypeName superclass) { | 4974 ExtendsClause.full(Token keyword, TypeName superclass) { |
| 5024 this._keyword = keyword; | 4975 this._keyword = keyword; |
| 5025 this._superclass = becomeParentOf(superclass); | 4976 this._superclass = becomeParentOf(superclass); |
| 5026 } | 4977 } |
| 5027 | 4978 |
| 5028 /** | 4979 /** |
| 5029 * Initialize a newly created extends clause. | 4980 * Initialize a newly created extends clause. |
| 5030 * @param keyword the token representing the 'extends' keyword | 4981 * @param keyword the token representing the 'extends' keyword |
| 5031 * @param superclass the name of the class that is being extended | 4982 * @param superclass the name of the class that is being extended |
| 5032 */ | 4983 */ |
| 5033 ExtendsClause({Token keyword, TypeName superclass}) : this.full(keyword, super
class); | 4984 ExtendsClause({Token keyword, TypeName superclass}) : this.full(keyword, super
class); |
| 5034 accept(ASTVisitor visitor) => visitor.visitExtendsClause(this); | 4985 accept(ASTVisitor visitor) => visitor.visitExtendsClause(this); |
| 5035 Token get beginToken => _keyword; | 4986 Token get beginToken => _keyword; |
| 5036 Token get endToken => _superclass.endToken; | 4987 Token get endToken => _superclass.endToken; |
| 5037 | 4988 |
| 5038 /** | 4989 /** |
| 5039 * Return the token representing the 'extends' keyword. | 4990 * Return the token representing the 'extends' keyword. |
| 5040 * @return the token representing the 'extends' keyword | 4991 * @return the token representing the 'extends' keyword |
| 5041 */ | 4992 */ |
| 5042 Token get keyword => _keyword; | 4993 Token get keyword => _keyword; |
| 5043 | 4994 |
| 5044 /** | 4995 /** |
| 5045 * Return the name of the class that is being extended. | 4996 * Return the name of the class that is being extended. |
| 5046 * @return the name of the class that is being extended | 4997 * @return the name of the class that is being extended |
| 5047 */ | 4998 */ |
| 5048 TypeName get superclass => _superclass; | 4999 TypeName get superclass => _superclass; |
| 5049 | 5000 |
| 5050 /** | 5001 /** |
| 5051 * Set the token representing the 'extends' keyword to the given token. | 5002 * Set the token representing the 'extends' keyword to the given token. |
| 5052 * @param keyword the token representing the 'extends' keyword | 5003 * @param keyword the token representing the 'extends' keyword |
| 5053 */ | 5004 */ |
| 5054 void set keyword(Token keyword2) { | 5005 void set keyword(Token keyword2) { |
| 5055 this._keyword = keyword2; | 5006 this._keyword = keyword2; |
| 5056 } | 5007 } |
| 5057 | 5008 |
| 5058 /** | 5009 /** |
| 5059 * Set the name of the class that is being extended to the given name. | 5010 * Set the name of the class that is being extended to the given name. |
| 5060 * @param name the name of the class that is being extended | 5011 * @param name the name of the class that is being extended |
| 5061 */ | 5012 */ |
| 5062 void set superclass(TypeName name) { | 5013 void set superclass(TypeName name) { |
| 5063 _superclass = becomeParentOf(name); | 5014 _superclass = becomeParentOf(name); |
| 5064 } | 5015 } |
| 5065 void visitChildren(ASTVisitor<Object> visitor) { | 5016 void visitChildren(ASTVisitor<Object> visitor) { |
| 5066 safelyVisitChild(_superclass, visitor); | 5017 safelyVisitChild(_superclass, visitor); |
| 5067 } | 5018 } |
| 5068 } | 5019 } |
| 5069 | |
| 5070 /** | 5020 /** |
| 5071 * Instances of the class {@code FieldDeclaration} represent the declaration of
one or more fields | 5021 * Instances of the class {@code FieldDeclaration} represent the declaration of
one or more fields |
| 5072 * of the same type. | 5022 * of the same type. |
| 5073 * <pre> | 5023 * <pre> |
| 5074 * fieldDeclaration ::= | 5024 * fieldDeclaration ::= |
| 5075 * 'static'? {@link VariableDeclarationList fieldList} ';' | 5025 * 'static'? {@link VariableDeclarationList fieldList} ';' |
| 5076 * </pre> | 5026 * </pre> |
| 5077 * @coverage dart.engine.ast | 5027 * @coverage dart.engine.ast |
| 5078 */ | 5028 */ |
| 5079 class FieldDeclaration extends ClassMember { | 5029 class FieldDeclaration extends ClassMember { |
| 5080 | 5030 |
| 5081 /** | 5031 /** |
| 5082 * The token representing the 'static' keyword, or {@code null} if the fields
are not static. | 5032 * The token representing the 'static' keyword, or {@code null} if the fields
are not static. |
| 5083 */ | 5033 */ |
| 5084 Token _keyword; | 5034 Token _keyword; |
| 5085 | 5035 |
| 5086 /** | 5036 /** |
| 5087 * The fields being declared. | 5037 * The fields being declared. |
| 5088 */ | 5038 */ |
| 5089 VariableDeclarationList _fieldList; | 5039 VariableDeclarationList _fieldList; |
| 5090 | 5040 |
| 5091 /** | 5041 /** |
| 5092 * The semicolon terminating the declaration. | 5042 * The semicolon terminating the declaration. |
| 5093 */ | 5043 */ |
| 5094 Token _semicolon; | 5044 Token _semicolon; |
| 5095 | 5045 |
| 5096 /** | 5046 /** |
| 5097 * Initialize a newly created field declaration. | 5047 * Initialize a newly created field declaration. |
| 5098 * @param comment the documentation comment associated with this field | 5048 * @param comment the documentation comment associated with this field |
| 5099 * @param metadata the annotations associated with this field | 5049 * @param metadata the annotations associated with this field |
| 5100 * @param keyword the token representing the 'static' keyword | 5050 * @param keyword the token representing the 'static' keyword |
| 5101 * @param fieldList the fields being declared | 5051 * @param fieldList the fields being declared |
| 5102 * @param semicolon the semicolon terminating the declaration | 5052 * @param semicolon the semicolon terminating the declaration |
| 5103 */ | 5053 */ |
| 5104 FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token keywor
d, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, met
adata) { | 5054 FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token keywor
d, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, met
adata) { |
| 5105 this._keyword = keyword; | 5055 this._keyword = keyword; |
| 5106 this._fieldList = becomeParentOf(fieldList); | 5056 this._fieldList = becomeParentOf(fieldList); |
| 5107 this._semicolon = semicolon; | 5057 this._semicolon = semicolon; |
| 5108 } | 5058 } |
| 5109 | 5059 |
| 5110 /** | 5060 /** |
| 5111 * Initialize a newly created field declaration. | 5061 * Initialize a newly created field declaration. |
| 5112 * @param comment the documentation comment associated with this field | 5062 * @param comment the documentation comment associated with this field |
| 5113 * @param metadata the annotations associated with this field | 5063 * @param metadata the annotations associated with this field |
| 5114 * @param keyword the token representing the 'static' keyword | 5064 * @param keyword the token representing the 'static' keyword |
| 5115 * @param fieldList the fields being declared | 5065 * @param fieldList the fields being declared |
| 5116 * @param semicolon the semicolon terminating the declaration | 5066 * @param semicolon the semicolon terminating the declaration |
| 5117 */ | 5067 */ |
| 5118 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V
ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat
a, keyword, fieldList, semicolon); | 5068 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V
ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat
a, keyword, fieldList, semicolon); |
| 5119 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); | 5069 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); |
| 5120 Element get element => null; | 5070 Element get element => null; |
| 5121 Token get endToken => _semicolon; | 5071 Token get endToken => _semicolon; |
| 5122 | 5072 |
| 5123 /** | 5073 /** |
| 5124 * Return the fields being declared. | 5074 * Return the fields being declared. |
| 5125 * @return the fields being declared | 5075 * @return the fields being declared |
| 5126 */ | 5076 */ |
| 5127 VariableDeclarationList get fields => _fieldList; | 5077 VariableDeclarationList get fields => _fieldList; |
| 5128 | 5078 |
| 5129 /** | 5079 /** |
| 5130 * Return the token representing the 'static' keyword, or {@code null} if the
fields are not | 5080 * Return the token representing the 'static' keyword, or {@code null} if the
fields are not |
| 5131 * static. | 5081 * static. |
| 5132 * @return the token representing the 'static' keyword | 5082 * @return the token representing the 'static' keyword |
| 5133 */ | 5083 */ |
| 5134 Token get keyword => _keyword; | 5084 Token get keyword => _keyword; |
| 5135 | 5085 |
| 5136 /** | 5086 /** |
| 5137 * Return the semicolon terminating the declaration. | 5087 * Return the semicolon terminating the declaration. |
| 5138 * @return the semicolon terminating the declaration | 5088 * @return the semicolon terminating the declaration |
| 5139 */ | 5089 */ |
| 5140 Token get semicolon => _semicolon; | 5090 Token get semicolon => _semicolon; |
| 5141 | 5091 |
| 5142 /** | 5092 /** |
| 5143 * Return {@code true} if the fields are static. | 5093 * Return {@code true} if the fields are static. |
| 5144 * @return {@code true} if the fields are declared to be static | 5094 * @return {@code true} if the fields are declared to be static |
| 5145 */ | 5095 */ |
| 5146 bool isStatic() => _keyword != null; | 5096 bool isStatic() => _keyword != null; |
| 5147 | 5097 |
| 5148 /** | 5098 /** |
| 5149 * Set the fields being declared to the given list of variables. | 5099 * Set the fields being declared to the given list of variables. |
| 5150 * @param fieldList the fields being declared | 5100 * @param fieldList the fields being declared |
| 5151 */ | 5101 */ |
| 5152 void set fields(VariableDeclarationList fieldList) { | 5102 void set fields(VariableDeclarationList fieldList) { |
| 5153 fieldList = becomeParentOf(fieldList); | 5103 fieldList = becomeParentOf(fieldList); |
| 5154 } | 5104 } |
| 5155 | 5105 |
| 5156 /** | 5106 /** |
| 5157 * Set the token representing the 'static' keyword to the given token. | 5107 * Set the token representing the 'static' keyword to the given token. |
| 5158 * @param keyword the token representing the 'static' keyword | 5108 * @param keyword the token representing the 'static' keyword |
| 5159 */ | 5109 */ |
| 5160 void set keyword(Token keyword2) { | 5110 void set keyword(Token keyword2) { |
| 5161 this._keyword = keyword2; | 5111 this._keyword = keyword2; |
| 5162 } | 5112 } |
| 5163 | 5113 |
| 5164 /** | 5114 /** |
| 5165 * Set the semicolon terminating the declaration to the given token. | 5115 * Set the semicolon terminating the declaration to the given token. |
| 5166 * @param semicolon the semicolon terminating the declaration | 5116 * @param semicolon the semicolon terminating the declaration |
| 5167 */ | 5117 */ |
| 5168 void set semicolon(Token semicolon2) { | 5118 void set semicolon(Token semicolon2) { |
| 5169 this._semicolon = semicolon2; | 5119 this._semicolon = semicolon2; |
| 5170 } | 5120 } |
| 5171 void visitChildren(ASTVisitor<Object> visitor) { | 5121 void visitChildren(ASTVisitor<Object> visitor) { |
| 5172 super.visitChildren(visitor); | 5122 super.visitChildren(visitor); |
| 5173 safelyVisitChild(_fieldList, visitor); | 5123 safelyVisitChild(_fieldList, visitor); |
| 5174 } | 5124 } |
| 5175 Token get firstTokenAfterCommentAndMetadata { | 5125 Token get firstTokenAfterCommentAndMetadata { |
| 5176 if (_keyword != null) { | 5126 if (_keyword != null) { |
| 5177 return _keyword; | 5127 return _keyword; |
| 5178 } | 5128 } |
| 5179 return _fieldList.beginToken; | 5129 return _fieldList.beginToken; |
| 5180 } | 5130 } |
| 5181 } | 5131 } |
| 5182 | |
| 5183 /** | 5132 /** |
| 5184 * Instances of the class {@code FieldFormalParameter} represent a field formal
parameter. | 5133 * Instances of the class {@code FieldFormalParameter} represent a field formal
parameter. |
| 5185 * <pre> | 5134 * <pre> |
| 5186 * fieldFormalParameter ::= | 5135 * fieldFormalParameter ::= |
| 5187 * ('final' {@link TypeName type} | 'const' {@link TypeName type} | 'var' | {@li
nk TypeName type})? 'this' '.' {@link SimpleIdentifier identifier}</pre> | 5136 * ('final' {@link TypeName type} | 'const' {@link TypeName type} | 'var' | {@li
nk TypeName type})? 'this' '.' {@link SimpleIdentifier identifier}</pre> |
| 5188 * @coverage dart.engine.ast | 5137 * @coverage dart.engine.ast |
| 5189 */ | 5138 */ |
| 5190 class FieldFormalParameter extends NormalFormalParameter { | 5139 class FieldFormalParameter extends NormalFormalParameter { |
| 5191 | 5140 |
| 5192 /** | 5141 /** |
| 5193 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 5142 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
| 5194 * keyword was used. | 5143 * keyword was used. |
| 5195 */ | 5144 */ |
| 5196 Token _keyword; | 5145 Token _keyword; |
| 5197 | 5146 |
| 5198 /** | 5147 /** |
| 5199 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have | 5148 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have |
| 5200 * a declared type. | 5149 * a declared type. |
| 5201 */ | 5150 */ |
| 5202 TypeName _type; | 5151 TypeName _type; |
| 5203 | 5152 |
| 5204 /** | 5153 /** |
| 5205 * The token representing the 'this' keyword. | 5154 * The token representing the 'this' keyword. |
| 5206 */ | 5155 */ |
| 5207 Token _thisToken; | 5156 Token _thisToken; |
| 5208 | 5157 |
| 5209 /** | 5158 /** |
| 5210 * The token representing the period. | 5159 * The token representing the period. |
| 5211 */ | 5160 */ |
| 5212 Token _period; | 5161 Token _period; |
| 5213 | 5162 |
| 5214 /** | 5163 /** |
| 5215 * Initialize a newly created formal parameter. | 5164 * Initialize a newly created formal parameter. |
| 5216 * @param comment the documentation comment associated with this parameter | 5165 * @param comment the documentation comment associated with this parameter |
| 5217 * @param metadata the annotations associated with this parameter | 5166 * @param metadata the annotations associated with this parameter |
| 5218 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5167 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 5219 * @param type the name of the declared type of the parameter | 5168 * @param type the name of the declared type of the parameter |
| 5220 * @param thisToken the token representing the 'this' keyword | 5169 * @param thisToken the token representing the 'this' keyword |
| 5221 * @param period the token representing the period | 5170 * @param period the token representing the period |
| 5222 * @param identifier the name of the parameter being declared | 5171 * @param identifier the name of the parameter being declared |
| 5223 */ | 5172 */ |
| 5224 FieldFormalParameter.full(Comment comment, List<Annotation> metadata, Token ke
yword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier
) : super.full(comment, metadata, identifier) { | 5173 FieldFormalParameter.full(Comment comment, List<Annotation> metadata, Token ke
yword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier
) : super.full(comment, metadata, identifier) { |
| 5225 this._keyword = keyword; | 5174 this._keyword = keyword; |
| 5226 this._type = becomeParentOf(type); | 5175 this._type = becomeParentOf(type); |
| 5227 this._thisToken = thisToken; | 5176 this._thisToken = thisToken; |
| 5228 this._period = period; | 5177 this._period = period; |
| 5229 } | 5178 } |
| 5230 | 5179 |
| 5231 /** | 5180 /** |
| 5232 * Initialize a newly created formal parameter. | 5181 * Initialize a newly created formal parameter. |
| 5233 * @param comment the documentation comment associated with this parameter | 5182 * @param comment the documentation comment associated with this parameter |
| 5234 * @param metadata the annotations associated with this parameter | 5183 * @param metadata the annotations associated with this parameter |
| 5235 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5184 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 5236 * @param type the name of the declared type of the parameter | 5185 * @param type the name of the declared type of the parameter |
| 5237 * @param thisToken the token representing the 'this' keyword | 5186 * @param thisToken the token representing the 'this' keyword |
| 5238 * @param period the token representing the period | 5187 * @param period the token representing the period |
| 5239 * @param identifier the name of the parameter being declared | 5188 * @param identifier the name of the parameter being declared |
| 5240 */ | 5189 */ |
| 5241 FieldFormalParameter({Comment comment, List<Annotation> metadata, Token keywor
d, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier}) :
this.full(comment, metadata, keyword, type, thisToken, period, identifier); | 5190 FieldFormalParameter({Comment comment, List<Annotation> metadata, Token keywor
d, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier}) :
this.full(comment, metadata, keyword, type, thisToken, period, identifier); |
| 5242 accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this); | 5191 accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this); |
| 5243 Token get beginToken { | 5192 Token get beginToken { |
| 5244 if (_keyword != null) { | 5193 if (_keyword != null) { |
| 5245 return _keyword; | 5194 return _keyword; |
| 5246 } else if (_type != null) { | 5195 } else if (_type != null) { |
| 5247 return _type.beginToken; | 5196 return _type.beginToken; |
| 5248 } | 5197 } |
| 5249 return _thisToken; | 5198 return _thisToken; |
| 5250 } | 5199 } |
| 5251 Token get endToken => identifier.endToken; | 5200 Token get endToken => identifier.endToken; |
| 5252 | 5201 |
| 5253 /** | 5202 /** |
| 5254 * Return the token representing either the 'final', 'const' or 'var' keyword. | 5203 * Return the token representing either the 'final', 'const' or 'var' keyword. |
| 5255 * @return the token representing either the 'final', 'const' or 'var' keyword | 5204 * @return the token representing either the 'final', 'const' or 'var' keyword |
| 5256 */ | 5205 */ |
| 5257 Token get keyword => _keyword; | 5206 Token get keyword => _keyword; |
| 5258 | 5207 |
| 5259 /** | 5208 /** |
| 5260 * Return the token representing the period. | 5209 * Return the token representing the period. |
| 5261 * @return the token representing the period | 5210 * @return the token representing the period |
| 5262 */ | 5211 */ |
| 5263 Token get period => _period; | 5212 Token get period => _period; |
| 5264 | 5213 |
| 5265 /** | 5214 /** |
| 5266 * Return the token representing the 'this' keyword. | 5215 * Return the token representing the 'this' keyword. |
| 5267 * @return the token representing the 'this' keyword | 5216 * @return the token representing the 'this' keyword |
| 5268 */ | 5217 */ |
| 5269 Token get thisToken => _thisToken; | 5218 Token get thisToken => _thisToken; |
| 5270 | 5219 |
| 5271 /** | 5220 /** |
| 5272 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does | 5221 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does |
| 5273 * not have a declared type. | 5222 * not have a declared type. |
| 5274 * @return the name of the declared type of the parameter | 5223 * @return the name of the declared type of the parameter |
| 5275 */ | 5224 */ |
| 5276 TypeName get type => _type; | 5225 TypeName get type => _type; |
| 5277 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 5226 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
| 5278 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); | 5227 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); |
| 5279 | 5228 |
| 5280 /** | 5229 /** |
| 5281 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 5230 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
| 5282 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5231 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 5283 */ | 5232 */ |
| 5284 void set keyword(Token keyword2) { | 5233 void set keyword(Token keyword2) { |
| 5285 this._keyword = keyword2; | 5234 this._keyword = keyword2; |
| 5286 } | 5235 } |
| 5287 | 5236 |
| 5288 /** | 5237 /** |
| 5289 * Set the token representing the period to the given token. | 5238 * Set the token representing the period to the given token. |
| 5290 * @param period the token representing the period | 5239 * @param period the token representing the period |
| 5291 */ | 5240 */ |
| 5292 void set period(Token period2) { | 5241 void set period(Token period2) { |
| 5293 this._period = period2; | 5242 this._period = period2; |
| 5294 } | 5243 } |
| 5295 | 5244 |
| 5296 /** | 5245 /** |
| 5297 * Set the token representing the 'this' keyword to the given token. | 5246 * Set the token representing the 'this' keyword to the given token. |
| 5298 * @param thisToken the token representing the 'this' keyword | 5247 * @param thisToken the token representing the 'this' keyword |
| 5299 */ | 5248 */ |
| 5300 void set thisToken(Token thisToken2) { | 5249 void set thisToken(Token thisToken2) { |
| 5301 this._thisToken = thisToken2; | 5250 this._thisToken = thisToken2; |
| 5302 } | 5251 } |
| 5303 | 5252 |
| 5304 /** | 5253 /** |
| 5305 * Set the name of the declared type of the parameter to the given type name. | 5254 * Set the name of the declared type of the parameter to the given type name. |
| 5306 * @param typeName the name of the declared type of the parameter | 5255 * @param typeName the name of the declared type of the parameter |
| 5307 */ | 5256 */ |
| 5308 void set type(TypeName typeName) { | 5257 void set type(TypeName typeName) { |
| 5309 _type = becomeParentOf(typeName); | 5258 _type = becomeParentOf(typeName); |
| 5310 } | 5259 } |
| 5311 void visitChildren(ASTVisitor<Object> visitor) { | 5260 void visitChildren(ASTVisitor<Object> visitor) { |
| 5312 super.visitChildren(visitor); | 5261 super.visitChildren(visitor); |
| 5313 safelyVisitChild(_type, visitor); | 5262 safelyVisitChild(_type, visitor); |
| 5314 safelyVisitChild(identifier, visitor); | 5263 safelyVisitChild(identifier, visitor); |
| 5315 } | 5264 } |
| 5316 } | 5265 } |
| 5317 | |
| 5318 /** | 5266 /** |
| 5319 * Instances of the class {@code ForEachStatement} represent a for-each statemen
t. | 5267 * Instances of the class {@code ForEachStatement} represent a for-each statemen
t. |
| 5320 * <pre> | 5268 * <pre> |
| 5321 * forEachStatement ::= | 5269 * forEachStatement ::= |
| 5322 * 'for' '(' {@link SimpleFormalParameter loopParameter} 'in' {@link Expression
iterator} ')' {@link Block body}</pre> | 5270 * 'for' '(' {@link SimpleFormalParameter loopParameter} 'in' {@link Expression
iterator} ')' {@link Block body}</pre> |
| 5323 * @coverage dart.engine.ast | 5271 * @coverage dart.engine.ast |
| 5324 */ | 5272 */ |
| 5325 class ForEachStatement extends Statement { | 5273 class ForEachStatement extends Statement { |
| 5326 | 5274 |
| 5327 /** | 5275 /** |
| 5328 * The token representing the 'for' keyword. | 5276 * The token representing the 'for' keyword. |
| 5329 */ | 5277 */ |
| 5330 Token _forKeyword; | 5278 Token _forKeyword; |
| 5331 | 5279 |
| 5332 /** | 5280 /** |
| 5333 * The left parenthesis. | 5281 * The left parenthesis. |
| 5334 */ | 5282 */ |
| 5335 Token _leftParenthesis; | 5283 Token _leftParenthesis; |
| 5336 | 5284 |
| 5337 /** | 5285 /** |
| 5338 * The declaration of the loop variable. | 5286 * The declaration of the loop variable. |
| 5339 */ | 5287 */ |
| 5340 DeclaredIdentifier _loopVariable; | 5288 DeclaredIdentifier _loopVariable; |
| 5341 | 5289 |
| 5342 /** | 5290 /** |
| 5343 * The token representing the 'in' keyword. | 5291 * The token representing the 'in' keyword. |
| 5344 */ | 5292 */ |
| 5345 Token _inKeyword; | 5293 Token _inKeyword; |
| 5346 | 5294 |
| 5347 /** | 5295 /** |
| 5348 * The expression evaluated to produce the iterator. | 5296 * The expression evaluated to produce the iterator. |
| 5349 */ | 5297 */ |
| 5350 Expression _iterator; | 5298 Expression _iterator; |
| 5351 | 5299 |
| 5352 /** | 5300 /** |
| 5353 * The right parenthesis. | 5301 * The right parenthesis. |
| 5354 */ | 5302 */ |
| 5355 Token _rightParenthesis; | 5303 Token _rightParenthesis; |
| 5356 | 5304 |
| 5357 /** | 5305 /** |
| 5358 * The body of the loop. | 5306 * The body of the loop. |
| 5359 */ | 5307 */ |
| 5360 Statement _body; | 5308 Statement _body; |
| 5361 | 5309 |
| 5362 /** | 5310 /** |
| 5363 * Initialize a newly created for-each statement. | 5311 * Initialize a newly created for-each statement. |
| 5364 * @param forKeyword the token representing the 'for' keyword | 5312 * @param forKeyword the token representing the 'for' keyword |
| 5365 * @param leftParenthesis the left parenthesis | 5313 * @param leftParenthesis the left parenthesis |
| 5366 * @param loopVariable the declaration of the loop variable | 5314 * @param loopVariable the declaration of the loop variable |
| 5367 * @param iterator the expression evaluated to produce the iterator | 5315 * @param iterator the expression evaluated to produce the iterator |
| 5368 * @param rightParenthesis the right parenthesis | 5316 * @param rightParenthesis the right parenthesis |
| 5369 * @param body the body of the loop | 5317 * @param body the body of the loop |
| 5370 */ | 5318 */ |
| 5371 ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentif
ier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis,
Statement body) { | 5319 ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentif
ier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis,
Statement body) { |
| 5372 this._forKeyword = forKeyword; | 5320 this._forKeyword = forKeyword; |
| 5373 this._leftParenthesis = leftParenthesis; | 5321 this._leftParenthesis = leftParenthesis; |
| 5374 this._loopVariable = becomeParentOf(loopVariable); | 5322 this._loopVariable = becomeParentOf(loopVariable); |
| 5375 this._inKeyword = inKeyword; | 5323 this._inKeyword = inKeyword; |
| 5376 this._iterator = becomeParentOf(iterator); | 5324 this._iterator = becomeParentOf(iterator); |
| 5377 this._rightParenthesis = rightParenthesis; | 5325 this._rightParenthesis = rightParenthesis; |
| 5378 this._body = becomeParentOf(body); | 5326 this._body = becomeParentOf(body); |
| 5379 } | 5327 } |
| 5380 | 5328 |
| 5381 /** | 5329 /** |
| 5382 * Initialize a newly created for-each statement. | 5330 * Initialize a newly created for-each statement. |
| 5383 * @param forKeyword the token representing the 'for' keyword | 5331 * @param forKeyword the token representing the 'for' keyword |
| 5384 * @param leftParenthesis the left parenthesis | 5332 * @param leftParenthesis the left parenthesis |
| 5385 * @param loopVariable the declaration of the loop variable | 5333 * @param loopVariable the declaration of the loop variable |
| 5386 * @param iterator the expression evaluated to produce the iterator | 5334 * @param iterator the expression evaluated to produce the iterator |
| 5387 * @param rightParenthesis the right parenthesis | 5335 * @param rightParenthesis the right parenthesis |
| 5388 * @param body the body of the loop | 5336 * @param body the body of the loop |
| 5389 */ | 5337 */ |
| 5390 ForEachStatement({Token forKeyword, Token leftParenthesis, DeclaredIdentifier
loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Stat
ement body}) : this.full(forKeyword, leftParenthesis, loopVariable, inKeyword, i
terator, rightParenthesis, body); | 5338 ForEachStatement({Token forKeyword, Token leftParenthesis, DeclaredIdentifier
loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Stat
ement body}) : this.full(forKeyword, leftParenthesis, loopVariable, inKeyword, i
terator, rightParenthesis, body); |
| 5391 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); | 5339 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); |
| 5392 Token get beginToken => _forKeyword; | 5340 Token get beginToken => _forKeyword; |
| 5393 | 5341 |
| 5394 /** | 5342 /** |
| 5395 * Return the body of the loop. | 5343 * Return the body of the loop. |
| 5396 * @return the body of the loop | 5344 * @return the body of the loop |
| 5397 */ | 5345 */ |
| 5398 Statement get body => _body; | 5346 Statement get body => _body; |
| 5399 Token get endToken => _body.endToken; | 5347 Token get endToken => _body.endToken; |
| 5400 | 5348 |
| 5401 /** | 5349 /** |
| 5402 * Return the token representing the 'for' keyword. | 5350 * Return the token representing the 'for' keyword. |
| 5403 * @return the token representing the 'for' keyword | 5351 * @return the token representing the 'for' keyword |
| 5404 */ | 5352 */ |
| 5405 Token get forKeyword => _forKeyword; | 5353 Token get forKeyword => _forKeyword; |
| 5406 | 5354 |
| 5407 /** | 5355 /** |
| 5408 * Return the token representing the 'in' keyword. | 5356 * Return the token representing the 'in' keyword. |
| 5409 * @return the token representing the 'in' keyword | 5357 * @return the token representing the 'in' keyword |
| 5410 */ | 5358 */ |
| 5411 Token get inKeyword => _inKeyword; | 5359 Token get inKeyword => _inKeyword; |
| 5412 | 5360 |
| 5413 /** | 5361 /** |
| 5414 * Return the expression evaluated to produce the iterator. | 5362 * Return the expression evaluated to produce the iterator. |
| 5415 * @return the expression evaluated to produce the iterator | 5363 * @return the expression evaluated to produce the iterator |
| 5416 */ | 5364 */ |
| 5417 Expression get iterator => _iterator; | 5365 Expression get iterator => _iterator; |
| 5418 | 5366 |
| 5419 /** | 5367 /** |
| 5420 * Return the left parenthesis. | 5368 * Return the left parenthesis. |
| 5421 * @return the left parenthesis | 5369 * @return the left parenthesis |
| 5422 */ | 5370 */ |
| 5423 Token get leftParenthesis => _leftParenthesis; | 5371 Token get leftParenthesis => _leftParenthesis; |
| 5424 | 5372 |
| 5425 /** | 5373 /** |
| 5426 * Return the declaration of the loop variable. | 5374 * Return the declaration of the loop variable. |
| 5427 * @return the declaration of the loop variable | 5375 * @return the declaration of the loop variable |
| 5428 */ | 5376 */ |
| 5429 DeclaredIdentifier get loopVariable => _loopVariable; | 5377 DeclaredIdentifier get loopVariable => _loopVariable; |
| 5430 | 5378 |
| 5431 /** | 5379 /** |
| 5432 * Return the right parenthesis. | 5380 * Return the right parenthesis. |
| 5433 * @return the right parenthesis | 5381 * @return the right parenthesis |
| 5434 */ | 5382 */ |
| 5435 Token get rightParenthesis => _rightParenthesis; | 5383 Token get rightParenthesis => _rightParenthesis; |
| 5436 | 5384 |
| 5437 /** | 5385 /** |
| 5438 * Set the body of the loop to the given block. | 5386 * Set the body of the loop to the given block. |
| 5439 * @param body the body of the loop | 5387 * @param body the body of the loop |
| 5440 */ | 5388 */ |
| 5441 void set body(Statement body2) { | 5389 void set body(Statement body2) { |
| 5442 this._body = becomeParentOf(body2); | 5390 this._body = becomeParentOf(body2); |
| 5443 } | 5391 } |
| 5444 | 5392 |
| 5445 /** | 5393 /** |
| 5446 * Set the token representing the 'for' keyword to the given token. | 5394 * Set the token representing the 'for' keyword to the given token. |
| 5447 * @param forKeyword the token representing the 'for' keyword | 5395 * @param forKeyword the token representing the 'for' keyword |
| 5448 */ | 5396 */ |
| 5449 void set forKeyword(Token forKeyword2) { | 5397 void set forKeyword(Token forKeyword2) { |
| 5450 this._forKeyword = forKeyword2; | 5398 this._forKeyword = forKeyword2; |
| 5451 } | 5399 } |
| 5452 | 5400 |
| 5453 /** | 5401 /** |
| 5454 * Set the token representing the 'in' keyword to the given token. | 5402 * Set the token representing the 'in' keyword to the given token. |
| 5455 * @param inKeyword the token representing the 'in' keyword | 5403 * @param inKeyword the token representing the 'in' keyword |
| 5456 */ | 5404 */ |
| 5457 void set inKeyword(Token inKeyword2) { | 5405 void set inKeyword(Token inKeyword2) { |
| 5458 this._inKeyword = inKeyword2; | 5406 this._inKeyword = inKeyword2; |
| 5459 } | 5407 } |
| 5460 | 5408 |
| 5461 /** | 5409 /** |
| 5462 * Set the expression evaluated to produce the iterator to the given expressio
n. | 5410 * Set the expression evaluated to produce the iterator to the given expressio
n. |
| 5463 * @param expression the expression evaluated to produce the iterator | 5411 * @param expression the expression evaluated to produce the iterator |
| 5464 */ | 5412 */ |
| 5465 void set iterator(Expression expression) { | 5413 void set iterator(Expression expression) { |
| 5466 _iterator = becomeParentOf(expression); | 5414 _iterator = becomeParentOf(expression); |
| 5467 } | 5415 } |
| 5468 | 5416 |
| 5469 /** | 5417 /** |
| 5470 * Set the left parenthesis to the given token. | 5418 * Set the left parenthesis to the given token. |
| 5471 * @param leftParenthesis the left parenthesis | 5419 * @param leftParenthesis the left parenthesis |
| 5472 */ | 5420 */ |
| 5473 void set leftParenthesis(Token leftParenthesis2) { | 5421 void set leftParenthesis(Token leftParenthesis2) { |
| 5474 this._leftParenthesis = leftParenthesis2; | 5422 this._leftParenthesis = leftParenthesis2; |
| 5475 } | 5423 } |
| 5476 | 5424 |
| 5477 /** | 5425 /** |
| 5478 * Set the declaration of the loop variable to the given variable. | 5426 * Set the declaration of the loop variable to the given variable. |
| 5479 * @param variable the declaration of the loop variable | 5427 * @param variable the declaration of the loop variable |
| 5480 */ | 5428 */ |
| 5481 void set loopVariable(DeclaredIdentifier variable) { | 5429 void set loopVariable(DeclaredIdentifier variable) { |
| 5482 _loopVariable = becomeParentOf(variable); | 5430 _loopVariable = becomeParentOf(variable); |
| 5483 } | 5431 } |
| 5484 | 5432 |
| 5485 /** | 5433 /** |
| 5486 * Set the right parenthesis to the given token. | 5434 * Set the right parenthesis to the given token. |
| 5487 * @param rightParenthesis the right parenthesis | 5435 * @param rightParenthesis the right parenthesis |
| 5488 */ | 5436 */ |
| 5489 void set rightParenthesis(Token rightParenthesis2) { | 5437 void set rightParenthesis(Token rightParenthesis2) { |
| 5490 this._rightParenthesis = rightParenthesis2; | 5438 this._rightParenthesis = rightParenthesis2; |
| 5491 } | 5439 } |
| 5492 void visitChildren(ASTVisitor<Object> visitor) { | 5440 void visitChildren(ASTVisitor<Object> visitor) { |
| 5493 safelyVisitChild(_loopVariable, visitor); | 5441 safelyVisitChild(_loopVariable, visitor); |
| 5494 safelyVisitChild(_iterator, visitor); | 5442 safelyVisitChild(_iterator, visitor); |
| 5495 safelyVisitChild(_body, visitor); | 5443 safelyVisitChild(_body, visitor); |
| 5496 } | 5444 } |
| 5497 } | 5445 } |
| 5498 | |
| 5499 /** | 5446 /** |
| 5500 * Instances of the class {@code ForStatement} represent a for statement. | 5447 * Instances of the class {@code ForStatement} represent a for statement. |
| 5501 * <pre> | 5448 * <pre> |
| 5502 * forStatement ::= | 5449 * forStatement ::= |
| 5503 * 'for' '(' forLoopParts ')' {@link Statement statement}forLoopParts ::= | 5450 * 'for' '(' forLoopParts ')' {@link Statement statement}forLoopParts ::= |
| 5504 * forInitializerStatement ';' {@link Expression expression}? ';' {@link Express
ion expressionList}? | 5451 * forInitializerStatement ';' {@link Expression expression}? ';' {@link Express
ion expressionList}? |
| 5505 * forInitializerStatement ::={@link DefaultFormalParameter initializedVariableD
eclaration}| {@link Expression expression}? | 5452 * forInitializerStatement ::={@link DefaultFormalParameter initializedVariableD
eclaration}| {@link Expression expression}? |
| 5506 * </pre> | 5453 * </pre> |
| 5507 * @coverage dart.engine.ast | 5454 * @coverage dart.engine.ast |
| 5508 */ | 5455 */ |
| 5509 class ForStatement extends Statement { | 5456 class ForStatement extends Statement { |
| 5510 | 5457 |
| 5511 /** | 5458 /** |
| 5512 * The token representing the 'for' keyword. | 5459 * The token representing the 'for' keyword. |
| 5513 */ | 5460 */ |
| 5514 Token _forKeyword; | 5461 Token _forKeyword; |
| 5515 | 5462 |
| 5516 /** | 5463 /** |
| 5517 * The left parenthesis. | 5464 * The left parenthesis. |
| 5518 */ | 5465 */ |
| 5519 Token _leftParenthesis; | 5466 Token _leftParenthesis; |
| 5520 | 5467 |
| 5521 /** | 5468 /** |
| 5522 * The declaration of the loop variables, or {@code null} if there are no vari
ables. Note that a | 5469 * The declaration of the loop variables, or {@code null} if there are no vari
ables. Note that a |
| 5523 * for statement cannot have both a variable list and an initialization expres
sion, but can | 5470 * for statement cannot have both a variable list and an initialization expres
sion, but can |
| 5524 * validly have neither. | 5471 * validly have neither. |
| 5525 */ | 5472 */ |
| 5526 VariableDeclarationList _variableList; | 5473 VariableDeclarationList _variableList; |
| 5527 | 5474 |
| 5528 /** | 5475 /** |
| 5529 * The initialization expression, or {@code null} if there is no initializatio
n expression. Note | 5476 * The initialization expression, or {@code null} if there is no initializatio
n expression. Note |
| 5530 * that a for statement cannot have both a variable list and an initialization
expression, but can | 5477 * that a for statement cannot have both a variable list and an initialization
expression, but can |
| 5531 * validly have neither. | 5478 * validly have neither. |
| 5532 */ | 5479 */ |
| 5533 Expression _initialization; | 5480 Expression _initialization; |
| 5534 | 5481 |
| 5535 /** | 5482 /** |
| 5536 * The semicolon separating the initializer and the condition. | 5483 * The semicolon separating the initializer and the condition. |
| 5537 */ | 5484 */ |
| 5538 Token _leftSeparator; | 5485 Token _leftSeparator; |
| 5539 | 5486 |
| 5540 /** | 5487 /** |
| 5541 * The condition used to determine when to terminate the loop. | 5488 * The condition used to determine when to terminate the loop. |
| 5542 */ | 5489 */ |
| 5543 Expression _condition; | 5490 Expression _condition; |
| 5544 | 5491 |
| 5545 /** | 5492 /** |
| 5546 * The semicolon separating the condition and the updater. | 5493 * The semicolon separating the condition and the updater. |
| 5547 */ | 5494 */ |
| 5548 Token _rightSeparator; | 5495 Token _rightSeparator; |
| 5549 | 5496 |
| 5550 /** | 5497 /** |
| 5551 * The list of expressions run after each execution of the loop body. | 5498 * The list of expressions run after each execution of the loop body. |
| 5552 */ | 5499 */ |
| 5553 NodeList<Expression> _updaters; | 5500 NodeList<Expression> _updaters; |
| 5554 | 5501 |
| 5555 /** | 5502 /** |
| 5556 * The right parenthesis. | 5503 * The right parenthesis. |
| 5557 */ | 5504 */ |
| 5558 Token _rightParenthesis; | 5505 Token _rightParenthesis; |
| 5559 | 5506 |
| 5560 /** | 5507 /** |
| 5561 * The body of the loop. | 5508 * The body of the loop. |
| 5562 */ | 5509 */ |
| 5563 Statement _body; | 5510 Statement _body; |
| 5564 | 5511 |
| 5565 /** | 5512 /** |
| 5566 * Initialize a newly created for statement. | 5513 * Initialize a newly created for statement. |
| 5567 * @param forKeyword the token representing the 'for' keyword | 5514 * @param forKeyword the token representing the 'for' keyword |
| 5568 * @param leftParenthesis the left parenthesis | 5515 * @param leftParenthesis the left parenthesis |
| 5569 * @param variableList the declaration of the loop variables | 5516 * @param variableList the declaration of the loop variables |
| 5570 * @param initialization the initialization expression | 5517 * @param initialization the initialization expression |
| 5571 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 5518 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
| 5572 * @param condition the condition used to determine when to terminate the loop | 5519 * @param condition the condition used to determine when to terminate the loop |
| 5573 * @param rightSeparator the semicolon separating the condition and the update
r | 5520 * @param rightSeparator the semicolon separating the condition and the update
r |
| 5574 * @param updaters the list of expressions run after each execution of the loo
p body | 5521 * @param updaters the list of expressions run after each execution of the loo
p body |
| 5575 * @param rightParenthesis the right parenthesis | 5522 * @param rightParenthesis the right parenthesis |
| 5576 * @param body the body of the loop | 5523 * @param body the body of the loop |
| 5577 */ | 5524 */ |
| 5578 ForStatement.full(Token forKeyword, Token leftParenthesis, VariableDeclaration
List variableList, Expression initialization, Token leftSeparator, Expression co
ndition, Token rightSeparator, List<Expression> updaters, Token rightParenthesis
, Statement body) { | 5525 ForStatement.full(Token forKeyword, Token leftParenthesis, VariableDeclaration
List variableList, Expression initialization, Token leftSeparator, Expression co
ndition, Token rightSeparator, List<Expression> updaters, Token rightParenthesis
, Statement body) { |
| 5579 this._updaters = new NodeList<Expression>(this); | 5526 this._updaters = new NodeList<Expression>(this); |
| 5580 this._forKeyword = forKeyword; | 5527 this._forKeyword = forKeyword; |
| 5581 this._leftParenthesis = leftParenthesis; | 5528 this._leftParenthesis = leftParenthesis; |
| 5582 this._variableList = becomeParentOf(variableList); | 5529 this._variableList = becomeParentOf(variableList); |
| 5583 this._initialization = becomeParentOf(initialization); | 5530 this._initialization = becomeParentOf(initialization); |
| 5584 this._leftSeparator = leftSeparator; | 5531 this._leftSeparator = leftSeparator; |
| 5585 this._condition = becomeParentOf(condition); | 5532 this._condition = becomeParentOf(condition); |
| 5586 this._rightSeparator = rightSeparator; | 5533 this._rightSeparator = rightSeparator; |
| 5587 this._updaters.addAll(updaters); | 5534 this._updaters.addAll(updaters); |
| 5588 this._rightParenthesis = rightParenthesis; | 5535 this._rightParenthesis = rightParenthesis; |
| 5589 this._body = becomeParentOf(body); | 5536 this._body = becomeParentOf(body); |
| 5590 } | 5537 } |
| 5591 | 5538 |
| 5592 /** | 5539 /** |
| 5593 * Initialize a newly created for statement. | 5540 * Initialize a newly created for statement. |
| 5594 * @param forKeyword the token representing the 'for' keyword | 5541 * @param forKeyword the token representing the 'for' keyword |
| 5595 * @param leftParenthesis the left parenthesis | 5542 * @param leftParenthesis the left parenthesis |
| 5596 * @param variableList the declaration of the loop variables | 5543 * @param variableList the declaration of the loop variables |
| 5597 * @param initialization the initialization expression | 5544 * @param initialization the initialization expression |
| 5598 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 5545 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
| 5599 * @param condition the condition used to determine when to terminate the loop | 5546 * @param condition the condition used to determine when to terminate the loop |
| 5600 * @param rightSeparator the semicolon separating the condition and the update
r | 5547 * @param rightSeparator the semicolon separating the condition and the update
r |
| 5601 * @param updaters the list of expressions run after each execution of the loo
p body | 5548 * @param updaters the list of expressions run after each execution of the loo
p body |
| 5602 * @param rightParenthesis the right parenthesis | 5549 * @param rightParenthesis the right parenthesis |
| 5603 * @param body the body of the loop | 5550 * @param body the body of the loop |
| 5604 */ | 5551 */ |
| 5605 ForStatement({Token forKeyword, Token leftParenthesis, VariableDeclarationList
variableList, Expression initialization, Token leftSeparator, Expression condit
ion, Token rightSeparator, List<Expression> updaters, Token rightParenthesis, St
atement body}) : this.full(forKeyword, leftParenthesis, variableList, initializa
tion, leftSeparator, condition, rightSeparator, updaters, rightParenthesis, body
); | 5552 ForStatement({Token forKeyword, Token leftParenthesis, VariableDeclarationList
variableList, Expression initialization, Token leftSeparator, Expression condit
ion, Token rightSeparator, List<Expression> updaters, Token rightParenthesis, St
atement body}) : this.full(forKeyword, leftParenthesis, variableList, initializa
tion, leftSeparator, condition, rightSeparator, updaters, rightParenthesis, body
); |
| 5606 accept(ASTVisitor visitor) => visitor.visitForStatement(this); | 5553 accept(ASTVisitor visitor) => visitor.visitForStatement(this); |
| 5607 Token get beginToken => _forKeyword; | 5554 Token get beginToken => _forKeyword; |
| 5608 | 5555 |
| 5609 /** | 5556 /** |
| 5610 * Return the body of the loop. | 5557 * Return the body of the loop. |
| 5611 * @return the body of the loop | 5558 * @return the body of the loop |
| 5612 */ | 5559 */ |
| 5613 Statement get body => _body; | 5560 Statement get body => _body; |
| 5614 | 5561 |
| 5615 /** | 5562 /** |
| 5616 * Return the condition used to determine when to terminate the loop. | 5563 * Return the condition used to determine when to terminate the loop. |
| 5617 * @return the condition used to determine when to terminate the loop | 5564 * @return the condition used to determine when to terminate the loop |
| 5618 */ | 5565 */ |
| 5619 Expression get condition => _condition; | 5566 Expression get condition => _condition; |
| 5620 Token get endToken => _body.endToken; | 5567 Token get endToken => _body.endToken; |
| 5621 | 5568 |
| 5622 /** | 5569 /** |
| 5623 * Return the token representing the 'for' keyword. | 5570 * Return the token representing the 'for' keyword. |
| 5624 * @return the token representing the 'for' keyword | 5571 * @return the token representing the 'for' keyword |
| 5625 */ | 5572 */ |
| 5626 Token get forKeyword => _forKeyword; | 5573 Token get forKeyword => _forKeyword; |
| 5627 | 5574 |
| 5628 /** | 5575 /** |
| 5629 * Return the initialization expression, or {@code null} if there is no initia
lization expression. | 5576 * Return the initialization expression, or {@code null} if there is no initia
lization expression. |
| 5630 * @return the initialization expression | 5577 * @return the initialization expression |
| 5631 */ | 5578 */ |
| 5632 Expression get initialization => _initialization; | 5579 Expression get initialization => _initialization; |
| 5633 | 5580 |
| 5634 /** | 5581 /** |
| 5635 * Return the left parenthesis. | 5582 * Return the left parenthesis. |
| 5636 * @return the left parenthesis | 5583 * @return the left parenthesis |
| 5637 */ | 5584 */ |
| 5638 Token get leftParenthesis => _leftParenthesis; | 5585 Token get leftParenthesis => _leftParenthesis; |
| 5639 | 5586 |
| 5640 /** | 5587 /** |
| 5641 * Return the semicolon separating the initializer and the condition. | 5588 * Return the semicolon separating the initializer and the condition. |
| 5642 * @return the semicolon separating the initializer and the condition | 5589 * @return the semicolon separating the initializer and the condition |
| 5643 */ | 5590 */ |
| 5644 Token get leftSeparator => _leftSeparator; | 5591 Token get leftSeparator => _leftSeparator; |
| 5645 | 5592 |
| 5646 /** | 5593 /** |
| 5647 * Return the right parenthesis. | 5594 * Return the right parenthesis. |
| 5648 * @return the right parenthesis | 5595 * @return the right parenthesis |
| 5649 */ | 5596 */ |
| 5650 Token get rightParenthesis => _rightParenthesis; | 5597 Token get rightParenthesis => _rightParenthesis; |
| 5651 | 5598 |
| 5652 /** | 5599 /** |
| 5653 * Return the semicolon separating the condition and the updater. | 5600 * Return the semicolon separating the condition and the updater. |
| 5654 * @return the semicolon separating the condition and the updater | 5601 * @return the semicolon separating the condition and the updater |
| 5655 */ | 5602 */ |
| 5656 Token get rightSeparator => _rightSeparator; | 5603 Token get rightSeparator => _rightSeparator; |
| 5657 | 5604 |
| 5658 /** | 5605 /** |
| 5659 * Return the list of expressions run after each execution of the loop body. | 5606 * Return the list of expressions run after each execution of the loop body. |
| 5660 * @return the list of expressions run after each execution of the loop body | 5607 * @return the list of expressions run after each execution of the loop body |
| 5661 */ | 5608 */ |
| 5662 NodeList<Expression> get updaters => _updaters; | 5609 NodeList<Expression> get updaters => _updaters; |
| 5663 | 5610 |
| 5664 /** | 5611 /** |
| 5665 * Return the declaration of the loop variables, or {@code null} if there are
no variables. | 5612 * Return the declaration of the loop variables, or {@code null} if there are
no variables. |
| 5666 * @return the declaration of the loop variables, or {@code null} if there are
no variables | 5613 * @return the declaration of the loop variables, or {@code null} if there are
no variables |
| 5667 */ | 5614 */ |
| 5668 VariableDeclarationList get variables => _variableList; | 5615 VariableDeclarationList get variables => _variableList; |
| 5669 | 5616 |
| 5670 /** | 5617 /** |
| 5671 * Set the body of the loop to the given statement. | 5618 * Set the body of the loop to the given statement. |
| 5672 * @param body the body of the loop | 5619 * @param body the body of the loop |
| 5673 */ | 5620 */ |
| 5674 void set body(Statement body2) { | 5621 void set body(Statement body2) { |
| 5675 this._body = becomeParentOf(body2); | 5622 this._body = becomeParentOf(body2); |
| 5676 } | 5623 } |
| 5677 | 5624 |
| 5678 /** | 5625 /** |
| 5679 * Set the condition used to determine when to terminate the loop to the given
expression. | 5626 * Set the condition used to determine when to terminate the loop to the given
expression. |
| 5680 * @param expression the condition used to determine when to terminate the loo
p | 5627 * @param expression the condition used to determine when to terminate the loo
p |
| 5681 */ | 5628 */ |
| 5682 void set condition(Expression expression) { | 5629 void set condition(Expression expression) { |
| 5683 _condition = becomeParentOf(expression); | 5630 _condition = becomeParentOf(expression); |
| 5684 } | 5631 } |
| 5685 | 5632 |
| 5686 /** | 5633 /** |
| 5687 * Set the token representing the 'for' keyword to the given token. | 5634 * Set the token representing the 'for' keyword to the given token. |
| 5688 * @param forKeyword the token representing the 'for' keyword | 5635 * @param forKeyword the token representing the 'for' keyword |
| 5689 */ | 5636 */ |
| 5690 void set forKeyword(Token forKeyword2) { | 5637 void set forKeyword(Token forKeyword2) { |
| 5691 this._forKeyword = forKeyword2; | 5638 this._forKeyword = forKeyword2; |
| 5692 } | 5639 } |
| 5693 | 5640 |
| 5694 /** | 5641 /** |
| 5695 * Set the initialization expression to the given expression. | 5642 * Set the initialization expression to the given expression. |
| 5696 * @param initialization the initialization expression | 5643 * @param initialization the initialization expression |
| 5697 */ | 5644 */ |
| 5698 void set initialization(Expression initialization2) { | 5645 void set initialization(Expression initialization2) { |
| 5699 this._initialization = becomeParentOf(initialization2); | 5646 this._initialization = becomeParentOf(initialization2); |
| 5700 } | 5647 } |
| 5701 | 5648 |
| 5702 /** | 5649 /** |
| 5703 * Set the left parenthesis to the given token. | 5650 * Set the left parenthesis to the given token. |
| 5704 * @param leftParenthesis the left parenthesis | 5651 * @param leftParenthesis the left parenthesis |
| 5705 */ | 5652 */ |
| 5706 void set leftParenthesis(Token leftParenthesis2) { | 5653 void set leftParenthesis(Token leftParenthesis2) { |
| 5707 this._leftParenthesis = leftParenthesis2; | 5654 this._leftParenthesis = leftParenthesis2; |
| 5708 } | 5655 } |
| 5709 | 5656 |
| 5710 /** | 5657 /** |
| 5711 * Set the semicolon separating the initializer and the condition to the given
token. | 5658 * Set the semicolon separating the initializer and the condition to the given
token. |
| 5712 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 5659 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
| 5713 */ | 5660 */ |
| 5714 void set leftSeparator(Token leftSeparator2) { | 5661 void set leftSeparator(Token leftSeparator2) { |
| 5715 this._leftSeparator = leftSeparator2; | 5662 this._leftSeparator = leftSeparator2; |
| 5716 } | 5663 } |
| 5717 | 5664 |
| 5718 /** | 5665 /** |
| 5719 * Set the right parenthesis to the given token. | 5666 * Set the right parenthesis to the given token. |
| 5720 * @param rightParenthesis the right parenthesis | 5667 * @param rightParenthesis the right parenthesis |
| 5721 */ | 5668 */ |
| 5722 void set rightParenthesis(Token rightParenthesis2) { | 5669 void set rightParenthesis(Token rightParenthesis2) { |
| 5723 this._rightParenthesis = rightParenthesis2; | 5670 this._rightParenthesis = rightParenthesis2; |
| 5724 } | 5671 } |
| 5725 | 5672 |
| 5726 /** | 5673 /** |
| 5727 * Set the semicolon separating the condition and the updater to the given tok
en. | 5674 * Set the semicolon separating the condition and the updater to the given tok
en. |
| 5728 * @param rightSeparator the semicolon separating the condition and the update
r | 5675 * @param rightSeparator the semicolon separating the condition and the update
r |
| 5729 */ | 5676 */ |
| 5730 void set rightSeparator(Token rightSeparator2) { | 5677 void set rightSeparator(Token rightSeparator2) { |
| 5731 this._rightSeparator = rightSeparator2; | 5678 this._rightSeparator = rightSeparator2; |
| 5732 } | 5679 } |
| 5733 | 5680 |
| 5734 /** | 5681 /** |
| 5735 * Set the declaration of the loop variables to the given parameter. | 5682 * Set the declaration of the loop variables to the given parameter. |
| 5736 * @param variableList the declaration of the loop variables | 5683 * @param variableList the declaration of the loop variables |
| 5737 */ | 5684 */ |
| 5738 void set variables(VariableDeclarationList variableList) { | 5685 void set variables(VariableDeclarationList variableList) { |
| 5739 variableList = becomeParentOf(variableList); | 5686 variableList = becomeParentOf(variableList); |
| 5740 } | 5687 } |
| 5741 void visitChildren(ASTVisitor<Object> visitor) { | 5688 void visitChildren(ASTVisitor<Object> visitor) { |
| 5742 safelyVisitChild(_variableList, visitor); | 5689 safelyVisitChild(_variableList, visitor); |
| 5743 safelyVisitChild(_initialization, visitor); | 5690 safelyVisitChild(_initialization, visitor); |
| 5744 safelyVisitChild(_condition, visitor); | 5691 safelyVisitChild(_condition, visitor); |
| 5745 _updaters.accept(visitor); | 5692 _updaters.accept(visitor); |
| 5746 safelyVisitChild(_body, visitor); | 5693 safelyVisitChild(_body, visitor); |
| 5747 } | 5694 } |
| 5748 } | 5695 } |
| 5749 | |
| 5750 /** | 5696 /** |
| 5751 * The abstract class {@code FormalParameter} defines the behavior of objects re
presenting a | 5697 * The abstract class {@code FormalParameter} defines the behavior of objects re
presenting a |
| 5752 * parameter to a function. | 5698 * parameter to a function. |
| 5753 * <pre> | 5699 * <pre> |
| 5754 * formalParameter ::={@link NormalFormalParameter normalFormalParameter}| {@lin
k DefaultFormalParameter namedFormalParameter}| {@link DefaultFormalParameter op
tionalFormalParameter}</pre> | 5700 * formalParameter ::={@link NormalFormalParameter normalFormalParameter}| {@lin
k DefaultFormalParameter namedFormalParameter}| {@link DefaultFormalParameter op
tionalFormalParameter}</pre> |
| 5755 * @coverage dart.engine.ast | 5701 * @coverage dart.engine.ast |
| 5756 */ | 5702 */ |
| 5757 abstract class FormalParameter extends ASTNode { | 5703 abstract class FormalParameter extends ASTNode { |
| 5758 | 5704 |
| 5759 /** | 5705 /** |
| 5760 * Return the element representing this parameter, or {@code null} if this par
ameter has not been | 5706 * Return the element representing this parameter, or {@code null} if this par
ameter has not been |
| 5761 * resolved. | 5707 * resolved. |
| 5762 * @return the element representing this parameter | 5708 * @return the element representing this parameter |
| 5763 */ | 5709 */ |
| 5764 ParameterElement get element { | 5710 ParameterElement get element { |
| 5765 SimpleIdentifier identifier2 = identifier; | 5711 SimpleIdentifier identifier2 = identifier; |
| 5766 if (identifier2 == null) { | 5712 if (identifier2 == null) { |
| 5767 return null; | 5713 return null; |
| 5768 } | 5714 } |
| 5769 return identifier2.element as ParameterElement; | 5715 return identifier2.element as ParameterElement; |
| 5770 } | 5716 } |
| 5771 | 5717 |
| 5772 /** | 5718 /** |
| 5773 * Return the name of the parameter being declared. | 5719 * Return the name of the parameter being declared. |
| 5774 * @return the name of the parameter being declared | 5720 * @return the name of the parameter being declared |
| 5775 */ | 5721 */ |
| 5776 SimpleIdentifier get identifier; | 5722 SimpleIdentifier get identifier; |
| 5777 | 5723 |
| 5778 /** | 5724 /** |
| 5779 * Return the kind of this parameter. | 5725 * Return the kind of this parameter. |
| 5780 * @return the kind of this parameter | 5726 * @return the kind of this parameter |
| 5781 */ | 5727 */ |
| 5782 ParameterKind get kind; | 5728 ParameterKind get kind; |
| 5783 } | 5729 } |
| 5784 | |
| 5785 /** | 5730 /** |
| 5786 * Instances of the class {@code FormalParameterList} represent the formal param
eter list of a | 5731 * Instances of the class {@code FormalParameterList} represent the formal param
eter list of a |
| 5787 * method declaration, function declaration, or function type alias. | 5732 * method declaration, function declaration, or function type alias. |
| 5788 * <p> | 5733 * <p> |
| 5789 * While the grammar requires all optional formal parameters to follow all of th
e normal formal | 5734 * While the grammar requires all optional formal parameters to follow all of th
e normal formal |
| 5790 * parameters and at most one grouping of optional formal parameters, this class
does not enforce | 5735 * parameters and at most one grouping of optional formal parameters, this class
does not enforce |
| 5791 * those constraints. All parameters are flattened into a single list, which can
have any or all | 5736 * those constraints. All parameters are flattened into a single list, which can
have any or all |
| 5792 * kinds of parameters (normal, named, and positional) in any order. | 5737 * kinds of parameters (normal, named, and positional) in any order. |
| 5793 * <pre> | 5738 * <pre> |
| 5794 * formalParameterList ::= | 5739 * formalParameterList ::= |
| 5795 * '(' ')' | 5740 * '(' ')' |
| 5796 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' | 5741 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' |
| 5797 * | '(' optionalFormalParameters ')' | 5742 * | '(' optionalFormalParameters ')' |
| 5798 * normalFormalParameters ::={@link NormalFormalParameter normalFormalParameter}
(',' {@link NormalFormalParameter normalFormalParameter}) | 5743 * normalFormalParameters ::={@link NormalFormalParameter normalFormalParameter}
(',' {@link NormalFormalParameter normalFormalParameter}) |
| 5799 * optionalFormalParameters ::= | 5744 * optionalFormalParameters ::= |
| 5800 * optionalPositionalFormalParameters | 5745 * optionalPositionalFormalParameters |
| 5801 * | namedFormalParameters | 5746 * | namedFormalParameters |
| 5802 * optionalPositionalFormalParameters ::= | 5747 * optionalPositionalFormalParameters ::= |
| 5803 * '\[' {@link DefaultFormalParameter positionalFormalParameter} (',' {@link Def
aultFormalParameter positionalFormalParameter})* '\]' | 5748 * '\[' {@link DefaultFormalParameter positionalFormalParameter} (',' {@link Def
aultFormalParameter positionalFormalParameter})* '\]' |
| 5804 * namedFormalParameters ::= | 5749 * namedFormalParameters ::= |
| 5805 * '{' {@link DefaultFormalParameter namedFormalParameter} (',' {@link DefaultFo
rmalParameter namedFormalParameter})* '}' | 5750 * '{' {@link DefaultFormalParameter namedFormalParameter} (',' {@link DefaultFo
rmalParameter namedFormalParameter})* '}' |
| 5806 * </pre> | 5751 * </pre> |
| 5807 * @coverage dart.engine.ast | 5752 * @coverage dart.engine.ast |
| 5808 */ | 5753 */ |
| 5809 class FormalParameterList extends ASTNode { | 5754 class FormalParameterList extends ASTNode { |
| 5810 | 5755 |
| 5811 /** | 5756 /** |
| 5812 * The left parenthesis. | 5757 * The left parenthesis. |
| 5813 */ | 5758 */ |
| 5814 Token _leftParenthesis; | 5759 Token _leftParenthesis; |
| 5815 | 5760 |
| 5816 /** | 5761 /** |
| 5817 * The parameters associated with the method. | 5762 * The parameters associated with the method. |
| 5818 */ | 5763 */ |
| 5819 NodeList<FormalParameter> _parameters; | 5764 NodeList<FormalParameter> _parameters; |
| 5820 | 5765 |
| 5821 /** | 5766 /** |
| 5822 * The left square bracket ('\[') or left curly brace ('{') introducing the op
tional parameters. | 5767 * The left square bracket ('\[') or left curly brace ('{') introducing the op
tional parameters. |
| 5823 */ | 5768 */ |
| 5824 Token _leftDelimiter; | 5769 Token _leftDelimiter; |
| 5825 | 5770 |
| 5826 /** | 5771 /** |
| 5827 * The right square bracket ('\]') or right curly brace ('}') introducing the
optional parameters. | 5772 * The right square bracket ('\]') or right curly brace ('}') introducing the
optional parameters. |
| 5828 */ | 5773 */ |
| 5829 Token _rightDelimiter; | 5774 Token _rightDelimiter; |
| 5830 | 5775 |
| 5831 /** | 5776 /** |
| 5832 * The right parenthesis. | 5777 * The right parenthesis. |
| 5833 */ | 5778 */ |
| 5834 Token _rightParenthesis; | 5779 Token _rightParenthesis; |
| 5835 | 5780 |
| 5836 /** | 5781 /** |
| 5837 * Initialize a newly created parameter list. | 5782 * Initialize a newly created parameter list. |
| 5838 * @param leftParenthesis the left parenthesis | 5783 * @param leftParenthesis the left parenthesis |
| 5839 * @param parameters the parameters associated with the method | 5784 * @param parameters the parameters associated with the method |
| 5840 * @param leftDelimiter the left delimiter introducing the optional parameters | 5785 * @param leftDelimiter the left delimiter introducing the optional parameters |
| 5841 * @param rightDelimiter the right delimiter introducing the optional paramete
rs | 5786 * @param rightDelimiter the right delimiter introducing the optional paramete
rs |
| 5842 * @param rightParenthesis the right parenthesis | 5787 * @param rightParenthesis the right parenthesis |
| 5843 */ | 5788 */ |
| 5844 FormalParameterList.full(Token leftParenthesis, List<FormalParameter> paramete
rs, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis) { | 5789 FormalParameterList.full(Token leftParenthesis, List<FormalParameter> paramete
rs, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis) { |
| 5845 this._parameters = new NodeList<FormalParameter>(this); | 5790 this._parameters = new NodeList<FormalParameter>(this); |
| 5846 this._leftParenthesis = leftParenthesis; | 5791 this._leftParenthesis = leftParenthesis; |
| 5847 this._parameters.addAll(parameters); | 5792 this._parameters.addAll(parameters); |
| 5848 this._leftDelimiter = leftDelimiter; | 5793 this._leftDelimiter = leftDelimiter; |
| 5849 this._rightDelimiter = rightDelimiter; | 5794 this._rightDelimiter = rightDelimiter; |
| 5850 this._rightParenthesis = rightParenthesis; | 5795 this._rightParenthesis = rightParenthesis; |
| 5851 } | 5796 } |
| 5852 | 5797 |
| 5853 /** | 5798 /** |
| 5854 * Initialize a newly created parameter list. | 5799 * Initialize a newly created parameter list. |
| 5855 * @param leftParenthesis the left parenthesis | 5800 * @param leftParenthesis the left parenthesis |
| 5856 * @param parameters the parameters associated with the method | 5801 * @param parameters the parameters associated with the method |
| 5857 * @param leftDelimiter the left delimiter introducing the optional parameters | 5802 * @param leftDelimiter the left delimiter introducing the optional parameters |
| 5858 * @param rightDelimiter the right delimiter introducing the optional paramete
rs | 5803 * @param rightDelimiter the right delimiter introducing the optional paramete
rs |
| 5859 * @param rightParenthesis the right parenthesis | 5804 * @param rightParenthesis the right parenthesis |
| 5860 */ | 5805 */ |
| 5861 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters,
Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full(
leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis); | 5806 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters,
Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full(
leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis); |
| 5862 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); | 5807 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); |
| 5863 Token get beginToken => _leftParenthesis; | 5808 Token get beginToken => _leftParenthesis; |
| 5864 | 5809 |
| 5865 /** | 5810 /** |
| 5866 * Return an array containing the elements representing the parameters in this
list. The array | 5811 * Return an array containing the elements representing the parameters in this
list. The array |
| 5867 * will contain {@code null}s if the parameters in this list have not been res
olved. | 5812 * will contain {@code null}s if the parameters in this list have not been res
olved. |
| 5868 * @return the elements representing the parameters in this list | 5813 * @return the elements representing the parameters in this list |
| 5869 */ | 5814 */ |
| 5870 List<ParameterElement> get elements { | 5815 List<ParameterElement> get elements { |
| 5871 int count = _parameters.length; | 5816 int count = _parameters.length; |
| 5872 List<ParameterElement> types = new List<ParameterElement>(count); | 5817 List<ParameterElement> types = new List<ParameterElement>(count); |
| 5873 for (int i = 0; i < count; i++) { | 5818 for (int i = 0; i < count; i++) { |
| 5874 types[i] = _parameters[i].element; | 5819 types[i] = _parameters[i].element; |
| 5875 } | 5820 } |
| 5876 return types; | 5821 return types; |
| 5877 } | 5822 } |
| 5878 Token get endToken => _rightParenthesis; | 5823 Token get endToken => _rightParenthesis; |
| 5879 | 5824 |
| 5880 /** | 5825 /** |
| 5881 * Return the left square bracket ('\[') or left curly brace ('{') introducing
the optional | 5826 * Return the left square bracket ('\[') or left curly brace ('{') introducing
the optional |
| 5882 * parameters. | 5827 * parameters. |
| 5883 * @return the left square bracket ('\[') or left curly brace ('{') introducin
g the optional | 5828 * @return the left square bracket ('\[') or left curly brace ('{') introducin
g the optional |
| 5884 * parameters | 5829 * parameters |
| 5885 */ | 5830 */ |
| 5886 Token get leftDelimiter => _leftDelimiter; | 5831 Token get leftDelimiter => _leftDelimiter; |
| 5887 | 5832 |
| 5888 /** | 5833 /** |
| 5889 * Return the left parenthesis. | 5834 * Return the left parenthesis. |
| 5890 * @return the left parenthesis | 5835 * @return the left parenthesis |
| 5891 */ | 5836 */ |
| 5892 Token get leftParenthesis => _leftParenthesis; | 5837 Token get leftParenthesis => _leftParenthesis; |
| 5893 | 5838 |
| 5894 /** | 5839 /** |
| 5895 * Return the parameters associated with the method. | 5840 * Return the parameters associated with the method. |
| 5896 * @return the parameters associated with the method | 5841 * @return the parameters associated with the method |
| 5897 */ | 5842 */ |
| 5898 NodeList<FormalParameter> get parameters => _parameters; | 5843 NodeList<FormalParameter> get parameters => _parameters; |
| 5899 | 5844 |
| 5900 /** | 5845 /** |
| 5901 * Return the right square bracket ('\]') or right curly brace ('}') introduci
ng the optional | 5846 * Return the right square bracket ('\]') or right curly brace ('}') introduci
ng the optional |
| 5902 * parameters. | 5847 * parameters. |
| 5903 * @return the right square bracket ('\]') or right curly brace ('}') introduc
ing the optional | 5848 * @return the right square bracket ('\]') or right curly brace ('}') introduc
ing the optional |
| 5904 * parameters | 5849 * parameters |
| 5905 */ | 5850 */ |
| 5906 Token get rightDelimiter => _rightDelimiter; | 5851 Token get rightDelimiter => _rightDelimiter; |
| 5907 | 5852 |
| 5908 /** | 5853 /** |
| 5909 * Return the right parenthesis. | 5854 * Return the right parenthesis. |
| 5910 * @return the right parenthesis | 5855 * @return the right parenthesis |
| 5911 */ | 5856 */ |
| 5912 Token get rightParenthesis => _rightParenthesis; | 5857 Token get rightParenthesis => _rightParenthesis; |
| 5913 | 5858 |
| 5914 /** | 5859 /** |
| 5915 * Set the left square bracket ('\[') or left curly brace ('{') introducing th
e optional parameters | 5860 * Set the left square bracket ('\[') or left curly brace ('{') introducing th
e optional parameters |
| 5916 * to the given token. | 5861 * to the given token. |
| 5917 * @param bracket the left delimiter introducing the optional parameters | 5862 * @param bracket the left delimiter introducing the optional parameters |
| 5918 */ | 5863 */ |
| 5919 void set leftDelimiter(Token bracket) { | 5864 void set leftDelimiter(Token bracket) { |
| 5920 _leftDelimiter = bracket; | 5865 _leftDelimiter = bracket; |
| 5921 } | 5866 } |
| 5922 | 5867 |
| 5923 /** | 5868 /** |
| 5924 * Set the left parenthesis to the given token. | 5869 * Set the left parenthesis to the given token. |
| 5925 * @param parenthesis the left parenthesis | 5870 * @param parenthesis the left parenthesis |
| 5926 */ | 5871 */ |
| 5927 void set leftParenthesis(Token parenthesis) { | 5872 void set leftParenthesis(Token parenthesis) { |
| 5928 _leftParenthesis = parenthesis; | 5873 _leftParenthesis = parenthesis; |
| 5929 } | 5874 } |
| 5930 | 5875 |
| 5931 /** | 5876 /** |
| 5932 * Set the right square bracket ('\]') or right curly brace ('}') introducing
the optional | 5877 * Set the right square bracket ('\]') or right curly brace ('}') introducing
the optional |
| 5933 * parameters to the given token. | 5878 * parameters to the given token. |
| 5934 * @param bracket the right delimiter introducing the optional parameters | 5879 * @param bracket the right delimiter introducing the optional parameters |
| 5935 */ | 5880 */ |
| 5936 void set rightDelimiter(Token bracket) { | 5881 void set rightDelimiter(Token bracket) { |
| 5937 _rightDelimiter = bracket; | 5882 _rightDelimiter = bracket; |
| 5938 } | 5883 } |
| 5939 | 5884 |
| 5940 /** | 5885 /** |
| 5941 * Set the right parenthesis to the given token. | 5886 * Set the right parenthesis to the given token. |
| 5942 * @param parenthesis the right parenthesis | 5887 * @param parenthesis the right parenthesis |
| 5943 */ | 5888 */ |
| 5944 void set rightParenthesis(Token parenthesis) { | 5889 void set rightParenthesis(Token parenthesis) { |
| 5945 _rightParenthesis = parenthesis; | 5890 _rightParenthesis = parenthesis; |
| 5946 } | 5891 } |
| 5947 void visitChildren(ASTVisitor<Object> visitor) { | 5892 void visitChildren(ASTVisitor<Object> visitor) { |
| 5948 _parameters.accept(visitor); | 5893 _parameters.accept(visitor); |
| 5949 } | 5894 } |
| 5950 } | 5895 } |
| 5951 | |
| 5952 /** | 5896 /** |
| 5953 * The abstract class {@code FunctionBody} defines the behavior common to object
s representing the | 5897 * The abstract class {@code FunctionBody} defines the behavior common to object
s representing the |
| 5954 * body of a function or method. | 5898 * body of a function or method. |
| 5955 * <pre> | 5899 * <pre> |
| 5956 * functionBody ::={@link BlockFunctionBody blockFunctionBody}| {@link EmptyFunc
tionBody emptyFunctionBody}| {@link ExpressionFunctionBody expressionFunctionBod
y}</pre> | 5900 * functionBody ::={@link BlockFunctionBody blockFunctionBody}| {@link EmptyFunc
tionBody emptyFunctionBody}| {@link ExpressionFunctionBody expressionFunctionBod
y}</pre> |
| 5957 * @coverage dart.engine.ast | 5901 * @coverage dart.engine.ast |
| 5958 */ | 5902 */ |
| 5959 abstract class FunctionBody extends ASTNode { | 5903 abstract class FunctionBody extends ASTNode { |
| 5960 } | 5904 } |
| 5961 | |
| 5962 /** | 5905 /** |
| 5963 * Instances of the class {@code FunctionDeclaration} wrap a {@link FunctionExpr
ession function | 5906 * Instances of the class {@code FunctionDeclaration} wrap a {@link FunctionExpr
ession function |
| 5964 * expression} as a top-level declaration. | 5907 * expression} as a top-level declaration. |
| 5965 * <pre> | 5908 * <pre> |
| 5966 * functionDeclaration ::= | 5909 * functionDeclaration ::= |
| 5967 * 'external' functionSignature | 5910 * 'external' functionSignature |
| 5968 * | functionSignature {@link FunctionBody functionBody}functionSignature ::={@l
ink Type returnType}? ('get' | 'set')? {@link SimpleIdentifier functionName} {@l
ink FormalParameterList formalParameterList}</pre> | 5911 * | functionSignature {@link FunctionBody functionBody}functionSignature ::={@l
ink Type returnType}? ('get' | 'set')? {@link SimpleIdentifier functionName} {@l
ink FormalParameterList formalParameterList}</pre> |
| 5969 * @coverage dart.engine.ast | 5912 * @coverage dart.engine.ast |
| 5970 */ | 5913 */ |
| 5971 class FunctionDeclaration extends CompilationUnitMember { | 5914 class FunctionDeclaration extends CompilationUnitMember { |
| 5972 | 5915 |
| 5973 /** | 5916 /** |
| 5974 * The token representing the 'external' keyword, or {@code null} if this is n
ot an external | 5917 * The token representing the 'external' keyword, or {@code null} if this is n
ot an external |
| 5975 * function. | 5918 * function. |
| 5976 */ | 5919 */ |
| 5977 Token _externalKeyword; | 5920 Token _externalKeyword; |
| 5978 | 5921 |
| 5979 /** | 5922 /** |
| 5980 * The return type of the function, or {@code null} if no return type was decl
ared. | 5923 * The return type of the function, or {@code null} if no return type was decl
ared. |
| 5981 */ | 5924 */ |
| 5982 TypeName _returnType; | 5925 TypeName _returnType; |
| 5983 | 5926 |
| 5984 /** | 5927 /** |
| 5985 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a function | 5928 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a function |
| 5986 * declaration rather than a property declaration. | 5929 * declaration rather than a property declaration. |
| 5987 */ | 5930 */ |
| 5988 Token _propertyKeyword; | 5931 Token _propertyKeyword; |
| 5989 | 5932 |
| 5990 /** | 5933 /** |
| 5991 * The name of the function, or {@code null} if the function is not named. | 5934 * The name of the function, or {@code null} if the function is not named. |
| 5992 */ | 5935 */ |
| 5993 SimpleIdentifier _name; | 5936 SimpleIdentifier _name; |
| 5994 | 5937 |
| 5995 /** | 5938 /** |
| 5996 * The function expression being wrapped. | 5939 * The function expression being wrapped. |
| 5997 */ | 5940 */ |
| 5998 FunctionExpression _functionExpression; | 5941 FunctionExpression _functionExpression; |
| 5999 | 5942 |
| 6000 /** | 5943 /** |
| 6001 * Initialize a newly created function declaration. | 5944 * Initialize a newly created function declaration. |
| 6002 * @param comment the documentation comment associated with this function | 5945 * @param comment the documentation comment associated with this function |
| 6003 * @param metadata the annotations associated with this function | 5946 * @param metadata the annotations associated with this function |
| 6004 * @param externalKeyword the token representing the 'external' keyword | 5947 * @param externalKeyword the token representing the 'external' keyword |
| 6005 * @param returnType the return type of the function | 5948 * @param returnType the return type of the function |
| 6006 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 5949 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 6007 * @param name the name of the function | 5950 * @param name the name of the function |
| 6008 * @param functionExpression the function expression being wrapped | 5951 * @param functionExpression the function expression being wrapped |
| 6009 */ | 5952 */ |
| 6010 FunctionDeclaration.full(Comment comment, List<Annotation> metadata, Token ext
ernalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name,
FunctionExpression functionExpression) : super.full(comment, metadata) { | 5953 FunctionDeclaration.full(Comment comment, List<Annotation> metadata, Token ext
ernalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name,
FunctionExpression functionExpression) : super.full(comment, metadata) { |
| 6011 this._externalKeyword = externalKeyword; | 5954 this._externalKeyword = externalKeyword; |
| 6012 this._returnType = becomeParentOf(returnType); | 5955 this._returnType = becomeParentOf(returnType); |
| 6013 this._propertyKeyword = propertyKeyword; | 5956 this._propertyKeyword = propertyKeyword; |
| 6014 this._name = becomeParentOf(name); | 5957 this._name = becomeParentOf(name); |
| 6015 this._functionExpression = becomeParentOf(functionExpression); | 5958 this._functionExpression = becomeParentOf(functionExpression); |
| 6016 } | 5959 } |
| 6017 | 5960 |
| 6018 /** | 5961 /** |
| 6019 * Initialize a newly created function declaration. | 5962 * Initialize a newly created function declaration. |
| 6020 * @param comment the documentation comment associated with this function | 5963 * @param comment the documentation comment associated with this function |
| 6021 * @param metadata the annotations associated with this function | 5964 * @param metadata the annotations associated with this function |
| 6022 * @param externalKeyword the token representing the 'external' keyword | 5965 * @param externalKeyword the token representing the 'external' keyword |
| 6023 * @param returnType the return type of the function | 5966 * @param returnType the return type of the function |
| 6024 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 5967 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 6025 * @param name the name of the function | 5968 * @param name the name of the function |
| 6026 * @param functionExpression the function expression being wrapped | 5969 * @param functionExpression the function expression being wrapped |
| 6027 */ | 5970 */ |
| 6028 FunctionDeclaration({Comment comment, List<Annotation> metadata, Token externa
lKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name, Fun
ctionExpression functionExpression}) : this.full(comment, metadata, externalKeyw
ord, returnType, propertyKeyword, name, functionExpression); | 5971 FunctionDeclaration({Comment comment, List<Annotation> metadata, Token externa
lKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name, Fun
ctionExpression functionExpression}) : this.full(comment, metadata, externalKeyw
ord, returnType, propertyKeyword, name, functionExpression); |
| 6029 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); | 5972 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); |
| 6030 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; | 5973 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; |
| 6031 Token get endToken => _functionExpression.endToken; | 5974 Token get endToken => _functionExpression.endToken; |
| 6032 | 5975 |
| 6033 /** | 5976 /** |
| 6034 * Return the token representing the 'external' keyword, or {@code null} if th
is is not an | 5977 * Return the token representing the 'external' keyword, or {@code null} if th
is is not an |
| 6035 * external function. | 5978 * external function. |
| 6036 * @return the token representing the 'external' keyword | 5979 * @return the token representing the 'external' keyword |
| 6037 */ | 5980 */ |
| 6038 Token get externalKeyword => _externalKeyword; | 5981 Token get externalKeyword => _externalKeyword; |
| 6039 | 5982 |
| 6040 /** | 5983 /** |
| 6041 * Return the function expression being wrapped. | 5984 * Return the function expression being wrapped. |
| 6042 * @return the function expression being wrapped | 5985 * @return the function expression being wrapped |
| 6043 */ | 5986 */ |
| 6044 FunctionExpression get functionExpression => _functionExpression; | 5987 FunctionExpression get functionExpression => _functionExpression; |
| 6045 | 5988 |
| 6046 /** | 5989 /** |
| 6047 * Return the name of the function, or {@code null} if the function is not nam
ed. | 5990 * Return the name of the function, or {@code null} if the function is not nam
ed. |
| 6048 * @return the name of the function | 5991 * @return the name of the function |
| 6049 */ | 5992 */ |
| 6050 SimpleIdentifier get name => _name; | 5993 SimpleIdentifier get name => _name; |
| 6051 | 5994 |
| 6052 /** | 5995 /** |
| 6053 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a function | 5996 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a function |
| 6054 * declaration rather than a property declaration. | 5997 * declaration rather than a property declaration. |
| 6055 * @return the token representing the 'get' or 'set' keyword | 5998 * @return the token representing the 'get' or 'set' keyword |
| 6056 */ | 5999 */ |
| 6057 Token get propertyKeyword => _propertyKeyword; | 6000 Token get propertyKeyword => _propertyKeyword; |
| 6058 | 6001 |
| 6059 /** | 6002 /** |
| 6060 * Return the return type of the function, or {@code null} if no return type w
as declared. | 6003 * Return the return type of the function, or {@code null} if no return type w
as declared. |
| 6061 * @return the return type of the function | 6004 * @return the return type of the function |
| 6062 */ | 6005 */ |
| 6063 TypeName get returnType => _returnType; | 6006 TypeName get returnType => _returnType; |
| 6064 | 6007 |
| 6065 /** | 6008 /** |
| 6066 * Return {@code true} if this function declares a getter. | 6009 * Return {@code true} if this function declares a getter. |
| 6067 * @return {@code true} if this function declares a getter | 6010 * @return {@code true} if this function declares a getter |
| 6068 */ | 6011 */ |
| 6069 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); | 6012 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); |
| 6070 | 6013 |
| 6071 /** | 6014 /** |
| 6072 * Return {@code true} if this function declares a setter. | 6015 * Return {@code true} if this function declares a setter. |
| 6073 * @return {@code true} if this function declares a setter | 6016 * @return {@code true} if this function declares a setter |
| 6074 */ | 6017 */ |
| 6075 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); | 6018 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); |
| 6076 | 6019 |
| 6077 /** | 6020 /** |
| 6078 * Set the token representing the 'external' keyword to the given token. | 6021 * Set the token representing the 'external' keyword to the given token. |
| 6079 * @param externalKeyword the token representing the 'external' keyword | 6022 * @param externalKeyword the token representing the 'external' keyword |
| 6080 */ | 6023 */ |
| 6081 void set externalKeyword(Token externalKeyword2) { | 6024 void set externalKeyword(Token externalKeyword2) { |
| 6082 this._externalKeyword = externalKeyword2; | 6025 this._externalKeyword = externalKeyword2; |
| 6083 } | 6026 } |
| 6084 | 6027 |
| 6085 /** | 6028 /** |
| 6086 * Set the function expression being wrapped to the given function expression. | 6029 * Set the function expression being wrapped to the given function expression. |
| 6087 * @param functionExpression the function expression being wrapped | 6030 * @param functionExpression the function expression being wrapped |
| 6088 */ | 6031 */ |
| 6089 void set functionExpression(FunctionExpression functionExpression2) { | 6032 void set functionExpression(FunctionExpression functionExpression2) { |
| 6090 functionExpression2 = becomeParentOf(functionExpression2); | 6033 functionExpression2 = becomeParentOf(functionExpression2); |
| 6091 } | 6034 } |
| 6092 | 6035 |
| 6093 /** | 6036 /** |
| 6094 * Set the name of the function to the given identifier. | 6037 * Set the name of the function to the given identifier. |
| 6095 * @param identifier the name of the function | 6038 * @param identifier the name of the function |
| 6096 */ | 6039 */ |
| 6097 void set name(SimpleIdentifier identifier) { | 6040 void set name(SimpleIdentifier identifier) { |
| 6098 _name = becomeParentOf(identifier); | 6041 _name = becomeParentOf(identifier); |
| 6099 } | 6042 } |
| 6100 | 6043 |
| 6101 /** | 6044 /** |
| 6102 * Set the token representing the 'get' or 'set' keyword to the given token. | 6045 * Set the token representing the 'get' or 'set' keyword to the given token. |
| 6103 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 6046 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 6104 */ | 6047 */ |
| 6105 void set propertyKeyword(Token propertyKeyword2) { | 6048 void set propertyKeyword(Token propertyKeyword2) { |
| 6106 this._propertyKeyword = propertyKeyword2; | 6049 this._propertyKeyword = propertyKeyword2; |
| 6107 } | 6050 } |
| 6108 | 6051 |
| 6109 /** | 6052 /** |
| 6110 * Set the return type of the function to the given name. | 6053 * Set the return type of the function to the given name. |
| 6111 * @param name the return type of the function | 6054 * @param name the return type of the function |
| 6112 */ | 6055 */ |
| 6113 void set returnType(TypeName name) { | 6056 void set returnType(TypeName name) { |
| 6114 _returnType = becomeParentOf(name); | 6057 _returnType = becomeParentOf(name); |
| 6115 } | 6058 } |
| 6116 void visitChildren(ASTVisitor<Object> visitor) { | 6059 void visitChildren(ASTVisitor<Object> visitor) { |
| 6117 super.visitChildren(visitor); | 6060 super.visitChildren(visitor); |
| 6118 safelyVisitChild(_returnType, visitor); | 6061 safelyVisitChild(_returnType, visitor); |
| 6119 safelyVisitChild(_name, visitor); | 6062 safelyVisitChild(_name, visitor); |
| 6120 safelyVisitChild(_functionExpression, visitor); | 6063 safelyVisitChild(_functionExpression, visitor); |
| 6121 } | 6064 } |
| 6122 Token get firstTokenAfterCommentAndMetadata { | 6065 Token get firstTokenAfterCommentAndMetadata { |
| 6123 if (_externalKeyword != null) { | 6066 if (_externalKeyword != null) { |
| 6124 return _externalKeyword; | 6067 return _externalKeyword; |
| 6125 } | 6068 } |
| 6126 if (_returnType != null) { | 6069 if (_returnType != null) { |
| 6127 return _returnType.beginToken; | 6070 return _returnType.beginToken; |
| 6128 } else if (_propertyKeyword != null) { | 6071 } else if (_propertyKeyword != null) { |
| 6129 return _propertyKeyword; | 6072 return _propertyKeyword; |
| 6130 } else if (_name != null) { | 6073 } else if (_name != null) { |
| 6131 return _name.beginToken; | 6074 return _name.beginToken; |
| 6132 } | 6075 } |
| 6133 return _functionExpression.beginToken; | 6076 return _functionExpression.beginToken; |
| 6134 } | 6077 } |
| 6135 } | 6078 } |
| 6136 | |
| 6137 /** | 6079 /** |
| 6138 * Instances of the class {@code FunctionDeclarationStatement} wrap a {@link Fun
ctionDeclarationfunction declaration} as a statement. | 6080 * Instances of the class {@code FunctionDeclarationStatement} wrap a {@link Fun
ctionDeclarationfunction declaration} as a statement. |
| 6139 * @coverage dart.engine.ast | 6081 * @coverage dart.engine.ast |
| 6140 */ | 6082 */ |
| 6141 class FunctionDeclarationStatement extends Statement { | 6083 class FunctionDeclarationStatement extends Statement { |
| 6142 | 6084 |
| 6143 /** | 6085 /** |
| 6144 * The function declaration being wrapped. | 6086 * The function declaration being wrapped. |
| 6145 */ | 6087 */ |
| 6146 FunctionDeclaration _functionDeclaration; | 6088 FunctionDeclaration _functionDeclaration; |
| 6147 | 6089 |
| 6148 /** | 6090 /** |
| 6149 * Initialize a newly created function declaration statement. | 6091 * Initialize a newly created function declaration statement. |
| 6150 * @param functionDeclaration the the function declaration being wrapped | 6092 * @param functionDeclaration the the function declaration being wrapped |
| 6151 */ | 6093 */ |
| 6152 FunctionDeclarationStatement.full(FunctionDeclaration functionDeclaration) { | 6094 FunctionDeclarationStatement.full(FunctionDeclaration functionDeclaration) { |
| 6153 this._functionDeclaration = becomeParentOf(functionDeclaration); | 6095 this._functionDeclaration = becomeParentOf(functionDeclaration); |
| 6154 } | 6096 } |
| 6155 | 6097 |
| 6156 /** | 6098 /** |
| 6157 * Initialize a newly created function declaration statement. | 6099 * Initialize a newly created function declaration statement. |
| 6158 * @param functionDeclaration the the function declaration being wrapped | 6100 * @param functionDeclaration the the function declaration being wrapped |
| 6159 */ | 6101 */ |
| 6160 FunctionDeclarationStatement({FunctionDeclaration functionDeclaration}) : this
.full(functionDeclaration); | 6102 FunctionDeclarationStatement({FunctionDeclaration functionDeclaration}) : this
.full(functionDeclaration); |
| 6161 accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); | 6103 accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); |
| 6162 Token get beginToken => _functionDeclaration.beginToken; | 6104 Token get beginToken => _functionDeclaration.beginToken; |
| 6163 Token get endToken => _functionDeclaration.endToken; | 6105 Token get endToken => _functionDeclaration.endToken; |
| 6164 | 6106 |
| 6165 /** | 6107 /** |
| 6166 * Return the function declaration being wrapped. | 6108 * Return the function declaration being wrapped. |
| 6167 * @return the function declaration being wrapped | 6109 * @return the function declaration being wrapped |
| 6168 */ | 6110 */ |
| 6169 FunctionDeclaration get functionDeclaration => _functionDeclaration; | 6111 FunctionDeclaration get functionDeclaration => _functionDeclaration; |
| 6170 | 6112 |
| 6171 /** | 6113 /** |
| 6172 * Set the function declaration being wrapped to the given function declaratio
n. | 6114 * Set the function declaration being wrapped to the given function declaratio
n. |
| 6173 * @param functionDeclaration the function declaration being wrapped | 6115 * @param functionDeclaration the function declaration being wrapped |
| 6174 */ | 6116 */ |
| 6175 void set functionExpression(FunctionDeclaration functionDeclaration2) { | 6117 void set functionExpression(FunctionDeclaration functionDeclaration2) { |
| 6176 this._functionDeclaration = becomeParentOf(functionDeclaration2); | 6118 this._functionDeclaration = becomeParentOf(functionDeclaration2); |
| 6177 } | 6119 } |
| 6178 void visitChildren(ASTVisitor<Object> visitor) { | 6120 void visitChildren(ASTVisitor<Object> visitor) { |
| 6179 safelyVisitChild(_functionDeclaration, visitor); | 6121 safelyVisitChild(_functionDeclaration, visitor); |
| 6180 } | 6122 } |
| 6181 } | 6123 } |
| 6182 | |
| 6183 /** | 6124 /** |
| 6184 * Instances of the class {@code FunctionExpression} represent a function expres
sion. | 6125 * Instances of the class {@code FunctionExpression} represent a function expres
sion. |
| 6185 * <pre> | 6126 * <pre> |
| 6186 * functionExpression ::={@link FormalParameterList formalParameterList} {@link
FunctionBody functionBody}</pre> | 6127 * functionExpression ::={@link FormalParameterList formalParameterList} {@link
FunctionBody functionBody}</pre> |
| 6187 * @coverage dart.engine.ast | 6128 * @coverage dart.engine.ast |
| 6188 */ | 6129 */ |
| 6189 class FunctionExpression extends Expression { | 6130 class FunctionExpression extends Expression { |
| 6190 | 6131 |
| 6191 /** | 6132 /** |
| 6192 * The parameters associated with the function. | 6133 * The parameters associated with the function. |
| 6193 */ | 6134 */ |
| 6194 FormalParameterList _parameters; | 6135 FormalParameterList _parameters; |
| 6195 | 6136 |
| 6196 /** | 6137 /** |
| 6197 * The body of the function, or {@code null} if this is an external function. | 6138 * The body of the function, or {@code null} if this is an external function. |
| 6198 */ | 6139 */ |
| 6199 FunctionBody _body; | 6140 FunctionBody _body; |
| 6200 | 6141 |
| 6201 /** | 6142 /** |
| 6202 * The element associated with the function, or {@code null} if the AST struct
ure has not been | 6143 * The element associated with the function, or {@code null} if the AST struct
ure has not been |
| 6203 * resolved. | 6144 * resolved. |
| 6204 */ | 6145 */ |
| 6205 ExecutableElement _element; | 6146 ExecutableElement _element; |
| 6206 | 6147 |
| 6207 /** | 6148 /** |
| 6208 * Initialize a newly created function declaration. | 6149 * Initialize a newly created function declaration. |
| 6209 * @param parameters the parameters associated with the function | 6150 * @param parameters the parameters associated with the function |
| 6210 * @param body the body of the function | 6151 * @param body the body of the function |
| 6211 */ | 6152 */ |
| 6212 FunctionExpression.full(FormalParameterList parameters, FunctionBody body) { | 6153 FunctionExpression.full(FormalParameterList parameters, FunctionBody body) { |
| 6213 this._parameters = becomeParentOf(parameters); | 6154 this._parameters = becomeParentOf(parameters); |
| 6214 this._body = becomeParentOf(body); | 6155 this._body = becomeParentOf(body); |
| 6215 } | 6156 } |
| 6216 | 6157 |
| 6217 /** | 6158 /** |
| 6218 * Initialize a newly created function declaration. | 6159 * Initialize a newly created function declaration. |
| 6219 * @param parameters the parameters associated with the function | 6160 * @param parameters the parameters associated with the function |
| 6220 * @param body the body of the function | 6161 * @param body the body of the function |
| 6221 */ | 6162 */ |
| 6222 FunctionExpression({FormalParameterList parameters, FunctionBody body}) : this
.full(parameters, body); | 6163 FunctionExpression({FormalParameterList parameters, FunctionBody body}) : this
.full(parameters, body); |
| 6223 accept(ASTVisitor visitor) => visitor.visitFunctionExpression(this); | 6164 accept(ASTVisitor visitor) => visitor.visitFunctionExpression(this); |
| 6224 Token get beginToken { | 6165 Token get beginToken { |
| 6225 if (_parameters != null) { | 6166 if (_parameters != null) { |
| 6226 return _parameters.beginToken; | 6167 return _parameters.beginToken; |
| 6227 } else if (_body != null) { | 6168 } else if (_body != null) { |
| 6228 return _body.beginToken; | 6169 return _body.beginToken; |
| 6229 } | 6170 } |
| 6230 throw new IllegalStateException("Non-external functions must have a body"); | 6171 throw new IllegalStateException("Non-external functions must have a body"); |
| 6231 } | 6172 } |
| 6232 | 6173 |
| 6233 /** | 6174 /** |
| 6234 * Return the body of the function, or {@code null} if this is an external fun
ction. | 6175 * Return the body of the function, or {@code null} if this is an external fun
ction. |
| 6235 * @return the body of the function | 6176 * @return the body of the function |
| 6236 */ | 6177 */ |
| 6237 FunctionBody get body => _body; | 6178 FunctionBody get body => _body; |
| 6238 | 6179 |
| 6239 /** | 6180 /** |
| 6240 * Return the element associated with this function, or {@code null} if the AS
T structure has not | 6181 * Return the element associated with this function, or {@code null} if the AS
T structure has not |
| 6241 * been resolved. | 6182 * been resolved. |
| 6242 * @return the element associated with this function | 6183 * @return the element associated with this function |
| 6243 */ | 6184 */ |
| 6244 ExecutableElement get element => _element; | 6185 ExecutableElement get element => _element; |
| 6245 Token get endToken { | 6186 Token get endToken { |
| 6246 if (_body != null) { | 6187 if (_body != null) { |
| 6247 return _body.endToken; | 6188 return _body.endToken; |
| 6248 } else if (_parameters != null) { | 6189 } else if (_parameters != null) { |
| 6249 return _parameters.endToken; | 6190 return _parameters.endToken; |
| 6250 } | 6191 } |
| 6251 throw new IllegalStateException("Non-external functions must have a body"); | 6192 throw new IllegalStateException("Non-external functions must have a body"); |
| 6252 } | 6193 } |
| 6253 | 6194 |
| 6254 /** | 6195 /** |
| 6255 * Return the parameters associated with the function. | 6196 * Return the parameters associated with the function. |
| 6256 * @return the parameters associated with the function | 6197 * @return the parameters associated with the function |
| 6257 */ | 6198 */ |
| 6258 FormalParameterList get parameters => _parameters; | 6199 FormalParameterList get parameters => _parameters; |
| 6259 | 6200 |
| 6260 /** | 6201 /** |
| 6261 * Set the body of the function to the given function body. | 6202 * Set the body of the function to the given function body. |
| 6262 * @param functionBody the body of the function | 6203 * @param functionBody the body of the function |
| 6263 */ | 6204 */ |
| 6264 void set body(FunctionBody functionBody) { | 6205 void set body(FunctionBody functionBody) { |
| 6265 _body = becomeParentOf(functionBody); | 6206 _body = becomeParentOf(functionBody); |
| 6266 } | 6207 } |
| 6267 | 6208 |
| 6268 /** | 6209 /** |
| 6269 * Set the element associated with this function to the given element. | 6210 * Set the element associated with this function to the given element. |
| 6270 * @param element the element associated with this function | 6211 * @param element the element associated with this function |
| 6271 */ | 6212 */ |
| 6272 void set element(ExecutableElement element2) { | 6213 void set element(ExecutableElement element2) { |
| 6273 this._element = element2; | 6214 this._element = element2; |
| 6274 } | 6215 } |
| 6275 | 6216 |
| 6276 /** | 6217 /** |
| 6277 * Set the parameters associated with the function to the given list of parame
ters. | 6218 * Set the parameters associated with the function to the given list of parame
ters. |
| 6278 * @param parameters the parameters associated with the function | 6219 * @param parameters the parameters associated with the function |
| 6279 */ | 6220 */ |
| 6280 void set parameters(FormalParameterList parameters2) { | 6221 void set parameters(FormalParameterList parameters2) { |
| 6281 this._parameters = becomeParentOf(parameters2); | 6222 this._parameters = becomeParentOf(parameters2); |
| 6282 } | 6223 } |
| 6283 void visitChildren(ASTVisitor<Object> visitor) { | 6224 void visitChildren(ASTVisitor<Object> visitor) { |
| 6284 safelyVisitChild(_parameters, visitor); | 6225 safelyVisitChild(_parameters, visitor); |
| 6285 safelyVisitChild(_body, visitor); | 6226 safelyVisitChild(_body, visitor); |
| 6286 } | 6227 } |
| 6287 } | 6228 } |
| 6288 | |
| 6289 /** | 6229 /** |
| 6290 * Instances of the class {@code FunctionExpressionInvocation} represent the inv
ocation of a | 6230 * Instances of the class {@code FunctionExpressionInvocation} represent the inv
ocation of a |
| 6291 * function resulting from evaluating an expression. Invocations of methods and
other forms of | 6231 * function resulting from evaluating an expression. Invocations of methods and
other forms of |
| 6292 * functions are represented by {@link MethodInvocation method invocation} nodes
. Invocations of | 6232 * functions are represented by {@link MethodInvocation method invocation} nodes
. Invocations of |
| 6293 * getters and setters are represented by either {@link PrefixedIdentifier prefi
xed identifier} or{@link PropertyAccess property access} nodes. | 6233 * getters and setters are represented by either {@link PrefixedIdentifier prefi
xed identifier} or{@link PropertyAccess property access} nodes. |
| 6294 * <pre> | 6234 * <pre> |
| 6295 * functionExpressionInvoction ::={@link Expression function} {@link ArgumentLis
t argumentList}</pre> | 6235 * functionExpressionInvoction ::={@link Expression function} {@link ArgumentLis
t argumentList}</pre> |
| 6296 * @coverage dart.engine.ast | 6236 * @coverage dart.engine.ast |
| 6297 */ | 6237 */ |
| 6298 class FunctionExpressionInvocation extends Expression { | 6238 class FunctionExpressionInvocation extends Expression { |
| 6299 | 6239 |
| 6300 /** | 6240 /** |
| 6301 * The expression producing the function being invoked. | 6241 * The expression producing the function being invoked. |
| 6302 */ | 6242 */ |
| 6303 Expression _function; | 6243 Expression _function; |
| 6304 | 6244 |
| 6305 /** | 6245 /** |
| 6306 * The list of arguments to the function. | 6246 * The list of arguments to the function. |
| 6307 */ | 6247 */ |
| 6308 ArgumentList _argumentList; | 6248 ArgumentList _argumentList; |
| 6309 | 6249 |
| 6310 /** | 6250 /** |
| 6311 * The element associated with the function being invoked based on static type
information, or{@code null} if the AST structure has not been resolved or the f
unction could not be resolved. | 6251 * The element associated with the function being invoked based on static type
information, or{@code null} if the AST structure has not been resolved or the f
unction could not be resolved. |
| 6312 */ | 6252 */ |
| 6313 ExecutableElement _staticElement; | 6253 ExecutableElement _staticElement; |
| 6314 | 6254 |
| 6315 /** | 6255 /** |
| 6316 * The element associated with the function being invoked based on propagated
type information, or{@code null} if the AST structure has not been resolved or t
he function could not be resolved. | 6256 * The element associated with the function being invoked based on propagated
type information, or{@code null} if the AST structure has not been resolved or t
he function could not be resolved. |
| 6317 */ | 6257 */ |
| 6318 ExecutableElement _propagatedElement; | 6258 ExecutableElement _propagatedElement; |
| 6319 | 6259 |
| 6320 /** | 6260 /** |
| 6321 * Initialize a newly created function expression invocation. | 6261 * Initialize a newly created function expression invocation. |
| 6322 * @param function the expression producing the function being invoked | 6262 * @param function the expression producing the function being invoked |
| 6323 * @param argumentList the list of arguments to the method | 6263 * @param argumentList the list of arguments to the method |
| 6324 */ | 6264 */ |
| 6325 FunctionExpressionInvocation.full(Expression function, ArgumentList argumentLi
st) { | 6265 FunctionExpressionInvocation.full(Expression function, ArgumentList argumentLi
st) { |
| 6326 this._function = becomeParentOf(function); | 6266 this._function = becomeParentOf(function); |
| 6327 this._argumentList = becomeParentOf(argumentList); | 6267 this._argumentList = becomeParentOf(argumentList); |
| 6328 } | 6268 } |
| 6329 | 6269 |
| 6330 /** | 6270 /** |
| 6331 * Initialize a newly created function expression invocation. | 6271 * Initialize a newly created function expression invocation. |
| 6332 * @param function the expression producing the function being invoked | 6272 * @param function the expression producing the function being invoked |
| 6333 * @param argumentList the list of arguments to the method | 6273 * @param argumentList the list of arguments to the method |
| 6334 */ | 6274 */ |
| 6335 FunctionExpressionInvocation({Expression function, ArgumentList argumentList})
: this.full(function, argumentList); | 6275 FunctionExpressionInvocation({Expression function, ArgumentList argumentList})
: this.full(function, argumentList); |
| 6336 accept(ASTVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); | 6276 accept(ASTVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); |
| 6337 | 6277 |
| 6338 /** | 6278 /** |
| 6339 * Return the list of arguments to the method. | 6279 * Return the list of arguments to the method. |
| 6340 * @return the list of arguments to the method | 6280 * @return the list of arguments to the method |
| 6341 */ | 6281 */ |
| 6342 ArgumentList get argumentList => _argumentList; | 6282 ArgumentList get argumentList => _argumentList; |
| 6343 Token get beginToken => _function.beginToken; | 6283 Token get beginToken => _function.beginToken; |
| 6344 | 6284 |
| 6345 /** | 6285 /** |
| 6346 * Return the element associated with the function being invoked based on prop
agated type | 6286 * Return the element associated with the function being invoked based on prop
agated type |
| 6347 * information, or {@code null} if the AST structure has not been resolved or
the function could | 6287 * information, or {@code null} if the AST structure has not been resolved or
the function could |
| 6348 * not be resolved. One common example of the latter case is an expression who
se value can change | 6288 * not be resolved. One common example of the latter case is an expression who
se value can change |
| 6349 * over time. | 6289 * over time. |
| 6350 * @return the element associated with the function being invoked | 6290 * @return the element associated with the function being invoked |
| 6351 */ | 6291 */ |
| 6352 ExecutableElement get element => _propagatedElement; | 6292 ExecutableElement get element => _propagatedElement; |
| 6353 Token get endToken => _argumentList.endToken; | 6293 Token get endToken => _argumentList.endToken; |
| 6354 | 6294 |
| 6355 /** | 6295 /** |
| 6356 * Return the expression producing the function being invoked. | 6296 * Return the expression producing the function being invoked. |
| 6357 * @return the expression producing the function being invoked | 6297 * @return the expression producing the function being invoked |
| 6358 */ | 6298 */ |
| 6359 Expression get function => _function; | 6299 Expression get function => _function; |
| 6360 | 6300 |
| 6361 /** | 6301 /** |
| 6362 * Return the element associated with the function being invoked based on stat
ic type information, | 6302 * Return the element associated with the function being invoked based on stat
ic type information, |
| 6363 * or {@code null} if the AST structure has not been resolved or the function
could not be | 6303 * or {@code null} if the AST structure has not been resolved or the function
could not be |
| 6364 * resolved. One common example of the latter case is an expression whose valu
e can change over | 6304 * resolved. One common example of the latter case is an expression whose valu
e can change over |
| 6365 * time. | 6305 * time. |
| 6366 * @return the element associated with the function | 6306 * @return the element associated with the function |
| 6367 */ | 6307 */ |
| 6368 ExecutableElement get staticElement => _staticElement; | 6308 ExecutableElement get staticElement => _staticElement; |
| 6369 | 6309 |
| 6370 /** | 6310 /** |
| 6371 * Set the list of arguments to the method to the given list. | 6311 * Set the list of arguments to the method to the given list. |
| 6372 * @param argumentList the list of arguments to the method | 6312 * @param argumentList the list of arguments to the method |
| 6373 */ | 6313 */ |
| 6374 void set argumentList(ArgumentList argumentList2) { | 6314 void set argumentList(ArgumentList argumentList2) { |
| 6375 this._argumentList = becomeParentOf(argumentList2); | 6315 this._argumentList = becomeParentOf(argumentList2); |
| 6376 } | 6316 } |
| 6377 | 6317 |
| 6378 /** | 6318 /** |
| 6379 * Set the element associated with the function being invoked based on propaga
ted type information | 6319 * Set the element associated with the function being invoked based on propaga
ted type information |
| 6380 * to the given element. | 6320 * to the given element. |
| 6381 * @param element the element to be associated with the function being invoked | 6321 * @param element the element to be associated with the function being invoked |
| 6382 */ | 6322 */ |
| 6383 void set element(ExecutableElement element2) { | 6323 void set element(ExecutableElement element2) { |
| 6384 _propagatedElement = element2; | 6324 _propagatedElement = element2; |
| 6385 } | 6325 } |
| 6386 | 6326 |
| 6387 /** | 6327 /** |
| 6388 * Set the expression producing the function being invoked to the given expres
sion. | 6328 * Set the expression producing the function being invoked to the given expres
sion. |
| 6389 * @param function the expression producing the function being invoked | 6329 * @param function the expression producing the function being invoked |
| 6390 */ | 6330 */ |
| 6391 void set function(Expression function2) { | 6331 void set function(Expression function2) { |
| 6392 function2 = becomeParentOf(function2); | 6332 function2 = becomeParentOf(function2); |
| 6393 } | 6333 } |
| 6394 | 6334 |
| 6395 /** | 6335 /** |
| 6396 * Set the element associated with the function being invoked based on static
type information to | 6336 * Set the element associated with the function being invoked based on static
type information to |
| 6397 * the given element. | 6337 * the given element. |
| 6398 * @param element the element to be associated with the function | 6338 * @param element the element to be associated with the function |
| 6399 */ | 6339 */ |
| 6400 void set staticElement(ExecutableElement element) { | 6340 void set staticElement(ExecutableElement element) { |
| 6401 this._staticElement = element; | 6341 this._staticElement = element; |
| 6402 } | 6342 } |
| 6403 void visitChildren(ASTVisitor<Object> visitor) { | 6343 void visitChildren(ASTVisitor<Object> visitor) { |
| 6404 safelyVisitChild(_function, visitor); | 6344 safelyVisitChild(_function, visitor); |
| 6405 safelyVisitChild(_argumentList, visitor); | 6345 safelyVisitChild(_argumentList, visitor); |
| 6406 } | 6346 } |
| 6407 } | 6347 } |
| 6408 | |
| 6409 /** | 6348 /** |
| 6410 * Instances of the class {@code FunctionTypeAlias} represent a function type al
ias. | 6349 * Instances of the class {@code FunctionTypeAlias} represent a function type al
ias. |
| 6411 * <pre> | 6350 * <pre> |
| 6412 * functionTypeAlias ::= | 6351 * functionTypeAlias ::= |
| 6413 * functionPrefix {@link TypeParameterList typeParameterList}? {@link FormalPara
meterList formalParameterList} ';' | 6352 * functionPrefix {@link TypeParameterList typeParameterList}? {@link FormalPara
meterList formalParameterList} ';' |
| 6414 * functionPrefix ::={@link TypeName returnType}? {@link SimpleIdentifier name}<
/pre> | 6353 * functionPrefix ::={@link TypeName returnType}? {@link SimpleIdentifier name}<
/pre> |
| 6415 * @coverage dart.engine.ast | 6354 * @coverage dart.engine.ast |
| 6416 */ | 6355 */ |
| 6417 class FunctionTypeAlias extends TypeAlias { | 6356 class FunctionTypeAlias extends TypeAlias { |
| 6418 | 6357 |
| 6419 /** | 6358 /** |
| 6420 * The name of the return type of the function type being defined, or {@code n
ull} if no return | 6359 * The name of the return type of the function type being defined, or {@code n
ull} if no return |
| 6421 * type was given. | 6360 * type was given. |
| 6422 */ | 6361 */ |
| 6423 TypeName _returnType; | 6362 TypeName _returnType; |
| 6424 | 6363 |
| 6425 /** | 6364 /** |
| 6426 * The name of the function type being declared. | 6365 * The name of the function type being declared. |
| 6427 */ | 6366 */ |
| 6428 SimpleIdentifier _name; | 6367 SimpleIdentifier _name; |
| 6429 | 6368 |
| 6430 /** | 6369 /** |
| 6431 * The type parameters for the function type, or {@code null} if the function
type does not have | 6370 * The type parameters for the function type, or {@code null} if the function
type does not have |
| 6432 * any type parameters. | 6371 * any type parameters. |
| 6433 */ | 6372 */ |
| 6434 TypeParameterList _typeParameters; | 6373 TypeParameterList _typeParameters; |
| 6435 | 6374 |
| 6436 /** | 6375 /** |
| 6437 * The parameters associated with the function type. | 6376 * The parameters associated with the function type. |
| 6438 */ | 6377 */ |
| 6439 FormalParameterList _parameters; | 6378 FormalParameterList _parameters; |
| 6440 | 6379 |
| 6441 /** | 6380 /** |
| 6442 * Initialize a newly created function type alias. | 6381 * Initialize a newly created function type alias. |
| 6443 * @param comment the documentation comment associated with this type alias | 6382 * @param comment the documentation comment associated with this type alias |
| 6444 * @param metadata the annotations associated with this type alias | 6383 * @param metadata the annotations associated with this type alias |
| 6445 * @param keyword the token representing the 'typedef' keyword | 6384 * @param keyword the token representing the 'typedef' keyword |
| 6446 * @param returnType the name of the return type of the function type being de
fined | 6385 * @param returnType the name of the return type of the function type being de
fined |
| 6447 * @param name the name of the type being declared | 6386 * @param name the name of the type being declared |
| 6448 * @param typeParameters the type parameters for the type | 6387 * @param typeParameters the type parameters for the type |
| 6449 * @param parameters the parameters associated with the function | 6388 * @param parameters the parameters associated with the function |
| 6450 * @param semicolon the semicolon terminating the declaration | 6389 * @param semicolon the semicolon terminating the declaration |
| 6451 */ | 6390 */ |
| 6452 FunctionTypeAlias.full(Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters
, FormalParameterList parameters, Token semicolon) : super.full(comment, metadat
a, keyword, semicolon) { | 6391 FunctionTypeAlias.full(Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters
, FormalParameterList parameters, Token semicolon) : super.full(comment, metadat
a, keyword, semicolon) { |
| 6453 this._returnType = becomeParentOf(returnType); | 6392 this._returnType = becomeParentOf(returnType); |
| 6454 this._name = becomeParentOf(name); | 6393 this._name = becomeParentOf(name); |
| 6455 this._typeParameters = becomeParentOf(typeParameters); | 6394 this._typeParameters = becomeParentOf(typeParameters); |
| 6456 this._parameters = becomeParentOf(parameters); | 6395 this._parameters = becomeParentOf(parameters); |
| 6457 } | 6396 } |
| 6458 | 6397 |
| 6459 /** | 6398 /** |
| 6460 * Initialize a newly created function type alias. | 6399 * Initialize a newly created function type alias. |
| 6461 * @param comment the documentation comment associated with this type alias | 6400 * @param comment the documentation comment associated with this type alias |
| 6462 * @param metadata the annotations associated with this type alias | 6401 * @param metadata the annotations associated with this type alias |
| 6463 * @param keyword the token representing the 'typedef' keyword | 6402 * @param keyword the token representing the 'typedef' keyword |
| 6464 * @param returnType the name of the return type of the function type being de
fined | 6403 * @param returnType the name of the return type of the function type being de
fined |
| 6465 * @param name the name of the type being declared | 6404 * @param name the name of the type being declared |
| 6466 * @param typeParameters the type parameters for the type | 6405 * @param typeParameters the type parameters for the type |
| 6467 * @param parameters the parameters associated with the function | 6406 * @param parameters the parameters associated with the function |
| 6468 * @param semicolon the semicolon terminating the declaration | 6407 * @param semicolon the semicolon terminating the declaration |
| 6469 */ | 6408 */ |
| 6470 FunctionTypeAlias({Comment comment, List<Annotation> metadata, Token keyword,
TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, Fo
rmalParameterList parameters, Token semicolon}) : this.full(comment, metadata, k
eyword, returnType, name, typeParameters, parameters, semicolon); | 6409 FunctionTypeAlias({Comment comment, List<Annotation> metadata, Token keyword,
TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, Fo
rmalParameterList parameters, Token semicolon}) : this.full(comment, metadata, k
eyword, returnType, name, typeParameters, parameters, semicolon); |
| 6471 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); | 6410 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); |
| 6472 FunctionTypeAliasElement get element => _name != null ? (_name.element as Func
tionTypeAliasElement) : null; | 6411 FunctionTypeAliasElement get element => _name != null ? (_name.element as Func
tionTypeAliasElement) : null; |
| 6473 | 6412 |
| 6474 /** | 6413 /** |
| 6475 * Return the name of the function type being declared. | 6414 * Return the name of the function type being declared. |
| 6476 * @return the name of the function type being declared | 6415 * @return the name of the function type being declared |
| 6477 */ | 6416 */ |
| 6478 SimpleIdentifier get name => _name; | 6417 SimpleIdentifier get name => _name; |
| 6479 | 6418 |
| 6480 /** | 6419 /** |
| 6481 * Return the parameters associated with the function type. | 6420 * Return the parameters associated with the function type. |
| 6482 * @return the parameters associated with the function type | 6421 * @return the parameters associated with the function type |
| 6483 */ | 6422 */ |
| 6484 FormalParameterList get parameters => _parameters; | 6423 FormalParameterList get parameters => _parameters; |
| 6485 | 6424 |
| 6486 /** | 6425 /** |
| 6487 * Return the name of the return type of the function type being defined, or {
@code null} if no | 6426 * Return the name of the return type of the function type being defined, or {
@code null} if no |
| 6488 * return type was given. | 6427 * return type was given. |
| 6489 * @return the name of the return type of the function type being defined | 6428 * @return the name of the return type of the function type being defined |
| 6490 */ | 6429 */ |
| 6491 TypeName get returnType => _returnType; | 6430 TypeName get returnType => _returnType; |
| 6492 | 6431 |
| 6493 /** | 6432 /** |
| 6494 * Return the type parameters for the function type, or {@code null} if the fu
nction type does not | 6433 * Return the type parameters for the function type, or {@code null} if the fu
nction type does not |
| 6495 * have any type parameters. | 6434 * have any type parameters. |
| 6496 * @return the type parameters for the function type | 6435 * @return the type parameters for the function type |
| 6497 */ | 6436 */ |
| 6498 TypeParameterList get typeParameters => _typeParameters; | 6437 TypeParameterList get typeParameters => _typeParameters; |
| 6499 | 6438 |
| 6500 /** | 6439 /** |
| 6501 * Set the name of the function type being declared to the given identifier. | 6440 * Set the name of the function type being declared to the given identifier. |
| 6502 * @param name the name of the function type being declared | 6441 * @param name the name of the function type being declared |
| 6503 */ | 6442 */ |
| 6504 void set name(SimpleIdentifier name2) { | 6443 void set name(SimpleIdentifier name2) { |
| 6505 this._name = becomeParentOf(name2); | 6444 this._name = becomeParentOf(name2); |
| 6506 } | 6445 } |
| 6507 | 6446 |
| 6508 /** | 6447 /** |
| 6509 * Set the parameters associated with the function type to the given list of p
arameters. | 6448 * Set the parameters associated with the function type to the given list of p
arameters. |
| 6510 * @param parameters the parameters associated with the function type | 6449 * @param parameters the parameters associated with the function type |
| 6511 */ | 6450 */ |
| 6512 void set parameters(FormalParameterList parameters2) { | 6451 void set parameters(FormalParameterList parameters2) { |
| 6513 this._parameters = becomeParentOf(parameters2); | 6452 this._parameters = becomeParentOf(parameters2); |
| 6514 } | 6453 } |
| 6515 | 6454 |
| 6516 /** | 6455 /** |
| 6517 * Set the name of the return type of the function type being defined to the g
iven type name. | 6456 * Set the name of the return type of the function type being defined to the g
iven type name. |
| 6518 * @param typeName the name of the return type of the function type being defi
ned | 6457 * @param typeName the name of the return type of the function type being defi
ned |
| 6519 */ | 6458 */ |
| 6520 void set returnType(TypeName typeName) { | 6459 void set returnType(TypeName typeName) { |
| 6521 _returnType = becomeParentOf(typeName); | 6460 _returnType = becomeParentOf(typeName); |
| 6522 } | 6461 } |
| 6523 | 6462 |
| 6524 /** | 6463 /** |
| 6525 * Set the type parameters for the function type to the given list of paramete
rs. | 6464 * Set the type parameters for the function type to the given list of paramete
rs. |
| 6526 * @param typeParameters the type parameters for the function type | 6465 * @param typeParameters the type parameters for the function type |
| 6527 */ | 6466 */ |
| 6528 void set typeParameters(TypeParameterList typeParameters2) { | 6467 void set typeParameters(TypeParameterList typeParameters2) { |
| 6529 this._typeParameters = becomeParentOf(typeParameters2); | 6468 this._typeParameters = becomeParentOf(typeParameters2); |
| 6530 } | 6469 } |
| 6531 void visitChildren(ASTVisitor<Object> visitor) { | 6470 void visitChildren(ASTVisitor<Object> visitor) { |
| 6532 super.visitChildren(visitor); | 6471 super.visitChildren(visitor); |
| 6533 safelyVisitChild(_returnType, visitor); | 6472 safelyVisitChild(_returnType, visitor); |
| 6534 safelyVisitChild(_name, visitor); | 6473 safelyVisitChild(_name, visitor); |
| 6535 safelyVisitChild(_typeParameters, visitor); | 6474 safelyVisitChild(_typeParameters, visitor); |
| 6536 safelyVisitChild(_parameters, visitor); | 6475 safelyVisitChild(_parameters, visitor); |
| 6537 } | 6476 } |
| 6538 } | 6477 } |
| 6539 | |
| 6540 /** | 6478 /** |
| 6541 * Instances of the class {@code FunctionTypedFormalParameter} represent a funct
ion-typed formal | 6479 * Instances of the class {@code FunctionTypedFormalParameter} represent a funct
ion-typed formal |
| 6542 * parameter. | 6480 * parameter. |
| 6543 * <pre> | 6481 * <pre> |
| 6544 * functionSignature ::={@link TypeName returnType}? {@link SimpleIdentifier ide
ntifier} {@link FormalParameterList formalParameterList}</pre> | 6482 * functionSignature ::={@link TypeName returnType}? {@link SimpleIdentifier ide
ntifier} {@link FormalParameterList formalParameterList}</pre> |
| 6545 * @coverage dart.engine.ast | 6483 * @coverage dart.engine.ast |
| 6546 */ | 6484 */ |
| 6547 class FunctionTypedFormalParameter extends NormalFormalParameter { | 6485 class FunctionTypedFormalParameter extends NormalFormalParameter { |
| 6548 | 6486 |
| 6549 /** | 6487 /** |
| 6550 * The return type of the function, or {@code null} if the function does not h
ave a return type. | 6488 * The return type of the function, or {@code null} if the function does not h
ave a return type. |
| 6551 */ | 6489 */ |
| 6552 TypeName _returnType; | 6490 TypeName _returnType; |
| 6553 | 6491 |
| 6554 /** | 6492 /** |
| 6555 * The parameters of the function-typed parameter. | 6493 * The parameters of the function-typed parameter. |
| 6556 */ | 6494 */ |
| 6557 FormalParameterList _parameters; | 6495 FormalParameterList _parameters; |
| 6558 | 6496 |
| 6559 /** | 6497 /** |
| 6560 * Initialize a newly created formal parameter. | 6498 * Initialize a newly created formal parameter. |
| 6561 * @param comment the documentation comment associated with this parameter | 6499 * @param comment the documentation comment associated with this parameter |
| 6562 * @param metadata the annotations associated with this parameter | 6500 * @param metadata the annotations associated with this parameter |
| 6563 * @param returnType the return type of the function, or {@code null} if the f
unction does not | 6501 * @param returnType the return type of the function, or {@code null} if the f
unction does not |
| 6564 * have a return type | 6502 * have a return type |
| 6565 * @param identifier the name of the function-typed parameter | 6503 * @param identifier the name of the function-typed parameter |
| 6566 * @param parameters the parameters of the function-typed parameter | 6504 * @param parameters the parameters of the function-typed parameter |
| 6567 */ | 6505 */ |
| 6568 FunctionTypedFormalParameter.full(Comment comment, List<Annotation> metadata,
TypeName returnType, SimpleIdentifier identifier, FormalParameterList parameters
) : super.full(comment, metadata, identifier) { | 6506 FunctionTypedFormalParameter.full(Comment comment, List<Annotation> metadata,
TypeName returnType, SimpleIdentifier identifier, FormalParameterList parameters
) : super.full(comment, metadata, identifier) { |
| 6569 this._returnType = becomeParentOf(returnType); | 6507 this._returnType = becomeParentOf(returnType); |
| 6570 this._parameters = becomeParentOf(parameters); | 6508 this._parameters = becomeParentOf(parameters); |
| 6571 } | 6509 } |
| 6572 | 6510 |
| 6573 /** | 6511 /** |
| 6574 * Initialize a newly created formal parameter. | 6512 * Initialize a newly created formal parameter. |
| 6575 * @param comment the documentation comment associated with this parameter | 6513 * @param comment the documentation comment associated with this parameter |
| 6576 * @param metadata the annotations associated with this parameter | 6514 * @param metadata the annotations associated with this parameter |
| 6577 * @param returnType the return type of the function, or {@code null} if the f
unction does not | 6515 * @param returnType the return type of the function, or {@code null} if the f
unction does not |
| 6578 * have a return type | 6516 * have a return type |
| 6579 * @param identifier the name of the function-typed parameter | 6517 * @param identifier the name of the function-typed parameter |
| 6580 * @param parameters the parameters of the function-typed parameter | 6518 * @param parameters the parameters of the function-typed parameter |
| 6581 */ | 6519 */ |
| 6582 FunctionTypedFormalParameter({Comment comment, List<Annotation> metadata, Type
Name returnType, SimpleIdentifier identifier, FormalParameterList parameters}) :
this.full(comment, metadata, returnType, identifier, parameters); | 6520 FunctionTypedFormalParameter({Comment comment, List<Annotation> metadata, Type
Name returnType, SimpleIdentifier identifier, FormalParameterList parameters}) :
this.full(comment, metadata, returnType, identifier, parameters); |
| 6583 accept(ASTVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); | 6521 accept(ASTVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); |
| 6584 Token get beginToken { | 6522 Token get beginToken { |
| 6585 if (_returnType != null) { | 6523 if (_returnType != null) { |
| 6586 return _returnType.beginToken; | 6524 return _returnType.beginToken; |
| 6587 } | 6525 } |
| 6588 return identifier.beginToken; | 6526 return identifier.beginToken; |
| 6589 } | 6527 } |
| 6590 Token get endToken => _parameters.endToken; | 6528 Token get endToken => _parameters.endToken; |
| 6591 | 6529 |
| 6592 /** | 6530 /** |
| 6593 * Return the parameters of the function-typed parameter. | 6531 * Return the parameters of the function-typed parameter. |
| 6594 * @return the parameters of the function-typed parameter | 6532 * @return the parameters of the function-typed parameter |
| 6595 */ | 6533 */ |
| 6596 FormalParameterList get parameters => _parameters; | 6534 FormalParameterList get parameters => _parameters; |
| 6597 | 6535 |
| 6598 /** | 6536 /** |
| 6599 * Return the return type of the function, or {@code null} if the function doe
s not have a return | 6537 * Return the return type of the function, or {@code null} if the function doe
s not have a return |
| 6600 * type. | 6538 * type. |
| 6601 * @return the return type of the function | 6539 * @return the return type of the function |
| 6602 */ | 6540 */ |
| 6603 TypeName get returnType => _returnType; | 6541 TypeName get returnType => _returnType; |
| 6604 bool isConst() => false; | 6542 bool isConst() => false; |
| 6605 bool isFinal() => false; | 6543 bool isFinal() => false; |
| 6606 | 6544 |
| 6607 /** | 6545 /** |
| 6608 * Set the parameters of the function-typed parameter to the given parameters. | 6546 * Set the parameters of the function-typed parameter to the given parameters. |
| 6609 * @param parameters the parameters of the function-typed parameter | 6547 * @param parameters the parameters of the function-typed parameter |
| 6610 */ | 6548 */ |
| 6611 void set parameters(FormalParameterList parameters2) { | 6549 void set parameters(FormalParameterList parameters2) { |
| 6612 this._parameters = becomeParentOf(parameters2); | 6550 this._parameters = becomeParentOf(parameters2); |
| 6613 } | 6551 } |
| 6614 | 6552 |
| 6615 /** | 6553 /** |
| 6616 * Set the return type of the function to the given type. | 6554 * Set the return type of the function to the given type. |
| 6617 * @param returnType the return type of the function | 6555 * @param returnType the return type of the function |
| 6618 */ | 6556 */ |
| 6619 void set returnType(TypeName returnType2) { | 6557 void set returnType(TypeName returnType2) { |
| 6620 this._returnType = becomeParentOf(returnType2); | 6558 this._returnType = becomeParentOf(returnType2); |
| 6621 } | 6559 } |
| 6622 void visitChildren(ASTVisitor<Object> visitor) { | 6560 void visitChildren(ASTVisitor<Object> visitor) { |
| 6623 super.visitChildren(visitor); | 6561 super.visitChildren(visitor); |
| 6624 safelyVisitChild(_returnType, visitor); | 6562 safelyVisitChild(_returnType, visitor); |
| 6625 safelyVisitChild(identifier, visitor); | 6563 safelyVisitChild(identifier, visitor); |
| 6626 safelyVisitChild(_parameters, visitor); | 6564 safelyVisitChild(_parameters, visitor); |
| 6627 } | 6565 } |
| 6628 } | 6566 } |
| 6629 | |
| 6630 /** | 6567 /** |
| 6631 * Instances of the class {@code HideCombinator} represent a combinator that res
tricts the names | 6568 * Instances of the class {@code HideCombinator} represent a combinator that res
tricts the names |
| 6632 * being imported to those that are not in a given list. | 6569 * being imported to those that are not in a given list. |
| 6633 * <pre> | 6570 * <pre> |
| 6634 * hideCombinator ::= | 6571 * hideCombinator ::= |
| 6635 * 'hide' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) | 6572 * 'hide' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) |
| 6636 * </pre> | 6573 * </pre> |
| 6637 * @coverage dart.engine.ast | 6574 * @coverage dart.engine.ast |
| 6638 */ | 6575 */ |
| 6639 class HideCombinator extends Combinator { | 6576 class HideCombinator extends Combinator { |
| 6640 | 6577 |
| 6641 /** | 6578 /** |
| 6642 * The list of names from the library that are hidden by this combinator. | 6579 * The list of names from the library that are hidden by this combinator. |
| 6643 */ | 6580 */ |
| 6644 NodeList<SimpleIdentifier> _hiddenNames; | 6581 NodeList<SimpleIdentifier> _hiddenNames; |
| 6645 | 6582 |
| 6646 /** | 6583 /** |
| 6647 * Initialize a newly created import show combinator. | 6584 * Initialize a newly created import show combinator. |
| 6648 * @param keyword the comma introducing the combinator | 6585 * @param keyword the comma introducing the combinator |
| 6649 * @param hiddenNames the list of names from the library that are hidden by th
is combinator | 6586 * @param hiddenNames the list of names from the library that are hidden by th
is combinator |
| 6650 */ | 6587 */ |
| 6651 HideCombinator.full(Token keyword, List<SimpleIdentifier> hiddenNames) : super
.full(keyword) { | 6588 HideCombinator.full(Token keyword, List<SimpleIdentifier> hiddenNames) : super
.full(keyword) { |
| 6652 this._hiddenNames = new NodeList<SimpleIdentifier>(this); | 6589 this._hiddenNames = new NodeList<SimpleIdentifier>(this); |
| 6653 this._hiddenNames.addAll(hiddenNames); | 6590 this._hiddenNames.addAll(hiddenNames); |
| 6654 } | 6591 } |
| 6655 | 6592 |
| 6656 /** | 6593 /** |
| 6657 * Initialize a newly created import show combinator. | 6594 * Initialize a newly created import show combinator. |
| 6658 * @param keyword the comma introducing the combinator | 6595 * @param keyword the comma introducing the combinator |
| 6659 * @param hiddenNames the list of names from the library that are hidden by th
is combinator | 6596 * @param hiddenNames the list of names from the library that are hidden by th
is combinator |
| 6660 */ | 6597 */ |
| 6661 HideCombinator({Token keyword, List<SimpleIdentifier> hiddenNames}) : this.ful
l(keyword, hiddenNames); | 6598 HideCombinator({Token keyword, List<SimpleIdentifier> hiddenNames}) : this.ful
l(keyword, hiddenNames); |
| 6662 accept(ASTVisitor visitor) => visitor.visitHideCombinator(this); | 6599 accept(ASTVisitor visitor) => visitor.visitHideCombinator(this); |
| 6663 Token get endToken => _hiddenNames.endToken; | 6600 Token get endToken => _hiddenNames.endToken; |
| 6664 | 6601 |
| 6665 /** | 6602 /** |
| 6666 * Return the list of names from the library that are hidden by this combinato
r. | 6603 * Return the list of names from the library that are hidden by this combinato
r. |
| 6667 * @return the list of names from the library that are hidden by this combinat
or | 6604 * @return the list of names from the library that are hidden by this combinat
or |
| 6668 */ | 6605 */ |
| 6669 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames; | 6606 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames; |
| 6670 void visitChildren(ASTVisitor<Object> visitor) { | 6607 void visitChildren(ASTVisitor<Object> visitor) { |
| 6671 _hiddenNames.accept(visitor); | 6608 _hiddenNames.accept(visitor); |
| 6672 } | 6609 } |
| 6673 } | 6610 } |
| 6674 | |
| 6675 /** | 6611 /** |
| 6676 * The abstract class {@code Identifier} defines the behavior common to nodes th
at represent an | 6612 * The abstract class {@code Identifier} defines the behavior common to nodes th
at represent an |
| 6677 * identifier. | 6613 * identifier. |
| 6678 * <pre> | 6614 * <pre> |
| 6679 * identifier ::={@link SimpleIdentifier simpleIdentifier}| {@link PrefixedIdent
ifier prefixedIdentifier}</pre> | 6615 * identifier ::={@link SimpleIdentifier simpleIdentifier}| {@link PrefixedIdent
ifier prefixedIdentifier}</pre> |
| 6680 * @coverage dart.engine.ast | 6616 * @coverage dart.engine.ast |
| 6681 */ | 6617 */ |
| 6682 abstract class Identifier extends Expression { | 6618 abstract class Identifier extends Expression { |
| 6683 | 6619 |
| 6684 /** | 6620 /** |
| 6685 * Return {@code true} if the given name is visible only within the library in
which it is | 6621 * Return {@code true} if the given name is visible only within the library in
which it is |
| 6686 * declared. | 6622 * declared. |
| 6687 * @param name the name being tested | 6623 * @param name the name being tested |
| 6688 * @return {@code true} if the given name is private | 6624 * @return {@code true} if the given name is private |
| 6689 */ | 6625 */ |
| 6690 static bool isPrivateName(String name) => name.startsWith("_"); | 6626 static bool isPrivateName(String name) => name.startsWith("_"); |
| 6691 | 6627 |
| 6692 /** | 6628 /** |
| 6693 * Return the element associated with this identifier based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
is identifier could not be | 6629 * Return the element associated with this identifier based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
is identifier could not be |
| 6694 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope | 6630 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope |
| 6695 * in which it appears. | 6631 * in which it appears. |
| 6696 * @return the element associated with this identifier | 6632 * @return the element associated with this identifier |
| 6697 */ | 6633 */ |
| 6698 Element get element; | 6634 Element get element; |
| 6699 | 6635 |
| 6700 /** | 6636 /** |
| 6701 * Return the lexical representation of the identifier. | 6637 * Return the lexical representation of the identifier. |
| 6702 * @return the lexical representation of the identifier | 6638 * @return the lexical representation of the identifier |
| 6703 */ | 6639 */ |
| 6704 String get name; | 6640 String get name; |
| 6705 | 6641 |
| 6706 /** | 6642 /** |
| 6707 * Return the element associated with this identifier based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if this i
dentifier could not be | 6643 * Return the element associated with this identifier based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if this i
dentifier could not be |
| 6708 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope | 6644 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope |
| 6709 * in which it appears | 6645 * in which it appears |
| 6710 * @return the element associated with the operator | 6646 * @return the element associated with the operator |
| 6711 */ | 6647 */ |
| 6712 Element get staticElement; | 6648 Element get staticElement; |
| 6713 bool isAssignable() => true; | 6649 bool isAssignable() => true; |
| 6714 } | 6650 } |
| 6715 | |
| 6716 /** | 6651 /** |
| 6717 * Instances of the class {@code IfStatement} represent an if statement. | 6652 * Instances of the class {@code IfStatement} represent an if statement. |
| 6718 * <pre> | 6653 * <pre> |
| 6719 * ifStatement ::= | 6654 * ifStatement ::= |
| 6720 * 'if' '(' {@link Expression expression} ')' {@link Statement thenStatement} ('
else' {@link Statement elseStatement})? | 6655 * 'if' '(' {@link Expression expression} ')' {@link Statement thenStatement} ('
else' {@link Statement elseStatement})? |
| 6721 * </pre> | 6656 * </pre> |
| 6722 * @coverage dart.engine.ast | 6657 * @coverage dart.engine.ast |
| 6723 */ | 6658 */ |
| 6724 class IfStatement extends Statement { | 6659 class IfStatement extends Statement { |
| 6725 | 6660 |
| 6726 /** | 6661 /** |
| 6727 * The token representing the 'if' keyword. | 6662 * The token representing the 'if' keyword. |
| 6728 */ | 6663 */ |
| 6729 Token _ifKeyword; | 6664 Token _ifKeyword; |
| 6730 | 6665 |
| 6731 /** | 6666 /** |
| 6732 * The left parenthesis. | 6667 * The left parenthesis. |
| 6733 */ | 6668 */ |
| 6734 Token _leftParenthesis; | 6669 Token _leftParenthesis; |
| 6735 | 6670 |
| 6736 /** | 6671 /** |
| 6737 * The condition used to determine which of the statements is executed next. | 6672 * The condition used to determine which of the statements is executed next. |
| 6738 */ | 6673 */ |
| 6739 Expression _condition; | 6674 Expression _condition; |
| 6740 | 6675 |
| 6741 /** | 6676 /** |
| 6742 * The right parenthesis. | 6677 * The right parenthesis. |
| 6743 */ | 6678 */ |
| 6744 Token _rightParenthesis; | 6679 Token _rightParenthesis; |
| 6745 | 6680 |
| 6746 /** | 6681 /** |
| 6747 * The statement that is executed if the condition evaluates to {@code true}. | 6682 * The statement that is executed if the condition evaluates to {@code true}. |
| 6748 */ | 6683 */ |
| 6749 Statement _thenStatement; | 6684 Statement _thenStatement; |
| 6750 | 6685 |
| 6751 /** | 6686 /** |
| 6752 * The token representing the 'else' keyword. | 6687 * The token representing the 'else' keyword. |
| 6753 */ | 6688 */ |
| 6754 Token _elseKeyword; | 6689 Token _elseKeyword; |
| 6755 | 6690 |
| 6756 /** | 6691 /** |
| 6757 * The statement that is executed if the condition evaluates to {@code false},
or {@code null} if | 6692 * The statement that is executed if the condition evaluates to {@code false},
or {@code null} if |
| 6758 * there is no else statement. | 6693 * there is no else statement. |
| 6759 */ | 6694 */ |
| 6760 Statement _elseStatement; | 6695 Statement _elseStatement; |
| 6761 | 6696 |
| 6762 /** | 6697 /** |
| 6763 * Initialize a newly created if statement. | 6698 * Initialize a newly created if statement. |
| 6764 * @param ifKeyword the token representing the 'if' keyword | 6699 * @param ifKeyword the token representing the 'if' keyword |
| 6765 * @param leftParenthesis the left parenthesis | 6700 * @param leftParenthesis the left parenthesis |
| 6766 * @param condition the condition used to determine which of the statements is
executed next | 6701 * @param condition the condition used to determine which of the statements is
executed next |
| 6767 * @param rightParenthesis the right parenthesis | 6702 * @param rightParenthesis the right parenthesis |
| 6768 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} | 6703 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} |
| 6769 * @param elseKeyword the token representing the 'else' keyword | 6704 * @param elseKeyword the token representing the 'else' keyword |
| 6770 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} | 6705 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} |
| 6771 */ | 6706 */ |
| 6772 IfStatement.full(Token ifKeyword, Token leftParenthesis, Expression condition,
Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement e
lseStatement) { | 6707 IfStatement.full(Token ifKeyword, Token leftParenthesis, Expression condition,
Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement e
lseStatement) { |
| 6773 this._ifKeyword = ifKeyword; | 6708 this._ifKeyword = ifKeyword; |
| 6774 this._leftParenthesis = leftParenthesis; | 6709 this._leftParenthesis = leftParenthesis; |
| 6775 this._condition = becomeParentOf(condition); | 6710 this._condition = becomeParentOf(condition); |
| 6776 this._rightParenthesis = rightParenthesis; | 6711 this._rightParenthesis = rightParenthesis; |
| 6777 this._thenStatement = becomeParentOf(thenStatement); | 6712 this._thenStatement = becomeParentOf(thenStatement); |
| 6778 this._elseKeyword = elseKeyword; | 6713 this._elseKeyword = elseKeyword; |
| 6779 this._elseStatement = becomeParentOf(elseStatement); | 6714 this._elseStatement = becomeParentOf(elseStatement); |
| 6780 } | 6715 } |
| 6781 | 6716 |
| 6782 /** | 6717 /** |
| 6783 * Initialize a newly created if statement. | 6718 * Initialize a newly created if statement. |
| 6784 * @param ifKeyword the token representing the 'if' keyword | 6719 * @param ifKeyword the token representing the 'if' keyword |
| 6785 * @param leftParenthesis the left parenthesis | 6720 * @param leftParenthesis the left parenthesis |
| 6786 * @param condition the condition used to determine which of the statements is
executed next | 6721 * @param condition the condition used to determine which of the statements is
executed next |
| 6787 * @param rightParenthesis the right parenthesis | 6722 * @param rightParenthesis the right parenthesis |
| 6788 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} | 6723 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} |
| 6789 * @param elseKeyword the token representing the 'else' keyword | 6724 * @param elseKeyword the token representing the 'else' keyword |
| 6790 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} | 6725 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} |
| 6791 */ | 6726 */ |
| 6792 IfStatement({Token ifKeyword, Token leftParenthesis, Expression condition, Tok
en rightParenthesis, Statement thenStatement, Token elseKeyword, Statement elseS
tatement}) : this.full(ifKeyword, leftParenthesis, condition, rightParenthesis,
thenStatement, elseKeyword, elseStatement); | 6727 IfStatement({Token ifKeyword, Token leftParenthesis, Expression condition, Tok
en rightParenthesis, Statement thenStatement, Token elseKeyword, Statement elseS
tatement}) : this.full(ifKeyword, leftParenthesis, condition, rightParenthesis,
thenStatement, elseKeyword, elseStatement); |
| 6793 accept(ASTVisitor visitor) => visitor.visitIfStatement(this); | 6728 accept(ASTVisitor visitor) => visitor.visitIfStatement(this); |
| 6794 Token get beginToken => _ifKeyword; | 6729 Token get beginToken => _ifKeyword; |
| 6795 | 6730 |
| 6796 /** | 6731 /** |
| 6797 * Return the condition used to determine which of the statements is executed
next. | 6732 * Return the condition used to determine which of the statements is executed
next. |
| 6798 * @return the condition used to determine which statement is executed next | 6733 * @return the condition used to determine which statement is executed next |
| 6799 */ | 6734 */ |
| 6800 Expression get condition => _condition; | 6735 Expression get condition => _condition; |
| 6801 | 6736 |
| 6802 /** | 6737 /** |
| 6803 * Return the token representing the 'else' keyword. | 6738 * Return the token representing the 'else' keyword. |
| 6804 * @return the token representing the 'else' keyword | 6739 * @return the token representing the 'else' keyword |
| 6805 */ | 6740 */ |
| 6806 Token get elseKeyword => _elseKeyword; | 6741 Token get elseKeyword => _elseKeyword; |
| 6807 | 6742 |
| 6808 /** | 6743 /** |
| 6809 * Return the statement that is executed if the condition evaluates to {@code
false}, or{@code null} if there is no else statement. | 6744 * Return the statement that is executed if the condition evaluates to {@code
false}, or{@code null} if there is no else statement. |
| 6810 * @return the statement that is executed if the condition evaluates to {@code
false} | 6745 * @return the statement that is executed if the condition evaluates to {@code
false} |
| 6811 */ | 6746 */ |
| 6812 Statement get elseStatement => _elseStatement; | 6747 Statement get elseStatement => _elseStatement; |
| 6813 Token get endToken { | 6748 Token get endToken { |
| 6814 if (_elseStatement != null) { | 6749 if (_elseStatement != null) { |
| 6815 return _elseStatement.endToken; | 6750 return _elseStatement.endToken; |
| 6816 } | 6751 } |
| 6817 return _thenStatement.endToken; | 6752 return _thenStatement.endToken; |
| 6818 } | 6753 } |
| 6819 | 6754 |
| 6820 /** | 6755 /** |
| 6821 * Return the token representing the 'if' keyword. | 6756 * Return the token representing the 'if' keyword. |
| 6822 * @return the token representing the 'if' keyword | 6757 * @return the token representing the 'if' keyword |
| 6823 */ | 6758 */ |
| 6824 Token get ifKeyword => _ifKeyword; | 6759 Token get ifKeyword => _ifKeyword; |
| 6825 | 6760 |
| 6826 /** | 6761 /** |
| 6827 * Return the left parenthesis. | 6762 * Return the left parenthesis. |
| 6828 * @return the left parenthesis | 6763 * @return the left parenthesis |
| 6829 */ | 6764 */ |
| 6830 Token get leftParenthesis => _leftParenthesis; | 6765 Token get leftParenthesis => _leftParenthesis; |
| 6831 | 6766 |
| 6832 /** | 6767 /** |
| 6833 * Return the right parenthesis. | 6768 * Return the right parenthesis. |
| 6834 * @return the right parenthesis | 6769 * @return the right parenthesis |
| 6835 */ | 6770 */ |
| 6836 Token get rightParenthesis => _rightParenthesis; | 6771 Token get rightParenthesis => _rightParenthesis; |
| 6837 | 6772 |
| 6838 /** | 6773 /** |
| 6839 * Return the statement that is executed if the condition evaluates to {@code
true}. | 6774 * Return the statement that is executed if the condition evaluates to {@code
true}. |
| 6840 * @return the statement that is executed if the condition evaluates to {@code
true} | 6775 * @return the statement that is executed if the condition evaluates to {@code
true} |
| 6841 */ | 6776 */ |
| 6842 Statement get thenStatement => _thenStatement; | 6777 Statement get thenStatement => _thenStatement; |
| 6843 | 6778 |
| 6844 /** | 6779 /** |
| 6845 * Set the condition used to determine which of the statements is executed nex
t to the given | 6780 * Set the condition used to determine which of the statements is executed nex
t to the given |
| 6846 * expression. | 6781 * expression. |
| 6847 * @param expression the condition used to determine which statement is execut
ed next | 6782 * @param expression the condition used to determine which statement is execut
ed next |
| 6848 */ | 6783 */ |
| 6849 void set condition(Expression expression) { | 6784 void set condition(Expression expression) { |
| 6850 _condition = becomeParentOf(expression); | 6785 _condition = becomeParentOf(expression); |
| 6851 } | 6786 } |
| 6852 | 6787 |
| 6853 /** | 6788 /** |
| 6854 * Set the token representing the 'else' keyword to the given token. | 6789 * Set the token representing the 'else' keyword to the given token. |
| 6855 * @param elseKeyword the token representing the 'else' keyword | 6790 * @param elseKeyword the token representing the 'else' keyword |
| 6856 */ | 6791 */ |
| 6857 void set elseKeyword(Token elseKeyword2) { | 6792 void set elseKeyword(Token elseKeyword2) { |
| 6858 this._elseKeyword = elseKeyword2; | 6793 this._elseKeyword = elseKeyword2; |
| 6859 } | 6794 } |
| 6860 | 6795 |
| 6861 /** | 6796 /** |
| 6862 * Set the statement that is executed if the condition evaluates to {@code fal
se} to the given | 6797 * Set the statement that is executed if the condition evaluates to {@code fal
se} to the given |
| 6863 * statement. | 6798 * statement. |
| 6864 * @param statement the statement that is executed if the condition evaluates
to {@code false} | 6799 * @param statement the statement that is executed if the condition evaluates
to {@code false} |
| 6865 */ | 6800 */ |
| 6866 void set elseStatement(Statement statement) { | 6801 void set elseStatement(Statement statement) { |
| 6867 _elseStatement = becomeParentOf(statement); | 6802 _elseStatement = becomeParentOf(statement); |
| 6868 } | 6803 } |
| 6869 | 6804 |
| 6870 /** | 6805 /** |
| 6871 * Set the token representing the 'if' keyword to the given token. | 6806 * Set the token representing the 'if' keyword to the given token. |
| 6872 * @param ifKeyword the token representing the 'if' keyword | 6807 * @param ifKeyword the token representing the 'if' keyword |
| 6873 */ | 6808 */ |
| 6874 void set ifKeyword(Token ifKeyword2) { | 6809 void set ifKeyword(Token ifKeyword2) { |
| 6875 this._ifKeyword = ifKeyword2; | 6810 this._ifKeyword = ifKeyword2; |
| 6876 } | 6811 } |
| 6877 | 6812 |
| 6878 /** | 6813 /** |
| 6879 * Set the left parenthesis to the given token. | 6814 * Set the left parenthesis to the given token. |
| 6880 * @param leftParenthesis the left parenthesis | 6815 * @param leftParenthesis the left parenthesis |
| 6881 */ | 6816 */ |
| 6882 void set leftParenthesis(Token leftParenthesis2) { | 6817 void set leftParenthesis(Token leftParenthesis2) { |
| 6883 this._leftParenthesis = leftParenthesis2; | 6818 this._leftParenthesis = leftParenthesis2; |
| 6884 } | 6819 } |
| 6885 | 6820 |
| 6886 /** | 6821 /** |
| 6887 * Set the right parenthesis to the given token. | 6822 * Set the right parenthesis to the given token. |
| 6888 * @param rightParenthesis the right parenthesis | 6823 * @param rightParenthesis the right parenthesis |
| 6889 */ | 6824 */ |
| 6890 void set rightParenthesis(Token rightParenthesis2) { | 6825 void set rightParenthesis(Token rightParenthesis2) { |
| 6891 this._rightParenthesis = rightParenthesis2; | 6826 this._rightParenthesis = rightParenthesis2; |
| 6892 } | 6827 } |
| 6893 | 6828 |
| 6894 /** | 6829 /** |
| 6895 * Set the statement that is executed if the condition evaluates to {@code tru
e} to the given | 6830 * Set the statement that is executed if the condition evaluates to {@code tru
e} to the given |
| 6896 * statement. | 6831 * statement. |
| 6897 * @param statement the statement that is executed if the condition evaluates
to {@code true} | 6832 * @param statement the statement that is executed if the condition evaluates
to {@code true} |
| 6898 */ | 6833 */ |
| 6899 void set thenStatement(Statement statement) { | 6834 void set thenStatement(Statement statement) { |
| 6900 _thenStatement = becomeParentOf(statement); | 6835 _thenStatement = becomeParentOf(statement); |
| 6901 } | 6836 } |
| 6902 void visitChildren(ASTVisitor<Object> visitor) { | 6837 void visitChildren(ASTVisitor<Object> visitor) { |
| 6903 safelyVisitChild(_condition, visitor); | 6838 safelyVisitChild(_condition, visitor); |
| 6904 safelyVisitChild(_thenStatement, visitor); | 6839 safelyVisitChild(_thenStatement, visitor); |
| 6905 safelyVisitChild(_elseStatement, visitor); | 6840 safelyVisitChild(_elseStatement, visitor); |
| 6906 } | 6841 } |
| 6907 } | 6842 } |
| 6908 | |
| 6909 /** | 6843 /** |
| 6910 * Instances of the class {@code ImplementsClause} represent the "implements" cl
ause in an class | 6844 * Instances of the class {@code ImplementsClause} represent the "implements" cl
ause in an class |
| 6911 * declaration. | 6845 * declaration. |
| 6912 * <pre> | 6846 * <pre> |
| 6913 * implementsClause ::= | 6847 * implementsClause ::= |
| 6914 * 'implements' {@link TypeName superclass} (',' {@link TypeName superclass}) | 6848 * 'implements' {@link TypeName superclass} (',' {@link TypeName superclass}) |
| 6915 * </pre> | 6849 * </pre> |
| 6916 * @coverage dart.engine.ast | 6850 * @coverage dart.engine.ast |
| 6917 */ | 6851 */ |
| 6918 class ImplementsClause extends ASTNode { | 6852 class ImplementsClause extends ASTNode { |
| 6919 | 6853 |
| 6920 /** | 6854 /** |
| 6921 * The token representing the 'implements' keyword. | 6855 * The token representing the 'implements' keyword. |
| 6922 */ | 6856 */ |
| 6923 Token _keyword; | 6857 Token _keyword; |
| 6924 | 6858 |
| 6925 /** | 6859 /** |
| 6926 * The interfaces that are being implemented. | 6860 * The interfaces that are being implemented. |
| 6927 */ | 6861 */ |
| 6928 NodeList<TypeName> _interfaces; | 6862 NodeList<TypeName> _interfaces; |
| 6929 | 6863 |
| 6930 /** | 6864 /** |
| 6931 * Initialize a newly created extends clause. | 6865 * Initialize a newly created extends clause. |
| 6932 * @param keyword the token representing the 'implements' keyword | 6866 * @param keyword the token representing the 'implements' keyword |
| 6933 * @param interfaces the interfaces that are being implemented | 6867 * @param interfaces the interfaces that are being implemented |
| 6934 */ | 6868 */ |
| 6935 ImplementsClause.full(Token keyword, List<TypeName> interfaces) { | 6869 ImplementsClause.full(Token keyword, List<TypeName> interfaces) { |
| 6936 this._interfaces = new NodeList<TypeName>(this); | 6870 this._interfaces = new NodeList<TypeName>(this); |
| 6937 this._keyword = keyword; | 6871 this._keyword = keyword; |
| 6938 this._interfaces.addAll(interfaces); | 6872 this._interfaces.addAll(interfaces); |
| 6939 } | 6873 } |
| 6940 | 6874 |
| 6941 /** | 6875 /** |
| 6942 * Initialize a newly created extends clause. | 6876 * Initialize a newly created extends clause. |
| 6943 * @param keyword the token representing the 'implements' keyword | 6877 * @param keyword the token representing the 'implements' keyword |
| 6944 * @param interfaces the interfaces that are being implemented | 6878 * @param interfaces the interfaces that are being implemented |
| 6945 */ | 6879 */ |
| 6946 ImplementsClause({Token keyword, List<TypeName> interfaces}) : this.full(keywo
rd, interfaces); | 6880 ImplementsClause({Token keyword, List<TypeName> interfaces}) : this.full(keywo
rd, interfaces); |
| 6947 accept(ASTVisitor visitor) => visitor.visitImplementsClause(this); | 6881 accept(ASTVisitor visitor) => visitor.visitImplementsClause(this); |
| 6948 Token get beginToken => _keyword; | 6882 Token get beginToken => _keyword; |
| 6949 Token get endToken => _interfaces.endToken; | 6883 Token get endToken => _interfaces.endToken; |
| 6950 | 6884 |
| 6951 /** | 6885 /** |
| 6952 * Return the list of the interfaces that are being implemented. | 6886 * Return the list of the interfaces that are being implemented. |
| 6953 * @return the list of the interfaces that are being implemented | 6887 * @return the list of the interfaces that are being implemented |
| 6954 */ | 6888 */ |
| 6955 NodeList<TypeName> get interfaces => _interfaces; | 6889 NodeList<TypeName> get interfaces => _interfaces; |
| 6956 | 6890 |
| 6957 /** | 6891 /** |
| 6958 * Return the token representing the 'implements' keyword. | 6892 * Return the token representing the 'implements' keyword. |
| 6959 * @return the token representing the 'implements' keyword | 6893 * @return the token representing the 'implements' keyword |
| 6960 */ | 6894 */ |
| 6961 Token get keyword => _keyword; | 6895 Token get keyword => _keyword; |
| 6962 | 6896 |
| 6963 /** | 6897 /** |
| 6964 * Set the token representing the 'implements' keyword to the given token. | 6898 * Set the token representing the 'implements' keyword to the given token. |
| 6965 * @param keyword the token representing the 'implements' keyword | 6899 * @param keyword the token representing the 'implements' keyword |
| 6966 */ | 6900 */ |
| 6967 void set keyword(Token keyword2) { | 6901 void set keyword(Token keyword2) { |
| 6968 this._keyword = keyword2; | 6902 this._keyword = keyword2; |
| 6969 } | 6903 } |
| 6970 void visitChildren(ASTVisitor<Object> visitor) { | 6904 void visitChildren(ASTVisitor<Object> visitor) { |
| 6971 _interfaces.accept(visitor); | 6905 _interfaces.accept(visitor); |
| 6972 } | 6906 } |
| 6973 } | 6907 } |
| 6974 | |
| 6975 /** | 6908 /** |
| 6976 * Instances of the class {@code ImportDirective} represent an import directive. | 6909 * Instances of the class {@code ImportDirective} represent an import directive. |
| 6977 * <pre> | 6910 * <pre> |
| 6978 * importDirective ::={@link Annotation metadata} 'import' {@link StringLiteral
libraryUri} ('as' identifier)? {@link Combinator combinator}* ';' | 6911 * importDirective ::={@link Annotation metadata} 'import' {@link StringLiteral
libraryUri} ('as' identifier)? {@link Combinator combinator}* ';' |
| 6979 * </pre> | 6912 * </pre> |
| 6980 * @coverage dart.engine.ast | 6913 * @coverage dart.engine.ast |
| 6981 */ | 6914 */ |
| 6982 class ImportDirective extends NamespaceDirective { | 6915 class ImportDirective extends NamespaceDirective { |
| 6983 | 6916 |
| 6984 /** | 6917 /** |
| 6985 * The token representing the 'as' token, or {@code null} if the imported name
s are not prefixed. | 6918 * The token representing the 'as' token, or {@code null} if the imported name
s are not prefixed. |
| 6986 */ | 6919 */ |
| 6987 Token _asToken; | 6920 Token _asToken; |
| 6988 | 6921 |
| 6989 /** | 6922 /** |
| 6990 * The prefix to be used with the imported names, or {@code null} if the impor
ted names are not | 6923 * The prefix to be used with the imported names, or {@code null} if the impor
ted names are not |
| 6991 * prefixed. | 6924 * prefixed. |
| 6992 */ | 6925 */ |
| 6993 SimpleIdentifier _prefix; | 6926 SimpleIdentifier _prefix; |
| 6994 | 6927 |
| 6995 /** | 6928 /** |
| 6996 * Initialize a newly created import directive. | 6929 * Initialize a newly created import directive. |
| 6997 * @param comment the documentation comment associated with this directive | 6930 * @param comment the documentation comment associated with this directive |
| 6998 * @param metadata the annotations associated with the directive | 6931 * @param metadata the annotations associated with the directive |
| 6999 * @param keyword the token representing the 'import' keyword | 6932 * @param keyword the token representing the 'import' keyword |
| 7000 * @param libraryUri the URI of the library being imported | 6933 * @param libraryUri the URI of the library being imported |
| 7001 * @param asToken the token representing the 'as' token | 6934 * @param asToken the token representing the 'as' token |
| 7002 * @param prefix the prefix to be used with the imported names | 6935 * @param prefix the prefix to be used with the imported names |
| 7003 * @param combinators the combinators used to control how names are imported | 6936 * @param combinators the combinators used to control how names are imported |
| 7004 * @param semicolon the semicolon terminating the directive | 6937 * @param semicolon the semicolon terminating the directive |
| 7005 */ | 6938 */ |
| 7006 ImportDirective.full(Comment comment, List<Annotation> metadata, Token keyword
, StringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combina
tor> combinators, Token semicolon) : super.full(comment, metadata, keyword, libr
aryUri, combinators, semicolon) { | 6939 ImportDirective.full(Comment comment, List<Annotation> metadata, Token keyword
, StringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combina
tor> combinators, Token semicolon) : super.full(comment, metadata, keyword, libr
aryUri, combinators, semicolon) { |
| 7007 this._asToken = asToken; | 6940 this._asToken = asToken; |
| 7008 this._prefix = becomeParentOf(prefix); | 6941 this._prefix = becomeParentOf(prefix); |
| 7009 } | 6942 } |
| 7010 | 6943 |
| 7011 /** | 6944 /** |
| 7012 * Initialize a newly created import directive. | 6945 * Initialize a newly created import directive. |
| 7013 * @param comment the documentation comment associated with this directive | 6946 * @param comment the documentation comment associated with this directive |
| 7014 * @param metadata the annotations associated with the directive | 6947 * @param metadata the annotations associated with the directive |
| 7015 * @param keyword the token representing the 'import' keyword | 6948 * @param keyword the token representing the 'import' keyword |
| 7016 * @param libraryUri the URI of the library being imported | 6949 * @param libraryUri the URI of the library being imported |
| 7017 * @param asToken the token representing the 'as' token | 6950 * @param asToken the token representing the 'as' token |
| 7018 * @param prefix the prefix to be used with the imported names | 6951 * @param prefix the prefix to be used with the imported names |
| 7019 * @param combinators the combinators used to control how names are imported | 6952 * @param combinators the combinators used to control how names are imported |
| 7020 * @param semicolon the semicolon terminating the directive | 6953 * @param semicolon the semicolon terminating the directive |
| 7021 */ | 6954 */ |
| 7022 ImportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combinator>
combinators, Token semicolon}) : this.full(comment, metadata, keyword, libraryU
ri, asToken, prefix, combinators, semicolon); | 6955 ImportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combinator>
combinators, Token semicolon}) : this.full(comment, metadata, keyword, libraryU
ri, asToken, prefix, combinators, semicolon); |
| 7023 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); | 6956 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); |
| 7024 | 6957 |
| 7025 /** | 6958 /** |
| 7026 * Return the token representing the 'as' token, or {@code null} if the import
ed names are not | 6959 * Return the token representing the 'as' token, or {@code null} if the import
ed names are not |
| 7027 * prefixed. | 6960 * prefixed. |
| 7028 * @return the token representing the 'as' token | 6961 * @return the token representing the 'as' token |
| 7029 */ | 6962 */ |
| 7030 Token get asToken => _asToken; | 6963 Token get asToken => _asToken; |
| 7031 | 6964 |
| 7032 /** | 6965 /** |
| 7033 * Return the prefix to be used with the imported names, or {@code null} if th
e imported names are | 6966 * Return the prefix to be used with the imported names, or {@code null} if th
e imported names are |
| 7034 * not prefixed. | 6967 * not prefixed. |
| 7035 * @return the prefix to be used with the imported names | 6968 * @return the prefix to be used with the imported names |
| 7036 */ | 6969 */ |
| 7037 SimpleIdentifier get prefix => _prefix; | 6970 SimpleIdentifier get prefix => _prefix; |
| 7038 LibraryElement get uriElement { | 6971 LibraryElement get uriElement { |
| 7039 Element element2 = element; | 6972 Element element2 = element; |
| 7040 if (element2 is ImportElement) { | 6973 if (element2 is ImportElement) { |
| 7041 return ((element2 as ImportElement)).importedLibrary; | 6974 return ((element2 as ImportElement)).importedLibrary; |
| 7042 } | 6975 } |
| 7043 return null; | 6976 return null; |
| 7044 } | 6977 } |
| 7045 | 6978 |
| 7046 /** | 6979 /** |
| 7047 * Set the token representing the 'as' token to the given token. | 6980 * Set the token representing the 'as' token to the given token. |
| 7048 * @param asToken the token representing the 'as' token | 6981 * @param asToken the token representing the 'as' token |
| 7049 */ | 6982 */ |
| 7050 void set asToken(Token asToken2) { | 6983 void set asToken(Token asToken2) { |
| 7051 this._asToken = asToken2; | 6984 this._asToken = asToken2; |
| 7052 } | 6985 } |
| 7053 | 6986 |
| 7054 /** | 6987 /** |
| 7055 * Set the prefix to be used with the imported names to the given identifier. | 6988 * Set the prefix to be used with the imported names to the given identifier. |
| 7056 * @param prefix the prefix to be used with the imported names | 6989 * @param prefix the prefix to be used with the imported names |
| 7057 */ | 6990 */ |
| 7058 void set prefix(SimpleIdentifier prefix2) { | 6991 void set prefix(SimpleIdentifier prefix2) { |
| 7059 this._prefix = becomeParentOf(prefix2); | 6992 this._prefix = becomeParentOf(prefix2); |
| 7060 } | 6993 } |
| 7061 void visitChildren(ASTVisitor<Object> visitor) { | 6994 void visitChildren(ASTVisitor<Object> visitor) { |
| 7062 super.visitChildren(visitor); | 6995 super.visitChildren(visitor); |
| 7063 safelyVisitChild(_prefix, visitor); | 6996 safelyVisitChild(_prefix, visitor); |
| 7064 combinators.accept(visitor); | 6997 combinators.accept(visitor); |
| 7065 } | 6998 } |
| 7066 } | 6999 } |
| 7067 | |
| 7068 /** | 7000 /** |
| 7069 * Instances of the class {@code IndexExpression} represent an index expression. | 7001 * Instances of the class {@code IndexExpression} represent an index expression. |
| 7070 * <pre> | 7002 * <pre> |
| 7071 * indexExpression ::={@link Expression target} '\[' {@link Expression index} '\
]' | 7003 * indexExpression ::={@link Expression target} '\[' {@link Expression index} '\
]' |
| 7072 * </pre> | 7004 * </pre> |
| 7073 * @coverage dart.engine.ast | 7005 * @coverage dart.engine.ast |
| 7074 */ | 7006 */ |
| 7075 class IndexExpression extends Expression { | 7007 class IndexExpression extends Expression { |
| 7076 | 7008 |
| 7077 /** | 7009 /** |
| 7078 * The expression used to compute the object being indexed, or {@code null} if
this index | 7010 * The expression used to compute the object being indexed, or {@code null} if
this index |
| 7079 * expression is part of a cascade expression. | 7011 * expression is part of a cascade expression. |
| 7080 */ | 7012 */ |
| 7081 Expression _target; | 7013 Expression _target; |
| 7082 | 7014 |
| 7083 /** | 7015 /** |
| 7084 * The period ("..") before a cascaded index expression, or {@code null} if th
is index expression | 7016 * The period ("..") before a cascaded index expression, or {@code null} if th
is index expression |
| 7085 * is not part of a cascade expression. | 7017 * is not part of a cascade expression. |
| 7086 */ | 7018 */ |
| 7087 Token _period; | 7019 Token _period; |
| 7088 | 7020 |
| 7089 /** | 7021 /** |
| 7090 * The left square bracket. | 7022 * The left square bracket. |
| 7091 */ | 7023 */ |
| 7092 Token _leftBracket; | 7024 Token _leftBracket; |
| 7093 | 7025 |
| 7094 /** | 7026 /** |
| 7095 * The expression used to compute the index. | 7027 * The expression used to compute the index. |
| 7096 */ | 7028 */ |
| 7097 Expression _index; | 7029 Expression _index; |
| 7098 | 7030 |
| 7099 /** | 7031 /** |
| 7100 * The right square bracket. | 7032 * The right square bracket. |
| 7101 */ | 7033 */ |
| 7102 Token _rightBracket; | 7034 Token _rightBracket; |
| 7103 | 7035 |
| 7104 /** | 7036 /** |
| 7105 * The element associated with the operator based on the static type of the ta
rget, or{@code null} if the AST structure has not been resolved or if the operat
or could not be | 7037 * The element associated with the operator based on the static type of the ta
rget, or{@code null} if the AST structure has not been resolved or if the operat
or could not be |
| 7106 * resolved. | 7038 * resolved. |
| 7107 */ | 7039 */ |
| 7108 MethodElement _staticElement; | 7040 MethodElement _staticElement; |
| 7109 | 7041 |
| 7110 /** | 7042 /** |
| 7111 * The element associated with the operator based on the propagated type of th
e target, or{@code null} if the AST structure has not been resolved or if the op
erator could not be | 7043 * The element associated with the operator based on the propagated type of th
e target, or{@code null} if the AST structure has not been resolved or if the op
erator could not be |
| 7112 * resolved. | 7044 * resolved. |
| 7113 */ | 7045 */ |
| 7114 MethodElement _propagatedElement; | 7046 MethodElement _propagatedElement; |
| 7115 | 7047 |
| 7116 /** | 7048 /** |
| 7117 * Initialize a newly created index expression. | 7049 * Initialize a newly created index expression. |
| 7118 * @param target the expression used to compute the object being indexed | 7050 * @param target the expression used to compute the object being indexed |
| 7119 * @param leftBracket the left square bracket | 7051 * @param leftBracket the left square bracket |
| 7120 * @param index the expression used to compute the index | 7052 * @param index the expression used to compute the index |
| 7121 * @param rightBracket the right square bracket | 7053 * @param rightBracket the right square bracket |
| 7122 */ | 7054 */ |
| 7123 IndexExpression.forTarget_full(Expression target2, Token leftBracket2, Express
ion index2, Token rightBracket2) { | 7055 IndexExpression.forTarget_full(Expression target2, Token leftBracket2, Express
ion index2, Token rightBracket2) { |
| 7124 _jtd_constructor_58_impl(target2, leftBracket2, index2, rightBracket2); | 7056 _jtd_constructor_58_impl(target2, leftBracket2, index2, rightBracket2); |
| 7125 } | 7057 } |
| 7126 | 7058 |
| 7127 /** | 7059 /** |
| 7128 * Initialize a newly created index expression. | 7060 * Initialize a newly created index expression. |
| 7129 * @param target the expression used to compute the object being indexed | 7061 * @param target the expression used to compute the object being indexed |
| 7130 * @param leftBracket the left square bracket | 7062 * @param leftBracket the left square bracket |
| 7131 * @param index the expression used to compute the index | 7063 * @param index the expression used to compute the index |
| 7132 * @param rightBracket the right square bracket | 7064 * @param rightBracket the right square bracket |
| 7133 */ | 7065 */ |
| 7134 IndexExpression.forTarget({Expression target2, Token leftBracket2, Expression
index2, Token rightBracket2}) : this.forTarget_full(target2, leftBracket2, index
2, rightBracket2); | 7066 IndexExpression.forTarget({Expression target2, Token leftBracket2, Expression
index2, Token rightBracket2}) : this.forTarget_full(target2, leftBracket2, index
2, rightBracket2); |
| 7135 _jtd_constructor_58_impl(Expression target2, Token leftBracket2, Expression in
dex2, Token rightBracket2) { | 7067 _jtd_constructor_58_impl(Expression target2, Token leftBracket2, Expression in
dex2, Token rightBracket2) { |
| 7136 this._target = becomeParentOf(target2); | 7068 this._target = becomeParentOf(target2); |
| 7137 this._leftBracket = leftBracket2; | 7069 this._leftBracket = leftBracket2; |
| 7138 this._index = becomeParentOf(index2); | 7070 this._index = becomeParentOf(index2); |
| 7139 this._rightBracket = rightBracket2; | 7071 this._rightBracket = rightBracket2; |
| 7140 } | 7072 } |
| 7141 | 7073 |
| 7142 /** | 7074 /** |
| 7143 * Initialize a newly created index expression. | 7075 * Initialize a newly created index expression. |
| 7144 * @param period the period ("..") before a cascaded index expression | 7076 * @param period the period ("..") before a cascaded index expression |
| 7145 * @param leftBracket the left square bracket | 7077 * @param leftBracket the left square bracket |
| 7146 * @param index the expression used to compute the index | 7078 * @param index the expression used to compute the index |
| 7147 * @param rightBracket the right square bracket | 7079 * @param rightBracket the right square bracket |
| 7148 */ | 7080 */ |
| 7149 IndexExpression.forCascade_full(Token period2, Token leftBracket2, Expression
index2, Token rightBracket2) { | 7081 IndexExpression.forCascade_full(Token period2, Token leftBracket2, Expression
index2, Token rightBracket2) { |
| 7150 _jtd_constructor_59_impl(period2, leftBracket2, index2, rightBracket2); | 7082 _jtd_constructor_59_impl(period2, leftBracket2, index2, rightBracket2); |
| 7151 } | 7083 } |
| 7152 | 7084 |
| 7153 /** | 7085 /** |
| 7154 * Initialize a newly created index expression. | 7086 * Initialize a newly created index expression. |
| 7155 * @param period the period ("..") before a cascaded index expression | 7087 * @param period the period ("..") before a cascaded index expression |
| 7156 * @param leftBracket the left square bracket | 7088 * @param leftBracket the left square bracket |
| 7157 * @param index the expression used to compute the index | 7089 * @param index the expression used to compute the index |
| 7158 * @param rightBracket the right square bracket | 7090 * @param rightBracket the right square bracket |
| 7159 */ | 7091 */ |
| 7160 IndexExpression.forCascade({Token period2, Token leftBracket2, Expression inde
x2, Token rightBracket2}) : this.forCascade_full(period2, leftBracket2, index2,
rightBracket2); | 7092 IndexExpression.forCascade({Token period2, Token leftBracket2, Expression inde
x2, Token rightBracket2}) : this.forCascade_full(period2, leftBracket2, index2,
rightBracket2); |
| 7161 _jtd_constructor_59_impl(Token period2, Token leftBracket2, Expression index2,
Token rightBracket2) { | 7093 _jtd_constructor_59_impl(Token period2, Token leftBracket2, Expression index2,
Token rightBracket2) { |
| 7162 this._period = period2; | 7094 this._period = period2; |
| 7163 this._leftBracket = leftBracket2; | 7095 this._leftBracket = leftBracket2; |
| 7164 this._index = becomeParentOf(index2); | 7096 this._index = becomeParentOf(index2); |
| 7165 this._rightBracket = rightBracket2; | 7097 this._rightBracket = rightBracket2; |
| 7166 } | 7098 } |
| 7167 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); | 7099 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); |
| 7168 | 7100 |
| 7169 /** | 7101 /** |
| 7170 * Return the expression used to compute the object being indexed, or {@code n
ull} if this index | 7102 * Return the expression used to compute the object being indexed, or {@code n
ull} if this index |
| 7171 * expression is part of a cascade expression. | 7103 * expression is part of a cascade expression. |
| 7172 * @return the expression used to compute the object being indexed | 7104 * @return the expression used to compute the object being indexed |
| 7173 * @see #getRealTarget() | 7105 * @see #getRealTarget() |
| 7174 */ | 7106 */ |
| 7175 Expression get array => _target; | 7107 Expression get array => _target; |
| 7176 Token get beginToken { | 7108 Token get beginToken { |
| 7177 if (_target != null) { | 7109 if (_target != null) { |
| 7178 return _target.beginToken; | 7110 return _target.beginToken; |
| 7179 } | 7111 } |
| 7180 return _period; | 7112 return _period; |
| 7181 } | 7113 } |
| 7182 | 7114 |
| 7183 /** | 7115 /** |
| 7184 * Return the element associated with the operator based on the propagated typ
e of the target, or{@code null} if the AST structure has not been resolved or if
the operator could not be | 7116 * Return the element associated with the operator based on the propagated typ
e of the target, or{@code null} if the AST structure has not been resolved or if
the operator could not be |
| 7185 * resolved. One example of the latter case is an operator that is not defined
for the type of the | 7117 * resolved. One example of the latter case is an operator that is not defined
for the type of the |
| 7186 * target. | 7118 * target. |
| 7187 * @return the element associated with this operator | 7119 * @return the element associated with this operator |
| 7188 */ | 7120 */ |
| 7189 MethodElement get element => _propagatedElement; | 7121 MethodElement get element => _propagatedElement; |
| 7190 Token get endToken => _rightBracket; | 7122 Token get endToken => _rightBracket; |
| 7191 | 7123 |
| 7192 /** | 7124 /** |
| 7193 * Return the expression used to compute the index. | 7125 * Return the expression used to compute the index. |
| 7194 * @return the expression used to compute the index | 7126 * @return the expression used to compute the index |
| 7195 */ | 7127 */ |
| 7196 Expression get index => _index; | 7128 Expression get index => _index; |
| 7197 | 7129 |
| 7198 /** | 7130 /** |
| 7199 * Return the left square bracket. | 7131 * Return the left square bracket. |
| 7200 * @return the left square bracket | 7132 * @return the left square bracket |
| 7201 */ | 7133 */ |
| 7202 Token get leftBracket => _leftBracket; | 7134 Token get leftBracket => _leftBracket; |
| 7203 | 7135 |
| 7204 /** | 7136 /** |
| 7205 * Return the period ("..") before a cascaded index expression, or {@code null
} if this index | 7137 * Return the period ("..") before a cascaded index expression, or {@code null
} if this index |
| 7206 * expression is not part of a cascade expression. | 7138 * expression is not part of a cascade expression. |
| 7207 * @return the period ("..") before a cascaded index expression | 7139 * @return the period ("..") before a cascaded index expression |
| 7208 */ | 7140 */ |
| 7209 Token get period => _period; | 7141 Token get period => _period; |
| 7210 | 7142 |
| 7211 /** | 7143 /** |
| 7212 * Return the expression used to compute the object being indexed. If this ind
ex expression is not | 7144 * Return the expression used to compute the object being indexed. If this ind
ex expression is not |
| 7213 * part of a cascade expression, then this is the same as {@link #getArray()}.
If this index | 7145 * part of a cascade expression, then this is the same as {@link #getArray()}.
If this index |
| 7214 * expression is part of a cascade expression, then the target expression stor
ed with the cascade | 7146 * expression is part of a cascade expression, then the target expression stor
ed with the cascade |
| 7215 * expression is returned. | 7147 * expression is returned. |
| 7216 * @return the expression used to compute the object being indexed | 7148 * @return the expression used to compute the object being indexed |
| 7217 * @see #getArray() | 7149 * @see #getArray() |
| 7218 */ | 7150 */ |
| 7219 Expression get realTarget { | 7151 Expression get realTarget { |
| 7220 if (isCascaded()) { | 7152 if (isCascaded()) { |
| 7221 ASTNode ancestor = parent; | 7153 ASTNode ancestor = parent; |
| 7222 while (ancestor is! CascadeExpression) { | 7154 while (ancestor is! CascadeExpression) { |
| 7223 if (ancestor == null) { | 7155 if (ancestor == null) { |
| 7224 return _target; | 7156 return _target; |
| 7225 } | 7157 } |
| 7226 ancestor = ancestor.parent; | 7158 ancestor = ancestor.parent; |
| 7227 } | 7159 } |
| 7228 return ((ancestor as CascadeExpression)).target; | 7160 return ((ancestor as CascadeExpression)).target; |
| 7229 } | 7161 } |
| 7230 return _target; | 7162 return _target; |
| 7231 } | 7163 } |
| 7232 | 7164 |
| 7233 /** | 7165 /** |
| 7234 * Return the right square bracket. | 7166 * Return the right square bracket. |
| 7235 * @return the right square bracket | 7167 * @return the right square bracket |
| 7236 */ | 7168 */ |
| 7237 Token get rightBracket => _rightBracket; | 7169 Token get rightBracket => _rightBracket; |
| 7238 | 7170 |
| 7239 /** | 7171 /** |
| 7240 * Return the element associated with the operator based on the static type of
the target, or{@code null} if the AST structure has not been resolved or if the
operator could not be | 7172 * Return the element associated with the operator based on the static type of
the target, or{@code null} if the AST structure has not been resolved or if the
operator could not be |
| 7241 * resolved. One example of the latter case is an operator that is not defined
for the type of the | 7173 * resolved. One example of the latter case is an operator that is not defined
for the type of the |
| 7242 * target. | 7174 * target. |
| 7243 * @return the element associated with the operator | 7175 * @return the element associated with the operator |
| 7244 */ | 7176 */ |
| 7245 MethodElement get staticElement => _staticElement; | 7177 MethodElement get staticElement => _staticElement; |
| 7246 | 7178 |
| 7247 /** | 7179 /** |
| 7248 * Return {@code true} if this expression is computing a right-hand value. | 7180 * Return {@code true} if this expression is computing a right-hand value. |
| 7249 * <p> | 7181 * <p> |
| 7250 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 7182 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
| 7251 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 7183 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
| 7252 * @return {@code true} if this expression is in a context where the operator
'\[\]' will be invoked | 7184 * @return {@code true} if this expression is in a context where the operator
'\[\]' will be invoked |
| 7253 */ | 7185 */ |
| 7254 bool inGetterContext() { | 7186 bool inGetterContext() { |
| 7255 ASTNode parent2 = parent; | 7187 ASTNode parent2 = parent; |
| 7256 if (parent2 is AssignmentExpression) { | 7188 if (parent2 is AssignmentExpression) { |
| 7257 AssignmentExpression assignment = parent2 as AssignmentExpression; | 7189 AssignmentExpression assignment = parent2 as AssignmentExpression; |
| 7258 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { | 7190 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { |
| 7259 return false; | 7191 return false; |
| 7260 } | 7192 } |
| 7261 } | 7193 } |
| 7262 return true; | 7194 return true; |
| 7263 } | 7195 } |
| 7264 | 7196 |
| 7265 /** | 7197 /** |
| 7266 * Return {@code true} if this expression is computing a left-hand value. | 7198 * Return {@code true} if this expression is computing a left-hand value. |
| 7267 * <p> | 7199 * <p> |
| 7268 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 7200 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
| 7269 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 7201 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
| 7270 * @return {@code true} if this expression is in a context where the operator
'\[\]=' will be | 7202 * @return {@code true} if this expression is in a context where the operator
'\[\]=' will be |
| 7271 * invoked | 7203 * invoked |
| 7272 */ | 7204 */ |
| 7273 bool inSetterContext() { | 7205 bool inSetterContext() { |
| 7274 ASTNode parent2 = parent; | 7206 ASTNode parent2 = parent; |
| 7275 if (parent2 is PrefixExpression) { | 7207 if (parent2 is PrefixExpression) { |
| 7276 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; | 7208 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; |
| 7277 } else if (parent2 is PostfixExpression) { | 7209 } else if (parent2 is PostfixExpression) { |
| 7278 return true; | 7210 return true; |
| 7279 } else if (parent2 is AssignmentExpression) { | 7211 } else if (parent2 is AssignmentExpression) { |
| 7280 return identical(((parent2 as AssignmentExpression)).leftHandSide, this); | 7212 return identical(((parent2 as AssignmentExpression)).leftHandSide, this); |
| 7281 } | 7213 } |
| 7282 return false; | 7214 return false; |
| 7283 } | 7215 } |
| 7284 bool isAssignable() => true; | 7216 bool isAssignable() => true; |
| 7285 | 7217 |
| 7286 /** | 7218 /** |
| 7287 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this | 7219 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this |
| 7288 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. | 7220 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. |
| 7289 * @return {@code true} if this expression is cascaded | 7221 * @return {@code true} if this expression is cascaded |
| 7290 */ | 7222 */ |
| 7291 bool isCascaded() => _period != null; | 7223 bool isCascaded() => _period != null; |
| 7292 | 7224 |
| 7293 /** | 7225 /** |
| 7294 * Set the expression used to compute the object being indexed to the given ex
pression. | 7226 * Set the expression used to compute the object being indexed to the given ex
pression. |
| 7295 * @param expression the expression used to compute the object being indexed | 7227 * @param expression the expression used to compute the object being indexed |
| 7296 */ | 7228 */ |
| 7297 void set array(Expression expression) { | 7229 void set array(Expression expression) { |
| 7298 _target = becomeParentOf(expression); | 7230 _target = becomeParentOf(expression); |
| 7299 } | 7231 } |
| 7300 | 7232 |
| 7301 /** | 7233 /** |
| 7302 * Set the element associated with the operator based on the propagated type o
f the target to the | 7234 * Set the element associated with the operator based on the propagated type o
f the target to the |
| 7303 * given element. | 7235 * given element. |
| 7304 * @param element the element to be associated with this operator | 7236 * @param element the element to be associated with this operator |
| 7305 */ | 7237 */ |
| 7306 void set element(MethodElement element2) { | 7238 void set element(MethodElement element2) { |
| 7307 _propagatedElement = element2; | 7239 _propagatedElement = element2; |
| 7308 } | 7240 } |
| 7309 | 7241 |
| 7310 /** | 7242 /** |
| 7311 * Set the expression used to compute the index to the given expression. | 7243 * Set the expression used to compute the index to the given expression. |
| 7312 * @param expression the expression used to compute the index | 7244 * @param expression the expression used to compute the index |
| 7313 */ | 7245 */ |
| 7314 void set index(Expression expression) { | 7246 void set index(Expression expression) { |
| 7315 _index = becomeParentOf(expression); | 7247 _index = becomeParentOf(expression); |
| 7316 } | 7248 } |
| 7317 | 7249 |
| 7318 /** | 7250 /** |
| 7319 * Set the left square bracket to the given token. | 7251 * Set the left square bracket to the given token. |
| 7320 * @param bracket the left square bracket | 7252 * @param bracket the left square bracket |
| 7321 */ | 7253 */ |
| 7322 void set leftBracket(Token bracket) { | 7254 void set leftBracket(Token bracket) { |
| 7323 _leftBracket = bracket; | 7255 _leftBracket = bracket; |
| 7324 } | 7256 } |
| 7325 | 7257 |
| 7326 /** | 7258 /** |
| 7327 * Set the period ("..") before a cascaded index expression to the given token
. | 7259 * Set the period ("..") before a cascaded index expression to the given token
. |
| 7328 * @param period the period ("..") before a cascaded index expression | 7260 * @param period the period ("..") before a cascaded index expression |
| 7329 */ | 7261 */ |
| 7330 void set period(Token period2) { | 7262 void set period(Token period2) { |
| 7331 this._period = period2; | 7263 this._period = period2; |
| 7332 } | 7264 } |
| 7333 | 7265 |
| 7334 /** | 7266 /** |
| 7335 * Set the right square bracket to the given token. | 7267 * Set the right square bracket to the given token. |
| 7336 * @param bracket the right square bracket | 7268 * @param bracket the right square bracket |
| 7337 */ | 7269 */ |
| 7338 void set rightBracket(Token bracket) { | 7270 void set rightBracket(Token bracket) { |
| 7339 _rightBracket = bracket; | 7271 _rightBracket = bracket; |
| 7340 } | 7272 } |
| 7341 | 7273 |
| 7342 /** | 7274 /** |
| 7343 * Set the element associated with the operator based on the static type of th
e target to the | 7275 * Set the element associated with the operator based on the static type of th
e target to the |
| 7344 * given element. | 7276 * given element. |
| 7345 * @param element the static element to be associated with the operator | 7277 * @param element the static element to be associated with the operator |
| 7346 */ | 7278 */ |
| 7347 void set staticElement(MethodElement element) { | 7279 void set staticElement(MethodElement element) { |
| 7348 _staticElement = element; | 7280 _staticElement = element; |
| 7349 } | 7281 } |
| 7350 void visitChildren(ASTVisitor<Object> visitor) { | 7282 void visitChildren(ASTVisitor<Object> visitor) { |
| 7351 safelyVisitChild(_target, visitor); | 7283 safelyVisitChild(_target, visitor); |
| 7352 safelyVisitChild(_index, visitor); | 7284 safelyVisitChild(_index, visitor); |
| 7353 } | 7285 } |
| 7354 | 7286 |
| 7355 /** | 7287 /** |
| 7356 * Return the parameter element representing the parameter to which the value
of the index | 7288 * Return the parameter element representing the parameter to which the value
of the index |
| 7357 * expression will be bound. May be {@code null}. | 7289 * expression will be bound. May be {@code null}. |
| 7358 * <p> | 7290 * <p> |
| 7359 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 7291 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
| 7360 * @return the parameter element representing the parameter to which the value
of the index | 7292 * @return the parameter element representing the parameter to which the value
of the index |
| 7361 * expression will be bound | 7293 * expression will be bound |
| 7362 */ | 7294 */ |
| 7363 ParameterElement get parameterElementForIndex { | 7295 ParameterElement get parameterElementForIndex { |
| 7364 if (_propagatedElement == null) { | 7296 if (_propagatedElement == null) { |
| 7365 return null; | 7297 return null; |
| 7366 } | 7298 } |
| 7367 List<ParameterElement> parameters2 = _propagatedElement.parameters; | 7299 List<ParameterElement> parameters2 = _propagatedElement.parameters; |
| 7368 if (parameters2.length < 1) { | 7300 if (parameters2.length < 1) { |
| 7369 return null; | 7301 return null; |
| 7370 } | 7302 } |
| 7371 return parameters2[0]; | 7303 return parameters2[0]; |
| 7372 } | 7304 } |
| 7373 } | 7305 } |
| 7374 | |
| 7375 /** | 7306 /** |
| 7376 * Instances of the class {@code InstanceCreationExpression} represent an instan
ce creation | 7307 * Instances of the class {@code InstanceCreationExpression} represent an instan
ce creation |
| 7377 * expression. | 7308 * expression. |
| 7378 * <pre> | 7309 * <pre> |
| 7379 * newExpression ::= | 7310 * newExpression ::= |
| 7380 * ('new' | 'const') {@link TypeName type} ('.' {@link SimpleIdentifier identifi
er})? {@link ArgumentList argumentList}</pre> | 7311 * ('new' | 'const') {@link TypeName type} ('.' {@link SimpleIdentifier identifi
er})? {@link ArgumentList argumentList}</pre> |
| 7381 * @coverage dart.engine.ast | 7312 * @coverage dart.engine.ast |
| 7382 */ | 7313 */ |
| 7383 class InstanceCreationExpression extends Expression { | 7314 class InstanceCreationExpression extends Expression { |
| 7384 | 7315 |
| 7385 /** | 7316 /** |
| 7386 * The keyword used to indicate how an object should be created. | 7317 * The keyword used to indicate how an object should be created. |
| 7387 */ | 7318 */ |
| 7388 Token _keyword; | 7319 Token _keyword; |
| 7389 | 7320 |
| 7390 /** | 7321 /** |
| 7391 * The name of the constructor to be invoked. | 7322 * The name of the constructor to be invoked. |
| 7392 */ | 7323 */ |
| 7393 ConstructorName _constructorName; | 7324 ConstructorName _constructorName; |
| 7394 | 7325 |
| 7395 /** | 7326 /** |
| 7396 * The list of arguments to the constructor. | 7327 * The list of arguments to the constructor. |
| 7397 */ | 7328 */ |
| 7398 ArgumentList _argumentList; | 7329 ArgumentList _argumentList; |
| 7399 | 7330 |
| 7400 /** | 7331 /** |
| 7401 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. | 7332 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. |
| 7402 */ | 7333 */ |
| 7403 ConstructorElement _staticElement; | 7334 ConstructorElement _staticElement; |
| 7404 | 7335 |
| 7405 /** | 7336 /** |
| 7406 * The element associated with the constructor based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if the const
ructor could not be | 7337 * The element associated with the constructor based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if the const
ructor could not be |
| 7407 * resolved. | 7338 * resolved. |
| 7408 */ | 7339 */ |
| 7409 ConstructorElement _propagatedElement; | 7340 ConstructorElement _propagatedElement; |
| 7410 | 7341 |
| 7411 /** | 7342 /** |
| 7412 * Initialize a newly created instance creation expression. | 7343 * Initialize a newly created instance creation expression. |
| 7413 * @param keyword the keyword used to indicate how an object should be created | 7344 * @param keyword the keyword used to indicate how an object should be created |
| 7414 * @param constructorName the name of the constructor to be invoked | 7345 * @param constructorName the name of the constructor to be invoked |
| 7415 * @param argumentList the list of arguments to the constructor | 7346 * @param argumentList the list of arguments to the constructor |
| 7416 */ | 7347 */ |
| 7417 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName
, ArgumentList argumentList) { | 7348 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName
, ArgumentList argumentList) { |
| 7418 this._keyword = keyword; | 7349 this._keyword = keyword; |
| 7419 this._constructorName = becomeParentOf(constructorName); | 7350 this._constructorName = becomeParentOf(constructorName); |
| 7420 this._argumentList = becomeParentOf(argumentList); | 7351 this._argumentList = becomeParentOf(argumentList); |
| 7421 } | 7352 } |
| 7422 | 7353 |
| 7423 /** | 7354 /** |
| 7424 * Initialize a newly created instance creation expression. | 7355 * Initialize a newly created instance creation expression. |
| 7425 * @param keyword the keyword used to indicate how an object should be created | 7356 * @param keyword the keyword used to indicate how an object should be created |
| 7426 * @param constructorName the name of the constructor to be invoked | 7357 * @param constructorName the name of the constructor to be invoked |
| 7427 * @param argumentList the list of arguments to the constructor | 7358 * @param argumentList the list of arguments to the constructor |
| 7428 */ | 7359 */ |
| 7429 InstanceCreationExpression({Token keyword, ConstructorName constructorName, Ar
gumentList argumentList}) : this.full(keyword, constructorName, argumentList); | 7360 InstanceCreationExpression({Token keyword, ConstructorName constructorName, Ar
gumentList argumentList}) : this.full(keyword, constructorName, argumentList); |
| 7430 accept(ASTVisitor visitor) => visitor.visitInstanceCreationExpression(this); | 7361 accept(ASTVisitor visitor) => visitor.visitInstanceCreationExpression(this); |
| 7431 | 7362 |
| 7432 /** | 7363 /** |
| 7433 * Return the list of arguments to the constructor. | 7364 * Return the list of arguments to the constructor. |
| 7434 * @return the list of arguments to the constructor | 7365 * @return the list of arguments to the constructor |
| 7435 */ | 7366 */ |
| 7436 ArgumentList get argumentList => _argumentList; | 7367 ArgumentList get argumentList => _argumentList; |
| 7437 Token get beginToken => _keyword; | 7368 Token get beginToken => _keyword; |
| 7438 | 7369 |
| 7439 /** | 7370 /** |
| 7440 * Return the name of the constructor to be invoked. | 7371 * Return the name of the constructor to be invoked. |
| 7441 * @return the name of the constructor to be invoked | 7372 * @return the name of the constructor to be invoked |
| 7442 */ | 7373 */ |
| 7443 ConstructorName get constructorName => _constructorName; | 7374 ConstructorName get constructorName => _constructorName; |
| 7444 | 7375 |
| 7445 /** | 7376 /** |
| 7446 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be | 7377 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be |
| 7447 * resolved. | 7378 * resolved. |
| 7448 * @return the element associated with the constructor | 7379 * @return the element associated with the constructor |
| 7449 */ | 7380 */ |
| 7450 ConstructorElement get element => _propagatedElement; | 7381 ConstructorElement get element => _propagatedElement; |
| 7451 Token get endToken => _argumentList.endToken; | 7382 Token get endToken => _argumentList.endToken; |
| 7452 | 7383 |
| 7453 /** | 7384 /** |
| 7454 * Return the keyword used to indicate how an object should be created. | 7385 * Return the keyword used to indicate how an object should be created. |
| 7455 * @return the keyword used to indicate how an object should be created | 7386 * @return the keyword used to indicate how an object should be created |
| 7456 */ | 7387 */ |
| 7457 Token get keyword => _keyword; | 7388 Token get keyword => _keyword; |
| 7458 | 7389 |
| 7459 /** | 7390 /** |
| 7460 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be | 7391 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be |
| 7461 * resolved. | 7392 * resolved. |
| 7462 * @return the element associated with the constructor | 7393 * @return the element associated with the constructor |
| 7463 */ | 7394 */ |
| 7464 ConstructorElement get staticElement => _staticElement; | 7395 ConstructorElement get staticElement => _staticElement; |
| 7465 | 7396 |
| 7466 /** | 7397 /** |
| 7467 * Return {@code true} if this creation expression is used to invoke a constan
t constructor. | 7398 * Return {@code true} if this creation expression is used to invoke a constan
t constructor. |
| 7468 * @return {@code true} if this creation expression is used to invoke a consta
nt constructor | 7399 * @return {@code true} if this creation expression is used to invoke a consta
nt constructor |
| 7469 */ | 7400 */ |
| 7470 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); | 7401 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); |
| 7471 | 7402 |
| 7472 /** | 7403 /** |
| 7473 * Set the list of arguments to the constructor to the given list. | 7404 * Set the list of arguments to the constructor to the given list. |
| 7474 * @param argumentList the list of arguments to the constructor | 7405 * @param argumentList the list of arguments to the constructor |
| 7475 */ | 7406 */ |
| 7476 void set argumentList(ArgumentList argumentList2) { | 7407 void set argumentList(ArgumentList argumentList2) { |
| 7477 this._argumentList = becomeParentOf(argumentList2); | 7408 this._argumentList = becomeParentOf(argumentList2); |
| 7478 } | 7409 } |
| 7479 | 7410 |
| 7480 /** | 7411 /** |
| 7481 * Set the name of the constructor to be invoked to the given name. | 7412 * Set the name of the constructor to be invoked to the given name. |
| 7482 * @param constructorName the name of the constructor to be invoked | 7413 * @param constructorName the name of the constructor to be invoked |
| 7483 */ | 7414 */ |
| 7484 void set constructorName(ConstructorName constructorName2) { | 7415 void set constructorName(ConstructorName constructorName2) { |
| 7485 this._constructorName = constructorName2; | 7416 this._constructorName = constructorName2; |
| 7486 } | 7417 } |
| 7487 | 7418 |
| 7488 /** | 7419 /** |
| 7489 * Set the element associated with the constructor based on propagated type in
formation to the | 7420 * Set the element associated with the constructor based on propagated type in
formation to the |
| 7490 * given element. | 7421 * given element. |
| 7491 * @param element the element to be associated with the constructor | 7422 * @param element the element to be associated with the constructor |
| 7492 */ | 7423 */ |
| 7493 void set element(ConstructorElement element2) { | 7424 void set element(ConstructorElement element2) { |
| 7494 this._propagatedElement = element2; | 7425 this._propagatedElement = element2; |
| 7495 } | 7426 } |
| 7496 | 7427 |
| 7497 /** | 7428 /** |
| 7498 * Set the keyword used to indicate how an object should be created to the giv
en keyword. | 7429 * Set the keyword used to indicate how an object should be created to the giv
en keyword. |
| 7499 * @param keyword the keyword used to indicate how an object should be created | 7430 * @param keyword the keyword used to indicate how an object should be created |
| 7500 */ | 7431 */ |
| 7501 void set keyword(Token keyword2) { | 7432 void set keyword(Token keyword2) { |
| 7502 this._keyword = keyword2; | 7433 this._keyword = keyword2; |
| 7503 } | 7434 } |
| 7504 | 7435 |
| 7505 /** | 7436 /** |
| 7506 * Set the element associated with the constructor based on static type inform
ation to the given | 7437 * Set the element associated with the constructor based on static type inform
ation to the given |
| 7507 * element. | 7438 * element. |
| 7508 * @param element the element to be associated with the constructor | 7439 * @param element the element to be associated with the constructor |
| 7509 */ | 7440 */ |
| 7510 void set staticElement(ConstructorElement element) { | 7441 void set staticElement(ConstructorElement element) { |
| 7511 this._staticElement = element; | 7442 this._staticElement = element; |
| 7512 } | 7443 } |
| 7513 void visitChildren(ASTVisitor<Object> visitor) { | 7444 void visitChildren(ASTVisitor<Object> visitor) { |
| 7514 safelyVisitChild(_constructorName, visitor); | 7445 safelyVisitChild(_constructorName, visitor); |
| 7515 safelyVisitChild(_argumentList, visitor); | 7446 safelyVisitChild(_argumentList, visitor); |
| 7516 } | 7447 } |
| 7517 } | 7448 } |
| 7518 | |
| 7519 /** | 7449 /** |
| 7520 * Instances of the class {@code IntegerLiteral} represent an integer literal ex
pression. | 7450 * Instances of the class {@code IntegerLiteral} represent an integer literal ex
pression. |
| 7521 * <pre> | 7451 * <pre> |
| 7522 * integerLiteral ::= | 7452 * integerLiteral ::= |
| 7523 * decimalIntegerLiteral | 7453 * decimalIntegerLiteral |
| 7524 * | hexidecimalIntegerLiteral | 7454 * | hexidecimalIntegerLiteral |
| 7525 * decimalIntegerLiteral ::= | 7455 * decimalIntegerLiteral ::= |
| 7526 * decimalDigit+ | 7456 * decimalDigit+ |
| 7527 * hexidecimalIntegerLiteral ::= | 7457 * hexidecimalIntegerLiteral ::= |
| 7528 * '0x' hexidecimalDigit+ | 7458 * '0x' hexidecimalDigit+ |
| 7529 * | '0X' hexidecimalDigit+ | 7459 * | '0X' hexidecimalDigit+ |
| 7530 * </pre> | 7460 * </pre> |
| 7531 * @coverage dart.engine.ast | 7461 * @coverage dart.engine.ast |
| 7532 */ | 7462 */ |
| 7533 class IntegerLiteral extends Literal { | 7463 class IntegerLiteral extends Literal { |
| 7534 | 7464 |
| 7535 /** | 7465 /** |
| 7536 * The token representing the literal. | 7466 * The token representing the literal. |
| 7537 */ | 7467 */ |
| 7538 Token _literal; | 7468 Token _literal; |
| 7539 | 7469 |
| 7540 /** | 7470 /** |
| 7541 * The value of the literal. | 7471 * The value of the literal. |
| 7542 */ | 7472 */ |
| 7543 int _value = 0; | 7473 int _value = 0; |
| 7544 | 7474 |
| 7545 /** | 7475 /** |
| 7546 * Initialize a newly created integer literal. | 7476 * Initialize a newly created integer literal. |
| 7547 * @param literal the token representing the literal | 7477 * @param literal the token representing the literal |
| 7548 * @param value the value of the literal | 7478 * @param value the value of the literal |
| 7549 */ | 7479 */ |
| 7550 IntegerLiteral.full(Token literal, int value) { | 7480 IntegerLiteral.full(Token literal, int value) { |
| 7551 this._literal = literal; | 7481 this._literal = literal; |
| 7552 this._value = value; | 7482 this._value = value; |
| 7553 } | 7483 } |
| 7554 | 7484 |
| 7555 /** | 7485 /** |
| 7556 * Initialize a newly created integer literal. | 7486 * Initialize a newly created integer literal. |
| 7557 * @param literal the token representing the literal | 7487 * @param literal the token representing the literal |
| 7558 * @param value the value of the literal | 7488 * @param value the value of the literal |
| 7559 */ | 7489 */ |
| 7560 IntegerLiteral({Token literal, int value}) : this.full(literal, value); | 7490 IntegerLiteral({Token literal, int value}) : this.full(literal, value); |
| 7561 accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this); | 7491 accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this); |
| 7562 Token get beginToken => _literal; | 7492 Token get beginToken => _literal; |
| 7563 Token get endToken => _literal; | 7493 Token get endToken => _literal; |
| 7564 | 7494 |
| 7565 /** | 7495 /** |
| 7566 * Return the token representing the literal. | 7496 * Return the token representing the literal. |
| 7567 * @return the token representing the literal | 7497 * @return the token representing the literal |
| 7568 */ | 7498 */ |
| 7569 Token get literal => _literal; | 7499 Token get literal => _literal; |
| 7570 | 7500 |
| 7571 /** | 7501 /** |
| 7572 * Return the value of the literal. | 7502 * Return the value of the literal. |
| 7573 * @return the value of the literal | 7503 * @return the value of the literal |
| 7574 */ | 7504 */ |
| 7575 int get value => _value; | 7505 int get value => _value; |
| 7576 | 7506 |
| 7577 /** | 7507 /** |
| 7578 * Set the token representing the literal to the given token. | 7508 * Set the token representing the literal to the given token. |
| 7579 * @param literal the token representing the literal | 7509 * @param literal the token representing the literal |
| 7580 */ | 7510 */ |
| 7581 void set literal(Token literal2) { | 7511 void set literal(Token literal2) { |
| 7582 this._literal = literal2; | 7512 this._literal = literal2; |
| 7583 } | 7513 } |
| 7584 | 7514 |
| 7585 /** | 7515 /** |
| 7586 * Set the value of the literal to the given value. | 7516 * Set the value of the literal to the given value. |
| 7587 * @param value the value of the literal | 7517 * @param value the value of the literal |
| 7588 */ | 7518 */ |
| 7589 void set value(int value2) { | 7519 void set value(int value2) { |
| 7590 this._value = value2; | 7520 this._value = value2; |
| 7591 } | 7521 } |
| 7592 void visitChildren(ASTVisitor<Object> visitor) { | 7522 void visitChildren(ASTVisitor<Object> visitor) { |
| 7593 } | 7523 } |
| 7594 } | 7524 } |
| 7595 | |
| 7596 /** | 7525 /** |
| 7597 * The abstract class {@code InterpolationElement} defines the behavior common t
o elements within a{@link StringInterpolation string interpolation}. | 7526 * The abstract class {@code InterpolationElement} defines the behavior common t
o elements within a{@link StringInterpolation string interpolation}. |
| 7598 * <pre> | 7527 * <pre> |
| 7599 * interpolationElement ::={@link InterpolationExpression interpolationExpressio
n}| {@link InterpolationString interpolationString}</pre> | 7528 * interpolationElement ::={@link InterpolationExpression interpolationExpressio
n}| {@link InterpolationString interpolationString}</pre> |
| 7600 * @coverage dart.engine.ast | 7529 * @coverage dart.engine.ast |
| 7601 */ | 7530 */ |
| 7602 abstract class InterpolationElement extends ASTNode { | 7531 abstract class InterpolationElement extends ASTNode { |
| 7603 } | 7532 } |
| 7604 | |
| 7605 /** | 7533 /** |
| 7606 * Instances of the class {@code InterpolationExpression} represent an expressio
n embedded in a | 7534 * Instances of the class {@code InterpolationExpression} represent an expressio
n embedded in a |
| 7607 * string interpolation. | 7535 * string interpolation. |
| 7608 * <pre> | 7536 * <pre> |
| 7609 * interpolationExpression ::= | 7537 * interpolationExpression ::= |
| 7610 * '$' {@link SimpleIdentifier identifier}| '$' '{' {@link Expression expression
} '}' | 7538 * '$' {@link SimpleIdentifier identifier}| '$' '{' {@link Expression expression
} '}' |
| 7611 * </pre> | 7539 * </pre> |
| 7612 * @coverage dart.engine.ast | 7540 * @coverage dart.engine.ast |
| 7613 */ | 7541 */ |
| 7614 class InterpolationExpression extends InterpolationElement { | 7542 class InterpolationExpression extends InterpolationElement { |
| 7615 | 7543 |
| 7616 /** | 7544 /** |
| 7617 * The token used to introduce the interpolation expression; either '$' if the
expression is a | 7545 * The token used to introduce the interpolation expression; either '$' if the
expression is a |
| 7618 * simple identifier or '${' if the expression is a full expression. | 7546 * simple identifier or '${' if the expression is a full expression. |
| 7619 */ | 7547 */ |
| 7620 Token _leftBracket; | 7548 Token _leftBracket; |
| 7621 | 7549 |
| 7622 /** | 7550 /** |
| 7623 * The expression to be evaluated for the value to be converted into a string. | 7551 * The expression to be evaluated for the value to be converted into a string. |
| 7624 */ | 7552 */ |
| 7625 Expression _expression; | 7553 Expression _expression; |
| 7626 | 7554 |
| 7627 /** | 7555 /** |
| 7628 * The right curly bracket, or {@code null} if the expression is an identifier
without brackets. | 7556 * The right curly bracket, or {@code null} if the expression is an identifier
without brackets. |
| 7629 */ | 7557 */ |
| 7630 Token _rightBracket; | 7558 Token _rightBracket; |
| 7631 | 7559 |
| 7632 /** | 7560 /** |
| 7633 * Initialize a newly created interpolation expression. | 7561 * Initialize a newly created interpolation expression. |
| 7634 * @param leftBracket the left curly bracket | 7562 * @param leftBracket the left curly bracket |
| 7635 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 7563 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
| 7636 * @param rightBracket the right curly bracket | 7564 * @param rightBracket the right curly bracket |
| 7637 */ | 7565 */ |
| 7638 InterpolationExpression.full(Token leftBracket, Expression expression, Token r
ightBracket) { | 7566 InterpolationExpression.full(Token leftBracket, Expression expression, Token r
ightBracket) { |
| 7639 this._leftBracket = leftBracket; | 7567 this._leftBracket = leftBracket; |
| 7640 this._expression = becomeParentOf(expression); | 7568 this._expression = becomeParentOf(expression); |
| 7641 this._rightBracket = rightBracket; | 7569 this._rightBracket = rightBracket; |
| 7642 } | 7570 } |
| 7643 | 7571 |
| 7644 /** | 7572 /** |
| 7645 * Initialize a newly created interpolation expression. | 7573 * Initialize a newly created interpolation expression. |
| 7646 * @param leftBracket the left curly bracket | 7574 * @param leftBracket the left curly bracket |
| 7647 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 7575 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
| 7648 * @param rightBracket the right curly bracket | 7576 * @param rightBracket the right curly bracket |
| 7649 */ | 7577 */ |
| 7650 InterpolationExpression({Token leftBracket, Expression expression, Token right
Bracket}) : this.full(leftBracket, expression, rightBracket); | 7578 InterpolationExpression({Token leftBracket, Expression expression, Token right
Bracket}) : this.full(leftBracket, expression, rightBracket); |
| 7651 accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this); | 7579 accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this); |
| 7652 Token get beginToken => _leftBracket; | 7580 Token get beginToken => _leftBracket; |
| 7653 Token get endToken { | 7581 Token get endToken { |
| 7654 if (_rightBracket != null) { | 7582 if (_rightBracket != null) { |
| 7655 return _rightBracket; | 7583 return _rightBracket; |
| 7656 } | 7584 } |
| 7657 return _expression.endToken; | 7585 return _expression.endToken; |
| 7658 } | 7586 } |
| 7659 | 7587 |
| 7660 /** | 7588 /** |
| 7661 * Return the expression to be evaluated for the value to be converted into a
string. | 7589 * Return the expression to be evaluated for the value to be converted into a
string. |
| 7662 * @return the expression to be evaluated for the value to be converted into a
string | 7590 * @return the expression to be evaluated for the value to be converted into a
string |
| 7663 */ | 7591 */ |
| 7664 Expression get expression => _expression; | 7592 Expression get expression => _expression; |
| 7665 | 7593 |
| 7666 /** | 7594 /** |
| 7667 * Return the left curly bracket. | 7595 * Return the left curly bracket. |
| 7668 * @return the left curly bracket | 7596 * @return the left curly bracket |
| 7669 */ | 7597 */ |
| 7670 Token get leftBracket => _leftBracket; | 7598 Token get leftBracket => _leftBracket; |
| 7671 | 7599 |
| 7672 /** | 7600 /** |
| 7673 * Return the right curly bracket. | 7601 * Return the right curly bracket. |
| 7674 * @return the right curly bracket | 7602 * @return the right curly bracket |
| 7675 */ | 7603 */ |
| 7676 Token get rightBracket => _rightBracket; | 7604 Token get rightBracket => _rightBracket; |
| 7677 | 7605 |
| 7678 /** | 7606 /** |
| 7679 * Set the expression to be evaluated for the value to be converted into a str
ing to the given | 7607 * Set the expression to be evaluated for the value to be converted into a str
ing to the given |
| 7680 * expression. | 7608 * expression. |
| 7681 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 7609 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
| 7682 */ | 7610 */ |
| 7683 void set expression(Expression expression2) { | 7611 void set expression(Expression expression2) { |
| 7684 this._expression = becomeParentOf(expression2); | 7612 this._expression = becomeParentOf(expression2); |
| 7685 } | 7613 } |
| 7686 | 7614 |
| 7687 /** | 7615 /** |
| 7688 * Set the left curly bracket to the given token. | 7616 * Set the left curly bracket to the given token. |
| 7689 * @param leftBracket the left curly bracket | 7617 * @param leftBracket the left curly bracket |
| 7690 */ | 7618 */ |
| 7691 void set leftBracket(Token leftBracket2) { | 7619 void set leftBracket(Token leftBracket2) { |
| 7692 this._leftBracket = leftBracket2; | 7620 this._leftBracket = leftBracket2; |
| 7693 } | 7621 } |
| 7694 | 7622 |
| 7695 /** | 7623 /** |
| 7696 * Set the right curly bracket to the given token. | 7624 * Set the right curly bracket to the given token. |
| 7697 * @param rightBracket the right curly bracket | 7625 * @param rightBracket the right curly bracket |
| 7698 */ | 7626 */ |
| 7699 void set rightBracket(Token rightBracket2) { | 7627 void set rightBracket(Token rightBracket2) { |
| 7700 this._rightBracket = rightBracket2; | 7628 this._rightBracket = rightBracket2; |
| 7701 } | 7629 } |
| 7702 void visitChildren(ASTVisitor<Object> visitor) { | 7630 void visitChildren(ASTVisitor<Object> visitor) { |
| 7703 safelyVisitChild(_expression, visitor); | 7631 safelyVisitChild(_expression, visitor); |
| 7704 } | 7632 } |
| 7705 } | 7633 } |
| 7706 | |
| 7707 /** | 7634 /** |
| 7708 * Instances of the class {@code InterpolationString} represent a non-empty subs
tring of an | 7635 * Instances of the class {@code InterpolationString} represent a non-empty subs
tring of an |
| 7709 * interpolated string. | 7636 * interpolated string. |
| 7710 * <pre> | 7637 * <pre> |
| 7711 * interpolationString ::= | 7638 * interpolationString ::= |
| 7712 * characters | 7639 * characters |
| 7713 * </pre> | 7640 * </pre> |
| 7714 * @coverage dart.engine.ast | 7641 * @coverage dart.engine.ast |
| 7715 */ | 7642 */ |
| 7716 class InterpolationString extends InterpolationElement { | 7643 class InterpolationString extends InterpolationElement { |
| 7717 | 7644 |
| 7718 /** | 7645 /** |
| 7719 * The characters that will be added to the string. | 7646 * The characters that will be added to the string. |
| 7720 */ | 7647 */ |
| 7721 Token _contents; | 7648 Token _contents; |
| 7722 | 7649 |
| 7723 /** | 7650 /** |
| 7724 * The value of the literal. | 7651 * The value of the literal. |
| 7725 */ | 7652 */ |
| 7726 String _value; | 7653 String _value; |
| 7727 | 7654 |
| 7728 /** | 7655 /** |
| 7729 * Initialize a newly created string of characters that are part of a string i
nterpolation. | 7656 * Initialize a newly created string of characters that are part of a string i
nterpolation. |
| 7730 * @param the characters that will be added to the string | 7657 * @param the characters that will be added to the string |
| 7731 * @param value the value of the literal | 7658 * @param value the value of the literal |
| 7732 */ | 7659 */ |
| 7733 InterpolationString.full(Token contents, String value) { | 7660 InterpolationString.full(Token contents, String value) { |
| 7734 this._contents = contents; | 7661 this._contents = contents; |
| 7735 this._value = value; | 7662 this._value = value; |
| 7736 } | 7663 } |
| 7737 | 7664 |
| 7738 /** | 7665 /** |
| 7739 * Initialize a newly created string of characters that are part of a string i
nterpolation. | 7666 * Initialize a newly created string of characters that are part of a string i
nterpolation. |
| 7740 * @param the characters that will be added to the string | 7667 * @param the characters that will be added to the string |
| 7741 * @param value the value of the literal | 7668 * @param value the value of the literal |
| 7742 */ | 7669 */ |
| 7743 InterpolationString({Token contents, String value}) : this.full(contents, valu
e); | 7670 InterpolationString({Token contents, String value}) : this.full(contents, valu
e); |
| 7744 accept(ASTVisitor visitor) => visitor.visitInterpolationString(this); | 7671 accept(ASTVisitor visitor) => visitor.visitInterpolationString(this); |
| 7745 Token get beginToken => _contents; | 7672 Token get beginToken => _contents; |
| 7746 | 7673 |
| 7747 /** | 7674 /** |
| 7748 * Return the characters that will be added to the string. | 7675 * Return the characters that will be added to the string. |
| 7749 * @return the characters that will be added to the string | 7676 * @return the characters that will be added to the string |
| 7750 */ | 7677 */ |
| 7751 Token get contents => _contents; | 7678 Token get contents => _contents; |
| 7752 Token get endToken => _contents; | 7679 Token get endToken => _contents; |
| 7753 | 7680 |
| 7754 /** | 7681 /** |
| 7755 * Return the value of the literal. | 7682 * Return the value of the literal. |
| 7756 * @return the value of the literal | 7683 * @return the value of the literal |
| 7757 */ | 7684 */ |
| 7758 String get value => _value; | 7685 String get value => _value; |
| 7759 | 7686 |
| 7760 /** | 7687 /** |
| 7761 * Set the characters that will be added to the string to those in the given s
tring. | 7688 * Set the characters that will be added to the string to those in the given s
tring. |
| 7762 * @param string the characters that will be added to the string | 7689 * @param string the characters that will be added to the string |
| 7763 */ | 7690 */ |
| 7764 void set contents(Token string) { | 7691 void set contents(Token string) { |
| 7765 _contents = string; | 7692 _contents = string; |
| 7766 } | 7693 } |
| 7767 | 7694 |
| 7768 /** | 7695 /** |
| 7769 * Set the value of the literal to the given string. | 7696 * Set the value of the literal to the given string. |
| 7770 * @param string the value of the literal | 7697 * @param string the value of the literal |
| 7771 */ | 7698 */ |
| 7772 void set value(String string) { | 7699 void set value(String string) { |
| 7773 _value = string; | 7700 _value = string; |
| 7774 } | 7701 } |
| 7775 void visitChildren(ASTVisitor<Object> visitor) { | 7702 void visitChildren(ASTVisitor<Object> visitor) { |
| 7776 } | 7703 } |
| 7777 } | 7704 } |
| 7778 | |
| 7779 /** | 7705 /** |
| 7780 * Instances of the class {@code IsExpression} represent an is expression. | 7706 * Instances of the class {@code IsExpression} represent an is expression. |
| 7781 * <pre> | 7707 * <pre> |
| 7782 * isExpression ::={@link Expression expression} 'is' '!'? {@link TypeName type}
</pre> | 7708 * isExpression ::={@link Expression expression} 'is' '!'? {@link TypeName type}
</pre> |
| 7783 * @coverage dart.engine.ast | 7709 * @coverage dart.engine.ast |
| 7784 */ | 7710 */ |
| 7785 class IsExpression extends Expression { | 7711 class IsExpression extends Expression { |
| 7786 | 7712 |
| 7787 /** | 7713 /** |
| 7788 * The expression used to compute the value whose type is being tested. | 7714 * The expression used to compute the value whose type is being tested. |
| 7789 */ | 7715 */ |
| 7790 Expression _expression; | 7716 Expression _expression; |
| 7791 | 7717 |
| 7792 /** | 7718 /** |
| 7793 * The is operator. | 7719 * The is operator. |
| 7794 */ | 7720 */ |
| 7795 Token _isOperator; | 7721 Token _isOperator; |
| 7796 | 7722 |
| 7797 /** | 7723 /** |
| 7798 * The not operator, or {@code null} if the sense of the test is not negated. | 7724 * The not operator, or {@code null} if the sense of the test is not negated. |
| 7799 */ | 7725 */ |
| 7800 Token _notOperator; | 7726 Token _notOperator; |
| 7801 | 7727 |
| 7802 /** | 7728 /** |
| 7803 * The name of the type being tested for. | 7729 * The name of the type being tested for. |
| 7804 */ | 7730 */ |
| 7805 TypeName _type; | 7731 TypeName _type; |
| 7806 | 7732 |
| 7807 /** | 7733 /** |
| 7808 * Initialize a newly created is expression. | 7734 * Initialize a newly created is expression. |
| 7809 * @param expression the expression used to compute the value whose type is be
ing tested | 7735 * @param expression the expression used to compute the value whose type is be
ing tested |
| 7810 * @param isOperator the is operator | 7736 * @param isOperator the is operator |
| 7811 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated | 7737 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated |
| 7812 * @param type the name of the type being tested for | 7738 * @param type the name of the type being tested for |
| 7813 */ | 7739 */ |
| 7814 IsExpression.full(Expression expression, Token isOperator, Token notOperator,
TypeName type) { | 7740 IsExpression.full(Expression expression, Token isOperator, Token notOperator,
TypeName type) { |
| 7815 this._expression = becomeParentOf(expression); | 7741 this._expression = becomeParentOf(expression); |
| 7816 this._isOperator = isOperator; | 7742 this._isOperator = isOperator; |
| 7817 this._notOperator = notOperator; | 7743 this._notOperator = notOperator; |
| 7818 this._type = becomeParentOf(type); | 7744 this._type = becomeParentOf(type); |
| 7819 } | 7745 } |
| 7820 | 7746 |
| 7821 /** | 7747 /** |
| 7822 * Initialize a newly created is expression. | 7748 * Initialize a newly created is expression. |
| 7823 * @param expression the expression used to compute the value whose type is be
ing tested | 7749 * @param expression the expression used to compute the value whose type is be
ing tested |
| 7824 * @param isOperator the is operator | 7750 * @param isOperator the is operator |
| 7825 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated | 7751 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated |
| 7826 * @param type the name of the type being tested for | 7752 * @param type the name of the type being tested for |
| 7827 */ | 7753 */ |
| 7828 IsExpression({Expression expression, Token isOperator, Token notOperator, Type
Name type}) : this.full(expression, isOperator, notOperator, type); | 7754 IsExpression({Expression expression, Token isOperator, Token notOperator, Type
Name type}) : this.full(expression, isOperator, notOperator, type); |
| 7829 accept(ASTVisitor visitor) => visitor.visitIsExpression(this); | 7755 accept(ASTVisitor visitor) => visitor.visitIsExpression(this); |
| 7830 Token get beginToken => _expression.beginToken; | 7756 Token get beginToken => _expression.beginToken; |
| 7831 Token get endToken => _type.endToken; | 7757 Token get endToken => _type.endToken; |
| 7832 | 7758 |
| 7833 /** | 7759 /** |
| 7834 * Return the expression used to compute the value whose type is being tested. | 7760 * Return the expression used to compute the value whose type is being tested. |
| 7835 * @return the expression used to compute the value whose type is being tested | 7761 * @return the expression used to compute the value whose type is being tested |
| 7836 */ | 7762 */ |
| 7837 Expression get expression => _expression; | 7763 Expression get expression => _expression; |
| 7838 | 7764 |
| 7839 /** | 7765 /** |
| 7840 * Return the is operator being applied. | 7766 * Return the is operator being applied. |
| 7841 * @return the is operator being applied | 7767 * @return the is operator being applied |
| 7842 */ | 7768 */ |
| 7843 Token get isOperator => _isOperator; | 7769 Token get isOperator => _isOperator; |
| 7844 | 7770 |
| 7845 /** | 7771 /** |
| 7846 * Return the not operator being applied. | 7772 * Return the not operator being applied. |
| 7847 * @return the not operator being applied | 7773 * @return the not operator being applied |
| 7848 */ | 7774 */ |
| 7849 Token get notOperator => _notOperator; | 7775 Token get notOperator => _notOperator; |
| 7850 | 7776 |
| 7851 /** | 7777 /** |
| 7852 * Return the name of the type being tested for. | 7778 * Return the name of the type being tested for. |
| 7853 * @return the name of the type being tested for | 7779 * @return the name of the type being tested for |
| 7854 */ | 7780 */ |
| 7855 TypeName get type => _type; | 7781 TypeName get type => _type; |
| 7856 | 7782 |
| 7857 /** | 7783 /** |
| 7858 * Set the expression used to compute the value whose type is being tested to
the given | 7784 * Set the expression used to compute the value whose type is being tested to
the given |
| 7859 * expression. | 7785 * expression. |
| 7860 * @param expression the expression used to compute the value whose type is be
ing tested | 7786 * @param expression the expression used to compute the value whose type is be
ing tested |
| 7861 */ | 7787 */ |
| 7862 void set expression(Expression expression2) { | 7788 void set expression(Expression expression2) { |
| 7863 this._expression = becomeParentOf(expression2); | 7789 this._expression = becomeParentOf(expression2); |
| 7864 } | 7790 } |
| 7865 | 7791 |
| 7866 /** | 7792 /** |
| 7867 * Set the is operator being applied to the given operator. | 7793 * Set the is operator being applied to the given operator. |
| 7868 * @param isOperator the is operator being applied | 7794 * @param isOperator the is operator being applied |
| 7869 */ | 7795 */ |
| 7870 void set isOperator(Token isOperator2) { | 7796 void set isOperator(Token isOperator2) { |
| 7871 this._isOperator = isOperator2; | 7797 this._isOperator = isOperator2; |
| 7872 } | 7798 } |
| 7873 | 7799 |
| 7874 /** | 7800 /** |
| 7875 * Set the not operator being applied to the given operator. | 7801 * Set the not operator being applied to the given operator. |
| 7876 * @param notOperator the is operator being applied | 7802 * @param notOperator the is operator being applied |
| 7877 */ | 7803 */ |
| 7878 void set notOperator(Token notOperator2) { | 7804 void set notOperator(Token notOperator2) { |
| 7879 this._notOperator = notOperator2; | 7805 this._notOperator = notOperator2; |
| 7880 } | 7806 } |
| 7881 | 7807 |
| 7882 /** | 7808 /** |
| 7883 * Set the name of the type being tested for to the given name. | 7809 * Set the name of the type being tested for to the given name. |
| 7884 * @param name the name of the type being tested for | 7810 * @param name the name of the type being tested for |
| 7885 */ | 7811 */ |
| 7886 void set type(TypeName name) { | 7812 void set type(TypeName name) { |
| 7887 this._type = becomeParentOf(name); | 7813 this._type = becomeParentOf(name); |
| 7888 } | 7814 } |
| 7889 void visitChildren(ASTVisitor<Object> visitor) { | 7815 void visitChildren(ASTVisitor<Object> visitor) { |
| 7890 safelyVisitChild(_expression, visitor); | 7816 safelyVisitChild(_expression, visitor); |
| 7891 safelyVisitChild(_type, visitor); | 7817 safelyVisitChild(_type, visitor); |
| 7892 } | 7818 } |
| 7893 } | 7819 } |
| 7894 | |
| 7895 /** | 7820 /** |
| 7896 * Instances of the class {@code Label} represent a label. | 7821 * Instances of the class {@code Label} represent a label. |
| 7897 * <pre> | 7822 * <pre> |
| 7898 * label ::={@link SimpleIdentifier label} ':' | 7823 * label ::={@link SimpleIdentifier label} ':' |
| 7899 * </pre> | 7824 * </pre> |
| 7900 * @coverage dart.engine.ast | 7825 * @coverage dart.engine.ast |
| 7901 */ | 7826 */ |
| 7902 class Label extends ASTNode { | 7827 class Label extends ASTNode { |
| 7903 | 7828 |
| 7904 /** | 7829 /** |
| 7905 * The label being associated with the statement. | 7830 * The label being associated with the statement. |
| 7906 */ | 7831 */ |
| 7907 SimpleIdentifier _label; | 7832 SimpleIdentifier _label; |
| 7908 | 7833 |
| 7909 /** | 7834 /** |
| 7910 * The colon that separates the label from the statement. | 7835 * The colon that separates the label from the statement. |
| 7911 */ | 7836 */ |
| 7912 Token _colon; | 7837 Token _colon; |
| 7913 | 7838 |
| 7914 /** | 7839 /** |
| 7915 * Initialize a newly created label. | 7840 * Initialize a newly created label. |
| 7916 * @param label the label being applied | 7841 * @param label the label being applied |
| 7917 * @param colon the colon that separates the label from whatever follows | 7842 * @param colon the colon that separates the label from whatever follows |
| 7918 */ | 7843 */ |
| 7919 Label.full(SimpleIdentifier label, Token colon) { | 7844 Label.full(SimpleIdentifier label, Token colon) { |
| 7920 this._label = becomeParentOf(label); | 7845 this._label = becomeParentOf(label); |
| 7921 this._colon = colon; | 7846 this._colon = colon; |
| 7922 } | 7847 } |
| 7923 | 7848 |
| 7924 /** | 7849 /** |
| 7925 * Initialize a newly created label. | 7850 * Initialize a newly created label. |
| 7926 * @param label the label being applied | 7851 * @param label the label being applied |
| 7927 * @param colon the colon that separates the label from whatever follows | 7852 * @param colon the colon that separates the label from whatever follows |
| 7928 */ | 7853 */ |
| 7929 Label({SimpleIdentifier label, Token colon}) : this.full(label, colon); | 7854 Label({SimpleIdentifier label, Token colon}) : this.full(label, colon); |
| 7930 accept(ASTVisitor visitor) => visitor.visitLabel(this); | 7855 accept(ASTVisitor visitor) => visitor.visitLabel(this); |
| 7931 Token get beginToken => _label.beginToken; | 7856 Token get beginToken => _label.beginToken; |
| 7932 | 7857 |
| 7933 /** | 7858 /** |
| 7934 * Return the colon that separates the label from the statement. | 7859 * Return the colon that separates the label from the statement. |
| 7935 * @return the colon that separates the label from the statement | 7860 * @return the colon that separates the label from the statement |
| 7936 */ | 7861 */ |
| 7937 Token get colon => _colon; | 7862 Token get colon => _colon; |
| 7938 Token get endToken => _colon; | 7863 Token get endToken => _colon; |
| 7939 | 7864 |
| 7940 /** | 7865 /** |
| 7941 * Return the label being associated with the statement. | 7866 * Return the label being associated with the statement. |
| 7942 * @return the label being associated with the statement | 7867 * @return the label being associated with the statement |
| 7943 */ | 7868 */ |
| 7944 SimpleIdentifier get label => _label; | 7869 SimpleIdentifier get label => _label; |
| 7945 | 7870 |
| 7946 /** | 7871 /** |
| 7947 * Set the colon that separates the label from the statement to the given toke
n. | 7872 * Set the colon that separates the label from the statement to the given toke
n. |
| 7948 * @param colon the colon that separates the label from the statement | 7873 * @param colon the colon that separates the label from the statement |
| 7949 */ | 7874 */ |
| 7950 void set colon(Token colon2) { | 7875 void set colon(Token colon2) { |
| 7951 this._colon = colon2; | 7876 this._colon = colon2; |
| 7952 } | 7877 } |
| 7953 | 7878 |
| 7954 /** | 7879 /** |
| 7955 * Set the label being associated with the statement to the given label. | 7880 * Set the label being associated with the statement to the given label. |
| 7956 * @param label the label being associated with the statement | 7881 * @param label the label being associated with the statement |
| 7957 */ | 7882 */ |
| 7958 void set label(SimpleIdentifier label2) { | 7883 void set label(SimpleIdentifier label2) { |
| 7959 this._label = becomeParentOf(label2); | 7884 this._label = becomeParentOf(label2); |
| 7960 } | 7885 } |
| 7961 void visitChildren(ASTVisitor<Object> visitor) { | 7886 void visitChildren(ASTVisitor<Object> visitor) { |
| 7962 safelyVisitChild(_label, visitor); | 7887 safelyVisitChild(_label, visitor); |
| 7963 } | 7888 } |
| 7964 } | 7889 } |
| 7965 | |
| 7966 /** | 7890 /** |
| 7967 * Instances of the class {@code LabeledStatement} represent a statement that ha
s a label associated | 7891 * Instances of the class {@code LabeledStatement} represent a statement that ha
s a label associated |
| 7968 * with them. | 7892 * with them. |
| 7969 * <pre> | 7893 * <pre> |
| 7970 * labeledStatement ::={@link Label label}+ {@link Statement statement}</pre> | 7894 * labeledStatement ::={@link Label label}+ {@link Statement statement}</pre> |
| 7971 * @coverage dart.engine.ast | 7895 * @coverage dart.engine.ast |
| 7972 */ | 7896 */ |
| 7973 class LabeledStatement extends Statement { | 7897 class LabeledStatement extends Statement { |
| 7974 | 7898 |
| 7975 /** | 7899 /** |
| 7976 * The labels being associated with the statement. | 7900 * The labels being associated with the statement. |
| 7977 */ | 7901 */ |
| 7978 NodeList<Label> _labels; | 7902 NodeList<Label> _labels; |
| 7979 | 7903 |
| 7980 /** | 7904 /** |
| 7981 * The statement with which the labels are being associated. | 7905 * The statement with which the labels are being associated. |
| 7982 */ | 7906 */ |
| 7983 Statement _statement; | 7907 Statement _statement; |
| 7984 | 7908 |
| 7985 /** | 7909 /** |
| 7986 * Initialize a newly created labeled statement. | 7910 * Initialize a newly created labeled statement. |
| 7987 * @param labels the labels being associated with the statement | 7911 * @param labels the labels being associated with the statement |
| 7988 * @param statement the statement with which the labels are being associated | 7912 * @param statement the statement with which the labels are being associated |
| 7989 */ | 7913 */ |
| 7990 LabeledStatement.full(List<Label> labels, Statement statement) { | 7914 LabeledStatement.full(List<Label> labels, Statement statement) { |
| 7991 this._labels = new NodeList<Label>(this); | 7915 this._labels = new NodeList<Label>(this); |
| 7992 this._labels.addAll(labels); | 7916 this._labels.addAll(labels); |
| 7993 this._statement = becomeParentOf(statement); | 7917 this._statement = becomeParentOf(statement); |
| 7994 } | 7918 } |
| 7995 | 7919 |
| 7996 /** | 7920 /** |
| 7997 * Initialize a newly created labeled statement. | 7921 * Initialize a newly created labeled statement. |
| 7998 * @param labels the labels being associated with the statement | 7922 * @param labels the labels being associated with the statement |
| 7999 * @param statement the statement with which the labels are being associated | 7923 * @param statement the statement with which the labels are being associated |
| 8000 */ | 7924 */ |
| 8001 LabeledStatement({List<Label> labels, Statement statement}) : this.full(labels
, statement); | 7925 LabeledStatement({List<Label> labels, Statement statement}) : this.full(labels
, statement); |
| 8002 accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this); | 7926 accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this); |
| 8003 Token get beginToken { | 7927 Token get beginToken { |
| 8004 if (!_labels.isEmpty) { | 7928 if (!_labels.isEmpty) { |
| 8005 return _labels.beginToken; | 7929 return _labels.beginToken; |
| 8006 } | 7930 } |
| 8007 return _statement.beginToken; | 7931 return _statement.beginToken; |
| 8008 } | 7932 } |
| 8009 Token get endToken => _statement.endToken; | 7933 Token get endToken => _statement.endToken; |
| 8010 | 7934 |
| 8011 /** | 7935 /** |
| 8012 * Return the labels being associated with the statement. | 7936 * Return the labels being associated with the statement. |
| 8013 * @return the labels being associated with the statement | 7937 * @return the labels being associated with the statement |
| 8014 */ | 7938 */ |
| 8015 NodeList<Label> get labels => _labels; | 7939 NodeList<Label> get labels => _labels; |
| 8016 | 7940 |
| 8017 /** | 7941 /** |
| 8018 * Return the statement with which the labels are being associated. | 7942 * Return the statement with which the labels are being associated. |
| 8019 * @return the statement with which the labels are being associated | 7943 * @return the statement with which the labels are being associated |
| 8020 */ | 7944 */ |
| 8021 Statement get statement => _statement; | 7945 Statement get statement => _statement; |
| 8022 | 7946 |
| 8023 /** | 7947 /** |
| 8024 * Set the statement with which the labels are being associated to the given s
tatement. | 7948 * Set the statement with which the labels are being associated to the given s
tatement. |
| 8025 * @param statement the statement with which the labels are being associated | 7949 * @param statement the statement with which the labels are being associated |
| 8026 */ | 7950 */ |
| 8027 void set statement(Statement statement2) { | 7951 void set statement(Statement statement2) { |
| 8028 this._statement = becomeParentOf(statement2); | 7952 this._statement = becomeParentOf(statement2); |
| 8029 } | 7953 } |
| 8030 void visitChildren(ASTVisitor<Object> visitor) { | 7954 void visitChildren(ASTVisitor<Object> visitor) { |
| 8031 _labels.accept(visitor); | 7955 _labels.accept(visitor); |
| 8032 safelyVisitChild(_statement, visitor); | 7956 safelyVisitChild(_statement, visitor); |
| 8033 } | 7957 } |
| 8034 } | 7958 } |
| 8035 | |
| 8036 /** | 7959 /** |
| 8037 * Instances of the class {@code LibraryDirective} represent a library directive
. | 7960 * Instances of the class {@code LibraryDirective} represent a library directive
. |
| 8038 * <pre> | 7961 * <pre> |
| 8039 * libraryDirective ::={@link Annotation metadata} 'library' {@link Identifier n
ame} ';' | 7962 * libraryDirective ::={@link Annotation metadata} 'library' {@link Identifier n
ame} ';' |
| 8040 * </pre> | 7963 * </pre> |
| 8041 * @coverage dart.engine.ast | 7964 * @coverage dart.engine.ast |
| 8042 */ | 7965 */ |
| 8043 class LibraryDirective extends Directive { | 7966 class LibraryDirective extends Directive { |
| 8044 | 7967 |
| 8045 /** | 7968 /** |
| 8046 * The token representing the 'library' token. | 7969 * The token representing the 'library' token. |
| 8047 */ | 7970 */ |
| 8048 Token _libraryToken; | 7971 Token _libraryToken; |
| 8049 | 7972 |
| 8050 /** | 7973 /** |
| 8051 * The name of the library being defined. | 7974 * The name of the library being defined. |
| 8052 */ | 7975 */ |
| 8053 LibraryIdentifier _name; | 7976 LibraryIdentifier _name; |
| 8054 | 7977 |
| 8055 /** | 7978 /** |
| 8056 * The semicolon terminating the directive. | 7979 * The semicolon terminating the directive. |
| 8057 */ | 7980 */ |
| 8058 Token _semicolon; | 7981 Token _semicolon; |
| 8059 | 7982 |
| 8060 /** | 7983 /** |
| 8061 * Initialize a newly created library directive. | 7984 * Initialize a newly created library directive. |
| 8062 * @param comment the documentation comment associated with this directive | 7985 * @param comment the documentation comment associated with this directive |
| 8063 * @param metadata the annotations associated with the directive | 7986 * @param metadata the annotations associated with the directive |
| 8064 * @param libraryToken the token representing the 'library' token | 7987 * @param libraryToken the token representing the 'library' token |
| 8065 * @param name the name of the library being defined | 7988 * @param name the name of the library being defined |
| 8066 * @param semicolon the semicolon terminating the directive | 7989 * @param semicolon the semicolon terminating the directive |
| 8067 */ | 7990 */ |
| 8068 LibraryDirective.full(Comment comment, List<Annotation> metadata, Token librar
yToken, LibraryIdentifier name, Token semicolon) : super.full(comment, metadata)
{ | 7991 LibraryDirective.full(Comment comment, List<Annotation> metadata, Token librar
yToken, LibraryIdentifier name, Token semicolon) : super.full(comment, metadata)
{ |
| 8069 this._libraryToken = libraryToken; | 7992 this._libraryToken = libraryToken; |
| 8070 this._name = becomeParentOf(name); | 7993 this._name = becomeParentOf(name); |
| 8071 this._semicolon = semicolon; | 7994 this._semicolon = semicolon; |
| 8072 } | 7995 } |
| 8073 | 7996 |
| 8074 /** | 7997 /** |
| 8075 * Initialize a newly created library directive. | 7998 * Initialize a newly created library directive. |
| 8076 * @param comment the documentation comment associated with this directive | 7999 * @param comment the documentation comment associated with this directive |
| 8077 * @param metadata the annotations associated with the directive | 8000 * @param metadata the annotations associated with the directive |
| 8078 * @param libraryToken the token representing the 'library' token | 8001 * @param libraryToken the token representing the 'library' token |
| 8079 * @param name the name of the library being defined | 8002 * @param name the name of the library being defined |
| 8080 * @param semicolon the semicolon terminating the directive | 8003 * @param semicolon the semicolon terminating the directive |
| 8081 */ | 8004 */ |
| 8082 LibraryDirective({Comment comment, List<Annotation> metadata, Token libraryTok
en, LibraryIdentifier name, Token semicolon}) : this.full(comment, metadata, lib
raryToken, name, semicolon); | 8005 LibraryDirective({Comment comment, List<Annotation> metadata, Token libraryTok
en, LibraryIdentifier name, Token semicolon}) : this.full(comment, metadata, lib
raryToken, name, semicolon); |
| 8083 accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this); | 8006 accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this); |
| 8084 Token get endToken => _semicolon; | 8007 Token get endToken => _semicolon; |
| 8085 Token get keyword => _libraryToken; | 8008 Token get keyword => _libraryToken; |
| 8086 | 8009 |
| 8087 /** | 8010 /** |
| 8088 * Return the token representing the 'library' token. | 8011 * Return the token representing the 'library' token. |
| 8089 * @return the token representing the 'library' token | 8012 * @return the token representing the 'library' token |
| 8090 */ | 8013 */ |
| 8091 Token get libraryToken => _libraryToken; | 8014 Token get libraryToken => _libraryToken; |
| 8092 | 8015 |
| 8093 /** | 8016 /** |
| 8094 * Return the name of the library being defined. | 8017 * Return the name of the library being defined. |
| 8095 * @return the name of the library being defined | 8018 * @return the name of the library being defined |
| 8096 */ | 8019 */ |
| 8097 LibraryIdentifier get name => _name; | 8020 LibraryIdentifier get name => _name; |
| 8098 | 8021 |
| 8099 /** | 8022 /** |
| 8100 * Return the semicolon terminating the directive. | 8023 * Return the semicolon terminating the directive. |
| 8101 * @return the semicolon terminating the directive | 8024 * @return the semicolon terminating the directive |
| 8102 */ | 8025 */ |
| 8103 Token get semicolon => _semicolon; | 8026 Token get semicolon => _semicolon; |
| 8104 | 8027 |
| 8105 /** | 8028 /** |
| 8106 * Set the token representing the 'library' token to the given token. | 8029 * Set the token representing the 'library' token to the given token. |
| 8107 * @param libraryToken the token representing the 'library' token | 8030 * @param libraryToken the token representing the 'library' token |
| 8108 */ | 8031 */ |
| 8109 void set libraryToken(Token libraryToken2) { | 8032 void set libraryToken(Token libraryToken2) { |
| 8110 this._libraryToken = libraryToken2; | 8033 this._libraryToken = libraryToken2; |
| 8111 } | 8034 } |
| 8112 | 8035 |
| 8113 /** | 8036 /** |
| 8114 * Set the name of the library being defined to the given name. | 8037 * Set the name of the library being defined to the given name. |
| 8115 * @param name the name of the library being defined | 8038 * @param name the name of the library being defined |
| 8116 */ | 8039 */ |
| 8117 void set name(LibraryIdentifier name2) { | 8040 void set name(LibraryIdentifier name2) { |
| 8118 this._name = becomeParentOf(name2); | 8041 this._name = becomeParentOf(name2); |
| 8119 } | 8042 } |
| 8120 | 8043 |
| 8121 /** | 8044 /** |
| 8122 * Set the semicolon terminating the directive to the given token. | 8045 * Set the semicolon terminating the directive to the given token. |
| 8123 * @param semicolon the semicolon terminating the directive | 8046 * @param semicolon the semicolon terminating the directive |
| 8124 */ | 8047 */ |
| 8125 void set semicolon(Token semicolon2) { | 8048 void set semicolon(Token semicolon2) { |
| 8126 this._semicolon = semicolon2; | 8049 this._semicolon = semicolon2; |
| 8127 } | 8050 } |
| 8128 void visitChildren(ASTVisitor<Object> visitor) { | 8051 void visitChildren(ASTVisitor<Object> visitor) { |
| 8129 super.visitChildren(visitor); | 8052 super.visitChildren(visitor); |
| 8130 safelyVisitChild(_name, visitor); | 8053 safelyVisitChild(_name, visitor); |
| 8131 } | 8054 } |
| 8132 Token get firstTokenAfterCommentAndMetadata => _libraryToken; | 8055 Token get firstTokenAfterCommentAndMetadata => _libraryToken; |
| 8133 } | 8056 } |
| 8134 | |
| 8135 /** | 8057 /** |
| 8136 * Instances of the class {@code LibraryIdentifier} represent the identifier for
a library. | 8058 * Instances of the class {@code LibraryIdentifier} represent the identifier for
a library. |
| 8137 * <pre> | 8059 * <pre> |
| 8138 * libraryIdentifier ::={@link SimpleIdentifier component} ('.' {@link SimpleIde
ntifier component}) | 8060 * libraryIdentifier ::={@link SimpleIdentifier component} ('.' {@link SimpleIde
ntifier component}) |
| 8139 * </pre> | 8061 * </pre> |
| 8140 * @coverage dart.engine.ast | 8062 * @coverage dart.engine.ast |
| 8141 */ | 8063 */ |
| 8142 class LibraryIdentifier extends Identifier { | 8064 class LibraryIdentifier extends Identifier { |
| 8143 | 8065 |
| 8144 /** | 8066 /** |
| 8145 * The components of the identifier. | 8067 * The components of the identifier. |
| 8146 */ | 8068 */ |
| 8147 NodeList<SimpleIdentifier> _components; | 8069 NodeList<SimpleIdentifier> _components; |
| 8148 | 8070 |
| 8149 /** | 8071 /** |
| 8150 * Initialize a newly created prefixed identifier. | 8072 * Initialize a newly created prefixed identifier. |
| 8151 * @param components the components of the identifier | 8073 * @param components the components of the identifier |
| 8152 */ | 8074 */ |
| 8153 LibraryIdentifier.full(List<SimpleIdentifier> components) { | 8075 LibraryIdentifier.full(List<SimpleIdentifier> components) { |
| 8154 this._components = new NodeList<SimpleIdentifier>(this); | 8076 this._components = new NodeList<SimpleIdentifier>(this); |
| 8155 this._components.addAll(components); | 8077 this._components.addAll(components); |
| 8156 } | 8078 } |
| 8157 | 8079 |
| 8158 /** | 8080 /** |
| 8159 * Initialize a newly created prefixed identifier. | 8081 * Initialize a newly created prefixed identifier. |
| 8160 * @param components the components of the identifier | 8082 * @param components the components of the identifier |
| 8161 */ | 8083 */ |
| 8162 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components)
; | 8084 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components)
; |
| 8163 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); | 8085 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); |
| 8164 Token get beginToken => _components.beginToken; | 8086 Token get beginToken => _components.beginToken; |
| 8165 | 8087 |
| 8166 /** | 8088 /** |
| 8167 * Return the components of the identifier. | 8089 * Return the components of the identifier. |
| 8168 * @return the components of the identifier | 8090 * @return the components of the identifier |
| 8169 */ | 8091 */ |
| 8170 NodeList<SimpleIdentifier> get components => _components; | 8092 NodeList<SimpleIdentifier> get components => _components; |
| 8171 Element get element => null; | 8093 Element get element => null; |
| 8172 Token get endToken => _components.endToken; | 8094 Token get endToken => _components.endToken; |
| 8173 String get name { | 8095 String get name { |
| 8174 JavaStringBuilder builder = new JavaStringBuilder(); | 8096 JavaStringBuilder builder = new JavaStringBuilder(); |
| 8175 bool needsPeriod = false; | 8097 bool needsPeriod = false; |
| 8176 for (SimpleIdentifier identifier in _components) { | 8098 for (SimpleIdentifier identifier in _components) { |
| 8177 if (needsPeriod) { | 8099 if (needsPeriod) { |
| 8178 builder.append("."); | 8100 builder.append("."); |
| 8179 } else { | 8101 } else { |
| 8180 needsPeriod = true; | 8102 needsPeriod = true; |
| 8181 } | 8103 } |
| 8182 builder.append(identifier.name); | 8104 builder.append(identifier.name); |
| 8183 } | 8105 } |
| 8184 return builder.toString(); | 8106 return builder.toString(); |
| 8185 } | 8107 } |
| 8186 Element get staticElement => null; | 8108 Element get staticElement => null; |
| 8187 void visitChildren(ASTVisitor<Object> visitor) { | 8109 void visitChildren(ASTVisitor<Object> visitor) { |
| 8188 _components.accept(visitor); | 8110 _components.accept(visitor); |
| 8189 } | 8111 } |
| 8190 } | 8112 } |
| 8191 | |
| 8192 /** | 8113 /** |
| 8193 * Instances of the class {@code ListLiteral} represent a list literal. | 8114 * Instances of the class {@code ListLiteral} represent a list literal. |
| 8194 * <pre> | 8115 * <pre> |
| 8195 * listLiteral ::= | 8116 * listLiteral ::= |
| 8196 * 'const'? ('<' {@link TypeName type} '>')? '\[' ({@link Expression expressionL
ist} ','?)? '\]' | 8117 * 'const'? ('<' {@link TypeName type} '>')? '\[' ({@link Expression expressionL
ist} ','?)? '\]' |
| 8197 * </pre> | 8118 * </pre> |
| 8198 * @coverage dart.engine.ast | 8119 * @coverage dart.engine.ast |
| 8199 */ | 8120 */ |
| 8200 class ListLiteral extends TypedLiteral { | 8121 class ListLiteral extends TypedLiteral { |
| 8201 | 8122 |
| 8202 /** | 8123 /** |
| 8203 * The left square bracket. | 8124 * The left square bracket. |
| 8204 */ | 8125 */ |
| 8205 Token _leftBracket; | 8126 Token _leftBracket; |
| 8206 | 8127 |
| 8207 /** | 8128 /** |
| 8208 * The expressions used to compute the elements of the list. | 8129 * The expressions used to compute the elements of the list. |
| 8209 */ | 8130 */ |
| 8210 NodeList<Expression> _elements; | 8131 NodeList<Expression> _elements; |
| 8211 | 8132 |
| 8212 /** | 8133 /** |
| 8213 * The right square bracket. | 8134 * The right square bracket. |
| 8214 */ | 8135 */ |
| 8215 Token _rightBracket; | 8136 Token _rightBracket; |
| 8216 | 8137 |
| 8217 /** | 8138 /** |
| 8218 * Initialize a newly created list literal. | 8139 * Initialize a newly created list literal. |
| 8219 * @param modifier the const modifier associated with this literal | 8140 * @param modifier the const modifier associated with this literal |
| 8220 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8141 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
| 8221 * arguments were declared | 8142 * arguments were declared |
| 8222 * @param leftBracket the left square bracket | 8143 * @param leftBracket the left square bracket |
| 8223 * @param elements the expressions used to compute the elements of the list | 8144 * @param elements the expressions used to compute the elements of the list |
| 8224 * @param rightBracket the right square bracket | 8145 * @param rightBracket the right square bracket |
| 8225 */ | 8146 */ |
| 8226 ListLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBra
cket, List<Expression> elements, Token rightBracket) : super.full(modifier, type
Arguments) { | 8147 ListLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBra
cket, List<Expression> elements, Token rightBracket) : super.full(modifier, type
Arguments) { |
| 8227 this._elements = new NodeList<Expression>(this); | 8148 this._elements = new NodeList<Expression>(this); |
| 8228 this._leftBracket = leftBracket; | 8149 this._leftBracket = leftBracket; |
| 8229 this._elements.addAll(elements); | 8150 this._elements.addAll(elements); |
| 8230 this._rightBracket = rightBracket; | 8151 this._rightBracket = rightBracket; |
| 8231 } | 8152 } |
| 8232 | 8153 |
| 8233 /** | 8154 /** |
| 8234 * Initialize a newly created list literal. | 8155 * Initialize a newly created list literal. |
| 8235 * @param modifier the const modifier associated with this literal | 8156 * @param modifier the const modifier associated with this literal |
| 8236 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8157 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
| 8237 * arguments were declared | 8158 * arguments were declared |
| 8238 * @param leftBracket the left square bracket | 8159 * @param leftBracket the left square bracket |
| 8239 * @param elements the expressions used to compute the elements of the list | 8160 * @param elements the expressions used to compute the elements of the list |
| 8240 * @param rightBracket the right square bracket | 8161 * @param rightBracket the right square bracket |
| 8241 */ | 8162 */ |
| 8242 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); | 8163 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); |
| 8243 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); | 8164 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); |
| 8244 Token get beginToken { | 8165 Token get beginToken { |
| 8245 Token token = modifier; | 8166 Token token = modifier; |
| 8246 if (token != null) { | 8167 if (token != null) { |
| 8247 return token; | 8168 return token; |
| 8248 } | 8169 } |
| 8249 TypeArgumentList typeArguments2 = typeArguments; | 8170 TypeArgumentList typeArguments2 = typeArguments; |
| 8250 if (typeArguments2 != null) { | 8171 if (typeArguments2 != null) { |
| 8251 return typeArguments2.beginToken; | 8172 return typeArguments2.beginToken; |
| 8252 } | 8173 } |
| 8253 return _leftBracket; | 8174 return _leftBracket; |
| 8254 } | 8175 } |
| 8255 | 8176 |
| 8256 /** | 8177 /** |
| 8257 * Return the expressions used to compute the elements of the list. | 8178 * Return the expressions used to compute the elements of the list. |
| 8258 * @return the expressions used to compute the elements of the list | 8179 * @return the expressions used to compute the elements of the list |
| 8259 */ | 8180 */ |
| 8260 NodeList<Expression> get elements => _elements; | 8181 NodeList<Expression> get elements => _elements; |
| 8261 Token get endToken => _rightBracket; | 8182 Token get endToken => _rightBracket; |
| 8262 | 8183 |
| 8263 /** | 8184 /** |
| 8264 * Return the left square bracket. | 8185 * Return the left square bracket. |
| 8265 * @return the left square bracket | 8186 * @return the left square bracket |
| 8266 */ | 8187 */ |
| 8267 Token get leftBracket => _leftBracket; | 8188 Token get leftBracket => _leftBracket; |
| 8268 | 8189 |
| 8269 /** | 8190 /** |
| 8270 * Return the right square bracket. | 8191 * Return the right square bracket. |
| 8271 * @return the right square bracket | 8192 * @return the right square bracket |
| 8272 */ | 8193 */ |
| 8273 Token get rightBracket => _rightBracket; | 8194 Token get rightBracket => _rightBracket; |
| 8274 | 8195 |
| 8275 /** | 8196 /** |
| 8276 * Set the left square bracket to the given token. | 8197 * Set the left square bracket to the given token. |
| 8277 * @param bracket the left square bracket | 8198 * @param bracket the left square bracket |
| 8278 */ | 8199 */ |
| 8279 void set leftBracket(Token bracket) { | 8200 void set leftBracket(Token bracket) { |
| 8280 _leftBracket = bracket; | 8201 _leftBracket = bracket; |
| 8281 } | 8202 } |
| 8282 | 8203 |
| 8283 /** | 8204 /** |
| 8284 * Set the right square bracket to the given token. | 8205 * Set the right square bracket to the given token. |
| 8285 * @param bracket the right square bracket | 8206 * @param bracket the right square bracket |
| 8286 */ | 8207 */ |
| 8287 void set rightBracket(Token bracket) { | 8208 void set rightBracket(Token bracket) { |
| 8288 _rightBracket = bracket; | 8209 _rightBracket = bracket; |
| 8289 } | 8210 } |
| 8290 void visitChildren(ASTVisitor<Object> visitor) { | 8211 void visitChildren(ASTVisitor<Object> visitor) { |
| 8291 super.visitChildren(visitor); | 8212 super.visitChildren(visitor); |
| 8292 _elements.accept(visitor); | 8213 _elements.accept(visitor); |
| 8293 } | 8214 } |
| 8294 } | 8215 } |
| 8295 | |
| 8296 /** | 8216 /** |
| 8297 * The abstract class {@code Literal} defines the behavior common to nodes that
represent a literal | 8217 * The abstract class {@code Literal} defines the behavior common to nodes that
represent a literal |
| 8298 * expression. | 8218 * expression. |
| 8299 * <pre> | 8219 * <pre> |
| 8300 * literal ::={@link BooleanLiteral booleanLiteral}| {@link DoubleLiteral double
Literal}| {@link IntegerLiteral integerLiteral}| {@link ListLiteral listLiteral}
| {@link MapLiteral mapLiteral}| {@link NullLiteral nullLiteral}| {@link StringL
iteral stringLiteral}</pre> | 8220 * literal ::={@link BooleanLiteral booleanLiteral}| {@link DoubleLiteral double
Literal}| {@link IntegerLiteral integerLiteral}| {@link ListLiteral listLiteral}
| {@link MapLiteral mapLiteral}| {@link NullLiteral nullLiteral}| {@link StringL
iteral stringLiteral}</pre> |
| 8301 * @coverage dart.engine.ast | 8221 * @coverage dart.engine.ast |
| 8302 */ | 8222 */ |
| 8303 abstract class Literal extends Expression { | 8223 abstract class Literal extends Expression { |
| 8304 } | 8224 } |
| 8305 | |
| 8306 /** | 8225 /** |
| 8307 * Instances of the class {@code MapLiteral} represent a literal map. | 8226 * Instances of the class {@code MapLiteral} represent a literal map. |
| 8308 * <pre> | 8227 * <pre> |
| 8309 * mapLiteral ::= | 8228 * mapLiteral ::= |
| 8310 * 'const'? ('<' {@link TypeName type} (',' {@link TypeName type})* '>')? '{' ({
@link MapLiteralEntry entry} (',' {@link MapLiteralEntry entry})* ','?)? '}' | 8229 * 'const'? ('<' {@link TypeName type} (',' {@link TypeName type})* '>')? '{' ({
@link MapLiteralEntry entry} (',' {@link MapLiteralEntry entry})* ','?)? '}' |
| 8311 * </pre> | 8230 * </pre> |
| 8312 * @coverage dart.engine.ast | 8231 * @coverage dart.engine.ast |
| 8313 */ | 8232 */ |
| 8314 class MapLiteral extends TypedLiteral { | 8233 class MapLiteral extends TypedLiteral { |
| 8315 | 8234 |
| 8316 /** | 8235 /** |
| 8317 * The left curly bracket. | 8236 * The left curly bracket. |
| 8318 */ | 8237 */ |
| 8319 Token _leftBracket; | 8238 Token _leftBracket; |
| 8320 | 8239 |
| 8321 /** | 8240 /** |
| 8322 * The entries in the map. | 8241 * The entries in the map. |
| 8323 */ | 8242 */ |
| 8324 NodeList<MapLiteralEntry> _entries; | 8243 NodeList<MapLiteralEntry> _entries; |
| 8325 | 8244 |
| 8326 /** | 8245 /** |
| 8327 * The right curly bracket. | 8246 * The right curly bracket. |
| 8328 */ | 8247 */ |
| 8329 Token _rightBracket; | 8248 Token _rightBracket; |
| 8330 | 8249 |
| 8331 /** | 8250 /** |
| 8332 * Initialize a newly created map literal. | 8251 * Initialize a newly created map literal. |
| 8333 * @param modifier the const modifier associated with this literal | 8252 * @param modifier the const modifier associated with this literal |
| 8334 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8253 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
| 8335 * arguments were declared | 8254 * arguments were declared |
| 8336 * @param leftBracket the left curly bracket | 8255 * @param leftBracket the left curly bracket |
| 8337 * @param entries the entries in the map | 8256 * @param entries the entries in the map |
| 8338 * @param rightBracket the right curly bracket | 8257 * @param rightBracket the right curly bracket |
| 8339 */ | 8258 */ |
| 8340 MapLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBrac
ket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(modifier, t
ypeArguments) { | 8259 MapLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBrac
ket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(modifier, t
ypeArguments) { |
| 8341 this._entries = new NodeList<MapLiteralEntry>(this); | 8260 this._entries = new NodeList<MapLiteralEntry>(this); |
| 8342 this._leftBracket = leftBracket; | 8261 this._leftBracket = leftBracket; |
| 8343 this._entries.addAll(entries); | 8262 this._entries.addAll(entries); |
| 8344 this._rightBracket = rightBracket; | 8263 this._rightBracket = rightBracket; |
| 8345 } | 8264 } |
| 8346 | 8265 |
| 8347 /** | 8266 /** |
| 8348 * Initialize a newly created map literal. | 8267 * Initialize a newly created map literal. |
| 8349 * @param modifier the const modifier associated with this literal | 8268 * @param modifier the const modifier associated with this literal |
| 8350 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8269 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
| 8351 * arguments were declared | 8270 * arguments were declared |
| 8352 * @param leftBracket the left curly bracket | 8271 * @param leftBracket the left curly bracket |
| 8353 * @param entries the entries in the map | 8272 * @param entries the entries in the map |
| 8354 * @param rightBracket the right curly bracket | 8273 * @param rightBracket the right curly bracket |
| 8355 */ | 8274 */ |
| 8356 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); | 8275 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); |
| 8357 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); | 8276 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); |
| 8358 Token get beginToken { | 8277 Token get beginToken { |
| 8359 Token token = modifier; | 8278 Token token = modifier; |
| 8360 if (token != null) { | 8279 if (token != null) { |
| 8361 return token; | 8280 return token; |
| 8362 } | 8281 } |
| 8363 TypeArgumentList typeArguments2 = typeArguments; | 8282 TypeArgumentList typeArguments2 = typeArguments; |
| 8364 if (typeArguments2 != null) { | 8283 if (typeArguments2 != null) { |
| 8365 return typeArguments2.beginToken; | 8284 return typeArguments2.beginToken; |
| 8366 } | 8285 } |
| 8367 return _leftBracket; | 8286 return _leftBracket; |
| 8368 } | 8287 } |
| 8369 Token get endToken => _rightBracket; | 8288 Token get endToken => _rightBracket; |
| 8370 | 8289 |
| 8371 /** | 8290 /** |
| 8372 * Return the entries in the map. | 8291 * Return the entries in the map. |
| 8373 * @return the entries in the map | 8292 * @return the entries in the map |
| 8374 */ | 8293 */ |
| 8375 NodeList<MapLiteralEntry> get entries => _entries; | 8294 NodeList<MapLiteralEntry> get entries => _entries; |
| 8376 | 8295 |
| 8377 /** | 8296 /** |
| 8378 * Return the left curly bracket. | 8297 * Return the left curly bracket. |
| 8379 * @return the left curly bracket | 8298 * @return the left curly bracket |
| 8380 */ | 8299 */ |
| 8381 Token get leftBracket => _leftBracket; | 8300 Token get leftBracket => _leftBracket; |
| 8382 | 8301 |
| 8383 /** | 8302 /** |
| 8384 * Return the right curly bracket. | 8303 * Return the right curly bracket. |
| 8385 * @return the right curly bracket | 8304 * @return the right curly bracket |
| 8386 */ | 8305 */ |
| 8387 Token get rightBracket => _rightBracket; | 8306 Token get rightBracket => _rightBracket; |
| 8388 | 8307 |
| 8389 /** | 8308 /** |
| 8390 * Set the left curly bracket to the given token. | 8309 * Set the left curly bracket to the given token. |
| 8391 * @param bracket the left curly bracket | 8310 * @param bracket the left curly bracket |
| 8392 */ | 8311 */ |
| 8393 void set leftBracket(Token bracket) { | 8312 void set leftBracket(Token bracket) { |
| 8394 _leftBracket = bracket; | 8313 _leftBracket = bracket; |
| 8395 } | 8314 } |
| 8396 | 8315 |
| 8397 /** | 8316 /** |
| 8398 * Set the right curly bracket to the given token. | 8317 * Set the right curly bracket to the given token. |
| 8399 * @param bracket the right curly bracket | 8318 * @param bracket the right curly bracket |
| 8400 */ | 8319 */ |
| 8401 void set rightBracket(Token bracket) { | 8320 void set rightBracket(Token bracket) { |
| 8402 _rightBracket = bracket; | 8321 _rightBracket = bracket; |
| 8403 } | 8322 } |
| 8404 void visitChildren(ASTVisitor<Object> visitor) { | 8323 void visitChildren(ASTVisitor<Object> visitor) { |
| 8405 super.visitChildren(visitor); | 8324 super.visitChildren(visitor); |
| 8406 _entries.accept(visitor); | 8325 _entries.accept(visitor); |
| 8407 } | 8326 } |
| 8408 } | 8327 } |
| 8409 | |
| 8410 /** | 8328 /** |
| 8411 * Instances of the class {@code MapLiteralEntry} represent a single key/value p
air in a map | 8329 * Instances of the class {@code MapLiteralEntry} represent a single key/value p
air in a map |
| 8412 * literal. | 8330 * literal. |
| 8413 * <pre> | 8331 * <pre> |
| 8414 * mapLiteralEntry ::={@link Expression key} ':' {@link Expression value}</pre> | 8332 * mapLiteralEntry ::={@link Expression key} ':' {@link Expression value}</pre> |
| 8415 * @coverage dart.engine.ast | 8333 * @coverage dart.engine.ast |
| 8416 */ | 8334 */ |
| 8417 class MapLiteralEntry extends ASTNode { | 8335 class MapLiteralEntry extends ASTNode { |
| 8418 | 8336 |
| 8419 /** | 8337 /** |
| 8420 * The expression computing the key with which the value will be associated. | 8338 * The expression computing the key with which the value will be associated. |
| 8421 */ | 8339 */ |
| 8422 Expression _key; | 8340 Expression _key; |
| 8423 | 8341 |
| 8424 /** | 8342 /** |
| 8425 * The colon that separates the key from the value. | 8343 * The colon that separates the key from the value. |
| 8426 */ | 8344 */ |
| 8427 Token _separator; | 8345 Token _separator; |
| 8428 | 8346 |
| 8429 /** | 8347 /** |
| 8430 * The expression computing the value that will be associated with the key. | 8348 * The expression computing the value that will be associated with the key. |
| 8431 */ | 8349 */ |
| 8432 Expression _value; | 8350 Expression _value; |
| 8433 | 8351 |
| 8434 /** | 8352 /** |
| 8435 * Initialize a newly created map literal entry. | 8353 * Initialize a newly created map literal entry. |
| 8436 * @param key the expression computing the key with which the value will be as
sociated | 8354 * @param key the expression computing the key with which the value will be as
sociated |
| 8437 * @param separator the colon that separates the key from the value | 8355 * @param separator the colon that separates the key from the value |
| 8438 * @param value the expression computing the value that will be associated wit
h the key | 8356 * @param value the expression computing the value that will be associated wit
h the key |
| 8439 */ | 8357 */ |
| 8440 MapLiteralEntry.full(Expression key, Token separator, Expression value) { | 8358 MapLiteralEntry.full(Expression key, Token separator, Expression value) { |
| 8441 this._key = becomeParentOf(key); | 8359 this._key = becomeParentOf(key); |
| 8442 this._separator = separator; | 8360 this._separator = separator; |
| 8443 this._value = becomeParentOf(value); | 8361 this._value = becomeParentOf(value); |
| 8444 } | 8362 } |
| 8445 | 8363 |
| 8446 /** | 8364 /** |
| 8447 * Initialize a newly created map literal entry. | 8365 * Initialize a newly created map literal entry. |
| 8448 * @param key the expression computing the key with which the value will be as
sociated | 8366 * @param key the expression computing the key with which the value will be as
sociated |
| 8449 * @param separator the colon that separates the key from the value | 8367 * @param separator the colon that separates the key from the value |
| 8450 * @param value the expression computing the value that will be associated wit
h the key | 8368 * @param value the expression computing the value that will be associated wit
h the key |
| 8451 */ | 8369 */ |
| 8452 MapLiteralEntry({Expression key, Token separator, Expression value}) : this.fu
ll(key, separator, value); | 8370 MapLiteralEntry({Expression key, Token separator, Expression value}) : this.fu
ll(key, separator, value); |
| 8453 accept(ASTVisitor visitor) => visitor.visitMapLiteralEntry(this); | 8371 accept(ASTVisitor visitor) => visitor.visitMapLiteralEntry(this); |
| 8454 Token get beginToken => _key.beginToken; | 8372 Token get beginToken => _key.beginToken; |
| 8455 Token get endToken => _value.endToken; | 8373 Token get endToken => _value.endToken; |
| 8456 | 8374 |
| 8457 /** | 8375 /** |
| 8458 * Return the expression computing the key with which the value will be associ
ated. | 8376 * Return the expression computing the key with which the value will be associ
ated. |
| 8459 * @return the expression computing the key with which the value will be assoc
iated | 8377 * @return the expression computing the key with which the value will be assoc
iated |
| 8460 */ | 8378 */ |
| 8461 Expression get key => _key; | 8379 Expression get key => _key; |
| 8462 | 8380 |
| 8463 /** | 8381 /** |
| 8464 * Return the colon that separates the key from the value. | 8382 * Return the colon that separates the key from the value. |
| 8465 * @return the colon that separates the key from the value | 8383 * @return the colon that separates the key from the value |
| 8466 */ | 8384 */ |
| 8467 Token get separator => _separator; | 8385 Token get separator => _separator; |
| 8468 | 8386 |
| 8469 /** | 8387 /** |
| 8470 * Return the expression computing the value that will be associated with the
key. | 8388 * Return the expression computing the value that will be associated with the
key. |
| 8471 * @return the expression computing the value that will be associated with the
key | 8389 * @return the expression computing the value that will be associated with the
key |
| 8472 */ | 8390 */ |
| 8473 Expression get value => _value; | 8391 Expression get value => _value; |
| 8474 | 8392 |
| 8475 /** | 8393 /** |
| 8476 * Set the expression computing the key with which the value will be associate
d to the given | 8394 * Set the expression computing the key with which the value will be associate
d to the given |
| 8477 * string. | 8395 * string. |
| 8478 * @param string the expression computing the key with which the value will be
associated | 8396 * @param string the expression computing the key with which the value will be
associated |
| 8479 */ | 8397 */ |
| 8480 void set key(Expression string) { | 8398 void set key(Expression string) { |
| 8481 _key = becomeParentOf(string); | 8399 _key = becomeParentOf(string); |
| 8482 } | 8400 } |
| 8483 | 8401 |
| 8484 /** | 8402 /** |
| 8485 * Set the colon that separates the key from the value to the given token. | 8403 * Set the colon that separates the key from the value to the given token. |
| 8486 * @param separator the colon that separates the key from the value | 8404 * @param separator the colon that separates the key from the value |
| 8487 */ | 8405 */ |
| 8488 void set separator(Token separator2) { | 8406 void set separator(Token separator2) { |
| 8489 this._separator = separator2; | 8407 this._separator = separator2; |
| 8490 } | 8408 } |
| 8491 | 8409 |
| 8492 /** | 8410 /** |
| 8493 * Set the expression computing the value that will be associated with the key
to the given | 8411 * Set the expression computing the value that will be associated with the key
to the given |
| 8494 * expression. | 8412 * expression. |
| 8495 * @param expression the expression computing the value that will be associate
d with the key | 8413 * @param expression the expression computing the value that will be associate
d with the key |
| 8496 */ | 8414 */ |
| 8497 void set value(Expression expression) { | 8415 void set value(Expression expression) { |
| 8498 _value = becomeParentOf(expression); | 8416 _value = becomeParentOf(expression); |
| 8499 } | 8417 } |
| 8500 void visitChildren(ASTVisitor<Object> visitor) { | 8418 void visitChildren(ASTVisitor<Object> visitor) { |
| 8501 safelyVisitChild(_key, visitor); | 8419 safelyVisitChild(_key, visitor); |
| 8502 safelyVisitChild(_value, visitor); | 8420 safelyVisitChild(_value, visitor); |
| 8503 } | 8421 } |
| 8504 } | 8422 } |
| 8505 | |
| 8506 /** | 8423 /** |
| 8507 * Instances of the class {@code MethodDeclaration} represent a method declarati
on. | 8424 * Instances of the class {@code MethodDeclaration} represent a method declarati
on. |
| 8508 * <pre> | 8425 * <pre> |
| 8509 * methodDeclaration ::= | 8426 * methodDeclaration ::= |
| 8510 * methodSignature {@link FunctionBody body}methodSignature ::= | 8427 * methodSignature {@link FunctionBody body}methodSignature ::= |
| 8511 * 'external'? ('abstract' | 'static')? {@link Type returnType}? ('get' | 'set')
? methodName{@link FormalParameterList formalParameterList}methodName ::={@link
SimpleIdentifier name}| 'operator' {@link SimpleIdentifier operator}</pre> | 8428 * 'external'? ('abstract' | 'static')? {@link Type returnType}? ('get' | 'set')
? methodName{@link FormalParameterList formalParameterList}methodName ::={@link
SimpleIdentifier name}| 'operator' {@link SimpleIdentifier operator}</pre> |
| 8512 * @coverage dart.engine.ast | 8429 * @coverage dart.engine.ast |
| 8513 */ | 8430 */ |
| 8514 class MethodDeclaration extends ClassMember { | 8431 class MethodDeclaration extends ClassMember { |
| 8515 | 8432 |
| 8516 /** | 8433 /** |
| 8517 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. | 8434 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. |
| 8518 */ | 8435 */ |
| 8519 Token _externalKeyword; | 8436 Token _externalKeyword; |
| 8520 | 8437 |
| 8521 /** | 8438 /** |
| 8522 * The token representing the 'abstract' or 'static' keyword, or {@code null}
if neither modifier | 8439 * The token representing the 'abstract' or 'static' keyword, or {@code null}
if neither modifier |
| 8523 * was specified. | 8440 * was specified. |
| 8524 */ | 8441 */ |
| 8525 Token _modifierKeyword; | 8442 Token _modifierKeyword; |
| 8526 | 8443 |
| 8527 /** | 8444 /** |
| 8528 * The return type of the method, or {@code null} if no return type was declar
ed. | 8445 * The return type of the method, or {@code null} if no return type was declar
ed. |
| 8529 */ | 8446 */ |
| 8530 TypeName _returnType; | 8447 TypeName _returnType; |
| 8531 | 8448 |
| 8532 /** | 8449 /** |
| 8533 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a method | 8450 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a method |
| 8534 * declaration rather than a property declaration. | 8451 * declaration rather than a property declaration. |
| 8535 */ | 8452 */ |
| 8536 Token _propertyKeyword; | 8453 Token _propertyKeyword; |
| 8537 | 8454 |
| 8538 /** | 8455 /** |
| 8539 * The token representing the 'operator' keyword, or {@code null} if this meth
od does not declare | 8456 * The token representing the 'operator' keyword, or {@code null} if this meth
od does not declare |
| 8540 * an operator. | 8457 * an operator. |
| 8541 */ | 8458 */ |
| 8542 Token _operatorKeyword; | 8459 Token _operatorKeyword; |
| 8543 | 8460 |
| 8544 /** | 8461 /** |
| 8545 * The name of the method. | 8462 * The name of the method. |
| 8546 */ | 8463 */ |
| 8547 SimpleIdentifier _name; | 8464 SimpleIdentifier _name; |
| 8548 | 8465 |
| 8549 /** | 8466 /** |
| 8550 * The parameters associated with the method, or {@code null} if this method d
eclares a getter. | 8467 * The parameters associated with the method, or {@code null} if this method d
eclares a getter. |
| 8551 */ | 8468 */ |
| 8552 FormalParameterList _parameters; | 8469 FormalParameterList _parameters; |
| 8553 | 8470 |
| 8554 /** | 8471 /** |
| 8555 * The body of the method. | 8472 * The body of the method. |
| 8556 */ | 8473 */ |
| 8557 FunctionBody _body; | 8474 FunctionBody _body; |
| 8558 | 8475 |
| 8559 /** | 8476 /** |
| 8560 * Initialize a newly created method declaration. | 8477 * Initialize a newly created method declaration. |
| 8561 * @param externalKeyword the token for the 'external' keyword | 8478 * @param externalKeyword the token for the 'external' keyword |
| 8562 * @param comment the documentation comment associated with this method | 8479 * @param comment the documentation comment associated with this method |
| 8563 * @param metadata the annotations associated with this method | 8480 * @param metadata the annotations associated with this method |
| 8564 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 8481 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
| 8565 * @param returnType the return type of the method | 8482 * @param returnType the return type of the method |
| 8566 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 8483 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 8567 * @param operatorKeyword the token representing the 'operator' keyword | 8484 * @param operatorKeyword the token representing the 'operator' keyword |
| 8568 * @param name the name of the method | 8485 * @param name the name of the method |
| 8569 * @param parameters the parameters associated with the method, or {@code null
} if this method | 8486 * @param parameters the parameters associated with the method, or {@code null
} if this method |
| 8570 * declares a getter | 8487 * declares a getter |
| 8571 * @param body the body of the method | 8488 * @param body the body of the method |
| 8572 */ | 8489 */ |
| 8573 MethodDeclaration.full(Comment comment, List<Annotation> metadata, Token exter
nalKeyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, T
oken operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Fun
ctionBody body) : super.full(comment, metadata) { | 8490 MethodDeclaration.full(Comment comment, List<Annotation> metadata, Token exter
nalKeyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, T
oken operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Fun
ctionBody body) : super.full(comment, metadata) { |
| 8574 this._externalKeyword = externalKeyword; | 8491 this._externalKeyword = externalKeyword; |
| 8575 this._modifierKeyword = modifierKeyword; | 8492 this._modifierKeyword = modifierKeyword; |
| 8576 this._returnType = becomeParentOf(returnType); | 8493 this._returnType = becomeParentOf(returnType); |
| 8577 this._propertyKeyword = propertyKeyword; | 8494 this._propertyKeyword = propertyKeyword; |
| 8578 this._operatorKeyword = operatorKeyword; | 8495 this._operatorKeyword = operatorKeyword; |
| 8579 this._name = becomeParentOf(name); | 8496 this._name = becomeParentOf(name); |
| 8580 this._parameters = becomeParentOf(parameters); | 8497 this._parameters = becomeParentOf(parameters); |
| 8581 this._body = becomeParentOf(body); | 8498 this._body = becomeParentOf(body); |
| 8582 } | 8499 } |
| 8583 | 8500 |
| 8584 /** | 8501 /** |
| 8585 * Initialize a newly created method declaration. | 8502 * Initialize a newly created method declaration. |
| 8586 * @param externalKeyword the token for the 'external' keyword | 8503 * @param externalKeyword the token for the 'external' keyword |
| 8587 * @param comment the documentation comment associated with this method | 8504 * @param comment the documentation comment associated with this method |
| 8588 * @param metadata the annotations associated with this method | 8505 * @param metadata the annotations associated with this method |
| 8589 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 8506 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
| 8590 * @param returnType the return type of the method | 8507 * @param returnType the return type of the method |
| 8591 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 8508 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 8592 * @param operatorKeyword the token representing the 'operator' keyword | 8509 * @param operatorKeyword the token representing the 'operator' keyword |
| 8593 * @param name the name of the method | 8510 * @param name the name of the method |
| 8594 * @param parameters the parameters associated with the method, or {@code null
} if this method | 8511 * @param parameters the parameters associated with the method, or {@code null
} if this method |
| 8595 * declares a getter | 8512 * declares a getter |
| 8596 * @param body the body of the method | 8513 * @param body the body of the method |
| 8597 */ | 8514 */ |
| 8598 MethodDeclaration({Comment comment, List<Annotation> metadata, Token externalK
eyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, Token
operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Functio
nBody body}) : this.full(comment, metadata, externalKeyword, modifierKeyword, re
turnType, propertyKeyword, operatorKeyword, name, parameters, body); | 8515 MethodDeclaration({Comment comment, List<Annotation> metadata, Token externalK
eyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, Token
operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Functio
nBody body}) : this.full(comment, metadata, externalKeyword, modifierKeyword, re
turnType, propertyKeyword, operatorKeyword, name, parameters, body); |
| 8599 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); | 8516 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); |
| 8600 | 8517 |
| 8601 /** | 8518 /** |
| 8602 * Return the body of the method. | 8519 * Return the body of the method. |
| 8603 * @return the body of the method | 8520 * @return the body of the method |
| 8604 */ | 8521 */ |
| 8605 FunctionBody get body => _body; | 8522 FunctionBody get body => _body; |
| 8606 | 8523 |
| 8607 /** | 8524 /** |
| 8608 * Return the element associated with this method, or {@code null} if the AST
structure has not | 8525 * Return the element associated with this method, or {@code null} if the AST
structure has not |
| 8609 * been resolved. The element can either be a {@link MethodElement}, if this r
epresents the | 8526 * been resolved. The element can either be a {@link MethodElement}, if this r
epresents the |
| 8610 * declaration of a normal method, or a {@link PropertyAccessorElement} if thi
s represents the | 8527 * declaration of a normal method, or a {@link PropertyAccessorElement} if thi
s represents the |
| 8611 * declaration of either a getter or a setter. | 8528 * declaration of either a getter or a setter. |
| 8612 * @return the element associated with this method | 8529 * @return the element associated with this method |
| 8613 */ | 8530 */ |
| 8614 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; | 8531 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; |
| 8615 Token get endToken => _body.endToken; | 8532 Token get endToken => _body.endToken; |
| 8616 | 8533 |
| 8617 /** | 8534 /** |
| 8618 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not | 8535 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not |
| 8619 * external. | 8536 * external. |
| 8620 * @return the token for the 'external' keyword | 8537 * @return the token for the 'external' keyword |
| 8621 */ | 8538 */ |
| 8622 Token get externalKeyword => _externalKeyword; | 8539 Token get externalKeyword => _externalKeyword; |
| 8623 | 8540 |
| 8624 /** | 8541 /** |
| 8625 * Return the token representing the 'abstract' or 'static' keyword, or {@code
null} if neither | 8542 * Return the token representing the 'abstract' or 'static' keyword, or {@code
null} if neither |
| 8626 * modifier was specified. | 8543 * modifier was specified. |
| 8627 * @return the token representing the 'abstract' or 'static' keyword | 8544 * @return the token representing the 'abstract' or 'static' keyword |
| 8628 */ | 8545 */ |
| 8629 Token get modifierKeyword => _modifierKeyword; | 8546 Token get modifierKeyword => _modifierKeyword; |
| 8630 | 8547 |
| 8631 /** | 8548 /** |
| 8632 * Return the name of the method. | 8549 * Return the name of the method. |
| 8633 * @return the name of the method | 8550 * @return the name of the method |
| 8634 */ | 8551 */ |
| 8635 SimpleIdentifier get name => _name; | 8552 SimpleIdentifier get name => _name; |
| 8636 | 8553 |
| 8637 /** | 8554 /** |
| 8638 * Return the token representing the 'operator' keyword, or {@code null} if th
is method does not | 8555 * Return the token representing the 'operator' keyword, or {@code null} if th
is method does not |
| 8639 * declare an operator. | 8556 * declare an operator. |
| 8640 * @return the token representing the 'operator' keyword | 8557 * @return the token representing the 'operator' keyword |
| 8641 */ | 8558 */ |
| 8642 Token get operatorKeyword => _operatorKeyword; | 8559 Token get operatorKeyword => _operatorKeyword; |
| 8643 | 8560 |
| 8644 /** | 8561 /** |
| 8645 * Return the parameters associated with the method, or {@code null} if this m
ethod declares a | 8562 * Return the parameters associated with the method, or {@code null} if this m
ethod declares a |
| 8646 * getter. | 8563 * getter. |
| 8647 * @return the parameters associated with the method | 8564 * @return the parameters associated with the method |
| 8648 */ | 8565 */ |
| 8649 FormalParameterList get parameters => _parameters; | 8566 FormalParameterList get parameters => _parameters; |
| 8650 | 8567 |
| 8651 /** | 8568 /** |
| 8652 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a method | 8569 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a method |
| 8653 * declaration rather than a property declaration. | 8570 * declaration rather than a property declaration. |
| 8654 * @return the token representing the 'get' or 'set' keyword | 8571 * @return the token representing the 'get' or 'set' keyword |
| 8655 */ | 8572 */ |
| 8656 Token get propertyKeyword => _propertyKeyword; | 8573 Token get propertyKeyword => _propertyKeyword; |
| 8657 | 8574 |
| 8658 /** | 8575 /** |
| 8659 * Return the return type of the method, or {@code null} if no return type was
declared. | 8576 * Return the return type of the method, or {@code null} if no return type was
declared. |
| 8660 * @return the return type of the method | 8577 * @return the return type of the method |
| 8661 */ | 8578 */ |
| 8662 TypeName get returnType => _returnType; | 8579 TypeName get returnType => _returnType; |
| 8663 | 8580 |
| 8664 /** | 8581 /** |
| 8665 * Return {@code true} if this method is declared to be an abstract method. | 8582 * Return {@code true} if this method is declared to be an abstract method. |
| 8666 * @return {@code true} if this method is declared to be an abstract method | 8583 * @return {@code true} if this method is declared to be an abstract method |
| 8667 */ | 8584 */ |
| 8668 bool isAbstract() => _externalKeyword == null && (_body is EmptyFunctionBody); | 8585 bool isAbstract() => _externalKeyword == null && (_body is EmptyFunctionBody); |
| 8669 | 8586 |
| 8670 /** | 8587 /** |
| 8671 * Return {@code true} if this method declares a getter. | 8588 * Return {@code true} if this method declares a getter. |
| 8672 * @return {@code true} if this method declares a getter | 8589 * @return {@code true} if this method declares a getter |
| 8673 */ | 8590 */ |
| 8674 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); | 8591 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); |
| 8675 | 8592 |
| 8676 /** | 8593 /** |
| 8677 * Return {@code true} if this method declares an operator. | 8594 * Return {@code true} if this method declares an operator. |
| 8678 * @return {@code true} if this method declares an operator | 8595 * @return {@code true} if this method declares an operator |
| 8679 */ | 8596 */ |
| 8680 bool isOperator() => _operatorKeyword != null; | 8597 bool isOperator() => _operatorKeyword != null; |
| 8681 | 8598 |
| 8682 /** | 8599 /** |
| 8683 * Return {@code true} if this method declares a setter. | 8600 * Return {@code true} if this method declares a setter. |
| 8684 * @return {@code true} if this method declares a setter | 8601 * @return {@code true} if this method declares a setter |
| 8685 */ | 8602 */ |
| 8686 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); | 8603 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); |
| 8687 | 8604 |
| 8688 /** | 8605 /** |
| 8689 * Return {@code true} if this method is declared to be a static method. | 8606 * Return {@code true} if this method is declared to be a static method. |
| 8690 * @return {@code true} if this method is declared to be a static method | 8607 * @return {@code true} if this method is declared to be a static method |
| 8691 */ | 8608 */ |
| 8692 bool isStatic() => _modifierKeyword != null && identical(((_modifierKeyword as
KeywordToken)).keyword, Keyword.STATIC); | 8609 bool isStatic() => _modifierKeyword != null && identical(((_modifierKeyword as
KeywordToken)).keyword, Keyword.STATIC); |
| 8693 | 8610 |
| 8694 /** | 8611 /** |
| 8695 * Set the body of the method to the given function body. | 8612 * Set the body of the method to the given function body. |
| 8696 * @param functionBody the body of the method | 8613 * @param functionBody the body of the method |
| 8697 */ | 8614 */ |
| 8698 void set body(FunctionBody functionBody) { | 8615 void set body(FunctionBody functionBody) { |
| 8699 _body = becomeParentOf(functionBody); | 8616 _body = becomeParentOf(functionBody); |
| 8700 } | 8617 } |
| 8701 | 8618 |
| 8702 /** | 8619 /** |
| 8703 * Set the token for the 'external' keyword to the given token. | 8620 * Set the token for the 'external' keyword to the given token. |
| 8704 * @param externalKeyword the token for the 'external' keyword | 8621 * @param externalKeyword the token for the 'external' keyword |
| 8705 */ | 8622 */ |
| 8706 void set externalKeyword(Token externalKeyword2) { | 8623 void set externalKeyword(Token externalKeyword2) { |
| 8707 this._externalKeyword = externalKeyword2; | 8624 this._externalKeyword = externalKeyword2; |
| 8708 } | 8625 } |
| 8709 | 8626 |
| 8710 /** | 8627 /** |
| 8711 * Set the token representing the 'abstract' or 'static' keyword to the given
token. | 8628 * Set the token representing the 'abstract' or 'static' keyword to the given
token. |
| 8712 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 8629 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
| 8713 */ | 8630 */ |
| 8714 void set modifierKeyword(Token modifierKeyword2) { | 8631 void set modifierKeyword(Token modifierKeyword2) { |
| 8715 this._modifierKeyword = modifierKeyword2; | 8632 this._modifierKeyword = modifierKeyword2; |
| 8716 } | 8633 } |
| 8717 | 8634 |
| 8718 /** | 8635 /** |
| 8719 * Set the name of the method to the given identifier. | 8636 * Set the name of the method to the given identifier. |
| 8720 * @param identifier the name of the method | 8637 * @param identifier the name of the method |
| 8721 */ | 8638 */ |
| 8722 void set name(SimpleIdentifier identifier) { | 8639 void set name(SimpleIdentifier identifier) { |
| 8723 _name = becomeParentOf(identifier); | 8640 _name = becomeParentOf(identifier); |
| 8724 } | 8641 } |
| 8725 | 8642 |
| 8726 /** | 8643 /** |
| 8727 * Set the token representing the 'operator' keyword to the given token. | 8644 * Set the token representing the 'operator' keyword to the given token. |
| 8728 * @param operatorKeyword the token representing the 'operator' keyword | 8645 * @param operatorKeyword the token representing the 'operator' keyword |
| 8729 */ | 8646 */ |
| 8730 void set operatorKeyword(Token operatorKeyword2) { | 8647 void set operatorKeyword(Token operatorKeyword2) { |
| 8731 this._operatorKeyword = operatorKeyword2; | 8648 this._operatorKeyword = operatorKeyword2; |
| 8732 } | 8649 } |
| 8733 | 8650 |
| 8734 /** | 8651 /** |
| 8735 * Set the parameters associated with the method to the given list of paramete
rs. | 8652 * Set the parameters associated with the method to the given list of paramete
rs. |
| 8736 * @param parameters the parameters associated with the method | 8653 * @param parameters the parameters associated with the method |
| 8737 */ | 8654 */ |
| 8738 void set parameters(FormalParameterList parameters2) { | 8655 void set parameters(FormalParameterList parameters2) { |
| 8739 this._parameters = becomeParentOf(parameters2); | 8656 this._parameters = becomeParentOf(parameters2); |
| 8740 } | 8657 } |
| 8741 | 8658 |
| 8742 /** | 8659 /** |
| 8743 * Set the token representing the 'get' or 'set' keyword to the given token. | 8660 * Set the token representing the 'get' or 'set' keyword to the given token. |
| 8744 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 8661 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 8745 */ | 8662 */ |
| 8746 void set propertyKeyword(Token propertyKeyword2) { | 8663 void set propertyKeyword(Token propertyKeyword2) { |
| 8747 this._propertyKeyword = propertyKeyword2; | 8664 this._propertyKeyword = propertyKeyword2; |
| 8748 } | 8665 } |
| 8749 | 8666 |
| 8750 /** | 8667 /** |
| 8751 * Set the return type of the method to the given type name. | 8668 * Set the return type of the method to the given type name. |
| 8752 * @param typeName the return type of the method | 8669 * @param typeName the return type of the method |
| 8753 */ | 8670 */ |
| 8754 void set returnType(TypeName typeName) { | 8671 void set returnType(TypeName typeName) { |
| 8755 _returnType = becomeParentOf(typeName); | 8672 _returnType = becomeParentOf(typeName); |
| 8756 } | 8673 } |
| 8757 void visitChildren(ASTVisitor<Object> visitor) { | 8674 void visitChildren(ASTVisitor<Object> visitor) { |
| 8758 super.visitChildren(visitor); | 8675 super.visitChildren(visitor); |
| 8759 safelyVisitChild(_returnType, visitor); | 8676 safelyVisitChild(_returnType, visitor); |
| 8760 safelyVisitChild(_name, visitor); | 8677 safelyVisitChild(_name, visitor); |
| 8761 safelyVisitChild(_parameters, visitor); | 8678 safelyVisitChild(_parameters, visitor); |
| 8762 safelyVisitChild(_body, visitor); | 8679 safelyVisitChild(_body, visitor); |
| 8763 } | 8680 } |
| 8764 Token get firstTokenAfterCommentAndMetadata { | 8681 Token get firstTokenAfterCommentAndMetadata { |
| 8765 if (_modifierKeyword != null) { | 8682 if (_modifierKeyword != null) { |
| 8766 return _modifierKeyword; | 8683 return _modifierKeyword; |
| 8767 } else if (_returnType != null) { | 8684 } else if (_returnType != null) { |
| 8768 return _returnType.beginToken; | 8685 return _returnType.beginToken; |
| 8769 } else if (_propertyKeyword != null) { | 8686 } else if (_propertyKeyword != null) { |
| 8770 return _propertyKeyword; | 8687 return _propertyKeyword; |
| 8771 } else if (_operatorKeyword != null) { | 8688 } else if (_operatorKeyword != null) { |
| 8772 return _operatorKeyword; | 8689 return _operatorKeyword; |
| 8773 } | 8690 } |
| 8774 return _name.beginToken; | 8691 return _name.beginToken; |
| 8775 } | 8692 } |
| 8776 } | 8693 } |
| 8777 | |
| 8778 /** | 8694 /** |
| 8779 * Instances of the class {@code MethodInvocation} represent the invocation of e
ither a function or | 8695 * Instances of the class {@code MethodInvocation} represent the invocation of e
ither a function or |
| 8780 * a method. Invocations of functions resulting from evaluating an expression ar
e represented by{@link FunctionExpressionInvocation function expression invocati
on} nodes. Invocations of getters | 8696 * a method. Invocations of functions resulting from evaluating an expression ar
e represented by{@link FunctionExpressionInvocation function expression invocati
on} nodes. Invocations of getters |
| 8781 * and setters are represented by either {@link PrefixedIdentifier prefixed iden
tifier} or{@link PropertyAccess property access} nodes. | 8697 * and setters are represented by either {@link PrefixedIdentifier prefixed iden
tifier} or{@link PropertyAccess property access} nodes. |
| 8782 * <pre> | 8698 * <pre> |
| 8783 * methodInvoction ::= | 8699 * methodInvoction ::= |
| 8784 * ({@link Expression target} '.')? {@link SimpleIdentifier methodName} {@link A
rgumentList argumentList}</pre> | 8700 * ({@link Expression target} '.')? {@link SimpleIdentifier methodName} {@link A
rgumentList argumentList}</pre> |
| 8785 * @coverage dart.engine.ast | 8701 * @coverage dart.engine.ast |
| 8786 */ | 8702 */ |
| 8787 class MethodInvocation extends Expression { | 8703 class MethodInvocation extends Expression { |
| 8788 | 8704 |
| 8789 /** | 8705 /** |
| 8790 * The expression producing the object on which the method is defined, or {@co
de null} if there is | 8706 * The expression producing the object on which the method is defined, or {@co
de null} if there is |
| 8791 * no target (that is, the target is implicitly {@code this}). | 8707 * no target (that is, the target is implicitly {@code this}). |
| 8792 */ | 8708 */ |
| 8793 Expression _target; | 8709 Expression _target; |
| 8794 | 8710 |
| 8795 /** | 8711 /** |
| 8796 * The period that separates the target from the method name, or {@code null}
if there is no | 8712 * The period that separates the target from the method name, or {@code null}
if there is no |
| 8797 * target. | 8713 * target. |
| 8798 */ | 8714 */ |
| 8799 Token _period; | 8715 Token _period; |
| 8800 | 8716 |
| 8801 /** | 8717 /** |
| 8802 * The name of the method being invoked. | 8718 * The name of the method being invoked. |
| 8803 */ | 8719 */ |
| 8804 SimpleIdentifier _methodName; | 8720 SimpleIdentifier _methodName; |
| 8805 | 8721 |
| 8806 /** | 8722 /** |
| 8807 * The list of arguments to the method. | 8723 * The list of arguments to the method. |
| 8808 */ | 8724 */ |
| 8809 ArgumentList _argumentList; | 8725 ArgumentList _argumentList; |
| 8810 | 8726 |
| 8811 /** | 8727 /** |
| 8812 * Initialize a newly created method invocation. | 8728 * Initialize a newly created method invocation. |
| 8813 * @param target the expression producing the object on which the method is de
fined | 8729 * @param target the expression producing the object on which the method is de
fined |
| 8814 * @param period the period that separates the target from the method name | 8730 * @param period the period that separates the target from the method name |
| 8815 * @param methodName the name of the method being invoked | 8731 * @param methodName the name of the method being invoked |
| 8816 * @param argumentList the list of arguments to the method | 8732 * @param argumentList the list of arguments to the method |
| 8817 */ | 8733 */ |
| 8818 MethodInvocation.full(Expression target, Token period, SimpleIdentifier method
Name, ArgumentList argumentList) { | 8734 MethodInvocation.full(Expression target, Token period, SimpleIdentifier method
Name, ArgumentList argumentList) { |
| 8819 this._target = becomeParentOf(target); | 8735 this._target = becomeParentOf(target); |
| 8820 this._period = period; | 8736 this._period = period; |
| 8821 this._methodName = becomeParentOf(methodName); | 8737 this._methodName = becomeParentOf(methodName); |
| 8822 this._argumentList = becomeParentOf(argumentList); | 8738 this._argumentList = becomeParentOf(argumentList); |
| 8823 } | 8739 } |
| 8824 | 8740 |
| 8825 /** | 8741 /** |
| 8826 * Initialize a newly created method invocation. | 8742 * Initialize a newly created method invocation. |
| 8827 * @param target the expression producing the object on which the method is de
fined | 8743 * @param target the expression producing the object on which the method is de
fined |
| 8828 * @param period the period that separates the target from the method name | 8744 * @param period the period that separates the target from the method name |
| 8829 * @param methodName the name of the method being invoked | 8745 * @param methodName the name of the method being invoked |
| 8830 * @param argumentList the list of arguments to the method | 8746 * @param argumentList the list of arguments to the method |
| 8831 */ | 8747 */ |
| 8832 MethodInvocation({Expression target, Token period, SimpleIdentifier methodName
, ArgumentList argumentList}) : this.full(target, period, methodName, argumentLi
st); | 8748 MethodInvocation({Expression target, Token period, SimpleIdentifier methodName
, ArgumentList argumentList}) : this.full(target, period, methodName, argumentLi
st); |
| 8833 accept(ASTVisitor visitor) => visitor.visitMethodInvocation(this); | 8749 accept(ASTVisitor visitor) => visitor.visitMethodInvocation(this); |
| 8834 | 8750 |
| 8835 /** | 8751 /** |
| 8836 * Return the list of arguments to the method. | 8752 * Return the list of arguments to the method. |
| 8837 * @return the list of arguments to the method | 8753 * @return the list of arguments to the method |
| 8838 */ | 8754 */ |
| 8839 ArgumentList get argumentList => _argumentList; | 8755 ArgumentList get argumentList => _argumentList; |
| 8840 Token get beginToken { | 8756 Token get beginToken { |
| 8841 if (_target != null) { | 8757 if (_target != null) { |
| 8842 return _target.beginToken; | 8758 return _target.beginToken; |
| 8843 } else if (_period != null) { | 8759 } else if (_period != null) { |
| 8844 return _period; | 8760 return _period; |
| 8845 } | 8761 } |
| 8846 return _methodName.beginToken; | 8762 return _methodName.beginToken; |
| 8847 } | 8763 } |
| 8848 Token get endToken => _argumentList.endToken; | 8764 Token get endToken => _argumentList.endToken; |
| 8849 | 8765 |
| 8850 /** | 8766 /** |
| 8851 * Return the name of the method being invoked. | 8767 * Return the name of the method being invoked. |
| 8852 * @return the name of the method being invoked | 8768 * @return the name of the method being invoked |
| 8853 */ | 8769 */ |
| 8854 SimpleIdentifier get methodName => _methodName; | 8770 SimpleIdentifier get methodName => _methodName; |
| 8855 | 8771 |
| 8856 /** | 8772 /** |
| 8857 * Return the period that separates the target from the method name, or {@code
null} if there is | 8773 * Return the period that separates the target from the method name, or {@code
null} if there is |
| 8858 * no target. | 8774 * no target. |
| 8859 * @return the period that separates the target from the method name | 8775 * @return the period that separates the target from the method name |
| 8860 */ | 8776 */ |
| 8861 Token get period => _period; | 8777 Token get period => _period; |
| 8862 | 8778 |
| 8863 /** | 8779 /** |
| 8864 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not | 8780 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not |
| 8865 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation | 8781 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation |
| 8866 * is part of a cascade expression, then the target stored with the cascade ex
pression is | 8782 * is part of a cascade expression, then the target stored with the cascade ex
pression is |
| 8867 * returned. | 8783 * returned. |
| 8868 * @return the expression used to compute the receiver of the invocation | 8784 * @return the expression used to compute the receiver of the invocation |
| 8869 * @see #getTarget() | 8785 * @see #getTarget() |
| 8870 */ | 8786 */ |
| 8871 Expression get realTarget { | 8787 Expression get realTarget { |
| 8872 if (isCascaded()) { | 8788 if (isCascaded()) { |
| 8873 ASTNode ancestor = parent; | 8789 ASTNode ancestor = parent; |
| 8874 while (ancestor is! CascadeExpression) { | 8790 while (ancestor is! CascadeExpression) { |
| 8875 if (ancestor == null) { | 8791 if (ancestor == null) { |
| 8876 return _target; | 8792 return _target; |
| 8877 } | 8793 } |
| 8878 ancestor = ancestor.parent; | 8794 ancestor = ancestor.parent; |
| 8879 } | 8795 } |
| 8880 return ((ancestor as CascadeExpression)).target; | 8796 return ((ancestor as CascadeExpression)).target; |
| 8881 } | 8797 } |
| 8882 return _target; | 8798 return _target; |
| 8883 } | 8799 } |
| 8884 | 8800 |
| 8885 /** | 8801 /** |
| 8886 * Return the expression producing the object on which the method is defined,
or {@code null} if | 8802 * Return the expression producing the object on which the method is defined,
or {@code null} if |
| 8887 * there is no target (that is, the target is implicitly {@code this}) or if t
his method | 8803 * there is no target (that is, the target is implicitly {@code this}) or if t
his method |
| 8888 * invocation is part of a cascade expression. | 8804 * invocation is part of a cascade expression. |
| 8889 * @return the expression producing the object on which the method is defined | 8805 * @return the expression producing the object on which the method is defined |
| 8890 * @see #getRealTarget() | 8806 * @see #getRealTarget() |
| 8891 */ | 8807 */ |
| 8892 Expression get target => _target; | 8808 Expression get target => _target; |
| 8893 | 8809 |
| 8894 /** | 8810 /** |
| 8895 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this | 8811 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this |
| 8896 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. | 8812 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. |
| 8897 * @return {@code true} if this expression is cascaded | 8813 * @return {@code true} if this expression is cascaded |
| 8898 */ | 8814 */ |
| 8899 bool isCascaded() => _period != null && identical(_period.type, TokenType.PERI
OD_PERIOD); | 8815 bool isCascaded() => _period != null && identical(_period.type, TokenType.PERI
OD_PERIOD); |
| 8900 | 8816 |
| 8901 /** | 8817 /** |
| 8902 * Set the list of arguments to the method to the given list. | 8818 * Set the list of arguments to the method to the given list. |
| 8903 * @param argumentList the list of arguments to the method | 8819 * @param argumentList the list of arguments to the method |
| 8904 */ | 8820 */ |
| 8905 void set argumentList(ArgumentList argumentList2) { | 8821 void set argumentList(ArgumentList argumentList2) { |
| 8906 this._argumentList = becomeParentOf(argumentList2); | 8822 this._argumentList = becomeParentOf(argumentList2); |
| 8907 } | 8823 } |
| 8908 | 8824 |
| 8909 /** | 8825 /** |
| 8910 * Set the name of the method being invoked to the given identifier. | 8826 * Set the name of the method being invoked to the given identifier. |
| 8911 * @param identifier the name of the method being invoked | 8827 * @param identifier the name of the method being invoked |
| 8912 */ | 8828 */ |
| 8913 void set methodName(SimpleIdentifier identifier) { | 8829 void set methodName(SimpleIdentifier identifier) { |
| 8914 _methodName = becomeParentOf(identifier); | 8830 _methodName = becomeParentOf(identifier); |
| 8915 } | 8831 } |
| 8916 | 8832 |
| 8917 /** | 8833 /** |
| 8918 * Set the period that separates the target from the method name to the given
token. | 8834 * Set the period that separates the target from the method name to the given
token. |
| 8919 * @param period the period that separates the target from the method name | 8835 * @param period the period that separates the target from the method name |
| 8920 */ | 8836 */ |
| 8921 void set period(Token period2) { | 8837 void set period(Token period2) { |
| 8922 this._period = period2; | 8838 this._period = period2; |
| 8923 } | 8839 } |
| 8924 | 8840 |
| 8925 /** | 8841 /** |
| 8926 * Set the expression producing the object on which the method is defined to t
he given expression. | 8842 * Set the expression producing the object on which the method is defined to t
he given expression. |
| 8927 * @param expression the expression producing the object on which the method i
s defined | 8843 * @param expression the expression producing the object on which the method i
s defined |
| 8928 */ | 8844 */ |
| 8929 void set target(Expression expression) { | 8845 void set target(Expression expression) { |
| 8930 _target = becomeParentOf(expression); | 8846 _target = becomeParentOf(expression); |
| 8931 } | 8847 } |
| 8932 void visitChildren(ASTVisitor<Object> visitor) { | 8848 void visitChildren(ASTVisitor<Object> visitor) { |
| 8933 safelyVisitChild(_target, visitor); | 8849 safelyVisitChild(_target, visitor); |
| 8934 safelyVisitChild(_methodName, visitor); | 8850 safelyVisitChild(_methodName, visitor); |
| 8935 safelyVisitChild(_argumentList, visitor); | 8851 safelyVisitChild(_argumentList, visitor); |
| 8936 } | 8852 } |
| 8937 } | 8853 } |
| 8938 | |
| 8939 /** | 8854 /** |
| 8940 * Instances of the class {@code NamedExpression} represent an expression that h
as a name associated | 8855 * Instances of the class {@code NamedExpression} represent an expression that h
as a name associated |
| 8941 * with it. They are used in method invocations when there are named parameters. | 8856 * with it. They are used in method invocations when there are named parameters. |
| 8942 * <pre> | 8857 * <pre> |
| 8943 * namedExpression ::={@link Label name} {@link Expression expression}</pre> | 8858 * namedExpression ::={@link Label name} {@link Expression expression}</pre> |
| 8944 * @coverage dart.engine.ast | 8859 * @coverage dart.engine.ast |
| 8945 */ | 8860 */ |
| 8946 class NamedExpression extends Expression { | 8861 class NamedExpression extends Expression { |
| 8947 | 8862 |
| 8948 /** | 8863 /** |
| 8949 * The name associated with the expression. | 8864 * The name associated with the expression. |
| 8950 */ | 8865 */ |
| 8951 Label _name; | 8866 Label _name; |
| 8952 | 8867 |
| 8953 /** | 8868 /** |
| 8954 * The expression with which the name is associated. | 8869 * The expression with which the name is associated. |
| 8955 */ | 8870 */ |
| 8956 Expression _expression; | 8871 Expression _expression; |
| 8957 | 8872 |
| 8958 /** | 8873 /** |
| 8959 * Initialize a newly created named expression. | 8874 * Initialize a newly created named expression. |
| 8960 * @param name the name associated with the expression | 8875 * @param name the name associated with the expression |
| 8961 * @param expression the expression with which the name is associated | 8876 * @param expression the expression with which the name is associated |
| 8962 */ | 8877 */ |
| 8963 NamedExpression.full(Label name, Expression expression) { | 8878 NamedExpression.full(Label name, Expression expression) { |
| 8964 this._name = becomeParentOf(name); | 8879 this._name = becomeParentOf(name); |
| 8965 this._expression = becomeParentOf(expression); | 8880 this._expression = becomeParentOf(expression); |
| 8966 } | 8881 } |
| 8967 | 8882 |
| 8968 /** | 8883 /** |
| 8969 * Initialize a newly created named expression. | 8884 * Initialize a newly created named expression. |
| 8970 * @param name the name associated with the expression | 8885 * @param name the name associated with the expression |
| 8971 * @param expression the expression with which the name is associated | 8886 * @param expression the expression with which the name is associated |
| 8972 */ | 8887 */ |
| 8973 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); | 8888 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); |
| 8974 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); | 8889 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); |
| 8975 Token get beginToken => _name.beginToken; | 8890 Token get beginToken => _name.beginToken; |
| 8976 | 8891 |
| 8977 /** | 8892 /** |
| 8978 * 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 | 8893 * 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 |
| 8979 * this expression. | 8894 * this expression. |
| 8980 * @return the element representing the parameter being named by this expressi
on | 8895 * @return the element representing the parameter being named by this expressi
on |
| 8981 */ | 8896 */ |
| 8982 ParameterElement get element { | 8897 ParameterElement get element { |
| 8983 Element element2 = _name.label.element; | 8898 Element element2 = _name.label.element; |
| 8984 if (element2 is ParameterElement) { | 8899 if (element2 is ParameterElement) { |
| 8985 return element2 as ParameterElement; | 8900 return element2 as ParameterElement; |
| 8986 } | 8901 } |
| 8987 return null; | 8902 return null; |
| 8988 } | 8903 } |
| 8989 Token get endToken => _expression.endToken; | 8904 Token get endToken => _expression.endToken; |
| 8990 | 8905 |
| 8991 /** | 8906 /** |
| 8992 * Return the expression with which the name is associated. | 8907 * Return the expression with which the name is associated. |
| 8993 * @return the expression with which the name is associated | 8908 * @return the expression with which the name is associated |
| 8994 */ | 8909 */ |
| 8995 Expression get expression => _expression; | 8910 Expression get expression => _expression; |
| 8996 | 8911 |
| 8997 /** | 8912 /** |
| 8998 * Return the name associated with the expression. | 8913 * Return the name associated with the expression. |
| 8999 * @return the name associated with the expression | 8914 * @return the name associated with the expression |
| 9000 */ | 8915 */ |
| 9001 Label get name => _name; | 8916 Label get name => _name; |
| 9002 | 8917 |
| 9003 /** | 8918 /** |
| 9004 * Set the expression with which the name is associated to the given expressio
n. | 8919 * Set the expression with which the name is associated to the given expressio
n. |
| 9005 * @param expression the expression with which the name is associated | 8920 * @param expression the expression with which the name is associated |
| 9006 */ | 8921 */ |
| 9007 void set expression(Expression expression2) { | 8922 void set expression(Expression expression2) { |
| 9008 this._expression = becomeParentOf(expression2); | 8923 this._expression = becomeParentOf(expression2); |
| 9009 } | 8924 } |
| 9010 | 8925 |
| 9011 /** | 8926 /** |
| 9012 * Set the name associated with the expression to the given identifier. | 8927 * Set the name associated with the expression to the given identifier. |
| 9013 * @param identifier the name associated with the expression | 8928 * @param identifier the name associated with the expression |
| 9014 */ | 8929 */ |
| 9015 void set name(Label identifier) { | 8930 void set name(Label identifier) { |
| 9016 _name = becomeParentOf(identifier); | 8931 _name = becomeParentOf(identifier); |
| 9017 } | 8932 } |
| 9018 void visitChildren(ASTVisitor<Object> visitor) { | 8933 void visitChildren(ASTVisitor<Object> visitor) { |
| 9019 safelyVisitChild(_name, visitor); | 8934 safelyVisitChild(_name, visitor); |
| 9020 safelyVisitChild(_expression, visitor); | 8935 safelyVisitChild(_expression, visitor); |
| 9021 } | 8936 } |
| 9022 } | 8937 } |
| 9023 | |
| 9024 /** | 8938 /** |
| 9025 * The abstract class {@code NamespaceDirective} defines the behavior common to
nodes that represent | 8939 * The abstract class {@code NamespaceDirective} defines the behavior common to
nodes that represent |
| 9026 * a directive that impacts the namespace of a library. | 8940 * a directive that impacts the namespace of a library. |
| 9027 * <pre> | 8941 * <pre> |
| 9028 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}</pre> | 8942 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}</pre> |
| 9029 * @coverage dart.engine.ast | 8943 * @coverage dart.engine.ast |
| 9030 */ | 8944 */ |
| 9031 abstract class NamespaceDirective extends UriBasedDirective { | 8945 abstract class NamespaceDirective extends UriBasedDirective { |
| 9032 | 8946 |
| 9033 /** | 8947 /** |
| 9034 * The token representing the 'import' or 'export' keyword. | 8948 * The token representing the 'import' or 'export' keyword. |
| 9035 */ | 8949 */ |
| 9036 Token _keyword; | 8950 Token _keyword; |
| 9037 | 8951 |
| 9038 /** | 8952 /** |
| 9039 * The combinators used to control which names are imported or exported. | 8953 * The combinators used to control which names are imported or exported. |
| 9040 */ | 8954 */ |
| 9041 NodeList<Combinator> _combinators; | 8955 NodeList<Combinator> _combinators; |
| 9042 | 8956 |
| 9043 /** | 8957 /** |
| 9044 * The semicolon terminating the directive. | 8958 * The semicolon terminating the directive. |
| 9045 */ | 8959 */ |
| 9046 Token _semicolon; | 8960 Token _semicolon; |
| 9047 | 8961 |
| 9048 /** | 8962 /** |
| 9049 * Initialize a newly created namespace directive. | 8963 * Initialize a newly created namespace directive. |
| 9050 * @param comment the documentation comment associated with this directive | 8964 * @param comment the documentation comment associated with this directive |
| 9051 * @param metadata the annotations associated with the directive | 8965 * @param metadata the annotations associated with the directive |
| 9052 * @param keyword the token representing the 'import' or 'export' keyword | 8966 * @param keyword the token representing the 'import' or 'export' keyword |
| 9053 * @param libraryUri the URI of the library being imported or exported | 8967 * @param libraryUri the URI of the library being imported or exported |
| 9054 * @param combinators the combinators used to control which names are imported
or exported | 8968 * @param combinators the combinators used to control which names are imported
or exported |
| 9055 * @param semicolon the semicolon terminating the directive | 8969 * @param semicolon the semicolon terminating the directive |
| 9056 */ | 8970 */ |
| 9057 NamespaceDirective.full(Comment comment, List<Annotation> metadata, Token keyw
ord, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) :
super.full(comment, metadata, libraryUri) { | 8971 NamespaceDirective.full(Comment comment, List<Annotation> metadata, Token keyw
ord, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) :
super.full(comment, metadata, libraryUri) { |
| 9058 this._combinators = new NodeList<Combinator>(this); | 8972 this._combinators = new NodeList<Combinator>(this); |
| 9059 this._keyword = keyword; | 8973 this._keyword = keyword; |
| 9060 this._combinators.addAll(combinators); | 8974 this._combinators.addAll(combinators); |
| 9061 this._semicolon = semicolon; | 8975 this._semicolon = semicolon; |
| 9062 } | 8976 } |
| 9063 | 8977 |
| 9064 /** | 8978 /** |
| 9065 * Initialize a newly created namespace directive. | 8979 * Initialize a newly created namespace directive. |
| 9066 * @param comment the documentation comment associated with this directive | 8980 * @param comment the documentation comment associated with this directive |
| 9067 * @param metadata the annotations associated with the directive | 8981 * @param metadata the annotations associated with the directive |
| 9068 * @param keyword the token representing the 'import' or 'export' keyword | 8982 * @param keyword the token representing the 'import' or 'export' keyword |
| 9069 * @param libraryUri the URI of the library being imported or exported | 8983 * @param libraryUri the URI of the library being imported or exported |
| 9070 * @param combinators the combinators used to control which names are imported
or exported | 8984 * @param combinators the combinators used to control which names are imported
or exported |
| 9071 * @param semicolon the semicolon terminating the directive | 8985 * @param semicolon the semicolon terminating the directive |
| 9072 */ | 8986 */ |
| 9073 NamespaceDirective({Comment comment, List<Annotation> metadata, Token keyword,
StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : thi
s.full(comment, metadata, keyword, libraryUri, combinators, semicolon); | 8987 NamespaceDirective({Comment comment, List<Annotation> metadata, Token keyword,
StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : thi
s.full(comment, metadata, keyword, libraryUri, combinators, semicolon); |
| 9074 | 8988 |
| 9075 /** | 8989 /** |
| 9076 * Return the combinators used to control how names are imported or exported. | 8990 * Return the combinators used to control how names are imported or exported. |
| 9077 * @return the combinators used to control how names are imported or exported | 8991 * @return the combinators used to control how names are imported or exported |
| 9078 */ | 8992 */ |
| 9079 NodeList<Combinator> get combinators => _combinators; | 8993 NodeList<Combinator> get combinators => _combinators; |
| 9080 Token get endToken => _semicolon; | 8994 Token get endToken => _semicolon; |
| 9081 Token get keyword => _keyword; | 8995 Token get keyword => _keyword; |
| 9082 | 8996 |
| 9083 /** | 8997 /** |
| 9084 * Return the semicolon terminating the directive. | 8998 * Return the semicolon terminating the directive. |
| 9085 * @return the semicolon terminating the directive | 8999 * @return the semicolon terminating the directive |
| 9086 */ | 9000 */ |
| 9087 Token get semicolon => _semicolon; | 9001 Token get semicolon => _semicolon; |
| 9088 LibraryElement get uriElement; | 9002 LibraryElement get uriElement; |
| 9089 | 9003 |
| 9090 /** | 9004 /** |
| 9091 * Set the token representing the 'import' or 'export' keyword to the given to
ken. | 9005 * Set the token representing the 'import' or 'export' keyword to the given to
ken. |
| 9092 * @param exportToken the token representing the 'import' or 'export' keyword | 9006 * @param exportToken the token representing the 'import' or 'export' keyword |
| 9093 */ | 9007 */ |
| 9094 void set keyword(Token exportToken) { | 9008 void set keyword(Token exportToken) { |
| 9095 this._keyword = exportToken; | 9009 this._keyword = exportToken; |
| 9096 } | 9010 } |
| 9097 | 9011 |
| 9098 /** | 9012 /** |
| 9099 * Set the semicolon terminating the directive to the given token. | 9013 * Set the semicolon terminating the directive to the given token. |
| 9100 * @param semicolon the semicolon terminating the directive | 9014 * @param semicolon the semicolon terminating the directive |
| 9101 */ | 9015 */ |
| 9102 void set semicolon(Token semicolon2) { | 9016 void set semicolon(Token semicolon2) { |
| 9103 this._semicolon = semicolon2; | 9017 this._semicolon = semicolon2; |
| 9104 } | 9018 } |
| 9105 Token get firstTokenAfterCommentAndMetadata => _keyword; | 9019 Token get firstTokenAfterCommentAndMetadata => _keyword; |
| 9106 } | 9020 } |
| 9107 | |
| 9108 /** | 9021 /** |
| 9109 * Instances of the class {@code NativeFunctionBody} represent a function body t
hat consists of a | 9022 * Instances of the class {@code NativeFunctionBody} represent a function body t
hat consists of a |
| 9110 * native keyword followed by a string literal. | 9023 * native keyword followed by a string literal. |
| 9111 * <pre> | 9024 * <pre> |
| 9112 * nativeFunctionBody ::= | 9025 * nativeFunctionBody ::= |
| 9113 * 'native' {@link SimpleStringLiteral simpleStringLiteral} ';' | 9026 * 'native' {@link SimpleStringLiteral simpleStringLiteral} ';' |
| 9114 * </pre> | 9027 * </pre> |
| 9115 * @coverage dart.engine.ast | 9028 * @coverage dart.engine.ast |
| 9116 */ | 9029 */ |
| 9117 class NativeFunctionBody extends FunctionBody { | 9030 class NativeFunctionBody extends FunctionBody { |
| 9118 | 9031 |
| 9119 /** | 9032 /** |
| 9120 * The token representing 'native' that marks the start of the function body. | 9033 * The token representing 'native' that marks the start of the function body. |
| 9121 */ | 9034 */ |
| 9122 Token _nativeToken; | 9035 Token _nativeToken; |
| 9123 | 9036 |
| 9124 /** | 9037 /** |
| 9125 * The string literal, after the 'native' token. | 9038 * The string literal, after the 'native' token. |
| 9126 */ | 9039 */ |
| 9127 StringLiteral _stringLiteral; | 9040 StringLiteral _stringLiteral; |
| 9128 | 9041 |
| 9129 /** | 9042 /** |
| 9130 * The token representing the semicolon that marks the end of the function bod
y. | 9043 * The token representing the semicolon that marks the end of the function bod
y. |
| 9131 */ | 9044 */ |
| 9132 Token _semicolon; | 9045 Token _semicolon; |
| 9133 | 9046 |
| 9134 /** | 9047 /** |
| 9135 * Initialize a newly created function body consisting of the 'native' token,
a string literal, | 9048 * Initialize a newly created function body consisting of the 'native' token,
a string literal, |
| 9136 * and a semicolon. | 9049 * and a semicolon. |
| 9137 * @param nativeToken the token representing 'native' that marks the start of
the function body | 9050 * @param nativeToken the token representing 'native' that marks the start of
the function body |
| 9138 * @param stringLiteral the string literal | 9051 * @param stringLiteral the string literal |
| 9139 * @param semicolon the token representing the semicolon that marks the end of
the function body | 9052 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 9140 */ | 9053 */ |
| 9141 NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token
semicolon) { | 9054 NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token
semicolon) { |
| 9142 this._nativeToken = nativeToken; | 9055 this._nativeToken = nativeToken; |
| 9143 this._stringLiteral = becomeParentOf(stringLiteral); | 9056 this._stringLiteral = becomeParentOf(stringLiteral); |
| 9144 this._semicolon = semicolon; | 9057 this._semicolon = semicolon; |
| 9145 } | 9058 } |
| 9146 | 9059 |
| 9147 /** | 9060 /** |
| 9148 * Initialize a newly created function body consisting of the 'native' token,
a string literal, | 9061 * Initialize a newly created function body consisting of the 'native' token,
a string literal, |
| 9149 * and a semicolon. | 9062 * and a semicolon. |
| 9150 * @param nativeToken the token representing 'native' that marks the start of
the function body | 9063 * @param nativeToken the token representing 'native' that marks the start of
the function body |
| 9151 * @param stringLiteral the string literal | 9064 * @param stringLiteral the string literal |
| 9152 * @param semicolon the token representing the semicolon that marks the end of
the function body | 9065 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 9153 */ | 9066 */ |
| 9154 NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semi
colon}) : this.full(nativeToken, stringLiteral, semicolon); | 9067 NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semi
colon}) : this.full(nativeToken, stringLiteral, semicolon); |
| 9155 accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this); | 9068 accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this); |
| 9156 Token get beginToken => _nativeToken; | 9069 Token get beginToken => _nativeToken; |
| 9157 Token get endToken => _semicolon; | 9070 Token get endToken => _semicolon; |
| 9158 | 9071 |
| 9159 /** | 9072 /** |
| 9160 * Return the simple identifier representing the 'native' token. | 9073 * Return the simple identifier representing the 'native' token. |
| 9161 * @return the simple identifier representing the 'native' token | 9074 * @return the simple identifier representing the 'native' token |
| 9162 */ | 9075 */ |
| 9163 Token get nativeToken => _nativeToken; | 9076 Token get nativeToken => _nativeToken; |
| 9164 | 9077 |
| 9165 /** | 9078 /** |
| 9166 * Return the token representing the semicolon that marks the end of the funct
ion body. | 9079 * Return the token representing the semicolon that marks the end of the funct
ion body. |
| 9167 * @return the token representing the semicolon that marks the end of the func
tion body | 9080 * @return the token representing the semicolon that marks the end of the func
tion body |
| 9168 */ | 9081 */ |
| 9169 Token get semicolon => _semicolon; | 9082 Token get semicolon => _semicolon; |
| 9170 | 9083 |
| 9171 /** | 9084 /** |
| 9172 * Return the string literal representing the string after the 'native' token. | 9085 * Return the string literal representing the string after the 'native' token. |
| 9173 * @return the string literal representing the string after the 'native' token | 9086 * @return the string literal representing the string after the 'native' token |
| 9174 */ | 9087 */ |
| 9175 StringLiteral get stringLiteral => _stringLiteral; | 9088 StringLiteral get stringLiteral => _stringLiteral; |
| 9176 void visitChildren(ASTVisitor<Object> visitor) { | 9089 void visitChildren(ASTVisitor<Object> visitor) { |
| 9177 safelyVisitChild(_stringLiteral, visitor); | 9090 safelyVisitChild(_stringLiteral, visitor); |
| 9178 } | 9091 } |
| 9179 } | 9092 } |
| 9180 | |
| 9181 /** | 9093 /** |
| 9182 * The abstract class {@code NormalFormalParameter} defines the behavior common
to formal parameters | 9094 * The abstract class {@code NormalFormalParameter} defines the behavior common
to formal parameters |
| 9183 * that are required (are not optional). | 9095 * that are required (are not optional). |
| 9184 * <pre> | 9096 * <pre> |
| 9185 * normalFormalParameter ::={@link FunctionTypedFormalParameter functionSignatur
e}| {@link FieldFormalParameter fieldFormalParameter}| {@link SimpleFormalParame
ter simpleFormalParameter}</pre> | 9097 * normalFormalParameter ::={@link FunctionTypedFormalParameter functionSignatur
e}| {@link FieldFormalParameter fieldFormalParameter}| {@link SimpleFormalParame
ter simpleFormalParameter}</pre> |
| 9186 * @coverage dart.engine.ast | 9098 * @coverage dart.engine.ast |
| 9187 */ | 9099 */ |
| 9188 abstract class NormalFormalParameter extends FormalParameter { | 9100 abstract class NormalFormalParameter extends FormalParameter { |
| 9189 | 9101 |
| 9190 /** | 9102 /** |
| 9191 * The documentation comment associated with this parameter, or {@code null} i
f this parameter | 9103 * The documentation comment associated with this parameter, or {@code null} i
f this parameter |
| 9192 * does not have a documentation comment associated with it. | 9104 * does not have a documentation comment associated with it. |
| 9193 */ | 9105 */ |
| 9194 Comment _comment; | 9106 Comment _comment; |
| 9195 | 9107 |
| 9196 /** | 9108 /** |
| 9197 * The annotations associated with this parameter. | 9109 * The annotations associated with this parameter. |
| 9198 */ | 9110 */ |
| 9199 NodeList<Annotation> _metadata; | 9111 NodeList<Annotation> _metadata; |
| 9200 | 9112 |
| 9201 /** | 9113 /** |
| 9202 * The name of the parameter being declared. | 9114 * The name of the parameter being declared. |
| 9203 */ | 9115 */ |
| 9204 SimpleIdentifier _identifier; | 9116 SimpleIdentifier _identifier; |
| 9205 | 9117 |
| 9206 /** | 9118 /** |
| 9207 * Initialize a newly created formal parameter. | 9119 * Initialize a newly created formal parameter. |
| 9208 * @param comment the documentation comment associated with this parameter | 9120 * @param comment the documentation comment associated with this parameter |
| 9209 * @param metadata the annotations associated with this parameter | 9121 * @param metadata the annotations associated with this parameter |
| 9210 * @param identifier the name of the parameter being declared | 9122 * @param identifier the name of the parameter being declared |
| 9211 */ | 9123 */ |
| 9212 NormalFormalParameter.full(Comment comment, List<Annotation> metadata, SimpleI
dentifier identifier) { | 9124 NormalFormalParameter.full(Comment comment, List<Annotation> metadata, SimpleI
dentifier identifier) { |
| 9213 this._metadata = new NodeList<Annotation>(this); | 9125 this._metadata = new NodeList<Annotation>(this); |
| 9214 this._comment = becomeParentOf(comment); | 9126 this._comment = becomeParentOf(comment); |
| 9215 this._metadata.addAll(metadata); | 9127 this._metadata.addAll(metadata); |
| 9216 this._identifier = becomeParentOf(identifier); | 9128 this._identifier = becomeParentOf(identifier); |
| 9217 } | 9129 } |
| 9218 | 9130 |
| 9219 /** | 9131 /** |
| 9220 * Initialize a newly created formal parameter. | 9132 * Initialize a newly created formal parameter. |
| 9221 * @param comment the documentation comment associated with this parameter | 9133 * @param comment the documentation comment associated with this parameter |
| 9222 * @param metadata the annotations associated with this parameter | 9134 * @param metadata the annotations associated with this parameter |
| 9223 * @param identifier the name of the parameter being declared | 9135 * @param identifier the name of the parameter being declared |
| 9224 */ | 9136 */ |
| 9225 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); | 9137 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); |
| 9226 | 9138 |
| 9227 /** | 9139 /** |
| 9228 * Return the documentation comment associated with this parameter, or {@code
null} if this | 9140 * Return the documentation comment associated with this parameter, or {@code
null} if this |
| 9229 * parameter does not have a documentation comment associated with it. | 9141 * parameter does not have a documentation comment associated with it. |
| 9230 * @return the documentation comment associated with this parameter | 9142 * @return the documentation comment associated with this parameter |
| 9231 */ | 9143 */ |
| 9232 Comment get documentationComment => _comment; | 9144 Comment get documentationComment => _comment; |
| 9233 SimpleIdentifier get identifier => _identifier; | 9145 SimpleIdentifier get identifier => _identifier; |
| 9234 ParameterKind get kind { | 9146 ParameterKind get kind { |
| 9235 ASTNode parent2 = parent; | 9147 ASTNode parent2 = parent; |
| 9236 if (parent2 is DefaultFormalParameter) { | 9148 if (parent2 is DefaultFormalParameter) { |
| 9237 return ((parent2 as DefaultFormalParameter)).kind; | 9149 return ((parent2 as DefaultFormalParameter)).kind; |
| 9238 } | 9150 } |
| 9239 return ParameterKind.REQUIRED; | 9151 return ParameterKind.REQUIRED; |
| 9240 } | 9152 } |
| 9241 | 9153 |
| 9242 /** | 9154 /** |
| 9243 * Return the annotations associated with this parameter. | 9155 * Return the annotations associated with this parameter. |
| 9244 * @return the annotations associated with this parameter | 9156 * @return the annotations associated with this parameter |
| 9245 */ | 9157 */ |
| 9246 NodeList<Annotation> get metadata => _metadata; | 9158 NodeList<Annotation> get metadata => _metadata; |
| 9247 | 9159 |
| 9248 /** | 9160 /** |
| 9249 * Return {@code true} if this parameter was declared with the 'const' modifie
r. | 9161 * Return {@code true} if this parameter was declared with the 'const' modifie
r. |
| 9250 * @return {@code true} if this parameter was declared with the 'const' modifi
er | 9162 * @return {@code true} if this parameter was declared with the 'const' modifi
er |
| 9251 */ | 9163 */ |
| 9252 bool isConst(); | 9164 bool isConst(); |
| 9253 | 9165 |
| 9254 /** | 9166 /** |
| 9255 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that | 9167 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that |
| 9256 * are declared with the 'const' modifier will return {@code false} even thoug
h they are | 9168 * are declared with the 'const' modifier will return {@code false} even thoug
h they are |
| 9257 * implicitly final. | 9169 * implicitly final. |
| 9258 * @return {@code true} if this parameter was declared with the 'final' modifi
er | 9170 * @return {@code true} if this parameter was declared with the 'final' modifi
er |
| 9259 */ | 9171 */ |
| 9260 bool isFinal(); | 9172 bool isFinal(); |
| 9261 | 9173 |
| 9262 /** | 9174 /** |
| 9263 * Set the documentation comment associated with this parameter to the given c
omment | 9175 * Set the documentation comment associated with this parameter to the given c
omment |
| 9264 * @param comment the documentation comment to be associated with this paramet
er | 9176 * @param comment the documentation comment to be associated with this paramet
er |
| 9265 */ | 9177 */ |
| 9266 void set documentationComment(Comment comment2) { | 9178 void set documentationComment(Comment comment2) { |
| 9267 this._comment = becomeParentOf(comment2); | 9179 this._comment = becomeParentOf(comment2); |
| 9268 } | 9180 } |
| 9269 | 9181 |
| 9270 /** | 9182 /** |
| 9271 * Set the name of the parameter being declared to the given identifier. | 9183 * Set the name of the parameter being declared to the given identifier. |
| 9272 * @param identifier the name of the parameter being declared | 9184 * @param identifier the name of the parameter being declared |
| 9273 */ | 9185 */ |
| 9274 void set identifier(SimpleIdentifier identifier2) { | 9186 void set identifier(SimpleIdentifier identifier2) { |
| 9275 this._identifier = becomeParentOf(identifier2); | 9187 this._identifier = becomeParentOf(identifier2); |
| 9276 } | 9188 } |
| 9277 void visitChildren(ASTVisitor<Object> visitor) { | 9189 void visitChildren(ASTVisitor<Object> visitor) { |
| 9278 if (commentIsBeforeAnnotations()) { | 9190 if (commentIsBeforeAnnotations()) { |
| 9279 safelyVisitChild(_comment, visitor); | 9191 safelyVisitChild(_comment, visitor); |
| 9280 _metadata.accept(visitor); | 9192 _metadata.accept(visitor); |
| 9281 } else { | 9193 } else { |
| 9282 for (ASTNode child in sortedCommentAndAnnotations) { | 9194 for (ASTNode child in sortedCommentAndAnnotations) { |
| 9283 child.accept(visitor); | 9195 child.accept(visitor); |
| 9284 } | 9196 } |
| 9285 } | 9197 } |
| 9286 } | 9198 } |
| 9287 | 9199 |
| 9288 /** | 9200 /** |
| 9289 * Return {@code true} if the comment is lexically before any annotations. | 9201 * Return {@code true} if the comment is lexically before any annotations. |
| 9290 * @return {@code true} if the comment is lexically before any annotations | 9202 * @return {@code true} if the comment is lexically before any annotations |
| 9291 */ | 9203 */ |
| 9292 bool commentIsBeforeAnnotations() { | 9204 bool commentIsBeforeAnnotations() { |
| 9293 if (_comment == null || _metadata.isEmpty) { | 9205 if (_comment == null || _metadata.isEmpty) { |
| 9294 return true; | 9206 return true; |
| 9295 } | 9207 } |
| 9296 Annotation firstAnnotation = _metadata[0]; | 9208 Annotation firstAnnotation = _metadata[0]; |
| 9297 return _comment.offset < firstAnnotation.offset; | 9209 return _comment.offset < firstAnnotation.offset; |
| 9298 } | 9210 } |
| 9299 | 9211 |
| 9300 /** | 9212 /** |
| 9301 * Return an array containing the comment and annotations associated with this
parameter, sorted | 9213 * Return an array containing the comment and annotations associated with this
parameter, sorted |
| 9302 * in lexical order. | 9214 * in lexical order. |
| 9303 * @return the comment and annotations associated with this parameter in the o
rder in which they | 9215 * @return the comment and annotations associated with this parameter in the o
rder in which they |
| 9304 * appeared in the original source | 9216 * appeared in the original source |
| 9305 */ | 9217 */ |
| 9306 List<ASTNode> get sortedCommentAndAnnotations { | 9218 List<ASTNode> get sortedCommentAndAnnotations { |
| 9307 List<ASTNode> childList = new List<ASTNode>(); | 9219 List<ASTNode> childList = new List<ASTNode>(); |
| 9308 childList.add(_comment); | 9220 childList.add(_comment); |
| 9309 childList.addAll(_metadata); | 9221 childList.addAll(_metadata); |
| 9310 List<ASTNode> children = new List.from(childList); | 9222 List<ASTNode> children = new List.from(childList); |
| 9311 children.sort(); | 9223 children.sort(); |
| 9312 return children; | 9224 return children; |
| 9313 } | 9225 } |
| 9314 } | 9226 } |
| 9315 | |
| 9316 /** | 9227 /** |
| 9317 * Instances of the class {@code NullLiteral} represent a null literal expressio
n. | 9228 * Instances of the class {@code NullLiteral} represent a null literal expressio
n. |
| 9318 * <pre> | 9229 * <pre> |
| 9319 * nullLiteral ::= | 9230 * nullLiteral ::= |
| 9320 * 'null' | 9231 * 'null' |
| 9321 * </pre> | 9232 * </pre> |
| 9322 * @coverage dart.engine.ast | 9233 * @coverage dart.engine.ast |
| 9323 */ | 9234 */ |
| 9324 class NullLiteral extends Literal { | 9235 class NullLiteral extends Literal { |
| 9325 | 9236 |
| 9326 /** | 9237 /** |
| 9327 * The token representing the literal. | 9238 * The token representing the literal. |
| 9328 */ | 9239 */ |
| 9329 Token _literal; | 9240 Token _literal; |
| 9330 | 9241 |
| 9331 /** | 9242 /** |
| 9332 * Initialize a newly created null literal. | 9243 * Initialize a newly created null literal. |
| 9333 * @param token the token representing the literal | 9244 * @param token the token representing the literal |
| 9334 */ | 9245 */ |
| 9335 NullLiteral.full(Token token) { | 9246 NullLiteral.full(Token token) { |
| 9336 this._literal = token; | 9247 this._literal = token; |
| 9337 } | 9248 } |
| 9338 | 9249 |
| 9339 /** | 9250 /** |
| 9340 * Initialize a newly created null literal. | 9251 * Initialize a newly created null literal. |
| 9341 * @param token the token representing the literal | 9252 * @param token the token representing the literal |
| 9342 */ | 9253 */ |
| 9343 NullLiteral({Token token}) : this.full(token); | 9254 NullLiteral({Token token}) : this.full(token); |
| 9344 accept(ASTVisitor visitor) => visitor.visitNullLiteral(this); | 9255 accept(ASTVisitor visitor) => visitor.visitNullLiteral(this); |
| 9345 Token get beginToken => _literal; | 9256 Token get beginToken => _literal; |
| 9346 Token get endToken => _literal; | 9257 Token get endToken => _literal; |
| 9347 | 9258 |
| 9348 /** | 9259 /** |
| 9349 * Return the token representing the literal. | 9260 * Return the token representing the literal. |
| 9350 * @return the token representing the literal | 9261 * @return the token representing the literal |
| 9351 */ | 9262 */ |
| 9352 Token get literal => _literal; | 9263 Token get literal => _literal; |
| 9353 | 9264 |
| 9354 /** | 9265 /** |
| 9355 * Set the token representing the literal to the given token. | 9266 * Set the token representing the literal to the given token. |
| 9356 * @param literal the token representing the literal | 9267 * @param literal the token representing the literal |
| 9357 */ | 9268 */ |
| 9358 void set literal(Token literal2) { | 9269 void set literal(Token literal2) { |
| 9359 this._literal = literal2; | 9270 this._literal = literal2; |
| 9360 } | 9271 } |
| 9361 void visitChildren(ASTVisitor<Object> visitor) { | 9272 void visitChildren(ASTVisitor<Object> visitor) { |
| 9362 } | 9273 } |
| 9363 } | 9274 } |
| 9364 | |
| 9365 /** | 9275 /** |
| 9366 * Instances of the class {@code ParenthesizedExpression} represent a parenthesi
zed expression. | 9276 * Instances of the class {@code ParenthesizedExpression} represent a parenthesi
zed expression. |
| 9367 * <pre> | 9277 * <pre> |
| 9368 * parenthesizedExpression ::= | 9278 * parenthesizedExpression ::= |
| 9369 * '(' {@link Expression expression} ')' | 9279 * '(' {@link Expression expression} ')' |
| 9370 * </pre> | 9280 * </pre> |
| 9371 * @coverage dart.engine.ast | 9281 * @coverage dart.engine.ast |
| 9372 */ | 9282 */ |
| 9373 class ParenthesizedExpression extends Expression { | 9283 class ParenthesizedExpression extends Expression { |
| 9374 | 9284 |
| 9375 /** | 9285 /** |
| 9376 * The left parenthesis. | 9286 * The left parenthesis. |
| 9377 */ | 9287 */ |
| 9378 Token _leftParenthesis; | 9288 Token _leftParenthesis; |
| 9379 | 9289 |
| 9380 /** | 9290 /** |
| 9381 * The expression within the parentheses. | 9291 * The expression within the parentheses. |
| 9382 */ | 9292 */ |
| 9383 Expression _expression; | 9293 Expression _expression; |
| 9384 | 9294 |
| 9385 /** | 9295 /** |
| 9386 * The right parenthesis. | 9296 * The right parenthesis. |
| 9387 */ | 9297 */ |
| 9388 Token _rightParenthesis; | 9298 Token _rightParenthesis; |
| 9389 | 9299 |
| 9390 /** | 9300 /** |
| 9391 * Initialize a newly created parenthesized expression. | 9301 * Initialize a newly created parenthesized expression. |
| 9392 * @param leftParenthesis the left parenthesis | 9302 * @param leftParenthesis the left parenthesis |
| 9393 * @param expression the expression within the parentheses | 9303 * @param expression the expression within the parentheses |
| 9394 * @param rightParenthesis the right parenthesis | 9304 * @param rightParenthesis the right parenthesis |
| 9395 */ | 9305 */ |
| 9396 ParenthesizedExpression.full(Token leftParenthesis, Expression expression, Tok
en rightParenthesis) { | 9306 ParenthesizedExpression.full(Token leftParenthesis, Expression expression, Tok
en rightParenthesis) { |
| 9397 this._leftParenthesis = leftParenthesis; | 9307 this._leftParenthesis = leftParenthesis; |
| 9398 this._expression = becomeParentOf(expression); | 9308 this._expression = becomeParentOf(expression); |
| 9399 this._rightParenthesis = rightParenthesis; | 9309 this._rightParenthesis = rightParenthesis; |
| 9400 } | 9310 } |
| 9401 | 9311 |
| 9402 /** | 9312 /** |
| 9403 * Initialize a newly created parenthesized expression. | 9313 * Initialize a newly created parenthesized expression. |
| 9404 * @param leftParenthesis the left parenthesis | 9314 * @param leftParenthesis the left parenthesis |
| 9405 * @param expression the expression within the parentheses | 9315 * @param expression the expression within the parentheses |
| 9406 * @param rightParenthesis the right parenthesis | 9316 * @param rightParenthesis the right parenthesis |
| 9407 */ | 9317 */ |
| 9408 ParenthesizedExpression({Token leftParenthesis, Expression expression, Token r
ightParenthesis}) : this.full(leftParenthesis, expression, rightParenthesis); | 9318 ParenthesizedExpression({Token leftParenthesis, Expression expression, Token r
ightParenthesis}) : this.full(leftParenthesis, expression, rightParenthesis); |
| 9409 accept(ASTVisitor visitor) => visitor.visitParenthesizedExpression(this); | 9319 accept(ASTVisitor visitor) => visitor.visitParenthesizedExpression(this); |
| 9410 Token get beginToken => _leftParenthesis; | 9320 Token get beginToken => _leftParenthesis; |
| 9411 Token get endToken => _rightParenthesis; | 9321 Token get endToken => _rightParenthesis; |
| 9412 | 9322 |
| 9413 /** | 9323 /** |
| 9414 * Return the expression within the parentheses. | 9324 * Return the expression within the parentheses. |
| 9415 * @return the expression within the parentheses | 9325 * @return the expression within the parentheses |
| 9416 */ | 9326 */ |
| 9417 Expression get expression => _expression; | 9327 Expression get expression => _expression; |
| 9418 | 9328 |
| 9419 /** | 9329 /** |
| 9420 * Return the left parenthesis. | 9330 * Return the left parenthesis. |
| 9421 * @return the left parenthesis | 9331 * @return the left parenthesis |
| 9422 */ | 9332 */ |
| 9423 Token get leftParenthesis => _leftParenthesis; | 9333 Token get leftParenthesis => _leftParenthesis; |
| 9424 | 9334 |
| 9425 /** | 9335 /** |
| 9426 * Return the right parenthesis. | 9336 * Return the right parenthesis. |
| 9427 * @return the right parenthesis | 9337 * @return the right parenthesis |
| 9428 */ | 9338 */ |
| 9429 Token get rightParenthesis => _rightParenthesis; | 9339 Token get rightParenthesis => _rightParenthesis; |
| 9430 | 9340 |
| 9431 /** | 9341 /** |
| 9432 * Set the expression within the parentheses to the given expression. | 9342 * Set the expression within the parentheses to the given expression. |
| 9433 * @param expression the expression within the parentheses | 9343 * @param expression the expression within the parentheses |
| 9434 */ | 9344 */ |
| 9435 void set expression(Expression expression2) { | 9345 void set expression(Expression expression2) { |
| 9436 this._expression = becomeParentOf(expression2); | 9346 this._expression = becomeParentOf(expression2); |
| 9437 } | 9347 } |
| 9438 | 9348 |
| 9439 /** | 9349 /** |
| 9440 * Set the left parenthesis to the given token. | 9350 * Set the left parenthesis to the given token. |
| 9441 * @param parenthesis the left parenthesis | 9351 * @param parenthesis the left parenthesis |
| 9442 */ | 9352 */ |
| 9443 void set leftParenthesis(Token parenthesis) { | 9353 void set leftParenthesis(Token parenthesis) { |
| 9444 _leftParenthesis = parenthesis; | 9354 _leftParenthesis = parenthesis; |
| 9445 } | 9355 } |
| 9446 | 9356 |
| 9447 /** | 9357 /** |
| 9448 * Set the right parenthesis to the given token. | 9358 * Set the right parenthesis to the given token. |
| 9449 * @param parenthesis the right parenthesis | 9359 * @param parenthesis the right parenthesis |
| 9450 */ | 9360 */ |
| 9451 void set rightParenthesis(Token parenthesis) { | 9361 void set rightParenthesis(Token parenthesis) { |
| 9452 _rightParenthesis = parenthesis; | 9362 _rightParenthesis = parenthesis; |
| 9453 } | 9363 } |
| 9454 void visitChildren(ASTVisitor<Object> visitor) { | 9364 void visitChildren(ASTVisitor<Object> visitor) { |
| 9455 safelyVisitChild(_expression, visitor); | 9365 safelyVisitChild(_expression, visitor); |
| 9456 } | 9366 } |
| 9457 } | 9367 } |
| 9458 | |
| 9459 /** | 9368 /** |
| 9460 * Instances of the class {@code PartDirective} represent a part directive. | 9369 * Instances of the class {@code PartDirective} represent a part directive. |
| 9461 * <pre> | 9370 * <pre> |
| 9462 * partDirective ::={@link Annotation metadata} 'part' {@link StringLiteral part
Uri} ';' | 9371 * partDirective ::={@link Annotation metadata} 'part' {@link StringLiteral part
Uri} ';' |
| 9463 * </pre> | 9372 * </pre> |
| 9464 * @coverage dart.engine.ast | 9373 * @coverage dart.engine.ast |
| 9465 */ | 9374 */ |
| 9466 class PartDirective extends UriBasedDirective { | 9375 class PartDirective extends UriBasedDirective { |
| 9467 | 9376 |
| 9468 /** | 9377 /** |
| 9469 * The token representing the 'part' token. | 9378 * The token representing the 'part' token. |
| 9470 */ | 9379 */ |
| 9471 Token _partToken; | 9380 Token _partToken; |
| 9472 | 9381 |
| 9473 /** | 9382 /** |
| 9474 * The semicolon terminating the directive. | 9383 * The semicolon terminating the directive. |
| 9475 */ | 9384 */ |
| 9476 Token _semicolon; | 9385 Token _semicolon; |
| 9477 | 9386 |
| 9478 /** | 9387 /** |
| 9479 * Initialize a newly created part directive. | 9388 * Initialize a newly created part directive. |
| 9480 * @param comment the documentation comment associated with this directive | 9389 * @param comment the documentation comment associated with this directive |
| 9481 * @param metadata the annotations associated with the directive | 9390 * @param metadata the annotations associated with the directive |
| 9482 * @param partToken the token representing the 'part' token | 9391 * @param partToken the token representing the 'part' token |
| 9483 * @param partUri the URI of the part being included | 9392 * @param partUri the URI of the part being included |
| 9484 * @param semicolon the semicolon terminating the directive | 9393 * @param semicolon the semicolon terminating the directive |
| 9485 */ | 9394 */ |
| 9486 PartDirective.full(Comment comment, List<Annotation> metadata, Token partToken
, StringLiteral partUri, Token semicolon) : super.full(comment, metadata, partUr
i) { | 9395 PartDirective.full(Comment comment, List<Annotation> metadata, Token partToken
, StringLiteral partUri, Token semicolon) : super.full(comment, metadata, partUr
i) { |
| 9487 this._partToken = partToken; | 9396 this._partToken = partToken; |
| 9488 this._semicolon = semicolon; | 9397 this._semicolon = semicolon; |
| 9489 } | 9398 } |
| 9490 | 9399 |
| 9491 /** | 9400 /** |
| 9492 * Initialize a newly created part directive. | 9401 * Initialize a newly created part directive. |
| 9493 * @param comment the documentation comment associated with this directive | 9402 * @param comment the documentation comment associated with this directive |
| 9494 * @param metadata the annotations associated with the directive | 9403 * @param metadata the annotations associated with the directive |
| 9495 * @param partToken the token representing the 'part' token | 9404 * @param partToken the token representing the 'part' token |
| 9496 * @param partUri the URI of the part being included | 9405 * @param partUri the URI of the part being included |
| 9497 * @param semicolon the semicolon terminating the directive | 9406 * @param semicolon the semicolon terminating the directive |
| 9498 */ | 9407 */ |
| 9499 PartDirective({Comment comment, List<Annotation> metadata, Token partToken, St
ringLiteral partUri, Token semicolon}) : this.full(comment, metadata, partToken,
partUri, semicolon); | 9408 PartDirective({Comment comment, List<Annotation> metadata, Token partToken, St
ringLiteral partUri, Token semicolon}) : this.full(comment, metadata, partToken,
partUri, semicolon); |
| 9500 accept(ASTVisitor visitor) => visitor.visitPartDirective(this); | 9409 accept(ASTVisitor visitor) => visitor.visitPartDirective(this); |
| 9501 Token get endToken => _semicolon; | 9410 Token get endToken => _semicolon; |
| 9502 Token get keyword => _partToken; | 9411 Token get keyword => _partToken; |
| 9503 | 9412 |
| 9504 /** | 9413 /** |
| 9505 * Return the token representing the 'part' token. | 9414 * Return the token representing the 'part' token. |
| 9506 * @return the token representing the 'part' token | 9415 * @return the token representing the 'part' token |
| 9507 */ | 9416 */ |
| 9508 Token get partToken => _partToken; | 9417 Token get partToken => _partToken; |
| 9509 | 9418 |
| 9510 /** | 9419 /** |
| 9511 * Return the semicolon terminating the directive. | 9420 * Return the semicolon terminating the directive. |
| 9512 * @return the semicolon terminating the directive | 9421 * @return the semicolon terminating the directive |
| 9513 */ | 9422 */ |
| 9514 Token get semicolon => _semicolon; | 9423 Token get semicolon => _semicolon; |
| 9515 CompilationUnitElement get uriElement => element as CompilationUnitElement; | 9424 CompilationUnitElement get uriElement => element as CompilationUnitElement; |
| 9516 | 9425 |
| 9517 /** | 9426 /** |
| 9518 * Set the token representing the 'part' token to the given token. | 9427 * Set the token representing the 'part' token to the given token. |
| 9519 * @param partToken the token representing the 'part' token | 9428 * @param partToken the token representing the 'part' token |
| 9520 */ | 9429 */ |
| 9521 void set partToken(Token partToken2) { | 9430 void set partToken(Token partToken2) { |
| 9522 this._partToken = partToken2; | 9431 this._partToken = partToken2; |
| 9523 } | 9432 } |
| 9524 | 9433 |
| 9525 /** | 9434 /** |
| 9526 * Set the semicolon terminating the directive to the given token. | 9435 * Set the semicolon terminating the directive to the given token. |
| 9527 * @param semicolon the semicolon terminating the directive | 9436 * @param semicolon the semicolon terminating the directive |
| 9528 */ | 9437 */ |
| 9529 void set semicolon(Token semicolon2) { | 9438 void set semicolon(Token semicolon2) { |
| 9530 this._semicolon = semicolon2; | 9439 this._semicolon = semicolon2; |
| 9531 } | 9440 } |
| 9532 Token get firstTokenAfterCommentAndMetadata => _partToken; | 9441 Token get firstTokenAfterCommentAndMetadata => _partToken; |
| 9533 } | 9442 } |
| 9534 | |
| 9535 /** | 9443 /** |
| 9536 * Instances of the class {@code PartOfDirective} represent a part-of directive. | 9444 * Instances of the class {@code PartOfDirective} represent a part-of directive. |
| 9537 * <pre> | 9445 * <pre> |
| 9538 * partOfDirective ::={@link Annotation metadata} 'part' 'of' {@link Identifier
libraryName} ';' | 9446 * partOfDirective ::={@link Annotation metadata} 'part' 'of' {@link Identifier
libraryName} ';' |
| 9539 * </pre> | 9447 * </pre> |
| 9540 * @coverage dart.engine.ast | 9448 * @coverage dart.engine.ast |
| 9541 */ | 9449 */ |
| 9542 class PartOfDirective extends Directive { | 9450 class PartOfDirective extends Directive { |
| 9543 | 9451 |
| 9544 /** | 9452 /** |
| 9545 * The token representing the 'part' token. | 9453 * The token representing the 'part' token. |
| 9546 */ | 9454 */ |
| 9547 Token _partToken; | 9455 Token _partToken; |
| 9548 | 9456 |
| 9549 /** | 9457 /** |
| 9550 * The token representing the 'of' token. | 9458 * The token representing the 'of' token. |
| 9551 */ | 9459 */ |
| 9552 Token _ofToken; | 9460 Token _ofToken; |
| 9553 | 9461 |
| 9554 /** | 9462 /** |
| 9555 * The name of the library that the containing compilation unit is part of. | 9463 * The name of the library that the containing compilation unit is part of. |
| 9556 */ | 9464 */ |
| 9557 LibraryIdentifier _libraryName; | 9465 LibraryIdentifier _libraryName; |
| 9558 | 9466 |
| 9559 /** | 9467 /** |
| 9560 * The semicolon terminating the directive. | 9468 * The semicolon terminating the directive. |
| 9561 */ | 9469 */ |
| 9562 Token _semicolon; | 9470 Token _semicolon; |
| 9563 | 9471 |
| 9564 /** | 9472 /** |
| 9565 * Initialize a newly created part-of directive. | 9473 * Initialize a newly created part-of directive. |
| 9566 * @param comment the documentation comment associated with this directive | 9474 * @param comment the documentation comment associated with this directive |
| 9567 * @param metadata the annotations associated with the directive | 9475 * @param metadata the annotations associated with the directive |
| 9568 * @param partToken the token representing the 'part' token | 9476 * @param partToken the token representing the 'part' token |
| 9569 * @param ofToken the token representing the 'of' token | 9477 * @param ofToken the token representing the 'of' token |
| 9570 * @param libraryName the name of the library that the containing compilation
unit is part of | 9478 * @param libraryName the name of the library that the containing compilation
unit is part of |
| 9571 * @param semicolon the semicolon terminating the directive | 9479 * @param semicolon the semicolon terminating the directive |
| 9572 */ | 9480 */ |
| 9573 PartOfDirective.full(Comment comment, List<Annotation> metadata, Token partTok
en, Token ofToken, LibraryIdentifier libraryName, Token semicolon) : super.full(
comment, metadata) { | 9481 PartOfDirective.full(Comment comment, List<Annotation> metadata, Token partTok
en, Token ofToken, LibraryIdentifier libraryName, Token semicolon) : super.full(
comment, metadata) { |
| 9574 this._partToken = partToken; | 9482 this._partToken = partToken; |
| 9575 this._ofToken = ofToken; | 9483 this._ofToken = ofToken; |
| 9576 this._libraryName = becomeParentOf(libraryName); | 9484 this._libraryName = becomeParentOf(libraryName); |
| 9577 this._semicolon = semicolon; | 9485 this._semicolon = semicolon; |
| 9578 } | 9486 } |
| 9579 | 9487 |
| 9580 /** | 9488 /** |
| 9581 * Initialize a newly created part-of directive. | 9489 * Initialize a newly created part-of directive. |
| 9582 * @param comment the documentation comment associated with this directive | 9490 * @param comment the documentation comment associated with this directive |
| 9583 * @param metadata the annotations associated with the directive | 9491 * @param metadata the annotations associated with the directive |
| 9584 * @param partToken the token representing the 'part' token | 9492 * @param partToken the token representing the 'part' token |
| 9585 * @param ofToken the token representing the 'of' token | 9493 * @param ofToken the token representing the 'of' token |
| 9586 * @param libraryName the name of the library that the containing compilation
unit is part of | 9494 * @param libraryName the name of the library that the containing compilation
unit is part of |
| 9587 * @param semicolon the semicolon terminating the directive | 9495 * @param semicolon the semicolon terminating the directive |
| 9588 */ | 9496 */ |
| 9589 PartOfDirective({Comment comment, List<Annotation> metadata, Token partToken,
Token ofToken, LibraryIdentifier libraryName, Token semicolon}) : this.full(comm
ent, metadata, partToken, ofToken, libraryName, semicolon); | 9497 PartOfDirective({Comment comment, List<Annotation> metadata, Token partToken,
Token ofToken, LibraryIdentifier libraryName, Token semicolon}) : this.full(comm
ent, metadata, partToken, ofToken, libraryName, semicolon); |
| 9590 accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this); | 9498 accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this); |
| 9591 Token get endToken => _semicolon; | 9499 Token get endToken => _semicolon; |
| 9592 Token get keyword => _partToken; | 9500 Token get keyword => _partToken; |
| 9593 | 9501 |
| 9594 /** | 9502 /** |
| 9595 * Return the name of the library that the containing compilation unit is part
of. | 9503 * Return the name of the library that the containing compilation unit is part
of. |
| 9596 * @return the name of the library that the containing compilation unit is par
t of | 9504 * @return the name of the library that the containing compilation unit is par
t of |
| 9597 */ | 9505 */ |
| 9598 LibraryIdentifier get libraryName => _libraryName; | 9506 LibraryIdentifier get libraryName => _libraryName; |
| 9599 | 9507 |
| 9600 /** | 9508 /** |
| 9601 * Return the token representing the 'of' token. | 9509 * Return the token representing the 'of' token. |
| 9602 * @return the token representing the 'of' token | 9510 * @return the token representing the 'of' token |
| 9603 */ | 9511 */ |
| 9604 Token get ofToken => _ofToken; | 9512 Token get ofToken => _ofToken; |
| 9605 | 9513 |
| 9606 /** | 9514 /** |
| 9607 * Return the token representing the 'part' token. | 9515 * Return the token representing the 'part' token. |
| 9608 * @return the token representing the 'part' token | 9516 * @return the token representing the 'part' token |
| 9609 */ | 9517 */ |
| 9610 Token get partToken => _partToken; | 9518 Token get partToken => _partToken; |
| 9611 | 9519 |
| 9612 /** | 9520 /** |
| 9613 * Return the semicolon terminating the directive. | 9521 * Return the semicolon terminating the directive. |
| 9614 * @return the semicolon terminating the directive | 9522 * @return the semicolon terminating the directive |
| 9615 */ | 9523 */ |
| 9616 Token get semicolon => _semicolon; | 9524 Token get semicolon => _semicolon; |
| 9617 | 9525 |
| 9618 /** | 9526 /** |
| 9619 * Set the name of the library that the containing compilation unit is part of
to the given name. | 9527 * Set the name of the library that the containing compilation unit is part of
to the given name. |
| 9620 * @param libraryName the name of the library that the containing compilation
unit is part of | 9528 * @param libraryName the name of the library that the containing compilation
unit is part of |
| 9621 */ | 9529 */ |
| 9622 void set libraryName(LibraryIdentifier libraryName2) { | 9530 void set libraryName(LibraryIdentifier libraryName2) { |
| 9623 this._libraryName = becomeParentOf(libraryName2); | 9531 this._libraryName = becomeParentOf(libraryName2); |
| 9624 } | 9532 } |
| 9625 | 9533 |
| 9626 /** | 9534 /** |
| 9627 * Set the token representing the 'of' token to the given token. | 9535 * Set the token representing the 'of' token to the given token. |
| 9628 * @param ofToken the token representing the 'of' token | 9536 * @param ofToken the token representing the 'of' token |
| 9629 */ | 9537 */ |
| 9630 void set ofToken(Token ofToken2) { | 9538 void set ofToken(Token ofToken2) { |
| 9631 this._ofToken = ofToken2; | 9539 this._ofToken = ofToken2; |
| 9632 } | 9540 } |
| 9633 | 9541 |
| 9634 /** | 9542 /** |
| 9635 * Set the token representing the 'part' token to the given token. | 9543 * Set the token representing the 'part' token to the given token. |
| 9636 * @param partToken the token representing the 'part' token | 9544 * @param partToken the token representing the 'part' token |
| 9637 */ | 9545 */ |
| 9638 void set partToken(Token partToken2) { | 9546 void set partToken(Token partToken2) { |
| 9639 this._partToken = partToken2; | 9547 this._partToken = partToken2; |
| 9640 } | 9548 } |
| 9641 | 9549 |
| 9642 /** | 9550 /** |
| 9643 * Set the semicolon terminating the directive to the given token. | 9551 * Set the semicolon terminating the directive to the given token. |
| 9644 * @param semicolon the semicolon terminating the directive | 9552 * @param semicolon the semicolon terminating the directive |
| 9645 */ | 9553 */ |
| 9646 void set semicolon(Token semicolon2) { | 9554 void set semicolon(Token semicolon2) { |
| 9647 this._semicolon = semicolon2; | 9555 this._semicolon = semicolon2; |
| 9648 } | 9556 } |
| 9649 void visitChildren(ASTVisitor<Object> visitor) { | 9557 void visitChildren(ASTVisitor<Object> visitor) { |
| 9650 super.visitChildren(visitor); | 9558 super.visitChildren(visitor); |
| 9651 safelyVisitChild(_libraryName, visitor); | 9559 safelyVisitChild(_libraryName, visitor); |
| 9652 } | 9560 } |
| 9653 Token get firstTokenAfterCommentAndMetadata => _partToken; | 9561 Token get firstTokenAfterCommentAndMetadata => _partToken; |
| 9654 } | 9562 } |
| 9655 | |
| 9656 /** | 9563 /** |
| 9657 * Instances of the class {@code PostfixExpression} represent a postfix unary ex
pression. | 9564 * Instances of the class {@code PostfixExpression} represent a postfix unary ex
pression. |
| 9658 * <pre> | 9565 * <pre> |
| 9659 * postfixExpression ::={@link Expression operand} {@link Token operator}</pre> | 9566 * postfixExpression ::={@link Expression operand} {@link Token operator}</pre> |
| 9660 * @coverage dart.engine.ast | 9567 * @coverage dart.engine.ast |
| 9661 */ | 9568 */ |
| 9662 class PostfixExpression extends Expression { | 9569 class PostfixExpression extends Expression { |
| 9663 | 9570 |
| 9664 /** | 9571 /** |
| 9665 * The expression computing the operand for the operator. | 9572 * The expression computing the operand for the operator. |
| 9666 */ | 9573 */ |
| 9667 Expression _operand; | 9574 Expression _operand; |
| 9668 | 9575 |
| 9669 /** | 9576 /** |
| 9670 * The postfix operator being applied to the operand. | 9577 * The postfix operator being applied to the operand. |
| 9671 */ | 9578 */ |
| 9672 Token _operator; | 9579 Token _operator; |
| 9673 | 9580 |
| 9674 /** | 9581 /** |
| 9675 * The element associated with this the operator based on the propagated type
of the operand, or{@code null} if the AST structure has not been resolved, if th
e operator is not user definable, | 9582 * The element associated with this the operator based on the propagated type
of the operand, or{@code null} if the AST structure has not been resolved, if th
e operator is not user definable, |
| 9676 * or if the operator could not be resolved. | 9583 * or if the operator could not be resolved. |
| 9677 */ | 9584 */ |
| 9678 MethodElement _propagatedElement; | 9585 MethodElement _propagatedElement; |
| 9679 | 9586 |
| 9680 /** | 9587 /** |
| 9681 * The element associated with the operator based on the static type of the op
erand, or{@code null} if the AST structure has not been resolved, if the operato
r is not user definable, | 9588 * The element associated with the operator based on the static type of the op
erand, or{@code null} if the AST structure has not been resolved, if the operato
r is not user definable, |
| 9682 * or if the operator could not be resolved. | 9589 * or if the operator could not be resolved. |
| 9683 */ | 9590 */ |
| 9684 MethodElement _staticElement; | 9591 MethodElement _staticElement; |
| 9685 | 9592 |
| 9686 /** | 9593 /** |
| 9687 * Initialize a newly created postfix expression. | 9594 * Initialize a newly created postfix expression. |
| 9688 * @param operand the expression computing the operand for the operator | 9595 * @param operand the expression computing the operand for the operator |
| 9689 * @param operator the postfix operator being applied to the operand | 9596 * @param operator the postfix operator being applied to the operand |
| 9690 */ | 9597 */ |
| 9691 PostfixExpression.full(Expression operand, Token operator) { | 9598 PostfixExpression.full(Expression operand, Token operator) { |
| 9692 this._operand = becomeParentOf(operand); | 9599 this._operand = becomeParentOf(operand); |
| 9693 this._operator = operator; | 9600 this._operator = operator; |
| 9694 } | 9601 } |
| 9695 | 9602 |
| 9696 /** | 9603 /** |
| 9697 * Initialize a newly created postfix expression. | 9604 * Initialize a newly created postfix expression. |
| 9698 * @param operand the expression computing the operand for the operator | 9605 * @param operand the expression computing the operand for the operator |
| 9699 * @param operator the postfix operator being applied to the operand | 9606 * @param operator the postfix operator being applied to the operand |
| 9700 */ | 9607 */ |
| 9701 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o
perator); | 9608 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o
perator); |
| 9702 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); | 9609 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); |
| 9703 Token get beginToken => _operand.beginToken; | 9610 Token get beginToken => _operand.beginToken; |
| 9704 | 9611 |
| 9705 /** | 9612 /** |
| 9706 * Return the element associated with the operator based on the propagated typ
e of the operand, or{@code null} if the AST structure has not been resolved, if
the operator is not user definable, | 9613 * Return the element associated with the operator based on the propagated typ
e of the operand, or{@code null} if the AST structure has not been resolved, if
the operator is not user definable, |
| 9707 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 9614 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9708 * not defined for the type of the operand. | 9615 * not defined for the type of the operand. |
| 9709 * @return the element associated with the operator | 9616 * @return the element associated with the operator |
| 9710 */ | 9617 */ |
| 9711 MethodElement get element => _propagatedElement; | 9618 MethodElement get element => _propagatedElement; |
| 9712 Token get endToken => _operator; | 9619 Token get endToken => _operator; |
| 9713 | 9620 |
| 9714 /** | 9621 /** |
| 9715 * Return the expression computing the operand for the operator. | 9622 * Return the expression computing the operand for the operator. |
| 9716 * @return the expression computing the operand for the operator | 9623 * @return the expression computing the operand for the operator |
| 9717 */ | 9624 */ |
| 9718 Expression get operand => _operand; | 9625 Expression get operand => _operand; |
| 9719 | 9626 |
| 9720 /** | 9627 /** |
| 9721 * Return the postfix operator being applied to the operand. | 9628 * Return the postfix operator being applied to the operand. |
| 9722 * @return the postfix operator being applied to the operand | 9629 * @return the postfix operator being applied to the operand |
| 9723 */ | 9630 */ |
| 9724 Token get operator => _operator; | 9631 Token get operator => _operator; |
| 9725 | 9632 |
| 9726 /** | 9633 /** |
| 9727 * Return the element associated with the operator based on the static type of
the operand, or{@code null} if the AST structure has not been resolved, if the
operator is not user definable, | 9634 * Return the element associated with the operator based on the static type of
the operand, or{@code null} if the AST structure has not been resolved, if the
operator is not user definable, |
| 9728 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 9635 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9729 * not defined for the type of the operand. | 9636 * not defined for the type of the operand. |
| 9730 * @return the element associated with the operator | 9637 * @return the element associated with the operator |
| 9731 */ | 9638 */ |
| 9732 MethodElement get staticElement => _staticElement; | 9639 MethodElement get staticElement => _staticElement; |
| 9733 | 9640 |
| 9734 /** | 9641 /** |
| 9735 * Set the element associated with the operator based on the propagated type o
f the operand to the | 9642 * Set the element associated with the operator based on the propagated type o
f the operand to the |
| 9736 * given element. | 9643 * given element. |
| 9737 * @param element the element to be associated with the operator | 9644 * @param element the element to be associated with the operator |
| 9738 */ | 9645 */ |
| 9739 void set element(MethodElement element2) { | 9646 void set element(MethodElement element2) { |
| 9740 _propagatedElement = element2; | 9647 _propagatedElement = element2; |
| 9741 } | 9648 } |
| 9742 | 9649 |
| 9743 /** | 9650 /** |
| 9744 * Set the expression computing the operand for the operator to the given expr
ession. | 9651 * Set the expression computing the operand for the operator to the given expr
ession. |
| 9745 * @param expression the expression computing the operand for the operator | 9652 * @param expression the expression computing the operand for the operator |
| 9746 */ | 9653 */ |
| 9747 void set operand(Expression expression) { | 9654 void set operand(Expression expression) { |
| 9748 _operand = becomeParentOf(expression); | 9655 _operand = becomeParentOf(expression); |
| 9749 } | 9656 } |
| 9750 | 9657 |
| 9751 /** | 9658 /** |
| 9752 * Set the postfix operator being applied to the operand to the given operator
. | 9659 * Set the postfix operator being applied to the operand to the given operator
. |
| 9753 * @param operator the postfix operator being applied to the operand | 9660 * @param operator the postfix operator being applied to the operand |
| 9754 */ | 9661 */ |
| 9755 void set operator(Token operator2) { | 9662 void set operator(Token operator2) { |
| 9756 this._operator = operator2; | 9663 this._operator = operator2; |
| 9757 } | 9664 } |
| 9758 | 9665 |
| 9759 /** | 9666 /** |
| 9760 * Set the element associated with the operator based on the static type of th
e operand to the | 9667 * Set the element associated with the operator based on the static type of th
e operand to the |
| 9761 * given element. | 9668 * given element. |
| 9762 * @param element the element to be associated with the operator | 9669 * @param element the element to be associated with the operator |
| 9763 */ | 9670 */ |
| 9764 void set staticElement(MethodElement element) { | 9671 void set staticElement(MethodElement element) { |
| 9765 _staticElement = element; | 9672 _staticElement = element; |
| 9766 } | 9673 } |
| 9767 void visitChildren(ASTVisitor<Object> visitor) { | 9674 void visitChildren(ASTVisitor<Object> visitor) { |
| 9768 safelyVisitChild(_operand, visitor); | 9675 safelyVisitChild(_operand, visitor); |
| 9769 } | 9676 } |
| 9770 } | 9677 } |
| 9771 | |
| 9772 /** | 9678 /** |
| 9773 * Instances of the class {@code PrefixExpression} represent a prefix unary expr
ession. | 9679 * Instances of the class {@code PrefixExpression} represent a prefix unary expr
ession. |
| 9774 * <pre> | 9680 * <pre> |
| 9775 * prefixExpression ::={@link Token operator} {@link Expression operand}</pre> | 9681 * prefixExpression ::={@link Token operator} {@link Expression operand}</pre> |
| 9776 * @coverage dart.engine.ast | 9682 * @coverage dart.engine.ast |
| 9777 */ | 9683 */ |
| 9778 class PrefixExpression extends Expression { | 9684 class PrefixExpression extends Expression { |
| 9779 | 9685 |
| 9780 /** | 9686 /** |
| 9781 * The prefix operator being applied to the operand. | 9687 * The prefix operator being applied to the operand. |
| 9782 */ | 9688 */ |
| 9783 Token _operator; | 9689 Token _operator; |
| 9784 | 9690 |
| 9785 /** | 9691 /** |
| 9786 * The expression computing the operand for the operator. | 9692 * The expression computing the operand for the operator. |
| 9787 */ | 9693 */ |
| 9788 Expression _operand; | 9694 Expression _operand; |
| 9789 | 9695 |
| 9790 /** | 9696 /** |
| 9791 * The element associated with the operator based on the static type of the op
erand, or{@code null} if the AST structure has not been resolved, if the operato
r is not user definable, | 9697 * The element associated with the operator based on the static type of the op
erand, or{@code null} if the AST structure has not been resolved, if the operato
r is not user definable, |
| 9792 * or if the operator could not be resolved. | 9698 * or if the operator could not be resolved. |
| 9793 */ | 9699 */ |
| 9794 MethodElement _staticElement; | 9700 MethodElement _staticElement; |
| 9795 | 9701 |
| 9796 /** | 9702 /** |
| 9797 * The element associated with the operator based on the propagated type of th
e operand, or{@code null} if the AST structure has not been resolved, if the ope
rator is not user definable, | 9703 * The element associated with the operator based on the propagated type of th
e operand, or{@code null} if the AST structure has not been resolved, if the ope
rator is not user definable, |
| 9798 * or if the operator could not be resolved. | 9704 * or if the operator could not be resolved. |
| 9799 */ | 9705 */ |
| 9800 MethodElement _propagatedElement; | 9706 MethodElement _propagatedElement; |
| 9801 | 9707 |
| 9802 /** | 9708 /** |
| 9803 * Initialize a newly created prefix expression. | 9709 * Initialize a newly created prefix expression. |
| 9804 * @param operator the prefix operator being applied to the operand | 9710 * @param operator the prefix operator being applied to the operand |
| 9805 * @param operand the expression computing the operand for the operator | 9711 * @param operand the expression computing the operand for the operator |
| 9806 */ | 9712 */ |
| 9807 PrefixExpression.full(Token operator, Expression operand) { | 9713 PrefixExpression.full(Token operator, Expression operand) { |
| 9808 this._operator = operator; | 9714 this._operator = operator; |
| 9809 this._operand = becomeParentOf(operand); | 9715 this._operand = becomeParentOf(operand); |
| 9810 } | 9716 } |
| 9811 | 9717 |
| 9812 /** | 9718 /** |
| 9813 * Initialize a newly created prefix expression. | 9719 * Initialize a newly created prefix expression. |
| 9814 * @param operator the prefix operator being applied to the operand | 9720 * @param operator the prefix operator being applied to the operand |
| 9815 * @param operand the expression computing the operand for the operator | 9721 * @param operand the expression computing the operand for the operator |
| 9816 */ | 9722 */ |
| 9817 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o
perand); | 9723 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o
perand); |
| 9818 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); | 9724 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); |
| 9819 Token get beginToken => _operator; | 9725 Token get beginToken => _operator; |
| 9820 | 9726 |
| 9821 /** | 9727 /** |
| 9822 * Return the element associated with the operator based on the propagated typ
e of the operand, or{@code null} if the AST structure has not been resolved, if
the operator is not user definable, | 9728 * Return the element associated with the operator based on the propagated typ
e of the operand, or{@code null} if the AST structure has not been resolved, if
the operator is not user definable, |
| 9823 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 9729 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9824 * not defined for the type of the operand. | 9730 * not defined for the type of the operand. |
| 9825 * @return the element associated with the operator | 9731 * @return the element associated with the operator |
| 9826 */ | 9732 */ |
| 9827 MethodElement get element => _propagatedElement; | 9733 MethodElement get element => _propagatedElement; |
| 9828 Token get endToken => _operand.endToken; | 9734 Token get endToken => _operand.endToken; |
| 9829 | 9735 |
| 9830 /** | 9736 /** |
| 9831 * Return the expression computing the operand for the operator. | 9737 * Return the expression computing the operand for the operator. |
| 9832 * @return the expression computing the operand for the operator | 9738 * @return the expression computing the operand for the operator |
| 9833 */ | 9739 */ |
| 9834 Expression get operand => _operand; | 9740 Expression get operand => _operand; |
| 9835 | 9741 |
| 9836 /** | 9742 /** |
| 9837 * Return the prefix operator being applied to the operand. | 9743 * Return the prefix operator being applied to the operand. |
| 9838 * @return the prefix operator being applied to the operand | 9744 * @return the prefix operator being applied to the operand |
| 9839 */ | 9745 */ |
| 9840 Token get operator => _operator; | 9746 Token get operator => _operator; |
| 9841 | 9747 |
| 9842 /** | 9748 /** |
| 9843 * Return the element associated with the operator based on the static type of
the operand, or{@code null} if the AST structure has not been resolved, if the
operator is not user definable, | 9749 * Return the element associated with the operator based on the static type of
the operand, or{@code null} if the AST structure has not been resolved, if the
operator is not user definable, |
| 9844 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 9750 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9845 * not defined for the type of the operand. | 9751 * not defined for the type of the operand. |
| 9846 * @return the element associated with the operator | 9752 * @return the element associated with the operator |
| 9847 */ | 9753 */ |
| 9848 MethodElement get staticElement => _staticElement; | 9754 MethodElement get staticElement => _staticElement; |
| 9849 | 9755 |
| 9850 /** | 9756 /** |
| 9851 * Set the element associated with the operator based on the propagated type o
f the operand to the | 9757 * Set the element associated with the operator based on the propagated type o
f the operand to the |
| 9852 * given element. | 9758 * given element. |
| 9853 * @param element the element to be associated with the operator | 9759 * @param element the element to be associated with the operator |
| 9854 */ | 9760 */ |
| 9855 void set element(MethodElement element2) { | 9761 void set element(MethodElement element2) { |
| 9856 _propagatedElement = element2; | 9762 _propagatedElement = element2; |
| 9857 } | 9763 } |
| 9858 | 9764 |
| 9859 /** | 9765 /** |
| 9860 * Set the expression computing the operand for the operator to the given expr
ession. | 9766 * Set the expression computing the operand for the operator to the given expr
ession. |
| 9861 * @param expression the expression computing the operand for the operator | 9767 * @param expression the expression computing the operand for the operator |
| 9862 */ | 9768 */ |
| 9863 void set operand(Expression expression) { | 9769 void set operand(Expression expression) { |
| 9864 _operand = becomeParentOf(expression); | 9770 _operand = becomeParentOf(expression); |
| 9865 } | 9771 } |
| 9866 | 9772 |
| 9867 /** | 9773 /** |
| 9868 * Set the prefix operator being applied to the operand to the given operator. | 9774 * Set the prefix operator being applied to the operand to the given operator. |
| 9869 * @param operator the prefix operator being applied to the operand | 9775 * @param operator the prefix operator being applied to the operand |
| 9870 */ | 9776 */ |
| 9871 void set operator(Token operator2) { | 9777 void set operator(Token operator2) { |
| 9872 this._operator = operator2; | 9778 this._operator = operator2; |
| 9873 } | 9779 } |
| 9874 | 9780 |
| 9875 /** | 9781 /** |
| 9876 * Set the element associated with the operator based on the static type of th
e operand to the | 9782 * Set the element associated with the operator based on the static type of th
e operand to the |
| 9877 * given element. | 9783 * given element. |
| 9878 * @param element the static element to be associated with the operator | 9784 * @param element the static element to be associated with the operator |
| 9879 */ | 9785 */ |
| 9880 void set staticElement(MethodElement element) { | 9786 void set staticElement(MethodElement element) { |
| 9881 _staticElement = element; | 9787 _staticElement = element; |
| 9882 } | 9788 } |
| 9883 void visitChildren(ASTVisitor<Object> visitor) { | 9789 void visitChildren(ASTVisitor<Object> visitor) { |
| 9884 safelyVisitChild(_operand, visitor); | 9790 safelyVisitChild(_operand, visitor); |
| 9885 } | 9791 } |
| 9886 } | 9792 } |
| 9887 | |
| 9888 /** | 9793 /** |
| 9889 * Instances of the class {@code PrefixedIdentifier} represent either an identif
ier that is prefixed | 9794 * Instances of the class {@code PrefixedIdentifier} represent either an identif
ier that is prefixed |
| 9890 * or an access to an object property where the target of the property access is
a simple | 9795 * or an access to an object property where the target of the property access is
a simple |
| 9891 * identifier. | 9796 * identifier. |
| 9892 * <pre> | 9797 * <pre> |
| 9893 * prefixedIdentifier ::={@link SimpleIdentifier prefix} '.' {@link SimpleIdenti
fier identifier}</pre> | 9798 * prefixedIdentifier ::={@link SimpleIdentifier prefix} '.' {@link SimpleIdenti
fier identifier}</pre> |
| 9894 * @coverage dart.engine.ast | 9799 * @coverage dart.engine.ast |
| 9895 */ | 9800 */ |
| 9896 class PrefixedIdentifier extends Identifier { | 9801 class PrefixedIdentifier extends Identifier { |
| 9897 | 9802 |
| 9898 /** | 9803 /** |
| 9899 * The prefix associated with the library in which the identifier is defined. | 9804 * The prefix associated with the library in which the identifier is defined. |
| 9900 */ | 9805 */ |
| 9901 SimpleIdentifier _prefix; | 9806 SimpleIdentifier _prefix; |
| 9902 | 9807 |
| 9903 /** | 9808 /** |
| 9904 * The period used to separate the prefix from the identifier. | 9809 * The period used to separate the prefix from the identifier. |
| 9905 */ | 9810 */ |
| 9906 Token _period; | 9811 Token _period; |
| 9907 | 9812 |
| 9908 /** | 9813 /** |
| 9909 * The identifier being prefixed. | 9814 * The identifier being prefixed. |
| 9910 */ | 9815 */ |
| 9911 SimpleIdentifier _identifier; | 9816 SimpleIdentifier _identifier; |
| 9912 | 9817 |
| 9913 /** | 9818 /** |
| 9914 * Initialize a newly created prefixed identifier. | 9819 * Initialize a newly created prefixed identifier. |
| 9915 * @param prefix the identifier being prefixed | 9820 * @param prefix the identifier being prefixed |
| 9916 * @param period the period used to separate the prefix from the identifier | 9821 * @param period the period used to separate the prefix from the identifier |
| 9917 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 9822 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
| 9918 */ | 9823 */ |
| 9919 PrefixedIdentifier.full(SimpleIdentifier prefix, Token period, SimpleIdentifie
r identifier) { | 9824 PrefixedIdentifier.full(SimpleIdentifier prefix, Token period, SimpleIdentifie
r identifier) { |
| 9920 this._prefix = becomeParentOf(prefix); | 9825 this._prefix = becomeParentOf(prefix); |
| 9921 this._period = period; | 9826 this._period = period; |
| 9922 this._identifier = becomeParentOf(identifier); | 9827 this._identifier = becomeParentOf(identifier); |
| 9923 } | 9828 } |
| 9924 | 9829 |
| 9925 /** | 9830 /** |
| 9926 * Initialize a newly created prefixed identifier. | 9831 * Initialize a newly created prefixed identifier. |
| 9927 * @param prefix the identifier being prefixed | 9832 * @param prefix the identifier being prefixed |
| 9928 * @param period the period used to separate the prefix from the identifier | 9833 * @param period the period used to separate the prefix from the identifier |
| 9929 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 9834 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
| 9930 */ | 9835 */ |
| 9931 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id
entifier}) : this.full(prefix, period, identifier); | 9836 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id
entifier}) : this.full(prefix, period, identifier); |
| 9932 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); | 9837 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); |
| 9933 Token get beginToken => _prefix.beginToken; | 9838 Token get beginToken => _prefix.beginToken; |
| 9934 Element get element { | 9839 Element get element { |
| 9935 if (_identifier == null) { | 9840 if (_identifier == null) { |
| 9936 return null; | 9841 return null; |
| 9937 } | 9842 } |
| 9938 return _identifier.element; | 9843 return _identifier.element; |
| 9939 } | 9844 } |
| 9940 Token get endToken => _identifier.endToken; | 9845 Token get endToken => _identifier.endToken; |
| 9941 | 9846 |
| 9942 /** | 9847 /** |
| 9943 * Return the identifier being prefixed. | 9848 * Return the identifier being prefixed. |
| 9944 * @return the identifier being prefixed | 9849 * @return the identifier being prefixed |
| 9945 */ | 9850 */ |
| 9946 SimpleIdentifier get identifier => _identifier; | 9851 SimpleIdentifier get identifier => _identifier; |
| 9947 String get name => "${_prefix.name}.${_identifier.name}"; | 9852 String get name => "${_prefix.name}.${_identifier.name}"; |
| 9948 | 9853 |
| 9949 /** | 9854 /** |
| 9950 * Return the period used to separate the prefix from the identifier. | 9855 * Return the period used to separate the prefix from the identifier. |
| 9951 * @return the period used to separate the prefix from the identifier | 9856 * @return the period used to separate the prefix from the identifier |
| 9952 */ | 9857 */ |
| 9953 Token get period => _period; | 9858 Token get period => _period; |
| 9954 | 9859 |
| 9955 /** | 9860 /** |
| 9956 * Return the prefix associated with the library in which the identifier is de
fined. | 9861 * Return the prefix associated with the library in which the identifier is de
fined. |
| 9957 * @return the prefix associated with the library in which the identifier is d
efined | 9862 * @return the prefix associated with the library in which the identifier is d
efined |
| 9958 */ | 9863 */ |
| 9959 SimpleIdentifier get prefix => _prefix; | 9864 SimpleIdentifier get prefix => _prefix; |
| 9960 Element get staticElement { | 9865 Element get staticElement { |
| 9961 if (_identifier == null) { | 9866 if (_identifier == null) { |
| 9962 return null; | 9867 return null; |
| 9963 } | 9868 } |
| 9964 return _identifier.staticElement; | 9869 return _identifier.staticElement; |
| 9965 } | 9870 } |
| 9966 | 9871 |
| 9967 /** | 9872 /** |
| 9968 * Set the identifier being prefixed to the given identifier. | 9873 * Set the identifier being prefixed to the given identifier. |
| 9969 * @param identifier the identifier being prefixed | 9874 * @param identifier the identifier being prefixed |
| 9970 */ | 9875 */ |
| 9971 void set identifier(SimpleIdentifier identifier2) { | 9876 void set identifier(SimpleIdentifier identifier2) { |
| 9972 this._identifier = becomeParentOf(identifier2); | 9877 this._identifier = becomeParentOf(identifier2); |
| 9973 } | 9878 } |
| 9974 | 9879 |
| 9975 /** | 9880 /** |
| 9976 * Set the period used to separate the prefix from the identifier to the given
token. | 9881 * Set the period used to separate the prefix from the identifier to the given
token. |
| 9977 * @param period the period used to separate the prefix from the identifier | 9882 * @param period the period used to separate the prefix from the identifier |
| 9978 */ | 9883 */ |
| 9979 void set period(Token period2) { | 9884 void set period(Token period2) { |
| 9980 this._period = period2; | 9885 this._period = period2; |
| 9981 } | 9886 } |
| 9982 | 9887 |
| 9983 /** | 9888 /** |
| 9984 * Set the prefix associated with the library in which the identifier is defin
ed to the given | 9889 * Set the prefix associated with the library in which the identifier is defin
ed to the given |
| 9985 * identifier. | 9890 * identifier. |
| 9986 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 9891 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
| 9987 */ | 9892 */ |
| 9988 void set prefix(SimpleIdentifier identifier) { | 9893 void set prefix(SimpleIdentifier identifier) { |
| 9989 _prefix = becomeParentOf(identifier); | 9894 _prefix = becomeParentOf(identifier); |
| 9990 } | 9895 } |
| 9991 void visitChildren(ASTVisitor<Object> visitor) { | 9896 void visitChildren(ASTVisitor<Object> visitor) { |
| 9992 safelyVisitChild(_prefix, visitor); | 9897 safelyVisitChild(_prefix, visitor); |
| 9993 safelyVisitChild(_identifier, visitor); | 9898 safelyVisitChild(_identifier, visitor); |
| 9994 } | 9899 } |
| 9995 } | 9900 } |
| 9996 | |
| 9997 /** | 9901 /** |
| 9998 * Instances of the class {@code PropertyAccess} represent the access of a prope
rty of an object. | 9902 * Instances of the class {@code PropertyAccess} represent the access of a prope
rty of an object. |
| 9999 * <p> | 9903 * <p> |
| 10000 * Note, however, that accesses to properties of objects can also be represented
as{@link PrefixedIdentifier prefixed identifier} nodes in cases where the targe
t is also a simple | 9904 * Note, however, that accesses to properties of objects can also be represented
as{@link PrefixedIdentifier prefixed identifier} nodes in cases where the targe
t is also a simple |
| 10001 * identifier. | 9905 * identifier. |
| 10002 * <pre> | 9906 * <pre> |
| 10003 * propertyAccess ::={@link Expression target} '.' {@link SimpleIdentifier prope
rtyName}</pre> | 9907 * propertyAccess ::={@link Expression target} '.' {@link SimpleIdentifier prope
rtyName}</pre> |
| 10004 * @coverage dart.engine.ast | 9908 * @coverage dart.engine.ast |
| 10005 */ | 9909 */ |
| 10006 class PropertyAccess extends Expression { | 9910 class PropertyAccess extends Expression { |
| 10007 | 9911 |
| 10008 /** | 9912 /** |
| 10009 * The expression computing the object defining the property being accessed. | 9913 * The expression computing the object defining the property being accessed. |
| 10010 */ | 9914 */ |
| 10011 Expression _target; | 9915 Expression _target; |
| 10012 | 9916 |
| 10013 /** | 9917 /** |
| 10014 * The property access operator. | 9918 * The property access operator. |
| 10015 */ | 9919 */ |
| 10016 Token _operator; | 9920 Token _operator; |
| 10017 | 9921 |
| 10018 /** | 9922 /** |
| 10019 * The name of the property being accessed. | 9923 * The name of the property being accessed. |
| 10020 */ | 9924 */ |
| 10021 SimpleIdentifier _propertyName; | 9925 SimpleIdentifier _propertyName; |
| 10022 | 9926 |
| 10023 /** | 9927 /** |
| 10024 * Initialize a newly created property access expression. | 9928 * Initialize a newly created property access expression. |
| 10025 * @param target the expression computing the object defining the property bei
ng accessed | 9929 * @param target the expression computing the object defining the property bei
ng accessed |
| 10026 * @param operator the property access operator | 9930 * @param operator the property access operator |
| 10027 * @param propertyName the name of the property being accessed | 9931 * @param propertyName the name of the property being accessed |
| 10028 */ | 9932 */ |
| 10029 PropertyAccess.full(Expression target, Token operator, SimpleIdentifier proper
tyName) { | 9933 PropertyAccess.full(Expression target, Token operator, SimpleIdentifier proper
tyName) { |
| 10030 this._target = becomeParentOf(target); | 9934 this._target = becomeParentOf(target); |
| 10031 this._operator = operator; | 9935 this._operator = operator; |
| 10032 this._propertyName = becomeParentOf(propertyName); | 9936 this._propertyName = becomeParentOf(propertyName); |
| 10033 } | 9937 } |
| 10034 | 9938 |
| 10035 /** | 9939 /** |
| 10036 * Initialize a newly created property access expression. | 9940 * Initialize a newly created property access expression. |
| 10037 * @param target the expression computing the object defining the property bei
ng accessed | 9941 * @param target the expression computing the object defining the property bei
ng accessed |
| 10038 * @param operator the property access operator | 9942 * @param operator the property access operator |
| 10039 * @param propertyName the name of the property being accessed | 9943 * @param propertyName the name of the property being accessed |
| 10040 */ | 9944 */ |
| 10041 PropertyAccess({Expression target, Token operator, SimpleIdentifier propertyNa
me}) : this.full(target, operator, propertyName); | 9945 PropertyAccess({Expression target, Token operator, SimpleIdentifier propertyNa
me}) : this.full(target, operator, propertyName); |
| 10042 accept(ASTVisitor visitor) => visitor.visitPropertyAccess(this); | 9946 accept(ASTVisitor visitor) => visitor.visitPropertyAccess(this); |
| 10043 Token get beginToken { | 9947 Token get beginToken { |
| 10044 if (_target != null) { | 9948 if (_target != null) { |
| 10045 return _target.beginToken; | 9949 return _target.beginToken; |
| 10046 } | 9950 } |
| 10047 return _operator; | 9951 return _operator; |
| 10048 } | 9952 } |
| 10049 Token get endToken => _propertyName.endToken; | 9953 Token get endToken => _propertyName.endToken; |
| 10050 | 9954 |
| 10051 /** | 9955 /** |
| 10052 * Return the property access operator. | 9956 * Return the property access operator. |
| 10053 * @return the property access operator | 9957 * @return the property access operator |
| 10054 */ | 9958 */ |
| 10055 Token get operator => _operator; | 9959 Token get operator => _operator; |
| 10056 | 9960 |
| 10057 /** | 9961 /** |
| 10058 * Return the name of the property being accessed. | 9962 * Return the name of the property being accessed. |
| 10059 * @return the name of the property being accessed | 9963 * @return the name of the property being accessed |
| 10060 */ | 9964 */ |
| 10061 SimpleIdentifier get propertyName => _propertyName; | 9965 SimpleIdentifier get propertyName => _propertyName; |
| 10062 | 9966 |
| 10063 /** | 9967 /** |
| 10064 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not | 9968 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not |
| 10065 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation | 9969 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation |
| 10066 * is part of a cascade expression, then the target stored with the cascade ex
pression is | 9970 * is part of a cascade expression, then the target stored with the cascade ex
pression is |
| 10067 * returned. | 9971 * returned. |
| 10068 * @return the expression used to compute the receiver of the invocation | 9972 * @return the expression used to compute the receiver of the invocation |
| 10069 * @see #getTarget() | 9973 * @see #getTarget() |
| 10070 */ | 9974 */ |
| 10071 Expression get realTarget { | 9975 Expression get realTarget { |
| 10072 if (isCascaded()) { | 9976 if (isCascaded()) { |
| 10073 ASTNode ancestor = parent; | 9977 ASTNode ancestor = parent; |
| 10074 while (ancestor is! CascadeExpression) { | 9978 while (ancestor is! CascadeExpression) { |
| 10075 if (ancestor == null) { | 9979 if (ancestor == null) { |
| 10076 return _target; | 9980 return _target; |
| 10077 } | 9981 } |
| 10078 ancestor = ancestor.parent; | 9982 ancestor = ancestor.parent; |
| 10079 } | 9983 } |
| 10080 return ((ancestor as CascadeExpression)).target; | 9984 return ((ancestor as CascadeExpression)).target; |
| 10081 } | 9985 } |
| 10082 return _target; | 9986 return _target; |
| 10083 } | 9987 } |
| 10084 | 9988 |
| 10085 /** | 9989 /** |
| 10086 * Return the expression computing the object defining the property being acce
ssed, or{@code null} if this property access is part of a cascade expression. | 9990 * Return the expression computing the object defining the property being acce
ssed, or{@code null} if this property access is part of a cascade expression. |
| 10087 * @return the expression computing the object defining the property being acc
essed | 9991 * @return the expression computing the object defining the property being acc
essed |
| 10088 * @see #getRealTarget() | 9992 * @see #getRealTarget() |
| 10089 */ | 9993 */ |
| 10090 Expression get target => _target; | 9994 Expression get target => _target; |
| 10091 bool isAssignable() => true; | 9995 bool isAssignable() => true; |
| 10092 | 9996 |
| 10093 /** | 9997 /** |
| 10094 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this | 9998 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this |
| 10095 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. | 9999 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. |
| 10096 * @return {@code true} if this expression is cascaded | 10000 * @return {@code true} if this expression is cascaded |
| 10097 */ | 10001 */ |
| 10098 bool isCascaded() => _operator != null && identical(_operator.type, TokenType.
PERIOD_PERIOD); | 10002 bool isCascaded() => _operator != null && identical(_operator.type, TokenType.
PERIOD_PERIOD); |
| 10099 | 10003 |
| 10100 /** | 10004 /** |
| 10101 * Set the property access operator to the given token. | 10005 * Set the property access operator to the given token. |
| 10102 * @param operator the property access operator | 10006 * @param operator the property access operator |
| 10103 */ | 10007 */ |
| 10104 void set operator(Token operator2) { | 10008 void set operator(Token operator2) { |
| 10105 this._operator = operator2; | 10009 this._operator = operator2; |
| 10106 } | 10010 } |
| 10107 | 10011 |
| 10108 /** | 10012 /** |
| 10109 * Set the name of the property being accessed to the given identifier. | 10013 * Set the name of the property being accessed to the given identifier. |
| 10110 * @param identifier the name of the property being accessed | 10014 * @param identifier the name of the property being accessed |
| 10111 */ | 10015 */ |
| 10112 void set propertyName(SimpleIdentifier identifier) { | 10016 void set propertyName(SimpleIdentifier identifier) { |
| 10113 _propertyName = becomeParentOf(identifier); | 10017 _propertyName = becomeParentOf(identifier); |
| 10114 } | 10018 } |
| 10115 | 10019 |
| 10116 /** | 10020 /** |
| 10117 * Set the expression computing the object defining the property being accesse
d to the given | 10021 * Set the expression computing the object defining the property being accesse
d to the given |
| 10118 * expression. | 10022 * expression. |
| 10119 * @param expression the expression computing the object defining the property
being accessed | 10023 * @param expression the expression computing the object defining the property
being accessed |
| 10120 */ | 10024 */ |
| 10121 void set target(Expression expression) { | 10025 void set target(Expression expression) { |
| 10122 _target = becomeParentOf(expression); | 10026 _target = becomeParentOf(expression); |
| 10123 } | 10027 } |
| 10124 void visitChildren(ASTVisitor<Object> visitor) { | 10028 void visitChildren(ASTVisitor<Object> visitor) { |
| 10125 safelyVisitChild(_target, visitor); | 10029 safelyVisitChild(_target, visitor); |
| 10126 safelyVisitChild(_propertyName, visitor); | 10030 safelyVisitChild(_propertyName, visitor); |
| 10127 } | 10031 } |
| 10128 } | 10032 } |
| 10129 | |
| 10130 /** | 10033 /** |
| 10131 * Instances of the class {@code RedirectingConstructorInvocation} represent the
invocation of a | 10034 * Instances of the class {@code RedirectingConstructorInvocation} represent the
invocation of a |
| 10132 * another constructor in the same class from within a constructor's initializat
ion list. | 10035 * another constructor in the same class from within a constructor's initializat
ion list. |
| 10133 * <pre> | 10036 * <pre> |
| 10134 * redirectingConstructorInvocation ::= | 10037 * redirectingConstructorInvocation ::= |
| 10135 * 'this' ('.' identifier)? arguments | 10038 * 'this' ('.' identifier)? arguments |
| 10136 * </pre> | 10039 * </pre> |
| 10137 * @coverage dart.engine.ast | 10040 * @coverage dart.engine.ast |
| 10138 */ | 10041 */ |
| 10139 class RedirectingConstructorInvocation extends ConstructorInitializer { | 10042 class RedirectingConstructorInvocation extends ConstructorInitializer { |
| 10140 | 10043 |
| 10141 /** | 10044 /** |
| 10142 * The token for the 'this' keyword. | 10045 * The token for the 'this' keyword. |
| 10143 */ | 10046 */ |
| 10144 Token _keyword; | 10047 Token _keyword; |
| 10145 | 10048 |
| 10146 /** | 10049 /** |
| 10147 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. | 10050 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. |
| 10148 */ | 10051 */ |
| 10149 Token _period; | 10052 Token _period; |
| 10150 | 10053 |
| 10151 /** | 10054 /** |
| 10152 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor | 10055 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor |
| 10153 * is being invoked. | 10056 * is being invoked. |
| 10154 */ | 10057 */ |
| 10155 SimpleIdentifier _constructorName; | 10058 SimpleIdentifier _constructorName; |
| 10156 | 10059 |
| 10157 /** | 10060 /** |
| 10158 * The list of arguments to the constructor. | 10061 * The list of arguments to the constructor. |
| 10159 */ | 10062 */ |
| 10160 ArgumentList _argumentList; | 10063 ArgumentList _argumentList; |
| 10161 | 10064 |
| 10162 /** | 10065 /** |
| 10163 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. | 10066 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. |
| 10164 */ | 10067 */ |
| 10165 ConstructorElement _staticElement; | 10068 ConstructorElement _staticElement; |
| 10166 | 10069 |
| 10167 /** | 10070 /** |
| 10168 * The element associated with the constructor based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if the const
ructor could not be | 10071 * The element associated with the constructor based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if the const
ructor could not be |
| 10169 * resolved. | 10072 * resolved. |
| 10170 */ | 10073 */ |
| 10171 ConstructorElement _propagatedElement; | 10074 ConstructorElement _propagatedElement; |
| 10172 | 10075 |
| 10173 /** | 10076 /** |
| 10174 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name | 10077 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name |
| 10175 * with the given arguments. | 10078 * with the given arguments. |
| 10176 * @param keyword the token for the 'this' keyword | 10079 * @param keyword the token for the 'this' keyword |
| 10177 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10080 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 10178 * @param constructorName the name of the constructor that is being invoked | 10081 * @param constructorName the name of the constructor that is being invoked |
| 10179 * @param argumentList the list of arguments to the constructor | 10082 * @param argumentList the list of arguments to the constructor |
| 10180 */ | 10083 */ |
| 10181 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent
ifier constructorName, ArgumentList argumentList) { | 10084 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent
ifier constructorName, ArgumentList argumentList) { |
| 10182 this._keyword = keyword; | 10085 this._keyword = keyword; |
| 10183 this._period = period; | 10086 this._period = period; |
| 10184 this._constructorName = becomeParentOf(constructorName); | 10087 this._constructorName = becomeParentOf(constructorName); |
| 10185 this._argumentList = becomeParentOf(argumentList); | 10088 this._argumentList = becomeParentOf(argumentList); |
| 10186 } | 10089 } |
| 10187 | 10090 |
| 10188 /** | 10091 /** |
| 10189 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name | 10092 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name |
| 10190 * with the given arguments. | 10093 * with the given arguments. |
| 10191 * @param keyword the token for the 'this' keyword | 10094 * @param keyword the token for the 'this' keyword |
| 10192 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10095 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 10193 * @param constructorName the name of the constructor that is being invoked | 10096 * @param constructorName the name of the constructor that is being invoked |
| 10194 * @param argumentList the list of arguments to the constructor | 10097 * @param argumentList the list of arguments to the constructor |
| 10195 */ | 10098 */ |
| 10196 RedirectingConstructorInvocation({Token keyword, Token period, SimpleIdentifie
r constructorName, ArgumentList argumentList}) : this.full(keyword, period, cons
tructorName, argumentList); | 10099 RedirectingConstructorInvocation({Token keyword, Token period, SimpleIdentifie
r constructorName, ArgumentList argumentList}) : this.full(keyword, period, cons
tructorName, argumentList); |
| 10197 accept(ASTVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th
is); | 10100 accept(ASTVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th
is); |
| 10198 | 10101 |
| 10199 /** | 10102 /** |
| 10200 * Return the list of arguments to the constructor. | 10103 * Return the list of arguments to the constructor. |
| 10201 * @return the list of arguments to the constructor | 10104 * @return the list of arguments to the constructor |
| 10202 */ | 10105 */ |
| 10203 ArgumentList get argumentList => _argumentList; | 10106 ArgumentList get argumentList => _argumentList; |
| 10204 Token get beginToken => _keyword; | 10107 Token get beginToken => _keyword; |
| 10205 | 10108 |
| 10206 /** | 10109 /** |
| 10207 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed | 10110 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed |
| 10208 * constructor is being invoked. | 10111 * constructor is being invoked. |
| 10209 * @return the name of the constructor that is being invoked | 10112 * @return the name of the constructor that is being invoked |
| 10210 */ | 10113 */ |
| 10211 SimpleIdentifier get constructorName => _constructorName; | 10114 SimpleIdentifier get constructorName => _constructorName; |
| 10212 | 10115 |
| 10213 /** | 10116 /** |
| 10214 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be | 10117 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be |
| 10215 * resolved. | 10118 * resolved. |
| 10216 * @return the element associated with the super constructor | 10119 * @return the element associated with the super constructor |
| 10217 */ | 10120 */ |
| 10218 ConstructorElement get element => _propagatedElement; | 10121 ConstructorElement get element => _propagatedElement; |
| 10219 Token get endToken => _argumentList.endToken; | 10122 Token get endToken => _argumentList.endToken; |
| 10220 | 10123 |
| 10221 /** | 10124 /** |
| 10222 * Return the token for the 'this' keyword. | 10125 * Return the token for the 'this' keyword. |
| 10223 * @return the token for the 'this' keyword | 10126 * @return the token for the 'this' keyword |
| 10224 */ | 10127 */ |
| 10225 Token get keyword => _keyword; | 10128 Token get keyword => _keyword; |
| 10226 | 10129 |
| 10227 /** | 10130 /** |
| 10228 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. | 10131 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. |
| 10229 * @return the token for the period before the name of the constructor that is
being invoked | 10132 * @return the token for the period before the name of the constructor that is
being invoked |
| 10230 */ | 10133 */ |
| 10231 Token get period => _period; | 10134 Token get period => _period; |
| 10232 | 10135 |
| 10233 /** | 10136 /** |
| 10234 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be | 10137 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be |
| 10235 * resolved. | 10138 * resolved. |
| 10236 * @return the element associated with the constructor | 10139 * @return the element associated with the constructor |
| 10237 */ | 10140 */ |
| 10238 ConstructorElement get staticElement => _staticElement; | 10141 ConstructorElement get staticElement => _staticElement; |
| 10239 | 10142 |
| 10240 /** | 10143 /** |
| 10241 * Set the list of arguments to the constructor to the given list. | 10144 * Set the list of arguments to the constructor to the given list. |
| 10242 * @param argumentList the list of arguments to the constructor | 10145 * @param argumentList the list of arguments to the constructor |
| 10243 */ | 10146 */ |
| 10244 void set argumentList(ArgumentList argumentList2) { | 10147 void set argumentList(ArgumentList argumentList2) { |
| 10245 this._argumentList = becomeParentOf(argumentList2); | 10148 this._argumentList = becomeParentOf(argumentList2); |
| 10246 } | 10149 } |
| 10247 | 10150 |
| 10248 /** | 10151 /** |
| 10249 * Set the name of the constructor that is being invoked to the given identifi
er. | 10152 * Set the name of the constructor that is being invoked to the given identifi
er. |
| 10250 * @param identifier the name of the constructor that is being invoked | 10153 * @param identifier the name of the constructor that is being invoked |
| 10251 */ | 10154 */ |
| 10252 void set constructorName(SimpleIdentifier identifier) { | 10155 void set constructorName(SimpleIdentifier identifier) { |
| 10253 _constructorName = becomeParentOf(identifier); | 10156 _constructorName = becomeParentOf(identifier); |
| 10254 } | 10157 } |
| 10255 | 10158 |
| 10256 /** | 10159 /** |
| 10257 * Set the element associated with the constructor based on propagated type in
formation to the | 10160 * Set the element associated with the constructor based on propagated type in
formation to the |
| 10258 * given element. | 10161 * given element. |
| 10259 * @param element the element to be associated with the constructor | 10162 * @param element the element to be associated with the constructor |
| 10260 */ | 10163 */ |
| 10261 void set element(ConstructorElement element2) { | 10164 void set element(ConstructorElement element2) { |
| 10262 _propagatedElement = element2; | 10165 _propagatedElement = element2; |
| 10263 } | 10166 } |
| 10264 | 10167 |
| 10265 /** | 10168 /** |
| 10266 * Set the token for the 'this' keyword to the given token. | 10169 * Set the token for the 'this' keyword to the given token. |
| 10267 * @param keyword the token for the 'this' keyword | 10170 * @param keyword the token for the 'this' keyword |
| 10268 */ | 10171 */ |
| 10269 void set keyword(Token keyword2) { | 10172 void set keyword(Token keyword2) { |
| 10270 this._keyword = keyword2; | 10173 this._keyword = keyword2; |
| 10271 } | 10174 } |
| 10272 | 10175 |
| 10273 /** | 10176 /** |
| 10274 * Set the token for the period before the name of the constructor that is bei
ng invoked to the | 10177 * Set the token for the period before the name of the constructor that is bei
ng invoked to the |
| 10275 * given token. | 10178 * given token. |
| 10276 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10179 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 10277 */ | 10180 */ |
| 10278 void set period(Token period2) { | 10181 void set period(Token period2) { |
| 10279 this._period = period2; | 10182 this._period = period2; |
| 10280 } | 10183 } |
| 10281 | 10184 |
| 10282 /** | 10185 /** |
| 10283 * Set the element associated with the constructor based on static type inform
ation to the given | 10186 * Set the element associated with the constructor based on static type inform
ation to the given |
| 10284 * element. | 10187 * element. |
| 10285 * @param element the element to be associated with the constructor | 10188 * @param element the element to be associated with the constructor |
| 10286 */ | 10189 */ |
| 10287 void set staticElement(ConstructorElement element) { | 10190 void set staticElement(ConstructorElement element) { |
| 10288 this._staticElement = element; | 10191 this._staticElement = element; |
| 10289 } | 10192 } |
| 10290 void visitChildren(ASTVisitor<Object> visitor) { | 10193 void visitChildren(ASTVisitor<Object> visitor) { |
| 10291 safelyVisitChild(_constructorName, visitor); | 10194 safelyVisitChild(_constructorName, visitor); |
| 10292 safelyVisitChild(_argumentList, visitor); | 10195 safelyVisitChild(_argumentList, visitor); |
| 10293 } | 10196 } |
| 10294 } | 10197 } |
| 10295 | |
| 10296 /** | 10198 /** |
| 10297 * Instances of the class {@code RethrowExpression} represent a rethrow expressi
on. | 10199 * Instances of the class {@code RethrowExpression} represent a rethrow expressi
on. |
| 10298 * <pre> | 10200 * <pre> |
| 10299 * rethrowExpression ::= | 10201 * rethrowExpression ::= |
| 10300 * 'rethrow' | 10202 * 'rethrow' |
| 10301 * </pre> | 10203 * </pre> |
| 10302 * @coverage dart.engine.ast | 10204 * @coverage dart.engine.ast |
| 10303 */ | 10205 */ |
| 10304 class RethrowExpression extends Expression { | 10206 class RethrowExpression extends Expression { |
| 10305 | 10207 |
| 10306 /** | 10208 /** |
| 10307 * The token representing the 'rethrow' keyword. | 10209 * The token representing the 'rethrow' keyword. |
| 10308 */ | 10210 */ |
| 10309 Token _keyword; | 10211 Token _keyword; |
| 10310 | 10212 |
| 10311 /** | 10213 /** |
| 10312 * Initialize a newly created rethrow expression. | 10214 * Initialize a newly created rethrow expression. |
| 10313 * @param keyword the token representing the 'rethrow' keyword | 10215 * @param keyword the token representing the 'rethrow' keyword |
| 10314 */ | 10216 */ |
| 10315 RethrowExpression.full(Token keyword) { | 10217 RethrowExpression.full(Token keyword) { |
| 10316 this._keyword = keyword; | 10218 this._keyword = keyword; |
| 10317 } | 10219 } |
| 10318 | 10220 |
| 10319 /** | 10221 /** |
| 10320 * Initialize a newly created rethrow expression. | 10222 * Initialize a newly created rethrow expression. |
| 10321 * @param keyword the token representing the 'rethrow' keyword | 10223 * @param keyword the token representing the 'rethrow' keyword |
| 10322 */ | 10224 */ |
| 10323 RethrowExpression({Token keyword}) : this.full(keyword); | 10225 RethrowExpression({Token keyword}) : this.full(keyword); |
| 10324 accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this); | 10226 accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this); |
| 10325 Token get beginToken => _keyword; | 10227 Token get beginToken => _keyword; |
| 10326 Token get endToken => _keyword; | 10228 Token get endToken => _keyword; |
| 10327 | 10229 |
| 10328 /** | 10230 /** |
| 10329 * Return the token representing the 'rethrow' keyword. | 10231 * Return the token representing the 'rethrow' keyword. |
| 10330 * @return the token representing the 'rethrow' keyword | 10232 * @return the token representing the 'rethrow' keyword |
| 10331 */ | 10233 */ |
| 10332 Token get keyword => _keyword; | 10234 Token get keyword => _keyword; |
| 10333 | 10235 |
| 10334 /** | 10236 /** |
| 10335 * Set the token representing the 'rethrow' keyword to the given token. | 10237 * Set the token representing the 'rethrow' keyword to the given token. |
| 10336 * @param keyword the token representing the 'rethrow' keyword | 10238 * @param keyword the token representing the 'rethrow' keyword |
| 10337 */ | 10239 */ |
| 10338 void set keyword(Token keyword2) { | 10240 void set keyword(Token keyword2) { |
| 10339 this._keyword = keyword2; | 10241 this._keyword = keyword2; |
| 10340 } | 10242 } |
| 10341 void visitChildren(ASTVisitor<Object> visitor) { | 10243 void visitChildren(ASTVisitor<Object> visitor) { |
| 10342 } | 10244 } |
| 10343 } | 10245 } |
| 10344 | |
| 10345 /** | 10246 /** |
| 10346 * Instances of the class {@code ReturnStatement} represent a return statement. | 10247 * Instances of the class {@code ReturnStatement} represent a return statement. |
| 10347 * <pre> | 10248 * <pre> |
| 10348 * returnStatement ::= | 10249 * returnStatement ::= |
| 10349 * 'return' {@link Expression expression}? ';' | 10250 * 'return' {@link Expression expression}? ';' |
| 10350 * </pre> | 10251 * </pre> |
| 10351 * @coverage dart.engine.ast | 10252 * @coverage dart.engine.ast |
| 10352 */ | 10253 */ |
| 10353 class ReturnStatement extends Statement { | 10254 class ReturnStatement extends Statement { |
| 10354 | 10255 |
| 10355 /** | 10256 /** |
| 10356 * The token representing the 'return' keyword. | 10257 * The token representing the 'return' keyword. |
| 10357 */ | 10258 */ |
| 10358 Token _keyword; | 10259 Token _keyword; |
| 10359 | 10260 |
| 10360 /** | 10261 /** |
| 10361 * The expression computing the value to be returned, or {@code null} if no ex
plicit value was | 10262 * The expression computing the value to be returned, or {@code null} if no ex
plicit value was |
| 10362 * provided. | 10263 * provided. |
| 10363 */ | 10264 */ |
| 10364 Expression _expression; | 10265 Expression _expression; |
| 10365 | 10266 |
| 10366 /** | 10267 /** |
| 10367 * The semicolon terminating the statement. | 10268 * The semicolon terminating the statement. |
| 10368 */ | 10269 */ |
| 10369 Token _semicolon; | 10270 Token _semicolon; |
| 10370 | 10271 |
| 10371 /** | 10272 /** |
| 10372 * Initialize a newly created return statement. | 10273 * Initialize a newly created return statement. |
| 10373 * @param keyword the token representing the 'return' keyword | 10274 * @param keyword the token representing the 'return' keyword |
| 10374 * @param expression the expression computing the value to be returned | 10275 * @param expression the expression computing the value to be returned |
| 10375 * @param semicolon the semicolon terminating the statement | 10276 * @param semicolon the semicolon terminating the statement |
| 10376 */ | 10277 */ |
| 10377 ReturnStatement.full(Token keyword, Expression expression, Token semicolon) { | 10278 ReturnStatement.full(Token keyword, Expression expression, Token semicolon) { |
| 10378 this._keyword = keyword; | 10279 this._keyword = keyword; |
| 10379 this._expression = becomeParentOf(expression); | 10280 this._expression = becomeParentOf(expression); |
| 10380 this._semicolon = semicolon; | 10281 this._semicolon = semicolon; |
| 10381 } | 10282 } |
| 10382 | 10283 |
| 10383 /** | 10284 /** |
| 10384 * Initialize a newly created return statement. | 10285 * Initialize a newly created return statement. |
| 10385 * @param keyword the token representing the 'return' keyword | 10286 * @param keyword the token representing the 'return' keyword |
| 10386 * @param expression the expression computing the value to be returned | 10287 * @param expression the expression computing the value to be returned |
| 10387 * @param semicolon the semicolon terminating the statement | 10288 * @param semicolon the semicolon terminating the statement |
| 10388 */ | 10289 */ |
| 10389 ReturnStatement({Token keyword, Expression expression, Token semicolon}) : thi
s.full(keyword, expression, semicolon); | 10290 ReturnStatement({Token keyword, Expression expression, Token semicolon}) : thi
s.full(keyword, expression, semicolon); |
| 10390 accept(ASTVisitor visitor) => visitor.visitReturnStatement(this); | 10291 accept(ASTVisitor visitor) => visitor.visitReturnStatement(this); |
| 10391 Token get beginToken => _keyword; | 10292 Token get beginToken => _keyword; |
| 10392 Token get endToken => _semicolon; | 10293 Token get endToken => _semicolon; |
| 10393 | 10294 |
| 10394 /** | 10295 /** |
| 10395 * Return the expression computing the value to be returned, or {@code null} i
f no explicit value | 10296 * Return the expression computing the value to be returned, or {@code null} i
f no explicit value |
| 10396 * was provided. | 10297 * was provided. |
| 10397 * @return the expression computing the value to be returned | 10298 * @return the expression computing the value to be returned |
| 10398 */ | 10299 */ |
| 10399 Expression get expression => _expression; | 10300 Expression get expression => _expression; |
| 10400 | 10301 |
| 10401 /** | 10302 /** |
| 10402 * Return the token representing the 'return' keyword. | 10303 * Return the token representing the 'return' keyword. |
| 10403 * @return the token representing the 'return' keyword | 10304 * @return the token representing the 'return' keyword |
| 10404 */ | 10305 */ |
| 10405 Token get keyword => _keyword; | 10306 Token get keyword => _keyword; |
| 10406 | 10307 |
| 10407 /** | 10308 /** |
| 10408 * Return the semicolon terminating the statement. | 10309 * Return the semicolon terminating the statement. |
| 10409 * @return the semicolon terminating the statement | 10310 * @return the semicolon terminating the statement |
| 10410 */ | 10311 */ |
| 10411 Token get semicolon => _semicolon; | 10312 Token get semicolon => _semicolon; |
| 10412 | 10313 |
| 10413 /** | 10314 /** |
| 10414 * Set the expression computing the value to be returned to the given expressi
on. | 10315 * Set the expression computing the value to be returned to the given expressi
on. |
| 10415 * @param expression the expression computing the value to be returned | 10316 * @param expression the expression computing the value to be returned |
| 10416 */ | 10317 */ |
| 10417 void set expression(Expression expression2) { | 10318 void set expression(Expression expression2) { |
| 10418 this._expression = becomeParentOf(expression2); | 10319 this._expression = becomeParentOf(expression2); |
| 10419 } | 10320 } |
| 10420 | 10321 |
| 10421 /** | 10322 /** |
| 10422 * Set the token representing the 'return' keyword to the given token. | 10323 * Set the token representing the 'return' keyword to the given token. |
| 10423 * @param keyword the token representing the 'return' keyword | 10324 * @param keyword the token representing the 'return' keyword |
| 10424 */ | 10325 */ |
| 10425 void set keyword(Token keyword2) { | 10326 void set keyword(Token keyword2) { |
| 10426 this._keyword = keyword2; | 10327 this._keyword = keyword2; |
| 10427 } | 10328 } |
| 10428 | 10329 |
| 10429 /** | 10330 /** |
| 10430 * Set the semicolon terminating the statement to the given token. | 10331 * Set the semicolon terminating the statement to the given token. |
| 10431 * @param semicolon the semicolon terminating the statement | 10332 * @param semicolon the semicolon terminating the statement |
| 10432 */ | 10333 */ |
| 10433 void set semicolon(Token semicolon2) { | 10334 void set semicolon(Token semicolon2) { |
| 10434 this._semicolon = semicolon2; | 10335 this._semicolon = semicolon2; |
| 10435 } | 10336 } |
| 10436 void visitChildren(ASTVisitor<Object> visitor) { | 10337 void visitChildren(ASTVisitor<Object> visitor) { |
| 10437 safelyVisitChild(_expression, visitor); | 10338 safelyVisitChild(_expression, visitor); |
| 10438 } | 10339 } |
| 10439 } | 10340 } |
| 10440 | |
| 10441 /** | 10341 /** |
| 10442 * Instances of the class {@code ScriptTag} represent the script tag that can op
tionally occur at | 10342 * Instances of the class {@code ScriptTag} represent the script tag that can op
tionally occur at |
| 10443 * the beginning of a compilation unit. | 10343 * the beginning of a compilation unit. |
| 10444 * <pre> | 10344 * <pre> |
| 10445 * scriptTag ::= | 10345 * scriptTag ::= |
| 10446 * '#!' (~NEWLINE)* NEWLINE | 10346 * '#!' (~NEWLINE)* NEWLINE |
| 10447 * </pre> | 10347 * </pre> |
| 10448 * @coverage dart.engine.ast | 10348 * @coverage dart.engine.ast |
| 10449 */ | 10349 */ |
| 10450 class ScriptTag extends ASTNode { | 10350 class ScriptTag extends ASTNode { |
| 10451 | 10351 |
| 10452 /** | 10352 /** |
| 10453 * The token representing this script tag. | 10353 * The token representing this script tag. |
| 10454 */ | 10354 */ |
| 10455 Token _scriptTag; | 10355 Token _scriptTag; |
| 10456 | 10356 |
| 10457 /** | 10357 /** |
| 10458 * Initialize a newly created script tag. | 10358 * Initialize a newly created script tag. |
| 10459 * @param scriptTag the token representing this script tag | 10359 * @param scriptTag the token representing this script tag |
| 10460 */ | 10360 */ |
| 10461 ScriptTag.full(Token scriptTag) { | 10361 ScriptTag.full(Token scriptTag) { |
| 10462 this._scriptTag = scriptTag; | 10362 this._scriptTag = scriptTag; |
| 10463 } | 10363 } |
| 10464 | 10364 |
| 10465 /** | 10365 /** |
| 10466 * Initialize a newly created script tag. | 10366 * Initialize a newly created script tag. |
| 10467 * @param scriptTag the token representing this script tag | 10367 * @param scriptTag the token representing this script tag |
| 10468 */ | 10368 */ |
| 10469 ScriptTag({Token scriptTag}) : this.full(scriptTag); | 10369 ScriptTag({Token scriptTag}) : this.full(scriptTag); |
| 10470 accept(ASTVisitor visitor) => visitor.visitScriptTag(this); | 10370 accept(ASTVisitor visitor) => visitor.visitScriptTag(this); |
| 10471 Token get beginToken => _scriptTag; | 10371 Token get beginToken => _scriptTag; |
| 10472 Token get endToken => _scriptTag; | 10372 Token get endToken => _scriptTag; |
| 10473 | 10373 |
| 10474 /** | 10374 /** |
| 10475 * Return the token representing this script tag. | 10375 * Return the token representing this script tag. |
| 10476 * @return the token representing this script tag | 10376 * @return the token representing this script tag |
| 10477 */ | 10377 */ |
| 10478 Token get scriptTag => _scriptTag; | 10378 Token get scriptTag => _scriptTag; |
| 10479 | 10379 |
| 10480 /** | 10380 /** |
| 10481 * Set the token representing this script tag to the given script tag. | 10381 * Set the token representing this script tag to the given script tag. |
| 10482 * @param scriptTag the token representing this script tag | 10382 * @param scriptTag the token representing this script tag |
| 10483 */ | 10383 */ |
| 10484 void set scriptTag(Token scriptTag2) { | 10384 void set scriptTag(Token scriptTag2) { |
| 10485 this._scriptTag = scriptTag2; | 10385 this._scriptTag = scriptTag2; |
| 10486 } | 10386 } |
| 10487 void visitChildren(ASTVisitor<Object> visitor) { | 10387 void visitChildren(ASTVisitor<Object> visitor) { |
| 10488 } | 10388 } |
| 10489 } | 10389 } |
| 10490 | |
| 10491 /** | 10390 /** |
| 10492 * Instances of the class {@code ShowCombinator} represent a combinator that res
tricts the names | 10391 * Instances of the class {@code ShowCombinator} represent a combinator that res
tricts the names |
| 10493 * being imported to those in a given list. | 10392 * being imported to those in a given list. |
| 10494 * <pre> | 10393 * <pre> |
| 10495 * showCombinator ::= | 10394 * showCombinator ::= |
| 10496 * 'show' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) | 10395 * 'show' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) |
| 10497 * </pre> | 10396 * </pre> |
| 10498 * @coverage dart.engine.ast | 10397 * @coverage dart.engine.ast |
| 10499 */ | 10398 */ |
| 10500 class ShowCombinator extends Combinator { | 10399 class ShowCombinator extends Combinator { |
| 10501 | 10400 |
| 10502 /** | 10401 /** |
| 10503 * The list of names from the library that are made visible by this combinator
. | 10402 * The list of names from the library that are made visible by this combinator
. |
| 10504 */ | 10403 */ |
| 10505 NodeList<SimpleIdentifier> _shownNames; | 10404 NodeList<SimpleIdentifier> _shownNames; |
| 10506 | 10405 |
| 10507 /** | 10406 /** |
| 10508 * Initialize a newly created import show combinator. | 10407 * Initialize a newly created import show combinator. |
| 10509 * @param keyword the comma introducing the combinator | 10408 * @param keyword the comma introducing the combinator |
| 10510 * @param shownNames the list of names from the library that are made visible
by this combinator | 10409 * @param shownNames the list of names from the library that are made visible
by this combinator |
| 10511 */ | 10410 */ |
| 10512 ShowCombinator.full(Token keyword, List<SimpleIdentifier> shownNames) : super.
full(keyword) { | 10411 ShowCombinator.full(Token keyword, List<SimpleIdentifier> shownNames) : super.
full(keyword) { |
| 10513 this._shownNames = new NodeList<SimpleIdentifier>(this); | 10412 this._shownNames = new NodeList<SimpleIdentifier>(this); |
| 10514 this._shownNames.addAll(shownNames); | 10413 this._shownNames.addAll(shownNames); |
| 10515 } | 10414 } |
| 10516 | 10415 |
| 10517 /** | 10416 /** |
| 10518 * Initialize a newly created import show combinator. | 10417 * Initialize a newly created import show combinator. |
| 10519 * @param keyword the comma introducing the combinator | 10418 * @param keyword the comma introducing the combinator |
| 10520 * @param shownNames the list of names from the library that are made visible
by this combinator | 10419 * @param shownNames the list of names from the library that are made visible
by this combinator |
| 10521 */ | 10420 */ |
| 10522 ShowCombinator({Token keyword, List<SimpleIdentifier> shownNames}) : this.full
(keyword, shownNames); | 10421 ShowCombinator({Token keyword, List<SimpleIdentifier> shownNames}) : this.full
(keyword, shownNames); |
| 10523 accept(ASTVisitor visitor) => visitor.visitShowCombinator(this); | 10422 accept(ASTVisitor visitor) => visitor.visitShowCombinator(this); |
| 10524 Token get endToken => _shownNames.endToken; | 10423 Token get endToken => _shownNames.endToken; |
| 10525 | 10424 |
| 10526 /** | 10425 /** |
| 10527 * Return the list of names from the library that are made visible by this com
binator. | 10426 * Return the list of names from the library that are made visible by this com
binator. |
| 10528 * @return the list of names from the library that are made visible by this co
mbinator | 10427 * @return the list of names from the library that are made visible by this co
mbinator |
| 10529 */ | 10428 */ |
| 10530 NodeList<SimpleIdentifier> get shownNames => _shownNames; | 10429 NodeList<SimpleIdentifier> get shownNames => _shownNames; |
| 10531 void visitChildren(ASTVisitor<Object> visitor) { | 10430 void visitChildren(ASTVisitor<Object> visitor) { |
| 10532 _shownNames.accept(visitor); | 10431 _shownNames.accept(visitor); |
| 10533 } | 10432 } |
| 10534 } | 10433 } |
| 10535 | |
| 10536 /** | 10434 /** |
| 10537 * Instances of the class {@code SimpleFormalParameter} represent a simple forma
l parameter. | 10435 * Instances of the class {@code SimpleFormalParameter} represent a simple forma
l parameter. |
| 10538 * <pre> | 10436 * <pre> |
| 10539 * simpleFormalParameter ::= | 10437 * simpleFormalParameter ::= |
| 10540 * ('final' {@link TypeName type} | 'var' | {@link TypeName type})? {@link Simpl
eIdentifier identifier}</pre> | 10438 * ('final' {@link TypeName type} | 'var' | {@link TypeName type})? {@link Simpl
eIdentifier identifier}</pre> |
| 10541 * @coverage dart.engine.ast | 10439 * @coverage dart.engine.ast |
| 10542 */ | 10440 */ |
| 10543 class SimpleFormalParameter extends NormalFormalParameter { | 10441 class SimpleFormalParameter extends NormalFormalParameter { |
| 10544 | 10442 |
| 10545 /** | 10443 /** |
| 10546 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 10444 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
| 10547 * keyword was used. | 10445 * keyword was used. |
| 10548 */ | 10446 */ |
| 10549 Token _keyword; | 10447 Token _keyword; |
| 10550 | 10448 |
| 10551 /** | 10449 /** |
| 10552 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have | 10450 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have |
| 10553 * a declared type. | 10451 * a declared type. |
| 10554 */ | 10452 */ |
| 10555 TypeName _type; | 10453 TypeName _type; |
| 10556 | 10454 |
| 10557 /** | 10455 /** |
| 10558 * Initialize a newly created formal parameter. | 10456 * Initialize a newly created formal parameter. |
| 10559 * @param comment the documentation comment associated with this parameter | 10457 * @param comment the documentation comment associated with this parameter |
| 10560 * @param metadata the annotations associated with this parameter | 10458 * @param metadata the annotations associated with this parameter |
| 10561 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 10459 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 10562 * @param type the name of the declared type of the parameter | 10460 * @param type the name of the declared type of the parameter |
| 10563 * @param identifier the name of the parameter being declared | 10461 * @param identifier the name of the parameter being declared |
| 10564 */ | 10462 */ |
| 10565 SimpleFormalParameter.full(Comment comment, List<Annotation> metadata, Token k
eyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metada
ta, identifier) { | 10463 SimpleFormalParameter.full(Comment comment, List<Annotation> metadata, Token k
eyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metada
ta, identifier) { |
| 10566 this._keyword = keyword; | 10464 this._keyword = keyword; |
| 10567 this._type = becomeParentOf(type); | 10465 this._type = becomeParentOf(type); |
| 10568 } | 10466 } |
| 10569 | 10467 |
| 10570 /** | 10468 /** |
| 10571 * Initialize a newly created formal parameter. | 10469 * Initialize a newly created formal parameter. |
| 10572 * @param comment the documentation comment associated with this parameter | 10470 * @param comment the documentation comment associated with this parameter |
| 10573 * @param metadata the annotations associated with this parameter | 10471 * @param metadata the annotations associated with this parameter |
| 10574 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 10472 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 10575 * @param type the name of the declared type of the parameter | 10473 * @param type the name of the declared type of the parameter |
| 10576 * @param identifier the name of the parameter being declared | 10474 * @param identifier the name of the parameter being declared |
| 10577 */ | 10475 */ |
| 10578 SimpleFormalParameter({Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata,
keyword, type, identifier); | 10476 SimpleFormalParameter({Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata,
keyword, type, identifier); |
| 10579 accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this); | 10477 accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this); |
| 10580 Token get beginToken { | 10478 Token get beginToken { |
| 10581 if (_keyword != null) { | 10479 if (_keyword != null) { |
| 10582 return _keyword; | 10480 return _keyword; |
| 10583 } else if (_type != null) { | 10481 } else if (_type != null) { |
| 10584 return _type.beginToken; | 10482 return _type.beginToken; |
| 10585 } | 10483 } |
| 10586 return identifier.beginToken; | 10484 return identifier.beginToken; |
| 10587 } | 10485 } |
| 10588 Token get endToken => identifier.endToken; | 10486 Token get endToken => identifier.endToken; |
| 10589 | 10487 |
| 10590 /** | 10488 /** |
| 10591 * Return the token representing either the 'final', 'const' or 'var' keyword. | 10489 * Return the token representing either the 'final', 'const' or 'var' keyword. |
| 10592 * @return the token representing either the 'final', 'const' or 'var' keyword | 10490 * @return the token representing either the 'final', 'const' or 'var' keyword |
| 10593 */ | 10491 */ |
| 10594 Token get keyword => _keyword; | 10492 Token get keyword => _keyword; |
| 10595 | 10493 |
| 10596 /** | 10494 /** |
| 10597 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does | 10495 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does |
| 10598 * not have a declared type. | 10496 * not have a declared type. |
| 10599 * @return the name of the declared type of the parameter | 10497 * @return the name of the declared type of the parameter |
| 10600 */ | 10498 */ |
| 10601 TypeName get type => _type; | 10499 TypeName get type => _type; |
| 10602 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 10500 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
| 10603 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); | 10501 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); |
| 10604 | 10502 |
| 10605 /** | 10503 /** |
| 10606 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 10504 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
| 10607 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 10505 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 10608 */ | 10506 */ |
| 10609 void set keyword(Token keyword2) { | 10507 void set keyword(Token keyword2) { |
| 10610 this._keyword = keyword2; | 10508 this._keyword = keyword2; |
| 10611 } | 10509 } |
| 10612 | 10510 |
| 10613 /** | 10511 /** |
| 10614 * Set the name of the declared type of the parameter to the given type name. | 10512 * Set the name of the declared type of the parameter to the given type name. |
| 10615 * @param typeName the name of the declared type of the parameter | 10513 * @param typeName the name of the declared type of the parameter |
| 10616 */ | 10514 */ |
| 10617 void set type(TypeName typeName) { | 10515 void set type(TypeName typeName) { |
| 10618 _type = becomeParentOf(typeName); | 10516 _type = becomeParentOf(typeName); |
| 10619 } | 10517 } |
| 10620 void visitChildren(ASTVisitor<Object> visitor) { | 10518 void visitChildren(ASTVisitor<Object> visitor) { |
| 10621 super.visitChildren(visitor); | 10519 super.visitChildren(visitor); |
| 10622 safelyVisitChild(_type, visitor); | 10520 safelyVisitChild(_type, visitor); |
| 10623 safelyVisitChild(identifier, visitor); | 10521 safelyVisitChild(identifier, visitor); |
| 10624 } | 10522 } |
| 10625 } | 10523 } |
| 10626 | |
| 10627 /** | 10524 /** |
| 10628 * Instances of the class {@code SimpleIdentifier} represent a simple identifier
. | 10525 * Instances of the class {@code SimpleIdentifier} represent a simple identifier
. |
| 10629 * <pre> | 10526 * <pre> |
| 10630 * simpleIdentifier ::= | 10527 * simpleIdentifier ::= |
| 10631 * initialCharacter internalCharacter | 10528 * initialCharacter internalCharacter |
| 10632 * initialCharacter ::= '_' | '$' | letter | 10529 * initialCharacter ::= '_' | '$' | letter |
| 10633 * internalCharacter ::= '_' | '$' | letter | digit | 10530 * internalCharacter ::= '_' | '$' | letter | digit |
| 10634 * </pre> | 10531 * </pre> |
| 10635 * @coverage dart.engine.ast | 10532 * @coverage dart.engine.ast |
| 10636 */ | 10533 */ |
| 10637 class SimpleIdentifier extends Identifier { | 10534 class SimpleIdentifier extends Identifier { |
| 10638 | 10535 |
| 10639 /** | 10536 /** |
| 10640 * The token representing the identifier. | 10537 * The token representing the identifier. |
| 10641 */ | 10538 */ |
| 10642 Token _token; | 10539 Token _token; |
| 10643 | 10540 |
| 10644 /** | 10541 /** |
| 10645 * The element associated with this identifier based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if this identifi
er could not be resolved. | 10542 * The element associated with this identifier based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if this identifi
er could not be resolved. |
| 10646 */ | 10543 */ |
| 10647 Element _staticElement; | 10544 Element _staticElement; |
| 10648 | 10545 |
| 10649 /** | 10546 /** |
| 10650 * The element associated with this identifier based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if this iden
tifier could not be | 10547 * The element associated with this identifier based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if this iden
tifier could not be |
| 10651 * resolved. | 10548 * resolved. |
| 10652 */ | 10549 */ |
| 10653 Element _propagatedElement; | 10550 Element _propagatedElement; |
| 10654 | 10551 |
| 10655 /** | 10552 /** |
| 10656 * Initialize a newly created identifier. | 10553 * Initialize a newly created identifier. |
| 10657 * @param token the token representing the identifier | 10554 * @param token the token representing the identifier |
| 10658 */ | 10555 */ |
| 10659 SimpleIdentifier.full(Token token) { | 10556 SimpleIdentifier.full(Token token) { |
| 10660 this._token = token; | 10557 this._token = token; |
| 10661 } | 10558 } |
| 10662 | 10559 |
| 10663 /** | 10560 /** |
| 10664 * Initialize a newly created identifier. | 10561 * Initialize a newly created identifier. |
| 10665 * @param token the token representing the identifier | 10562 * @param token the token representing the identifier |
| 10666 */ | 10563 */ |
| 10667 SimpleIdentifier({Token token}) : this.full(token); | 10564 SimpleIdentifier({Token token}) : this.full(token); |
| 10668 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); | 10565 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); |
| 10669 Token get beginToken => _token; | 10566 Token get beginToken => _token; |
| 10670 Element get element => _propagatedElement; | 10567 Element get element => _propagatedElement; |
| 10671 Token get endToken => _token; | 10568 Token get endToken => _token; |
| 10672 String get name => _token.lexeme; | 10569 String get name => _token.lexeme; |
| 10673 Element get staticElement => _staticElement; | 10570 Element get staticElement => _staticElement; |
| 10674 | 10571 |
| 10675 /** | 10572 /** |
| 10676 * Return the token representing the identifier. | 10573 * Return the token representing the identifier. |
| 10677 * @return the token representing the identifier | 10574 * @return the token representing the identifier |
| 10678 */ | 10575 */ |
| 10679 Token get token => _token; | 10576 Token get token => _token; |
| 10680 | 10577 |
| 10681 /** | 10578 /** |
| 10682 * Return {@code true} if this identifier is the name being declared in a decl
aration. | 10579 * Return {@code true} if this identifier is the name being declared in a decl
aration. |
| 10683 * @return {@code true} if this identifier is the name being declared in a dec
laration | 10580 * @return {@code true} if this identifier is the name being declared in a dec
laration |
| 10684 */ | 10581 */ |
| 10685 bool inDeclarationContext() { | 10582 bool inDeclarationContext() { |
| 10686 ASTNode parent2 = parent; | 10583 ASTNode parent2 = parent; |
| 10687 if (parent2 is CatchClause) { | 10584 if (parent2 is CatchClause) { |
| 10688 CatchClause clause = parent2 as CatchClause; | 10585 CatchClause clause = parent2 as CatchClause; |
| 10689 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); | 10586 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); |
| 10690 } else if (parent2 is ClassDeclaration) { | 10587 } else if (parent2 is ClassDeclaration) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 10703 return identical(this, ((parent2 as MethodDeclaration)).name); | 10600 return identical(this, ((parent2 as MethodDeclaration)).name); |
| 10704 } else if (parent2 is FunctionTypedFormalParameter || parent2 is SimpleForma
lParameter) { | 10601 } else if (parent2 is FunctionTypedFormalParameter || parent2 is SimpleForma
lParameter) { |
| 10705 return identical(this, ((parent2 as NormalFormalParameter)).identifier); | 10602 return identical(this, ((parent2 as NormalFormalParameter)).identifier); |
| 10706 } else if (parent2 is TypeParameter) { | 10603 } else if (parent2 is TypeParameter) { |
| 10707 return identical(this, ((parent2 as TypeParameter)).name); | 10604 return identical(this, ((parent2 as TypeParameter)).name); |
| 10708 } else if (parent2 is VariableDeclaration) { | 10605 } else if (parent2 is VariableDeclaration) { |
| 10709 return identical(this, ((parent2 as VariableDeclaration)).name); | 10606 return identical(this, ((parent2 as VariableDeclaration)).name); |
| 10710 } | 10607 } |
| 10711 return false; | 10608 return false; |
| 10712 } | 10609 } |
| 10713 | 10610 |
| 10714 /** | 10611 /** |
| 10715 * Return {@code true} if this expression is computing a right-hand value. | 10612 * Return {@code true} if this expression is computing a right-hand value. |
| 10716 * <p> | 10613 * <p> |
| 10717 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 10614 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
| 10718 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 10615 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
| 10719 * @return {@code true} if this expression is in a context where a getter will
be invoked | 10616 * @return {@code true} if this expression is in a context where a getter will
be invoked |
| 10720 */ | 10617 */ |
| 10721 bool inGetterContext() { | 10618 bool inGetterContext() { |
| 10722 ASTNode parent2 = parent; | 10619 ASTNode parent2 = parent; |
| 10723 ASTNode target = this; | 10620 ASTNode target = this; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 10740 return false; | 10637 return false; |
| 10741 } | 10638 } |
| 10742 if (parent2 is AssignmentExpression) { | 10639 if (parent2 is AssignmentExpression) { |
| 10743 AssignmentExpression expr = parent2 as AssignmentExpression; | 10640 AssignmentExpression expr = parent2 as AssignmentExpression; |
| 10744 if (identical(expr.leftHandSide, target) && identical(expr.operator.type,
TokenType.EQ)) { | 10641 if (identical(expr.leftHandSide, target) && identical(expr.operator.type,
TokenType.EQ)) { |
| 10745 return false; | 10642 return false; |
| 10746 } | 10643 } |
| 10747 } | 10644 } |
| 10748 return true; | 10645 return true; |
| 10749 } | 10646 } |
| 10750 | 10647 |
| 10751 /** | 10648 /** |
| 10752 * Return {@code true} if this expression is computing a left-hand value. | 10649 * Return {@code true} if this expression is computing a left-hand value. |
| 10753 * <p> | 10650 * <p> |
| 10754 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 10651 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
| 10755 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 10652 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
| 10756 * @return {@code true} if this expression is in a context where a setter will
be invoked | 10653 * @return {@code true} if this expression is in a context where a setter will
be invoked |
| 10757 */ | 10654 */ |
| 10758 bool inSetterContext() { | 10655 bool inSetterContext() { |
| 10759 ASTNode parent2 = parent; | 10656 ASTNode parent2 = parent; |
| 10760 ASTNode target = this; | 10657 ASTNode target = this; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10776 if (parent2 is PrefixExpression) { | 10673 if (parent2 is PrefixExpression) { |
| 10777 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; | 10674 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; |
| 10778 } else if (parent2 is PostfixExpression) { | 10675 } else if (parent2 is PostfixExpression) { |
| 10779 return true; | 10676 return true; |
| 10780 } else if (parent2 is AssignmentExpression) { | 10677 } else if (parent2 is AssignmentExpression) { |
| 10781 return identical(((parent2 as AssignmentExpression)).leftHandSide, target)
; | 10678 return identical(((parent2 as AssignmentExpression)).leftHandSide, target)
; |
| 10782 } | 10679 } |
| 10783 return false; | 10680 return false; |
| 10784 } | 10681 } |
| 10785 bool isSynthetic() => _token.isSynthetic(); | 10682 bool isSynthetic() => _token.isSynthetic(); |
| 10786 | 10683 |
| 10787 /** | 10684 /** |
| 10788 * Set the element associated with this identifier based on propagated type in
formation to the | 10685 * Set the element associated with this identifier based on propagated type in
formation to the |
| 10789 * given element. | 10686 * given element. |
| 10790 * @param element the element to be associated with this identifier | 10687 * @param element the element to be associated with this identifier |
| 10791 */ | 10688 */ |
| 10792 void set element(Element element2) { | 10689 void set element(Element element2) { |
| 10793 _propagatedElement = element2; | 10690 _propagatedElement = element2; |
| 10794 } | 10691 } |
| 10795 | 10692 |
| 10796 /** | 10693 /** |
| 10797 * Set the element associated with this identifier based on static type inform
ation to the given | 10694 * Set the element associated with this identifier based on static type inform
ation to the given |
| 10798 * element. | 10695 * element. |
| 10799 * @param element the element to be associated with this identifier | 10696 * @param element the element to be associated with this identifier |
| 10800 */ | 10697 */ |
| 10801 void set staticElement(Element element) { | 10698 void set staticElement(Element element) { |
| 10802 _staticElement = element; | 10699 _staticElement = element; |
| 10803 } | 10700 } |
| 10804 | 10701 |
| 10805 /** | 10702 /** |
| 10806 * Set the token representing the identifier to the given token. | 10703 * Set the token representing the identifier to the given token. |
| 10807 * @param token the token representing the literal | 10704 * @param token the token representing the literal |
| 10808 */ | 10705 */ |
| 10809 void set token(Token token2) { | 10706 void set token(Token token2) { |
| 10810 this._token = token2; | 10707 this._token = token2; |
| 10811 } | 10708 } |
| 10812 void visitChildren(ASTVisitor<Object> visitor) { | 10709 void visitChildren(ASTVisitor<Object> visitor) { |
| 10813 } | 10710 } |
| 10814 } | 10711 } |
| 10815 | |
| 10816 /** | 10712 /** |
| 10817 * Instances of the class {@code SimpleStringLiteral} represent a string literal
expression that | 10713 * Instances of the class {@code SimpleStringLiteral} represent a string literal
expression that |
| 10818 * does not contain any interpolations. | 10714 * does not contain any interpolations. |
| 10819 * <pre> | 10715 * <pre> |
| 10820 * simpleStringLiteral ::= | 10716 * simpleStringLiteral ::= |
| 10821 * rawStringLiteral | 10717 * rawStringLiteral |
| 10822 * | basicStringLiteral | 10718 * | basicStringLiteral |
| 10823 * rawStringLiteral ::= | 10719 * rawStringLiteral ::= |
| 10824 * '@' basicStringLiteral | 10720 * '@' basicStringLiteral |
| 10825 * simpleStringLiteral ::= | 10721 * simpleStringLiteral ::= |
| 10826 * multiLineStringLiteral | 10722 * multiLineStringLiteral |
| 10827 * | singleLineStringLiteral | 10723 * | singleLineStringLiteral |
| 10828 * multiLineStringLiteral ::= | 10724 * multiLineStringLiteral ::= |
| 10829 * "'''" characters "'''" | 10725 * "'''" characters "'''" |
| 10830 * | '"""' characters '"""' | 10726 * | '"""' characters '"""' |
| 10831 * singleLineStringLiteral ::= | 10727 * singleLineStringLiteral ::= |
| 10832 * "'" characters "'" | 10728 * "'" characters "'" |
| 10833 * '"' characters '"' | 10729 * '"' characters '"' |
| 10834 * </pre> | 10730 * </pre> |
| 10835 * @coverage dart.engine.ast | 10731 * @coverage dart.engine.ast |
| 10836 */ | 10732 */ |
| 10837 class SimpleStringLiteral extends StringLiteral { | 10733 class SimpleStringLiteral extends StringLiteral { |
| 10838 | 10734 |
| 10839 /** | 10735 /** |
| 10840 * The token representing the literal. | 10736 * The token representing the literal. |
| 10841 */ | 10737 */ |
| 10842 Token _literal; | 10738 Token _literal; |
| 10843 | 10739 |
| 10844 /** | 10740 /** |
| 10845 * The value of the literal. | 10741 * The value of the literal. |
| 10846 */ | 10742 */ |
| 10847 String _value; | 10743 String _value; |
| 10848 | 10744 |
| 10849 /** | 10745 /** |
| 10850 * Initialize a newly created simple string literal. | 10746 * Initialize a newly created simple string literal. |
| 10851 * @param literal the token representing the literal | 10747 * @param literal the token representing the literal |
| 10852 * @param value the value of the literal | 10748 * @param value the value of the literal |
| 10853 */ | 10749 */ |
| 10854 SimpleStringLiteral.full(Token literal, String value) { | 10750 SimpleStringLiteral.full(Token literal, String value) { |
| 10855 this._literal = literal; | 10751 this._literal = literal; |
| 10856 this._value = StringUtilities.intern(value); | 10752 this._value = StringUtilities.intern(value); |
| 10857 } | 10753 } |
| 10858 | 10754 |
| 10859 /** | 10755 /** |
| 10860 * Initialize a newly created simple string literal. | 10756 * Initialize a newly created simple string literal. |
| 10861 * @param literal the token representing the literal | 10757 * @param literal the token representing the literal |
| 10862 * @param value the value of the literal | 10758 * @param value the value of the literal |
| 10863 */ | 10759 */ |
| 10864 SimpleStringLiteral({Token literal, String value}) : this.full(literal, value)
; | 10760 SimpleStringLiteral({Token literal, String value}) : this.full(literal, value)
; |
| 10865 accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this); | 10761 accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this); |
| 10866 Token get beginToken => _literal; | 10762 Token get beginToken => _literal; |
| 10867 Token get endToken => _literal; | 10763 Token get endToken => _literal; |
| 10868 | 10764 |
| 10869 /** | 10765 /** |
| 10870 * Return the token representing the literal. | 10766 * Return the token representing the literal. |
| 10871 * @return the token representing the literal | 10767 * @return the token representing the literal |
| 10872 */ | 10768 */ |
| 10873 Token get literal => _literal; | 10769 Token get literal => _literal; |
| 10874 | 10770 |
| 10875 /** | 10771 /** |
| 10876 * Return the value of the literal. | 10772 * Return the value of the literal. |
| 10877 * @return the value of the literal | 10773 * @return the value of the literal |
| 10878 */ | 10774 */ |
| 10879 String get value => _value; | 10775 String get value => _value; |
| 10880 | 10776 |
| 10881 /** | 10777 /** |
| 10882 * Return {@code true} if this string literal is a multi-line string. | 10778 * Return {@code true} if this string literal is a multi-line string. |
| 10883 * @return {@code true} if this string literal is a multi-line string | 10779 * @return {@code true} if this string literal is a multi-line string |
| 10884 */ | 10780 */ |
| 10885 bool isMultiline() { | 10781 bool isMultiline() { |
| 10886 if (_value.length < 6) { | 10782 if (_value.length < 6) { |
| 10887 return false; | 10783 return false; |
| 10888 } | 10784 } |
| 10889 return _value.endsWith("\"\"\"") || _value.endsWith("'''"); | 10785 return _value.endsWith("\"\"\"") || _value.endsWith("'''"); |
| 10890 } | 10786 } |
| 10891 | 10787 |
| 10892 /** | 10788 /** |
| 10893 * Return {@code true} if this string literal is a raw string. | 10789 * Return {@code true} if this string literal is a raw string. |
| 10894 * @return {@code true} if this string literal is a raw string | 10790 * @return {@code true} if this string literal is a raw string |
| 10895 */ | 10791 */ |
| 10896 bool isRaw() => _value.codeUnitAt(0) == 0x40; | 10792 bool isRaw() => _value.codeUnitAt(0) == 0x40; |
| 10897 bool isSynthetic() => _literal.isSynthetic(); | 10793 bool isSynthetic() => _literal.isSynthetic(); |
| 10898 | 10794 |
| 10899 /** | 10795 /** |
| 10900 * Set the token representing the literal to the given token. | 10796 * Set the token representing the literal to the given token. |
| 10901 * @param literal the token representing the literal | 10797 * @param literal the token representing the literal |
| 10902 */ | 10798 */ |
| 10903 void set literal(Token literal2) { | 10799 void set literal(Token literal2) { |
| 10904 this._literal = literal2; | 10800 this._literal = literal2; |
| 10905 } | 10801 } |
| 10906 | 10802 |
| 10907 /** | 10803 /** |
| 10908 * Set the value of the literal to the given string. | 10804 * Set the value of the literal to the given string. |
| 10909 * @param string the value of the literal | 10805 * @param string the value of the literal |
| 10910 */ | 10806 */ |
| 10911 void set value(String string) { | 10807 void set value(String string) { |
| 10912 _value = StringUtilities.intern(_value); | 10808 _value = StringUtilities.intern(_value); |
| 10913 } | 10809 } |
| 10914 void visitChildren(ASTVisitor<Object> visitor) { | 10810 void visitChildren(ASTVisitor<Object> visitor) { |
| 10915 } | 10811 } |
| 10916 void appendStringValue(JavaStringBuilder builder) { | 10812 void appendStringValue(JavaStringBuilder builder) { |
| 10917 builder.append(value); | 10813 builder.append(value); |
| 10918 } | 10814 } |
| 10919 } | 10815 } |
| 10920 | |
| 10921 /** | 10816 /** |
| 10922 * Instances of the class {@code Statement} defines the behavior common to nodes
that represent a | 10817 * Instances of the class {@code Statement} defines the behavior common to nodes
that represent a |
| 10923 * statement. | 10818 * statement. |
| 10924 * <pre> | 10819 * <pre> |
| 10925 * statement ::={@link Block block}| {@link VariableDeclarationStatement initial
izedVariableDeclaration ';'}| {@link ForStatement forStatement}| {@link ForEachS
tatement forEachStatement}| {@link WhileStatement whileStatement}| {@link DoStat
ement doStatement}| {@link SwitchStatement switchStatement}| {@link IfStatement
ifStatement}| {@link TryStatement tryStatement}| {@link BreakStatement breakStat
ement}| {@link ContinueStatement continueStatement}| {@link ReturnStatement retu
rnStatement}| {@link ExpressionStatement expressionStatement}| {@link FunctionDe
clarationStatement functionSignature functionBody}</pre> | 10820 * statement ::={@link Block block}| {@link VariableDeclarationStatement initial
izedVariableDeclaration ';'}| {@link ForStatement forStatement}| {@link ForEachS
tatement forEachStatement}| {@link WhileStatement whileStatement}| {@link DoStat
ement doStatement}| {@link SwitchStatement switchStatement}| {@link IfStatement
ifStatement}| {@link TryStatement tryStatement}| {@link BreakStatement breakStat
ement}| {@link ContinueStatement continueStatement}| {@link ReturnStatement retu
rnStatement}| {@link ExpressionStatement expressionStatement}| {@link FunctionDe
clarationStatement functionSignature functionBody}</pre> |
| 10926 * @coverage dart.engine.ast | 10821 * @coverage dart.engine.ast |
| 10927 */ | 10822 */ |
| 10928 abstract class Statement extends ASTNode { | 10823 abstract class Statement extends ASTNode { |
| 10929 } | 10824 } |
| 10930 | |
| 10931 /** | 10825 /** |
| 10932 * Instances of the class {@code StringInterpolation} represent a string interpo
lation literal. | 10826 * Instances of the class {@code StringInterpolation} represent a string interpo
lation literal. |
| 10933 * <pre> | 10827 * <pre> |
| 10934 * stringInterpolation ::= | 10828 * stringInterpolation ::= |
| 10935 * ''' {@link InterpolationElement interpolationElement}* ''' | 10829 * ''' {@link InterpolationElement interpolationElement}* ''' |
| 10936 * | '"' {@link InterpolationElement interpolationElement}* '"' | 10830 * | '"' {@link InterpolationElement interpolationElement}* '"' |
| 10937 * </pre> | 10831 * </pre> |
| 10938 * @coverage dart.engine.ast | 10832 * @coverage dart.engine.ast |
| 10939 */ | 10833 */ |
| 10940 class StringInterpolation extends StringLiteral { | 10834 class StringInterpolation extends StringLiteral { |
| 10941 | 10835 |
| 10942 /** | 10836 /** |
| 10943 * The elements that will be composed to produce the resulting string. | 10837 * The elements that will be composed to produce the resulting string. |
| 10944 */ | 10838 */ |
| 10945 NodeList<InterpolationElement> _elements; | 10839 NodeList<InterpolationElement> _elements; |
| 10946 | 10840 |
| 10947 /** | 10841 /** |
| 10948 * Initialize a newly created string interpolation expression. | 10842 * Initialize a newly created string interpolation expression. |
| 10949 * @param elements the elements that will be composed to produce the resulting
string | 10843 * @param elements the elements that will be composed to produce the resulting
string |
| 10950 */ | 10844 */ |
| 10951 StringInterpolation.full(List<InterpolationElement> elements) { | 10845 StringInterpolation.full(List<InterpolationElement> elements) { |
| 10952 this._elements = new NodeList<InterpolationElement>(this); | 10846 this._elements = new NodeList<InterpolationElement>(this); |
| 10953 this._elements.addAll(elements); | 10847 this._elements.addAll(elements); |
| 10954 } | 10848 } |
| 10955 | 10849 |
| 10956 /** | 10850 /** |
| 10957 * Initialize a newly created string interpolation expression. | 10851 * Initialize a newly created string interpolation expression. |
| 10958 * @param elements the elements that will be composed to produce the resulting
string | 10852 * @param elements the elements that will be composed to produce the resulting
string |
| 10959 */ | 10853 */ |
| 10960 StringInterpolation({List<InterpolationElement> elements}) : this.full(element
s); | 10854 StringInterpolation({List<InterpolationElement> elements}) : this.full(element
s); |
| 10961 accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this); | 10855 accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this); |
| 10962 Token get beginToken => _elements.beginToken; | 10856 Token get beginToken => _elements.beginToken; |
| 10963 | 10857 |
| 10964 /** | 10858 /** |
| 10965 * Return the elements that will be composed to produce the resulting string. | 10859 * Return the elements that will be composed to produce the resulting string. |
| 10966 * @return the elements that will be composed to produce the resulting string | 10860 * @return the elements that will be composed to produce the resulting string |
| 10967 */ | 10861 */ |
| 10968 NodeList<InterpolationElement> get elements => _elements; | 10862 NodeList<InterpolationElement> get elements => _elements; |
| 10969 Token get endToken => _elements.endToken; | 10863 Token get endToken => _elements.endToken; |
| 10970 void visitChildren(ASTVisitor<Object> visitor) { | 10864 void visitChildren(ASTVisitor<Object> visitor) { |
| 10971 _elements.accept(visitor); | 10865 _elements.accept(visitor); |
| 10972 } | 10866 } |
| 10973 void appendStringValue(JavaStringBuilder builder) { | 10867 void appendStringValue(JavaStringBuilder builder) { |
| 10974 throw new IllegalArgumentException(); | 10868 throw new IllegalArgumentException(); |
| 10975 } | 10869 } |
| 10976 } | 10870 } |
| 10977 | |
| 10978 /** | 10871 /** |
| 10979 * Instances of the class {@code StringLiteral} represent a string literal expre
ssion. | 10872 * Instances of the class {@code StringLiteral} represent a string literal expre
ssion. |
| 10980 * <pre> | 10873 * <pre> |
| 10981 * stringLiteral ::={@link SimpleStringLiteral simpleStringLiteral}| {@link Adja
centStrings adjacentStrings}| {@link StringInterpolation stringInterpolation}</p
re> | 10874 * stringLiteral ::={@link SimpleStringLiteral simpleStringLiteral}| {@link Adja
centStrings adjacentStrings}| {@link StringInterpolation stringInterpolation}</p
re> |
| 10982 * @coverage dart.engine.ast | 10875 * @coverage dart.engine.ast |
| 10983 */ | 10876 */ |
| 10984 abstract class StringLiteral extends Literal { | 10877 abstract class StringLiteral extends Literal { |
| 10985 | 10878 |
| 10986 /** | 10879 /** |
| 10987 * Return the value of the string literal, or {@code null} if the string is no
t a constant string | 10880 * Return the value of the string literal, or {@code null} if the string is no
t a constant string |
| 10988 * without any string interpolation. | 10881 * without any string interpolation. |
| 10989 * @return the value of the string literal | 10882 * @return the value of the string literal |
| 10990 */ | 10883 */ |
| 10991 String get stringValue { | 10884 String get stringValue { |
| 10992 JavaStringBuilder builder = new JavaStringBuilder(); | 10885 JavaStringBuilder builder = new JavaStringBuilder(); |
| 10993 try { | 10886 try { |
| 10994 appendStringValue(builder); | 10887 appendStringValue(builder); |
| 10995 } on IllegalArgumentException catch (exception) { | 10888 } on IllegalArgumentException catch (exception) { |
| 10996 return null; | 10889 return null; |
| 10997 } | 10890 } |
| 10998 return builder.toString(); | 10891 return builder.toString(); |
| 10999 } | 10892 } |
| 11000 | 10893 |
| 11001 /** | 10894 /** |
| 11002 * Append the value of the given string literal to the given string builder. | 10895 * Append the value of the given string literal to the given string builder. |
| 11003 * @param builder the builder to which the string's value is to be appended | 10896 * @param builder the builder to which the string's value is to be appended |
| 11004 * @throws IllegalArgumentException if the string is not a constant string wit
hout any string | 10897 * @throws IllegalArgumentException if the string is not a constant string wit
hout any string |
| 11005 * interpolation | 10898 * interpolation |
| 11006 */ | 10899 */ |
| 11007 void appendStringValue(JavaStringBuilder builder); | 10900 void appendStringValue(JavaStringBuilder builder); |
| 11008 } | 10901 } |
| 11009 | |
| 11010 /** | 10902 /** |
| 11011 * Instances of the class {@code SuperConstructorInvocation} represent the invoc
ation of a | 10903 * Instances of the class {@code SuperConstructorInvocation} represent the invoc
ation of a |
| 11012 * superclass' constructor from within a constructor's initialization list. | 10904 * superclass' constructor from within a constructor's initialization list. |
| 11013 * <pre> | 10905 * <pre> |
| 11014 * superInvocation ::= | 10906 * superInvocation ::= |
| 11015 * 'super' ('.' {@link SimpleIdentifier name})? {@link ArgumentList argumentList
}</pre> | 10907 * 'super' ('.' {@link SimpleIdentifier name})? {@link ArgumentList argumentList
}</pre> |
| 11016 * @coverage dart.engine.ast | 10908 * @coverage dart.engine.ast |
| 11017 */ | 10909 */ |
| 11018 class SuperConstructorInvocation extends ConstructorInitializer { | 10910 class SuperConstructorInvocation extends ConstructorInitializer { |
| 11019 | 10911 |
| 11020 /** | 10912 /** |
| 11021 * The token for the 'super' keyword. | 10913 * The token for the 'super' keyword. |
| 11022 */ | 10914 */ |
| 11023 Token _keyword; | 10915 Token _keyword; |
| 11024 | 10916 |
| 11025 /** | 10917 /** |
| 11026 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. | 10918 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. |
| 11027 */ | 10919 */ |
| 11028 Token _period; | 10920 Token _period; |
| 11029 | 10921 |
| 11030 /** | 10922 /** |
| 11031 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor | 10923 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor |
| 11032 * is being invoked. | 10924 * is being invoked. |
| 11033 */ | 10925 */ |
| 11034 SimpleIdentifier _constructorName; | 10926 SimpleIdentifier _constructorName; |
| 11035 | 10927 |
| 11036 /** | 10928 /** |
| 11037 * The list of arguments to the constructor. | 10929 * The list of arguments to the constructor. |
| 11038 */ | 10930 */ |
| 11039 ArgumentList _argumentList; | 10931 ArgumentList _argumentList; |
| 11040 | 10932 |
| 11041 /** | 10933 /** |
| 11042 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. | 10934 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. |
| 11043 */ | 10935 */ |
| 11044 ConstructorElement _staticElement; | 10936 ConstructorElement _staticElement; |
| 11045 | 10937 |
| 11046 /** | 10938 /** |
| 11047 * The element associated with the constructor based on propagated type inform
ation, or {@code null} if the AST structure has not been | 10939 * The element associated with the constructor based on propagated type inform
ation, or {@code null} if the AST structure has not been |
| 11048 * resolved or if the constructor could not be resolved. | 10940 * resolved or if the constructor could not be resolved. |
| 11049 */ | 10941 */ |
| 11050 ConstructorElement _propagatedElement; | 10942 ConstructorElement _propagatedElement; |
| 11051 | 10943 |
| 11052 /** | 10944 /** |
| 11053 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given | 10945 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given |
| 11054 * name with the given arguments. | 10946 * name with the given arguments. |
| 11055 * @param keyword the token for the 'super' keyword | 10947 * @param keyword the token for the 'super' keyword |
| 11056 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10948 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 11057 * @param constructorName the name of the constructor that is being invoked | 10949 * @param constructorName the name of the constructor that is being invoked |
| 11058 * @param argumentList the list of arguments to the constructor | 10950 * @param argumentList the list of arguments to the constructor |
| 11059 */ | 10951 */ |
| 11060 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier
constructorName, ArgumentList argumentList) { | 10952 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier
constructorName, ArgumentList argumentList) { |
| 11061 this._keyword = keyword; | 10953 this._keyword = keyword; |
| 11062 this._period = period; | 10954 this._period = period; |
| 11063 this._constructorName = becomeParentOf(constructorName); | 10955 this._constructorName = becomeParentOf(constructorName); |
| 11064 this._argumentList = becomeParentOf(argumentList); | 10956 this._argumentList = becomeParentOf(argumentList); |
| 11065 } | 10957 } |
| 11066 | 10958 |
| 11067 /** | 10959 /** |
| 11068 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given | 10960 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given |
| 11069 * name with the given arguments. | 10961 * name with the given arguments. |
| 11070 * @param keyword the token for the 'super' keyword | 10962 * @param keyword the token for the 'super' keyword |
| 11071 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10963 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 11072 * @param constructorName the name of the constructor that is being invoked | 10964 * @param constructorName the name of the constructor that is being invoked |
| 11073 * @param argumentList the list of arguments to the constructor | 10965 * @param argumentList the list of arguments to the constructor |
| 11074 */ | 10966 */ |
| 11075 SuperConstructorInvocation({Token keyword, Token period, SimpleIdentifier cons
tructorName, ArgumentList argumentList}) : this.full(keyword, period, constructo
rName, argumentList); | 10967 SuperConstructorInvocation({Token keyword, Token period, SimpleIdentifier cons
tructorName, ArgumentList argumentList}) : this.full(keyword, period, constructo
rName, argumentList); |
| 11076 accept(ASTVisitor visitor) => visitor.visitSuperConstructorInvocation(this); | 10968 accept(ASTVisitor visitor) => visitor.visitSuperConstructorInvocation(this); |
| 11077 | 10969 |
| 11078 /** | 10970 /** |
| 11079 * Return the list of arguments to the constructor. | 10971 * Return the list of arguments to the constructor. |
| 11080 * @return the list of arguments to the constructor | 10972 * @return the list of arguments to the constructor |
| 11081 */ | 10973 */ |
| 11082 ArgumentList get argumentList => _argumentList; | 10974 ArgumentList get argumentList => _argumentList; |
| 11083 Token get beginToken => _keyword; | 10975 Token get beginToken => _keyword; |
| 11084 | 10976 |
| 11085 /** | 10977 /** |
| 11086 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed | 10978 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed |
| 11087 * constructor is being invoked. | 10979 * constructor is being invoked. |
| 11088 * @return the name of the constructor that is being invoked | 10980 * @return the name of the constructor that is being invoked |
| 11089 */ | 10981 */ |
| 11090 SimpleIdentifier get constructorName => _constructorName; | 10982 SimpleIdentifier get constructorName => _constructorName; |
| 11091 | 10983 |
| 11092 /** | 10984 /** |
| 11093 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be | 10985 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be |
| 11094 * resolved. | 10986 * resolved. |
| 11095 * @return the element associated with the super constructor | 10987 * @return the element associated with the super constructor |
| 11096 */ | 10988 */ |
| 11097 ConstructorElement get element => _propagatedElement; | 10989 ConstructorElement get element => _propagatedElement; |
| 11098 Token get endToken => _argumentList.endToken; | 10990 Token get endToken => _argumentList.endToken; |
| 11099 | 10991 |
| 11100 /** | 10992 /** |
| 11101 * Return the token for the 'super' keyword. | 10993 * Return the token for the 'super' keyword. |
| 11102 * @return the token for the 'super' keyword | 10994 * @return the token for the 'super' keyword |
| 11103 */ | 10995 */ |
| 11104 Token get keyword => _keyword; | 10996 Token get keyword => _keyword; |
| 11105 | 10997 |
| 11106 /** | 10998 /** |
| 11107 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. | 10999 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. |
| 11108 * @return the token for the period before the name of the constructor that is
being invoked | 11000 * @return the token for the period before the name of the constructor that is
being invoked |
| 11109 */ | 11001 */ |
| 11110 Token get period => _period; | 11002 Token get period => _period; |
| 11111 | 11003 |
| 11112 /** | 11004 /** |
| 11113 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be | 11005 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be |
| 11114 * resolved. | 11006 * resolved. |
| 11115 * @return the element associated with the constructor | 11007 * @return the element associated with the constructor |
| 11116 */ | 11008 */ |
| 11117 ConstructorElement get staticElement => _staticElement; | 11009 ConstructorElement get staticElement => _staticElement; |
| 11118 | 11010 |
| 11119 /** | 11011 /** |
| 11120 * Set the list of arguments to the constructor to the given list. | 11012 * Set the list of arguments to the constructor to the given list. |
| 11121 * @param argumentList the list of arguments to the constructor | 11013 * @param argumentList the list of arguments to the constructor |
| 11122 */ | 11014 */ |
| 11123 void set argumentList(ArgumentList argumentList2) { | 11015 void set argumentList(ArgumentList argumentList2) { |
| 11124 this._argumentList = becomeParentOf(argumentList2); | 11016 this._argumentList = becomeParentOf(argumentList2); |
| 11125 } | 11017 } |
| 11126 | 11018 |
| 11127 /** | 11019 /** |
| 11128 * Set the name of the constructor that is being invoked to the given identifi
er. | 11020 * Set the name of the constructor that is being invoked to the given identifi
er. |
| 11129 * @param identifier the name of the constructor that is being invoked | 11021 * @param identifier the name of the constructor that is being invoked |
| 11130 */ | 11022 */ |
| 11131 void set constructorName(SimpleIdentifier identifier) { | 11023 void set constructorName(SimpleIdentifier identifier) { |
| 11132 _constructorName = becomeParentOf(identifier); | 11024 _constructorName = becomeParentOf(identifier); |
| 11133 } | 11025 } |
| 11134 | 11026 |
| 11135 /** | 11027 /** |
| 11136 * Set the element associated with the constructor based on propagated type in
formation to the | 11028 * Set the element associated with the constructor based on propagated type in
formation to the |
| 11137 * given element. | 11029 * given element. |
| 11138 * @param element the element to be associated with the constructor | 11030 * @param element the element to be associated with the constructor |
| 11139 */ | 11031 */ |
| 11140 void set element(ConstructorElement element2) { | 11032 void set element(ConstructorElement element2) { |
| 11141 _propagatedElement = element2; | 11033 _propagatedElement = element2; |
| 11142 } | 11034 } |
| 11143 | 11035 |
| 11144 /** | 11036 /** |
| 11145 * Set the token for the 'super' keyword to the given token. | 11037 * Set the token for the 'super' keyword to the given token. |
| 11146 * @param keyword the token for the 'super' keyword | 11038 * @param keyword the token for the 'super' keyword |
| 11147 */ | 11039 */ |
| 11148 void set keyword(Token keyword2) { | 11040 void set keyword(Token keyword2) { |
| 11149 this._keyword = keyword2; | 11041 this._keyword = keyword2; |
| 11150 } | 11042 } |
| 11151 | 11043 |
| 11152 /** | 11044 /** |
| 11153 * Set the token for the period before the name of the constructor that is bei
ng invoked to the | 11045 * Set the token for the period before the name of the constructor that is bei
ng invoked to the |
| 11154 * given token. | 11046 * given token. |
| 11155 * @param period the token for the period before the name of the constructor t
hat is being invoked | 11047 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 11156 */ | 11048 */ |
| 11157 void set period(Token period2) { | 11049 void set period(Token period2) { |
| 11158 this._period = period2; | 11050 this._period = period2; |
| 11159 } | 11051 } |
| 11160 | 11052 |
| 11161 /** | 11053 /** |
| 11162 * Set the element associated with the constructor based on static type inform
ation to the given | 11054 * Set the element associated with the constructor based on static type inform
ation to the given |
| 11163 * element. | 11055 * element. |
| 11164 * @param element the element to be associated with the constructor | 11056 * @param element the element to be associated with the constructor |
| 11165 */ | 11057 */ |
| 11166 void set staticElement(ConstructorElement element) { | 11058 void set staticElement(ConstructorElement element) { |
| 11167 this._staticElement = element; | 11059 this._staticElement = element; |
| 11168 } | 11060 } |
| 11169 void visitChildren(ASTVisitor<Object> visitor) { | 11061 void visitChildren(ASTVisitor<Object> visitor) { |
| 11170 safelyVisitChild(_constructorName, visitor); | 11062 safelyVisitChild(_constructorName, visitor); |
| 11171 safelyVisitChild(_argumentList, visitor); | 11063 safelyVisitChild(_argumentList, visitor); |
| 11172 } | 11064 } |
| 11173 } | 11065 } |
| 11174 | |
| 11175 /** | 11066 /** |
| 11176 * Instances of the class {@code SuperExpression} represent a super expression. | 11067 * Instances of the class {@code SuperExpression} represent a super expression. |
| 11177 * <pre> | 11068 * <pre> |
| 11178 * superExpression ::= | 11069 * superExpression ::= |
| 11179 * 'super' | 11070 * 'super' |
| 11180 * </pre> | 11071 * </pre> |
| 11181 * @coverage dart.engine.ast | 11072 * @coverage dart.engine.ast |
| 11182 */ | 11073 */ |
| 11183 class SuperExpression extends Expression { | 11074 class SuperExpression extends Expression { |
| 11184 | 11075 |
| 11185 /** | 11076 /** |
| 11186 * The token representing the keyword. | 11077 * The token representing the keyword. |
| 11187 */ | 11078 */ |
| 11188 Token _keyword; | 11079 Token _keyword; |
| 11189 | 11080 |
| 11190 /** | 11081 /** |
| 11191 * Initialize a newly created super expression. | 11082 * Initialize a newly created super expression. |
| 11192 * @param keyword the token representing the keyword | 11083 * @param keyword the token representing the keyword |
| 11193 */ | 11084 */ |
| 11194 SuperExpression.full(Token keyword) { | 11085 SuperExpression.full(Token keyword) { |
| 11195 this._keyword = keyword; | 11086 this._keyword = keyword; |
| 11196 } | 11087 } |
| 11197 | 11088 |
| 11198 /** | 11089 /** |
| 11199 * Initialize a newly created super expression. | 11090 * Initialize a newly created super expression. |
| 11200 * @param keyword the token representing the keyword | 11091 * @param keyword the token representing the keyword |
| 11201 */ | 11092 */ |
| 11202 SuperExpression({Token keyword}) : this.full(keyword); | 11093 SuperExpression({Token keyword}) : this.full(keyword); |
| 11203 accept(ASTVisitor visitor) => visitor.visitSuperExpression(this); | 11094 accept(ASTVisitor visitor) => visitor.visitSuperExpression(this); |
| 11204 Token get beginToken => _keyword; | 11095 Token get beginToken => _keyword; |
| 11205 Token get endToken => _keyword; | 11096 Token get endToken => _keyword; |
| 11206 | 11097 |
| 11207 /** | 11098 /** |
| 11208 * Return the token representing the keyword. | 11099 * Return the token representing the keyword. |
| 11209 * @return the token representing the keyword | 11100 * @return the token representing the keyword |
| 11210 */ | 11101 */ |
| 11211 Token get keyword => _keyword; | 11102 Token get keyword => _keyword; |
| 11212 | 11103 |
| 11213 /** | 11104 /** |
| 11214 * Set the token representing the keyword to the given token. | 11105 * Set the token representing the keyword to the given token. |
| 11215 * @param keyword the token representing the keyword | 11106 * @param keyword the token representing the keyword |
| 11216 */ | 11107 */ |
| 11217 void set keyword(Token keyword2) { | 11108 void set keyword(Token keyword2) { |
| 11218 this._keyword = keyword2; | 11109 this._keyword = keyword2; |
| 11219 } | 11110 } |
| 11220 void visitChildren(ASTVisitor<Object> visitor) { | 11111 void visitChildren(ASTVisitor<Object> visitor) { |
| 11221 } | 11112 } |
| 11222 } | 11113 } |
| 11223 | |
| 11224 /** | 11114 /** |
| 11225 * Instances of the class {@code SwitchCase} represent the case in a switch stat
ement. | 11115 * Instances of the class {@code SwitchCase} represent the case in a switch stat
ement. |
| 11226 * <pre> | 11116 * <pre> |
| 11227 * switchCase ::={@link SimpleIdentifier label}* 'case' {@link Expression expres
sion} ':' {@link Statement statement}</pre> | 11117 * switchCase ::={@link SimpleIdentifier label}* 'case' {@link Expression expres
sion} ':' {@link Statement statement}</pre> |
| 11228 * @coverage dart.engine.ast | 11118 * @coverage dart.engine.ast |
| 11229 */ | 11119 */ |
| 11230 class SwitchCase extends SwitchMember { | 11120 class SwitchCase extends SwitchMember { |
| 11231 | 11121 |
| 11232 /** | 11122 /** |
| 11233 * The expression controlling whether the statements will be executed. | 11123 * The expression controlling whether the statements will be executed. |
| 11234 */ | 11124 */ |
| 11235 Expression _expression; | 11125 Expression _expression; |
| 11236 | 11126 |
| 11237 /** | 11127 /** |
| 11238 * Initialize a newly created switch case. | 11128 * Initialize a newly created switch case. |
| 11239 * @param labels the labels associated with the switch member | 11129 * @param labels the labels associated with the switch member |
| 11240 * @param keyword the token representing the 'case' or 'default' keyword | 11130 * @param keyword the token representing the 'case' or 'default' keyword |
| 11241 * @param expression the expression controlling whether the statements will be
executed | 11131 * @param expression the expression controlling whether the statements will be
executed |
| 11242 * @param colon the colon separating the keyword or the expression from the st
atements | 11132 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11243 * @param statements the statements that will be executed if this switch membe
r is selected | 11133 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11244 */ | 11134 */ |
| 11245 SwitchCase.full(List<Label> labels, Token keyword, Expression expression, Toke
n colon, List<Statement> statements) : super.full(labels, keyword, colon, statem
ents) { | 11135 SwitchCase.full(List<Label> labels, Token keyword, Expression expression, Toke
n colon, List<Statement> statements) : super.full(labels, keyword, colon, statem
ents) { |
| 11246 this._expression = becomeParentOf(expression); | 11136 this._expression = becomeParentOf(expression); |
| 11247 } | 11137 } |
| 11248 | 11138 |
| 11249 /** | 11139 /** |
| 11250 * Initialize a newly created switch case. | 11140 * Initialize a newly created switch case. |
| 11251 * @param labels the labels associated with the switch member | 11141 * @param labels the labels associated with the switch member |
| 11252 * @param keyword the token representing the 'case' or 'default' keyword | 11142 * @param keyword the token representing the 'case' or 'default' keyword |
| 11253 * @param expression the expression controlling whether the statements will be
executed | 11143 * @param expression the expression controlling whether the statements will be
executed |
| 11254 * @param colon the colon separating the keyword or the expression from the st
atements | 11144 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11255 * @param statements the statements that will be executed if this switch membe
r is selected | 11145 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11256 */ | 11146 */ |
| 11257 SwitchCase({List<Label> labels, Token keyword, Expression expression, Token co
lon, List<Statement> statements}) : this.full(labels, keyword, expression, colon
, statements); | 11147 SwitchCase({List<Label> labels, Token keyword, Expression expression, Token co
lon, List<Statement> statements}) : this.full(labels, keyword, expression, colon
, statements); |
| 11258 accept(ASTVisitor visitor) => visitor.visitSwitchCase(this); | 11148 accept(ASTVisitor visitor) => visitor.visitSwitchCase(this); |
| 11259 | 11149 |
| 11260 /** | 11150 /** |
| 11261 * Return the expression controlling whether the statements will be executed. | 11151 * Return the expression controlling whether the statements will be executed. |
| 11262 * @return the expression controlling whether the statements will be executed | 11152 * @return the expression controlling whether the statements will be executed |
| 11263 */ | 11153 */ |
| 11264 Expression get expression => _expression; | 11154 Expression get expression => _expression; |
| 11265 | 11155 |
| 11266 /** | 11156 /** |
| 11267 * Set the expression controlling whether the statements will be executed to t
he given expression. | 11157 * Set the expression controlling whether the statements will be executed to t
he given expression. |
| 11268 * @param expression the expression controlling whether the statements will be
executed | 11158 * @param expression the expression controlling whether the statements will be
executed |
| 11269 */ | 11159 */ |
| 11270 void set expression(Expression expression2) { | 11160 void set expression(Expression expression2) { |
| 11271 this._expression = becomeParentOf(expression2); | 11161 this._expression = becomeParentOf(expression2); |
| 11272 } | 11162 } |
| 11273 void visitChildren(ASTVisitor<Object> visitor) { | 11163 void visitChildren(ASTVisitor<Object> visitor) { |
| 11274 labels.accept(visitor); | 11164 labels.accept(visitor); |
| 11275 safelyVisitChild(_expression, visitor); | 11165 safelyVisitChild(_expression, visitor); |
| 11276 statements.accept(visitor); | 11166 statements.accept(visitor); |
| 11277 } | 11167 } |
| 11278 } | 11168 } |
| 11279 | |
| 11280 /** | 11169 /** |
| 11281 * Instances of the class {@code SwitchDefault} represent the default case in a
switch statement. | 11170 * Instances of the class {@code SwitchDefault} represent the default case in a
switch statement. |
| 11282 * <pre> | 11171 * <pre> |
| 11283 * switchDefault ::={@link SimpleIdentifier label}* 'default' ':' {@link Stateme
nt statement}</pre> | 11172 * switchDefault ::={@link SimpleIdentifier label}* 'default' ':' {@link Stateme
nt statement}</pre> |
| 11284 * @coverage dart.engine.ast | 11173 * @coverage dart.engine.ast |
| 11285 */ | 11174 */ |
| 11286 class SwitchDefault extends SwitchMember { | 11175 class SwitchDefault extends SwitchMember { |
| 11287 | 11176 |
| 11288 /** | 11177 /** |
| 11289 * Initialize a newly created switch default. | 11178 * Initialize a newly created switch default. |
| 11290 * @param labels the labels associated with the switch member | 11179 * @param labels the labels associated with the switch member |
| 11291 * @param keyword the token representing the 'case' or 'default' keyword | 11180 * @param keyword the token representing the 'case' or 'default' keyword |
| 11292 * @param colon the colon separating the keyword or the expression from the st
atements | 11181 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11293 * @param statements the statements that will be executed if this switch membe
r is selected | 11182 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11294 */ | 11183 */ |
| 11295 SwitchDefault.full(List<Label> labels, Token keyword, Token colon, List<Statem
ent> statements) : super.full(labels, keyword, colon, statements) { | 11184 SwitchDefault.full(List<Label> labels, Token keyword, Token colon, List<Statem
ent> statements) : super.full(labels, keyword, colon, statements) { |
| 11296 } | 11185 } |
| 11297 | 11186 |
| 11298 /** | 11187 /** |
| 11299 * Initialize a newly created switch default. | 11188 * Initialize a newly created switch default. |
| 11300 * @param labels the labels associated with the switch member | 11189 * @param labels the labels associated with the switch member |
| 11301 * @param keyword the token representing the 'case' or 'default' keyword | 11190 * @param keyword the token representing the 'case' or 'default' keyword |
| 11302 * @param colon the colon separating the keyword or the expression from the st
atements | 11191 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11303 * @param statements the statements that will be executed if this switch membe
r is selected | 11192 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11304 */ | 11193 */ |
| 11305 SwitchDefault({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); | 11194 SwitchDefault({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); |
| 11306 accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this); | 11195 accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this); |
| 11307 void visitChildren(ASTVisitor<Object> visitor) { | 11196 void visitChildren(ASTVisitor<Object> visitor) { |
| 11308 labels.accept(visitor); | 11197 labels.accept(visitor); |
| 11309 statements.accept(visitor); | 11198 statements.accept(visitor); |
| 11310 } | 11199 } |
| 11311 } | 11200 } |
| 11312 | |
| 11313 /** | 11201 /** |
| 11314 * The abstract class {@code SwitchMember} defines the behavior common to object
s representing | 11202 * The abstract class {@code SwitchMember} defines the behavior common to object
s representing |
| 11315 * elements within a switch statement. | 11203 * elements within a switch statement. |
| 11316 * <pre> | 11204 * <pre> |
| 11317 * switchMember ::= | 11205 * switchMember ::= |
| 11318 * switchCase | 11206 * switchCase |
| 11319 * | switchDefault | 11207 * | switchDefault |
| 11320 * </pre> | 11208 * </pre> |
| 11321 * @coverage dart.engine.ast | 11209 * @coverage dart.engine.ast |
| 11322 */ | 11210 */ |
| 11323 abstract class SwitchMember extends ASTNode { | 11211 abstract class SwitchMember extends ASTNode { |
| 11324 | 11212 |
| 11325 /** | 11213 /** |
| 11326 * The labels associated with the switch member. | 11214 * The labels associated with the switch member. |
| 11327 */ | 11215 */ |
| 11328 NodeList<Label> _labels; | 11216 NodeList<Label> _labels; |
| 11329 | 11217 |
| 11330 /** | 11218 /** |
| 11331 * The token representing the 'case' or 'default' keyword. | 11219 * The token representing the 'case' or 'default' keyword. |
| 11332 */ | 11220 */ |
| 11333 Token _keyword; | 11221 Token _keyword; |
| 11334 | 11222 |
| 11335 /** | 11223 /** |
| 11336 * The colon separating the keyword or the expression from the statements. | 11224 * The colon separating the keyword or the expression from the statements. |
| 11337 */ | 11225 */ |
| 11338 Token _colon; | 11226 Token _colon; |
| 11339 | 11227 |
| 11340 /** | 11228 /** |
| 11341 * The statements that will be executed if this switch member is selected. | 11229 * The statements that will be executed if this switch member is selected. |
| 11342 */ | 11230 */ |
| 11343 NodeList<Statement> _statements; | 11231 NodeList<Statement> _statements; |
| 11344 | 11232 |
| 11345 /** | 11233 /** |
| 11346 * Initialize a newly created switch member. | 11234 * Initialize a newly created switch member. |
| 11347 * @param labels the labels associated with the switch member | 11235 * @param labels the labels associated with the switch member |
| 11348 * @param keyword the token representing the 'case' or 'default' keyword | 11236 * @param keyword the token representing the 'case' or 'default' keyword |
| 11349 * @param colon the colon separating the keyword or the expression from the st
atements | 11237 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11350 * @param statements the statements that will be executed if this switch membe
r is selected | 11238 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11351 */ | 11239 */ |
| 11352 SwitchMember.full(List<Label> labels, Token keyword, Token colon, List<Stateme
nt> statements) { | 11240 SwitchMember.full(List<Label> labels, Token keyword, Token colon, List<Stateme
nt> statements) { |
| 11353 this._labels = new NodeList<Label>(this); | 11241 this._labels = new NodeList<Label>(this); |
| 11354 this._statements = new NodeList<Statement>(this); | 11242 this._statements = new NodeList<Statement>(this); |
| 11355 this._labels.addAll(labels); | 11243 this._labels.addAll(labels); |
| 11356 this._keyword = keyword; | 11244 this._keyword = keyword; |
| 11357 this._colon = colon; | 11245 this._colon = colon; |
| 11358 this._statements.addAll(statements); | 11246 this._statements.addAll(statements); |
| 11359 } | 11247 } |
| 11360 | 11248 |
| 11361 /** | 11249 /** |
| 11362 * Initialize a newly created switch member. | 11250 * Initialize a newly created switch member. |
| 11363 * @param labels the labels associated with the switch member | 11251 * @param labels the labels associated with the switch member |
| 11364 * @param keyword the token representing the 'case' or 'default' keyword | 11252 * @param keyword the token representing the 'case' or 'default' keyword |
| 11365 * @param colon the colon separating the keyword or the expression from the st
atements | 11253 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11366 * @param statements the statements that will be executed if this switch membe
r is selected | 11254 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11367 */ | 11255 */ |
| 11368 SwitchMember({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); | 11256 SwitchMember({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); |
| 11369 Token get beginToken { | 11257 Token get beginToken { |
| 11370 if (!_labels.isEmpty) { | 11258 if (!_labels.isEmpty) { |
| 11371 return _labels.beginToken; | 11259 return _labels.beginToken; |
| 11372 } | 11260 } |
| 11373 return _keyword; | 11261 return _keyword; |
| 11374 } | 11262 } |
| 11375 | 11263 |
| 11376 /** | 11264 /** |
| 11377 * Return the colon separating the keyword or the expression from the statemen
ts. | 11265 * Return the colon separating the keyword or the expression from the statemen
ts. |
| 11378 * @return the colon separating the keyword or the expression from the stateme
nts | 11266 * @return the colon separating the keyword or the expression from the stateme
nts |
| 11379 */ | 11267 */ |
| 11380 Token get colon => _colon; | 11268 Token get colon => _colon; |
| 11381 Token get endToken { | 11269 Token get endToken { |
| 11382 if (!_statements.isEmpty) { | 11270 if (!_statements.isEmpty) { |
| 11383 return _statements.endToken; | 11271 return _statements.endToken; |
| 11384 } | 11272 } |
| 11385 return _colon; | 11273 return _colon; |
| 11386 } | 11274 } |
| 11387 | 11275 |
| 11388 /** | 11276 /** |
| 11389 * Return the token representing the 'case' or 'default' keyword. | 11277 * Return the token representing the 'case' or 'default' keyword. |
| 11390 * @return the token representing the 'case' or 'default' keyword | 11278 * @return the token representing the 'case' or 'default' keyword |
| 11391 */ | 11279 */ |
| 11392 Token get keyword => _keyword; | 11280 Token get keyword => _keyword; |
| 11393 | 11281 |
| 11394 /** | 11282 /** |
| 11395 * Return the labels associated with the switch member. | 11283 * Return the labels associated with the switch member. |
| 11396 * @return the labels associated with the switch member | 11284 * @return the labels associated with the switch member |
| 11397 */ | 11285 */ |
| 11398 NodeList<Label> get labels => _labels; | 11286 NodeList<Label> get labels => _labels; |
| 11399 | 11287 |
| 11400 /** | 11288 /** |
| 11401 * Return the statements that will be executed if this switch member is select
ed. | 11289 * Return the statements that will be executed if this switch member is select
ed. |
| 11402 * @return the statements that will be executed if this switch member is selec
ted | 11290 * @return the statements that will be executed if this switch member is selec
ted |
| 11403 */ | 11291 */ |
| 11404 NodeList<Statement> get statements => _statements; | 11292 NodeList<Statement> get statements => _statements; |
| 11405 | 11293 |
| 11406 /** | 11294 /** |
| 11407 * Set the colon separating the keyword or the expression from the statements
to the given token. | 11295 * Set the colon separating the keyword or the expression from the statements
to the given token. |
| 11408 * @param colon the colon separating the keyword or the expression from the st
atements | 11296 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11409 */ | 11297 */ |
| 11410 void set colon(Token colon2) { | 11298 void set colon(Token colon2) { |
| 11411 this._colon = colon2; | 11299 this._colon = colon2; |
| 11412 } | 11300 } |
| 11413 | 11301 |
| 11414 /** | 11302 /** |
| 11415 * Set the token representing the 'case' or 'default' keyword to the given tok
en. | 11303 * Set the token representing the 'case' or 'default' keyword to the given tok
en. |
| 11416 * @param keyword the token representing the 'case' or 'default' keyword | 11304 * @param keyword the token representing the 'case' or 'default' keyword |
| 11417 */ | 11305 */ |
| 11418 void set keyword(Token keyword2) { | 11306 void set keyword(Token keyword2) { |
| 11419 this._keyword = keyword2; | 11307 this._keyword = keyword2; |
| 11420 } | 11308 } |
| 11421 } | 11309 } |
| 11422 | |
| 11423 /** | 11310 /** |
| 11424 * Instances of the class {@code SwitchStatement} represent a switch statement. | 11311 * Instances of the class {@code SwitchStatement} represent a switch statement. |
| 11425 * <pre> | 11312 * <pre> |
| 11426 * switchStatement ::= | 11313 * switchStatement ::= |
| 11427 * 'switch' '(' {@link Expression expression} ')' '{' {@link SwitchCase switchCa
se}* {@link SwitchDefault defaultCase}? '}' | 11314 * 'switch' '(' {@link Expression expression} ')' '{' {@link SwitchCase switchCa
se}* {@link SwitchDefault defaultCase}? '}' |
| 11428 * </pre> | 11315 * </pre> |
| 11429 * @coverage dart.engine.ast | 11316 * @coverage dart.engine.ast |
| 11430 */ | 11317 */ |
| 11431 class SwitchStatement extends Statement { | 11318 class SwitchStatement extends Statement { |
| 11432 | 11319 |
| 11433 /** | 11320 /** |
| 11434 * The token representing the 'switch' keyword. | 11321 * The token representing the 'switch' keyword. |
| 11435 */ | 11322 */ |
| 11436 Token _keyword; | 11323 Token _keyword; |
| 11437 | 11324 |
| 11438 /** | 11325 /** |
| 11439 * The left parenthesis. | 11326 * The left parenthesis. |
| 11440 */ | 11327 */ |
| 11441 Token _leftParenthesis; | 11328 Token _leftParenthesis; |
| 11442 | 11329 |
| 11443 /** | 11330 /** |
| 11444 * The expression used to determine which of the switch members will be select
ed. | 11331 * The expression used to determine which of the switch members will be select
ed. |
| 11445 */ | 11332 */ |
| 11446 Expression _expression; | 11333 Expression _expression; |
| 11447 | 11334 |
| 11448 /** | 11335 /** |
| 11449 * The right parenthesis. | 11336 * The right parenthesis. |
| 11450 */ | 11337 */ |
| 11451 Token _rightParenthesis; | 11338 Token _rightParenthesis; |
| 11452 | 11339 |
| 11453 /** | 11340 /** |
| 11454 * The left curly bracket. | 11341 * The left curly bracket. |
| 11455 */ | 11342 */ |
| 11456 Token _leftBracket; | 11343 Token _leftBracket; |
| 11457 | 11344 |
| 11458 /** | 11345 /** |
| 11459 * The switch members that can be selected by the expression. | 11346 * The switch members that can be selected by the expression. |
| 11460 */ | 11347 */ |
| 11461 NodeList<SwitchMember> _members; | 11348 NodeList<SwitchMember> _members; |
| 11462 | 11349 |
| 11463 /** | 11350 /** |
| 11464 * The right curly bracket. | 11351 * The right curly bracket. |
| 11465 */ | 11352 */ |
| 11466 Token _rightBracket; | 11353 Token _rightBracket; |
| 11467 | 11354 |
| 11468 /** | 11355 /** |
| 11469 * Initialize a newly created switch statement. | 11356 * Initialize a newly created switch statement. |
| 11470 * @param keyword the token representing the 'switch' keyword | 11357 * @param keyword the token representing the 'switch' keyword |
| 11471 * @param leftParenthesis the left parenthesis | 11358 * @param leftParenthesis the left parenthesis |
| 11472 * @param expression the expression used to determine which of the switch memb
ers will be selected | 11359 * @param expression the expression used to determine which of the switch memb
ers will be selected |
| 11473 * @param rightParenthesis the right parenthesis | 11360 * @param rightParenthesis the right parenthesis |
| 11474 * @param leftBracket the left curly bracket | 11361 * @param leftBracket the left curly bracket |
| 11475 * @param members the switch members that can be selected by the expression | 11362 * @param members the switch members that can be selected by the expression |
| 11476 * @param rightBracket the right curly bracket | 11363 * @param rightBracket the right curly bracket |
| 11477 */ | 11364 */ |
| 11478 SwitchStatement.full(Token keyword, Token leftParenthesis, Expression expressi
on, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token
rightBracket) { | 11365 SwitchStatement.full(Token keyword, Token leftParenthesis, Expression expressi
on, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token
rightBracket) { |
| 11479 this._members = new NodeList<SwitchMember>(this); | 11366 this._members = new NodeList<SwitchMember>(this); |
| 11480 this._keyword = keyword; | 11367 this._keyword = keyword; |
| 11481 this._leftParenthesis = leftParenthesis; | 11368 this._leftParenthesis = leftParenthesis; |
| 11482 this._expression = becomeParentOf(expression); | 11369 this._expression = becomeParentOf(expression); |
| 11483 this._rightParenthesis = rightParenthesis; | 11370 this._rightParenthesis = rightParenthesis; |
| 11484 this._leftBracket = leftBracket; | 11371 this._leftBracket = leftBracket; |
| 11485 this._members.addAll(members); | 11372 this._members.addAll(members); |
| 11486 this._rightBracket = rightBracket; | 11373 this._rightBracket = rightBracket; |
| 11487 } | 11374 } |
| 11488 | 11375 |
| 11489 /** | 11376 /** |
| 11490 * Initialize a newly created switch statement. | 11377 * Initialize a newly created switch statement. |
| 11491 * @param keyword the token representing the 'switch' keyword | 11378 * @param keyword the token representing the 'switch' keyword |
| 11492 * @param leftParenthesis the left parenthesis | 11379 * @param leftParenthesis the left parenthesis |
| 11493 * @param expression the expression used to determine which of the switch memb
ers will be selected | 11380 * @param expression the expression used to determine which of the switch memb
ers will be selected |
| 11494 * @param rightParenthesis the right parenthesis | 11381 * @param rightParenthesis the right parenthesis |
| 11495 * @param leftBracket the left curly bracket | 11382 * @param leftBracket the left curly bracket |
| 11496 * @param members the switch members that can be selected by the expression | 11383 * @param members the switch members that can be selected by the expression |
| 11497 * @param rightBracket the right curly bracket | 11384 * @param rightBracket the right curly bracket |
| 11498 */ | 11385 */ |
| 11499 SwitchStatement({Token keyword, Token leftParenthesis, Expression expression,
Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token rig
htBracket}) : this.full(keyword, leftParenthesis, expression, rightParenthesis,
leftBracket, members, rightBracket); | 11386 SwitchStatement({Token keyword, Token leftParenthesis, Expression expression,
Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token rig
htBracket}) : this.full(keyword, leftParenthesis, expression, rightParenthesis,
leftBracket, members, rightBracket); |
| 11500 accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this); | 11387 accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this); |
| 11501 Token get beginToken => _keyword; | 11388 Token get beginToken => _keyword; |
| 11502 Token get endToken => _rightBracket; | 11389 Token get endToken => _rightBracket; |
| 11503 | 11390 |
| 11504 /** | 11391 /** |
| 11505 * Return the expression used to determine which of the switch members will be
selected. | 11392 * Return the expression used to determine which of the switch members will be
selected. |
| 11506 * @return the expression used to determine which of the switch members will b
e selected | 11393 * @return the expression used to determine which of the switch members will b
e selected |
| 11507 */ | 11394 */ |
| 11508 Expression get expression => _expression; | 11395 Expression get expression => _expression; |
| 11509 | 11396 |
| 11510 /** | 11397 /** |
| 11511 * Return the token representing the 'switch' keyword. | 11398 * Return the token representing the 'switch' keyword. |
| 11512 * @return the token representing the 'switch' keyword | 11399 * @return the token representing the 'switch' keyword |
| 11513 */ | 11400 */ |
| 11514 Token get keyword => _keyword; | 11401 Token get keyword => _keyword; |
| 11515 | 11402 |
| 11516 /** | 11403 /** |
| 11517 * Return the left curly bracket. | 11404 * Return the left curly bracket. |
| 11518 * @return the left curly bracket | 11405 * @return the left curly bracket |
| 11519 */ | 11406 */ |
| 11520 Token get leftBracket => _leftBracket; | 11407 Token get leftBracket => _leftBracket; |
| 11521 | 11408 |
| 11522 /** | 11409 /** |
| 11523 * Return the left parenthesis. | 11410 * Return the left parenthesis. |
| 11524 * @return the left parenthesis | 11411 * @return the left parenthesis |
| 11525 */ | 11412 */ |
| 11526 Token get leftParenthesis => _leftParenthesis; | 11413 Token get leftParenthesis => _leftParenthesis; |
| 11527 | 11414 |
| 11528 /** | 11415 /** |
| 11529 * Return the switch members that can be selected by the expression. | 11416 * Return the switch members that can be selected by the expression. |
| 11530 * @return the switch members that can be selected by the expression | 11417 * @return the switch members that can be selected by the expression |
| 11531 */ | 11418 */ |
| 11532 NodeList<SwitchMember> get members => _members; | 11419 NodeList<SwitchMember> get members => _members; |
| 11533 | 11420 |
| 11534 /** | 11421 /** |
| 11535 * Return the right curly bracket. | 11422 * Return the right curly bracket. |
| 11536 * @return the right curly bracket | 11423 * @return the right curly bracket |
| 11537 */ | 11424 */ |
| 11538 Token get rightBracket => _rightBracket; | 11425 Token get rightBracket => _rightBracket; |
| 11539 | 11426 |
| 11540 /** | 11427 /** |
| 11541 * Return the right parenthesis. | 11428 * Return the right parenthesis. |
| 11542 * @return the right parenthesis | 11429 * @return the right parenthesis |
| 11543 */ | 11430 */ |
| 11544 Token get rightParenthesis => _rightParenthesis; | 11431 Token get rightParenthesis => _rightParenthesis; |
| 11545 | 11432 |
| 11546 /** | 11433 /** |
| 11547 * Set the expression used to determine which of the switch members will be se
lected to the given | 11434 * Set the expression used to determine which of the switch members will be se
lected to the given |
| 11548 * expression. | 11435 * expression. |
| 11549 * @param expression the expression used to determine which of the switch memb
ers will be selected | 11436 * @param expression the expression used to determine which of the switch memb
ers will be selected |
| 11550 */ | 11437 */ |
| 11551 void set expression(Expression expression2) { | 11438 void set expression(Expression expression2) { |
| 11552 this._expression = becomeParentOf(expression2); | 11439 this._expression = becomeParentOf(expression2); |
| 11553 } | 11440 } |
| 11554 | 11441 |
| 11555 /** | 11442 /** |
| 11556 * Set the token representing the 'switch' keyword to the given token. | 11443 * Set the token representing the 'switch' keyword to the given token. |
| 11557 * @param keyword the token representing the 'switch' keyword | 11444 * @param keyword the token representing the 'switch' keyword |
| 11558 */ | 11445 */ |
| 11559 void set keyword(Token keyword2) { | 11446 void set keyword(Token keyword2) { |
| 11560 this._keyword = keyword2; | 11447 this._keyword = keyword2; |
| 11561 } | 11448 } |
| 11562 | 11449 |
| 11563 /** | 11450 /** |
| 11564 * Set the left curly bracket to the given token. | 11451 * Set the left curly bracket to the given token. |
| 11565 * @param leftBracket the left curly bracket | 11452 * @param leftBracket the left curly bracket |
| 11566 */ | 11453 */ |
| 11567 void set leftBracket(Token leftBracket2) { | 11454 void set leftBracket(Token leftBracket2) { |
| 11568 this._leftBracket = leftBracket2; | 11455 this._leftBracket = leftBracket2; |
| 11569 } | 11456 } |
| 11570 | 11457 |
| 11571 /** | 11458 /** |
| 11572 * Set the left parenthesis to the given token. | 11459 * Set the left parenthesis to the given token. |
| 11573 * @param leftParenthesis the left parenthesis | 11460 * @param leftParenthesis the left parenthesis |
| 11574 */ | 11461 */ |
| 11575 void set leftParenthesis(Token leftParenthesis2) { | 11462 void set leftParenthesis(Token leftParenthesis2) { |
| 11576 this._leftParenthesis = leftParenthesis2; | 11463 this._leftParenthesis = leftParenthesis2; |
| 11577 } | 11464 } |
| 11578 | 11465 |
| 11579 /** | 11466 /** |
| 11580 * Set the right curly bracket to the given token. | 11467 * Set the right curly bracket to the given token. |
| 11581 * @param rightBracket the right curly bracket | 11468 * @param rightBracket the right curly bracket |
| 11582 */ | 11469 */ |
| 11583 void set rightBracket(Token rightBracket2) { | 11470 void set rightBracket(Token rightBracket2) { |
| 11584 this._rightBracket = rightBracket2; | 11471 this._rightBracket = rightBracket2; |
| 11585 } | 11472 } |
| 11586 | 11473 |
| 11587 /** | 11474 /** |
| 11588 * Set the right parenthesis to the given token. | 11475 * Set the right parenthesis to the given token. |
| 11589 * @param rightParenthesis the right parenthesis | 11476 * @param rightParenthesis the right parenthesis |
| 11590 */ | 11477 */ |
| 11591 void set rightParenthesis(Token rightParenthesis2) { | 11478 void set rightParenthesis(Token rightParenthesis2) { |
| 11592 this._rightParenthesis = rightParenthesis2; | 11479 this._rightParenthesis = rightParenthesis2; |
| 11593 } | 11480 } |
| 11594 void visitChildren(ASTVisitor<Object> visitor) { | 11481 void visitChildren(ASTVisitor<Object> visitor) { |
| 11595 safelyVisitChild(_expression, visitor); | 11482 safelyVisitChild(_expression, visitor); |
| 11596 _members.accept(visitor); | 11483 _members.accept(visitor); |
| 11597 } | 11484 } |
| 11598 } | 11485 } |
| 11599 | |
| 11600 /** | 11486 /** |
| 11601 * Instances of the class {@code ThisExpression} represent a this expression. | 11487 * Instances of the class {@code ThisExpression} represent a this expression. |
| 11602 * <pre> | 11488 * <pre> |
| 11603 * thisExpression ::= | 11489 * thisExpression ::= |
| 11604 * 'this' | 11490 * 'this' |
| 11605 * </pre> | 11491 * </pre> |
| 11606 * @coverage dart.engine.ast | 11492 * @coverage dart.engine.ast |
| 11607 */ | 11493 */ |
| 11608 class ThisExpression extends Expression { | 11494 class ThisExpression extends Expression { |
| 11609 | 11495 |
| 11610 /** | 11496 /** |
| 11611 * The token representing the keyword. | 11497 * The token representing the keyword. |
| 11612 */ | 11498 */ |
| 11613 Token _keyword; | 11499 Token _keyword; |
| 11614 | 11500 |
| 11615 /** | 11501 /** |
| 11616 * Initialize a newly created this expression. | 11502 * Initialize a newly created this expression. |
| 11617 * @param keyword the token representing the keyword | 11503 * @param keyword the token representing the keyword |
| 11618 */ | 11504 */ |
| 11619 ThisExpression.full(Token keyword) { | 11505 ThisExpression.full(Token keyword) { |
| 11620 this._keyword = keyword; | 11506 this._keyword = keyword; |
| 11621 } | 11507 } |
| 11622 | 11508 |
| 11623 /** | 11509 /** |
| 11624 * Initialize a newly created this expression. | 11510 * Initialize a newly created this expression. |
| 11625 * @param keyword the token representing the keyword | 11511 * @param keyword the token representing the keyword |
| 11626 */ | 11512 */ |
| 11627 ThisExpression({Token keyword}) : this.full(keyword); | 11513 ThisExpression({Token keyword}) : this.full(keyword); |
| 11628 accept(ASTVisitor visitor) => visitor.visitThisExpression(this); | 11514 accept(ASTVisitor visitor) => visitor.visitThisExpression(this); |
| 11629 Token get beginToken => _keyword; | 11515 Token get beginToken => _keyword; |
| 11630 Token get endToken => _keyword; | 11516 Token get endToken => _keyword; |
| 11631 | 11517 |
| 11632 /** | 11518 /** |
| 11633 * Return the token representing the keyword. | 11519 * Return the token representing the keyword. |
| 11634 * @return the token representing the keyword | 11520 * @return the token representing the keyword |
| 11635 */ | 11521 */ |
| 11636 Token get keyword => _keyword; | 11522 Token get keyword => _keyword; |
| 11637 | 11523 |
| 11638 /** | 11524 /** |
| 11639 * Set the token representing the keyword to the given token. | 11525 * Set the token representing the keyword to the given token. |
| 11640 * @param keyword the token representing the keyword | 11526 * @param keyword the token representing the keyword |
| 11641 */ | 11527 */ |
| 11642 void set keyword(Token keyword2) { | 11528 void set keyword(Token keyword2) { |
| 11643 this._keyword = keyword2; | 11529 this._keyword = keyword2; |
| 11644 } | 11530 } |
| 11645 void visitChildren(ASTVisitor<Object> visitor) { | 11531 void visitChildren(ASTVisitor<Object> visitor) { |
| 11646 } | 11532 } |
| 11647 } | 11533 } |
| 11648 | |
| 11649 /** | 11534 /** |
| 11650 * Instances of the class {@code ThrowExpression} represent a throw expression. | 11535 * Instances of the class {@code ThrowExpression} represent a throw expression. |
| 11651 * <pre> | 11536 * <pre> |
| 11652 * throwExpression ::= | 11537 * throwExpression ::= |
| 11653 * 'throw' {@link Expression expression}</pre> | 11538 * 'throw' {@link Expression expression}</pre> |
| 11654 * @coverage dart.engine.ast | 11539 * @coverage dart.engine.ast |
| 11655 */ | 11540 */ |
| 11656 class ThrowExpression extends Expression { | 11541 class ThrowExpression extends Expression { |
| 11657 | 11542 |
| 11658 /** | 11543 /** |
| 11659 * The token representing the 'throw' keyword. | 11544 * The token representing the 'throw' keyword. |
| 11660 */ | 11545 */ |
| 11661 Token _keyword; | 11546 Token _keyword; |
| 11662 | 11547 |
| 11663 /** | 11548 /** |
| 11664 * The expression computing the exception to be thrown. | 11549 * The expression computing the exception to be thrown. |
| 11665 */ | 11550 */ |
| 11666 Expression _expression; | 11551 Expression _expression; |
| 11667 | 11552 |
| 11668 /** | 11553 /** |
| 11669 * Initialize a newly created throw expression. | 11554 * Initialize a newly created throw expression. |
| 11670 * @param keyword the token representing the 'throw' keyword | 11555 * @param keyword the token representing the 'throw' keyword |
| 11671 * @param expression the expression computing the exception to be thrown | 11556 * @param expression the expression computing the exception to be thrown |
| 11672 */ | 11557 */ |
| 11673 ThrowExpression.full(Token keyword, Expression expression) { | 11558 ThrowExpression.full(Token keyword, Expression expression) { |
| 11674 this._keyword = keyword; | 11559 this._keyword = keyword; |
| 11675 this._expression = becomeParentOf(expression); | 11560 this._expression = becomeParentOf(expression); |
| 11676 } | 11561 } |
| 11677 | 11562 |
| 11678 /** | 11563 /** |
| 11679 * Initialize a newly created throw expression. | 11564 * Initialize a newly created throw expression. |
| 11680 * @param keyword the token representing the 'throw' keyword | 11565 * @param keyword the token representing the 'throw' keyword |
| 11681 * @param expression the expression computing the exception to be thrown | 11566 * @param expression the expression computing the exception to be thrown |
| 11682 */ | 11567 */ |
| 11683 ThrowExpression({Token keyword, Expression expression}) : this.full(keyword, e
xpression); | 11568 ThrowExpression({Token keyword, Expression expression}) : this.full(keyword, e
xpression); |
| 11684 accept(ASTVisitor visitor) => visitor.visitThrowExpression(this); | 11569 accept(ASTVisitor visitor) => visitor.visitThrowExpression(this); |
| 11685 Token get beginToken => _keyword; | 11570 Token get beginToken => _keyword; |
| 11686 Token get endToken { | 11571 Token get endToken { |
| 11687 if (_expression != null) { | 11572 if (_expression != null) { |
| 11688 return _expression.endToken; | 11573 return _expression.endToken; |
| 11689 } | 11574 } |
| 11690 return _keyword; | 11575 return _keyword; |
| 11691 } | 11576 } |
| 11692 | 11577 |
| 11693 /** | 11578 /** |
| 11694 * Return the expression computing the exception to be thrown. | 11579 * Return the expression computing the exception to be thrown. |
| 11695 * @return the expression computing the exception to be thrown | 11580 * @return the expression computing the exception to be thrown |
| 11696 */ | 11581 */ |
| 11697 Expression get expression => _expression; | 11582 Expression get expression => _expression; |
| 11698 | 11583 |
| 11699 /** | 11584 /** |
| 11700 * Return the token representing the 'throw' keyword. | 11585 * Return the token representing the 'throw' keyword. |
| 11701 * @return the token representing the 'throw' keyword | 11586 * @return the token representing the 'throw' keyword |
| 11702 */ | 11587 */ |
| 11703 Token get keyword => _keyword; | 11588 Token get keyword => _keyword; |
| 11704 | 11589 |
| 11705 /** | 11590 /** |
| 11706 * Set the expression computing the exception to be thrown to the given expres
sion. | 11591 * Set the expression computing the exception to be thrown to the given expres
sion. |
| 11707 * @param expression the expression computing the exception to be thrown | 11592 * @param expression the expression computing the exception to be thrown |
| 11708 */ | 11593 */ |
| 11709 void set expression(Expression expression2) { | 11594 void set expression(Expression expression2) { |
| 11710 this._expression = becomeParentOf(expression2); | 11595 this._expression = becomeParentOf(expression2); |
| 11711 } | 11596 } |
| 11712 | 11597 |
| 11713 /** | 11598 /** |
| 11714 * Set the token representing the 'throw' keyword to the given token. | 11599 * Set the token representing the 'throw' keyword to the given token. |
| 11715 * @param keyword the token representing the 'throw' keyword | 11600 * @param keyword the token representing the 'throw' keyword |
| 11716 */ | 11601 */ |
| 11717 void set keyword(Token keyword2) { | 11602 void set keyword(Token keyword2) { |
| 11718 this._keyword = keyword2; | 11603 this._keyword = keyword2; |
| 11719 } | 11604 } |
| 11720 void visitChildren(ASTVisitor<Object> visitor) { | 11605 void visitChildren(ASTVisitor<Object> visitor) { |
| 11721 safelyVisitChild(_expression, visitor); | 11606 safelyVisitChild(_expression, visitor); |
| 11722 } | 11607 } |
| 11723 } | 11608 } |
| 11724 | |
| 11725 /** | 11609 /** |
| 11726 * Instances of the class {@code TopLevelVariableDeclaration} represent the decl
aration of one or | 11610 * Instances of the class {@code TopLevelVariableDeclaration} represent the decl
aration of one or |
| 11727 * more top-level variables of the same type. | 11611 * more top-level variables of the same type. |
| 11728 * <pre> | 11612 * <pre> |
| 11729 * topLevelVariableDeclaration ::= | 11613 * topLevelVariableDeclaration ::= |
| 11730 * ('final' | 'const') type? staticFinalDeclarationList ';' | 11614 * ('final' | 'const') type? staticFinalDeclarationList ';' |
| 11731 * | variableDeclaration ';' | 11615 * | variableDeclaration ';' |
| 11732 * </pre> | 11616 * </pre> |
| 11733 * @coverage dart.engine.ast | 11617 * @coverage dart.engine.ast |
| 11734 */ | 11618 */ |
| 11735 class TopLevelVariableDeclaration extends CompilationUnitMember { | 11619 class TopLevelVariableDeclaration extends CompilationUnitMember { |
| 11736 | 11620 |
| 11737 /** | 11621 /** |
| 11738 * The top-level variables being declared. | 11622 * The top-level variables being declared. |
| 11739 */ | 11623 */ |
| 11740 VariableDeclarationList _variableList; | 11624 VariableDeclarationList _variableList; |
| 11741 | 11625 |
| 11742 /** | 11626 /** |
| 11743 * The semicolon terminating the declaration. | 11627 * The semicolon terminating the declaration. |
| 11744 */ | 11628 */ |
| 11745 Token _semicolon; | 11629 Token _semicolon; |
| 11746 | 11630 |
| 11747 /** | 11631 /** |
| 11748 * Initialize a newly created top-level variable declaration. | 11632 * Initialize a newly created top-level variable declaration. |
| 11749 * @param comment the documentation comment associated with this variable | 11633 * @param comment the documentation comment associated with this variable |
| 11750 * @param metadata the annotations associated with this variable | 11634 * @param metadata the annotations associated with this variable |
| 11751 * @param variableList the top-level variables being declared | 11635 * @param variableList the top-level variables being declared |
| 11752 * @param semicolon the semicolon terminating the declaration | 11636 * @param semicolon the semicolon terminating the declaration |
| 11753 */ | 11637 */ |
| 11754 TopLevelVariableDeclaration.full(Comment comment, List<Annotation> metadata, V
ariableDeclarationList variableList, Token semicolon) : super.full(comment, meta
data) { | 11638 TopLevelVariableDeclaration.full(Comment comment, List<Annotation> metadata, V
ariableDeclarationList variableList, Token semicolon) : super.full(comment, meta
data) { |
| 11755 this._variableList = becomeParentOf(variableList); | 11639 this._variableList = becomeParentOf(variableList); |
| 11756 this._semicolon = semicolon; | 11640 this._semicolon = semicolon; |
| 11757 } | 11641 } |
| 11758 | 11642 |
| 11759 /** | 11643 /** |
| 11760 * Initialize a newly created top-level variable declaration. | 11644 * Initialize a newly created top-level variable declaration. |
| 11761 * @param comment the documentation comment associated with this variable | 11645 * @param comment the documentation comment associated with this variable |
| 11762 * @param metadata the annotations associated with this variable | 11646 * @param metadata the annotations associated with this variable |
| 11763 * @param variableList the top-level variables being declared | 11647 * @param variableList the top-level variables being declared |
| 11764 * @param semicolon the semicolon terminating the declaration | 11648 * @param semicolon the semicolon terminating the declaration |
| 11765 */ | 11649 */ |
| 11766 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia
bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata
, variableList, semicolon); | 11650 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia
bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata
, variableList, semicolon); |
| 11767 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); | 11651 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); |
| 11768 Element get element => null; | 11652 Element get element => null; |
| 11769 Token get endToken => _semicolon; | 11653 Token get endToken => _semicolon; |
| 11770 | 11654 |
| 11771 /** | 11655 /** |
| 11772 * Return the semicolon terminating the declaration. | 11656 * Return the semicolon terminating the declaration. |
| 11773 * @return the semicolon terminating the declaration | 11657 * @return the semicolon terminating the declaration |
| 11774 */ | 11658 */ |
| 11775 Token get semicolon => _semicolon; | 11659 Token get semicolon => _semicolon; |
| 11776 | 11660 |
| 11777 /** | 11661 /** |
| 11778 * Return the top-level variables being declared. | 11662 * Return the top-level variables being declared. |
| 11779 * @return the top-level variables being declared | 11663 * @return the top-level variables being declared |
| 11780 */ | 11664 */ |
| 11781 VariableDeclarationList get variables => _variableList; | 11665 VariableDeclarationList get variables => _variableList; |
| 11782 | 11666 |
| 11783 /** | 11667 /** |
| 11784 * Set the semicolon terminating the declaration to the given token. | 11668 * Set the semicolon terminating the declaration to the given token. |
| 11785 * @param semicolon the semicolon terminating the declaration | 11669 * @param semicolon the semicolon terminating the declaration |
| 11786 */ | 11670 */ |
| 11787 void set semicolon(Token semicolon2) { | 11671 void set semicolon(Token semicolon2) { |
| 11788 this._semicolon = semicolon2; | 11672 this._semicolon = semicolon2; |
| 11789 } | 11673 } |
| 11790 | 11674 |
| 11791 /** | 11675 /** |
| 11792 * Set the top-level variables being declared to the given list of variables. | 11676 * Set the top-level variables being declared to the given list of variables. |
| 11793 * @param variableList the top-level variables being declared | 11677 * @param variableList the top-level variables being declared |
| 11794 */ | 11678 */ |
| 11795 void set variables(VariableDeclarationList variableList) { | 11679 void set variables(VariableDeclarationList variableList) { |
| 11796 variableList = becomeParentOf(variableList); | 11680 variableList = becomeParentOf(variableList); |
| 11797 } | 11681 } |
| 11798 void visitChildren(ASTVisitor<Object> visitor) { | 11682 void visitChildren(ASTVisitor<Object> visitor) { |
| 11799 super.visitChildren(visitor); | 11683 super.visitChildren(visitor); |
| 11800 safelyVisitChild(_variableList, visitor); | 11684 safelyVisitChild(_variableList, visitor); |
| 11801 } | 11685 } |
| 11802 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; | 11686 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; |
| 11803 } | 11687 } |
| 11804 | |
| 11805 /** | 11688 /** |
| 11806 * Instances of the class {@code TryStatement} represent a try statement. | 11689 * Instances of the class {@code TryStatement} represent a try statement. |
| 11807 * <pre> | 11690 * <pre> |
| 11808 * tryStatement ::= | 11691 * tryStatement ::= |
| 11809 * 'try' {@link Block block} ({@link CatchClause catchClause}+ finallyClause? |
finallyClause) | 11692 * 'try' {@link Block block} ({@link CatchClause catchClause}+ finallyClause? |
finallyClause) |
| 11810 * finallyClause ::= | 11693 * finallyClause ::= |
| 11811 * 'finally' {@link Block block}</pre> | 11694 * 'finally' {@link Block block}</pre> |
| 11812 * @coverage dart.engine.ast | 11695 * @coverage dart.engine.ast |
| 11813 */ | 11696 */ |
| 11814 class TryStatement extends Statement { | 11697 class TryStatement extends Statement { |
| 11815 | 11698 |
| 11816 /** | 11699 /** |
| 11817 * The token representing the 'try' keyword. | 11700 * The token representing the 'try' keyword. |
| 11818 */ | 11701 */ |
| 11819 Token _tryKeyword; | 11702 Token _tryKeyword; |
| 11820 | 11703 |
| 11821 /** | 11704 /** |
| 11822 * The body of the statement. | 11705 * The body of the statement. |
| 11823 */ | 11706 */ |
| 11824 Block _body; | 11707 Block _body; |
| 11825 | 11708 |
| 11826 /** | 11709 /** |
| 11827 * The catch clauses contained in the try statement. | 11710 * The catch clauses contained in the try statement. |
| 11828 */ | 11711 */ |
| 11829 NodeList<CatchClause> _catchClauses; | 11712 NodeList<CatchClause> _catchClauses; |
| 11830 | 11713 |
| 11831 /** | 11714 /** |
| 11832 * The token representing the 'finally' keyword, or {@code null} if the statem
ent does not contain | 11715 * The token representing the 'finally' keyword, or {@code null} if the statem
ent does not contain |
| 11833 * a finally clause. | 11716 * a finally clause. |
| 11834 */ | 11717 */ |
| 11835 Token _finallyKeyword; | 11718 Token _finallyKeyword; |
| 11836 | 11719 |
| 11837 /** | 11720 /** |
| 11838 * The finally clause contained in the try statement, or {@code null} if the s
tatement does not | 11721 * The finally clause contained in the try statement, or {@code null} if the s
tatement does not |
| 11839 * contain a finally clause. | 11722 * contain a finally clause. |
| 11840 */ | 11723 */ |
| 11841 Block _finallyClause; | 11724 Block _finallyClause; |
| 11842 | 11725 |
| 11843 /** | 11726 /** |
| 11844 * Initialize a newly created try statement. | 11727 * Initialize a newly created try statement. |
| 11845 * @param tryKeyword the token representing the 'try' keyword | 11728 * @param tryKeyword the token representing the 'try' keyword |
| 11846 * @param body the body of the statement | 11729 * @param body the body of the statement |
| 11847 * @param catchClauses the catch clauses contained in the try statement | 11730 * @param catchClauses the catch clauses contained in the try statement |
| 11848 * @param finallyKeyword the token representing the 'finally' keyword | 11731 * @param finallyKeyword the token representing the 'finally' keyword |
| 11849 * @param finallyClause the finally clause contained in the try statement | 11732 * @param finallyClause the finally clause contained in the try statement |
| 11850 */ | 11733 */ |
| 11851 TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses
, Token finallyKeyword, Block finallyClause) { | 11734 TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses
, Token finallyKeyword, Block finallyClause) { |
| 11852 this._catchClauses = new NodeList<CatchClause>(this); | 11735 this._catchClauses = new NodeList<CatchClause>(this); |
| 11853 this._tryKeyword = tryKeyword; | 11736 this._tryKeyword = tryKeyword; |
| 11854 this._body = becomeParentOf(body); | 11737 this._body = becomeParentOf(body); |
| 11855 this._catchClauses.addAll(catchClauses); | 11738 this._catchClauses.addAll(catchClauses); |
| 11856 this._finallyKeyword = finallyKeyword; | 11739 this._finallyKeyword = finallyKeyword; |
| 11857 this._finallyClause = becomeParentOf(finallyClause); | 11740 this._finallyClause = becomeParentOf(finallyClause); |
| 11858 } | 11741 } |
| 11859 | 11742 |
| 11860 /** | 11743 /** |
| 11861 * Initialize a newly created try statement. | 11744 * Initialize a newly created try statement. |
| 11862 * @param tryKeyword the token representing the 'try' keyword | 11745 * @param tryKeyword the token representing the 'try' keyword |
| 11863 * @param body the body of the statement | 11746 * @param body the body of the statement |
| 11864 * @param catchClauses the catch clauses contained in the try statement | 11747 * @param catchClauses the catch clauses contained in the try statement |
| 11865 * @param finallyKeyword the token representing the 'finally' keyword | 11748 * @param finallyKeyword the token representing the 'finally' keyword |
| 11866 * @param finallyClause the finally clause contained in the try statement | 11749 * @param finallyClause the finally clause contained in the try statement |
| 11867 */ | 11750 */ |
| 11868 TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, To
ken finallyKeyword, Block finallyClause}) : this.full(tryKeyword, body, catchCla
uses, finallyKeyword, finallyClause); | 11751 TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, To
ken finallyKeyword, Block finallyClause}) : this.full(tryKeyword, body, catchCla
uses, finallyKeyword, finallyClause); |
| 11869 accept(ASTVisitor visitor) => visitor.visitTryStatement(this); | 11752 accept(ASTVisitor visitor) => visitor.visitTryStatement(this); |
| 11870 Token get beginToken => _tryKeyword; | 11753 Token get beginToken => _tryKeyword; |
| 11871 | 11754 |
| 11872 /** | 11755 /** |
| 11873 * Return the body of the statement. | 11756 * Return the body of the statement. |
| 11874 * @return the body of the statement | 11757 * @return the body of the statement |
| 11875 */ | 11758 */ |
| 11876 Block get body => _body; | 11759 Block get body => _body; |
| 11877 | 11760 |
| 11878 /** | 11761 /** |
| 11879 * Return the catch clauses contained in the try statement. | 11762 * Return the catch clauses contained in the try statement. |
| 11880 * @return the catch clauses contained in the try statement | 11763 * @return the catch clauses contained in the try statement |
| 11881 */ | 11764 */ |
| 11882 NodeList<CatchClause> get catchClauses => _catchClauses; | 11765 NodeList<CatchClause> get catchClauses => _catchClauses; |
| 11883 Token get endToken { | 11766 Token get endToken { |
| 11884 if (_finallyClause != null) { | 11767 if (_finallyClause != null) { |
| 11885 return _finallyClause.endToken; | 11768 return _finallyClause.endToken; |
| 11886 } else if (_finallyKeyword != null) { | 11769 } else if (_finallyKeyword != null) { |
| 11887 return _finallyKeyword; | 11770 return _finallyKeyword; |
| 11888 } else if (!_catchClauses.isEmpty) { | 11771 } else if (!_catchClauses.isEmpty) { |
| 11889 return _catchClauses.endToken; | 11772 return _catchClauses.endToken; |
| 11890 } | 11773 } |
| 11891 return _body.endToken; | 11774 return _body.endToken; |
| 11892 } | 11775 } |
| 11893 | 11776 |
| 11894 /** | 11777 /** |
| 11895 * Return the finally clause contained in the try statement, or {@code null} i
f the statement does | 11778 * Return the finally clause contained in the try statement, or {@code null} i
f the statement does |
| 11896 * not contain a finally clause. | 11779 * not contain a finally clause. |
| 11897 * @return the finally clause contained in the try statement | 11780 * @return the finally clause contained in the try statement |
| 11898 */ | 11781 */ |
| 11899 Block get finallyClause => _finallyClause; | 11782 Block get finallyClause => _finallyClause; |
| 11900 | 11783 |
| 11901 /** | 11784 /** |
| 11902 * Return the token representing the 'finally' keyword, or {@code null} if the
statement does not | 11785 * Return the token representing the 'finally' keyword, or {@code null} if the
statement does not |
| 11903 * contain a finally clause. | 11786 * contain a finally clause. |
| 11904 * @return the token representing the 'finally' keyword | 11787 * @return the token representing the 'finally' keyword |
| 11905 */ | 11788 */ |
| 11906 Token get finallyKeyword => _finallyKeyword; | 11789 Token get finallyKeyword => _finallyKeyword; |
| 11907 | 11790 |
| 11908 /** | 11791 /** |
| 11909 * Return the token representing the 'try' keyword. | 11792 * Return the token representing the 'try' keyword. |
| 11910 * @return the token representing the 'try' keyword | 11793 * @return the token representing the 'try' keyword |
| 11911 */ | 11794 */ |
| 11912 Token get tryKeyword => _tryKeyword; | 11795 Token get tryKeyword => _tryKeyword; |
| 11913 | 11796 |
| 11914 /** | 11797 /** |
| 11915 * Set the body of the statement to the given block. | 11798 * Set the body of the statement to the given block. |
| 11916 * @param block the body of the statement | 11799 * @param block the body of the statement |
| 11917 */ | 11800 */ |
| 11918 void set body(Block block) { | 11801 void set body(Block block) { |
| 11919 _body = becomeParentOf(block); | 11802 _body = becomeParentOf(block); |
| 11920 } | 11803 } |
| 11921 | 11804 |
| 11922 /** | 11805 /** |
| 11923 * Set the finally clause contained in the try statement to the given block. | 11806 * Set the finally clause contained in the try statement to the given block. |
| 11924 * @param block the finally clause contained in the try statement | 11807 * @param block the finally clause contained in the try statement |
| 11925 */ | 11808 */ |
| 11926 void set finallyClause(Block block) { | 11809 void set finallyClause(Block block) { |
| 11927 _finallyClause = becomeParentOf(block); | 11810 _finallyClause = becomeParentOf(block); |
| 11928 } | 11811 } |
| 11929 | 11812 |
| 11930 /** | 11813 /** |
| 11931 * Set the token representing the 'finally' keyword to the given token. | 11814 * Set the token representing the 'finally' keyword to the given token. |
| 11932 * @param finallyKeyword the token representing the 'finally' keyword | 11815 * @param finallyKeyword the token representing the 'finally' keyword |
| 11933 */ | 11816 */ |
| 11934 void set finallyKeyword(Token finallyKeyword2) { | 11817 void set finallyKeyword(Token finallyKeyword2) { |
| 11935 this._finallyKeyword = finallyKeyword2; | 11818 this._finallyKeyword = finallyKeyword2; |
| 11936 } | 11819 } |
| 11937 | 11820 |
| 11938 /** | 11821 /** |
| 11939 * Set the token representing the 'try' keyword to the given token. | 11822 * Set the token representing the 'try' keyword to the given token. |
| 11940 * @param tryKeyword the token representing the 'try' keyword | 11823 * @param tryKeyword the token representing the 'try' keyword |
| 11941 */ | 11824 */ |
| 11942 void set tryKeyword(Token tryKeyword2) { | 11825 void set tryKeyword(Token tryKeyword2) { |
| 11943 this._tryKeyword = tryKeyword2; | 11826 this._tryKeyword = tryKeyword2; |
| 11944 } | 11827 } |
| 11945 void visitChildren(ASTVisitor<Object> visitor) { | 11828 void visitChildren(ASTVisitor<Object> visitor) { |
| 11946 safelyVisitChild(_body, visitor); | 11829 safelyVisitChild(_body, visitor); |
| 11947 _catchClauses.accept(visitor); | 11830 _catchClauses.accept(visitor); |
| 11948 safelyVisitChild(_finallyClause, visitor); | 11831 safelyVisitChild(_finallyClause, visitor); |
| 11949 } | 11832 } |
| 11950 } | 11833 } |
| 11951 | |
| 11952 /** | 11834 /** |
| 11953 * The abstract class {@code TypeAlias} defines the behavior common to declarati
ons of type aliases. | 11835 * The abstract class {@code TypeAlias} defines the behavior common to declarati
ons of type aliases. |
| 11954 * <pre> | 11836 * <pre> |
| 11955 * typeAlias ::= | 11837 * typeAlias ::= |
| 11956 * 'typedef' typeAliasBody | 11838 * 'typedef' typeAliasBody |
| 11957 * typeAliasBody ::= | 11839 * typeAliasBody ::= |
| 11958 * classTypeAlias | 11840 * classTypeAlias |
| 11959 * | functionTypeAlias | 11841 * | functionTypeAlias |
| 11960 * </pre> | 11842 * </pre> |
| 11961 * @coverage dart.engine.ast | 11843 * @coverage dart.engine.ast |
| 11962 */ | 11844 */ |
| 11963 abstract class TypeAlias extends CompilationUnitMember { | 11845 abstract class TypeAlias extends CompilationUnitMember { |
| 11964 | 11846 |
| 11965 /** | 11847 /** |
| 11966 * The token representing the 'typedef' keyword. | 11848 * The token representing the 'typedef' keyword. |
| 11967 */ | 11849 */ |
| 11968 Token _keyword; | 11850 Token _keyword; |
| 11969 | 11851 |
| 11970 /** | 11852 /** |
| 11971 * The semicolon terminating the declaration. | 11853 * The semicolon terminating the declaration. |
| 11972 */ | 11854 */ |
| 11973 Token _semicolon; | 11855 Token _semicolon; |
| 11974 | 11856 |
| 11975 /** | 11857 /** |
| 11976 * Initialize a newly created type alias. | 11858 * Initialize a newly created type alias. |
| 11977 * @param comment the documentation comment associated with this type alias | 11859 * @param comment the documentation comment associated with this type alias |
| 11978 * @param metadata the annotations associated with this type alias | 11860 * @param metadata the annotations associated with this type alias |
| 11979 * @param keyword the token representing the 'typedef' keyword | 11861 * @param keyword the token representing the 'typedef' keyword |
| 11980 * @param semicolon the semicolon terminating the declaration | 11862 * @param semicolon the semicolon terminating the declaration |
| 11981 */ | 11863 */ |
| 11982 TypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, Toke
n semicolon) : super.full(comment, metadata) { | 11864 TypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, Toke
n semicolon) : super.full(comment, metadata) { |
| 11983 this._keyword = keyword; | 11865 this._keyword = keyword; |
| 11984 this._semicolon = semicolon; | 11866 this._semicolon = semicolon; |
| 11985 } | 11867 } |
| 11986 | 11868 |
| 11987 /** | 11869 /** |
| 11988 * Initialize a newly created type alias. | 11870 * Initialize a newly created type alias. |
| 11989 * @param comment the documentation comment associated with this type alias | 11871 * @param comment the documentation comment associated with this type alias |
| 11990 * @param metadata the annotations associated with this type alias | 11872 * @param metadata the annotations associated with this type alias |
| 11991 * @param keyword the token representing the 'typedef' keyword | 11873 * @param keyword the token representing the 'typedef' keyword |
| 11992 * @param semicolon the semicolon terminating the declaration | 11874 * @param semicolon the semicolon terminating the declaration |
| 11993 */ | 11875 */ |
| 11994 TypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Token se
micolon}) : this.full(comment, metadata, keyword, semicolon); | 11876 TypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Token se
micolon}) : this.full(comment, metadata, keyword, semicolon); |
| 11995 Token get endToken => _semicolon; | 11877 Token get endToken => _semicolon; |
| 11996 | 11878 |
| 11997 /** | 11879 /** |
| 11998 * Return the token representing the 'typedef' keyword. | 11880 * Return the token representing the 'typedef' keyword. |
| 11999 * @return the token representing the 'typedef' keyword | 11881 * @return the token representing the 'typedef' keyword |
| 12000 */ | 11882 */ |
| 12001 Token get keyword => _keyword; | 11883 Token get keyword => _keyword; |
| 12002 | 11884 |
| 12003 /** | 11885 /** |
| 12004 * Return the semicolon terminating the declaration. | 11886 * Return the semicolon terminating the declaration. |
| 12005 * @return the semicolon terminating the declaration | 11887 * @return the semicolon terminating the declaration |
| 12006 */ | 11888 */ |
| 12007 Token get semicolon => _semicolon; | 11889 Token get semicolon => _semicolon; |
| 12008 | 11890 |
| 12009 /** | 11891 /** |
| 12010 * Set the token representing the 'typedef' keyword to the given token. | 11892 * Set the token representing the 'typedef' keyword to the given token. |
| 12011 * @param keyword the token representing the 'typedef' keyword | 11893 * @param keyword the token representing the 'typedef' keyword |
| 12012 */ | 11894 */ |
| 12013 void set keyword(Token keyword2) { | 11895 void set keyword(Token keyword2) { |
| 12014 this._keyword = keyword2; | 11896 this._keyword = keyword2; |
| 12015 } | 11897 } |
| 12016 | 11898 |
| 12017 /** | 11899 /** |
| 12018 * Set the semicolon terminating the declaration to the given token. | 11900 * Set the semicolon terminating the declaration to the given token. |
| 12019 * @param semicolon the semicolon terminating the declaration | 11901 * @param semicolon the semicolon terminating the declaration |
| 12020 */ | 11902 */ |
| 12021 void set semicolon(Token semicolon2) { | 11903 void set semicolon(Token semicolon2) { |
| 12022 this._semicolon = semicolon2; | 11904 this._semicolon = semicolon2; |
| 12023 } | 11905 } |
| 12024 Token get firstTokenAfterCommentAndMetadata => _keyword; | 11906 Token get firstTokenAfterCommentAndMetadata => _keyword; |
| 12025 } | 11907 } |
| 12026 | |
| 12027 /** | 11908 /** |
| 12028 * Instances of the class {@code TypeArgumentList} represent a list of type argu
ments. | 11909 * Instances of the class {@code TypeArgumentList} represent a list of type argu
ments. |
| 12029 * <pre> | 11910 * <pre> |
| 12030 * typeArguments ::= | 11911 * typeArguments ::= |
| 12031 * '<' typeName (',' typeName)* '>' | 11912 * '<' typeName (',' typeName)* '>' |
| 12032 * </pre> | 11913 * </pre> |
| 12033 * @coverage dart.engine.ast | 11914 * @coverage dart.engine.ast |
| 12034 */ | 11915 */ |
| 12035 class TypeArgumentList extends ASTNode { | 11916 class TypeArgumentList extends ASTNode { |
| 12036 | 11917 |
| 12037 /** | 11918 /** |
| 12038 * The left bracket. | 11919 * The left bracket. |
| 12039 */ | 11920 */ |
| 12040 Token _leftBracket; | 11921 Token _leftBracket; |
| 12041 | 11922 |
| 12042 /** | 11923 /** |
| 12043 * The type arguments associated with the type. | 11924 * The type arguments associated with the type. |
| 12044 */ | 11925 */ |
| 12045 NodeList<TypeName> _arguments; | 11926 NodeList<TypeName> _arguments; |
| 12046 | 11927 |
| 12047 /** | 11928 /** |
| 12048 * The right bracket. | 11929 * The right bracket. |
| 12049 */ | 11930 */ |
| 12050 Token _rightBracket; | 11931 Token _rightBracket; |
| 12051 | 11932 |
| 12052 /** | 11933 /** |
| 12053 * Initialize a newly created list of type arguments. | 11934 * Initialize a newly created list of type arguments. |
| 12054 * @param leftBracket the left bracket | 11935 * @param leftBracket the left bracket |
| 12055 * @param arguments the type arguments associated with the type | 11936 * @param arguments the type arguments associated with the type |
| 12056 * @param rightBracket the right bracket | 11937 * @param rightBracket the right bracket |
| 12057 */ | 11938 */ |
| 12058 TypeArgumentList.full(Token leftBracket, List<TypeName> arguments, Token right
Bracket) { | 11939 TypeArgumentList.full(Token leftBracket, List<TypeName> arguments, Token right
Bracket) { |
| 12059 this._arguments = new NodeList<TypeName>(this); | 11940 this._arguments = new NodeList<TypeName>(this); |
| 12060 this._leftBracket = leftBracket; | 11941 this._leftBracket = leftBracket; |
| 12061 this._arguments.addAll(arguments); | 11942 this._arguments.addAll(arguments); |
| 12062 this._rightBracket = rightBracket; | 11943 this._rightBracket = rightBracket; |
| 12063 } | 11944 } |
| 12064 | 11945 |
| 12065 /** | 11946 /** |
| 12066 * Initialize a newly created list of type arguments. | 11947 * Initialize a newly created list of type arguments. |
| 12067 * @param leftBracket the left bracket | 11948 * @param leftBracket the left bracket |
| 12068 * @param arguments the type arguments associated with the type | 11949 * @param arguments the type arguments associated with the type |
| 12069 * @param rightBracket the right bracket | 11950 * @param rightBracket the right bracket |
| 12070 */ | 11951 */ |
| 12071 TypeArgumentList({Token leftBracket, List<TypeName> arguments, Token rightBrac
ket}) : this.full(leftBracket, arguments, rightBracket); | 11952 TypeArgumentList({Token leftBracket, List<TypeName> arguments, Token rightBrac
ket}) : this.full(leftBracket, arguments, rightBracket); |
| 12072 accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this); | 11953 accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this); |
| 12073 | 11954 |
| 12074 /** | 11955 /** |
| 12075 * Return the type arguments associated with the type. | 11956 * Return the type arguments associated with the type. |
| 12076 * @return the type arguments associated with the type | 11957 * @return the type arguments associated with the type |
| 12077 */ | 11958 */ |
| 12078 NodeList<TypeName> get arguments => _arguments; | 11959 NodeList<TypeName> get arguments => _arguments; |
| 12079 Token get beginToken => _leftBracket; | 11960 Token get beginToken => _leftBracket; |
| 12080 Token get endToken => _rightBracket; | 11961 Token get endToken => _rightBracket; |
| 12081 | 11962 |
| 12082 /** | 11963 /** |
| 12083 * Return the left bracket. | 11964 * Return the left bracket. |
| 12084 * @return the left bracket | 11965 * @return the left bracket |
| 12085 */ | 11966 */ |
| 12086 Token get leftBracket => _leftBracket; | 11967 Token get leftBracket => _leftBracket; |
| 12087 | 11968 |
| 12088 /** | 11969 /** |
| 12089 * Return the right bracket. | 11970 * Return the right bracket. |
| 12090 * @return the right bracket | 11971 * @return the right bracket |
| 12091 */ | 11972 */ |
| 12092 Token get rightBracket => _rightBracket; | 11973 Token get rightBracket => _rightBracket; |
| 12093 | 11974 |
| 12094 /** | 11975 /** |
| 12095 * Set the left bracket to the given token. | 11976 * Set the left bracket to the given token. |
| 12096 * @param leftBracket the left bracket | 11977 * @param leftBracket the left bracket |
| 12097 */ | 11978 */ |
| 12098 void set leftBracket(Token leftBracket2) { | 11979 void set leftBracket(Token leftBracket2) { |
| 12099 this._leftBracket = leftBracket2; | 11980 this._leftBracket = leftBracket2; |
| 12100 } | 11981 } |
| 12101 | 11982 |
| 12102 /** | 11983 /** |
| 12103 * Set the right bracket to the given token. | 11984 * Set the right bracket to the given token. |
| 12104 * @param rightBracket the right bracket | 11985 * @param rightBracket the right bracket |
| 12105 */ | 11986 */ |
| 12106 void set rightBracket(Token rightBracket2) { | 11987 void set rightBracket(Token rightBracket2) { |
| 12107 this._rightBracket = rightBracket2; | 11988 this._rightBracket = rightBracket2; |
| 12108 } | 11989 } |
| 12109 void visitChildren(ASTVisitor<Object> visitor) { | 11990 void visitChildren(ASTVisitor<Object> visitor) { |
| 12110 _arguments.accept(visitor); | 11991 _arguments.accept(visitor); |
| 12111 } | 11992 } |
| 12112 } | 11993 } |
| 12113 | |
| 12114 /** | 11994 /** |
| 12115 * Instances of the class {@code TypeName} represent the name of a type, which c
an optionally | 11995 * Instances of the class {@code TypeName} represent the name of a type, which c
an optionally |
| 12116 * include type arguments. | 11996 * include type arguments. |
| 12117 * <pre> | 11997 * <pre> |
| 12118 * typeName ::={@link Identifier identifier} typeArguments? | 11998 * typeName ::={@link Identifier identifier} typeArguments? |
| 12119 * </pre> | 11999 * </pre> |
| 12120 * @coverage dart.engine.ast | 12000 * @coverage dart.engine.ast |
| 12121 */ | 12001 */ |
| 12122 class TypeName extends ASTNode { | 12002 class TypeName extends ASTNode { |
| 12123 | 12003 |
| 12124 /** | 12004 /** |
| 12125 * The name of the type. | 12005 * The name of the type. |
| 12126 */ | 12006 */ |
| 12127 Identifier _name; | 12007 Identifier _name; |
| 12128 | 12008 |
| 12129 /** | 12009 /** |
| 12130 * The type arguments associated with the type, or {@code null} if there are n
o type arguments. | 12010 * The type arguments associated with the type, or {@code null} if there are n
o type arguments. |
| 12131 */ | 12011 */ |
| 12132 TypeArgumentList _typeArguments; | 12012 TypeArgumentList _typeArguments; |
| 12133 | 12013 |
| 12134 /** | 12014 /** |
| 12135 * The type being named, or {@code null} if the AST structure has not been res
olved. | 12015 * The type being named, or {@code null} if the AST structure has not been res
olved. |
| 12136 */ | 12016 */ |
| 12137 Type2 _type; | 12017 Type2 _type; |
| 12138 | 12018 |
| 12139 /** | 12019 /** |
| 12140 * Initialize a newly created type name. | 12020 * Initialize a newly created type name. |
| 12141 * @param name the name of the type | 12021 * @param name the name of the type |
| 12142 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are | 12022 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are |
| 12143 * no type arguments | 12023 * no type arguments |
| 12144 */ | 12024 */ |
| 12145 TypeName.full(Identifier name, TypeArgumentList typeArguments) { | 12025 TypeName.full(Identifier name, TypeArgumentList typeArguments) { |
| 12146 this._name = becomeParentOf(name); | 12026 this._name = becomeParentOf(name); |
| 12147 this._typeArguments = becomeParentOf(typeArguments); | 12027 this._typeArguments = becomeParentOf(typeArguments); |
| 12148 } | 12028 } |
| 12149 | 12029 |
| 12150 /** | 12030 /** |
| 12151 * Initialize a newly created type name. | 12031 * Initialize a newly created type name. |
| 12152 * @param name the name of the type | 12032 * @param name the name of the type |
| 12153 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are | 12033 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are |
| 12154 * no type arguments | 12034 * no type arguments |
| 12155 */ | 12035 */ |
| 12156 TypeName({Identifier name, TypeArgumentList typeArguments}) : this.full(name,
typeArguments); | 12036 TypeName({Identifier name, TypeArgumentList typeArguments}) : this.full(name,
typeArguments); |
| 12157 accept(ASTVisitor visitor) => visitor.visitTypeName(this); | 12037 accept(ASTVisitor visitor) => visitor.visitTypeName(this); |
| 12158 Token get beginToken => _name.beginToken; | 12038 Token get beginToken => _name.beginToken; |
| 12159 Token get endToken { | 12039 Token get endToken { |
| 12160 if (_typeArguments != null) { | 12040 if (_typeArguments != null) { |
| 12161 return _typeArguments.endToken; | 12041 return _typeArguments.endToken; |
| 12162 } | 12042 } |
| 12163 return _name.endToken; | 12043 return _name.endToken; |
| 12164 } | 12044 } |
| 12165 | 12045 |
| 12166 /** | 12046 /** |
| 12167 * Return the name of the type. | 12047 * Return the name of the type. |
| 12168 * @return the name of the type | 12048 * @return the name of the type |
| 12169 */ | 12049 */ |
| 12170 Identifier get name => _name; | 12050 Identifier get name => _name; |
| 12171 | 12051 |
| 12172 /** | 12052 /** |
| 12173 * Return the type being named, or {@code null} if the AST structure has not b
een resolved. | 12053 * Return the type being named, or {@code null} if the AST structure has not b
een resolved. |
| 12174 * @return the type being named | 12054 * @return the type being named |
| 12175 */ | 12055 */ |
| 12176 Type2 get type => _type; | 12056 Type2 get type => _type; |
| 12177 | 12057 |
| 12178 /** | 12058 /** |
| 12179 * Return the type arguments associated with the type, or {@code null} if ther
e are no type | 12059 * Return the type arguments associated with the type, or {@code null} if ther
e are no type |
| 12180 * arguments. | 12060 * arguments. |
| 12181 * @return the type arguments associated with the type | 12061 * @return the type arguments associated with the type |
| 12182 */ | 12062 */ |
| 12183 TypeArgumentList get typeArguments => _typeArguments; | 12063 TypeArgumentList get typeArguments => _typeArguments; |
| 12184 bool isSynthetic() => _name.isSynthetic() && _typeArguments == null; | 12064 bool isSynthetic() => _name.isSynthetic() && _typeArguments == null; |
| 12185 | 12065 |
| 12186 /** | 12066 /** |
| 12187 * Set the name of the type to the given identifier. | 12067 * Set the name of the type to the given identifier. |
| 12188 * @param identifier the name of the type | 12068 * @param identifier the name of the type |
| 12189 */ | 12069 */ |
| 12190 void set name(Identifier identifier) { | 12070 void set name(Identifier identifier) { |
| 12191 _name = becomeParentOf(identifier); | 12071 _name = becomeParentOf(identifier); |
| 12192 } | 12072 } |
| 12193 | 12073 |
| 12194 /** | 12074 /** |
| 12195 * Set the type being named to the given type. | 12075 * Set the type being named to the given type. |
| 12196 * @param type the type being named | 12076 * @param type the type being named |
| 12197 */ | 12077 */ |
| 12198 void set type(Type2 type2) { | 12078 void set type(Type2 type2) { |
| 12199 this._type = type2; | 12079 this._type = type2; |
| 12200 } | 12080 } |
| 12201 | 12081 |
| 12202 /** | 12082 /** |
| 12203 * Set the type arguments associated with the type to the given type arguments
. | 12083 * Set the type arguments associated with the type to the given type arguments
. |
| 12204 * @param typeArguments the type arguments associated with the type | 12084 * @param typeArguments the type arguments associated with the type |
| 12205 */ | 12085 */ |
| 12206 void set typeArguments(TypeArgumentList typeArguments2) { | 12086 void set typeArguments(TypeArgumentList typeArguments2) { |
| 12207 this._typeArguments = becomeParentOf(typeArguments2); | 12087 this._typeArguments = becomeParentOf(typeArguments2); |
| 12208 } | 12088 } |
| 12209 void visitChildren(ASTVisitor<Object> visitor) { | 12089 void visitChildren(ASTVisitor<Object> visitor) { |
| 12210 safelyVisitChild(_name, visitor); | 12090 safelyVisitChild(_name, visitor); |
| 12211 safelyVisitChild(_typeArguments, visitor); | 12091 safelyVisitChild(_typeArguments, visitor); |
| 12212 } | 12092 } |
| 12213 } | 12093 } |
| 12214 | |
| 12215 /** | 12094 /** |
| 12216 * Instances of the class {@code TypeParameter} represent a type parameter. | 12095 * Instances of the class {@code TypeParameter} represent a type parameter. |
| 12217 * <pre> | 12096 * <pre> |
| 12218 * typeParameter ::={@link SimpleIdentifier name} ('extends' {@link TypeName bou
nd})? | 12097 * typeParameter ::={@link SimpleIdentifier name} ('extends' {@link TypeName bou
nd})? |
| 12219 * </pre> | 12098 * </pre> |
| 12220 * @coverage dart.engine.ast | 12099 * @coverage dart.engine.ast |
| 12221 */ | 12100 */ |
| 12222 class TypeParameter extends Declaration { | 12101 class TypeParameter extends Declaration { |
| 12223 | 12102 |
| 12224 /** | 12103 /** |
| 12225 * The name of the type parameter. | 12104 * The name of the type parameter. |
| 12226 */ | 12105 */ |
| 12227 SimpleIdentifier _name; | 12106 SimpleIdentifier _name; |
| 12228 | 12107 |
| 12229 /** | 12108 /** |
| 12230 * The token representing the 'extends' keyword, or {@code null} if there was
no explicit upper | 12109 * The token representing the 'extends' keyword, or {@code null} if there was
no explicit upper |
| 12231 * bound. | 12110 * bound. |
| 12232 */ | 12111 */ |
| 12233 Token _keyword; | 12112 Token _keyword; |
| 12234 | 12113 |
| 12235 /** | 12114 /** |
| 12236 * The name of the upper bound for legal arguments, or {@code null} if there w
as no explicit upper | 12115 * The name of the upper bound for legal arguments, or {@code null} if there w
as no explicit upper |
| 12237 * bound. | 12116 * bound. |
| 12238 */ | 12117 */ |
| 12239 TypeName _bound; | 12118 TypeName _bound; |
| 12240 | 12119 |
| 12241 /** | 12120 /** |
| 12242 * Initialize a newly created type parameter. | 12121 * Initialize a newly created type parameter. |
| 12243 * @param comment the documentation comment associated with the type parameter | 12122 * @param comment the documentation comment associated with the type parameter |
| 12244 * @param metadata the annotations associated with the type parameter | 12123 * @param metadata the annotations associated with the type parameter |
| 12245 * @param name the name of the type parameter | 12124 * @param name the name of the type parameter |
| 12246 * @param keyword the token representing the 'extends' keyword | 12125 * @param keyword the token representing the 'extends' keyword |
| 12247 * @param bound the name of the upper bound for legal arguments | 12126 * @param bound the name of the upper bound for legal arguments |
| 12248 */ | 12127 */ |
| 12249 TypeParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifie
r name, Token keyword, TypeName bound) : super.full(comment, metadata) { | 12128 TypeParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifie
r name, Token keyword, TypeName bound) : super.full(comment, metadata) { |
| 12250 this._name = becomeParentOf(name); | 12129 this._name = becomeParentOf(name); |
| 12251 this._keyword = keyword; | 12130 this._keyword = keyword; |
| 12252 this._bound = becomeParentOf(bound); | 12131 this._bound = becomeParentOf(bound); |
| 12253 } | 12132 } |
| 12254 | 12133 |
| 12255 /** | 12134 /** |
| 12256 * Initialize a newly created type parameter. | 12135 * Initialize a newly created type parameter. |
| 12257 * @param comment the documentation comment associated with the type parameter | 12136 * @param comment the documentation comment associated with the type parameter |
| 12258 * @param metadata the annotations associated with the type parameter | 12137 * @param metadata the annotations associated with the type parameter |
| 12259 * @param name the name of the type parameter | 12138 * @param name the name of the type parameter |
| 12260 * @param keyword the token representing the 'extends' keyword | 12139 * @param keyword the token representing the 'extends' keyword |
| 12261 * @param bound the name of the upper bound for legal arguments | 12140 * @param bound the name of the upper bound for legal arguments |
| 12262 */ | 12141 */ |
| 12263 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na
me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword
, bound); | 12142 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na
me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword
, bound); |
| 12264 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); | 12143 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); |
| 12265 | 12144 |
| 12266 /** | 12145 /** |
| 12267 * Return the name of the upper bound for legal arguments, or {@code null} if
there was no | 12146 * Return the name of the upper bound for legal arguments, or {@code null} if
there was no |
| 12268 * explicit upper bound. | 12147 * explicit upper bound. |
| 12269 * @return the name of the upper bound for legal arguments | 12148 * @return the name of the upper bound for legal arguments |
| 12270 */ | 12149 */ |
| 12271 TypeName get bound => _bound; | 12150 TypeName get bound => _bound; |
| 12272 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria
bleElement) : null; | 12151 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria
bleElement) : null; |
| 12273 Token get endToken { | 12152 Token get endToken { |
| 12274 if (_bound == null) { | 12153 if (_bound == null) { |
| 12275 return _name.endToken; | 12154 return _name.endToken; |
| 12276 } | 12155 } |
| 12277 return _bound.endToken; | 12156 return _bound.endToken; |
| 12278 } | 12157 } |
| 12279 | 12158 |
| 12280 /** | 12159 /** |
| 12281 * Return the token representing the 'assert' keyword. | 12160 * Return the token representing the 'assert' keyword. |
| 12282 * @return the token representing the 'assert' keyword | 12161 * @return the token representing the 'assert' keyword |
| 12283 */ | 12162 */ |
| 12284 Token get keyword => _keyword; | 12163 Token get keyword => _keyword; |
| 12285 | 12164 |
| 12286 /** | 12165 /** |
| 12287 * Return the name of the type parameter. | 12166 * Return the name of the type parameter. |
| 12288 * @return the name of the type parameter | 12167 * @return the name of the type parameter |
| 12289 */ | 12168 */ |
| 12290 SimpleIdentifier get name => _name; | 12169 SimpleIdentifier get name => _name; |
| 12291 | 12170 |
| 12292 /** | 12171 /** |
| 12293 * Set the name of the upper bound for legal arguments to the given type name. | 12172 * Set the name of the upper bound for legal arguments to the given type name. |
| 12294 * @param typeName the name of the upper bound for legal arguments | 12173 * @param typeName the name of the upper bound for legal arguments |
| 12295 */ | 12174 */ |
| 12296 void set bound(TypeName typeName) { | 12175 void set bound(TypeName typeName) { |
| 12297 _bound = becomeParentOf(typeName); | 12176 _bound = becomeParentOf(typeName); |
| 12298 } | 12177 } |
| 12299 | 12178 |
| 12300 /** | 12179 /** |
| 12301 * Set the token representing the 'assert' keyword to the given token. | 12180 * Set the token representing the 'assert' keyword to the given token. |
| 12302 * @param keyword the token representing the 'assert' keyword | 12181 * @param keyword the token representing the 'assert' keyword |
| 12303 */ | 12182 */ |
| 12304 void set keyword(Token keyword2) { | 12183 void set keyword(Token keyword2) { |
| 12305 this._keyword = keyword2; | 12184 this._keyword = keyword2; |
| 12306 } | 12185 } |
| 12307 | 12186 |
| 12308 /** | 12187 /** |
| 12309 * Set the name of the type parameter to the given identifier. | 12188 * Set the name of the type parameter to the given identifier. |
| 12310 * @param identifier the name of the type parameter | 12189 * @param identifier the name of the type parameter |
| 12311 */ | 12190 */ |
| 12312 void set name(SimpleIdentifier identifier) { | 12191 void set name(SimpleIdentifier identifier) { |
| 12313 _name = becomeParentOf(identifier); | 12192 _name = becomeParentOf(identifier); |
| 12314 } | 12193 } |
| 12315 void visitChildren(ASTVisitor<Object> visitor) { | 12194 void visitChildren(ASTVisitor<Object> visitor) { |
| 12316 super.visitChildren(visitor); | 12195 super.visitChildren(visitor); |
| 12317 safelyVisitChild(_name, visitor); | 12196 safelyVisitChild(_name, visitor); |
| 12318 safelyVisitChild(_bound, visitor); | 12197 safelyVisitChild(_bound, visitor); |
| 12319 } | 12198 } |
| 12320 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; | 12199 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; |
| 12321 } | 12200 } |
| 12322 | |
| 12323 /** | 12201 /** |
| 12324 * Instances of the class {@code TypeParameterList} represent type parameters wi
thin a declaration. | 12202 * Instances of the class {@code TypeParameterList} represent type parameters wi
thin a declaration. |
| 12325 * <pre> | 12203 * <pre> |
| 12326 * typeParameterList ::= | 12204 * typeParameterList ::= |
| 12327 * '<' {@link TypeParameter typeParameter} (',' {@link TypeParameter typeParamet
er})* '>' | 12205 * '<' {@link TypeParameter typeParameter} (',' {@link TypeParameter typeParamet
er})* '>' |
| 12328 * </pre> | 12206 * </pre> |
| 12329 * @coverage dart.engine.ast | 12207 * @coverage dart.engine.ast |
| 12330 */ | 12208 */ |
| 12331 class TypeParameterList extends ASTNode { | 12209 class TypeParameterList extends ASTNode { |
| 12332 | 12210 |
| 12333 /** | 12211 /** |
| 12334 * The left angle bracket. | 12212 * The left angle bracket. |
| 12335 */ | 12213 */ |
| 12336 Token _leftBracket; | 12214 Token _leftBracket; |
| 12337 | 12215 |
| 12338 /** | 12216 /** |
| 12339 * The type parameters in the list. | 12217 * The type parameters in the list. |
| 12340 */ | 12218 */ |
| 12341 NodeList<TypeParameter> _typeParameters; | 12219 NodeList<TypeParameter> _typeParameters; |
| 12342 | 12220 |
| 12343 /** | 12221 /** |
| 12344 * The right angle bracket. | 12222 * The right angle bracket. |
| 12345 */ | 12223 */ |
| 12346 Token _rightBracket; | 12224 Token _rightBracket; |
| 12347 | 12225 |
| 12348 /** | 12226 /** |
| 12349 * Initialize a newly created list of type parameters. | 12227 * Initialize a newly created list of type parameters. |
| 12350 * @param leftBracket the left angle bracket | 12228 * @param leftBracket the left angle bracket |
| 12351 * @param typeParameters the type parameters in the list | 12229 * @param typeParameters the type parameters in the list |
| 12352 * @param rightBracket the right angle bracket | 12230 * @param rightBracket the right angle bracket |
| 12353 */ | 12231 */ |
| 12354 TypeParameterList.full(Token leftBracket, List<TypeParameter> typeParameters,
Token rightBracket) { | 12232 TypeParameterList.full(Token leftBracket, List<TypeParameter> typeParameters,
Token rightBracket) { |
| 12355 this._typeParameters = new NodeList<TypeParameter>(this); | 12233 this._typeParameters = new NodeList<TypeParameter>(this); |
| 12356 this._leftBracket = leftBracket; | 12234 this._leftBracket = leftBracket; |
| 12357 this._typeParameters.addAll(typeParameters); | 12235 this._typeParameters.addAll(typeParameters); |
| 12358 this._rightBracket = rightBracket; | 12236 this._rightBracket = rightBracket; |
| 12359 } | 12237 } |
| 12360 | 12238 |
| 12361 /** | 12239 /** |
| 12362 * Initialize a newly created list of type parameters. | 12240 * Initialize a newly created list of type parameters. |
| 12363 * @param leftBracket the left angle bracket | 12241 * @param leftBracket the left angle bracket |
| 12364 * @param typeParameters the type parameters in the list | 12242 * @param typeParameters the type parameters in the list |
| 12365 * @param rightBracket the right angle bracket | 12243 * @param rightBracket the right angle bracket |
| 12366 */ | 12244 */ |
| 12367 TypeParameterList({Token leftBracket, List<TypeParameter> typeParameters, Toke
n rightBracket}) : this.full(leftBracket, typeParameters, rightBracket); | 12245 TypeParameterList({Token leftBracket, List<TypeParameter> typeParameters, Toke
n rightBracket}) : this.full(leftBracket, typeParameters, rightBracket); |
| 12368 accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this); | 12246 accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this); |
| 12369 Token get beginToken => _leftBracket; | 12247 Token get beginToken => _leftBracket; |
| 12370 Token get endToken => _rightBracket; | 12248 Token get endToken => _rightBracket; |
| 12371 | 12249 |
| 12372 /** | 12250 /** |
| 12373 * Return the left angle bracket. | 12251 * Return the left angle bracket. |
| 12374 * @return the left angle bracket | 12252 * @return the left angle bracket |
| 12375 */ | 12253 */ |
| 12376 Token get leftBracket => _leftBracket; | 12254 Token get leftBracket => _leftBracket; |
| 12377 | 12255 |
| 12378 /** | 12256 /** |
| 12379 * Return the right angle bracket. | 12257 * Return the right angle bracket. |
| 12380 * @return the right angle bracket | 12258 * @return the right angle bracket |
| 12381 */ | 12259 */ |
| 12382 Token get rightBracket => _rightBracket; | 12260 Token get rightBracket => _rightBracket; |
| 12383 | 12261 |
| 12384 /** | 12262 /** |
| 12385 * Return the type parameters for the type. | 12263 * Return the type parameters for the type. |
| 12386 * @return the type parameters for the type | 12264 * @return the type parameters for the type |
| 12387 */ | 12265 */ |
| 12388 NodeList<TypeParameter> get typeParameters => _typeParameters; | 12266 NodeList<TypeParameter> get typeParameters => _typeParameters; |
| 12389 void visitChildren(ASTVisitor<Object> visitor) { | 12267 void visitChildren(ASTVisitor<Object> visitor) { |
| 12390 _typeParameters.accept(visitor); | 12268 _typeParameters.accept(visitor); |
| 12391 } | 12269 } |
| 12392 } | 12270 } |
| 12393 | |
| 12394 /** | 12271 /** |
| 12395 * The abstract class {@code TypedLiteral} defines the behavior common to litera
ls that have a type | 12272 * The abstract class {@code TypedLiteral} defines the behavior common to litera
ls that have a type |
| 12396 * associated with them. | 12273 * associated with them. |
| 12397 * <pre> | 12274 * <pre> |
| 12398 * listLiteral ::={@link ListLiteral listLiteral}| {@link MapLiteral mapLiteral}
</pre> | 12275 * listLiteral ::={@link ListLiteral listLiteral}| {@link MapLiteral mapLiteral}
</pre> |
| 12399 * @coverage dart.engine.ast | 12276 * @coverage dart.engine.ast |
| 12400 */ | 12277 */ |
| 12401 abstract class TypedLiteral extends Literal { | 12278 abstract class TypedLiteral extends Literal { |
| 12402 | 12279 |
| 12403 /** | 12280 /** |
| 12404 * The const modifier associated with this literal, or {@code null} if the lit
eral is not a | 12281 * The const modifier associated with this literal, or {@code null} if the lit
eral is not a |
| 12405 * constant. | 12282 * constant. |
| 12406 */ | 12283 */ |
| 12407 Token _modifier; | 12284 Token _modifier; |
| 12408 | 12285 |
| 12409 /** | 12286 /** |
| 12410 * The type argument associated with this literal, or {@code null} if no type
arguments were | 12287 * The type argument associated with this literal, or {@code null} if no type
arguments were |
| 12411 * declared. | 12288 * declared. |
| 12412 */ | 12289 */ |
| 12413 TypeArgumentList _typeArguments; | 12290 TypeArgumentList _typeArguments; |
| 12414 | 12291 |
| 12415 /** | 12292 /** |
| 12416 * Initialize a newly created typed literal. | 12293 * Initialize a newly created typed literal. |
| 12417 * @param modifier the const modifier associated with this literal | 12294 * @param modifier the const modifier associated with this literal |
| 12418 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 12295 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
| 12419 * arguments were declared | 12296 * arguments were declared |
| 12420 */ | 12297 */ |
| 12421 TypedLiteral.full(Token modifier, TypeArgumentList typeArguments) { | 12298 TypedLiteral.full(Token modifier, TypeArgumentList typeArguments) { |
| 12422 this._modifier = modifier; | 12299 this._modifier = modifier; |
| 12423 this._typeArguments = becomeParentOf(typeArguments); | 12300 this._typeArguments = becomeParentOf(typeArguments); |
| 12424 } | 12301 } |
| 12425 | 12302 |
| 12426 /** | 12303 /** |
| 12427 * Initialize a newly created typed literal. | 12304 * Initialize a newly created typed literal. |
| 12428 * @param modifier the const modifier associated with this literal | 12305 * @param modifier the const modifier associated with this literal |
| 12429 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 12306 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
| 12430 * arguments were declared | 12307 * arguments were declared |
| 12431 */ | 12308 */ |
| 12432 TypedLiteral({Token modifier, TypeArgumentList typeArguments}) : this.full(mod
ifier, typeArguments); | 12309 TypedLiteral({Token modifier, TypeArgumentList typeArguments}) : this.full(mod
ifier, typeArguments); |
| 12433 | 12310 |
| 12434 /** | 12311 /** |
| 12435 * Return the const modifier associated with this literal. | 12312 * Return the const modifier associated with this literal. |
| 12436 * @return the const modifier associated with this literal | 12313 * @return the const modifier associated with this literal |
| 12437 */ | 12314 */ |
| 12438 Token get modifier => _modifier; | 12315 Token get modifier => _modifier; |
| 12439 | 12316 |
| 12440 /** | 12317 /** |
| 12441 * Return the type argument associated with this literal, or {@code null} if n
o type arguments | 12318 * Return the type argument associated with this literal, or {@code null} if n
o type arguments |
| 12442 * were declared. | 12319 * were declared. |
| 12443 * @return the type argument associated with this literal | 12320 * @return the type argument associated with this literal |
| 12444 */ | 12321 */ |
| 12445 TypeArgumentList get typeArguments => _typeArguments; | 12322 TypeArgumentList get typeArguments => _typeArguments; |
| 12446 | 12323 |
| 12447 /** | 12324 /** |
| 12448 * Set the modifiers associated with this literal to the given modifiers. | 12325 * Set the modifiers associated with this literal to the given modifiers. |
| 12449 * @param modifiers the modifiers associated with this literal | 12326 * @param modifiers the modifiers associated with this literal |
| 12450 */ | 12327 */ |
| 12451 void set modifier(Token modifier2) { | 12328 void set modifier(Token modifier2) { |
| 12452 this._modifier = modifier2; | 12329 this._modifier = modifier2; |
| 12453 } | 12330 } |
| 12454 | 12331 |
| 12455 /** | 12332 /** |
| 12456 * Set the type argument associated with this literal to the given arguments. | 12333 * Set the type argument associated with this literal to the given arguments. |
| 12457 * @param typeArguments the type argument associated with this literal | 12334 * @param typeArguments the type argument associated with this literal |
| 12458 */ | 12335 */ |
| 12459 void set typeArguments(TypeArgumentList typeArguments2) { | 12336 void set typeArguments(TypeArgumentList typeArguments2) { |
| 12460 this._typeArguments = typeArguments2; | 12337 this._typeArguments = typeArguments2; |
| 12461 } | 12338 } |
| 12462 void visitChildren(ASTVisitor<Object> visitor) { | 12339 void visitChildren(ASTVisitor<Object> visitor) { |
| 12463 safelyVisitChild(_typeArguments, visitor); | 12340 safelyVisitChild(_typeArguments, visitor); |
| 12464 } | 12341 } |
| 12465 } | 12342 } |
| 12466 | |
| 12467 /** | 12343 /** |
| 12468 * The abstract class {@code UriBasedDirective} defines the behavior common to n
odes that represent | 12344 * The abstract class {@code UriBasedDirective} defines the behavior common to n
odes that represent |
| 12469 * a directive that references a URI. | 12345 * a directive that references a URI. |
| 12470 * <pre> | 12346 * <pre> |
| 12471 * uriBasedDirective ::={@link ExportDirective exportDirective}| {@link ImportDi
rective importDirective}| {@link PartDirective partDirective}</pre> | 12347 * uriBasedDirective ::={@link ExportDirective exportDirective}| {@link ImportDi
rective importDirective}| {@link PartDirective partDirective}</pre> |
| 12472 * @coverage dart.engine.ast | 12348 * @coverage dart.engine.ast |
| 12473 */ | 12349 */ |
| 12474 abstract class UriBasedDirective extends Directive { | 12350 abstract class UriBasedDirective extends Directive { |
| 12475 | 12351 |
| 12476 /** | 12352 /** |
| 12477 * The URI referenced by this directive. | 12353 * The URI referenced by this directive. |
| 12478 */ | 12354 */ |
| 12479 StringLiteral _uri; | 12355 StringLiteral _uri; |
| 12480 | 12356 |
| 12481 /** | 12357 /** |
| 12482 * Initialize a newly create URI-based directive. | 12358 * Initialize a newly create URI-based directive. |
| 12483 * @param comment the documentation comment associated with this directive | 12359 * @param comment the documentation comment associated with this directive |
| 12484 * @param metadata the annotations associated with the directive | 12360 * @param metadata the annotations associated with the directive |
| 12485 * @param uri the URI referenced by this directive | 12361 * @param uri the URI referenced by this directive |
| 12486 */ | 12362 */ |
| 12487 UriBasedDirective.full(Comment comment, List<Annotation> metadata, StringLiter
al uri) : super.full(comment, metadata) { | 12363 UriBasedDirective.full(Comment comment, List<Annotation> metadata, StringLiter
al uri) : super.full(comment, metadata) { |
| 12488 this._uri = becomeParentOf(uri); | 12364 this._uri = becomeParentOf(uri); |
| 12489 } | 12365 } |
| 12490 | 12366 |
| 12491 /** | 12367 /** |
| 12492 * Initialize a newly create URI-based directive. | 12368 * Initialize a newly create URI-based directive. |
| 12493 * @param comment the documentation comment associated with this directive | 12369 * @param comment the documentation comment associated with this directive |
| 12494 * @param metadata the annotations associated with the directive | 12370 * @param metadata the annotations associated with the directive |
| 12495 * @param uri the URI referenced by this directive | 12371 * @param uri the URI referenced by this directive |
| 12496 */ | 12372 */ |
| 12497 UriBasedDirective({Comment comment, List<Annotation> metadata, StringLiteral u
ri}) : this.full(comment, metadata, uri); | 12373 UriBasedDirective({Comment comment, List<Annotation> metadata, StringLiteral u
ri}) : this.full(comment, metadata, uri); |
| 12498 | 12374 |
| 12499 /** | 12375 /** |
| 12500 * Return the URI referenced by this directive. | 12376 * Return the URI referenced by this directive. |
| 12501 * @return the URI referenced by this directive | 12377 * @return the URI referenced by this directive |
| 12502 */ | 12378 */ |
| 12503 StringLiteral get uri => _uri; | 12379 StringLiteral get uri => _uri; |
| 12504 | 12380 |
| 12505 /** | 12381 /** |
| 12506 * Return the element associated with the URI of this directive, or {@code nul
l} if the AST | 12382 * Return the element associated with the URI of this directive, or {@code nul
l} if the AST |
| 12507 * structure has not been resolved or if this URI could not be resolved. Examp
les of the latter | 12383 * structure has not been resolved or if this URI could not be resolved. Examp
les of the latter |
| 12508 * case include a directive that contains an invalid URL or a URL that does no
t exist. | 12384 * case include a directive that contains an invalid URL or a URL that does no
t exist. |
| 12509 * @return the element associated with this directive | 12385 * @return the element associated with this directive |
| 12510 */ | 12386 */ |
| 12511 Element get uriElement; | 12387 Element get uriElement; |
| 12512 | 12388 |
| 12513 /** | 12389 /** |
| 12514 * Set the URI referenced by this directive to the given URI. | 12390 * Set the URI referenced by this directive to the given URI. |
| 12515 * @param uri the URI referenced by this directive | 12391 * @param uri the URI referenced by this directive |
| 12516 */ | 12392 */ |
| 12517 void set uri(StringLiteral uri2) { | 12393 void set uri(StringLiteral uri2) { |
| 12518 this._uri = becomeParentOf(uri2); | 12394 this._uri = becomeParentOf(uri2); |
| 12519 } | 12395 } |
| 12520 void visitChildren(ASTVisitor<Object> visitor) { | 12396 void visitChildren(ASTVisitor<Object> visitor) { |
| 12521 super.visitChildren(visitor); | 12397 super.visitChildren(visitor); |
| 12522 safelyVisitChild(_uri, visitor); | 12398 safelyVisitChild(_uri, visitor); |
| 12523 } | 12399 } |
| 12524 } | 12400 } |
| 12525 | |
| 12526 /** | 12401 /** |
| 12527 * Instances of the class {@code VariableDeclaration} represent an identifier th
at has an initial | 12402 * Instances of the class {@code VariableDeclaration} represent an identifier th
at has an initial |
| 12528 * value associated with it. Instances of this class are always children of the
class{@link VariableDeclarationList}. | 12403 * value associated with it. Instances of this class are always children of the
class{@link VariableDeclarationList}. |
| 12529 * <pre> | 12404 * <pre> |
| 12530 * variableDeclaration ::={@link SimpleIdentifier identifier} ('=' {@link Expres
sion initialValue})? | 12405 * variableDeclaration ::={@link SimpleIdentifier identifier} ('=' {@link Expres
sion initialValue})? |
| 12531 * </pre> | 12406 * </pre> |
| 12532 * @coverage dart.engine.ast | 12407 * @coverage dart.engine.ast |
| 12533 */ | 12408 */ |
| 12534 class VariableDeclaration extends Declaration { | 12409 class VariableDeclaration extends Declaration { |
| 12535 | 12410 |
| 12536 /** | 12411 /** |
| 12537 * The name of the variable being declared. | 12412 * The name of the variable being declared. |
| 12538 */ | 12413 */ |
| 12539 SimpleIdentifier _name; | 12414 SimpleIdentifier _name; |
| 12540 | 12415 |
| 12541 /** | 12416 /** |
| 12542 * The equal sign separating the variable name from the initial value, or {@co
de null} if the | 12417 * The equal sign separating the variable name from the initial value, or {@co
de null} if the |
| 12543 * initial value was not specified. | 12418 * initial value was not specified. |
| 12544 */ | 12419 */ |
| 12545 Token _equals; | 12420 Token _equals; |
| 12546 | 12421 |
| 12547 /** | 12422 /** |
| 12548 * The expression used to compute the initial value for the variable, or {@cod
e null} if the | 12423 * The expression used to compute the initial value for the variable, or {@cod
e null} if the |
| 12549 * initial value was not specified. | 12424 * initial value was not specified. |
| 12550 */ | 12425 */ |
| 12551 Expression _initializer; | 12426 Expression _initializer; |
| 12552 | 12427 |
| 12553 /** | 12428 /** |
| 12554 * Initialize a newly created variable declaration. | 12429 * Initialize a newly created variable declaration. |
| 12555 * @param comment the documentation comment associated with this declaration | 12430 * @param comment the documentation comment associated with this declaration |
| 12556 * @param metadata the annotations associated with this member | 12431 * @param metadata the annotations associated with this member |
| 12557 * @param name the name of the variable being declared | 12432 * @param name the name of the variable being declared |
| 12558 * @param equals the equal sign separating the variable name from the initial
value | 12433 * @param equals the equal sign separating the variable name from the initial
value |
| 12559 * @param initializer the expression used to compute the initial value for the
variable | 12434 * @param initializer the expression used to compute the initial value for the
variable |
| 12560 */ | 12435 */ |
| 12561 VariableDeclaration.full(Comment comment, List<Annotation> metadata, SimpleIde
ntifier name, Token equals, Expression initializer) : super.full(comment, metada
ta) { | 12436 VariableDeclaration.full(Comment comment, List<Annotation> metadata, SimpleIde
ntifier name, Token equals, Expression initializer) : super.full(comment, metada
ta) { |
| 12562 this._name = becomeParentOf(name); | 12437 this._name = becomeParentOf(name); |
| 12563 this._equals = equals; | 12438 this._equals = equals; |
| 12564 this._initializer = becomeParentOf(initializer); | 12439 this._initializer = becomeParentOf(initializer); |
| 12565 } | 12440 } |
| 12566 | 12441 |
| 12567 /** | 12442 /** |
| 12568 * Initialize a newly created variable declaration. | 12443 * Initialize a newly created variable declaration. |
| 12569 * @param comment the documentation comment associated with this declaration | 12444 * @param comment the documentation comment associated with this declaration |
| 12570 * @param metadata the annotations associated with this member | 12445 * @param metadata the annotations associated with this member |
| 12571 * @param name the name of the variable being declared | 12446 * @param name the name of the variable being declared |
| 12572 * @param equals the equal sign separating the variable name from the initial
value | 12447 * @param equals the equal sign separating the variable name from the initial
value |
| 12573 * @param initializer the expression used to compute the initial value for the
variable | 12448 * @param initializer the expression used to compute the initial value for the
variable |
| 12574 */ | 12449 */ |
| 12575 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif
ier name, Token equals, Expression initializer}) : this.full(comment, metadata,
name, equals, initializer); | 12450 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif
ier name, Token equals, Expression initializer}) : this.full(comment, metadata,
name, equals, initializer); |
| 12576 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); | 12451 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); |
| 12577 VariableElement get element => _name != null ? (_name.element as VariableEleme
nt) : null; | 12452 VariableElement get element => _name != null ? (_name.element as VariableEleme
nt) : null; |
| 12578 Token get endToken { | 12453 Token get endToken { |
| 12579 if (_initializer != null) { | 12454 if (_initializer != null) { |
| 12580 return _initializer.endToken; | 12455 return _initializer.endToken; |
| 12581 } | 12456 } |
| 12582 return _name.endToken; | 12457 return _name.endToken; |
| 12583 } | 12458 } |
| 12584 | 12459 |
| 12585 /** | 12460 /** |
| 12586 * Return the equal sign separating the variable name from the initial value,
or {@code null} if | 12461 * Return the equal sign separating the variable name from the initial value,
or {@code null} if |
| 12587 * the initial value was not specified. | 12462 * the initial value was not specified. |
| 12588 * @return the equal sign separating the variable name from the initial value | 12463 * @return the equal sign separating the variable name from the initial value |
| 12589 */ | 12464 */ |
| 12590 Token get equals => _equals; | 12465 Token get equals => _equals; |
| 12591 | 12466 |
| 12592 /** | 12467 /** |
| 12593 * Return the expression used to compute the initial value for the variable, o
r {@code null} if | 12468 * Return the expression used to compute the initial value for the variable, o
r {@code null} if |
| 12594 * the initial value was not specified. | 12469 * the initial value was not specified. |
| 12595 * @return the expression used to compute the initial value for the variable | 12470 * @return the expression used to compute the initial value for the variable |
| 12596 */ | 12471 */ |
| 12597 Expression get initializer => _initializer; | 12472 Expression get initializer => _initializer; |
| 12598 | 12473 |
| 12599 /** | 12474 /** |
| 12600 * Return the name of the variable being declared. | 12475 * Return the name of the variable being declared. |
| 12601 * @return the name of the variable being declared | 12476 * @return the name of the variable being declared |
| 12602 */ | 12477 */ |
| 12603 SimpleIdentifier get name => _name; | 12478 SimpleIdentifier get name => _name; |
| 12604 | 12479 |
| 12605 /** | 12480 /** |
| 12606 * Return {@code true} if this variable was declared with the 'const' modifier
. | 12481 * Return {@code true} if this variable was declared with the 'const' modifier
. |
| 12607 * @return {@code true} if this variable was declared with the 'const' modifie
r | 12482 * @return {@code true} if this variable was declared with the 'const' modifie
r |
| 12608 */ | 12483 */ |
| 12609 bool isConst() { | 12484 bool isConst() { |
| 12610 ASTNode parent2 = parent; | 12485 ASTNode parent2 = parent; |
| 12611 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isConst(); | 12486 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isConst(); |
| 12612 } | 12487 } |
| 12613 | 12488 |
| 12614 /** | 12489 /** |
| 12615 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are | 12490 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are |
| 12616 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly | 12491 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly |
| 12617 * final. | 12492 * final. |
| 12618 * @return {@code true} if this variable was declared with the 'final' modifie
r | 12493 * @return {@code true} if this variable was declared with the 'final' modifie
r |
| 12619 */ | 12494 */ |
| 12620 bool isFinal() { | 12495 bool isFinal() { |
| 12621 ASTNode parent2 = parent; | 12496 ASTNode parent2 = parent; |
| 12622 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isFinal(); | 12497 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isFinal(); |
| 12623 } | 12498 } |
| 12624 | 12499 |
| 12625 /** | 12500 /** |
| 12626 * Set the equal sign separating the variable name from the initial value to t
he given token. | 12501 * Set the equal sign separating the variable name from the initial value to t
he given token. |
| 12627 * @param equals the equal sign separating the variable name from the initial
value | 12502 * @param equals the equal sign separating the variable name from the initial
value |
| 12628 */ | 12503 */ |
| 12629 void set equals(Token equals2) { | 12504 void set equals(Token equals2) { |
| 12630 this._equals = equals2; | 12505 this._equals = equals2; |
| 12631 } | 12506 } |
| 12632 | 12507 |
| 12633 /** | 12508 /** |
| 12634 * Set the expression used to compute the initial value for the variable to th
e given expression. | 12509 * Set the expression used to compute the initial value for the variable to th
e given expression. |
| 12635 * @param initializer the expression used to compute the initial value for the
variable | 12510 * @param initializer the expression used to compute the initial value for the
variable |
| 12636 */ | 12511 */ |
| 12637 void set initializer(Expression initializer2) { | 12512 void set initializer(Expression initializer2) { |
| 12638 this._initializer = becomeParentOf(initializer2); | 12513 this._initializer = becomeParentOf(initializer2); |
| 12639 } | 12514 } |
| 12640 | 12515 |
| 12641 /** | 12516 /** |
| 12642 * Set the name of the variable being declared to the given identifier. | 12517 * Set the name of the variable being declared to the given identifier. |
| 12643 * @param name the name of the variable being declared | 12518 * @param name the name of the variable being declared |
| 12644 */ | 12519 */ |
| 12645 void set name(SimpleIdentifier name2) { | 12520 void set name(SimpleIdentifier name2) { |
| 12646 this._name = becomeParentOf(name2); | 12521 this._name = becomeParentOf(name2); |
| 12647 } | 12522 } |
| 12648 void visitChildren(ASTVisitor<Object> visitor) { | 12523 void visitChildren(ASTVisitor<Object> visitor) { |
| 12649 super.visitChildren(visitor); | 12524 super.visitChildren(visitor); |
| 12650 safelyVisitChild(_name, visitor); | 12525 safelyVisitChild(_name, visitor); |
| 12651 safelyVisitChild(_initializer, visitor); | 12526 safelyVisitChild(_initializer, visitor); |
| 12652 } | 12527 } |
| 12653 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; | 12528 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; |
| 12654 } | 12529 } |
| 12655 | |
| 12656 /** | 12530 /** |
| 12657 * Instances of the class {@code VariableDeclarationList} represent the declarat
ion of one or more | 12531 * Instances of the class {@code VariableDeclarationList} represent the declarat
ion of one or more |
| 12658 * variables of the same type. | 12532 * variables of the same type. |
| 12659 * <pre> | 12533 * <pre> |
| 12660 * variableDeclarationList ::= | 12534 * variableDeclarationList ::= |
| 12661 * finalConstVarOrType {@link VariableDeclaration variableDeclaration} (',' {@li
nk VariableDeclaration variableDeclaration}) | 12535 * finalConstVarOrType {@link VariableDeclaration variableDeclaration} (',' {@li
nk VariableDeclaration variableDeclaration}) |
| 12662 * finalConstVarOrType ::= | 12536 * finalConstVarOrType ::= |
| 12663 * | 'final' {@link TypeName type}? | 12537 * | 'final' {@link TypeName type}? |
| 12664 * | 'const' {@link TypeName type}? | 12538 * | 'const' {@link TypeName type}? |
| 12665 * | 'var' | 12539 * | 'var' |
| 12666 * | {@link TypeName type}</pre> | 12540 * | {@link TypeName type}</pre> |
| 12667 * @coverage dart.engine.ast | 12541 * @coverage dart.engine.ast |
| 12668 */ | 12542 */ |
| 12669 class VariableDeclarationList extends AnnotatedNode { | 12543 class VariableDeclarationList extends AnnotatedNode { |
| 12670 | 12544 |
| 12671 /** | 12545 /** |
| 12672 * The token representing the 'final', 'const' or 'var' keyword, or {@code nul
l} if no keyword was | 12546 * The token representing the 'final', 'const' or 'var' keyword, or {@code nul
l} if no keyword was |
| 12673 * included. | 12547 * included. |
| 12674 */ | 12548 */ |
| 12675 Token _keyword; | 12549 Token _keyword; |
| 12676 | 12550 |
| 12677 /** | 12551 /** |
| 12678 * The type of the variables being declared, or {@code null} if no type was pr
ovided. | 12552 * The type of the variables being declared, or {@code null} if no type was pr
ovided. |
| 12679 */ | 12553 */ |
| 12680 TypeName _type; | 12554 TypeName _type; |
| 12681 | 12555 |
| 12682 /** | 12556 /** |
| 12683 * A list containing the individual variables being declared. | 12557 * A list containing the individual variables being declared. |
| 12684 */ | 12558 */ |
| 12685 NodeList<VariableDeclaration> _variables; | 12559 NodeList<VariableDeclaration> _variables; |
| 12686 | 12560 |
| 12687 /** | 12561 /** |
| 12688 * Initialize a newly created variable declaration list. | 12562 * Initialize a newly created variable declaration list. |
| 12689 * @param comment the documentation comment associated with this declaration l
ist | 12563 * @param comment the documentation comment associated with this declaration l
ist |
| 12690 * @param metadata the annotations associated with this declaration list | 12564 * @param metadata the annotations associated with this declaration list |
| 12691 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 12565 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
| 12692 * @param type the type of the variables being declared | 12566 * @param type the type of the variables being declared |
| 12693 * @param variables a list containing the individual variables being declared | 12567 * @param variables a list containing the individual variables being declared |
| 12694 */ | 12568 */ |
| 12695 VariableDeclarationList.full(Comment comment, List<Annotation> metadata, Token
keyword, TypeName type, List<VariableDeclaration> variables) : super.full(comme
nt, metadata) { | 12569 VariableDeclarationList.full(Comment comment, List<Annotation> metadata, Token
keyword, TypeName type, List<VariableDeclaration> variables) : super.full(comme
nt, metadata) { |
| 12696 this._variables = new NodeList<VariableDeclaration>(this); | 12570 this._variables = new NodeList<VariableDeclaration>(this); |
| 12697 this._keyword = keyword; | 12571 this._keyword = keyword; |
| 12698 this._type = becomeParentOf(type); | 12572 this._type = becomeParentOf(type); |
| 12699 this._variables.addAll(variables); | 12573 this._variables.addAll(variables); |
| 12700 } | 12574 } |
| 12701 | 12575 |
| 12702 /** | 12576 /** |
| 12703 * Initialize a newly created variable declaration list. | 12577 * Initialize a newly created variable declaration list. |
| 12704 * @param comment the documentation comment associated with this declaration l
ist | 12578 * @param comment the documentation comment associated with this declaration l
ist |
| 12705 * @param metadata the annotations associated with this declaration list | 12579 * @param metadata the annotations associated with this declaration list |
| 12706 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 12580 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
| 12707 * @param type the type of the variables being declared | 12581 * @param type the type of the variables being declared |
| 12708 * @param variables a list containing the individual variables being declared | 12582 * @param variables a list containing the individual variables being declared |
| 12709 */ | 12583 */ |
| 12710 VariableDeclarationList({Comment comment, List<Annotation> metadata, Token key
word, TypeName type, List<VariableDeclaration> variables}) : this.full(comment,
metadata, keyword, type, variables); | 12584 VariableDeclarationList({Comment comment, List<Annotation> metadata, Token key
word, TypeName type, List<VariableDeclaration> variables}) : this.full(comment,
metadata, keyword, type, variables); |
| 12711 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this); | 12585 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this); |
| 12712 Token get endToken => _variables.endToken; | 12586 Token get endToken => _variables.endToken; |
| 12713 | 12587 |
| 12714 /** | 12588 /** |
| 12715 * Return the token representing the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 12589 * Return the token representing the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
| 12716 * keyword was included. | 12590 * keyword was included. |
| 12717 * @return the token representing the 'final', 'const' or 'var' keyword | 12591 * @return the token representing the 'final', 'const' or 'var' keyword |
| 12718 */ | 12592 */ |
| 12719 Token get keyword => _keyword; | 12593 Token get keyword => _keyword; |
| 12720 | 12594 |
| 12721 /** | 12595 /** |
| 12722 * Return the type of the variables being declared, or {@code null} if no type
was provided. | 12596 * Return the type of the variables being declared, or {@code null} if no type
was provided. |
| 12723 * @return the type of the variables being declared | 12597 * @return the type of the variables being declared |
| 12724 */ | 12598 */ |
| 12725 TypeName get type => _type; | 12599 TypeName get type => _type; |
| 12726 | 12600 |
| 12727 /** | 12601 /** |
| 12728 * Return a list containing the individual variables being declared. | 12602 * Return a list containing the individual variables being declared. |
| 12729 * @return a list containing the individual variables being declared | 12603 * @return a list containing the individual variables being declared |
| 12730 */ | 12604 */ |
| 12731 NodeList<VariableDeclaration> get variables => _variables; | 12605 NodeList<VariableDeclaration> get variables => _variables; |
| 12732 | 12606 |
| 12733 /** | 12607 /** |
| 12734 * Return {@code true} if the variables in this list were declared with the 'c
onst' modifier. | 12608 * Return {@code true} if the variables in this list were declared with the 'c
onst' modifier. |
| 12735 * @return {@code true} if the variables in this list were declared with the '
const' modifier | 12609 * @return {@code true} if the variables in this list were declared with the '
const' modifier |
| 12736 */ | 12610 */ |
| 12737 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); | 12611 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); |
| 12738 | 12612 |
| 12739 /** | 12613 /** |
| 12740 * Return {@code true} if the variables in this list were declared with the 'f
inal' modifier. | 12614 * Return {@code true} if the variables in this list were declared with the 'f
inal' modifier. |
| 12741 * Variables that are declared with the 'const' modifier will return {@code fa
lse} even though | 12615 * Variables that are declared with the 'const' modifier will return {@code fa
lse} even though |
| 12742 * they are implicitly final. | 12616 * they are implicitly final. |
| 12743 * @return {@code true} if the variables in this list were declared with the '
final' modifier | 12617 * @return {@code true} if the variables in this list were declared with the '
final' modifier |
| 12744 */ | 12618 */ |
| 12745 bool isFinal() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.FINAL); | 12619 bool isFinal() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.FINAL); |
| 12746 | 12620 |
| 12747 /** | 12621 /** |
| 12748 * Set the token representing the 'final', 'const' or 'var' keyword to the giv
en token. | 12622 * Set the token representing the 'final', 'const' or 'var' keyword to the giv
en token. |
| 12749 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 12623 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
| 12750 */ | 12624 */ |
| 12751 void set keyword(Token keyword2) { | 12625 void set keyword(Token keyword2) { |
| 12752 this._keyword = keyword2; | 12626 this._keyword = keyword2; |
| 12753 } | 12627 } |
| 12754 | 12628 |
| 12755 /** | 12629 /** |
| 12756 * Set the type of the variables being declared to the given type name. | 12630 * Set the type of the variables being declared to the given type name. |
| 12757 * @param typeName the type of the variables being declared | 12631 * @param typeName the type of the variables being declared |
| 12758 */ | 12632 */ |
| 12759 void set type(TypeName typeName) { | 12633 void set type(TypeName typeName) { |
| 12760 _type = becomeParentOf(typeName); | 12634 _type = becomeParentOf(typeName); |
| 12761 } | 12635 } |
| 12762 void visitChildren(ASTVisitor<Object> visitor) { | 12636 void visitChildren(ASTVisitor<Object> visitor) { |
| 12763 safelyVisitChild(_type, visitor); | 12637 safelyVisitChild(_type, visitor); |
| 12764 _variables.accept(visitor); | 12638 _variables.accept(visitor); |
| 12765 } | 12639 } |
| 12766 Token get firstTokenAfterCommentAndMetadata { | 12640 Token get firstTokenAfterCommentAndMetadata { |
| 12767 if (_keyword != null) { | 12641 if (_keyword != null) { |
| 12768 return _keyword; | 12642 return _keyword; |
| 12769 } else if (_type != null) { | 12643 } else if (_type != null) { |
| 12770 return _type.beginToken; | 12644 return _type.beginToken; |
| 12771 } | 12645 } |
| 12772 return _variables.beginToken; | 12646 return _variables.beginToken; |
| 12773 } | 12647 } |
| 12774 } | 12648 } |
| 12775 | |
| 12776 /** | 12649 /** |
| 12777 * Instances of the class {@code VariableDeclarationStatement} represent a list
of variables that | 12650 * Instances of the class {@code VariableDeclarationStatement} represent a list
of variables that |
| 12778 * are being declared in a context where a statement is required. | 12651 * are being declared in a context where a statement is required. |
| 12779 * <pre> | 12652 * <pre> |
| 12780 * variableDeclarationStatement ::={@link VariableDeclarationList variableList}
';' | 12653 * variableDeclarationStatement ::={@link VariableDeclarationList variableList}
';' |
| 12781 * </pre> | 12654 * </pre> |
| 12782 * @coverage dart.engine.ast | 12655 * @coverage dart.engine.ast |
| 12783 */ | 12656 */ |
| 12784 class VariableDeclarationStatement extends Statement { | 12657 class VariableDeclarationStatement extends Statement { |
| 12785 | 12658 |
| 12786 /** | 12659 /** |
| 12787 * The variables being declared. | 12660 * The variables being declared. |
| 12788 */ | 12661 */ |
| 12789 VariableDeclarationList _variableList; | 12662 VariableDeclarationList _variableList; |
| 12790 | 12663 |
| 12791 /** | 12664 /** |
| 12792 * The semicolon terminating the statement. | 12665 * The semicolon terminating the statement. |
| 12793 */ | 12666 */ |
| 12794 Token _semicolon; | 12667 Token _semicolon; |
| 12795 | 12668 |
| 12796 /** | 12669 /** |
| 12797 * Initialize a newly created variable declaration statement. | 12670 * Initialize a newly created variable declaration statement. |
| 12798 * @param variableList the fields being declared | 12671 * @param variableList the fields being declared |
| 12799 * @param semicolon the semicolon terminating the statement | 12672 * @param semicolon the semicolon terminating the statement |
| 12800 */ | 12673 */ |
| 12801 VariableDeclarationStatement.full(VariableDeclarationList variableList, Token
semicolon) { | 12674 VariableDeclarationStatement.full(VariableDeclarationList variableList, Token
semicolon) { |
| 12802 this._variableList = becomeParentOf(variableList); | 12675 this._variableList = becomeParentOf(variableList); |
| 12803 this._semicolon = semicolon; | 12676 this._semicolon = semicolon; |
| 12804 } | 12677 } |
| 12805 | 12678 |
| 12806 /** | 12679 /** |
| 12807 * Initialize a newly created variable declaration statement. | 12680 * Initialize a newly created variable declaration statement. |
| 12808 * @param variableList the fields being declared | 12681 * @param variableList the fields being declared |
| 12809 * @param semicolon the semicolon terminating the statement | 12682 * @param semicolon the semicolon terminating the statement |
| 12810 */ | 12683 */ |
| 12811 VariableDeclarationStatement({VariableDeclarationList variableList, Token semi
colon}) : this.full(variableList, semicolon); | 12684 VariableDeclarationStatement({VariableDeclarationList variableList, Token semi
colon}) : this.full(variableList, semicolon); |
| 12812 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this); | 12685 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this); |
| 12813 Token get beginToken => _variableList.beginToken; | 12686 Token get beginToken => _variableList.beginToken; |
| 12814 Token get endToken => _semicolon; | 12687 Token get endToken => _semicolon; |
| 12815 | 12688 |
| 12816 /** | 12689 /** |
| 12817 * Return the semicolon terminating the statement. | 12690 * Return the semicolon terminating the statement. |
| 12818 * @return the semicolon terminating the statement | 12691 * @return the semicolon terminating the statement |
| 12819 */ | 12692 */ |
| 12820 Token get semicolon => _semicolon; | 12693 Token get semicolon => _semicolon; |
| 12821 | 12694 |
| 12822 /** | 12695 /** |
| 12823 * Return the variables being declared. | 12696 * Return the variables being declared. |
| 12824 * @return the variables being declared | 12697 * @return the variables being declared |
| 12825 */ | 12698 */ |
| 12826 VariableDeclarationList get variables => _variableList; | 12699 VariableDeclarationList get variables => _variableList; |
| 12827 | 12700 |
| 12828 /** | 12701 /** |
| 12829 * Set the semicolon terminating the statement to the given token. | 12702 * Set the semicolon terminating the statement to the given token. |
| 12830 * @param semicolon the semicolon terminating the statement | 12703 * @param semicolon the semicolon terminating the statement |
| 12831 */ | 12704 */ |
| 12832 void set semicolon(Token semicolon2) { | 12705 void set semicolon(Token semicolon2) { |
| 12833 this._semicolon = semicolon2; | 12706 this._semicolon = semicolon2; |
| 12834 } | 12707 } |
| 12835 | 12708 |
| 12836 /** | 12709 /** |
| 12837 * Set the variables being declared to the given list of variables. | 12710 * Set the variables being declared to the given list of variables. |
| 12838 * @param variableList the variables being declared | 12711 * @param variableList the variables being declared |
| 12839 */ | 12712 */ |
| 12840 void set variables(VariableDeclarationList variableList2) { | 12713 void set variables(VariableDeclarationList variableList2) { |
| 12841 this._variableList = becomeParentOf(variableList2); | 12714 this._variableList = becomeParentOf(variableList2); |
| 12842 } | 12715 } |
| 12843 void visitChildren(ASTVisitor<Object> visitor) { | 12716 void visitChildren(ASTVisitor<Object> visitor) { |
| 12844 safelyVisitChild(_variableList, visitor); | 12717 safelyVisitChild(_variableList, visitor); |
| 12845 } | 12718 } |
| 12846 } | 12719 } |
| 12847 | |
| 12848 /** | 12720 /** |
| 12849 * Instances of the class {@code WhileStatement} represent a while statement. | 12721 * Instances of the class {@code WhileStatement} represent a while statement. |
| 12850 * <pre> | 12722 * <pre> |
| 12851 * whileStatement ::= | 12723 * whileStatement ::= |
| 12852 * 'while' '(' {@link Expression condition} ')' {@link Statement body}</pre> | 12724 * 'while' '(' {@link Expression condition} ')' {@link Statement body}</pre> |
| 12853 * @coverage dart.engine.ast | 12725 * @coverage dart.engine.ast |
| 12854 */ | 12726 */ |
| 12855 class WhileStatement extends Statement { | 12727 class WhileStatement extends Statement { |
| 12856 | 12728 |
| 12857 /** | 12729 /** |
| 12858 * The token representing the 'while' keyword. | 12730 * The token representing the 'while' keyword. |
| 12859 */ | 12731 */ |
| 12860 Token _keyword; | 12732 Token _keyword; |
| 12861 | 12733 |
| 12862 /** | 12734 /** |
| 12863 * The left parenthesis. | 12735 * The left parenthesis. |
| 12864 */ | 12736 */ |
| 12865 Token _leftParenthesis; | 12737 Token _leftParenthesis; |
| 12866 | 12738 |
| 12867 /** | 12739 /** |
| 12868 * The expression used to determine whether to execute the body of the loop. | 12740 * The expression used to determine whether to execute the body of the loop. |
| 12869 */ | 12741 */ |
| 12870 Expression _condition; | 12742 Expression _condition; |
| 12871 | 12743 |
| 12872 /** | 12744 /** |
| 12873 * The right parenthesis. | 12745 * The right parenthesis. |
| 12874 */ | 12746 */ |
| 12875 Token _rightParenthesis; | 12747 Token _rightParenthesis; |
| 12876 | 12748 |
| 12877 /** | 12749 /** |
| 12878 * The body of the loop. | 12750 * The body of the loop. |
| 12879 */ | 12751 */ |
| 12880 Statement _body; | 12752 Statement _body; |
| 12881 | 12753 |
| 12882 /** | 12754 /** |
| 12883 * Initialize a newly created while statement. | 12755 * Initialize a newly created while statement. |
| 12884 * @param keyword the token representing the 'while' keyword | 12756 * @param keyword the token representing the 'while' keyword |
| 12885 * @param leftParenthesis the left parenthesis | 12757 * @param leftParenthesis the left parenthesis |
| 12886 * @param condition the expression used to determine whether to execute the bo
dy of the loop | 12758 * @param condition the expression used to determine whether to execute the bo
dy of the loop |
| 12887 * @param rightParenthesis the right parenthesis | 12759 * @param rightParenthesis the right parenthesis |
| 12888 * @param body the body of the loop | 12760 * @param body the body of the loop |
| 12889 */ | 12761 */ |
| 12890 WhileStatement.full(Token keyword, Token leftParenthesis, Expression condition
, Token rightParenthesis, Statement body) { | 12762 WhileStatement.full(Token keyword, Token leftParenthesis, Expression condition
, Token rightParenthesis, Statement body) { |
| 12891 this._keyword = keyword; | 12763 this._keyword = keyword; |
| 12892 this._leftParenthesis = leftParenthesis; | 12764 this._leftParenthesis = leftParenthesis; |
| 12893 this._condition = becomeParentOf(condition); | 12765 this._condition = becomeParentOf(condition); |
| 12894 this._rightParenthesis = rightParenthesis; | 12766 this._rightParenthesis = rightParenthesis; |
| 12895 this._body = becomeParentOf(body); | 12767 this._body = becomeParentOf(body); |
| 12896 } | 12768 } |
| 12897 | 12769 |
| 12898 /** | 12770 /** |
| 12899 * Initialize a newly created while statement. | 12771 * Initialize a newly created while statement. |
| 12900 * @param keyword the token representing the 'while' keyword | 12772 * @param keyword the token representing the 'while' keyword |
| 12901 * @param leftParenthesis the left parenthesis | 12773 * @param leftParenthesis the left parenthesis |
| 12902 * @param condition the expression used to determine whether to execute the bo
dy of the loop | 12774 * @param condition the expression used to determine whether to execute the bo
dy of the loop |
| 12903 * @param rightParenthesis the right parenthesis | 12775 * @param rightParenthesis the right parenthesis |
| 12904 * @param body the body of the loop | 12776 * @param body the body of the loop |
| 12905 */ | 12777 */ |
| 12906 WhileStatement({Token keyword, Token leftParenthesis, Expression condition, To
ken rightParenthesis, Statement body}) : this.full(keyword, leftParenthesis, con
dition, rightParenthesis, body); | 12778 WhileStatement({Token keyword, Token leftParenthesis, Expression condition, To
ken rightParenthesis, Statement body}) : this.full(keyword, leftParenthesis, con
dition, rightParenthesis, body); |
| 12907 accept(ASTVisitor visitor) => visitor.visitWhileStatement(this); | 12779 accept(ASTVisitor visitor) => visitor.visitWhileStatement(this); |
| 12908 Token get beginToken => _keyword; | 12780 Token get beginToken => _keyword; |
| 12909 | 12781 |
| 12910 /** | 12782 /** |
| 12911 * Return the body of the loop. | 12783 * Return the body of the loop. |
| 12912 * @return the body of the loop | 12784 * @return the body of the loop |
| 12913 */ | 12785 */ |
| 12914 Statement get body => _body; | 12786 Statement get body => _body; |
| 12915 | 12787 |
| 12916 /** | 12788 /** |
| 12917 * Return the expression used to determine whether to execute the body of the
loop. | 12789 * Return the expression used to determine whether to execute the body of the
loop. |
| 12918 * @return the expression used to determine whether to execute the body of the
loop | 12790 * @return the expression used to determine whether to execute the body of the
loop |
| 12919 */ | 12791 */ |
| 12920 Expression get condition => _condition; | 12792 Expression get condition => _condition; |
| 12921 Token get endToken => _body.endToken; | 12793 Token get endToken => _body.endToken; |
| 12922 | 12794 |
| 12923 /** | 12795 /** |
| 12924 * Return the token representing the 'while' keyword. | 12796 * Return the token representing the 'while' keyword. |
| 12925 * @return the token representing the 'while' keyword | 12797 * @return the token representing the 'while' keyword |
| 12926 */ | 12798 */ |
| 12927 Token get keyword => _keyword; | 12799 Token get keyword => _keyword; |
| 12928 | 12800 |
| 12929 /** | 12801 /** |
| 12930 * Return the left parenthesis. | 12802 * Return the left parenthesis. |
| 12931 * @return the left parenthesis | 12803 * @return the left parenthesis |
| 12932 */ | 12804 */ |
| 12933 Token get leftParenthesis => _leftParenthesis; | 12805 Token get leftParenthesis => _leftParenthesis; |
| 12934 | 12806 |
| 12935 /** | 12807 /** |
| 12936 * Return the right parenthesis. | 12808 * Return the right parenthesis. |
| 12937 * @return the right parenthesis | 12809 * @return the right parenthesis |
| 12938 */ | 12810 */ |
| 12939 Token get rightParenthesis => _rightParenthesis; | 12811 Token get rightParenthesis => _rightParenthesis; |
| 12940 | 12812 |
| 12941 /** | 12813 /** |
| 12942 * Set the body of the loop to the given statement. | 12814 * Set the body of the loop to the given statement. |
| 12943 * @param statement the body of the loop | 12815 * @param statement the body of the loop |
| 12944 */ | 12816 */ |
| 12945 void set body(Statement statement) { | 12817 void set body(Statement statement) { |
| 12946 _body = becomeParentOf(statement); | 12818 _body = becomeParentOf(statement); |
| 12947 } | 12819 } |
| 12948 | 12820 |
| 12949 /** | 12821 /** |
| 12950 * Set the expression used to determine whether to execute the body of the loo
p to the given | 12822 * Set the expression used to determine whether to execute the body of the loo
p to the given |
| 12951 * expression. | 12823 * expression. |
| 12952 * @param expression the expression used to determine whether to execute the b
ody of the loop | 12824 * @param expression the expression used to determine whether to execute the b
ody of the loop |
| 12953 */ | 12825 */ |
| 12954 void set condition(Expression expression) { | 12826 void set condition(Expression expression) { |
| 12955 _condition = becomeParentOf(expression); | 12827 _condition = becomeParentOf(expression); |
| 12956 } | 12828 } |
| 12957 | 12829 |
| 12958 /** | 12830 /** |
| 12959 * Set the token representing the 'while' keyword to the given token. | 12831 * Set the token representing the 'while' keyword to the given token. |
| 12960 * @param keyword the token representing the 'while' keyword | 12832 * @param keyword the token representing the 'while' keyword |
| 12961 */ | 12833 */ |
| 12962 void set keyword(Token keyword2) { | 12834 void set keyword(Token keyword2) { |
| 12963 this._keyword = keyword2; | 12835 this._keyword = keyword2; |
| 12964 } | 12836 } |
| 12965 | 12837 |
| 12966 /** | 12838 /** |
| 12967 * Set the left parenthesis to the given token. | 12839 * Set the left parenthesis to the given token. |
| 12968 * @param leftParenthesis the left parenthesis | 12840 * @param leftParenthesis the left parenthesis |
| 12969 */ | 12841 */ |
| 12970 void set leftParenthesis(Token leftParenthesis2) { | 12842 void set leftParenthesis(Token leftParenthesis2) { |
| 12971 this._leftParenthesis = leftParenthesis2; | 12843 this._leftParenthesis = leftParenthesis2; |
| 12972 } | 12844 } |
| 12973 | 12845 |
| 12974 /** | 12846 /** |
| 12975 * Set the right parenthesis to the given token. | 12847 * Set the right parenthesis to the given token. |
| 12976 * @param rightParenthesis the right parenthesis | 12848 * @param rightParenthesis the right parenthesis |
| 12977 */ | 12849 */ |
| 12978 void set rightParenthesis(Token rightParenthesis2) { | 12850 void set rightParenthesis(Token rightParenthesis2) { |
| 12979 this._rightParenthesis = rightParenthesis2; | 12851 this._rightParenthesis = rightParenthesis2; |
| 12980 } | 12852 } |
| 12981 void visitChildren(ASTVisitor<Object> visitor) { | 12853 void visitChildren(ASTVisitor<Object> visitor) { |
| 12982 safelyVisitChild(_condition, visitor); | 12854 safelyVisitChild(_condition, visitor); |
| 12983 safelyVisitChild(_body, visitor); | 12855 safelyVisitChild(_body, visitor); |
| 12984 } | 12856 } |
| 12985 } | 12857 } |
| 12986 | |
| 12987 /** | 12858 /** |
| 12988 * Instances of the class {@code WithClause} represent the with clause in a clas
s declaration. | 12859 * Instances of the class {@code WithClause} represent the with clause in a clas
s declaration. |
| 12989 * <pre> | 12860 * <pre> |
| 12990 * withClause ::= | 12861 * withClause ::= |
| 12991 * 'with' {@link TypeName mixin} (',' {@link TypeName mixin}) | 12862 * 'with' {@link TypeName mixin} (',' {@link TypeName mixin}) |
| 12992 * </pre> | 12863 * </pre> |
| 12993 * @coverage dart.engine.ast | 12864 * @coverage dart.engine.ast |
| 12994 */ | 12865 */ |
| 12995 class WithClause extends ASTNode { | 12866 class WithClause extends ASTNode { |
| 12996 | 12867 |
| 12997 /** | 12868 /** |
| 12998 * The token representing the 'with' keyword. | 12869 * The token representing the 'with' keyword. |
| 12999 */ | 12870 */ |
| 13000 Token _withKeyword; | 12871 Token _withKeyword; |
| 13001 | 12872 |
| 13002 /** | 12873 /** |
| 13003 * The names of the mixins that were specified. | 12874 * The names of the mixins that were specified. |
| 13004 */ | 12875 */ |
| 13005 NodeList<TypeName> _mixinTypes; | 12876 NodeList<TypeName> _mixinTypes; |
| 13006 | 12877 |
| 13007 /** | 12878 /** |
| 13008 * Initialize a newly created with clause. | 12879 * Initialize a newly created with clause. |
| 13009 * @param withKeyword the token representing the 'with' keyword | 12880 * @param withKeyword the token representing the 'with' keyword |
| 13010 * @param mixinTypes the names of the mixins that were specified | 12881 * @param mixinTypes the names of the mixins that were specified |
| 13011 */ | 12882 */ |
| 13012 WithClause.full(Token withKeyword, List<TypeName> mixinTypes) { | 12883 WithClause.full(Token withKeyword, List<TypeName> mixinTypes) { |
| 13013 this._mixinTypes = new NodeList<TypeName>(this); | 12884 this._mixinTypes = new NodeList<TypeName>(this); |
| 13014 this._withKeyword = withKeyword; | 12885 this._withKeyword = withKeyword; |
| 13015 this._mixinTypes.addAll(mixinTypes); | 12886 this._mixinTypes.addAll(mixinTypes); |
| 13016 } | 12887 } |
| 13017 | 12888 |
| 13018 /** | 12889 /** |
| 13019 * Initialize a newly created with clause. | 12890 * Initialize a newly created with clause. |
| 13020 * @param withKeyword the token representing the 'with' keyword | 12891 * @param withKeyword the token representing the 'with' keyword |
| 13021 * @param mixinTypes the names of the mixins that were specified | 12892 * @param mixinTypes the names of the mixins that were specified |
| 13022 */ | 12893 */ |
| 13023 WithClause({Token withKeyword, List<TypeName> mixinTypes}) : this.full(withKey
word, mixinTypes); | 12894 WithClause({Token withKeyword, List<TypeName> mixinTypes}) : this.full(withKey
word, mixinTypes); |
| 13024 accept(ASTVisitor visitor) => visitor.visitWithClause(this); | 12895 accept(ASTVisitor visitor) => visitor.visitWithClause(this); |
| 13025 Token get beginToken => _withKeyword; | 12896 Token get beginToken => _withKeyword; |
| 13026 Token get endToken => _mixinTypes.endToken; | 12897 Token get endToken => _mixinTypes.endToken; |
| 13027 | 12898 |
| 13028 /** | 12899 /** |
| 13029 * Return the names of the mixins that were specified. | 12900 * Return the names of the mixins that were specified. |
| 13030 * @return the names of the mixins that were specified | 12901 * @return the names of the mixins that were specified |
| 13031 */ | 12902 */ |
| 13032 NodeList<TypeName> get mixinTypes => _mixinTypes; | 12903 NodeList<TypeName> get mixinTypes => _mixinTypes; |
| 13033 | 12904 |
| 13034 /** | 12905 /** |
| 13035 * Return the token representing the 'with' keyword. | 12906 * Return the token representing the 'with' keyword. |
| 13036 * @return the token representing the 'with' keyword | 12907 * @return the token representing the 'with' keyword |
| 13037 */ | 12908 */ |
| 13038 Token get withKeyword => _withKeyword; | 12909 Token get withKeyword => _withKeyword; |
| 13039 | 12910 |
| 13040 /** | 12911 /** |
| 13041 * Set the token representing the 'with' keyword to the given token. | 12912 * Set the token representing the 'with' keyword to the given token. |
| 13042 * @param withKeyword the token representing the 'with' keyword | 12913 * @param withKeyword the token representing the 'with' keyword |
| 13043 */ | 12914 */ |
| 13044 void set mixinKeyword(Token withKeyword2) { | 12915 void set mixinKeyword(Token withKeyword2) { |
| 13045 this._withKeyword = withKeyword2; | 12916 this._withKeyword = withKeyword2; |
| 13046 } | 12917 } |
| 13047 void visitChildren(ASTVisitor<Object> visitor) { | 12918 void visitChildren(ASTVisitor<Object> visitor) { |
| 13048 _mixinTypes.accept(visitor); | 12919 _mixinTypes.accept(visitor); |
| 13049 } | 12920 } |
| 13050 } | 12921 } |
| 13051 | |
| 13052 /** | 12922 /** |
| 13053 * Instances of the class {@code BreadthFirstVisitor} implement an AST visitor t
hat will recursively | 12923 * Instances of the class {@code BreadthFirstVisitor} implement an AST visitor t
hat will recursively |
| 13054 * visit all of the nodes in an AST structure, similar to {@link GeneralizingAST
Visitor}. This | 12924 * visit all of the nodes in an AST structure, similar to {@link GeneralizingAST
Visitor}. This |
| 13055 * visitor uses a breadth-first ordering rather than the depth-first ordering of
{@link GeneralizingASTVisitor}. | 12925 * visitor uses a breadth-first ordering rather than the depth-first ordering of
{@link GeneralizingASTVisitor}. |
| 13056 * @coverage dart.engine.ast | 12926 * @coverage dart.engine.ast |
| 13057 */ | 12927 */ |
| 13058 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> { | 12928 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> { |
| 13059 Queue<ASTNode> _queue = new Queue<ASTNode>(); | 12929 Queue<ASTNode> _queue = new Queue<ASTNode>(); |
| 13060 GeneralizingASTVisitor<Object> _childVisitor; | 12930 GeneralizingASTVisitor<Object> _childVisitor; |
| 13061 | 12931 |
| 13062 /** | 12932 /** |
| 13063 * Visit all nodes in the tree starting at the given {@code root} node, in dep
th-first order. | 12933 * Visit all nodes in the tree starting at the given {@code root} node, in dep
th-first order. |
| 13064 * @param root the root of the ASTNode tree | 12934 * @param root the root of the ASTNode tree |
| 13065 */ | 12935 */ |
| 13066 void visitAllNodes(ASTNode root) { | 12936 void visitAllNodes(ASTNode root) { |
| 13067 _queue.add(root); | 12937 _queue.add(root); |
| 13068 while (!_queue.isEmpty) { | 12938 while (!_queue.isEmpty) { |
| 13069 ASTNode next = _queue.removeFirst(); | 12939 ASTNode next = _queue.removeFirst(); |
| 13070 next.accept(this); | 12940 next.accept(this); |
| 13071 } | 12941 } |
| 13072 } | 12942 } |
| 13073 R visitNode(ASTNode node) { | 12943 R visitNode(ASTNode node) { |
| 13074 node.visitChildren(_childVisitor); | 12944 node.visitChildren(_childVisitor); |
| 13075 return null; | 12945 return null; |
| 13076 } | 12946 } |
| 13077 BreadthFirstVisitor() { | 12947 BreadthFirstVisitor() { |
| 13078 this._childVisitor = new GeneralizingASTVisitor_1(this); | 12948 this._childVisitor = new GeneralizingASTVisitor_1(this); |
| 13079 } | 12949 } |
| 13080 } | 12950 } |
| 13081 class GeneralizingASTVisitor_1 extends GeneralizingASTVisitor<Object> { | 12951 class GeneralizingASTVisitor_1 extends GeneralizingASTVisitor<Object> { |
| 13082 final BreadthFirstVisitor BreadthFirstVisitor_this; | 12952 final BreadthFirstVisitor BreadthFirstVisitor_this; |
| 13083 GeneralizingASTVisitor_1(this.BreadthFirstVisitor_this) : super(); | 12953 GeneralizingASTVisitor_1(this.BreadthFirstVisitor_this) : super(); |
| 13084 Object visitNode(ASTNode node) { | 12954 Object visitNode(ASTNode node) { |
| 13085 BreadthFirstVisitor_this._queue.add(node); | 12955 BreadthFirstVisitor_this._queue.add(node); |
| 13086 return null; | 12956 return null; |
| 13087 } | 12957 } |
| 13088 } | 12958 } |
| 13089 | |
| 13090 /** | 12959 /** |
| 13091 * Instances of the class {@code ConstantEvaluator} evaluate constant expression
s to produce their | 12960 * Instances of the class {@code ConstantEvaluator} evaluate constant expression
s to produce their |
| 13092 * compile-time value. According to the Dart Language Specification: <blockquote
> A constant | 12961 * compile-time value. According to the Dart Language Specification: <blockquote
> A constant |
| 13093 * expression is one of the following: | 12962 * expression is one of the following: |
| 13094 * <ul> | 12963 * <ul> |
| 13095 * <li>A literal number.</li> | 12964 * <li>A literal number.</li> |
| 13096 * <li>A literal boolean.</li> | 12965 * <li>A literal boolean.</li> |
| 13097 * <li>A literal string where any interpolated expression is a compile-time cons
tant that evaluates | 12966 * <li>A literal string where any interpolated expression is a compile-time cons
tant that evaluates |
| 13098 * to a numeric, string or boolean value or to {@code null}.</li> | 12967 * to a numeric, string or boolean value or to {@code null}.</li> |
| 13099 * <li>{@code null}.</li> | 12968 * <li>{@code null}.</li> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 13113 * </ul> | 12982 * </ul> |
| 13114 * </blockquote> The values returned by instances of this class are therefore {@
code null} and | 12983 * </blockquote> The values returned by instances of this class are therefore {@
code null} and |
| 13115 * instances of the classes {@code Boolean}, {@code BigInteger}, {@code Double},
{@code String}, and{@code DartObject}. | 12984 * instances of the classes {@code Boolean}, {@code BigInteger}, {@code Double},
{@code String}, and{@code DartObject}. |
| 13116 * <p> | 12985 * <p> |
| 13117 * In addition, this class defines several values that can be returned to indica
te various | 12986 * In addition, this class defines several values that can be returned to indica
te various |
| 13118 * conditions encountered during evaluation. These are documented with the stati
c field that define | 12987 * conditions encountered during evaluation. These are documented with the stati
c field that define |
| 13119 * those values. | 12988 * those values. |
| 13120 * @coverage dart.engine.ast | 12989 * @coverage dart.engine.ast |
| 13121 */ | 12990 */ |
| 13122 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { | 12991 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { |
| 13123 | 12992 |
| 13124 /** | 12993 /** |
| 13125 * The value returned for expressions (or non-expression nodes) that are not c
ompile-time constant | 12994 * The value returned for expressions (or non-expression nodes) that are not c
ompile-time constant |
| 13126 * expressions. | 12995 * expressions. |
| 13127 */ | 12996 */ |
| 13128 static Object NOT_A_CONSTANT = new Object(); | 12997 static Object NOT_A_CONSTANT = new Object(); |
| 13129 Object visitAdjacentStrings(AdjacentStrings node) { | 12998 Object visitAdjacentStrings(AdjacentStrings node) { |
| 13130 JavaStringBuilder builder = new JavaStringBuilder(); | 12999 JavaStringBuilder builder = new JavaStringBuilder(); |
| 13131 for (StringLiteral string in node.strings) { | 13000 for (StringLiteral string in node.strings) { |
| 13132 Object value = string.accept(this); | 13001 Object value = string.accept(this); |
| 13133 if (identical(value, NOT_A_CONSTANT)) { | 13002 if (identical(value, NOT_A_CONSTANT)) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13343 JavaStringBuilder builder = new JavaStringBuilder(); | 13212 JavaStringBuilder builder = new JavaStringBuilder(); |
| 13344 for (InterpolationElement element in node.elements) { | 13213 for (InterpolationElement element in node.elements) { |
| 13345 Object value = element.accept(this); | 13214 Object value = element.accept(this); |
| 13346 if (identical(value, NOT_A_CONSTANT)) { | 13215 if (identical(value, NOT_A_CONSTANT)) { |
| 13347 return value; | 13216 return value; |
| 13348 } | 13217 } |
| 13349 builder.append(value); | 13218 builder.append(value); |
| 13350 } | 13219 } |
| 13351 return builder.toString(); | 13220 return builder.toString(); |
| 13352 } | 13221 } |
| 13353 | 13222 |
| 13354 /** | 13223 /** |
| 13355 * Return the constant value of the static constant represented by the given e
lement. | 13224 * Return the constant value of the static constant represented by the given e
lement. |
| 13356 * @param element the element whose value is to be returned | 13225 * @param element the element whose value is to be returned |
| 13357 * @return the constant value of the static constant | 13226 * @return the constant value of the static constant |
| 13358 */ | 13227 */ |
| 13359 Object getConstantValue(Element element) { | 13228 Object getConstantValue(Element element) { |
| 13360 if (element is FieldElement) { | 13229 if (element is FieldElement) { |
| 13361 FieldElement field = element as FieldElement; | 13230 FieldElement field = element as FieldElement; |
| 13362 if (field.isStatic() && field.isConst()) { | 13231 if (field.isStatic() && field.isConst()) { |
| 13363 } | 13232 } |
| 13364 } | 13233 } |
| 13365 return NOT_A_CONSTANT; | 13234 return NOT_A_CONSTANT; |
| 13366 } | 13235 } |
| 13367 } | 13236 } |
| 13368 | |
| 13369 /** | 13237 /** |
| 13370 * Instances of the class {@code ElementLocator} locate the {@link Element Dart
model element}associated with a given {@link ASTNode AST node}. | 13238 * Instances of the class {@code ElementLocator} locate the {@link Element Dart
model element}associated with a given {@link ASTNode AST node}. |
| 13371 * @coverage dart.engine.ast | 13239 * @coverage dart.engine.ast |
| 13372 */ | 13240 */ |
| 13373 class ElementLocator { | 13241 class ElementLocator { |
| 13374 | 13242 |
| 13375 /** | 13243 /** |
| 13376 * Locate the {@link Element Dart model element} associated with the given {@l
ink ASTNode AST | 13244 * Locate the {@link Element Dart model element} associated with the given {@l
ink ASTNode AST |
| 13377 * node}. | 13245 * node}. |
| 13378 * @param node the node (not {@code null}) | 13246 * @param node the node (not {@code null}) |
| 13379 * @return the associated element, or {@code null} if none is found | 13247 * @return the associated element, or {@code null} if none is found |
| 13380 */ | 13248 */ |
| 13381 static Element locate(ASTNode node) { | 13249 static Element locate(ASTNode node) { |
| 13382 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); | 13250 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); |
| 13383 return node.accept(mapper); | 13251 return node.accept(mapper); |
| 13384 } | 13252 } |
| 13385 } | 13253 } |
| 13386 | |
| 13387 /** | 13254 /** |
| 13388 * Visitor that maps nodes to elements. | 13255 * Visitor that maps nodes to elements. |
| 13389 */ | 13256 */ |
| 13390 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { | 13257 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { |
| 13391 Element visitBinaryExpression(BinaryExpression node) => node.element; | 13258 Element visitBinaryExpression(BinaryExpression node) => node.element; |
| 13392 Element visitClassDeclaration(ClassDeclaration node) => node.element; | 13259 Element visitClassDeclaration(ClassDeclaration node) => node.element; |
| 13393 Element visitCompilationUnit(CompilationUnit node) => node.element; | 13260 Element visitCompilationUnit(CompilationUnit node) => node.element; |
| 13394 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme
nt; | 13261 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme
nt; |
| 13395 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; | 13262 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; |
| 13396 Element visitIdentifier(Identifier node) { | 13263 Element visitIdentifier(Identifier node) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13431 Element visitPrefixExpression(PrefixExpression node) => node.element; | 13298 Element visitPrefixExpression(PrefixExpression node) => node.element; |
| 13432 Element visitStringLiteral(StringLiteral node) { | 13299 Element visitStringLiteral(StringLiteral node) { |
| 13433 ASTNode parent2 = node.parent; | 13300 ASTNode parent2 = node.parent; |
| 13434 if (parent2 is UriBasedDirective) { | 13301 if (parent2 is UriBasedDirective) { |
| 13435 return ((parent2 as UriBasedDirective)).uriElement; | 13302 return ((parent2 as UriBasedDirective)).uriElement; |
| 13436 } | 13303 } |
| 13437 return null; | 13304 return null; |
| 13438 } | 13305 } |
| 13439 Element visitVariableDeclaration(VariableDeclaration node) => node.element; | 13306 Element visitVariableDeclaration(VariableDeclaration node) => node.element; |
| 13440 } | 13307 } |
| 13441 | |
| 13442 /** | 13308 /** |
| 13443 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito
r that will | 13309 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito
r that will |
| 13444 * 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 | 13310 * 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 |
| 13445 * will the visit method for that specific type of node be invoked, but addition
al methods for the | 13311 * will the visit method for that specific type of node be invoked, but addition
al methods for the |
| 13446 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to | 13312 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to |
| 13447 * visit a {@link Block} will cause the method {@link #visitBlock(Block)} to be
invoked but will | 13313 * visit a {@link Block} will cause the method {@link #visitBlock(Block)} to be
invoked but will |
| 13448 * also cause the methods {@link #visitStatement(Statement)} and {@link #visitNo
de(ASTNode)} to be | 13314 * also cause the methods {@link #visitStatement(Statement)} and {@link #visitNo
de(ASTNode)} to be |
| 13449 * subsequently invoked. This allows visitors to be written that visit all state
ments without | 13315 * subsequently invoked. This allows visitors to be written that visit all state
ments without |
| 13450 * needing to override the visit method for each of the specific subclasses of {
@link Statement}. | 13316 * needing to override the visit method for each of the specific subclasses of {
@link Statement}. |
| 13451 * <p> | 13317 * <p> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13576 R visitTypeName(TypeName node) => visitNode(node); | 13442 R visitTypeName(TypeName node) => visitNode(node); |
| 13577 R visitTypeParameter(TypeParameter node) => visitNode(node); | 13443 R visitTypeParameter(TypeParameter node) => visitNode(node); |
| 13578 R visitTypeParameterList(TypeParameterList node) => visitNode(node); | 13444 R visitTypeParameterList(TypeParameterList node) => visitNode(node); |
| 13579 R visitUriBasedDirective(UriBasedDirective node) => visitDirective(node); | 13445 R visitUriBasedDirective(UriBasedDirective node) => visitDirective(node); |
| 13580 R visitVariableDeclaration(VariableDeclaration node) => visitDeclaration(node)
; | 13446 R visitVariableDeclaration(VariableDeclaration node) => visitDeclaration(node)
; |
| 13581 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node
); | 13447 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node
); |
| 13582 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi
tStatement(node); | 13448 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi
tStatement(node); |
| 13583 R visitWhileStatement(WhileStatement node) => visitStatement(node); | 13449 R visitWhileStatement(WhileStatement node) => visitStatement(node); |
| 13584 R visitWithClause(WithClause node) => visitNode(node); | 13450 R visitWithClause(WithClause node) => visitNode(node); |
| 13585 } | 13451 } |
| 13586 | |
| 13587 /** | 13452 /** |
| 13588 * Instances of the class {@code NodeLocator} locate the {@link ASTNode AST node
} associated with a | 13453 * Instances of the class {@code NodeLocator} locate the {@link ASTNode AST node
} associated with a |
| 13589 * source range, given the AST structure built from the source. More specificall
y, they will return | 13454 * source range, given the AST structure built from the source. More specificall
y, they will return |
| 13590 * the {@link ASTNode AST node} with the shortest length whose source range comp
letely encompasses | 13455 * the {@link ASTNode AST node} with the shortest length whose source range comp
letely encompasses |
| 13591 * the specified range. | 13456 * the specified range. |
| 13592 * @coverage dart.engine.ast | 13457 * @coverage dart.engine.ast |
| 13593 */ | 13458 */ |
| 13594 class NodeLocator extends GeneralizingASTVisitor<Object> { | 13459 class NodeLocator extends GeneralizingASTVisitor<Object> { |
| 13595 | 13460 |
| 13596 /** | 13461 /** |
| 13597 * The start offset of the range used to identify the node. | 13462 * The start offset of the range used to identify the node. |
| 13598 */ | 13463 */ |
| 13599 int _startOffset = 0; | 13464 int _startOffset = 0; |
| 13600 | 13465 |
| 13601 /** | 13466 /** |
| 13602 * The end offset of the range used to identify the node. | 13467 * The end offset of the range used to identify the node. |
| 13603 */ | 13468 */ |
| 13604 int _endOffset = 0; | 13469 int _endOffset = 0; |
| 13605 | 13470 |
| 13606 /** | 13471 /** |
| 13607 * The element that was found that corresponds to the given source range, or {
@code null} if there | 13472 * The element that was found that corresponds to the given source range, or {
@code null} if there |
| 13608 * is no such element. | 13473 * is no such element. |
| 13609 */ | 13474 */ |
| 13610 ASTNode _foundNode; | 13475 ASTNode _foundNode; |
| 13611 | 13476 |
| 13612 /** | 13477 /** |
| 13613 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating | 13478 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating |
| 13614 * the node within an AST structure that corresponds to the given offset in th
e source. | 13479 * the node within an AST structure that corresponds to the given offset in th
e source. |
| 13615 * @param offset the offset used to identify the node | 13480 * @param offset the offset used to identify the node |
| 13616 */ | 13481 */ |
| 13617 NodeLocator.con1(int offset) { | 13482 NodeLocator.con1(int offset) { |
| 13618 _jtd_constructor_120_impl(offset); | 13483 _jtd_constructor_120_impl(offset); |
| 13619 } | 13484 } |
| 13620 _jtd_constructor_120_impl(int offset) { | 13485 _jtd_constructor_120_impl(int offset) { |
| 13621 _jtd_constructor_121_impl(offset, offset); | 13486 _jtd_constructor_121_impl(offset, offset); |
| 13622 } | 13487 } |
| 13623 | 13488 |
| 13624 /** | 13489 /** |
| 13625 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating | 13490 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating |
| 13626 * the node within an AST structure that corresponds to the given range of cha
racters in the | 13491 * the node within an AST structure that corresponds to the given range of cha
racters in the |
| 13627 * source. | 13492 * source. |
| 13628 * @param start the start offset of the range used to identify the node | 13493 * @param start the start offset of the range used to identify the node |
| 13629 * @param end the end offset of the range used to identify the node | 13494 * @param end the end offset of the range used to identify the node |
| 13630 */ | 13495 */ |
| 13631 NodeLocator.con2(int start, int end) { | 13496 NodeLocator.con2(int start, int end) { |
| 13632 _jtd_constructor_121_impl(start, end); | 13497 _jtd_constructor_121_impl(start, end); |
| 13633 } | 13498 } |
| 13634 _jtd_constructor_121_impl(int start, int end) { | 13499 _jtd_constructor_121_impl(int start, int end) { |
| 13635 this._startOffset = start; | 13500 this._startOffset = start; |
| 13636 this._endOffset = end; | 13501 this._endOffset = end; |
| 13637 } | 13502 } |
| 13638 | 13503 |
| 13639 /** | 13504 /** |
| 13640 * Return the node that was found that corresponds to the given source range,
or {@code null} if | 13505 * Return the node that was found that corresponds to the given source range,
or {@code null} if |
| 13641 * there is no such node. | 13506 * there is no such node. |
| 13642 * @return the node that was found | 13507 * @return the node that was found |
| 13643 */ | 13508 */ |
| 13644 ASTNode get foundNode => _foundNode; | 13509 ASTNode get foundNode => _foundNode; |
| 13645 | 13510 |
| 13646 /** | 13511 /** |
| 13647 * Search within the given AST node for an identifier representing a {@link Da
rtElement Dart | 13512 * Search within the given AST node for an identifier representing a {@link Da
rtElement Dart |
| 13648 * element} in the specified source range. Return the element that was found,
or {@code null} if | 13513 * element} in the specified source range. Return the element that was found,
or {@code null} if |
| 13649 * no element was found. | 13514 * no element was found. |
| 13650 * @param node the AST node within which to search | 13515 * @param node the AST node within which to search |
| 13651 * @return the element that was found | 13516 * @return the element that was found |
| 13652 */ | 13517 */ |
| 13653 ASTNode searchWithin(ASTNode node) { | 13518 ASTNode searchWithin(ASTNode node) { |
| 13654 try { | 13519 try { |
| 13655 node.accept(this); | 13520 node.accept(this); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 13676 } catch (exception) { | 13541 } catch (exception) { |
| 13677 AnalysisEngine.instance.logger.logInformation2("Exception caught while tra
versing an AST structure.", exception); | 13542 AnalysisEngine.instance.logger.logInformation2("Exception caught while tra
versing an AST structure.", exception); |
| 13678 } | 13543 } |
| 13679 if (start <= _startOffset && _endOffset <= end) { | 13544 if (start <= _startOffset && _endOffset <= end) { |
| 13680 _foundNode = node; | 13545 _foundNode = node; |
| 13681 throw new NodeLocator_NodeFoundException(); | 13546 throw new NodeLocator_NodeFoundException(); |
| 13682 } | 13547 } |
| 13683 return null; | 13548 return null; |
| 13684 } | 13549 } |
| 13685 } | 13550 } |
| 13686 | |
| 13687 /** | 13551 /** |
| 13688 * Instances of the class {@code NodeFoundException} are used to cancel visiting
after a node has | 13552 * Instances of the class {@code NodeFoundException} are used to cancel visiting
after a node has |
| 13689 * been found. | 13553 * been found. |
| 13690 */ | 13554 */ |
| 13691 class NodeLocator_NodeFoundException extends RuntimeException { | 13555 class NodeLocator_NodeFoundException extends RuntimeException { |
| 13692 static int _serialVersionUID = 1; | 13556 static int _serialVersionUID = 1; |
| 13693 } | 13557 } |
| 13694 | |
| 13695 /** | 13558 /** |
| 13696 * Instances of the class {@code RecursiveASTVisitor} implement an AST visitor t
hat will recursively | 13559 * Instances of the class {@code RecursiveASTVisitor} implement an AST visitor t
hat will recursively |
| 13697 * visit all of the nodes in an AST structure. For example, using an instance of
this class to visit | 13560 * visit all of the nodes in an AST structure. For example, using an instance of
this class to visit |
| 13698 * a {@link Block} will also cause all of the statements in the block to be visi
ted. | 13561 * a {@link Block} will also cause all of the statements in the block to be visi
ted. |
| 13699 * <p> | 13562 * <p> |
| 13700 * Subclasses that override a visit method must either invoke the overridden vis
it method or must | 13563 * Subclasses that override a visit method must either invoke the overridden vis
it method or must |
| 13701 * explicitly ask the visited node to visit its children. Failure to do so will
cause the children | 13564 * explicitly ask the visited node to visit its children. Failure to do so will
cause the children |
| 13702 * of the visited node to not be visited. | 13565 * of the visited node to not be visited. |
| 13703 * @coverage dart.engine.ast | 13566 * @coverage dart.engine.ast |
| 13704 */ | 13567 */ |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14101 } | 13964 } |
| 14102 R visitWhileStatement(WhileStatement node) { | 13965 R visitWhileStatement(WhileStatement node) { |
| 14103 node.visitChildren(this); | 13966 node.visitChildren(this); |
| 14104 return null; | 13967 return null; |
| 14105 } | 13968 } |
| 14106 R visitWithClause(WithClause node) { | 13969 R visitWithClause(WithClause node) { |
| 14107 node.visitChildren(this); | 13970 node.visitChildren(this); |
| 14108 return null; | 13971 return null; |
| 14109 } | 13972 } |
| 14110 } | 13973 } |
| 14111 | |
| 14112 /** | 13974 /** |
| 14113 * Instances of the class {@code SimpleASTVisitor} implement an AST visitor that
will do nothing | 13975 * Instances of the class {@code SimpleASTVisitor} implement an AST visitor that
will do nothing |
| 14114 * when visiting an AST node. It is intended to be a superclass for classes that
use the visitor | 13976 * when visiting an AST node. It is intended to be a superclass for classes that
use the visitor |
| 14115 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel
y visit a whole | 13977 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel
y visit a whole |
| 14116 * structure) and that only need to visit a small number of node types. | 13978 * structure) and that only need to visit a small number of node types. |
| 14117 * @coverage dart.engine.ast | 13979 * @coverage dart.engine.ast |
| 14118 */ | 13980 */ |
| 14119 class SimpleASTVisitor<R> implements ASTVisitor<R> { | 13981 class SimpleASTVisitor<R> implements ASTVisitor<R> { |
| 14120 R visitAdjacentStrings(AdjacentStrings node) => null; | 13982 R visitAdjacentStrings(AdjacentStrings node) => null; |
| 14121 R visitAnnotation(Annotation node) => null; | 13983 R visitAnnotation(Annotation node) => null; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14212 R visitTypeArgumentList(TypeArgumentList node) => null; | 14074 R visitTypeArgumentList(TypeArgumentList node) => null; |
| 14213 R visitTypeName(TypeName node) => null; | 14075 R visitTypeName(TypeName node) => null; |
| 14214 R visitTypeParameter(TypeParameter node) => null; | 14076 R visitTypeParameter(TypeParameter node) => null; |
| 14215 R visitTypeParameterList(TypeParameterList node) => null; | 14077 R visitTypeParameterList(TypeParameterList node) => null; |
| 14216 R visitVariableDeclaration(VariableDeclaration node) => null; | 14078 R visitVariableDeclaration(VariableDeclaration node) => null; |
| 14217 R visitVariableDeclarationList(VariableDeclarationList node) => null; | 14079 R visitVariableDeclarationList(VariableDeclarationList node) => null; |
| 14218 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null
; | 14080 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null
; |
| 14219 R visitWhileStatement(WhileStatement node) => null; | 14081 R visitWhileStatement(WhileStatement node) => null; |
| 14220 R visitWithClause(WithClause node) => null; | 14082 R visitWithClause(WithClause node) => null; |
| 14221 } | 14083 } |
| 14222 | |
| 14223 /** | 14084 /** |
| 14224 * Instances of the class {@code ToSourceVisitor} write a source representation
of a visited AST | 14085 * Instances of the class {@code ToSourceVisitor} write a source representation
of a visited AST |
| 14225 * node (and all of it's children) to a writer. | 14086 * node (and all of it's children) to a writer. |
| 14226 * @coverage dart.engine.ast | 14087 * @coverage dart.engine.ast |
| 14227 */ | 14088 */ |
| 14228 class ToSourceVisitor implements ASTVisitor<Object> { | 14089 class ToSourceVisitor implements ASTVisitor<Object> { |
| 14229 | 14090 |
| 14230 /** | 14091 /** |
| 14231 * The writer to which the source is to be written. | 14092 * The writer to which the source is to be written. |
| 14232 */ | 14093 */ |
| 14233 PrintWriter _writer; | 14094 PrintWriter _writer; |
| 14234 | 14095 |
| 14235 /** | 14096 /** |
| 14236 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the | 14097 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the |
| 14237 * given writer. | 14098 * given writer. |
| 14238 * @param writer the writer to which the source is to be written | 14099 * @param writer the writer to which the source is to be written |
| 14239 */ | 14100 */ |
| 14240 ToSourceVisitor(PrintWriter writer) { | 14101 ToSourceVisitor(PrintWriter writer) { |
| 14241 this._writer = writer; | 14102 this._writer = writer; |
| 14242 } | 14103 } |
| 14243 Object visitAdjacentStrings(AdjacentStrings node) { | 14104 Object visitAdjacentStrings(AdjacentStrings node) { |
| 14244 visitList2(node.strings, " "); | 14105 visitList2(node.strings, " "); |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14916 visit(node.condition); | 14777 visit(node.condition); |
| 14917 _writer.print(") "); | 14778 _writer.print(") "); |
| 14918 visit(node.body); | 14779 visit(node.body); |
| 14919 return null; | 14780 return null; |
| 14920 } | 14781 } |
| 14921 Object visitWithClause(WithClause node) { | 14782 Object visitWithClause(WithClause node) { |
| 14922 _writer.print("with "); | 14783 _writer.print("with "); |
| 14923 visitList2(node.mixinTypes, ", "); | 14784 visitList2(node.mixinTypes, ", "); |
| 14924 return null; | 14785 return null; |
| 14925 } | 14786 } |
| 14926 | 14787 |
| 14927 /** | 14788 /** |
| 14928 * Safely visit the given node. | 14789 * Safely visit the given node. |
| 14929 * @param node the node to be visited | 14790 * @param node the node to be visited |
| 14930 */ | 14791 */ |
| 14931 void visit(ASTNode node) { | 14792 void visit(ASTNode node) { |
| 14932 if (node != null) { | 14793 if (node != null) { |
| 14933 node.accept(this); | 14794 node.accept(this); |
| 14934 } | 14795 } |
| 14935 } | 14796 } |
| 14936 | 14797 |
| 14937 /** | 14798 /** |
| 14938 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. | 14799 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. |
| 14939 * @param suffix the suffix to be printed if there is a node to visit | 14800 * @param suffix the suffix to be printed if there is a node to visit |
| 14940 * @param node the node to be visited | 14801 * @param node the node to be visited |
| 14941 */ | 14802 */ |
| 14942 void visit2(ASTNode node, String suffix) { | 14803 void visit2(ASTNode node, String suffix) { |
| 14943 if (node != null) { | 14804 if (node != null) { |
| 14944 node.accept(this); | 14805 node.accept(this); |
| 14945 _writer.print(suffix); | 14806 _writer.print(suffix); |
| 14946 } | 14807 } |
| 14947 } | 14808 } |
| 14948 | 14809 |
| 14949 /** | 14810 /** |
| 14950 * Safely visit the given node, printing the prefix before the node if it is n
on-{@code null}. | 14811 * Safely visit the given node, printing the prefix before the node if it is n
on-{@code null}. |
| 14951 * @param prefix the prefix to be printed if there is a node to visit | 14812 * @param prefix the prefix to be printed if there is a node to visit |
| 14952 * @param node the node to be visited | 14813 * @param node the node to be visited |
| 14953 */ | 14814 */ |
| 14954 void visit3(String prefix, ASTNode node) { | 14815 void visit3(String prefix, ASTNode node) { |
| 14955 if (node != null) { | 14816 if (node != null) { |
| 14956 _writer.print(prefix); | 14817 _writer.print(prefix); |
| 14957 node.accept(this); | 14818 node.accept(this); |
| 14958 } | 14819 } |
| 14959 } | 14820 } |
| 14960 | 14821 |
| 14961 /** | 14822 /** |
| 14962 * Visit the given function body, printing the prefix before if given body is
not empty. | 14823 * Visit the given function body, printing the prefix before if given body is
not empty. |
| 14963 * @param prefix the prefix to be printed if there is a node to visit | 14824 * @param prefix the prefix to be printed if there is a node to visit |
| 14964 * @param body the function body to be visited | 14825 * @param body the function body to be visited |
| 14965 */ | 14826 */ |
| 14966 void visit4(String prefix, FunctionBody body) { | 14827 void visit4(String prefix, FunctionBody body) { |
| 14967 if (body is! EmptyFunctionBody) { | 14828 if (body is! EmptyFunctionBody) { |
| 14968 _writer.print(prefix); | 14829 _writer.print(prefix); |
| 14969 } | 14830 } |
| 14970 visit(body); | 14831 visit(body); |
| 14971 } | 14832 } |
| 14972 | 14833 |
| 14973 /** | 14834 /** |
| 14974 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. | 14835 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. |
| 14975 * @param suffix the suffix to be printed if there is a node to visit | 14836 * @param suffix the suffix to be printed if there is a node to visit |
| 14976 * @param node the node to be visited | 14837 * @param node the node to be visited |
| 14977 */ | 14838 */ |
| 14978 void visit5(Token token, String suffix) { | 14839 void visit5(Token token, String suffix) { |
| 14979 if (token != null) { | 14840 if (token != null) { |
| 14980 _writer.print(token.lexeme); | 14841 _writer.print(token.lexeme); |
| 14981 _writer.print(suffix); | 14842 _writer.print(suffix); |
| 14982 } | 14843 } |
| 14983 } | 14844 } |
| 14984 | 14845 |
| 14985 /** | 14846 /** |
| 14986 * Print a list of nodes without any separation. | 14847 * Print a list of nodes without any separation. |
| 14987 * @param nodes the nodes to be printed | 14848 * @param nodes the nodes to be printed |
| 14988 * @param separator the separator to be printed between adjacent nodes | 14849 * @param separator the separator to be printed between adjacent nodes |
| 14989 */ | 14850 */ |
| 14990 void visitList(NodeList<ASTNode> nodes) { | 14851 void visitList(NodeList<ASTNode> nodes) { |
| 14991 visitList2(nodes, ""); | 14852 visitList2(nodes, ""); |
| 14992 } | 14853 } |
| 14993 | 14854 |
| 14994 /** | 14855 /** |
| 14995 * Print a list of nodes, separated by the given separator. | 14856 * Print a list of nodes, separated by the given separator. |
| 14996 * @param nodes the nodes to be printed | 14857 * @param nodes the nodes to be printed |
| 14997 * @param separator the separator to be printed between adjacent nodes | 14858 * @param separator the separator to be printed between adjacent nodes |
| 14998 */ | 14859 */ |
| 14999 void visitList2(NodeList<ASTNode> nodes, String separator) { | 14860 void visitList2(NodeList<ASTNode> nodes, String separator) { |
| 15000 if (nodes != null) { | 14861 if (nodes != null) { |
| 15001 int size2 = nodes.length; | 14862 int size2 = nodes.length; |
| 15002 for (int i = 0; i < size2; i++) { | 14863 for (int i = 0; i < size2; i++) { |
| 15003 if (i > 0) { | 14864 if (i > 0) { |
| 15004 _writer.print(separator); | 14865 _writer.print(separator); |
| 15005 } | 14866 } |
| 15006 nodes[i].accept(this); | 14867 nodes[i].accept(this); |
| 15007 } | 14868 } |
| 15008 } | 14869 } |
| 15009 } | 14870 } |
| 15010 | 14871 |
| 15011 /** | 14872 /** |
| 15012 * Print a list of nodes, separated by the given separator. | 14873 * Print a list of nodes, separated by the given separator. |
| 15013 * @param nodes the nodes to be printed | 14874 * @param nodes the nodes to be printed |
| 15014 * @param separator the separator to be printed between adjacent nodes | 14875 * @param separator the separator to be printed between adjacent nodes |
| 15015 * @param suffix the suffix to be printed if the list is not empty | 14876 * @param suffix the suffix to be printed if the list is not empty |
| 15016 */ | 14877 */ |
| 15017 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { | 14878 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { |
| 15018 if (nodes != null) { | 14879 if (nodes != null) { |
| 15019 int size2 = nodes.length; | 14880 int size2 = nodes.length; |
| 15020 if (size2 > 0) { | 14881 if (size2 > 0) { |
| 15021 for (int i = 0; i < size2; i++) { | 14882 for (int i = 0; i < size2; i++) { |
| 15022 if (i > 0) { | 14883 if (i > 0) { |
| 15023 _writer.print(separator); | 14884 _writer.print(separator); |
| 15024 } | 14885 } |
| 15025 nodes[i].accept(this); | 14886 nodes[i].accept(this); |
| 15026 } | 14887 } |
| 15027 _writer.print(suffix); | 14888 _writer.print(suffix); |
| 15028 } | 14889 } |
| 15029 } | 14890 } |
| 15030 } | 14891 } |
| 15031 | 14892 |
| 15032 /** | 14893 /** |
| 15033 * Print a list of nodes, separated by the given separator. | 14894 * Print a list of nodes, separated by the given separator. |
| 15034 * @param prefix the prefix to be printed if the list is not empty | 14895 * @param prefix the prefix to be printed if the list is not empty |
| 15035 * @param nodes the nodes to be printed | 14896 * @param nodes the nodes to be printed |
| 15036 * @param separator the separator to be printed between adjacent nodes | 14897 * @param separator the separator to be printed between adjacent nodes |
| 15037 */ | 14898 */ |
| 15038 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { | 14899 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { |
| 15039 if (nodes != null) { | 14900 if (nodes != null) { |
| 15040 int size2 = nodes.length; | 14901 int size2 = nodes.length; |
| 15041 if (size2 > 0) { | 14902 if (size2 > 0) { |
| 15042 _writer.print(prefix); | 14903 _writer.print(prefix); |
| 15043 for (int i = 0; i < size2; i++) { | 14904 for (int i = 0; i < size2; i++) { |
| 15044 if (i > 0) { | 14905 if (i > 0) { |
| 15045 _writer.print(separator); | 14906 _writer.print(separator); |
| 15046 } | 14907 } |
| 15047 nodes[i].accept(this); | 14908 nodes[i].accept(this); |
| 15048 } | 14909 } |
| 15049 } | 14910 } |
| 15050 } | 14911 } |
| 15051 } | 14912 } |
| 15052 } | 14913 } |
| 15053 | |
| 15054 /** | 14914 /** |
| 15055 * Instances of the class {@code ASTCloner} implement an object that will clone
any AST structure | 14915 * Instances of the class {@code ASTCloner} implement an object that will clone
any AST structure |
| 15056 * that it visits. The cloner will only clone the structure, it will not preserv
e any resolution | 14916 * that it visits. The cloner will only clone the structure, it will not preserv
e any resolution |
| 15057 * results or properties associated with the nodes. | 14917 * results or properties associated with the nodes. |
| 15058 */ | 14918 */ |
| 15059 class ASTCloner implements ASTVisitor<ASTNode> { | 14919 class ASTCloner implements ASTVisitor<ASTNode> { |
| 15060 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri
ngs.full(clone3(node.strings)); | 14920 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri
ngs.full(clone3(node.strings)); |
| 15061 Annotation visitAnnotation(Annotation node) => new Annotation.full(node.atSign
, clone2(node.name), node.period, clone2(node.constructorName), clone2(node.argu
ments)); | 14921 Annotation visitAnnotation(Annotation node) => new Annotation.full(node.atSign
, clone2(node.name), node.period, clone2(node.constructorName), clone2(node.argu
ments)); |
| 15062 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node
) => new ArgumentDefinitionTest.full(node.question, clone2(node.identifier)); | 14922 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node
) => new ArgumentDefinitionTest.full(node.question, clone2(node.identifier)); |
| 15063 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList.full(nod
e.leftParenthesis, clone3(node.arguments), node.rightParenthesis); | 14923 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList.full(nod
e.leftParenthesis, clone3(node.arguments), node.rightParenthesis); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15185 return node.accept(this) as ASTNode; | 15045 return node.accept(this) as ASTNode; |
| 15186 } | 15046 } |
| 15187 List clone3(NodeList nodes) { | 15047 List clone3(NodeList nodes) { |
| 15188 List clonedNodes = new List(); | 15048 List clonedNodes = new List(); |
| 15189 for (ASTNode node in nodes) { | 15049 for (ASTNode node in nodes) { |
| 15190 clonedNodes.add((node.accept(this) as ASTNode)); | 15050 clonedNodes.add((node.accept(this) as ASTNode)); |
| 15191 } | 15051 } |
| 15192 return clonedNodes; | 15052 return clonedNodes; |
| 15193 } | 15053 } |
| 15194 } | 15054 } |
| 15195 | |
| 15196 /** | 15055 /** |
| 15197 * Traverse the AST from initial child node to successive parents, building a co
llection of local | 15056 * Traverse the AST from initial child node to successive parents, building a co
llection of local |
| 15198 * variable and parameter names visible to the initial child node. In case of na
me shadowing, the | 15057 * variable and parameter names visible to the initial child node. In case of na
me shadowing, the |
| 15199 * first name seen is the most specific one so names are not redefined. | 15058 * first name seen is the most specific one so names are not redefined. |
| 15200 * <p> | 15059 * <p> |
| 15201 * Completion test code coverage is 95%. The two basic blocks that are not execu
ted cannot be | 15060 * Completion test code coverage is 95%. The two basic blocks that are not execu
ted cannot be |
| 15202 * executed. They are included for future reference. | 15061 * executed. They are included for future reference. |
| 15203 * @coverage com.google.dart.engine.services.completion | 15062 * @coverage com.google.dart.engine.services.completion |
| 15204 */ | 15063 */ |
| 15205 class ScopedNameFinder extends GeneralizingASTVisitor<Object> { | 15064 class ScopedNameFinder extends GeneralizingASTVisitor<Object> { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15301 if (!_locals.containsKey(name2)) { | 15160 if (!_locals.containsKey(name2)) { |
| 15302 _locals[name2] = identifier; | 15161 _locals[name2] = identifier; |
| 15303 } | 15162 } |
| 15304 } | 15163 } |
| 15305 } | 15164 } |
| 15306 void addVariables(NodeList<VariableDeclaration> vars) { | 15165 void addVariables(NodeList<VariableDeclaration> vars) { |
| 15307 for (VariableDeclaration var2 in vars) { | 15166 for (VariableDeclaration var2 in vars) { |
| 15308 addToScope(var2.name); | 15167 addToScope(var2.name); |
| 15309 } | 15168 } |
| 15310 } | 15169 } |
| 15311 | 15170 |
| 15312 /** | 15171 /** |
| 15313 * Some statements define names that are visible downstream. There aren't many
of these. | 15172 * Some statements define names that are visible downstream. There aren't many
of these. |
| 15314 * @param statements the list of statements to check for name definitions | 15173 * @param statements the list of statements to check for name definitions |
| 15315 */ | 15174 */ |
| 15316 void checkStatements(List<Statement> statements) { | 15175 void checkStatements(List<Statement> statements) { |
| 15317 for (Statement stmt in statements) { | 15176 for (Statement stmt in statements) { |
| 15318 if (identical(stmt, _immediateChild)) { | 15177 if (identical(stmt, _immediateChild)) { |
| 15319 return; | 15178 return; |
| 15320 } | 15179 } |
| 15321 if (stmt is VariableDeclarationStatement) { | 15180 if (stmt is VariableDeclarationStatement) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15392 return elements[elements.length - 1].endToken; | 15251 return elements[elements.length - 1].endToken; |
| 15393 } | 15252 } |
| 15394 /** | 15253 /** |
| 15395 * Return the node that is the parent of each of the elements in the list. | 15254 * Return the node that is the parent of each of the elements in the list. |
| 15396 * @return the node that is the parent of each of the elements in the list | 15255 * @return the node that is the parent of each of the elements in the list |
| 15397 */ | 15256 */ |
| 15398 ASTNode getOwner() { | 15257 ASTNode getOwner() { |
| 15399 return owner; | 15258 return owner; |
| 15400 } | 15259 } |
| 15401 } | 15260 } |
| OLD | NEW |