| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.ast; | 3 library engine.ast; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'error.dart'; | 7 import 'error.dart'; |
| 8 import 'source.dart' show LineInfo; | 8 import 'source.dart' show LineInfo; |
| 9 import 'scanner.dart'; | 9 import 'scanner.dart'; |
| 10 import 'engine.dart' show AnalysisEngine; | 10 import 'engine.dart' show AnalysisEngine; |
| 11 import 'utilities_dart.dart'; | 11 import 'utilities_dart.dart'; |
| 12 import 'element.dart'; | 12 import 'element.dart'; |
| 13 /** | 13 /** |
| 14 * The abstract class `ASTNode` defines the behavior common to all nodes in the
AST structure | 14 * The abstract class `ASTNode` defines the behavior common to all nodes in the
AST structure |
| 15 * for a Dart program. | 15 * for a Dart program. |
| 16 * |
| 16 * @coverage dart.engine.ast | 17 * @coverage dart.engine.ast |
| 17 */ | 18 */ |
| 18 abstract class ASTNode { | 19 abstract class ASTNode { |
| 19 | 20 |
| 20 /** | 21 /** |
| 21 * The parent of the node, or `null` if the node is the root of an AST structu
re. | 22 * The parent of the node, or `null` if the node is the root of an AST structu
re. |
| 22 */ | 23 */ |
| 23 ASTNode _parent; | 24 ASTNode _parent; |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * A table mapping the names of properties to their values, or `null` if this
node does not | 27 * A table mapping the names of properties to their values, or `null` if this
node does not |
| 27 * have any properties associated with it. | 28 * have any properties associated with it. |
| 28 */ | 29 */ |
| 29 Map<String, Object> _propertyMap; | 30 Map<String, Object> _propertyMap; |
| 30 | 31 |
| 31 /** | 32 /** |
| 32 * A comparator that can be used to sort AST nodes in lexical order. In other
words,`compare` will return a negative value if the offset of the first node is
less than the | 33 * A comparator that can be used to sort AST nodes in lexical order. In other
words, |
| 34 * `compare` will return a negative value if the offset of the first node is l
ess than the |
| 33 * offset of the second node, zero (0) if the nodes have the same offset, and
a positive value if | 35 * offset of the second node, zero (0) if the nodes have the same offset, and
a positive value if |
| 34 * if the offset of the first node is greater than the offset of the second no
de. | 36 * if the offset of the first node is greater than the offset of the second no
de. |
| 35 */ | 37 */ |
| 36 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) =>
second.offset - first.offset; | 38 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) =>
second.offset - first.offset; |
| 37 | 39 |
| 38 /** | 40 /** |
| 39 * Use the given visitor to visit this node. | 41 * Use the given visitor to visit this node. |
| 42 * |
| 40 * @param visitor the visitor that will visit this node | 43 * @param visitor the visitor that will visit this node |
| 41 * @return the value returned by the visitor as a result of visiting this node | 44 * @return the value returned by the visitor as a result of visiting this node |
| 42 */ | 45 */ |
| 43 accept(ASTVisitor visitor); | 46 accept(ASTVisitor visitor); |
| 44 | 47 |
| 45 /** | 48 /** |
| 46 * @return the [ASTNode] of given [Class] which is [ASTNode] itself, or one of | 49 * @return the [ASTNode] of given [Class] which is [ASTNode] itself, or one of |
| 47 * its parents. | 50 * its parents. |
| 48 */ | 51 */ |
| 49 ASTNode getAncestor(Type enclosingClass) { | 52 ASTNode getAncestor(Type enclosingClass) { |
| 50 ASTNode node = this; | 53 ASTNode node = this; |
| 51 while (node != null && !isInstanceOf(node, enclosingClass)) { | 54 while (node != null && !isInstanceOf(node, enclosingClass)) { |
| 52 node = node.parent; | 55 node = node.parent; |
| 53 } | 56 } |
| 54 ; | 57 ; |
| 55 return node as ASTNode; | 58 return node as ASTNode; |
| 56 } | 59 } |
| 57 | 60 |
| 58 /** | 61 /** |
| 59 * Return the first token included in this node's source range. | 62 * Return the first token included in this node's source range. |
| 63 * |
| 60 * @return the first token included in this node's source range | 64 * @return the first token included in this node's source range |
| 61 */ | 65 */ |
| 62 Token get beginToken; | 66 Token get beginToken; |
| 63 | 67 |
| 64 /** | 68 /** |
| 65 * Return the offset of the character immediately following the last character
of this node's | 69 * Return the offset of the character immediately following the last character
of this node's |
| 66 * source range. This is equivalent to `node.getOffset() + node.getLength()`.
For a | 70 * source range. This is equivalent to `node.getOffset() + node.getLength()`.
For a |
| 67 * compilation unit this will be equal to the length of the unit's source. For
synthetic nodes | 71 * compilation unit this will be equal to the length of the unit's source. For
synthetic nodes |
| 68 * this will be equivalent to the node's offset (because the length is zero (0
) by definition). | 72 * this will be equivalent to the node's offset (because the length is zero (0
) by definition). |
| 73 * |
| 69 * @return the offset of the character just past the node's source range | 74 * @return the offset of the character just past the node's source range |
| 70 */ | 75 */ |
| 71 int get end => offset + length; | 76 int get end => offset + length; |
| 72 | 77 |
| 73 /** | 78 /** |
| 74 * Return the last token included in this node's source range. | 79 * Return the last token included in this node's source range. |
| 80 * |
| 75 * @return the last token included in this node's source range | 81 * @return the last token included in this node's source range |
| 76 */ | 82 */ |
| 77 Token get endToken; | 83 Token get endToken; |
| 78 | 84 |
| 79 /** | 85 /** |
| 80 * Return the number of characters in the node's source range. | 86 * Return the number of characters in the node's source range. |
| 87 * |
| 81 * @return the number of characters in the node's source range | 88 * @return the number of characters in the node's source range |
| 82 */ | 89 */ |
| 83 int get length { | 90 int get length { |
| 84 Token beginToken = this.beginToken; | 91 Token beginToken = this.beginToken; |
| 85 Token endToken = this.endToken; | 92 Token endToken = this.endToken; |
| 86 if (beginToken == null || endToken == null) { | 93 if (beginToken == null || endToken == null) { |
| 87 return -1; | 94 return -1; |
| 88 } | 95 } |
| 89 return endToken.offset + endToken.length - beginToken.offset; | 96 return endToken.offset + endToken.length - beginToken.offset; |
| 90 } | 97 } |
| 91 | 98 |
| 92 /** | 99 /** |
| 93 * Return the offset from the beginning of the file to the first character in
the node's source | 100 * Return the offset from the beginning of the file to the first character in
the node's source |
| 94 * range. | 101 * range. |
| 102 * |
| 95 * @return the offset from the beginning of the file to the first character in
the node's source | 103 * @return the offset from the beginning of the file to the first character in
the node's source |
| 96 * range | 104 * range |
| 97 */ | 105 */ |
| 98 int get offset { | 106 int get offset { |
| 99 Token beginToken = this.beginToken; | 107 Token beginToken = this.beginToken; |
| 100 if (beginToken == null) { | 108 if (beginToken == null) { |
| 101 return -1; | 109 return -1; |
| 102 } | 110 } |
| 103 return beginToken.offset; | 111 return beginToken.offset; |
| 104 } | 112 } |
| 105 | 113 |
| 106 /** | 114 /** |
| 107 * Return this node's parent node, or `null` if this node is the root of an AS
T structure. | 115 * Return this node's parent node, or `null` if this node is the root of an AS
T structure. |
| 108 * | 116 * |
| 109 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime | 117 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime |
| 110 * of a node. | 118 * of a node. |
| 119 * |
| 111 * @return the parent of this node, or `null` if none | 120 * @return the parent of this node, or `null` if none |
| 112 */ | 121 */ |
| 113 ASTNode get parent => _parent; | 122 ASTNode get parent => _parent; |
| 114 | 123 |
| 115 /** | 124 /** |
| 116 * Return the value of the property with the given name, or `null` if this nod
e does not | 125 * Return the value of the property with the given name, or `null` if this nod
e does not |
| 117 * have a property with the given name. | 126 * have a property with the given name. |
| 127 * |
| 118 * @return the value of the property with the given name | 128 * @return the value of the property with the given name |
| 119 */ | 129 */ |
| 120 Object getProperty(String propertyName) { | 130 Object getProperty(String propertyName) { |
| 121 if (_propertyMap == null) { | 131 if (_propertyMap == null) { |
| 122 return null; | 132 return null; |
| 123 } | 133 } |
| 124 return _propertyMap[propertyName]; | 134 return _propertyMap[propertyName]; |
| 125 } | 135 } |
| 126 | 136 |
| 127 /** | 137 /** |
| 128 * Return the node at the root of this node's AST structure. Note that this me
thod's performance | 138 * Return the node at the root of this node's AST structure. Note that this me
thod's performance |
| 129 * is linear with respect to the depth of the node in the AST structure (O(dep
th)). | 139 * is linear with respect to the depth of the node in the AST structure (O(dep
th)). |
| 140 * |
| 130 * @return the node at the root of this node's AST structure | 141 * @return the node at the root of this node's AST structure |
| 131 */ | 142 */ |
| 132 ASTNode get root { | 143 ASTNode get root { |
| 133 ASTNode root = this; | 144 ASTNode root = this; |
| 134 ASTNode parent = this.parent; | 145 ASTNode parent = this.parent; |
| 135 while (parent != null) { | 146 while (parent != null) { |
| 136 root = parent; | 147 root = parent; |
| 137 parent = root.parent; | 148 parent = root.parent; |
| 138 } | 149 } |
| 139 return root; | 150 return root; |
| 140 } | 151 } |
| 141 | 152 |
| 142 /** | 153 /** |
| 143 * Return `true` if this node is a synthetic node. A synthetic node is a node
that was | 154 * Return `true` if this node is a synthetic node. A synthetic node is a node
that was |
| 144 * introduced by the parser in order to recover from an error in the code. Syn
thetic nodes always | 155 * introduced by the parser in order to recover from an error in the code. Syn
thetic nodes always |
| 145 * have a length of zero (`0`). | 156 * have a length of zero (`0`). |
| 157 * |
| 146 * @return `true` if this node is a synthetic node | 158 * @return `true` if this node is a synthetic node |
| 147 */ | 159 */ |
| 148 bool get isSynthetic => false; | 160 bool get isSynthetic => false; |
| 149 | 161 |
| 150 /** | 162 /** |
| 151 * Set the value of the property with the given name to the given value. If th
e value is`null`, the property will effectively be removed. | 163 * Set the value of the property with the given name to the given value. If th
e value is |
| 164 * `null`, the property will effectively be removed. |
| 165 * |
| 152 * @param propertyName the name of the property whose value is to be set | 166 * @param propertyName the name of the property whose value is to be set |
| 153 * @param propertyValue the new value of the property | 167 * @param propertyValue the new value of the property |
| 154 */ | 168 */ |
| 155 void setProperty(String propertyName, Object propertyValue) { | 169 void setProperty(String propertyName, Object propertyValue) { |
| 156 if (propertyValue == null) { | 170 if (propertyValue == null) { |
| 157 if (_propertyMap != null) { | 171 if (_propertyMap != null) { |
| 158 _propertyMap.remove(propertyName); | 172 _propertyMap.remove(propertyName); |
| 159 if (_propertyMap.isEmpty) { | 173 if (_propertyMap.isEmpty) { |
| 160 _propertyMap = null; | 174 _propertyMap = null; |
| 161 } | 175 } |
| 162 } | 176 } |
| 163 } else { | 177 } else { |
| 164 if (_propertyMap == null) { | 178 if (_propertyMap == null) { |
| 165 _propertyMap = new Map<String, Object>(); | 179 _propertyMap = new Map<String, Object>(); |
| 166 } | 180 } |
| 167 _propertyMap[propertyName] = propertyValue; | 181 _propertyMap[propertyName] = propertyValue; |
| 168 } | 182 } |
| 169 } | 183 } |
| 170 | 184 |
| 171 /** | 185 /** |
| 172 * Return a textual description of this node in a form approximating valid sou
rce. The returned | 186 * Return a textual description of this node in a form approximating valid sou
rce. The returned |
| 173 * string will not be valid source primarily in the case where the node itself
is not well-formed. | 187 * string will not be valid source primarily in the case where the node itself
is not well-formed. |
| 188 * |
| 174 * @return the source code equivalent of this node | 189 * @return the source code equivalent of this node |
| 175 */ | 190 */ |
| 176 String toSource() { | 191 String toSource() { |
| 177 PrintStringWriter writer = new PrintStringWriter(); | 192 PrintStringWriter writer = new PrintStringWriter(); |
| 178 accept(new ToSourceVisitor(writer)); | 193 accept(new ToSourceVisitor(writer)); |
| 179 return writer.toString(); | 194 return writer.toString(); |
| 180 } | 195 } |
| 181 String toString() => toSource(); | 196 String toString() => toSource(); |
| 182 | 197 |
| 183 /** | 198 /** |
| 184 * Use the given visitor to visit all of the children of this node. The childr
en will be visited | 199 * Use the given visitor to visit all of the children of this node. The childr
en will be visited |
| 185 * in source order. | 200 * in source order. |
| 201 * |
| 186 * @param visitor the visitor that will be used to visit the children of this
node | 202 * @param visitor the visitor that will be used to visit the children of this
node |
| 187 */ | 203 */ |
| 188 void visitChildren(ASTVisitor<Object> visitor); | 204 void visitChildren(ASTVisitor<Object> visitor); |
| 189 | 205 |
| 190 /** | 206 /** |
| 191 * Make this node the parent of the given child node. | 207 * Make this node the parent of the given child node. |
| 208 * |
| 192 * @param child the node that will become a child of this node | 209 * @param child the node that will become a child of this node |
| 193 * @return the node that was made a child of this node | 210 * @return the node that was made a child of this node |
| 194 */ | 211 */ |
| 195 ASTNode becomeParentOf(ASTNode child) { | 212 ASTNode becomeParentOf(ASTNode child) { |
| 196 if (child != null) { | 213 if (child != null) { |
| 197 ASTNode node = child; | 214 ASTNode node = child; |
| 198 node.parent = this; | 215 node.parent = this; |
| 199 } | 216 } |
| 200 return child; | 217 return child; |
| 201 } | 218 } |
| 202 | 219 |
| 203 /** | 220 /** |
| 204 * If the given child is not `null`, use the given visitor to visit it. | 221 * If the given child is not `null`, use the given visitor to visit it. |
| 222 * |
| 205 * @param child the child to be visited | 223 * @param child the child to be visited |
| 206 * @param visitor the visitor that will be used to visit the child | 224 * @param visitor the visitor that will be used to visit the child |
| 207 */ | 225 */ |
| 208 void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) { | 226 void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) { |
| 209 if (child != null) { | 227 if (child != null) { |
| 210 child.accept(visitor); | 228 child.accept(visitor); |
| 211 } | 229 } |
| 212 } | 230 } |
| 213 | 231 |
| 214 /** | 232 /** |
| 215 * Set the parent of this node to the given node. | 233 * Set the parent of this node to the given node. |
| 234 * |
| 216 * @param newParent the node that is to be made the parent of this node | 235 * @param newParent the node that is to be made the parent of this node |
| 217 */ | 236 */ |
| 218 void set parent(ASTNode newParent) { | 237 void set parent(ASTNode newParent) { |
| 219 _parent = newParent; | 238 _parent = newParent; |
| 220 } | 239 } |
| 221 static int _hashCodeGenerator = 0; | 240 static int _hashCodeGenerator = 0; |
| 222 final int hashCode = ++_hashCodeGenerator; | 241 final int hashCode = ++_hashCodeGenerator; |
| 223 } | 242 } |
| 224 /** | 243 /** |
| 225 * The interface `ASTVisitor` defines the behavior of objects that can be used t
o visit an AST | 244 * The interface `ASTVisitor` defines the behavior of objects that can be used t
o visit an AST |
| 226 * structure. | 245 * structure. |
| 246 * |
| 227 * @coverage dart.engine.ast | 247 * @coverage dart.engine.ast |
| 228 */ | 248 */ |
| 229 abstract class ASTVisitor<R> { | 249 abstract class ASTVisitor<R> { |
| 230 R visitAdjacentStrings(AdjacentStrings node); | 250 R visitAdjacentStrings(AdjacentStrings node); |
| 231 R visitAnnotation(Annotation node); | 251 R visitAnnotation(Annotation node); |
| 232 R visitArgumentDefinitionTest(ArgumentDefinitionTest node); | 252 R visitArgumentDefinitionTest(ArgumentDefinitionTest node); |
| 233 R visitArgumentList(ArgumentList node); | 253 R visitArgumentList(ArgumentList node); |
| 234 R visitAsExpression(AsExpression node); | 254 R visitAsExpression(AsExpression node); |
| 235 R visitAssertStatement(AssertStatement assertStatement); | 255 R visitAssertStatement(AssertStatement assertStatement); |
| 236 R visitAssignmentExpression(AssignmentExpression node); | 256 R visitAssignmentExpression(AssignmentExpression node); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 R visitVariableDeclarationStatement(VariableDeclarationStatement node); | 348 R visitVariableDeclarationStatement(VariableDeclarationStatement node); |
| 329 R visitWhileStatement(WhileStatement node); | 349 R visitWhileStatement(WhileStatement node); |
| 330 R visitWithClause(WithClause node); | 350 R visitWithClause(WithClause node); |
| 331 } | 351 } |
| 332 /** | 352 /** |
| 333 * Instances of the class `AdjacentStrings` represents two or more string litera
ls that are | 353 * Instances of the class `AdjacentStrings` represents two or more string litera
ls that are |
| 334 * implicitly concatenated because of being adjacent (separated only by whitespa
ce). | 354 * implicitly concatenated because of being adjacent (separated only by whitespa
ce). |
| 335 * | 355 * |
| 336 * While the grammar only allows adjacent strings when all of the strings are of
the same kind | 356 * While the grammar only allows adjacent strings when all of the strings are of
the same kind |
| 337 * (single line or multi-line), this class doesn't enforce that restriction. | 357 * (single line or multi-line), this class doesn't enforce that restriction. |
| 358 * |
| 338 * <pre> | 359 * <pre> |
| 339 * adjacentStrings ::=[StringLiteral string] [StringLiteral string]+ | 360 * adjacentStrings ::= |
| 361 * [StringLiteral] [StringLiteral]+ |
| 340 * </pre> | 362 * </pre> |
| 363 * |
| 341 * @coverage dart.engine.ast | 364 * @coverage dart.engine.ast |
| 342 */ | 365 */ |
| 343 class AdjacentStrings extends StringLiteral { | 366 class AdjacentStrings extends StringLiteral { |
| 344 | 367 |
| 345 /** | 368 /** |
| 346 * The strings that are implicitly concatenated. | 369 * The strings that are implicitly concatenated. |
| 347 */ | 370 */ |
| 348 NodeList<StringLiteral> _strings; | 371 NodeList<StringLiteral> _strings; |
| 349 | 372 |
| 350 /** | 373 /** |
| 351 * Initialize a newly created list of adjacent strings. | 374 * Initialize a newly created list of adjacent strings. |
| 375 * |
| 352 * @param strings the strings that are implicitly concatenated | 376 * @param strings the strings that are implicitly concatenated |
| 353 */ | 377 */ |
| 354 AdjacentStrings.full(List<StringLiteral> strings) { | 378 AdjacentStrings.full(List<StringLiteral> strings) { |
| 355 this._strings = new NodeList<StringLiteral>(this); | 379 this._strings = new NodeList<StringLiteral>(this); |
| 356 this._strings.addAll(strings); | 380 this._strings.addAll(strings); |
| 357 } | 381 } |
| 358 | 382 |
| 359 /** | 383 /** |
| 360 * Initialize a newly created list of adjacent strings. | 384 * Initialize a newly created list of adjacent strings. |
| 385 * |
| 361 * @param strings the strings that are implicitly concatenated | 386 * @param strings the strings that are implicitly concatenated |
| 362 */ | 387 */ |
| 363 AdjacentStrings({List<StringLiteral> strings}) : this.full(strings); | 388 AdjacentStrings({List<StringLiteral> strings}) : this.full(strings); |
| 364 accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this); | 389 accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this); |
| 365 Token get beginToken => _strings.beginToken; | 390 Token get beginToken => _strings.beginToken; |
| 366 Token get endToken => _strings.endToken; | 391 Token get endToken => _strings.endToken; |
| 367 | 392 |
| 368 /** | 393 /** |
| 369 * Return the strings that are implicitly concatenated. | 394 * Return the strings that are implicitly concatenated. |
| 395 * |
| 370 * @return the strings that are implicitly concatenated | 396 * @return the strings that are implicitly concatenated |
| 371 */ | 397 */ |
| 372 NodeList<StringLiteral> get strings => _strings; | 398 NodeList<StringLiteral> get strings => _strings; |
| 373 void visitChildren(ASTVisitor<Object> visitor) { | 399 void visitChildren(ASTVisitor<Object> visitor) { |
| 374 _strings.accept(visitor); | 400 _strings.accept(visitor); |
| 375 } | 401 } |
| 376 void appendStringValue(JavaStringBuilder builder) { | 402 void appendStringValue(JavaStringBuilder builder) { |
| 377 for (StringLiteral stringLiteral in strings) { | 403 for (StringLiteral stringLiteral in strings) { |
| 378 stringLiteral.appendStringValue(builder); | 404 stringLiteral.appendStringValue(builder); |
| 379 } | 405 } |
| 380 } | 406 } |
| 381 } | 407 } |
| 382 /** | 408 /** |
| 383 * The abstract class `AnnotatedNode` defines the behavior of nodes that can be
annotated with | 409 * The abstract class `AnnotatedNode` defines the behavior of nodes that can be
annotated with |
| 384 * both a comment and metadata. | 410 * both a comment and metadata. |
| 411 * |
| 385 * @coverage dart.engine.ast | 412 * @coverage dart.engine.ast |
| 386 */ | 413 */ |
| 387 abstract class AnnotatedNode extends ASTNode { | 414 abstract class AnnotatedNode extends ASTNode { |
| 388 | 415 |
| 389 /** | 416 /** |
| 390 * The documentation comment associated with this node, or `null` if this node
does not have | 417 * The documentation comment associated with this node, or `null` if this node
does not have |
| 391 * a documentation comment associated with it. | 418 * a documentation comment associated with it. |
| 392 */ | 419 */ |
| 393 Comment _comment; | 420 Comment _comment; |
| 394 | 421 |
| 395 /** | 422 /** |
| 396 * The annotations associated with this node. | 423 * The annotations associated with this node. |
| 397 */ | 424 */ |
| 398 NodeList<Annotation> _metadata; | 425 NodeList<Annotation> _metadata; |
| 399 | 426 |
| 400 /** | 427 /** |
| 401 * Initialize a newly created node. | 428 * Initialize a newly created node. |
| 429 * |
| 402 * @param comment the documentation comment associated with this node | 430 * @param comment the documentation comment associated with this node |
| 403 * @param metadata the annotations associated with this node | 431 * @param metadata the annotations associated with this node |
| 404 */ | 432 */ |
| 405 AnnotatedNode.full(Comment comment, List<Annotation> metadata) { | 433 AnnotatedNode.full(Comment comment, List<Annotation> metadata) { |
| 406 this._metadata = new NodeList<Annotation>(this); | 434 this._metadata = new NodeList<Annotation>(this); |
| 407 this._comment = becomeParentOf(comment); | 435 this._comment = becomeParentOf(comment); |
| 408 this._metadata.addAll(metadata); | 436 this._metadata.addAll(metadata); |
| 409 } | 437 } |
| 410 | 438 |
| 411 /** | 439 /** |
| 412 * Initialize a newly created node. | 440 * Initialize a newly created node. |
| 441 * |
| 413 * @param comment the documentation comment associated with this node | 442 * @param comment the documentation comment associated with this node |
| 414 * @param metadata the annotations associated with this node | 443 * @param metadata the annotations associated with this node |
| 415 */ | 444 */ |
| 416 AnnotatedNode({Comment comment, List<Annotation> metadata}) : this.full(commen
t, metadata); | 445 AnnotatedNode({Comment comment, List<Annotation> metadata}) : this.full(commen
t, metadata); |
| 417 Token get beginToken { | 446 Token get beginToken { |
| 418 if (_comment == null) { | 447 if (_comment == null) { |
| 419 if (_metadata.isEmpty) { | 448 if (_metadata.isEmpty) { |
| 420 return firstTokenAfterCommentAndMetadata; | 449 return firstTokenAfterCommentAndMetadata; |
| 421 } else { | 450 } else { |
| 422 return _metadata.beginToken; | 451 return _metadata.beginToken; |
| 423 } | 452 } |
| 424 } else if (_metadata.isEmpty) { | 453 } else if (_metadata.isEmpty) { |
| 425 return _comment.beginToken; | 454 return _comment.beginToken; |
| 426 } | 455 } |
| 427 Token commentToken = _comment.beginToken; | 456 Token commentToken = _comment.beginToken; |
| 428 Token metadataToken = _metadata.beginToken; | 457 Token metadataToken = _metadata.beginToken; |
| 429 if (commentToken.offset < metadataToken.offset) { | 458 if (commentToken.offset < metadataToken.offset) { |
| 430 return commentToken; | 459 return commentToken; |
| 431 } | 460 } |
| 432 return metadataToken; | 461 return metadataToken; |
| 433 } | 462 } |
| 434 | 463 |
| 435 /** | 464 /** |
| 436 * Return the documentation comment associated with this node, or `null` if th
is node does | 465 * Return the documentation comment associated with this node, or `null` if th
is node does |
| 437 * not have a documentation comment associated with it. | 466 * not have a documentation comment associated with it. |
| 467 * |
| 438 * @return the documentation comment associated with this node | 468 * @return the documentation comment associated with this node |
| 439 */ | 469 */ |
| 440 Comment get documentationComment => _comment; | 470 Comment get documentationComment => _comment; |
| 441 | 471 |
| 442 /** | 472 /** |
| 443 * Return the annotations associated with this node. | 473 * Return the annotations associated with this node. |
| 474 * |
| 444 * @return the annotations associated with this node | 475 * @return the annotations associated with this node |
| 445 */ | 476 */ |
| 446 NodeList<Annotation> get metadata => _metadata; | 477 NodeList<Annotation> get metadata => _metadata; |
| 447 | 478 |
| 448 /** | 479 /** |
| 449 * Set the documentation comment associated with this node to the given commen
t. | 480 * Set the documentation comment associated with this node to the given commen
t. |
| 481 * |
| 450 * @param comment the documentation comment to be associated with this node | 482 * @param comment the documentation comment to be associated with this node |
| 451 */ | 483 */ |
| 452 void set documentationComment(Comment comment2) { | 484 void set documentationComment(Comment comment2) { |
| 453 this._comment = becomeParentOf(comment2); | 485 this._comment = becomeParentOf(comment2); |
| 454 } | 486 } |
| 455 | 487 |
| 456 /** | 488 /** |
| 457 * Set the metadata associated with this node to the given metadata. | 489 * Set the metadata associated with this node to the given metadata. |
| 490 * |
| 458 * @param metadata the metadata to be associated with this node | 491 * @param metadata the metadata to be associated with this node |
| 459 */ | 492 */ |
| 460 void set metadata(List<Annotation> metadata2) { | 493 void set metadata(List<Annotation> metadata2) { |
| 461 this._metadata.clear(); | 494 this._metadata.clear(); |
| 462 this._metadata.addAll(metadata2); | 495 this._metadata.addAll(metadata2); |
| 463 } | 496 } |
| 464 void visitChildren(ASTVisitor<Object> visitor) { | 497 void visitChildren(ASTVisitor<Object> visitor) { |
| 465 if (commentIsBeforeAnnotations()) { | 498 if (commentIsBeforeAnnotations()) { |
| 466 safelyVisitChild(_comment, visitor); | 499 safelyVisitChild(_comment, visitor); |
| 467 _metadata.accept(visitor); | 500 _metadata.accept(visitor); |
| 468 } else { | 501 } else { |
| 469 for (ASTNode child in sortedCommentAndAnnotations) { | 502 for (ASTNode child in sortedCommentAndAnnotations) { |
| 470 child.accept(visitor); | 503 child.accept(visitor); |
| 471 } | 504 } |
| 472 } | 505 } |
| 473 } | 506 } |
| 474 | 507 |
| 475 /** | 508 /** |
| 476 * Return the first token following the comment and metadata. | 509 * Return the first token following the comment and metadata. |
| 510 * |
| 477 * @return the first token following the comment and metadata | 511 * @return the first token following the comment and metadata |
| 478 */ | 512 */ |
| 479 Token get firstTokenAfterCommentAndMetadata; | 513 Token get firstTokenAfterCommentAndMetadata; |
| 480 | 514 |
| 481 /** | 515 /** |
| 482 * Return `true` if the comment is lexically before any annotations. | 516 * Return `true` if the comment is lexically before any annotations. |
| 517 * |
| 483 * @return `true` if the comment is lexically before any annotations | 518 * @return `true` if the comment is lexically before any annotations |
| 484 */ | 519 */ |
| 485 bool commentIsBeforeAnnotations() { | 520 bool commentIsBeforeAnnotations() { |
| 486 if (_comment == null || _metadata.isEmpty) { | 521 if (_comment == null || _metadata.isEmpty) { |
| 487 return true; | 522 return true; |
| 488 } | 523 } |
| 489 Annotation firstAnnotation = _metadata[0]; | 524 Annotation firstAnnotation = _metadata[0]; |
| 490 return _comment.offset < firstAnnotation.offset; | 525 return _comment.offset < firstAnnotation.offset; |
| 491 } | 526 } |
| 492 | 527 |
| 493 /** | 528 /** |
| 494 * Return an array containing the comment and annotations associated with this
node, sorted in | 529 * Return an array containing the comment and annotations associated with this
node, sorted in |
| 495 * lexical order. | 530 * lexical order. |
| 531 * |
| 496 * @return the comment and annotations associated with this node in the order
in which they | 532 * @return the comment and annotations associated with this node in the order
in which they |
| 497 * appeared in the original source | 533 * appeared in the original source |
| 498 */ | 534 */ |
| 499 List<ASTNode> get sortedCommentAndAnnotations { | 535 List<ASTNode> get sortedCommentAndAnnotations { |
| 500 List<ASTNode> childList = new List<ASTNode>(); | 536 List<ASTNode> childList = new List<ASTNode>(); |
| 501 childList.add(_comment); | 537 childList.add(_comment); |
| 502 childList.addAll(_metadata); | 538 childList.addAll(_metadata); |
| 503 List<ASTNode> children = new List.from(childList); | 539 List<ASTNode> children = new List.from(childList); |
| 504 children.sort(ASTNode.LEXICAL_ORDER); | 540 children.sort(ASTNode.LEXICAL_ORDER); |
| 505 return children; | 541 return children; |
| 506 } | 542 } |
| 507 } | 543 } |
| 508 /** | 544 /** |
| 509 * Instances of the class `Annotation` represent an annotation that can be assoc
iated with an | 545 * Instances of the class `Annotation` represent an annotation that can be assoc
iated with an |
| 510 * AST node. | 546 * AST node. |
| 547 * |
| 511 * <pre> | 548 * <pre> |
| 512 * metadata ::= | 549 * metadata ::= |
| 513 * annotation | 550 * annotation* |
| 551 * |
| 514 * annotation ::= | 552 * annotation ::= |
| 515 * '@' [Identifier qualified] ('.' [SimpleIdentifier identifier])? [ArgumentList
arguments]? | 553 * '@' [Identifier] ('.' [SimpleIdentifier])? [ArgumentList]? |
| 516 * </pre> | 554 * </pre> |
| 555 * |
| 517 * @coverage dart.engine.ast | 556 * @coverage dart.engine.ast |
| 518 */ | 557 */ |
| 519 class Annotation extends ASTNode { | 558 class Annotation extends ASTNode { |
| 520 | 559 |
| 521 /** | 560 /** |
| 522 * The at sign that introduced the annotation. | 561 * The at sign that introduced the annotation. |
| 523 */ | 562 */ |
| 524 Token _atSign; | 563 Token _atSign; |
| 525 | 564 |
| 526 /** | 565 /** |
| (...skipping 14 matching lines...) Expand all Loading... |
| 541 */ | 580 */ |
| 542 SimpleIdentifier _constructorName; | 581 SimpleIdentifier _constructorName; |
| 543 | 582 |
| 544 /** | 583 /** |
| 545 * The arguments to the constructor being invoked, or `null` if this annotatio
n is not the | 584 * The arguments to the constructor being invoked, or `null` if this annotatio
n is not the |
| 546 * invocation of a constructor. | 585 * invocation of a constructor. |
| 547 */ | 586 */ |
| 548 ArgumentList _arguments; | 587 ArgumentList _arguments; |
| 549 | 588 |
| 550 /** | 589 /** |
| 590 * The element associated with this annotation, or `null` if the AST structure
has not been |
| 591 * resolved or if this annotation could not be resolved. |
| 592 */ |
| 593 Element _element; |
| 594 |
| 595 /** |
| 551 * Initialize a newly created annotation. | 596 * Initialize a newly created annotation. |
| 597 * |
| 552 * @param atSign the at sign that introduced the annotation | 598 * @param atSign the at sign that introduced the annotation |
| 553 * @param name the name of the class defining the constructor that is being in
voked or the name of | 599 * @param name the name of the class defining the constructor that is being in
voked or the name of |
| 554 * the field that is being referenced | 600 * the field that is being referenced |
| 555 * @param period the period before the constructor name, or `null` if this ann
otation is not | 601 * @param period the period before the constructor name, or `null` if this ann
otation is not |
| 556 * the invocation of a named constructor | 602 * the invocation of a named constructor |
| 557 * @param constructorName the name of the constructor being invoked, or `null`
if this | 603 * @param constructorName the name of the constructor being invoked, or `null`
if this |
| 558 * annotation is not the invocation of a named constructor | 604 * annotation is not the invocation of a named constructor |
| 559 * @param arguments the arguments to the constructor being invoked, or `null`
if this | 605 * @param arguments the arguments to the constructor being invoked, or `null`
if this |
| 560 * annotation is not the invocation of a constructor | 606 * annotation is not the invocation of a constructor |
| 561 */ | 607 */ |
| 562 Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier
constructorName, ArgumentList arguments) { | 608 Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier
constructorName, ArgumentList arguments) { |
| 563 this._atSign = atSign; | 609 this._atSign = atSign; |
| 564 this._name = becomeParentOf(name); | 610 this._name = becomeParentOf(name); |
| 565 this._period = period; | 611 this._period = period; |
| 566 this._constructorName = becomeParentOf(constructorName); | 612 this._constructorName = becomeParentOf(constructorName); |
| 567 this._arguments = becomeParentOf(arguments); | 613 this._arguments = becomeParentOf(arguments); |
| 568 } | 614 } |
| 569 | 615 |
| 570 /** | 616 /** |
| 571 * Initialize a newly created annotation. | 617 * Initialize a newly created annotation. |
| 618 * |
| 572 * @param atSign the at sign that introduced the annotation | 619 * @param atSign the at sign that introduced the annotation |
| 573 * @param name the name of the class defining the constructor that is being in
voked or the name of | 620 * @param name the name of the class defining the constructor that is being in
voked or the name of |
| 574 * the field that is being referenced | 621 * the field that is being referenced |
| 575 * @param period the period before the constructor name, or `null` if this ann
otation is not | 622 * @param period the period before the constructor name, or `null` if this ann
otation is not |
| 576 * the invocation of a named constructor | 623 * the invocation of a named constructor |
| 577 * @param constructorName the name of the constructor being invoked, or `null`
if this | 624 * @param constructorName the name of the constructor being invoked, or `null`
if this |
| 578 * annotation is not the invocation of a named constructor | 625 * annotation is not the invocation of a named constructor |
| 579 * @param arguments the arguments to the constructor being invoked, or `null`
if this | 626 * @param arguments the arguments to the constructor being invoked, or `null`
if this |
| 580 * annotation is not the invocation of a constructor | 627 * annotation is not the invocation of a constructor |
| 581 */ | 628 */ |
| 582 Annotation({Token atSign, Identifier name, Token period, SimpleIdentifier cons
tructorName, ArgumentList arguments}) : this.full(atSign, name, period, construc
torName, arguments); | 629 Annotation({Token atSign, Identifier name, Token period, SimpleIdentifier cons
tructorName, ArgumentList arguments}) : this.full(atSign, name, period, construc
torName, arguments); |
| 583 accept(ASTVisitor visitor) => visitor.visitAnnotation(this); | 630 accept(ASTVisitor visitor) => visitor.visitAnnotation(this); |
| 584 | 631 |
| 585 /** | 632 /** |
| 586 * Return the arguments to the constructor being invoked, or `null` if this an
notation is | 633 * Return the arguments to the constructor being invoked, or `null` if this an
notation is |
| 587 * not the invocation of a constructor. | 634 * not the invocation of a constructor. |
| 635 * |
| 588 * @return the arguments to the constructor being invoked | 636 * @return the arguments to the constructor being invoked |
| 589 */ | 637 */ |
| 590 ArgumentList get arguments => _arguments; | 638 ArgumentList get arguments => _arguments; |
| 591 | 639 |
| 592 /** | 640 /** |
| 593 * Return the at sign that introduced the annotation. | 641 * Return the at sign that introduced the annotation. |
| 642 * |
| 594 * @return the at sign that introduced the annotation | 643 * @return the at sign that introduced the annotation |
| 595 */ | 644 */ |
| 596 Token get atSign => _atSign; | 645 Token get atSign => _atSign; |
| 597 Token get beginToken => _atSign; | 646 Token get beginToken => _atSign; |
| 598 | 647 |
| 599 /** | 648 /** |
| 600 * Return the name of the constructor being invoked, or `null` if this annotat
ion is not the | 649 * Return the name of the constructor being invoked, or `null` if this annotat
ion is not the |
| 601 * invocation of a named constructor. | 650 * invocation of a named constructor. |
| 651 * |
| 602 * @return the name of the constructor being invoked | 652 * @return the name of the constructor being invoked |
| 603 */ | 653 */ |
| 604 SimpleIdentifier get constructorName => _constructorName; | 654 SimpleIdentifier get constructorName => _constructorName; |
| 605 | 655 |
| 606 /** | 656 /** |
| 607 * Return the element associated with this annotation, or `null` if the AST st
ructure has | 657 * Return the element associated with this annotation, or `null` if the AST st
ructure has |
| 608 * not been resolved or if this annotation could not be resolved. | 658 * not been resolved or if this annotation could not be resolved. |
| 659 * |
| 609 * @return the element associated with this annotation | 660 * @return the element associated with this annotation |
| 610 */ | 661 */ |
| 611 Element get element { | 662 Element get element { |
| 612 if (_constructorName != null) { | 663 if (_element != null) { |
| 613 return _constructorName.element; | 664 return _element; |
| 614 } else if (_name != null) { | 665 } |
| 666 if (_name != null) { |
| 615 return _name.element; | 667 return _name.element; |
| 616 } | 668 } |
| 617 return null; | 669 return null; |
| 618 } | 670 } |
| 619 Token get endToken { | 671 Token get endToken { |
| 620 if (_arguments != null) { | 672 if (_arguments != null) { |
| 621 return _arguments.endToken; | 673 return _arguments.endToken; |
| 622 } else if (_constructorName != null) { | 674 } else if (_constructorName != null) { |
| 623 return _constructorName.endToken; | 675 return _constructorName.endToken; |
| 624 } | 676 } |
| 625 return _name.endToken; | 677 return _name.endToken; |
| 626 } | 678 } |
| 627 | 679 |
| 628 /** | 680 /** |
| 629 * Return the name of the class defining the constructor that is being invoked
or the name of the | 681 * Return the name of the class defining the constructor that is being invoked
or the name of the |
| 630 * field that is being referenced. | 682 * field that is being referenced. |
| 683 * |
| 631 * @return the name of the constructor being invoked or the name of the field
being referenced | 684 * @return the name of the constructor being invoked or the name of the field
being referenced |
| 632 */ | 685 */ |
| 633 Identifier get name => _name; | 686 Identifier get name => _name; |
| 634 | 687 |
| 635 /** | 688 /** |
| 636 * Return the period before the constructor name, or `null` if this annotation
is not the | 689 * Return the period before the constructor name, or `null` if this annotation
is not the |
| 637 * invocation of a named constructor. | 690 * invocation of a named constructor. |
| 691 * |
| 638 * @return the period before the constructor name | 692 * @return the period before the constructor name |
| 639 */ | 693 */ |
| 640 Token get period => _period; | 694 Token get period => _period; |
| 641 | 695 |
| 642 /** | 696 /** |
| 643 * Set the arguments to the constructor being invoked to the given arguments. | 697 * Set the arguments to the constructor being invoked to the given arguments. |
| 698 * |
| 644 * @param arguments the arguments to the constructor being invoked | 699 * @param arguments the arguments to the constructor being invoked |
| 645 */ | 700 */ |
| 646 void set arguments(ArgumentList arguments2) { | 701 void set arguments(ArgumentList arguments2) { |
| 647 this._arguments = becomeParentOf(arguments2); | 702 this._arguments = becomeParentOf(arguments2); |
| 648 } | 703 } |
| 649 | 704 |
| 650 /** | 705 /** |
| 651 * Set the at sign that introduced the annotation to the given token. | 706 * Set the at sign that introduced the annotation to the given token. |
| 707 * |
| 652 * @param atSign the at sign that introduced the annotation | 708 * @param atSign the at sign that introduced the annotation |
| 653 */ | 709 */ |
| 654 void set atSign(Token atSign2) { | 710 void set atSign(Token atSign2) { |
| 655 this._atSign = atSign2; | 711 this._atSign = atSign2; |
| 656 } | 712 } |
| 657 | 713 |
| 658 /** | 714 /** |
| 659 * Set the name of the constructor being invoked to the given name. | 715 * Set the name of the constructor being invoked to the given name. |
| 716 * |
| 660 * @param constructorName the name of the constructor being invoked | 717 * @param constructorName the name of the constructor being invoked |
| 661 */ | 718 */ |
| 662 void set constructorName(SimpleIdentifier constructorName2) { | 719 void set constructorName(SimpleIdentifier constructorName2) { |
| 663 this._constructorName = becomeParentOf(constructorName2); | 720 this._constructorName = becomeParentOf(constructorName2); |
| 664 } | 721 } |
| 665 | 722 |
| 666 /** | 723 /** |
| 724 * Set the element associated with this annotation based. |
| 725 * |
| 726 * @param element the element to be associated with this identifier |
| 727 */ |
| 728 void set element(Element element2) { |
| 729 this._element = element2; |
| 730 } |
| 731 |
| 732 /** |
| 667 * Set the name of the class defining the constructor that is being invoked or
the name of the | 733 * Set the name of the class defining the constructor that is being invoked or
the name of the |
| 668 * field that is being referenced to the given name. | 734 * field that is being referenced to the given name. |
| 735 * |
| 669 * @param name the name of the constructor being invoked or the name of the fi
eld being referenced | 736 * @param name the name of the constructor being invoked or the name of the fi
eld being referenced |
| 670 */ | 737 */ |
| 671 void set name(Identifier name2) { | 738 void set name(Identifier name2) { |
| 672 this._name = becomeParentOf(name2); | 739 this._name = becomeParentOf(name2); |
| 673 } | 740 } |
| 674 | 741 |
| 675 /** | 742 /** |
| 676 * Set the period before the constructor name to the given token. | 743 * Set the period before the constructor name to the given token. |
| 744 * |
| 677 * @param period the period before the constructor name | 745 * @param period the period before the constructor name |
| 678 */ | 746 */ |
| 679 void set period(Token period2) { | 747 void set period(Token period2) { |
| 680 this._period = period2; | 748 this._period = period2; |
| 681 } | 749 } |
| 682 void visitChildren(ASTVisitor<Object> visitor) { | 750 void visitChildren(ASTVisitor<Object> visitor) { |
| 683 safelyVisitChild(_name, visitor); | 751 safelyVisitChild(_name, visitor); |
| 684 safelyVisitChild(_constructorName, visitor); | 752 safelyVisitChild(_constructorName, visitor); |
| 685 safelyVisitChild(_arguments, visitor); | 753 safelyVisitChild(_arguments, visitor); |
| 686 } | 754 } |
| 687 } | 755 } |
| 688 /** | 756 /** |
| 689 * Instances of the class `ArgumentDefinitionTest` represent an argument definit
ion test. | 757 * Instances of the class `ArgumentDefinitionTest` represent an argument definit
ion test. |
| 758 * |
| 690 * <pre> | 759 * <pre> |
| 691 * argumentDefinitionTest ::= | 760 * argumentDefinitionTest ::= |
| 692 * '?' [SimpleIdentifier identifier]</pre> | 761 * '?' [SimpleIdentifier] |
| 762 * </pre> |
| 763 * |
| 693 * @coverage dart.engine.ast | 764 * @coverage dart.engine.ast |
| 694 */ | 765 */ |
| 695 class ArgumentDefinitionTest extends Expression { | 766 class ArgumentDefinitionTest extends Expression { |
| 696 | 767 |
| 697 /** | 768 /** |
| 698 * The token representing the question mark. | 769 * The token representing the question mark. |
| 699 */ | 770 */ |
| 700 Token _question; | 771 Token _question; |
| 701 | 772 |
| 702 /** | 773 /** |
| 703 * The identifier representing the argument being tested. | 774 * The identifier representing the argument being tested. |
| 704 */ | 775 */ |
| 705 SimpleIdentifier _identifier; | 776 SimpleIdentifier _identifier; |
| 706 | 777 |
| 707 /** | 778 /** |
| 708 * Initialize a newly created argument definition test. | 779 * Initialize a newly created argument definition test. |
| 780 * |
| 709 * @param question the token representing the question mark | 781 * @param question the token representing the question mark |
| 710 * @param identifier the identifier representing the argument being tested | 782 * @param identifier the identifier representing the argument being tested |
| 711 */ | 783 */ |
| 712 ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) { | 784 ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) { |
| 713 this._question = question; | 785 this._question = question; |
| 714 this._identifier = becomeParentOf(identifier); | 786 this._identifier = becomeParentOf(identifier); |
| 715 } | 787 } |
| 716 | 788 |
| 717 /** | 789 /** |
| 718 * Initialize a newly created argument definition test. | 790 * Initialize a newly created argument definition test. |
| 791 * |
| 719 * @param question the token representing the question mark | 792 * @param question the token representing the question mark |
| 720 * @param identifier the identifier representing the argument being tested | 793 * @param identifier the identifier representing the argument being tested |
| 721 */ | 794 */ |
| 722 ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.f
ull(question, identifier); | 795 ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.f
ull(question, identifier); |
| 723 accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this); | 796 accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this); |
| 724 Token get beginToken => _question; | 797 Token get beginToken => _question; |
| 725 Token get endToken => _identifier.endToken; | 798 Token get endToken => _identifier.endToken; |
| 726 | 799 |
| 727 /** | 800 /** |
| 728 * Return the identifier representing the argument being tested. | 801 * Return the identifier representing the argument being tested. |
| 802 * |
| 729 * @return the identifier representing the argument being tested | 803 * @return the identifier representing the argument being tested |
| 730 */ | 804 */ |
| 731 SimpleIdentifier get identifier => _identifier; | 805 SimpleIdentifier get identifier => _identifier; |
| 732 | 806 |
| 733 /** | 807 /** |
| 734 * Return the token representing the question mark. | 808 * Return the token representing the question mark. |
| 809 * |
| 735 * @return the token representing the question mark | 810 * @return the token representing the question mark |
| 736 */ | 811 */ |
| 737 Token get question => _question; | 812 Token get question => _question; |
| 738 | 813 |
| 739 /** | 814 /** |
| 740 * Set the identifier representing the argument being tested to the given iden
tifier. | 815 * Set the identifier representing the argument being tested to the given iden
tifier. |
| 816 * |
| 741 * @param identifier the identifier representing the argument being tested | 817 * @param identifier the identifier representing the argument being tested |
| 742 */ | 818 */ |
| 743 void set identifier(SimpleIdentifier identifier2) { | 819 void set identifier(SimpleIdentifier identifier2) { |
| 744 this._identifier = becomeParentOf(identifier2); | 820 this._identifier = becomeParentOf(identifier2); |
| 745 } | 821 } |
| 746 | 822 |
| 747 /** | 823 /** |
| 748 * Set the token representing the question mark to the given token. | 824 * Set the token representing the question mark to the given token. |
| 825 * |
| 749 * @param question the token representing the question mark | 826 * @param question the token representing the question mark |
| 750 */ | 827 */ |
| 751 void set question(Token question2) { | 828 void set question(Token question2) { |
| 752 this._question = question2; | 829 this._question = question2; |
| 753 } | 830 } |
| 754 void visitChildren(ASTVisitor<Object> visitor) { | 831 void visitChildren(ASTVisitor<Object> visitor) { |
| 755 safelyVisitChild(_identifier, visitor); | 832 safelyVisitChild(_identifier, visitor); |
| 756 } | 833 } |
| 757 } | 834 } |
| 758 /** | 835 /** |
| 759 * Instances of the class `ArgumentList` represent a list of arguments in the in
vocation of a | 836 * Instances of the class `ArgumentList` represent a list of arguments in the in
vocation of a |
| 760 * executable element: a function, method, or constructor. | 837 * executable element: a function, method, or constructor. |
| 838 * |
| 761 * <pre> | 839 * <pre> |
| 762 * argumentList ::= | 840 * argumentList ::= |
| 763 * '(' arguments? ')' | 841 * '(' arguments? ')' |
| 764 * arguments ::=[NamedExpression namedArgument] (',' [NamedExpression namedArgum
ent]) | 842 * |
| 765 * | [Expression expressionList] (',' [NamedExpression namedArgument]) | 843 * arguments ::= |
| 844 * [NamedExpression] (',' [NamedExpression])* |
| 845 * | [Expression] (',' [NamedExpression])* |
| 766 * </pre> | 846 * </pre> |
| 847 * |
| 767 * @coverage dart.engine.ast | 848 * @coverage dart.engine.ast |
| 768 */ | 849 */ |
| 769 class ArgumentList extends ASTNode { | 850 class ArgumentList extends ASTNode { |
| 770 | 851 |
| 771 /** | 852 /** |
| 772 * The left parenthesis. | 853 * The left parenthesis. |
| 773 */ | 854 */ |
| 774 Token _leftParenthesis; | 855 Token _leftParenthesis; |
| 775 | 856 |
| 776 /** | 857 /** |
| (...skipping 19 matching lines...) Expand all Loading... |
| 796 * An array containing the elements representing the parameters corresponding
to each of the | 877 * An array containing the elements representing the parameters corresponding
to each of the |
| 797 * arguments in this list, or `null` if the AST has not been resolved or if th
e function or | 878 * arguments in this list, or `null` if the AST has not been resolved or if th
e function or |
| 798 * method being invoked could not be determined based on propagated type infor
mation. The array | 879 * method being invoked could not be determined based on propagated type infor
mation. The array |
| 799 * must be the same length as the number of arguments, but can contain `null`
entries if a | 880 * must be the same length as the number of arguments, but can contain `null`
entries if a |
| 800 * given argument does not correspond to a formal parameter. | 881 * given argument does not correspond to a formal parameter. |
| 801 */ | 882 */ |
| 802 List<ParameterElement> _correspondingPropagatedParameters; | 883 List<ParameterElement> _correspondingPropagatedParameters; |
| 803 | 884 |
| 804 /** | 885 /** |
| 805 * Initialize a newly created list of arguments. | 886 * Initialize a newly created list of arguments. |
| 887 * |
| 806 * @param leftParenthesis the left parenthesis | 888 * @param leftParenthesis the left parenthesis |
| 807 * @param arguments the expressions producing the values of the arguments | 889 * @param arguments the expressions producing the values of the arguments |
| 808 * @param rightParenthesis the right parenthesis | 890 * @param rightParenthesis the right parenthesis |
| 809 */ | 891 */ |
| 810 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig
htParenthesis) { | 892 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig
htParenthesis) { |
| 811 this._arguments = new NodeList<Expression>(this); | 893 this._arguments = new NodeList<Expression>(this); |
| 812 this._leftParenthesis = leftParenthesis; | 894 this._leftParenthesis = leftParenthesis; |
| 813 this._arguments.addAll(arguments); | 895 this._arguments.addAll(arguments); |
| 814 this._rightParenthesis = rightParenthesis; | 896 this._rightParenthesis = rightParenthesis; |
| 815 } | 897 } |
| 816 | 898 |
| 817 /** | 899 /** |
| 818 * Initialize a newly created list of arguments. | 900 * Initialize a newly created list of arguments. |
| 901 * |
| 819 * @param leftParenthesis the left parenthesis | 902 * @param leftParenthesis the left parenthesis |
| 820 * @param arguments the expressions producing the values of the arguments | 903 * @param arguments the expressions producing the values of the arguments |
| 821 * @param rightParenthesis the right parenthesis | 904 * @param rightParenthesis the right parenthesis |
| 822 */ | 905 */ |
| 823 ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightPa
renthesis}) : this.full(leftParenthesis, arguments, rightParenthesis); | 906 ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightPa
renthesis}) : this.full(leftParenthesis, arguments, rightParenthesis); |
| 824 accept(ASTVisitor visitor) => visitor.visitArgumentList(this); | 907 accept(ASTVisitor visitor) => visitor.visitArgumentList(this); |
| 825 | 908 |
| 826 /** | 909 /** |
| 827 * Return the expressions producing the values of the arguments. Although the
language requires | 910 * Return the expressions producing the values of the arguments. Although the
language requires |
| 828 * that positional arguments appear before named arguments, this class allows
them to be | 911 * that positional arguments appear before named arguments, this class allows
them to be |
| 829 * intermixed. | 912 * intermixed. |
| 913 * |
| 830 * @return the expressions producing the values of the arguments | 914 * @return the expressions producing the values of the arguments |
| 831 */ | 915 */ |
| 832 NodeList<Expression> get arguments => _arguments; | 916 NodeList<Expression> get arguments => _arguments; |
| 833 Token get beginToken => _leftParenthesis; | 917 Token get beginToken => _leftParenthesis; |
| 834 Token get endToken => _rightParenthesis; | 918 Token get endToken => _rightParenthesis; |
| 835 | 919 |
| 836 /** | 920 /** |
| 837 * Return the left parenthesis. | 921 * Return the left parenthesis. |
| 922 * |
| 838 * @return the left parenthesis | 923 * @return the left parenthesis |
| 839 */ | 924 */ |
| 840 Token get leftParenthesis => _leftParenthesis; | 925 Token get leftParenthesis => _leftParenthesis; |
| 841 | 926 |
| 842 /** | 927 /** |
| 843 * Return the right parenthesis. | 928 * Return the right parenthesis. |
| 929 * |
| 844 * @return the right parenthesis | 930 * @return the right parenthesis |
| 845 */ | 931 */ |
| 846 Token get rightParenthesis => _rightParenthesis; | 932 Token get rightParenthesis => _rightParenthesis; |
| 847 | 933 |
| 848 /** | 934 /** |
| 849 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given | 935 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given |
| 850 * array of parameters. The array of parameters must be the same length as the
number of | 936 * array of parameters. The array of parameters must be the same length as the
number of |
| 851 * arguments, but can contain `null` entries if a given argument does not corr
espond to a | 937 * arguments, but can contain `null` entries if a given argument does not corr
espond to a |
| 852 * formal parameter. | 938 * formal parameter. |
| 939 * |
| 853 * @param parameters the parameter elements corresponding to the arguments | 940 * @param parameters the parameter elements corresponding to the arguments |
| 854 */ | 941 */ |
| 855 void set correspondingParameters(List<ParameterElement> parameters) { | 942 void set correspondingParameters(List<ParameterElement> parameters) { |
| 856 if (parameters.length != _arguments.length) { | 943 if (parameters.length != _arguments.length) { |
| 857 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); | 944 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); |
| 858 } | 945 } |
| 859 _correspondingPropagatedParameters = parameters; | 946 _correspondingPropagatedParameters = parameters; |
| 860 } | 947 } |
| 861 | 948 |
| 862 /** | 949 /** |
| 863 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given | 950 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given |
| 864 * array of parameters. The array of parameters must be the same length as the
number of | 951 * array of parameters. The array of parameters must be the same length as the
number of |
| 865 * arguments, but can contain `null` entries if a given argument does not corr
espond to a | 952 * arguments, but can contain `null` entries if a given argument does not corr
espond to a |
| 866 * formal parameter. | 953 * formal parameter. |
| 954 * |
| 867 * @param parameters the parameter elements corresponding to the arguments | 955 * @param parameters the parameter elements corresponding to the arguments |
| 868 */ | 956 */ |
| 869 void set correspondingStaticParameters(List<ParameterElement> parameters) { | 957 void set correspondingStaticParameters(List<ParameterElement> parameters) { |
| 870 if (parameters.length != _arguments.length) { | 958 if (parameters.length != _arguments.length) { |
| 871 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); | 959 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); |
| 872 } | 960 } |
| 873 _correspondingStaticParameters = parameters; | 961 _correspondingStaticParameters = parameters; |
| 874 } | 962 } |
| 875 | 963 |
| 876 /** | 964 /** |
| 877 * Set the left parenthesis to the given token. | 965 * Set the left parenthesis to the given token. |
| 966 * |
| 878 * @param parenthesis the left parenthesis | 967 * @param parenthesis the left parenthesis |
| 879 */ | 968 */ |
| 880 void set leftParenthesis(Token parenthesis) { | 969 void set leftParenthesis(Token parenthesis) { |
| 881 _leftParenthesis = parenthesis; | 970 _leftParenthesis = parenthesis; |
| 882 } | 971 } |
| 883 | 972 |
| 884 /** | 973 /** |
| 885 * Set the right parenthesis to the given token. | 974 * Set the right parenthesis to the given token. |
| 975 * |
| 886 * @param parenthesis the right parenthesis | 976 * @param parenthesis the right parenthesis |
| 887 */ | 977 */ |
| 888 void set rightParenthesis(Token parenthesis) { | 978 void set rightParenthesis(Token parenthesis) { |
| 889 _rightParenthesis = parenthesis; | 979 _rightParenthesis = parenthesis; |
| 890 } | 980 } |
| 891 void visitChildren(ASTVisitor<Object> visitor) { | 981 void visitChildren(ASTVisitor<Object> visitor) { |
| 892 _arguments.accept(visitor); | 982 _arguments.accept(visitor); |
| 893 } | 983 } |
| 894 | 984 |
| 895 /** | 985 /** |
| 896 * If the given expression is a child of this list, and the AST structure has
been resolved, and | 986 * If the given expression is a child of this list, and the AST structure has
been resolved, and |
| 897 * the function being invoked is known based on propagated type information, a
nd the expression | 987 * the function being invoked is known based on propagated type information, a
nd the expression |
| 898 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter | 988 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter |
| 899 * element representing the parameter to which the value of the given expressi
on will be bound. | 989 * element representing the parameter to which the value of the given expressi
on will be bound. |
| 900 * Otherwise, return `null`. | 990 * Otherwise, return `null`. |
| 901 * | 991 * |
| 902 * This method is only intended to be used by [Expression#getParameterElement]
. | 992 * This method is only intended to be used by [Expression#getParameterElement]
. |
| 993 * |
| 903 * @param expression the expression corresponding to the parameter to be retur
ned | 994 * @param expression the expression corresponding to the parameter to be retur
ned |
| 904 * @return the parameter element representing the parameter to which the value
of the expression | 995 * @return the parameter element representing the parameter to which the value
of the expression |
| 905 * will be bound | 996 * will be bound |
| 906 */ | 997 */ |
| 907 ParameterElement getPropagatedParameterElementFor(Expression expression) { | 998 ParameterElement getPropagatedParameterElementFor(Expression expression) { |
| 908 if (_correspondingPropagatedParameters == null) { | 999 if (_correspondingPropagatedParameters == null) { |
| 909 return null; | 1000 return null; |
| 910 } | 1001 } |
| 911 int index = _arguments.indexOf(expression); | 1002 int index = _arguments.indexOf(expression); |
| 912 if (index < 0) { | 1003 if (index < 0) { |
| 913 return null; | 1004 return null; |
| 914 } | 1005 } |
| 915 return _correspondingPropagatedParameters[index]; | 1006 return _correspondingPropagatedParameters[index]; |
| 916 } | 1007 } |
| 917 | 1008 |
| 918 /** | 1009 /** |
| 919 * If the given expression is a child of this list, and the AST structure has
been resolved, and | 1010 * If the given expression is a child of this list, and the AST structure has
been resolved, and |
| 920 * the function being invoked is known based on static type information, and t
he expression | 1011 * the function being invoked is known based on static type information, and t
he expression |
| 921 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter | 1012 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter |
| 922 * element representing the parameter to which the value of the given expressi
on will be bound. | 1013 * element representing the parameter to which the value of the given expressi
on will be bound. |
| 923 * Otherwise, return `null`. | 1014 * Otherwise, return `null`. |
| 924 * | 1015 * |
| 925 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. | 1016 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. |
| 1017 * |
| 926 * @param expression the expression corresponding to the parameter to be retur
ned | 1018 * @param expression the expression corresponding to the parameter to be retur
ned |
| 927 * @return the parameter element representing the parameter to which the value
of the expression | 1019 * @return the parameter element representing the parameter to which the value
of the expression |
| 928 * will be bound | 1020 * will be bound |
| 929 */ | 1021 */ |
| 930 ParameterElement getStaticParameterElementFor(Expression expression) { | 1022 ParameterElement getStaticParameterElementFor(Expression expression) { |
| 931 if (_correspondingStaticParameters == null) { | 1023 if (_correspondingStaticParameters == null) { |
| 932 return null; | 1024 return null; |
| 933 } | 1025 } |
| 934 int index = _arguments.indexOf(expression); | 1026 int index = _arguments.indexOf(expression); |
| 935 if (index < 0) { | 1027 if (index < 0) { |
| 936 return null; | 1028 return null; |
| 937 } | 1029 } |
| 938 return _correspondingStaticParameters[index]; | 1030 return _correspondingStaticParameters[index]; |
| 939 } | 1031 } |
| 940 } | 1032 } |
| 941 /** | 1033 /** |
| 942 * Instances of the class `AsExpression` represent an 'as' expression. | 1034 * Instances of the class `AsExpression` represent an 'as' expression. |
| 1035 * |
| 943 * <pre> | 1036 * <pre> |
| 944 * asExpression ::=[Expression expression] 'as' [TypeName type]</pre> | 1037 * asExpression ::= |
| 1038 * [Expression] 'as' [TypeName] |
| 1039 * </pre> |
| 1040 * |
| 945 * @coverage dart.engine.ast | 1041 * @coverage dart.engine.ast |
| 946 */ | 1042 */ |
| 947 class AsExpression extends Expression { | 1043 class AsExpression extends Expression { |
| 948 | 1044 |
| 949 /** | 1045 /** |
| 950 * The expression used to compute the value being cast. | 1046 * The expression used to compute the value being cast. |
| 951 */ | 1047 */ |
| 952 Expression _expression; | 1048 Expression _expression; |
| 953 | 1049 |
| 954 /** | 1050 /** |
| 955 * The as operator. | 1051 * The as operator. |
| 956 */ | 1052 */ |
| 957 Token _asOperator; | 1053 Token _asOperator; |
| 958 | 1054 |
| 959 /** | 1055 /** |
| 960 * The name of the type being cast to. | 1056 * The name of the type being cast to. |
| 961 */ | 1057 */ |
| 962 TypeName _type; | 1058 TypeName _type; |
| 963 | 1059 |
| 964 /** | 1060 /** |
| 965 * Initialize a newly created as expression. | 1061 * Initialize a newly created as expression. |
| 1062 * |
| 966 * @param expression the expression used to compute the value being cast | 1063 * @param expression the expression used to compute the value being cast |
| 967 * @param isOperator the is operator | 1064 * @param isOperator the is operator |
| 968 * @param type the name of the type being cast to | 1065 * @param type the name of the type being cast to |
| 969 */ | 1066 */ |
| 970 AsExpression.full(Expression expression, Token isOperator, TypeName type) { | 1067 AsExpression.full(Expression expression, Token isOperator, TypeName type) { |
| 971 this._expression = becomeParentOf(expression); | 1068 this._expression = becomeParentOf(expression); |
| 972 this._asOperator = isOperator; | 1069 this._asOperator = isOperator; |
| 973 this._type = becomeParentOf(type); | 1070 this._type = becomeParentOf(type); |
| 974 } | 1071 } |
| 975 | 1072 |
| 976 /** | 1073 /** |
| 977 * Initialize a newly created as expression. | 1074 * Initialize a newly created as expression. |
| 1075 * |
| 978 * @param expression the expression used to compute the value being cast | 1076 * @param expression the expression used to compute the value being cast |
| 979 * @param isOperator the is operator | 1077 * @param isOperator the is operator |
| 980 * @param type the name of the type being cast to | 1078 * @param type the name of the type being cast to |
| 981 */ | 1079 */ |
| 982 AsExpression({Expression expression, Token isOperator, TypeName type}) : this.
full(expression, isOperator, type); | 1080 AsExpression({Expression expression, Token isOperator, TypeName type}) : this.
full(expression, isOperator, type); |
| 983 accept(ASTVisitor visitor) => visitor.visitAsExpression(this); | 1081 accept(ASTVisitor visitor) => visitor.visitAsExpression(this); |
| 984 | 1082 |
| 985 /** | 1083 /** |
| 986 * Return the is operator being applied. | 1084 * Return the is operator being applied. |
| 1085 * |
| 987 * @return the is operator being applied | 1086 * @return the is operator being applied |
| 988 */ | 1087 */ |
| 989 Token get asOperator => _asOperator; | 1088 Token get asOperator => _asOperator; |
| 990 Token get beginToken => _expression.beginToken; | 1089 Token get beginToken => _expression.beginToken; |
| 991 Token get endToken => _type.endToken; | 1090 Token get endToken => _type.endToken; |
| 992 | 1091 |
| 993 /** | 1092 /** |
| 994 * Return the expression used to compute the value being cast. | 1093 * Return the expression used to compute the value being cast. |
| 1094 * |
| 995 * @return the expression used to compute the value being cast | 1095 * @return the expression used to compute the value being cast |
| 996 */ | 1096 */ |
| 997 Expression get expression => _expression; | 1097 Expression get expression => _expression; |
| 998 | 1098 |
| 999 /** | 1099 /** |
| 1000 * Return the name of the type being cast to. | 1100 * Return the name of the type being cast to. |
| 1101 * |
| 1001 * @return the name of the type being cast to | 1102 * @return the name of the type being cast to |
| 1002 */ | 1103 */ |
| 1003 TypeName get type => _type; | 1104 TypeName get type => _type; |
| 1004 | 1105 |
| 1005 /** | 1106 /** |
| 1006 * Set the is operator being applied to the given operator. | 1107 * Set the is operator being applied to the given operator. |
| 1108 * |
| 1007 * @param asOperator the is operator being applied | 1109 * @param asOperator the is operator being applied |
| 1008 */ | 1110 */ |
| 1009 void set asOperator(Token asOperator2) { | 1111 void set asOperator(Token asOperator2) { |
| 1010 this._asOperator = asOperator2; | 1112 this._asOperator = asOperator2; |
| 1011 } | 1113 } |
| 1012 | 1114 |
| 1013 /** | 1115 /** |
| 1014 * Set the expression used to compute the value being cast to the given expres
sion. | 1116 * Set the expression used to compute the value being cast to the given expres
sion. |
| 1117 * |
| 1015 * @param expression the expression used to compute the value being cast | 1118 * @param expression the expression used to compute the value being cast |
| 1016 */ | 1119 */ |
| 1017 void set expression(Expression expression2) { | 1120 void set expression(Expression expression2) { |
| 1018 this._expression = becomeParentOf(expression2); | 1121 this._expression = becomeParentOf(expression2); |
| 1019 } | 1122 } |
| 1020 | 1123 |
| 1021 /** | 1124 /** |
| 1022 * Set the name of the type being cast to to the given name. | 1125 * Set the name of the type being cast to to the given name. |
| 1126 * |
| 1023 * @param name the name of the type being cast to | 1127 * @param name the name of the type being cast to |
| 1024 */ | 1128 */ |
| 1025 void set type(TypeName name) { | 1129 void set type(TypeName name) { |
| 1026 this._type = becomeParentOf(name); | 1130 this._type = becomeParentOf(name); |
| 1027 } | 1131 } |
| 1028 void visitChildren(ASTVisitor<Object> visitor) { | 1132 void visitChildren(ASTVisitor<Object> visitor) { |
| 1029 safelyVisitChild(_expression, visitor); | 1133 safelyVisitChild(_expression, visitor); |
| 1030 safelyVisitChild(_type, visitor); | 1134 safelyVisitChild(_type, visitor); |
| 1031 } | 1135 } |
| 1032 } | 1136 } |
| 1033 /** | 1137 /** |
| 1034 * Instances of the class `AssertStatement` represent an assert statement. | 1138 * Instances of the class `AssertStatement` represent an assert statement. |
| 1139 * |
| 1035 * <pre> | 1140 * <pre> |
| 1036 * assertStatement ::= | 1141 * assertStatement ::= |
| 1037 * 'assert' '(' [Expression conditionalExpression] ')' ';' | 1142 * 'assert' '(' [Expression] ')' ';' |
| 1038 * </pre> | 1143 * </pre> |
| 1144 * |
| 1039 * @coverage dart.engine.ast | 1145 * @coverage dart.engine.ast |
| 1040 */ | 1146 */ |
| 1041 class AssertStatement extends Statement { | 1147 class AssertStatement extends Statement { |
| 1042 | 1148 |
| 1043 /** | 1149 /** |
| 1044 * The token representing the 'assert' keyword. | 1150 * The token representing the 'assert' keyword. |
| 1045 */ | 1151 */ |
| 1046 Token _keyword; | 1152 Token _keyword; |
| 1047 | 1153 |
| 1048 /** | 1154 /** |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1060 */ | 1166 */ |
| 1061 Token _rightParenthesis; | 1167 Token _rightParenthesis; |
| 1062 | 1168 |
| 1063 /** | 1169 /** |
| 1064 * The semicolon terminating the statement. | 1170 * The semicolon terminating the statement. |
| 1065 */ | 1171 */ |
| 1066 Token _semicolon; | 1172 Token _semicolon; |
| 1067 | 1173 |
| 1068 /** | 1174 /** |
| 1069 * Initialize a newly created assert statement. | 1175 * Initialize a newly created assert statement. |
| 1176 * |
| 1070 * @param keyword the token representing the 'assert' keyword | 1177 * @param keyword the token representing the 'assert' keyword |
| 1071 * @param leftParenthesis the left parenthesis | 1178 * @param leftParenthesis the left parenthesis |
| 1072 * @param condition the condition that is being asserted to be `true` | 1179 * @param condition the condition that is being asserted to be `true` |
| 1073 * @param rightParenthesis the right parenthesis | 1180 * @param rightParenthesis the right parenthesis |
| 1074 * @param semicolon the semicolon terminating the statement | 1181 * @param semicolon the semicolon terminating the statement |
| 1075 */ | 1182 */ |
| 1076 AssertStatement.full(Token keyword, Token leftParenthesis, Expression conditio
n, Token rightParenthesis, Token semicolon) { | 1183 AssertStatement.full(Token keyword, Token leftParenthesis, Expression conditio
n, Token rightParenthesis, Token semicolon) { |
| 1077 this._keyword = keyword; | 1184 this._keyword = keyword; |
| 1078 this._leftParenthesis = leftParenthesis; | 1185 this._leftParenthesis = leftParenthesis; |
| 1079 this._condition = becomeParentOf(condition); | 1186 this._condition = becomeParentOf(condition); |
| 1080 this._rightParenthesis = rightParenthesis; | 1187 this._rightParenthesis = rightParenthesis; |
| 1081 this._semicolon = semicolon; | 1188 this._semicolon = semicolon; |
| 1082 } | 1189 } |
| 1083 | 1190 |
| 1084 /** | 1191 /** |
| 1085 * Initialize a newly created assert statement. | 1192 * Initialize a newly created assert statement. |
| 1193 * |
| 1086 * @param keyword the token representing the 'assert' keyword | 1194 * @param keyword the token representing the 'assert' keyword |
| 1087 * @param leftParenthesis the left parenthesis | 1195 * @param leftParenthesis the left parenthesis |
| 1088 * @param condition the condition that is being asserted to be `true` | 1196 * @param condition the condition that is being asserted to be `true` |
| 1089 * @param rightParenthesis the right parenthesis | 1197 * @param rightParenthesis the right parenthesis |
| 1090 * @param semicolon the semicolon terminating the statement | 1198 * @param semicolon the semicolon terminating the statement |
| 1091 */ | 1199 */ |
| 1092 AssertStatement({Token keyword, Token leftParenthesis, Expression condition, T
oken rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, c
ondition, rightParenthesis, semicolon); | 1200 AssertStatement({Token keyword, Token leftParenthesis, Expression condition, T
oken rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, c
ondition, rightParenthesis, semicolon); |
| 1093 accept(ASTVisitor visitor) => visitor.visitAssertStatement(this); | 1201 accept(ASTVisitor visitor) => visitor.visitAssertStatement(this); |
| 1094 Token get beginToken => _keyword; | 1202 Token get beginToken => _keyword; |
| 1095 | 1203 |
| 1096 /** | 1204 /** |
| 1097 * Return the condition that is being asserted to be `true`. | 1205 * Return the condition that is being asserted to be `true`. |
| 1206 * |
| 1098 * @return the condition that is being asserted to be `true` | 1207 * @return the condition that is being asserted to be `true` |
| 1099 */ | 1208 */ |
| 1100 Expression get condition => _condition; | 1209 Expression get condition => _condition; |
| 1101 Token get endToken => _semicolon; | 1210 Token get endToken => _semicolon; |
| 1102 | 1211 |
| 1103 /** | 1212 /** |
| 1104 * Return the token representing the 'assert' keyword. | 1213 * Return the token representing the 'assert' keyword. |
| 1214 * |
| 1105 * @return the token representing the 'assert' keyword | 1215 * @return the token representing the 'assert' keyword |
| 1106 */ | 1216 */ |
| 1107 Token get keyword => _keyword; | 1217 Token get keyword => _keyword; |
| 1108 | 1218 |
| 1109 /** | 1219 /** |
| 1110 * Return the left parenthesis. | 1220 * Return the left parenthesis. |
| 1221 * |
| 1111 * @return the left parenthesis | 1222 * @return the left parenthesis |
| 1112 */ | 1223 */ |
| 1113 Token get leftParenthesis => _leftParenthesis; | 1224 Token get leftParenthesis => _leftParenthesis; |
| 1114 | 1225 |
| 1115 /** | 1226 /** |
| 1116 * Return the right parenthesis. | 1227 * Return the right parenthesis. |
| 1228 * |
| 1117 * @return the right parenthesis | 1229 * @return the right parenthesis |
| 1118 */ | 1230 */ |
| 1119 Token get rightParenthesis => _rightParenthesis; | 1231 Token get rightParenthesis => _rightParenthesis; |
| 1120 | 1232 |
| 1121 /** | 1233 /** |
| 1122 * Return the semicolon terminating the statement. | 1234 * Return the semicolon terminating the statement. |
| 1235 * |
| 1123 * @return the semicolon terminating the statement | 1236 * @return the semicolon terminating the statement |
| 1124 */ | 1237 */ |
| 1125 Token get semicolon => _semicolon; | 1238 Token get semicolon => _semicolon; |
| 1126 | 1239 |
| 1127 /** | 1240 /** |
| 1128 * Set the condition that is being asserted to be `true` to the given expressi
on. | 1241 * Set the condition that is being asserted to be `true` to the given expressi
on. |
| 1242 * |
| 1129 * @param the condition that is being asserted to be `true` | 1243 * @param the condition that is being asserted to be `true` |
| 1130 */ | 1244 */ |
| 1131 void set condition(Expression condition2) { | 1245 void set condition(Expression condition2) { |
| 1132 this._condition = becomeParentOf(condition2); | 1246 this._condition = becomeParentOf(condition2); |
| 1133 } | 1247 } |
| 1134 | 1248 |
| 1135 /** | 1249 /** |
| 1136 * Set the token representing the 'assert' keyword to the given token. | 1250 * Set the token representing the 'assert' keyword to the given token. |
| 1251 * |
| 1137 * @param keyword the token representing the 'assert' keyword | 1252 * @param keyword the token representing the 'assert' keyword |
| 1138 */ | 1253 */ |
| 1139 void set keyword(Token keyword2) { | 1254 void set keyword(Token keyword2) { |
| 1140 this._keyword = keyword2; | 1255 this._keyword = keyword2; |
| 1141 } | 1256 } |
| 1142 | 1257 |
| 1143 /** | 1258 /** |
| 1144 * Set the left parenthesis to the given token. | 1259 * Set the left parenthesis to the given token. |
| 1260 * |
| 1145 * @param the left parenthesis | 1261 * @param the left parenthesis |
| 1146 */ | 1262 */ |
| 1147 void set leftParenthesis(Token leftParenthesis2) { | 1263 void set leftParenthesis(Token leftParenthesis2) { |
| 1148 this._leftParenthesis = leftParenthesis2; | 1264 this._leftParenthesis = leftParenthesis2; |
| 1149 } | 1265 } |
| 1150 | 1266 |
| 1151 /** | 1267 /** |
| 1152 * Set the right parenthesis to the given token. | 1268 * Set the right parenthesis to the given token. |
| 1269 * |
| 1153 * @param rightParenthesis the right parenthesis | 1270 * @param rightParenthesis the right parenthesis |
| 1154 */ | 1271 */ |
| 1155 void set rightParenthesis(Token rightParenthesis2) { | 1272 void set rightParenthesis(Token rightParenthesis2) { |
| 1156 this._rightParenthesis = rightParenthesis2; | 1273 this._rightParenthesis = rightParenthesis2; |
| 1157 } | 1274 } |
| 1158 | 1275 |
| 1159 /** | 1276 /** |
| 1160 * Set the semicolon terminating the statement to the given token. | 1277 * Set the semicolon terminating the statement to the given token. |
| 1278 * |
| 1161 * @param semicolon the semicolon terminating the statement | 1279 * @param semicolon the semicolon terminating the statement |
| 1162 */ | 1280 */ |
| 1163 void set semicolon(Token semicolon2) { | 1281 void set semicolon(Token semicolon2) { |
| 1164 this._semicolon = semicolon2; | 1282 this._semicolon = semicolon2; |
| 1165 } | 1283 } |
| 1166 void visitChildren(ASTVisitor<Object> visitor) { | 1284 void visitChildren(ASTVisitor<Object> visitor) { |
| 1167 safelyVisitChild(_condition, visitor); | 1285 safelyVisitChild(_condition, visitor); |
| 1168 } | 1286 } |
| 1169 } | 1287 } |
| 1170 /** | 1288 /** |
| 1171 * Instances of the class `AssignmentExpression` represent an assignment express
ion. | 1289 * Instances of the class `AssignmentExpression` represent an assignment express
ion. |
| 1290 * |
| 1172 * <pre> | 1291 * <pre> |
| 1173 * assignmentExpression ::=[Expression leftHandSide] [Token operator] [Expressio
n rightHandSide]</pre> | 1292 * assignmentExpression ::= |
| 1293 * [Expression] [Token] [Expression] |
| 1294 * </pre> |
| 1295 * |
| 1174 * @coverage dart.engine.ast | 1296 * @coverage dart.engine.ast |
| 1175 */ | 1297 */ |
| 1176 class AssignmentExpression extends Expression { | 1298 class AssignmentExpression extends Expression { |
| 1177 | 1299 |
| 1178 /** | 1300 /** |
| 1179 * The expression used to compute the left hand side. | 1301 * The expression used to compute the left hand side. |
| 1180 */ | 1302 */ |
| 1181 Expression _leftHandSide; | 1303 Expression _leftHandSide; |
| 1182 | 1304 |
| 1183 /** | 1305 /** |
| 1184 * The assignment operator being applied. | 1306 * The assignment operator being applied. |
| 1185 */ | 1307 */ |
| 1186 Token _operator; | 1308 Token _operator; |
| 1187 | 1309 |
| 1188 /** | 1310 /** |
| 1189 * The expression used to compute the right hand side. | 1311 * The expression used to compute the right hand side. |
| 1190 */ | 1312 */ |
| 1191 Expression _rightHandSide; | 1313 Expression _rightHandSide; |
| 1192 | 1314 |
| 1193 /** | 1315 /** |
| 1194 * The element associated with the operator based on the static type of the le
ft-hand-side, or`null` if the AST structure has not been resolved, if the operat
or is not a compound | 1316 * The element associated with the operator based on the static type of the le
ft-hand-side, or |
| 1317 * `null` if the AST structure has not been resolved, if the operator is not a
compound |
| 1195 * operator, or if the operator could not be resolved. | 1318 * operator, or if the operator could not be resolved. |
| 1196 */ | 1319 */ |
| 1197 MethodElement _staticElement; | 1320 MethodElement _staticElement; |
| 1198 | 1321 |
| 1199 /** | 1322 /** |
| 1200 * The element associated with the operator based on the propagated type of th
e left-hand-side, or`null` if the AST structure has not been resolved, if the op
erator is not a compound | 1323 * The element associated with the operator based on the propagated type of th
e left-hand-side, or |
| 1324 * `null` if the AST structure has not been resolved, if the operator is not a
compound |
| 1201 * operator, or if the operator could not be resolved. | 1325 * operator, or if the operator could not be resolved. |
| 1202 */ | 1326 */ |
| 1203 MethodElement _propagatedElement; | 1327 MethodElement _propagatedElement; |
| 1204 | 1328 |
| 1205 /** | 1329 /** |
| 1206 * Initialize a newly created assignment expression. | 1330 * Initialize a newly created assignment expression. |
| 1331 * |
| 1207 * @param leftHandSide the expression used to compute the left hand side | 1332 * @param leftHandSide the expression used to compute the left hand side |
| 1208 * @param operator the assignment operator being applied | 1333 * @param operator the assignment operator being applied |
| 1209 * @param rightHandSide the expression used to compute the right hand side | 1334 * @param rightHandSide the expression used to compute the right hand side |
| 1210 */ | 1335 */ |
| 1211 AssignmentExpression.full(Expression leftHandSide, Token operator, Expression
rightHandSide) { | 1336 AssignmentExpression.full(Expression leftHandSide, Token operator, Expression
rightHandSide) { |
| 1212 this._leftHandSide = becomeParentOf(leftHandSide); | 1337 this._leftHandSide = becomeParentOf(leftHandSide); |
| 1213 this._operator = operator; | 1338 this._operator = operator; |
| 1214 this._rightHandSide = becomeParentOf(rightHandSide); | 1339 this._rightHandSide = becomeParentOf(rightHandSide); |
| 1215 } | 1340 } |
| 1216 | 1341 |
| 1217 /** | 1342 /** |
| 1218 * Initialize a newly created assignment expression. | 1343 * Initialize a newly created assignment expression. |
| 1344 * |
| 1219 * @param leftHandSide the expression used to compute the left hand side | 1345 * @param leftHandSide the expression used to compute the left hand side |
| 1220 * @param operator the assignment operator being applied | 1346 * @param operator the assignment operator being applied |
| 1221 * @param rightHandSide the expression used to compute the right hand side | 1347 * @param rightHandSide the expression used to compute the right hand side |
| 1222 */ | 1348 */ |
| 1223 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ
tHandSide}) : this.full(leftHandSide, operator, rightHandSide); | 1349 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ
tHandSide}) : this.full(leftHandSide, operator, rightHandSide); |
| 1224 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this); | 1350 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this); |
| 1225 Token get beginToken => _leftHandSide.beginToken; | 1351 Token get beginToken => _leftHandSide.beginToken; |
| 1226 | 1352 |
| 1227 /** | 1353 /** |
| 1228 * Return the element associated with the operator based on the propagated typ
e of the | 1354 * Return the element associated with the operator based on the propagated typ
e of the |
| 1229 * left-hand-side, or `null` if the AST structure has not been resolved, if th
e operator is | 1355 * left-hand-side, or `null` if the AST structure has not been resolved, if th
e operator is |
| 1230 * not a compound operator, or if the operator could not be resolved. One exam
ple of the latter | 1356 * not a compound operator, or if the operator could not be resolved. One exam
ple of the latter |
| 1231 * case is an operator that is not defined for the type of the left-hand opera
nd. | 1357 * case is an operator that is not defined for the type of the left-hand opera
nd. |
| 1358 * |
| 1232 * @return the element associated with the operator | 1359 * @return the element associated with the operator |
| 1233 */ | 1360 */ |
| 1234 MethodElement get element => _propagatedElement; | 1361 MethodElement get element => _propagatedElement; |
| 1235 Token get endToken => _rightHandSide.endToken; | 1362 Token get endToken => _rightHandSide.endToken; |
| 1236 | 1363 |
| 1237 /** | 1364 /** |
| 1238 * Set the expression used to compute the left hand side to the given expressi
on. | 1365 * Set the expression used to compute the left hand side to the given expressi
on. |
| 1366 * |
| 1239 * @return the expression used to compute the left hand side | 1367 * @return the expression used to compute the left hand side |
| 1240 */ | 1368 */ |
| 1241 Expression get leftHandSide => _leftHandSide; | 1369 Expression get leftHandSide => _leftHandSide; |
| 1242 | 1370 |
| 1243 /** | 1371 /** |
| 1244 * Return the assignment operator being applied. | 1372 * Return the assignment operator being applied. |
| 1373 * |
| 1245 * @return the assignment operator being applied | 1374 * @return the assignment operator being applied |
| 1246 */ | 1375 */ |
| 1247 Token get operator => _operator; | 1376 Token get operator => _operator; |
| 1248 | 1377 |
| 1249 /** | 1378 /** |
| 1250 * Return the expression used to compute the right hand side. | 1379 * Return the expression used to compute the right hand side. |
| 1380 * |
| 1251 * @return the expression used to compute the right hand side | 1381 * @return the expression used to compute the right hand side |
| 1252 */ | 1382 */ |
| 1253 Expression get rightHandSide => _rightHandSide; | 1383 Expression get rightHandSide => _rightHandSide; |
| 1254 | 1384 |
| 1255 /** | 1385 /** |
| 1256 * Return the element associated with the operator based on the static type of
the left-hand-side, | 1386 * Return the element associated with the operator based on the static type of
the left-hand-side, |
| 1257 * or `null` if the AST structure has not been resolved, if the operator is no
t a compound | 1387 * or `null` if the AST structure has not been resolved, if the operator is no
t a compound |
| 1258 * operator, or if the operator could not be resolved. One example of the latt
er case is an | 1388 * operator, or if the operator could not be resolved. One example of the latt
er case is an |
| 1259 * operator that is not defined for the type of the left-hand operand. | 1389 * operator that is not defined for the type of the left-hand operand. |
| 1390 * |
| 1260 * @return the element associated with the operator | 1391 * @return the element associated with the operator |
| 1261 */ | 1392 */ |
| 1262 MethodElement get staticElement => _staticElement; | 1393 MethodElement get staticElement => _staticElement; |
| 1263 | 1394 |
| 1264 /** | 1395 /** |
| 1265 * Set the element associated with the operator based on the propagated type o
f the left-hand-side | 1396 * Set the element associated with the operator based on the propagated type o
f the left-hand-side |
| 1266 * to the given element. | 1397 * to the given element. |
| 1398 * |
| 1267 * @param element the element to be associated with the operator | 1399 * @param element the element to be associated with the operator |
| 1268 */ | 1400 */ |
| 1269 void set element(MethodElement element2) { | 1401 void set element(MethodElement element2) { |
| 1270 _propagatedElement = element2; | 1402 _propagatedElement = element2; |
| 1271 } | 1403 } |
| 1272 | 1404 |
| 1273 /** | 1405 /** |
| 1274 * Return the expression used to compute the left hand side. | 1406 * Return the expression used to compute the left hand side. |
| 1407 * |
| 1275 * @param expression the expression used to compute the left hand side | 1408 * @param expression the expression used to compute the left hand side |
| 1276 */ | 1409 */ |
| 1277 void set leftHandSide(Expression expression) { | 1410 void set leftHandSide(Expression expression) { |
| 1278 _leftHandSide = becomeParentOf(expression); | 1411 _leftHandSide = becomeParentOf(expression); |
| 1279 } | 1412 } |
| 1280 | 1413 |
| 1281 /** | 1414 /** |
| 1282 * Set the assignment operator being applied to the given operator. | 1415 * Set the assignment operator being applied to the given operator. |
| 1416 * |
| 1283 * @param operator the assignment operator being applied | 1417 * @param operator the assignment operator being applied |
| 1284 */ | 1418 */ |
| 1285 void set operator(Token operator2) { | 1419 void set operator(Token operator2) { |
| 1286 this._operator = operator2; | 1420 this._operator = operator2; |
| 1287 } | 1421 } |
| 1288 | 1422 |
| 1289 /** | 1423 /** |
| 1290 * Set the expression used to compute the left hand side to the given expressi
on. | 1424 * Set the expression used to compute the left hand side to the given expressi
on. |
| 1425 * |
| 1291 * @param expression the expression used to compute the left hand side | 1426 * @param expression the expression used to compute the left hand side |
| 1292 */ | 1427 */ |
| 1293 void set rightHandSide(Expression expression) { | 1428 void set rightHandSide(Expression expression) { |
| 1294 _rightHandSide = becomeParentOf(expression); | 1429 _rightHandSide = becomeParentOf(expression); |
| 1295 } | 1430 } |
| 1296 | 1431 |
| 1297 /** | 1432 /** |
| 1298 * Set the element associated with the operator based on the static type of th
e left-hand-side to | 1433 * Set the element associated with the operator based on the static type of th
e left-hand-side to |
| 1299 * the given element. | 1434 * the given element. |
| 1435 * |
| 1300 * @param element the static element to be associated with the operator | 1436 * @param element the static element to be associated with the operator |
| 1301 */ | 1437 */ |
| 1302 void set staticElement(MethodElement element) { | 1438 void set staticElement(MethodElement element) { |
| 1303 _staticElement = element; | 1439 _staticElement = element; |
| 1304 } | 1440 } |
| 1305 void visitChildren(ASTVisitor<Object> visitor) { | 1441 void visitChildren(ASTVisitor<Object> visitor) { |
| 1306 safelyVisitChild(_leftHandSide, visitor); | 1442 safelyVisitChild(_leftHandSide, visitor); |
| 1307 safelyVisitChild(_rightHandSide, visitor); | 1443 safelyVisitChild(_rightHandSide, visitor); |
| 1308 } | 1444 } |
| 1309 } | 1445 } |
| 1310 /** | 1446 /** |
| 1311 * Instances of the class `BinaryExpression` represent a binary (infix) expressi
on. | 1447 * Instances of the class `BinaryExpression` represent a binary (infix) expressi
on. |
| 1448 * |
| 1312 * <pre> | 1449 * <pre> |
| 1313 * binaryExpression ::=[Expression leftOperand] [Token operator] [Expression rig
htOperand]</pre> | 1450 * binaryExpression ::= |
| 1451 * [Expression] [Token] [Expression] |
| 1452 * </pre> |
| 1453 * |
| 1314 * @coverage dart.engine.ast | 1454 * @coverage dart.engine.ast |
| 1315 */ | 1455 */ |
| 1316 class BinaryExpression extends Expression { | 1456 class BinaryExpression extends Expression { |
| 1317 | 1457 |
| 1318 /** | 1458 /** |
| 1319 * The expression used to compute the left operand. | 1459 * The expression used to compute the left operand. |
| 1320 */ | 1460 */ |
| 1321 Expression _leftOperand; | 1461 Expression _leftOperand; |
| 1322 | 1462 |
| 1323 /** | 1463 /** |
| 1324 * The binary operator being applied. | 1464 * The binary operator being applied. |
| 1325 */ | 1465 */ |
| 1326 Token _operator; | 1466 Token _operator; |
| 1327 | 1467 |
| 1328 /** | 1468 /** |
| 1329 * The expression used to compute the right operand. | 1469 * The expression used to compute the right operand. |
| 1330 */ | 1470 */ |
| 1331 Expression _rightOperand; | 1471 Expression _rightOperand; |
| 1332 | 1472 |
| 1333 /** | 1473 /** |
| 1334 * The element associated with the operator based on the static type of the le
ft operand, or`null` if the AST structure has not been resolved, if the operator
is not user definable, | 1474 * The element associated with the operator based on the static type of the le
ft operand, or |
| 1475 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 1335 * or if the operator could not be resolved. | 1476 * or if the operator could not be resolved. |
| 1336 */ | 1477 */ |
| 1337 MethodElement _staticElement; | 1478 MethodElement _staticElement; |
| 1338 | 1479 |
| 1339 /** | 1480 /** |
| 1340 * The element associated with the operator based on the propagated type of th
e left operand, or`null` if the AST structure has not been resolved, if the oper
ator is not user definable, | 1481 * The element associated with the operator based on the propagated type of th
e left operand, or |
| 1482 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 1341 * or if the operator could not be resolved. | 1483 * or if the operator could not be resolved. |
| 1342 */ | 1484 */ |
| 1343 MethodElement _propagatedElement; | 1485 MethodElement _propagatedElement; |
| 1344 | 1486 |
| 1345 /** | 1487 /** |
| 1346 * Initialize a newly created binary expression. | 1488 * Initialize a newly created binary expression. |
| 1489 * |
| 1347 * @param leftOperand the expression used to compute the left operand | 1490 * @param leftOperand the expression used to compute the left operand |
| 1348 * @param operator the binary operator being applied | 1491 * @param operator the binary operator being applied |
| 1349 * @param rightOperand the expression used to compute the right operand | 1492 * @param rightOperand the expression used to compute the right operand |
| 1350 */ | 1493 */ |
| 1351 BinaryExpression.full(Expression leftOperand, Token operator, Expression right
Operand) { | 1494 BinaryExpression.full(Expression leftOperand, Token operator, Expression right
Operand) { |
| 1352 this._leftOperand = becomeParentOf(leftOperand); | 1495 this._leftOperand = becomeParentOf(leftOperand); |
| 1353 this._operator = operator; | 1496 this._operator = operator; |
| 1354 this._rightOperand = becomeParentOf(rightOperand); | 1497 this._rightOperand = becomeParentOf(rightOperand); |
| 1355 } | 1498 } |
| 1356 | 1499 |
| 1357 /** | 1500 /** |
| 1358 * Initialize a newly created binary expression. | 1501 * Initialize a newly created binary expression. |
| 1502 * |
| 1359 * @param leftOperand the expression used to compute the left operand | 1503 * @param leftOperand the expression used to compute the left operand |
| 1360 * @param operator the binary operator being applied | 1504 * @param operator the binary operator being applied |
| 1361 * @param rightOperand the expression used to compute the right operand | 1505 * @param rightOperand the expression used to compute the right operand |
| 1362 */ | 1506 */ |
| 1363 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper
and}) : this.full(leftOperand, operator, rightOperand); | 1507 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper
and}) : this.full(leftOperand, operator, rightOperand); |
| 1364 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); | 1508 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); |
| 1365 Token get beginToken => _leftOperand.beginToken; | 1509 Token get beginToken => _leftOperand.beginToken; |
| 1366 | 1510 |
| 1367 /** | 1511 /** |
| 1368 * Return the element associated with the operator based on the propagated typ
e of the left | 1512 * Return the element associated with the operator based on the propagated typ
e of the left |
| 1369 * operand, or `null` if the AST structure has not been resolved, if the opera
tor is not | 1513 * operand, or `null` if the AST structure has not been resolved, if the opera
tor is not |
| 1370 * user definable, or if the operator could not be resolved. One example of th
e latter case is an | 1514 * user definable, or if the operator could not be resolved. One example of th
e latter case is an |
| 1371 * operator that is not defined for the type of the left-hand operand. | 1515 * operator that is not defined for the type of the left-hand operand. |
| 1516 * |
| 1372 * @return the element associated with the operator | 1517 * @return the element associated with the operator |
| 1373 */ | 1518 */ |
| 1374 MethodElement get element => _propagatedElement; | 1519 MethodElement get element => _propagatedElement; |
| 1375 Token get endToken => _rightOperand.endToken; | 1520 Token get endToken => _rightOperand.endToken; |
| 1376 | 1521 |
| 1377 /** | 1522 /** |
| 1378 * Return the expression used to compute the left operand. | 1523 * Return the expression used to compute the left operand. |
| 1524 * |
| 1379 * @return the expression used to compute the left operand | 1525 * @return the expression used to compute the left operand |
| 1380 */ | 1526 */ |
| 1381 Expression get leftOperand => _leftOperand; | 1527 Expression get leftOperand => _leftOperand; |
| 1382 | 1528 |
| 1383 /** | 1529 /** |
| 1384 * Return the binary operator being applied. | 1530 * Return the binary operator being applied. |
| 1531 * |
| 1385 * @return the binary operator being applied | 1532 * @return the binary operator being applied |
| 1386 */ | 1533 */ |
| 1387 Token get operator => _operator; | 1534 Token get operator => _operator; |
| 1388 | 1535 |
| 1389 /** | 1536 /** |
| 1390 * Return the expression used to compute the right operand. | 1537 * Return the expression used to compute the right operand. |
| 1538 * |
| 1391 * @return the expression used to compute the right operand | 1539 * @return the expression used to compute the right operand |
| 1392 */ | 1540 */ |
| 1393 Expression get rightOperand => _rightOperand; | 1541 Expression get rightOperand => _rightOperand; |
| 1394 | 1542 |
| 1395 /** | 1543 /** |
| 1396 * Return the element associated with the operator based on the static type of
the left operand, | 1544 * Return the element associated with the operator based on the static type of
the left operand, |
| 1397 * or `null` if the AST structure has not been resolved, if the operator is no
t user | 1545 * or `null` if the AST structure has not been resolved, if the operator is no
t user |
| 1398 * definable, or if the operator could not be resolved. One example of the lat
ter case is an | 1546 * definable, or if the operator could not be resolved. One example of the lat
ter case is an |
| 1399 * operator that is not defined for the type of the left operand. | 1547 * operator that is not defined for the type of the left operand. |
| 1548 * |
| 1400 * @return the element associated with the operator | 1549 * @return the element associated with the operator |
| 1401 */ | 1550 */ |
| 1402 MethodElement get staticElement => _staticElement; | 1551 MethodElement get staticElement => _staticElement; |
| 1403 | 1552 |
| 1404 /** | 1553 /** |
| 1405 * Set the element associated with the operator based on the propagated type o
f the left operand | 1554 * Set the element associated with the operator based on the propagated type o
f the left operand |
| 1406 * to the given element. | 1555 * to the given element. |
| 1556 * |
| 1407 * @param element the element to be associated with the operator | 1557 * @param element the element to be associated with the operator |
| 1408 */ | 1558 */ |
| 1409 void set element(MethodElement element2) { | 1559 void set element(MethodElement element2) { |
| 1410 _propagatedElement = element2; | 1560 _propagatedElement = element2; |
| 1411 } | 1561 } |
| 1412 | 1562 |
| 1413 /** | 1563 /** |
| 1414 * Set the expression used to compute the left operand to the given expression
. | 1564 * Set the expression used to compute the left operand to the given expression
. |
| 1565 * |
| 1415 * @param expression the expression used to compute the left operand | 1566 * @param expression the expression used to compute the left operand |
| 1416 */ | 1567 */ |
| 1417 void set leftOperand(Expression expression) { | 1568 void set leftOperand(Expression expression) { |
| 1418 _leftOperand = becomeParentOf(expression); | 1569 _leftOperand = becomeParentOf(expression); |
| 1419 } | 1570 } |
| 1420 | 1571 |
| 1421 /** | 1572 /** |
| 1422 * Set the binary operator being applied to the given operator. | 1573 * Set the binary operator being applied to the given operator. |
| 1574 * |
| 1423 * @return the binary operator being applied | 1575 * @return the binary operator being applied |
| 1424 */ | 1576 */ |
| 1425 void set operator(Token operator2) { | 1577 void set operator(Token operator2) { |
| 1426 this._operator = operator2; | 1578 this._operator = operator2; |
| 1427 } | 1579 } |
| 1428 | 1580 |
| 1429 /** | 1581 /** |
| 1430 * Set the expression used to compute the right operand to the given expressio
n. | 1582 * Set the expression used to compute the right operand to the given expressio
n. |
| 1583 * |
| 1431 * @param expression the expression used to compute the right operand | 1584 * @param expression the expression used to compute the right operand |
| 1432 */ | 1585 */ |
| 1433 void set rightOperand(Expression expression) { | 1586 void set rightOperand(Expression expression) { |
| 1434 _rightOperand = becomeParentOf(expression); | 1587 _rightOperand = becomeParentOf(expression); |
| 1435 } | 1588 } |
| 1436 | 1589 |
| 1437 /** | 1590 /** |
| 1438 * Set the element associated with the operator based on the static type of th
e left operand to | 1591 * Set the element associated with the operator based on the static type of th
e left operand to |
| 1439 * the given element. | 1592 * the given element. |
| 1593 * |
| 1440 * @param element the static element to be associated with the operator | 1594 * @param element the static element to be associated with the operator |
| 1441 */ | 1595 */ |
| 1442 void set staticElement(MethodElement element) { | 1596 void set staticElement(MethodElement element) { |
| 1443 _staticElement = element; | 1597 _staticElement = element; |
| 1444 } | 1598 } |
| 1445 void visitChildren(ASTVisitor<Object> visitor) { | 1599 void visitChildren(ASTVisitor<Object> visitor) { |
| 1446 safelyVisitChild(_leftOperand, visitor); | 1600 safelyVisitChild(_leftOperand, visitor); |
| 1447 safelyVisitChild(_rightOperand, visitor); | 1601 safelyVisitChild(_rightOperand, visitor); |
| 1448 } | 1602 } |
| 1449 | 1603 |
| 1450 /** | 1604 /** |
| 1451 * If the AST structure has been resolved, and the function being invoked is k
nown based on | 1605 * If the AST structure has been resolved, and the function being invoked is k
nown based on |
| 1452 * propagated type information, then return the parameter element representing
the parameter to | 1606 * propagated type information, then return the parameter element representing
the parameter to |
| 1453 * which the value of the right operand will be bound. Otherwise, return `null
`. | 1607 * which the value of the right operand will be bound. Otherwise, return `null
`. |
| 1454 * | 1608 * |
| 1455 * This method is only intended to be used by [Expression#getParameterElement]
. | 1609 * This method is only intended to be used by [Expression#getParameterElement]
. |
| 1610 * |
| 1456 * @return the parameter element representing the parameter to which the value
of the right | 1611 * @return the parameter element representing the parameter to which the value
of the right |
| 1457 * operand will be bound | 1612 * operand will be bound |
| 1458 */ | 1613 */ |
| 1459 ParameterElement get propagatedParameterElementForRightOperand { | 1614 ParameterElement get propagatedParameterElementForRightOperand { |
| 1460 if (_propagatedElement == null) { | 1615 if (_propagatedElement == null) { |
| 1461 return null; | 1616 return null; |
| 1462 } | 1617 } |
| 1463 List<ParameterElement> parameters = _propagatedElement.parameters; | 1618 List<ParameterElement> parameters = _propagatedElement.parameters; |
| 1464 if (parameters.length < 1) { | 1619 if (parameters.length < 1) { |
| 1465 return null; | 1620 return null; |
| 1466 } | 1621 } |
| 1467 return parameters[0]; | 1622 return parameters[0]; |
| 1468 } | 1623 } |
| 1469 | 1624 |
| 1470 /** | 1625 /** |
| 1471 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 1626 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
| 1472 * type information, then return the parameter element representing the parame
ter to which the | 1627 * type information, then return the parameter element representing the parame
ter to which the |
| 1473 * value of the right operand will be bound. Otherwise, return `null`. | 1628 * value of the right operand will be bound. Otherwise, return `null`. |
| 1474 * | 1629 * |
| 1475 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. | 1630 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. |
| 1631 * |
| 1476 * @return the parameter element representing the parameter to which the value
of the right | 1632 * @return the parameter element representing the parameter to which the value
of the right |
| 1477 * operand will be bound | 1633 * operand will be bound |
| 1478 */ | 1634 */ |
| 1479 ParameterElement get staticParameterElementForRightOperand { | 1635 ParameterElement get staticParameterElementForRightOperand { |
| 1480 if (_staticElement == null) { | 1636 if (_staticElement == null) { |
| 1481 return null; | 1637 return null; |
| 1482 } | 1638 } |
| 1483 List<ParameterElement> parameters = _staticElement.parameters; | 1639 List<ParameterElement> parameters = _staticElement.parameters; |
| 1484 if (parameters.length < 1) { | 1640 if (parameters.length < 1) { |
| 1485 return null; | 1641 return null; |
| 1486 } | 1642 } |
| 1487 return parameters[0]; | 1643 return parameters[0]; |
| 1488 } | 1644 } |
| 1489 } | 1645 } |
| 1490 /** | 1646 /** |
| 1491 * Instances of the class `Block` represent a sequence of statements. | 1647 * Instances of the class `Block` represent a sequence of statements. |
| 1648 * |
| 1492 * <pre> | 1649 * <pre> |
| 1493 * block ::= | 1650 * block ::= |
| 1494 * '{' statement* '}' | 1651 * '{' statement* '}' |
| 1495 * </pre> | 1652 * </pre> |
| 1653 * |
| 1496 * @coverage dart.engine.ast | 1654 * @coverage dart.engine.ast |
| 1497 */ | 1655 */ |
| 1498 class Block extends Statement { | 1656 class Block extends Statement { |
| 1499 | 1657 |
| 1500 /** | 1658 /** |
| 1501 * The left curly bracket. | 1659 * The left curly bracket. |
| 1502 */ | 1660 */ |
| 1503 Token _leftBracket; | 1661 Token _leftBracket; |
| 1504 | 1662 |
| 1505 /** | 1663 /** |
| 1506 * The statements contained in the block. | 1664 * The statements contained in the block. |
| 1507 */ | 1665 */ |
| 1508 NodeList<Statement> _statements; | 1666 NodeList<Statement> _statements; |
| 1509 | 1667 |
| 1510 /** | 1668 /** |
| 1511 * The right curly bracket. | 1669 * The right curly bracket. |
| 1512 */ | 1670 */ |
| 1513 Token _rightBracket; | 1671 Token _rightBracket; |
| 1514 | 1672 |
| 1515 /** | 1673 /** |
| 1516 * Initialize a newly created block of code. | 1674 * Initialize a newly created block of code. |
| 1675 * |
| 1517 * @param leftBracket the left curly bracket | 1676 * @param leftBracket the left curly bracket |
| 1518 * @param statements the statements contained in the block | 1677 * @param statements the statements contained in the block |
| 1519 * @param rightBracket the right curly bracket | 1678 * @param rightBracket the right curly bracket |
| 1520 */ | 1679 */ |
| 1521 Block.full(Token leftBracket, List<Statement> statements, Token rightBracket)
{ | 1680 Block.full(Token leftBracket, List<Statement> statements, Token rightBracket)
{ |
| 1522 this._statements = new NodeList<Statement>(this); | 1681 this._statements = new NodeList<Statement>(this); |
| 1523 this._leftBracket = leftBracket; | 1682 this._leftBracket = leftBracket; |
| 1524 this._statements.addAll(statements); | 1683 this._statements.addAll(statements); |
| 1525 this._rightBracket = rightBracket; | 1684 this._rightBracket = rightBracket; |
| 1526 } | 1685 } |
| 1527 | 1686 |
| 1528 /** | 1687 /** |
| 1529 * Initialize a newly created block of code. | 1688 * Initialize a newly created block of code. |
| 1689 * |
| 1530 * @param leftBracket the left curly bracket | 1690 * @param leftBracket the left curly bracket |
| 1531 * @param statements the statements contained in the block | 1691 * @param statements the statements contained in the block |
| 1532 * @param rightBracket the right curly bracket | 1692 * @param rightBracket the right curly bracket |
| 1533 */ | 1693 */ |
| 1534 Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : t
his.full(leftBracket, statements, rightBracket); | 1694 Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : t
his.full(leftBracket, statements, rightBracket); |
| 1535 accept(ASTVisitor visitor) => visitor.visitBlock(this); | 1695 accept(ASTVisitor visitor) => visitor.visitBlock(this); |
| 1536 Token get beginToken => _leftBracket; | 1696 Token get beginToken => _leftBracket; |
| 1537 Token get endToken => _rightBracket; | 1697 Token get endToken => _rightBracket; |
| 1538 | 1698 |
| 1539 /** | 1699 /** |
| 1540 * Return the left curly bracket. | 1700 * Return the left curly bracket. |
| 1701 * |
| 1541 * @return the left curly bracket | 1702 * @return the left curly bracket |
| 1542 */ | 1703 */ |
| 1543 Token get leftBracket => _leftBracket; | 1704 Token get leftBracket => _leftBracket; |
| 1544 | 1705 |
| 1545 /** | 1706 /** |
| 1546 * Return the right curly bracket. | 1707 * Return the right curly bracket. |
| 1708 * |
| 1547 * @return the right curly bracket | 1709 * @return the right curly bracket |
| 1548 */ | 1710 */ |
| 1549 Token get rightBracket => _rightBracket; | 1711 Token get rightBracket => _rightBracket; |
| 1550 | 1712 |
| 1551 /** | 1713 /** |
| 1552 * Return the statements contained in the block. | 1714 * Return the statements contained in the block. |
| 1715 * |
| 1553 * @return the statements contained in the block | 1716 * @return the statements contained in the block |
| 1554 */ | 1717 */ |
| 1555 NodeList<Statement> get statements => _statements; | 1718 NodeList<Statement> get statements => _statements; |
| 1556 | 1719 |
| 1557 /** | 1720 /** |
| 1558 * Set the left curly bracket to the given token. | 1721 * Set the left curly bracket to the given token. |
| 1722 * |
| 1559 * @param leftBracket the left curly bracket | 1723 * @param leftBracket the left curly bracket |
| 1560 */ | 1724 */ |
| 1561 void set leftBracket(Token leftBracket2) { | 1725 void set leftBracket(Token leftBracket2) { |
| 1562 this._leftBracket = leftBracket2; | 1726 this._leftBracket = leftBracket2; |
| 1563 } | 1727 } |
| 1564 | 1728 |
| 1565 /** | 1729 /** |
| 1566 * Set the right curly bracket to the given token. | 1730 * Set the right curly bracket to the given token. |
| 1731 * |
| 1567 * @param rightBracket the right curly bracket | 1732 * @param rightBracket the right curly bracket |
| 1568 */ | 1733 */ |
| 1569 void set rightBracket(Token rightBracket2) { | 1734 void set rightBracket(Token rightBracket2) { |
| 1570 this._rightBracket = rightBracket2; | 1735 this._rightBracket = rightBracket2; |
| 1571 } | 1736 } |
| 1572 void visitChildren(ASTVisitor<Object> visitor) { | 1737 void visitChildren(ASTVisitor<Object> visitor) { |
| 1573 _statements.accept(visitor); | 1738 _statements.accept(visitor); |
| 1574 } | 1739 } |
| 1575 } | 1740 } |
| 1576 /** | 1741 /** |
| 1577 * Instances of the class `BlockFunctionBody` represent a function body that con
sists of a | 1742 * Instances of the class `BlockFunctionBody` represent a function body that con
sists of a |
| 1578 * block of statements. | 1743 * block of statements. |
| 1744 * |
| 1579 * <pre> | 1745 * <pre> |
| 1580 * blockFunctionBody ::=[Block block]</pre> | 1746 * blockFunctionBody ::= |
| 1747 * [Block] |
| 1748 * </pre> |
| 1749 * |
| 1581 * @coverage dart.engine.ast | 1750 * @coverage dart.engine.ast |
| 1582 */ | 1751 */ |
| 1583 class BlockFunctionBody extends FunctionBody { | 1752 class BlockFunctionBody extends FunctionBody { |
| 1584 | 1753 |
| 1585 /** | 1754 /** |
| 1586 * The block representing the body of the function. | 1755 * The block representing the body of the function. |
| 1587 */ | 1756 */ |
| 1588 Block _block; | 1757 Block _block; |
| 1589 | 1758 |
| 1590 /** | 1759 /** |
| 1591 * Initialize a newly created function body consisting of a block of statement
s. | 1760 * Initialize a newly created function body consisting of a block of statement
s. |
| 1761 * |
| 1592 * @param block the block representing the body of the function | 1762 * @param block the block representing the body of the function |
| 1593 */ | 1763 */ |
| 1594 BlockFunctionBody.full(Block block) { | 1764 BlockFunctionBody.full(Block block) { |
| 1595 this._block = becomeParentOf(block); | 1765 this._block = becomeParentOf(block); |
| 1596 } | 1766 } |
| 1597 | 1767 |
| 1598 /** | 1768 /** |
| 1599 * Initialize a newly created function body consisting of a block of statement
s. | 1769 * Initialize a newly created function body consisting of a block of statement
s. |
| 1770 * |
| 1600 * @param block the block representing the body of the function | 1771 * @param block the block representing the body of the function |
| 1601 */ | 1772 */ |
| 1602 BlockFunctionBody({Block block}) : this.full(block); | 1773 BlockFunctionBody({Block block}) : this.full(block); |
| 1603 accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this); | 1774 accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this); |
| 1604 Token get beginToken => _block.beginToken; | 1775 Token get beginToken => _block.beginToken; |
| 1605 | 1776 |
| 1606 /** | 1777 /** |
| 1607 * Return the block representing the body of the function. | 1778 * Return the block representing the body of the function. |
| 1779 * |
| 1608 * @return the block representing the body of the function | 1780 * @return the block representing the body of the function |
| 1609 */ | 1781 */ |
| 1610 Block get block => _block; | 1782 Block get block => _block; |
| 1611 Token get endToken => _block.endToken; | 1783 Token get endToken => _block.endToken; |
| 1612 | 1784 |
| 1613 /** | 1785 /** |
| 1614 * Set the block representing the body of the function to the given block. | 1786 * Set the block representing the body of the function to the given block. |
| 1787 * |
| 1615 * @param block the block representing the body of the function | 1788 * @param block the block representing the body of the function |
| 1616 */ | 1789 */ |
| 1617 void set block(Block block2) { | 1790 void set block(Block block2) { |
| 1618 this._block = becomeParentOf(block2); | 1791 this._block = becomeParentOf(block2); |
| 1619 } | 1792 } |
| 1620 void visitChildren(ASTVisitor<Object> visitor) { | 1793 void visitChildren(ASTVisitor<Object> visitor) { |
| 1621 safelyVisitChild(_block, visitor); | 1794 safelyVisitChild(_block, visitor); |
| 1622 } | 1795 } |
| 1623 } | 1796 } |
| 1624 /** | 1797 /** |
| 1625 * Instances of the class `BooleanLiteral` represent a boolean literal expressio
n. | 1798 * Instances of the class `BooleanLiteral` represent a boolean literal expressio
n. |
| 1799 * |
| 1626 * <pre> | 1800 * <pre> |
| 1627 * booleanLiteral ::= | 1801 * booleanLiteral ::= |
| 1628 * 'false' | 'true' | 1802 * 'false' | 'true' |
| 1629 * </pre> | 1803 * </pre> |
| 1804 * |
| 1630 * @coverage dart.engine.ast | 1805 * @coverage dart.engine.ast |
| 1631 */ | 1806 */ |
| 1632 class BooleanLiteral extends Literal { | 1807 class BooleanLiteral extends Literal { |
| 1633 | 1808 |
| 1634 /** | 1809 /** |
| 1635 * The token representing the literal. | 1810 * The token representing the literal. |
| 1636 */ | 1811 */ |
| 1637 Token _literal; | 1812 Token _literal; |
| 1638 | 1813 |
| 1639 /** | 1814 /** |
| 1640 * The value of the literal. | 1815 * The value of the literal. |
| 1641 */ | 1816 */ |
| 1642 bool _value = false; | 1817 bool _value = false; |
| 1643 | 1818 |
| 1644 /** | 1819 /** |
| 1645 * Initialize a newly created boolean literal. | 1820 * Initialize a newly created boolean literal. |
| 1821 * |
| 1646 * @param literal the token representing the literal | 1822 * @param literal the token representing the literal |
| 1647 * @param value the value of the literal | 1823 * @param value the value of the literal |
| 1648 */ | 1824 */ |
| 1649 BooleanLiteral.full(Token literal, bool value) { | 1825 BooleanLiteral.full(Token literal, bool value) { |
| 1650 this._literal = literal; | 1826 this._literal = literal; |
| 1651 this._value = value; | 1827 this._value = value; |
| 1652 } | 1828 } |
| 1653 | 1829 |
| 1654 /** | 1830 /** |
| 1655 * Initialize a newly created boolean literal. | 1831 * Initialize a newly created boolean literal. |
| 1832 * |
| 1656 * @param literal the token representing the literal | 1833 * @param literal the token representing the literal |
| 1657 * @param value the value of the literal | 1834 * @param value the value of the literal |
| 1658 */ | 1835 */ |
| 1659 BooleanLiteral({Token literal, bool value}) : this.full(literal, value); | 1836 BooleanLiteral({Token literal, bool value}) : this.full(literal, value); |
| 1660 accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this); | 1837 accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this); |
| 1661 Token get beginToken => _literal; | 1838 Token get beginToken => _literal; |
| 1662 Token get endToken => _literal; | 1839 Token get endToken => _literal; |
| 1663 | 1840 |
| 1664 /** | 1841 /** |
| 1665 * Return the token representing the literal. | 1842 * Return the token representing the literal. |
| 1843 * |
| 1666 * @return the token representing the literal | 1844 * @return the token representing the literal |
| 1667 */ | 1845 */ |
| 1668 Token get literal => _literal; | 1846 Token get literal => _literal; |
| 1669 | 1847 |
| 1670 /** | 1848 /** |
| 1671 * Return the value of the literal. | 1849 * Return the value of the literal. |
| 1850 * |
| 1672 * @return the value of the literal | 1851 * @return the value of the literal |
| 1673 */ | 1852 */ |
| 1674 bool get value => _value; | 1853 bool get value => _value; |
| 1675 bool get isSynthetic => _literal.isSynthetic; | 1854 bool get isSynthetic => _literal.isSynthetic; |
| 1676 | 1855 |
| 1677 /** | 1856 /** |
| 1678 * Set the token representing the literal to the given token. | 1857 * Set the token representing the literal to the given token. |
| 1858 * |
| 1679 * @param literal the token representing the literal | 1859 * @param literal the token representing the literal |
| 1680 */ | 1860 */ |
| 1681 void set literal(Token literal2) { | 1861 void set literal(Token literal2) { |
| 1682 this._literal = literal2; | 1862 this._literal = literal2; |
| 1683 } | 1863 } |
| 1684 | 1864 |
| 1685 /** | 1865 /** |
| 1686 * Set the value of the literal to the given value. | 1866 * Set the value of the literal to the given value. |
| 1867 * |
| 1687 * @param value the value of the literal | 1868 * @param value the value of the literal |
| 1688 */ | 1869 */ |
| 1689 void set value(bool value2) { | 1870 void set value(bool value2) { |
| 1690 this._value = value2; | 1871 this._value = value2; |
| 1691 } | 1872 } |
| 1692 void visitChildren(ASTVisitor<Object> visitor) { | 1873 void visitChildren(ASTVisitor<Object> visitor) { |
| 1693 } | 1874 } |
| 1694 } | 1875 } |
| 1695 /** | 1876 /** |
| 1696 * Instances of the class `BreakStatement` represent a break statement. | 1877 * Instances of the class `BreakStatement` represent a break statement. |
| 1878 * |
| 1697 * <pre> | 1879 * <pre> |
| 1698 * breakStatement ::= | 1880 * breakStatement ::= |
| 1699 * 'break' [SimpleIdentifier label]? ';' | 1881 * 'break' [SimpleIdentifier]? ';' |
| 1700 * </pre> | 1882 * </pre> |
| 1883 * |
| 1701 * @coverage dart.engine.ast | 1884 * @coverage dart.engine.ast |
| 1702 */ | 1885 */ |
| 1703 class BreakStatement extends Statement { | 1886 class BreakStatement extends Statement { |
| 1704 | 1887 |
| 1705 /** | 1888 /** |
| 1706 * The token representing the 'break' keyword. | 1889 * The token representing the 'break' keyword. |
| 1707 */ | 1890 */ |
| 1708 Token _keyword; | 1891 Token _keyword; |
| 1709 | 1892 |
| 1710 /** | 1893 /** |
| 1711 * The label associated with the statement, or `null` if there is no label. | 1894 * The label associated with the statement, or `null` if there is no label. |
| 1712 */ | 1895 */ |
| 1713 SimpleIdentifier _label; | 1896 SimpleIdentifier _label; |
| 1714 | 1897 |
| 1715 /** | 1898 /** |
| 1716 * The semicolon terminating the statement. | 1899 * The semicolon terminating the statement. |
| 1717 */ | 1900 */ |
| 1718 Token _semicolon; | 1901 Token _semicolon; |
| 1719 | 1902 |
| 1720 /** | 1903 /** |
| 1721 * Initialize a newly created break statement. | 1904 * Initialize a newly created break statement. |
| 1905 * |
| 1722 * @param keyword the token representing the 'break' keyword | 1906 * @param keyword the token representing the 'break' keyword |
| 1723 * @param label the label associated with the statement | 1907 * @param label the label associated with the statement |
| 1724 * @param semicolon the semicolon terminating the statement | 1908 * @param semicolon the semicolon terminating the statement |
| 1725 */ | 1909 */ |
| 1726 BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) { | 1910 BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) { |
| 1727 this._keyword = keyword; | 1911 this._keyword = keyword; |
| 1728 this._label = becomeParentOf(label); | 1912 this._label = becomeParentOf(label); |
| 1729 this._semicolon = semicolon; | 1913 this._semicolon = semicolon; |
| 1730 } | 1914 } |
| 1731 | 1915 |
| 1732 /** | 1916 /** |
| 1733 * Initialize a newly created break statement. | 1917 * Initialize a newly created break statement. |
| 1918 * |
| 1734 * @param keyword the token representing the 'break' keyword | 1919 * @param keyword the token representing the 'break' keyword |
| 1735 * @param label the label associated with the statement | 1920 * @param label the label associated with the statement |
| 1736 * @param semicolon the semicolon terminating the statement | 1921 * @param semicolon the semicolon terminating the statement |
| 1737 */ | 1922 */ |
| 1738 BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : thi
s.full(keyword, label, semicolon); | 1923 BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : thi
s.full(keyword, label, semicolon); |
| 1739 accept(ASTVisitor visitor) => visitor.visitBreakStatement(this); | 1924 accept(ASTVisitor visitor) => visitor.visitBreakStatement(this); |
| 1740 Token get beginToken => _keyword; | 1925 Token get beginToken => _keyword; |
| 1741 Token get endToken => _semicolon; | 1926 Token get endToken => _semicolon; |
| 1742 | 1927 |
| 1743 /** | 1928 /** |
| 1744 * Return the token representing the 'break' keyword. | 1929 * Return the token representing the 'break' keyword. |
| 1930 * |
| 1745 * @return the token representing the 'break' keyword | 1931 * @return the token representing the 'break' keyword |
| 1746 */ | 1932 */ |
| 1747 Token get keyword => _keyword; | 1933 Token get keyword => _keyword; |
| 1748 | 1934 |
| 1749 /** | 1935 /** |
| 1750 * Return the label associated with the statement, or `null` if there is no la
bel. | 1936 * Return the label associated with the statement, or `null` if there is no la
bel. |
| 1937 * |
| 1751 * @return the label associated with the statement | 1938 * @return the label associated with the statement |
| 1752 */ | 1939 */ |
| 1753 SimpleIdentifier get label => _label; | 1940 SimpleIdentifier get label => _label; |
| 1754 | 1941 |
| 1755 /** | 1942 /** |
| 1756 * Return the semicolon terminating the statement. | 1943 * Return the semicolon terminating the statement. |
| 1944 * |
| 1757 * @return the semicolon terminating the statement | 1945 * @return the semicolon terminating the statement |
| 1758 */ | 1946 */ |
| 1759 Token get semicolon => _semicolon; | 1947 Token get semicolon => _semicolon; |
| 1760 | 1948 |
| 1761 /** | 1949 /** |
| 1762 * Set the token representing the 'break' keyword to the given token. | 1950 * Set the token representing the 'break' keyword to the given token. |
| 1951 * |
| 1763 * @param keyword the token representing the 'break' keyword | 1952 * @param keyword the token representing the 'break' keyword |
| 1764 */ | 1953 */ |
| 1765 void set keyword(Token keyword2) { | 1954 void set keyword(Token keyword2) { |
| 1766 this._keyword = keyword2; | 1955 this._keyword = keyword2; |
| 1767 } | 1956 } |
| 1768 | 1957 |
| 1769 /** | 1958 /** |
| 1770 * Set the label associated with the statement to the given identifier. | 1959 * Set the label associated with the statement to the given identifier. |
| 1960 * |
| 1771 * @param identifier the label associated with the statement | 1961 * @param identifier the label associated with the statement |
| 1772 */ | 1962 */ |
| 1773 void set label(SimpleIdentifier identifier) { | 1963 void set label(SimpleIdentifier identifier) { |
| 1774 _label = becomeParentOf(identifier); | 1964 _label = becomeParentOf(identifier); |
| 1775 } | 1965 } |
| 1776 | 1966 |
| 1777 /** | 1967 /** |
| 1778 * Set the semicolon terminating the statement to the given token. | 1968 * Set the semicolon terminating the statement to the given token. |
| 1969 * |
| 1779 * @param semicolon the semicolon terminating the statement | 1970 * @param semicolon the semicolon terminating the statement |
| 1780 */ | 1971 */ |
| 1781 void set semicolon(Token semicolon2) { | 1972 void set semicolon(Token semicolon2) { |
| 1782 this._semicolon = semicolon2; | 1973 this._semicolon = semicolon2; |
| 1783 } | 1974 } |
| 1784 void visitChildren(ASTVisitor<Object> visitor) { | 1975 void visitChildren(ASTVisitor<Object> visitor) { |
| 1785 safelyVisitChild(_label, visitor); | 1976 safelyVisitChild(_label, visitor); |
| 1786 } | 1977 } |
| 1787 } | 1978 } |
| 1788 /** | 1979 /** |
| 1789 * Instances of the class `CascadeExpression` represent a sequence of cascaded e
xpressions: | 1980 * Instances of the class `CascadeExpression` represent a sequence of cascaded e
xpressions: |
| 1790 * expressions that share a common target. There are three kinds of expressions
that can be used in | 1981 * expressions that share a common target. There are three kinds of expressions
that can be used in |
| 1791 * a cascade expression: [IndexExpression], [MethodInvocation] and[PropertyAcces
s]. | 1982 * a cascade expression: [IndexExpression], [MethodInvocation] and |
| 1983 * [PropertyAccess]. |
| 1984 * |
| 1792 * <pre> | 1985 * <pre> |
| 1793 * cascadeExpression ::=[Expression conditionalExpression] cascadeSection | 1986 * cascadeExpression ::= |
| 1987 * [Expression] cascadeSection* |
| 1988 * |
| 1794 * cascadeSection ::= | 1989 * cascadeSection ::= |
| 1795 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assignme
ntOperator expressionWithoutCascade)? | 1990 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assi
gnmentOperator expressionWithoutCascade)? |
| 1991 * |
| 1796 * cascadeSelector ::= | 1992 * cascadeSelector ::= |
| 1797 * '\[ ' expression '\] ' | 1993 * '[ ' expression '] ' |
| 1798 * | identifier | 1994 * | identifier |
| 1799 * </pre> | 1995 * </pre> |
| 1996 * |
| 1800 * @coverage dart.engine.ast | 1997 * @coverage dart.engine.ast |
| 1801 */ | 1998 */ |
| 1802 class CascadeExpression extends Expression { | 1999 class CascadeExpression extends Expression { |
| 1803 | 2000 |
| 1804 /** | 2001 /** |
| 1805 * The target of the cascade sections. | 2002 * The target of the cascade sections. |
| 1806 */ | 2003 */ |
| 1807 Expression _target; | 2004 Expression _target; |
| 1808 | 2005 |
| 1809 /** | 2006 /** |
| 1810 * The cascade sections sharing the common target. | 2007 * The cascade sections sharing the common target. |
| 1811 */ | 2008 */ |
| 1812 NodeList<Expression> _cascadeSections; | 2009 NodeList<Expression> _cascadeSections; |
| 1813 | 2010 |
| 1814 /** | 2011 /** |
| 1815 * Initialize a newly created cascade expression. | 2012 * Initialize a newly created cascade expression. |
| 2013 * |
| 1816 * @param target the target of the cascade sections | 2014 * @param target the target of the cascade sections |
| 1817 * @param cascadeSections the cascade sections sharing the common target | 2015 * @param cascadeSections the cascade sections sharing the common target |
| 1818 */ | 2016 */ |
| 1819 CascadeExpression.full(Expression target, List<Expression> cascadeSections) { | 2017 CascadeExpression.full(Expression target, List<Expression> cascadeSections) { |
| 1820 this._cascadeSections = new NodeList<Expression>(this); | 2018 this._cascadeSections = new NodeList<Expression>(this); |
| 1821 this._target = becomeParentOf(target); | 2019 this._target = becomeParentOf(target); |
| 1822 this._cascadeSections.addAll(cascadeSections); | 2020 this._cascadeSections.addAll(cascadeSections); |
| 1823 } | 2021 } |
| 1824 | 2022 |
| 1825 /** | 2023 /** |
| 1826 * Initialize a newly created cascade expression. | 2024 * Initialize a newly created cascade expression. |
| 2025 * |
| 1827 * @param target the target of the cascade sections | 2026 * @param target the target of the cascade sections |
| 1828 * @param cascadeSections the cascade sections sharing the common target | 2027 * @param cascadeSections the cascade sections sharing the common target |
| 1829 */ | 2028 */ |
| 1830 CascadeExpression({Expression target, List<Expression> cascadeSections}) : thi
s.full(target, cascadeSections); | 2029 CascadeExpression({Expression target, List<Expression> cascadeSections}) : thi
s.full(target, cascadeSections); |
| 1831 accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this); | 2030 accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this); |
| 1832 Token get beginToken => _target.beginToken; | 2031 Token get beginToken => _target.beginToken; |
| 1833 | 2032 |
| 1834 /** | 2033 /** |
| 1835 * Return the cascade sections sharing the common target. | 2034 * Return the cascade sections sharing the common target. |
| 2035 * |
| 1836 * @return the cascade sections sharing the common target | 2036 * @return the cascade sections sharing the common target |
| 1837 */ | 2037 */ |
| 1838 NodeList<Expression> get cascadeSections => _cascadeSections; | 2038 NodeList<Expression> get cascadeSections => _cascadeSections; |
| 1839 Token get endToken => _cascadeSections.endToken; | 2039 Token get endToken => _cascadeSections.endToken; |
| 1840 | 2040 |
| 1841 /** | 2041 /** |
| 1842 * Return the target of the cascade sections. | 2042 * Return the target of the cascade sections. |
| 2043 * |
| 1843 * @return the target of the cascade sections | 2044 * @return the target of the cascade sections |
| 1844 */ | 2045 */ |
| 1845 Expression get target => _target; | 2046 Expression get target => _target; |
| 1846 | 2047 |
| 1847 /** | 2048 /** |
| 1848 * Set the target of the cascade sections to the given expression. | 2049 * Set the target of the cascade sections to the given expression. |
| 2050 * |
| 1849 * @param target the target of the cascade sections | 2051 * @param target the target of the cascade sections |
| 1850 */ | 2052 */ |
| 1851 void set target(Expression target2) { | 2053 void set target(Expression target2) { |
| 1852 this._target = becomeParentOf(target2); | 2054 this._target = becomeParentOf(target2); |
| 1853 } | 2055 } |
| 1854 void visitChildren(ASTVisitor<Object> visitor) { | 2056 void visitChildren(ASTVisitor<Object> visitor) { |
| 1855 safelyVisitChild(_target, visitor); | 2057 safelyVisitChild(_target, visitor); |
| 1856 _cascadeSections.accept(visitor); | 2058 _cascadeSections.accept(visitor); |
| 1857 } | 2059 } |
| 1858 } | 2060 } |
| 1859 /** | 2061 /** |
| 1860 * Instances of the class `CatchClause` represent a catch clause within a try st
atement. | 2062 * Instances of the class `CatchClause` represent a catch clause within a try st
atement. |
| 2063 * |
| 1861 * <pre> | 2064 * <pre> |
| 1862 * onPart ::= | 2065 * onPart ::= |
| 1863 * catchPart [Block block]| 'on' type catchPart? [Block block]catchPart ::= | 2066 * catchPart [Block] |
| 1864 * 'catch' '(' [SimpleIdentifier exceptionParameter] (',' [SimpleIdentifier stac
kTraceParameter])? ')' | 2067 * | 'on' type catchPart? [Block] |
| 2068 * |
| 2069 * catchPart ::= |
| 2070 * 'catch' '(' [SimpleIdentifier] (',' [SimpleIdentifier])? ')' |
| 1865 * </pre> | 2071 * </pre> |
| 2072 * |
| 1866 * @coverage dart.engine.ast | 2073 * @coverage dart.engine.ast |
| 1867 */ | 2074 */ |
| 1868 class CatchClause extends ASTNode { | 2075 class CatchClause extends ASTNode { |
| 1869 | 2076 |
| 1870 /** | 2077 /** |
| 1871 * The token representing the 'on' keyword, or `null` if there is no 'on' keyw
ord. | 2078 * The token representing the 'on' keyword, or `null` if there is no 'on' keyw
ord. |
| 1872 */ | 2079 */ |
| 1873 Token _onKeyword; | 2080 Token _onKeyword; |
| 1874 | 2081 |
| 1875 /** | 2082 /** |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 */ | 2115 */ |
| 1909 Token _rightParenthesis; | 2116 Token _rightParenthesis; |
| 1910 | 2117 |
| 1911 /** | 2118 /** |
| 1912 * The body of the catch block. | 2119 * The body of the catch block. |
| 1913 */ | 2120 */ |
| 1914 Block _body; | 2121 Block _body; |
| 1915 | 2122 |
| 1916 /** | 2123 /** |
| 1917 * Initialize a newly created catch clause. | 2124 * Initialize a newly created catch clause. |
| 2125 * |
| 1918 * @param onKeyword the token representing the 'on' keyword | 2126 * @param onKeyword the token representing the 'on' keyword |
| 1919 * @param exceptionType the type of exceptions caught by this catch clause | 2127 * @param exceptionType the type of exceptions caught by this catch clause |
| 1920 * @param leftParenthesis the left parenthesis | 2128 * @param leftParenthesis the left parenthesis |
| 1921 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown | 2129 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown |
| 1922 * @param comma the comma separating the exception parameter from the stack tr
ace parameter | 2130 * @param comma the comma separating the exception parameter from the stack tr
ace parameter |
| 1923 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with | 2131 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with |
| 1924 * the exception | 2132 * the exception |
| 1925 * @param rightParenthesis the right parenthesis | 2133 * @param rightParenthesis the right parenthesis |
| 1926 * @param body the body of the catch block | 2134 * @param body the body of the catch block |
| 1927 */ | 2135 */ |
| 1928 CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword,
Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleI
dentifier stackTraceParameter, Token rightParenthesis, Block body) { | 2136 CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword,
Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleI
dentifier stackTraceParameter, Token rightParenthesis, Block body) { |
| 1929 this._onKeyword = onKeyword; | 2137 this._onKeyword = onKeyword; |
| 1930 this._exceptionType = becomeParentOf(exceptionType); | 2138 this._exceptionType = becomeParentOf(exceptionType); |
| 1931 this._catchKeyword = catchKeyword; | 2139 this._catchKeyword = catchKeyword; |
| 1932 this._leftParenthesis = leftParenthesis; | 2140 this._leftParenthesis = leftParenthesis; |
| 1933 this._exceptionParameter = becomeParentOf(exceptionParameter); | 2141 this._exceptionParameter = becomeParentOf(exceptionParameter); |
| 1934 this._comma = comma; | 2142 this._comma = comma; |
| 1935 this._stackTraceParameter = becomeParentOf(stackTraceParameter); | 2143 this._stackTraceParameter = becomeParentOf(stackTraceParameter); |
| 1936 this._rightParenthesis = rightParenthesis; | 2144 this._rightParenthesis = rightParenthesis; |
| 1937 this._body = becomeParentOf(body); | 2145 this._body = becomeParentOf(body); |
| 1938 } | 2146 } |
| 1939 | 2147 |
| 1940 /** | 2148 /** |
| 1941 * Initialize a newly created catch clause. | 2149 * Initialize a newly created catch clause. |
| 2150 * |
| 1942 * @param onKeyword the token representing the 'on' keyword | 2151 * @param onKeyword the token representing the 'on' keyword |
| 1943 * @param exceptionType the type of exceptions caught by this catch clause | 2152 * @param exceptionType the type of exceptions caught by this catch clause |
| 1944 * @param leftParenthesis the left parenthesis | 2153 * @param leftParenthesis the left parenthesis |
| 1945 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown | 2154 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown |
| 1946 * @param comma the comma separating the exception parameter from the stack tr
ace parameter | 2155 * @param comma the comma separating the exception parameter from the stack tr
ace parameter |
| 1947 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with | 2156 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with |
| 1948 * the exception | 2157 * the exception |
| 1949 * @param rightParenthesis the right parenthesis | 2158 * @param rightParenthesis the right parenthesis |
| 1950 * @param body the body of the catch block | 2159 * @param body the body of the catch block |
| 1951 */ | 2160 */ |
| 1952 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); | 2161 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); |
| 1953 accept(ASTVisitor visitor) => visitor.visitCatchClause(this); | 2162 accept(ASTVisitor visitor) => visitor.visitCatchClause(this); |
| 1954 Token get beginToken { | 2163 Token get beginToken { |
| 1955 if (_onKeyword != null) { | 2164 if (_onKeyword != null) { |
| 1956 return _onKeyword; | 2165 return _onKeyword; |
| 1957 } | 2166 } |
| 1958 return _catchKeyword; | 2167 return _catchKeyword; |
| 1959 } | 2168 } |
| 1960 | 2169 |
| 1961 /** | 2170 /** |
| 1962 * Return the body of the catch block. | 2171 * Return the body of the catch block. |
| 2172 * |
| 1963 * @return the body of the catch block | 2173 * @return the body of the catch block |
| 1964 */ | 2174 */ |
| 1965 Block get body => _body; | 2175 Block get body => _body; |
| 1966 | 2176 |
| 1967 /** | 2177 /** |
| 1968 * Return the token representing the 'catch' keyword, or `null` if there is no
'catch' | 2178 * Return the token representing the 'catch' keyword, or `null` if there is no
'catch' |
| 1969 * keyword. | 2179 * keyword. |
| 2180 * |
| 1970 * @return the token representing the 'catch' keyword | 2181 * @return the token representing the 'catch' keyword |
| 1971 */ | 2182 */ |
| 1972 Token get catchKeyword => _catchKeyword; | 2183 Token get catchKeyword => _catchKeyword; |
| 1973 | 2184 |
| 1974 /** | 2185 /** |
| 1975 * Return the comma. | 2186 * Return the comma. |
| 2187 * |
| 1976 * @return the comma | 2188 * @return the comma |
| 1977 */ | 2189 */ |
| 1978 Token get comma => _comma; | 2190 Token get comma => _comma; |
| 1979 Token get endToken => _body.endToken; | 2191 Token get endToken => _body.endToken; |
| 1980 | 2192 |
| 1981 /** | 2193 /** |
| 1982 * Return the parameter whose value will be the exception that was thrown. | 2194 * Return the parameter whose value will be the exception that was thrown. |
| 2195 * |
| 1983 * @return the parameter whose value will be the exception that was thrown | 2196 * @return the parameter whose value will be the exception that was thrown |
| 1984 */ | 2197 */ |
| 1985 SimpleIdentifier get exceptionParameter => _exceptionParameter; | 2198 SimpleIdentifier get exceptionParameter => _exceptionParameter; |
| 1986 | 2199 |
| 1987 /** | 2200 /** |
| 1988 * Return the type of exceptions caught by this catch clause, or `null` if thi
s catch clause | 2201 * Return the type of exceptions caught by this catch clause, or `null` if thi
s catch clause |
| 1989 * catches every type of exception. | 2202 * catches every type of exception. |
| 2203 * |
| 1990 * @return the type of exceptions caught by this catch clause | 2204 * @return the type of exceptions caught by this catch clause |
| 1991 */ | 2205 */ |
| 1992 TypeName get exceptionType => _exceptionType; | 2206 TypeName get exceptionType => _exceptionType; |
| 1993 | 2207 |
| 1994 /** | 2208 /** |
| 1995 * Return the left parenthesis. | 2209 * Return the left parenthesis. |
| 2210 * |
| 1996 * @return the left parenthesis | 2211 * @return the left parenthesis |
| 1997 */ | 2212 */ |
| 1998 Token get leftParenthesis => _leftParenthesis; | 2213 Token get leftParenthesis => _leftParenthesis; |
| 1999 | 2214 |
| 2000 /** | 2215 /** |
| 2001 * Return the token representing the 'on' keyword, or `null` if there is no 'o
n' keyword. | 2216 * Return the token representing the 'on' keyword, or `null` if there is no 'o
n' keyword. |
| 2217 * |
| 2002 * @return the token representing the 'on' keyword | 2218 * @return the token representing the 'on' keyword |
| 2003 */ | 2219 */ |
| 2004 Token get onKeyword => _onKeyword; | 2220 Token get onKeyword => _onKeyword; |
| 2005 | 2221 |
| 2006 /** | 2222 /** |
| 2007 * Return the right parenthesis. | 2223 * Return the right parenthesis. |
| 2224 * |
| 2008 * @return the right parenthesis | 2225 * @return the right parenthesis |
| 2009 */ | 2226 */ |
| 2010 Token get rightParenthesis => _rightParenthesis; | 2227 Token get rightParenthesis => _rightParenthesis; |
| 2011 | 2228 |
| 2012 /** | 2229 /** |
| 2013 * Return the parameter whose value will be the stack trace associated with th
e exception. | 2230 * Return the parameter whose value will be the stack trace associated with th
e exception. |
| 2231 * |
| 2014 * @return the parameter whose value will be the stack trace associated with t
he exception | 2232 * @return the parameter whose value will be the stack trace associated with t
he exception |
| 2015 */ | 2233 */ |
| 2016 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; | 2234 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; |
| 2017 | 2235 |
| 2018 /** | 2236 /** |
| 2019 * Set the body of the catch block to the given block. | 2237 * Set the body of the catch block to the given block. |
| 2238 * |
| 2020 * @param block the body of the catch block | 2239 * @param block the body of the catch block |
| 2021 */ | 2240 */ |
| 2022 void set body(Block block) { | 2241 void set body(Block block) { |
| 2023 _body = becomeParentOf(block); | 2242 _body = becomeParentOf(block); |
| 2024 } | 2243 } |
| 2025 | 2244 |
| 2026 /** | 2245 /** |
| 2027 * Set the token representing the 'catch' keyword to the given token. | 2246 * Set the token representing the 'catch' keyword to the given token. |
| 2247 * |
| 2028 * @param catchKeyword the token representing the 'catch' keyword | 2248 * @param catchKeyword the token representing the 'catch' keyword |
| 2029 */ | 2249 */ |
| 2030 void set catchKeyword(Token catchKeyword2) { | 2250 void set catchKeyword(Token catchKeyword2) { |
| 2031 this._catchKeyword = catchKeyword2; | 2251 this._catchKeyword = catchKeyword2; |
| 2032 } | 2252 } |
| 2033 | 2253 |
| 2034 /** | 2254 /** |
| 2035 * Set the comma to the given token. | 2255 * Set the comma to the given token. |
| 2256 * |
| 2036 * @param comma the comma | 2257 * @param comma the comma |
| 2037 */ | 2258 */ |
| 2038 void set comma(Token comma2) { | 2259 void set comma(Token comma2) { |
| 2039 this._comma = comma2; | 2260 this._comma = comma2; |
| 2040 } | 2261 } |
| 2041 | 2262 |
| 2042 /** | 2263 /** |
| 2043 * Set the parameter whose value will be the exception that was thrown to the
given parameter. | 2264 * Set the parameter whose value will be the exception that was thrown to the
given parameter. |
| 2265 * |
| 2044 * @param parameter the parameter whose value will be the exception that was t
hrown | 2266 * @param parameter the parameter whose value will be the exception that was t
hrown |
| 2045 */ | 2267 */ |
| 2046 void set exceptionParameter(SimpleIdentifier parameter) { | 2268 void set exceptionParameter(SimpleIdentifier parameter) { |
| 2047 _exceptionParameter = becomeParentOf(parameter); | 2269 _exceptionParameter = becomeParentOf(parameter); |
| 2048 } | 2270 } |
| 2049 | 2271 |
| 2050 /** | 2272 /** |
| 2051 * Set the type of exceptions caught by this catch clause to the given type. | 2273 * Set the type of exceptions caught by this catch clause to the given type. |
| 2274 * |
| 2052 * @param exceptionType the type of exceptions caught by this catch clause | 2275 * @param exceptionType the type of exceptions caught by this catch clause |
| 2053 */ | 2276 */ |
| 2054 void set exceptionType(TypeName exceptionType2) { | 2277 void set exceptionType(TypeName exceptionType2) { |
| 2055 this._exceptionType = exceptionType2; | 2278 this._exceptionType = exceptionType2; |
| 2056 } | 2279 } |
| 2057 | 2280 |
| 2058 /** | 2281 /** |
| 2059 * Set the left parenthesis to the given token. | 2282 * Set the left parenthesis to the given token. |
| 2283 * |
| 2060 * @param parenthesis the left parenthesis | 2284 * @param parenthesis the left parenthesis |
| 2061 */ | 2285 */ |
| 2062 void set leftParenthesis(Token parenthesis) { | 2286 void set leftParenthesis(Token parenthesis) { |
| 2063 _leftParenthesis = parenthesis; | 2287 _leftParenthesis = parenthesis; |
| 2064 } | 2288 } |
| 2065 | 2289 |
| 2066 /** | 2290 /** |
| 2067 * Set the token representing the 'on' keyword to the given keyword. | 2291 * Set the token representing the 'on' keyword to the given keyword. |
| 2292 * |
| 2068 * @param onKeyword the token representing the 'on' keyword | 2293 * @param onKeyword the token representing the 'on' keyword |
| 2069 */ | 2294 */ |
| 2070 void set onKeyword(Token onKeyword2) { | 2295 void set onKeyword(Token onKeyword2) { |
| 2071 this._onKeyword = onKeyword2; | 2296 this._onKeyword = onKeyword2; |
| 2072 } | 2297 } |
| 2073 | 2298 |
| 2074 /** | 2299 /** |
| 2075 * Set the right parenthesis to the given token. | 2300 * Set the right parenthesis to the given token. |
| 2301 * |
| 2076 * @param parenthesis the right parenthesis | 2302 * @param parenthesis the right parenthesis |
| 2077 */ | 2303 */ |
| 2078 void set rightParenthesis(Token parenthesis) { | 2304 void set rightParenthesis(Token parenthesis) { |
| 2079 _rightParenthesis = parenthesis; | 2305 _rightParenthesis = parenthesis; |
| 2080 } | 2306 } |
| 2081 | 2307 |
| 2082 /** | 2308 /** |
| 2083 * Set the parameter whose value will be the stack trace associated with the e
xception to the | 2309 * Set the parameter whose value will be the stack trace associated with the e
xception to the |
| 2084 * given parameter. | 2310 * given parameter. |
| 2311 * |
| 2085 * @param parameter the parameter whose value will be the stack trace associat
ed with the | 2312 * @param parameter the parameter whose value will be the stack trace associat
ed with the |
| 2086 * exception | 2313 * exception |
| 2087 */ | 2314 */ |
| 2088 void set stackTraceParameter(SimpleIdentifier parameter) { | 2315 void set stackTraceParameter(SimpleIdentifier parameter) { |
| 2089 _stackTraceParameter = becomeParentOf(parameter); | 2316 _stackTraceParameter = becomeParentOf(parameter); |
| 2090 } | 2317 } |
| 2091 void visitChildren(ASTVisitor<Object> visitor) { | 2318 void visitChildren(ASTVisitor<Object> visitor) { |
| 2092 safelyVisitChild(_exceptionType, visitor); | 2319 safelyVisitChild(_exceptionType, visitor); |
| 2093 safelyVisitChild(_exceptionParameter, visitor); | 2320 safelyVisitChild(_exceptionParameter, visitor); |
| 2094 safelyVisitChild(_stackTraceParameter, visitor); | 2321 safelyVisitChild(_stackTraceParameter, visitor); |
| 2095 safelyVisitChild(_body, visitor); | 2322 safelyVisitChild(_body, visitor); |
| 2096 } | 2323 } |
| 2097 } | 2324 } |
| 2098 /** | 2325 /** |
| 2099 * Instances of the class `ClassDeclaration` represent the declaration of a clas
s. | 2326 * Instances of the class `ClassDeclaration` represent the declaration of a clas
s. |
| 2327 * |
| 2100 * <pre> | 2328 * <pre> |
| 2101 * classDeclaration ::= | 2329 * classDeclaration ::= |
| 2102 * 'abstract'? 'class' [SimpleIdentifier name] [TypeParameterList typeParameterL
ist]? | 2330 * 'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]? |
| 2103 * ([ExtendsClause extendsClause] [WithClause withClause]?)?[ImplementsClause im
plementsClause]? | 2331 * ([ExtendsClause] [WithClause]?)? |
| 2104 * '{' [ClassMember classMember]* '}' | 2332 * [ImplementsClause]? |
| 2333 * '{' [ClassMember]* '}' |
| 2105 * </pre> | 2334 * </pre> |
| 2335 * |
| 2106 * @coverage dart.engine.ast | 2336 * @coverage dart.engine.ast |
| 2107 */ | 2337 */ |
| 2108 class ClassDeclaration extends CompilationUnitMember { | 2338 class ClassDeclaration extends CompilationUnitMember { |
| 2109 | 2339 |
| 2110 /** | 2340 /** |
| 2111 * The 'abstract' keyword, or `null` if the keyword was absent. | 2341 * The 'abstract' keyword, or `null` if the keyword was absent. |
| 2112 */ | 2342 */ |
| 2113 Token _abstractKeyword; | 2343 Token _abstractKeyword; |
| 2114 | 2344 |
| 2115 /** | 2345 /** |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 */ | 2384 */ |
| 2155 NodeList<ClassMember> _members; | 2385 NodeList<ClassMember> _members; |
| 2156 | 2386 |
| 2157 /** | 2387 /** |
| 2158 * The right curly bracket. | 2388 * The right curly bracket. |
| 2159 */ | 2389 */ |
| 2160 Token _rightBracket; | 2390 Token _rightBracket; |
| 2161 | 2391 |
| 2162 /** | 2392 /** |
| 2163 * Initialize a newly created class declaration. | 2393 * Initialize a newly created class declaration. |
| 2394 * |
| 2164 * @param comment the documentation comment associated with this class | 2395 * @param comment the documentation comment associated with this class |
| 2165 * @param metadata the annotations associated with this class | 2396 * @param metadata the annotations associated with this class |
| 2166 * @param abstractKeyword the 'abstract' keyword, or `null` if the keyword was
absent | 2397 * @param abstractKeyword the 'abstract' keyword, or `null` if the keyword was
absent |
| 2167 * @param classKeyword the token representing the 'class' keyword | 2398 * @param classKeyword the token representing the 'class' keyword |
| 2168 * @param name the name of the class being declared | 2399 * @param name the name of the class being declared |
| 2169 * @param typeParameters the type parameters for the class | 2400 * @param typeParameters the type parameters for the class |
| 2170 * @param extendsClause the extends clause for the class | 2401 * @param extendsClause the extends clause for the class |
| 2171 * @param withClause the with clause for the class | 2402 * @param withClause the with clause for the class |
| 2172 * @param implementsClause the implements clause for the class | 2403 * @param implementsClause the implements clause for the class |
| 2173 * @param leftBracket the left curly bracket | 2404 * @param leftBracket the left curly bracket |
| 2174 * @param members the members defined by the class | 2405 * @param members the members defined by the class |
| 2175 * @param rightBracket the right curly bracket | 2406 * @param rightBracket the right curly bracket |
| 2176 */ | 2407 */ |
| 2177 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) { | 2408 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) { |
| 2178 this._members = new NodeList<ClassMember>(this); | 2409 this._members = new NodeList<ClassMember>(this); |
| 2179 this._abstractKeyword = abstractKeyword; | 2410 this._abstractKeyword = abstractKeyword; |
| 2180 this._classKeyword = classKeyword; | 2411 this._classKeyword = classKeyword; |
| 2181 this._name = becomeParentOf(name); | 2412 this._name = becomeParentOf(name); |
| 2182 this._typeParameters = becomeParentOf(typeParameters); | 2413 this._typeParameters = becomeParentOf(typeParameters); |
| 2183 this._extendsClause = becomeParentOf(extendsClause); | 2414 this._extendsClause = becomeParentOf(extendsClause); |
| 2184 this._withClause = becomeParentOf(withClause); | 2415 this._withClause = becomeParentOf(withClause); |
| 2185 this._implementsClause = becomeParentOf(implementsClause); | 2416 this._implementsClause = becomeParentOf(implementsClause); |
| 2186 this._leftBracket = leftBracket; | 2417 this._leftBracket = leftBracket; |
| 2187 this._members.addAll(members); | 2418 this._members.addAll(members); |
| 2188 this._rightBracket = rightBracket; | 2419 this._rightBracket = rightBracket; |
| 2189 } | 2420 } |
| 2190 | 2421 |
| 2191 /** | 2422 /** |
| 2192 * Initialize a newly created class declaration. | 2423 * Initialize a newly created class declaration. |
| 2424 * |
| 2193 * @param comment the documentation comment associated with this class | 2425 * @param comment the documentation comment associated with this class |
| 2194 * @param metadata the annotations associated with this class | 2426 * @param metadata the annotations associated with this class |
| 2195 * @param abstractKeyword the 'abstract' keyword, or `null` if the keyword was
absent | 2427 * @param abstractKeyword the 'abstract' keyword, or `null` if the keyword was
absent |
| 2196 * @param classKeyword the token representing the 'class' keyword | 2428 * @param classKeyword the token representing the 'class' keyword |
| 2197 * @param name the name of the class being declared | 2429 * @param name the name of the class being declared |
| 2198 * @param typeParameters the type parameters for the class | 2430 * @param typeParameters the type parameters for the class |
| 2199 * @param extendsClause the extends clause for the class | 2431 * @param extendsClause the extends clause for the class |
| 2200 * @param withClause the with clause for the class | 2432 * @param withClause the with clause for the class |
| 2201 * @param implementsClause the implements clause for the class | 2433 * @param implementsClause the implements clause for the class |
| 2202 * @param leftBracket the left curly bracket | 2434 * @param leftBracket the left curly bracket |
| 2203 * @param members the members defined by the class | 2435 * @param members the members defined by the class |
| 2204 * @param rightBracket the right curly bracket | 2436 * @param rightBracket the right curly bracket |
| 2205 */ | 2437 */ |
| 2206 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); | 2438 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); |
| 2207 accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); | 2439 accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); |
| 2208 | 2440 |
| 2209 /** | 2441 /** |
| 2210 * Return the 'abstract' keyword, or `null` if the keyword was absent. | 2442 * Return the 'abstract' keyword, or `null` if the keyword was absent. |
| 2443 * |
| 2211 * @return the 'abstract' keyword | 2444 * @return the 'abstract' keyword |
| 2212 */ | 2445 */ |
| 2213 Token get abstractKeyword => _abstractKeyword; | 2446 Token get abstractKeyword => _abstractKeyword; |
| 2214 | 2447 |
| 2215 /** | 2448 /** |
| 2216 * Return the token representing the 'class' keyword. | 2449 * Return the token representing the 'class' keyword. |
| 2450 * |
| 2217 * @return the token representing the 'class' keyword | 2451 * @return the token representing the 'class' keyword |
| 2218 */ | 2452 */ |
| 2219 Token get classKeyword => _classKeyword; | 2453 Token get classKeyword => _classKeyword; |
| 2220 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; | 2454 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; |
| 2221 Token get endToken => _rightBracket; | 2455 Token get endToken => _rightBracket; |
| 2222 | 2456 |
| 2223 /** | 2457 /** |
| 2224 * Return the extends clause for this class, or `null` if the class does not e
xtend any | 2458 * Return the extends clause for this class, or `null` if the class does not e
xtend any |
| 2225 * other class. | 2459 * other class. |
| 2460 * |
| 2226 * @return the extends clause for this class | 2461 * @return the extends clause for this class |
| 2227 */ | 2462 */ |
| 2228 ExtendsClause get extendsClause => _extendsClause; | 2463 ExtendsClause get extendsClause => _extendsClause; |
| 2229 | 2464 |
| 2230 /** | 2465 /** |
| 2231 * Return the implements clause for the class, or `null` if the class does not
implement any | 2466 * Return the implements clause for the class, or `null` if the class does not
implement any |
| 2232 * interfaces. | 2467 * interfaces. |
| 2468 * |
| 2233 * @return the implements clause for the class | 2469 * @return the implements clause for the class |
| 2234 */ | 2470 */ |
| 2235 ImplementsClause get implementsClause => _implementsClause; | 2471 ImplementsClause get implementsClause => _implementsClause; |
| 2236 | 2472 |
| 2237 /** | 2473 /** |
| 2238 * Return the left curly bracket. | 2474 * Return the left curly bracket. |
| 2475 * |
| 2239 * @return the left curly bracket | 2476 * @return the left curly bracket |
| 2240 */ | 2477 */ |
| 2241 Token get leftBracket => _leftBracket; | 2478 Token get leftBracket => _leftBracket; |
| 2242 | 2479 |
| 2243 /** | 2480 /** |
| 2244 * Return the members defined by the class. | 2481 * Return the members defined by the class. |
| 2482 * |
| 2245 * @return the members defined by the class | 2483 * @return the members defined by the class |
| 2246 */ | 2484 */ |
| 2247 NodeList<ClassMember> get members => _members; | 2485 NodeList<ClassMember> get members => _members; |
| 2248 | 2486 |
| 2249 /** | 2487 /** |
| 2250 * Return the name of the class being declared. | 2488 * Return the name of the class being declared. |
| 2489 * |
| 2251 * @return the name of the class being declared | 2490 * @return the name of the class being declared |
| 2252 */ | 2491 */ |
| 2253 SimpleIdentifier get name => _name; | 2492 SimpleIdentifier get name => _name; |
| 2254 | 2493 |
| 2255 /** | 2494 /** |
| 2256 * Return the right curly bracket. | 2495 * Return the right curly bracket. |
| 2496 * |
| 2257 * @return the right curly bracket | 2497 * @return the right curly bracket |
| 2258 */ | 2498 */ |
| 2259 Token get rightBracket => _rightBracket; | 2499 Token get rightBracket => _rightBracket; |
| 2260 | 2500 |
| 2261 /** | 2501 /** |
| 2262 * Return the type parameters for the class, or `null` if the class does not h
ave any type | 2502 * Return the type parameters for the class, or `null` if the class does not h
ave any type |
| 2263 * parameters. | 2503 * parameters. |
| 2504 * |
| 2264 * @return the type parameters for the class | 2505 * @return the type parameters for the class |
| 2265 */ | 2506 */ |
| 2266 TypeParameterList get typeParameters => _typeParameters; | 2507 TypeParameterList get typeParameters => _typeParameters; |
| 2267 | 2508 |
| 2268 /** | 2509 /** |
| 2269 * Return the with clause for the class, or `null` if the class does not have
a with clause. | 2510 * Return the with clause for the class, or `null` if the class does not have
a with clause. |
| 2511 * |
| 2270 * @return the with clause for the class | 2512 * @return the with clause for the class |
| 2271 */ | 2513 */ |
| 2272 WithClause get withClause => _withClause; | 2514 WithClause get withClause => _withClause; |
| 2273 | 2515 |
| 2274 /** | 2516 /** |
| 2275 * Set the 'abstract' keyword to the given keyword. | 2517 * Set the 'abstract' keyword to the given keyword. |
| 2518 * |
| 2276 * @param abstractKeyword the 'abstract' keyword | 2519 * @param abstractKeyword the 'abstract' keyword |
| 2277 */ | 2520 */ |
| 2278 void set abstractKeyword(Token abstractKeyword2) { | 2521 void set abstractKeyword(Token abstractKeyword2) { |
| 2279 this._abstractKeyword = abstractKeyword2; | 2522 this._abstractKeyword = abstractKeyword2; |
| 2280 } | 2523 } |
| 2281 | 2524 |
| 2282 /** | 2525 /** |
| 2283 * Set the token representing the 'class' keyword to the given token. | 2526 * Set the token representing the 'class' keyword to the given token. |
| 2527 * |
| 2284 * @param classKeyword the token representing the 'class' keyword | 2528 * @param classKeyword the token representing the 'class' keyword |
| 2285 */ | 2529 */ |
| 2286 void set classKeyword(Token classKeyword2) { | 2530 void set classKeyword(Token classKeyword2) { |
| 2287 this._classKeyword = classKeyword2; | 2531 this._classKeyword = classKeyword2; |
| 2288 } | 2532 } |
| 2289 | 2533 |
| 2290 /** | 2534 /** |
| 2291 * Set the extends clause for this class to the given clause. | 2535 * Set the extends clause for this class to the given clause. |
| 2536 * |
| 2292 * @param extendsClause the extends clause for this class | 2537 * @param extendsClause the extends clause for this class |
| 2293 */ | 2538 */ |
| 2294 void set extendsClause(ExtendsClause extendsClause2) { | 2539 void set extendsClause(ExtendsClause extendsClause2) { |
| 2295 this._extendsClause = becomeParentOf(extendsClause2); | 2540 this._extendsClause = becomeParentOf(extendsClause2); |
| 2296 } | 2541 } |
| 2297 | 2542 |
| 2298 /** | 2543 /** |
| 2299 * Set the implements clause for the class to the given clause. | 2544 * Set the implements clause for the class to the given clause. |
| 2545 * |
| 2300 * @param implementsClause the implements clause for the class | 2546 * @param implementsClause the implements clause for the class |
| 2301 */ | 2547 */ |
| 2302 void set implementsClause(ImplementsClause implementsClause2) { | 2548 void set implementsClause(ImplementsClause implementsClause2) { |
| 2303 this._implementsClause = becomeParentOf(implementsClause2); | 2549 this._implementsClause = becomeParentOf(implementsClause2); |
| 2304 } | 2550 } |
| 2305 | 2551 |
| 2306 /** | 2552 /** |
| 2307 * Set the left curly bracket to the given token. | 2553 * Set the left curly bracket to the given token. |
| 2554 * |
| 2308 * @param leftBracket the left curly bracket | 2555 * @param leftBracket the left curly bracket |
| 2309 */ | 2556 */ |
| 2310 void set leftBracket(Token leftBracket2) { | 2557 void set leftBracket(Token leftBracket2) { |
| 2311 this._leftBracket = leftBracket2; | 2558 this._leftBracket = leftBracket2; |
| 2312 } | 2559 } |
| 2313 | 2560 |
| 2314 /** | 2561 /** |
| 2315 * Set the name of the class being declared to the given identifier. | 2562 * Set the name of the class being declared to the given identifier. |
| 2563 * |
| 2316 * @param identifier the name of the class being declared | 2564 * @param identifier the name of the class being declared |
| 2317 */ | 2565 */ |
| 2318 void set name(SimpleIdentifier identifier) { | 2566 void set name(SimpleIdentifier identifier) { |
| 2319 _name = becomeParentOf(identifier); | 2567 _name = becomeParentOf(identifier); |
| 2320 } | 2568 } |
| 2321 | 2569 |
| 2322 /** | 2570 /** |
| 2323 * Set the right curly bracket to the given token. | 2571 * Set the right curly bracket to the given token. |
| 2572 * |
| 2324 * @param rightBracket the right curly bracket | 2573 * @param rightBracket the right curly bracket |
| 2325 */ | 2574 */ |
| 2326 void set rightBracket(Token rightBracket2) { | 2575 void set rightBracket(Token rightBracket2) { |
| 2327 this._rightBracket = rightBracket2; | 2576 this._rightBracket = rightBracket2; |
| 2328 } | 2577 } |
| 2329 | 2578 |
| 2330 /** | 2579 /** |
| 2331 * Set the type parameters for the class to the given list of type parameters. | 2580 * Set the type parameters for the class to the given list of type parameters. |
| 2581 * |
| 2332 * @param typeParameters the type parameters for the class | 2582 * @param typeParameters the type parameters for the class |
| 2333 */ | 2583 */ |
| 2334 void set typeParameters(TypeParameterList typeParameters2) { | 2584 void set typeParameters(TypeParameterList typeParameters2) { |
| 2335 this._typeParameters = typeParameters2; | 2585 this._typeParameters = typeParameters2; |
| 2336 } | 2586 } |
| 2337 | 2587 |
| 2338 /** | 2588 /** |
| 2339 * Set the with clause for the class to the given clause. | 2589 * Set the with clause for the class to the given clause. |
| 2590 * |
| 2340 * @param withClause the with clause for the class | 2591 * @param withClause the with clause for the class |
| 2341 */ | 2592 */ |
| 2342 void set withClause(WithClause withClause2) { | 2593 void set withClause(WithClause withClause2) { |
| 2343 this._withClause = becomeParentOf(withClause2); | 2594 this._withClause = becomeParentOf(withClause2); |
| 2344 } | 2595 } |
| 2345 void visitChildren(ASTVisitor<Object> visitor) { | 2596 void visitChildren(ASTVisitor<Object> visitor) { |
| 2346 super.visitChildren(visitor); | 2597 super.visitChildren(visitor); |
| 2347 safelyVisitChild(_name, visitor); | 2598 safelyVisitChild(_name, visitor); |
| 2348 safelyVisitChild(_typeParameters, visitor); | 2599 safelyVisitChild(_typeParameters, visitor); |
| 2349 safelyVisitChild(_extendsClause, visitor); | 2600 safelyVisitChild(_extendsClause, visitor); |
| 2350 safelyVisitChild(_withClause, visitor); | 2601 safelyVisitChild(_withClause, visitor); |
| 2351 safelyVisitChild(_implementsClause, visitor); | 2602 safelyVisitChild(_implementsClause, visitor); |
| 2352 members.accept(visitor); | 2603 members.accept(visitor); |
| 2353 } | 2604 } |
| 2354 Token get firstTokenAfterCommentAndMetadata { | 2605 Token get firstTokenAfterCommentAndMetadata { |
| 2355 if (_abstractKeyword != null) { | 2606 if (_abstractKeyword != null) { |
| 2356 return _abstractKeyword; | 2607 return _abstractKeyword; |
| 2357 } | 2608 } |
| 2358 return _classKeyword; | 2609 return _classKeyword; |
| 2359 } | 2610 } |
| 2360 } | 2611 } |
| 2361 /** | 2612 /** |
| 2362 * The abstract class `ClassMember` defines the behavior common to nodes that de
clare a name | 2613 * The abstract class `ClassMember` defines the behavior common to nodes that de
clare a name |
| 2363 * within the scope of a class. | 2614 * within the scope of a class. |
| 2615 * |
| 2364 * @coverage dart.engine.ast | 2616 * @coverage dart.engine.ast |
| 2365 */ | 2617 */ |
| 2366 abstract class ClassMember extends Declaration { | 2618 abstract class ClassMember extends Declaration { |
| 2367 | 2619 |
| 2368 /** | 2620 /** |
| 2369 * Initialize a newly created member of a class. | 2621 * Initialize a newly created member of a class. |
| 2622 * |
| 2370 * @param comment the documentation comment associated with this member | 2623 * @param comment the documentation comment associated with this member |
| 2371 * @param metadata the annotations associated with this member | 2624 * @param metadata the annotations associated with this member |
| 2372 */ | 2625 */ |
| 2373 ClassMember.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { | 2626 ClassMember.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { |
| 2374 } | 2627 } |
| 2375 | 2628 |
| 2376 /** | 2629 /** |
| 2377 * Initialize a newly created member of a class. | 2630 * Initialize a newly created member of a class. |
| 2631 * |
| 2378 * @param comment the documentation comment associated with this member | 2632 * @param comment the documentation comment associated with this member |
| 2379 * @param metadata the annotations associated with this member | 2633 * @param metadata the annotations associated with this member |
| 2380 */ | 2634 */ |
| 2381 ClassMember({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); | 2635 ClassMember({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); |
| 2382 } | 2636 } |
| 2383 /** | 2637 /** |
| 2384 * Instances of the class `ClassTypeAlias` represent a class type alias. | 2638 * Instances of the class `ClassTypeAlias` represent a class type alias. |
| 2639 * |
| 2385 * <pre> | 2640 * <pre> |
| 2386 * classTypeAlias ::=[SimpleIdentifier identifier] [TypeParameterList typeParame
ters]? '=' 'abstract'? mixinApplication | 2641 * classTypeAlias ::= |
| 2387 * mixinApplication ::=[TypeName superclass] [WithClause withClause] [Implements
Clause implementsClause]? ';' | 2642 * [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplication |
| 2643 * |
| 2644 * mixinApplication ::= |
| 2645 * [TypeName] [WithClause] [ImplementsClause]? ';' |
| 2388 * </pre> | 2646 * </pre> |
| 2647 * |
| 2389 * @coverage dart.engine.ast | 2648 * @coverage dart.engine.ast |
| 2390 */ | 2649 */ |
| 2391 class ClassTypeAlias extends TypeAlias { | 2650 class ClassTypeAlias extends TypeAlias { |
| 2392 | 2651 |
| 2393 /** | 2652 /** |
| 2394 * The name of the class being declared. | 2653 * The name of the class being declared. |
| 2395 */ | 2654 */ |
| 2396 SimpleIdentifier _name; | 2655 SimpleIdentifier _name; |
| 2397 | 2656 |
| 2398 /** | 2657 /** |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2422 */ | 2681 */ |
| 2423 WithClause _withClause; | 2682 WithClause _withClause; |
| 2424 | 2683 |
| 2425 /** | 2684 /** |
| 2426 * The implements clause for this class, or `null` if there is no implements c
lause. | 2685 * The implements clause for this class, or `null` if there is no implements c
lause. |
| 2427 */ | 2686 */ |
| 2428 ImplementsClause _implementsClause; | 2687 ImplementsClause _implementsClause; |
| 2429 | 2688 |
| 2430 /** | 2689 /** |
| 2431 * Initialize a newly created class type alias. | 2690 * Initialize a newly created class type alias. |
| 2691 * |
| 2432 * @param comment the documentation comment associated with this type alias | 2692 * @param comment the documentation comment associated with this type alias |
| 2433 * @param metadata the annotations associated with this type alias | 2693 * @param metadata the annotations associated with this type alias |
| 2434 * @param keyword the token representing the 'typedef' keyword | 2694 * @param keyword the token representing the 'typedef' keyword |
| 2435 * @param name the name of the class being declared | 2695 * @param name the name of the class being declared |
| 2436 * @param typeParameters the type parameters for the class | 2696 * @param typeParameters the type parameters for the class |
| 2437 * @param equals the token for the '=' separating the name from the definition | 2697 * @param equals the token for the '=' separating the name from the definition |
| 2438 * @param abstractKeyword the token for the 'abstract' keyword | 2698 * @param abstractKeyword the token for the 'abstract' keyword |
| 2439 * @param superclass the name of the superclass of the class being declared | 2699 * @param superclass the name of the superclass of the class being declared |
| 2440 * @param withClause the with clause for this class | 2700 * @param withClause the with clause for this class |
| 2441 * @param implementsClause the implements clause for this class | 2701 * @param implementsClause the implements clause for this class |
| 2442 * @param semicolon the semicolon terminating the declaration | 2702 * @param semicolon the semicolon terminating the declaration |
| 2443 */ | 2703 */ |
| 2444 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) { | 2704 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) { |
| 2445 this._name = becomeParentOf(name); | 2705 this._name = becomeParentOf(name); |
| 2446 this._typeParameters = becomeParentOf(typeParameters); | 2706 this._typeParameters = becomeParentOf(typeParameters); |
| 2447 this._equals = equals; | 2707 this._equals = equals; |
| 2448 this._abstractKeyword = abstractKeyword; | 2708 this._abstractKeyword = abstractKeyword; |
| 2449 this._superclass = becomeParentOf(superclass); | 2709 this._superclass = becomeParentOf(superclass); |
| 2450 this._withClause = becomeParentOf(withClause); | 2710 this._withClause = becomeParentOf(withClause); |
| 2451 this._implementsClause = becomeParentOf(implementsClause); | 2711 this._implementsClause = becomeParentOf(implementsClause); |
| 2452 } | 2712 } |
| 2453 | 2713 |
| 2454 /** | 2714 /** |
| 2455 * Initialize a newly created class type alias. | 2715 * Initialize a newly created class type alias. |
| 2716 * |
| 2456 * @param comment the documentation comment associated with this type alias | 2717 * @param comment the documentation comment associated with this type alias |
| 2457 * @param metadata the annotations associated with this type alias | 2718 * @param metadata the annotations associated with this type alias |
| 2458 * @param keyword the token representing the 'typedef' keyword | 2719 * @param keyword the token representing the 'typedef' keyword |
| 2459 * @param name the name of the class being declared | 2720 * @param name the name of the class being declared |
| 2460 * @param typeParameters the type parameters for the class | 2721 * @param typeParameters the type parameters for the class |
| 2461 * @param equals the token for the '=' separating the name from the definition | 2722 * @param equals the token for the '=' separating the name from the definition |
| 2462 * @param abstractKeyword the token for the 'abstract' keyword | 2723 * @param abstractKeyword the token for the 'abstract' keyword |
| 2463 * @param superclass the name of the superclass of the class being declared | 2724 * @param superclass the name of the superclass of the class being declared |
| 2464 * @param withClause the with clause for this class | 2725 * @param withClause the with clause for this class |
| 2465 * @param implementsClause the implements clause for this class | 2726 * @param implementsClause the implements clause for this class |
| 2466 * @param semicolon the semicolon terminating the declaration | 2727 * @param semicolon the semicolon terminating the declaration |
| 2467 */ | 2728 */ |
| 2468 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); | 2729 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); |
| 2469 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); | 2730 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); |
| 2470 | 2731 |
| 2471 /** | 2732 /** |
| 2472 * Return the token for the 'abstract' keyword, or `null` if this is not defin
ing an | 2733 * Return the token for the 'abstract' keyword, or `null` if this is not defin
ing an |
| 2473 * abstract class. | 2734 * abstract class. |
| 2735 * |
| 2474 * @return the token for the 'abstract' keyword | 2736 * @return the token for the 'abstract' keyword |
| 2475 */ | 2737 */ |
| 2476 Token get abstractKeyword => _abstractKeyword; | 2738 Token get abstractKeyword => _abstractKeyword; |
| 2477 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; | 2739 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; |
| 2478 | 2740 |
| 2479 /** | 2741 /** |
| 2480 * Return the token for the '=' separating the name from the definition. | 2742 * Return the token for the '=' separating the name from the definition. |
| 2743 * |
| 2481 * @return the token for the '=' separating the name from the definition | 2744 * @return the token for the '=' separating the name from the definition |
| 2482 */ | 2745 */ |
| 2483 Token get equals => _equals; | 2746 Token get equals => _equals; |
| 2484 | 2747 |
| 2485 /** | 2748 /** |
| 2486 * Return the implements clause for this class, or `null` if there is no imple
ments clause. | 2749 * Return the implements clause for this class, or `null` if there is no imple
ments clause. |
| 2750 * |
| 2487 * @return the implements clause for this class | 2751 * @return the implements clause for this class |
| 2488 */ | 2752 */ |
| 2489 ImplementsClause get implementsClause => _implementsClause; | 2753 ImplementsClause get implementsClause => _implementsClause; |
| 2490 | 2754 |
| 2491 /** | 2755 /** |
| 2492 * Return the name of the class being declared. | 2756 * Return the name of the class being declared. |
| 2757 * |
| 2493 * @return the name of the class being declared | 2758 * @return the name of the class being declared |
| 2494 */ | 2759 */ |
| 2495 SimpleIdentifier get name => _name; | 2760 SimpleIdentifier get name => _name; |
| 2496 | 2761 |
| 2497 /** | 2762 /** |
| 2498 * Return the name of the superclass of the class being declared. | 2763 * Return the name of the superclass of the class being declared. |
| 2764 * |
| 2499 * @return the name of the superclass of the class being declared | 2765 * @return the name of the superclass of the class being declared |
| 2500 */ | 2766 */ |
| 2501 TypeName get superclass => _superclass; | 2767 TypeName get superclass => _superclass; |
| 2502 | 2768 |
| 2503 /** | 2769 /** |
| 2504 * Return the type parameters for the class, or `null` if the class does not h
ave any type | 2770 * Return the type parameters for the class, or `null` if the class does not h
ave any type |
| 2505 * parameters. | 2771 * parameters. |
| 2772 * |
| 2506 * @return the type parameters for the class | 2773 * @return the type parameters for the class |
| 2507 */ | 2774 */ |
| 2508 TypeParameterList get typeParameters => _typeParameters; | 2775 TypeParameterList get typeParameters => _typeParameters; |
| 2509 | 2776 |
| 2510 /** | 2777 /** |
| 2511 * Return the with clause for this class. | 2778 * Return the with clause for this class. |
| 2779 * |
| 2512 * @return the with clause for this class | 2780 * @return the with clause for this class |
| 2513 */ | 2781 */ |
| 2514 WithClause get withClause => _withClause; | 2782 WithClause get withClause => _withClause; |
| 2515 | 2783 |
| 2516 /** | 2784 /** |
| 2517 * Set the token for the 'abstract' keyword to the given token. | 2785 * Set the token for the 'abstract' keyword to the given token. |
| 2786 * |
| 2518 * @param abstractKeyword the token for the 'abstract' keyword | 2787 * @param abstractKeyword the token for the 'abstract' keyword |
| 2519 */ | 2788 */ |
| 2520 void set abstractKeyword(Token abstractKeyword2) { | 2789 void set abstractKeyword(Token abstractKeyword2) { |
| 2521 this._abstractKeyword = abstractKeyword2; | 2790 this._abstractKeyword = abstractKeyword2; |
| 2522 } | 2791 } |
| 2523 | 2792 |
| 2524 /** | 2793 /** |
| 2525 * Set the token for the '=' separating the name from the definition to the gi
ven token. | 2794 * Set the token for the '=' separating the name from the definition to the gi
ven token. |
| 2795 * |
| 2526 * @param equals the token for the '=' separating the name from the definition | 2796 * @param equals the token for the '=' separating the name from the definition |
| 2527 */ | 2797 */ |
| 2528 void set equals(Token equals2) { | 2798 void set equals(Token equals2) { |
| 2529 this._equals = equals2; | 2799 this._equals = equals2; |
| 2530 } | 2800 } |
| 2531 | 2801 |
| 2532 /** | 2802 /** |
| 2533 * Set the implements clause for this class to the given implements clause. | 2803 * Set the implements clause for this class to the given implements clause. |
| 2804 * |
| 2534 * @param implementsClause the implements clause for this class | 2805 * @param implementsClause the implements clause for this class |
| 2535 */ | 2806 */ |
| 2536 void set implementsClause(ImplementsClause implementsClause2) { | 2807 void set implementsClause(ImplementsClause implementsClause2) { |
| 2537 this._implementsClause = becomeParentOf(implementsClause2); | 2808 this._implementsClause = becomeParentOf(implementsClause2); |
| 2538 } | 2809 } |
| 2539 | 2810 |
| 2540 /** | 2811 /** |
| 2541 * Set the name of the class being declared to the given identifier. | 2812 * Set the name of the class being declared to the given identifier. |
| 2813 * |
| 2542 * @param name the name of the class being declared | 2814 * @param name the name of the class being declared |
| 2543 */ | 2815 */ |
| 2544 void set name(SimpleIdentifier name2) { | 2816 void set name(SimpleIdentifier name2) { |
| 2545 this._name = becomeParentOf(name2); | 2817 this._name = becomeParentOf(name2); |
| 2546 } | 2818 } |
| 2547 | 2819 |
| 2548 /** | 2820 /** |
| 2549 * Set the name of the superclass of the class being declared to the given nam
e. | 2821 * Set the name of the superclass of the class being declared to the given nam
e. |
| 2822 * |
| 2550 * @param superclass the name of the superclass of the class being declared | 2823 * @param superclass the name of the superclass of the class being declared |
| 2551 */ | 2824 */ |
| 2552 void set superclass(TypeName superclass2) { | 2825 void set superclass(TypeName superclass2) { |
| 2553 this._superclass = becomeParentOf(superclass2); | 2826 this._superclass = becomeParentOf(superclass2); |
| 2554 } | 2827 } |
| 2555 | 2828 |
| 2556 /** | 2829 /** |
| 2557 * Set the type parameters for the class to the given list of parameters. | 2830 * Set the type parameters for the class to the given list of parameters. |
| 2831 * |
| 2558 * @param typeParameters the type parameters for the class | 2832 * @param typeParameters the type parameters for the class |
| 2559 */ | 2833 */ |
| 2560 void set typeParameters(TypeParameterList typeParameters2) { | 2834 void set typeParameters(TypeParameterList typeParameters2) { |
| 2561 this._typeParameters = becomeParentOf(typeParameters2); | 2835 this._typeParameters = becomeParentOf(typeParameters2); |
| 2562 } | 2836 } |
| 2563 | 2837 |
| 2564 /** | 2838 /** |
| 2565 * Set the with clause for this class to the given with clause. | 2839 * Set the with clause for this class to the given with clause. |
| 2840 * |
| 2566 * @param withClause the with clause for this class | 2841 * @param withClause the with clause for this class |
| 2567 */ | 2842 */ |
| 2568 void set withClause(WithClause withClause2) { | 2843 void set withClause(WithClause withClause2) { |
| 2569 this._withClause = becomeParentOf(withClause2); | 2844 this._withClause = becomeParentOf(withClause2); |
| 2570 } | 2845 } |
| 2571 void visitChildren(ASTVisitor<Object> visitor) { | 2846 void visitChildren(ASTVisitor<Object> visitor) { |
| 2572 super.visitChildren(visitor); | 2847 super.visitChildren(visitor); |
| 2573 safelyVisitChild(_name, visitor); | 2848 safelyVisitChild(_name, visitor); |
| 2574 safelyVisitChild(_typeParameters, visitor); | 2849 safelyVisitChild(_typeParameters, visitor); |
| 2575 safelyVisitChild(_superclass, visitor); | 2850 safelyVisitChild(_superclass, visitor); |
| 2576 safelyVisitChild(_withClause, visitor); | 2851 safelyVisitChild(_withClause, visitor); |
| 2577 safelyVisitChild(_implementsClause, visitor); | 2852 safelyVisitChild(_implementsClause, visitor); |
| 2578 } | 2853 } |
| 2579 } | 2854 } |
| 2580 /** | 2855 /** |
| 2581 * Instances of the class `Combinator` represent the combinator associated with
an import | 2856 * Instances of the class `Combinator` represent the combinator associated with
an import |
| 2582 * directive. | 2857 * directive. |
| 2858 * |
| 2583 * <pre> | 2859 * <pre> |
| 2584 * combinator ::=[HideCombinator hideCombinator]| [ShowCombinator showCombinator
]</pre> | 2860 * combinator ::= |
| 2861 * [HideCombinator] |
| 2862 * | [ShowCombinator] |
| 2863 * </pre> |
| 2864 * |
| 2585 * @coverage dart.engine.ast | 2865 * @coverage dart.engine.ast |
| 2586 */ | 2866 */ |
| 2587 abstract class Combinator extends ASTNode { | 2867 abstract class Combinator extends ASTNode { |
| 2588 | 2868 |
| 2589 /** | 2869 /** |
| 2590 * The keyword specifying what kind of processing is to be done on the importe
d names. | 2870 * The keyword specifying what kind of processing is to be done on the importe
d names. |
| 2591 */ | 2871 */ |
| 2592 Token _keyword; | 2872 Token _keyword; |
| 2593 | 2873 |
| 2594 /** | 2874 /** |
| 2595 * Initialize a newly created import combinator. | 2875 * Initialize a newly created import combinator. |
| 2876 * |
| 2596 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2877 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
| 2597 * names | 2878 * names |
| 2598 */ | 2879 */ |
| 2599 Combinator.full(Token keyword) { | 2880 Combinator.full(Token keyword) { |
| 2600 this._keyword = keyword; | 2881 this._keyword = keyword; |
| 2601 } | 2882 } |
| 2602 | 2883 |
| 2603 /** | 2884 /** |
| 2604 * Initialize a newly created import combinator. | 2885 * Initialize a newly created import combinator. |
| 2886 * |
| 2605 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2887 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
| 2606 * names | 2888 * names |
| 2607 */ | 2889 */ |
| 2608 Combinator({Token keyword}) : this.full(keyword); | 2890 Combinator({Token keyword}) : this.full(keyword); |
| 2609 Token get beginToken => _keyword; | 2891 Token get beginToken => _keyword; |
| 2610 | 2892 |
| 2611 /** | 2893 /** |
| 2612 * Return the keyword specifying what kind of processing is to be done on the
imported names. | 2894 * Return the keyword specifying what kind of processing is to be done on the
imported names. |
| 2895 * |
| 2613 * @return the keyword specifying what kind of processing is to be done on the
imported names | 2896 * @return the keyword specifying what kind of processing is to be done on the
imported names |
| 2614 */ | 2897 */ |
| 2615 Token get keyword => _keyword; | 2898 Token get keyword => _keyword; |
| 2616 | 2899 |
| 2617 /** | 2900 /** |
| 2618 * Set the keyword specifying what kind of processing is to be done on the imp
orted names to the | 2901 * Set the keyword specifying what kind of processing is to be done on the imp
orted names to the |
| 2619 * given token. | 2902 * given token. |
| 2903 * |
| 2620 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2904 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
| 2621 * names | 2905 * names |
| 2622 */ | 2906 */ |
| 2623 void set keyword(Token keyword2) { | 2907 void set keyword(Token keyword2) { |
| 2624 this._keyword = keyword2; | 2908 this._keyword = keyword2; |
| 2625 } | 2909 } |
| 2626 } | 2910 } |
| 2627 /** | 2911 /** |
| 2628 * Instances of the class `Comment` represent a comment within the source code. | 2912 * Instances of the class `Comment` represent a comment within the source code. |
| 2913 * |
| 2629 * <pre> | 2914 * <pre> |
| 2630 * comment ::= | 2915 * comment ::= |
| 2631 * endOfLineComment | 2916 * endOfLineComment |
| 2632 * | blockComment | 2917 * | blockComment |
| 2633 * | documentationComment | 2918 * | documentationComment |
| 2919 * |
| 2634 * endOfLineComment ::= | 2920 * endOfLineComment ::= |
| 2635 * '//' (CHARACTER - EOL)* EOL | 2921 * '//' (CHARACTER - EOL)* EOL |
| 2922 * |
| 2636 * blockComment ::= | 2923 * blockComment ::= |
| 2637 * '/ *' CHARACTER* '*/' | 2924 * '/ *' CHARACTER* '*/' |
| 2925 * |
| 2638 * documentationComment ::= | 2926 * documentationComment ::= |
| 2639 * '/ **' (CHARACTER | [CommentReference commentReference])* '*/' | 2927 * '/ **' (CHARACTER | [CommentReference])* '*/' |
| 2640 * | ('///' (CHARACTER - EOL)* EOL)+ | 2928 * | ('///' (CHARACTER - EOL)* EOL)+ |
| 2641 * </pre> | 2929 * </pre> |
| 2930 * |
| 2642 * @coverage dart.engine.ast | 2931 * @coverage dart.engine.ast |
| 2643 */ | 2932 */ |
| 2644 class Comment extends ASTNode { | 2933 class Comment extends ASTNode { |
| 2645 | 2934 |
| 2646 /** | 2935 /** |
| 2647 * Create a block comment. | 2936 * Create a block comment. |
| 2937 * |
| 2648 * @param tokens the tokens representing the comment | 2938 * @param tokens the tokens representing the comment |
| 2649 * @return the block comment that was created | 2939 * @return the block comment that was created |
| 2650 */ | 2940 */ |
| 2651 static Comment createBlockComment(List<Token> tokens) => new Comment.full(toke
ns, CommentType.BLOCK, null); | 2941 static Comment createBlockComment(List<Token> tokens) => new Comment.full(toke
ns, CommentType.BLOCK, null); |
| 2652 | 2942 |
| 2653 /** | 2943 /** |
| 2654 * Create a documentation comment. | 2944 * Create a documentation comment. |
| 2945 * |
| 2655 * @param tokens the tokens representing the comment | 2946 * @param tokens the tokens representing the comment |
| 2656 * @return the documentation comment that was created | 2947 * @return the documentation comment that was created |
| 2657 */ | 2948 */ |
| 2658 static Comment createDocumentationComment(List<Token> tokens) => new Comment.f
ull(tokens, CommentType.DOCUMENTATION, new List<CommentReference>()); | 2949 static Comment createDocumentationComment(List<Token> tokens) => new Comment.f
ull(tokens, CommentType.DOCUMENTATION, new List<CommentReference>()); |
| 2659 | 2950 |
| 2660 /** | 2951 /** |
| 2661 * Create a documentation comment. | 2952 * Create a documentation comment. |
| 2953 * |
| 2662 * @param tokens the tokens representing the comment | 2954 * @param tokens the tokens representing the comment |
| 2663 * @param references the references embedded within the documentation comment | 2955 * @param references the references embedded within the documentation comment |
| 2664 * @return the documentation comment that was created | 2956 * @return the documentation comment that was created |
| 2665 */ | 2957 */ |
| 2666 static Comment createDocumentationComment2(List<Token> tokens, List<CommentRef
erence> references) => new Comment.full(tokens, CommentType.DOCUMENTATION, refer
ences); | 2958 static Comment createDocumentationComment2(List<Token> tokens, List<CommentRef
erence> references) => new Comment.full(tokens, CommentType.DOCUMENTATION, refer
ences); |
| 2667 | 2959 |
| 2668 /** | 2960 /** |
| 2669 * Create an end-of-line comment. | 2961 * Create an end-of-line comment. |
| 2962 * |
| 2670 * @param tokens the tokens representing the comment | 2963 * @param tokens the tokens representing the comment |
| 2671 * @return the end-of-line comment that was created | 2964 * @return the end-of-line comment that was created |
| 2672 */ | 2965 */ |
| 2673 static Comment createEndOfLineComment(List<Token> tokens) => new Comment.full(
tokens, CommentType.END_OF_LINE, null); | 2966 static Comment createEndOfLineComment(List<Token> tokens) => new Comment.full(
tokens, CommentType.END_OF_LINE, null); |
| 2674 | 2967 |
| 2675 /** | 2968 /** |
| 2676 * The tokens representing the comment. | 2969 * The tokens representing the comment. |
| 2677 */ | 2970 */ |
| 2678 List<Token> _tokens; | 2971 List<Token> _tokens; |
| 2679 | 2972 |
| 2680 /** | 2973 /** |
| 2681 * The type of the comment. | 2974 * The type of the comment. |
| 2682 */ | 2975 */ |
| 2683 CommentType _type; | 2976 CommentType _type; |
| 2684 | 2977 |
| 2685 /** | 2978 /** |
| 2686 * The references embedded within the documentation comment. This list will be
empty unless this | 2979 * The references embedded within the documentation comment. This list will be
empty unless this |
| 2687 * is a documentation comment that has references embedded within it. | 2980 * is a documentation comment that has references embedded within it. |
| 2688 */ | 2981 */ |
| 2689 NodeList<CommentReference> _references; | 2982 NodeList<CommentReference> _references; |
| 2690 | 2983 |
| 2691 /** | 2984 /** |
| 2692 * Initialize a newly created comment. | 2985 * Initialize a newly created comment. |
| 2986 * |
| 2693 * @param tokens the tokens representing the comment | 2987 * @param tokens the tokens representing the comment |
| 2694 * @param type the type of the comment | 2988 * @param type the type of the comment |
| 2695 * @param references the references embedded within the documentation comment | 2989 * @param references the references embedded within the documentation comment |
| 2696 */ | 2990 */ |
| 2697 Comment.full(List<Token> tokens, CommentType type, List<CommentReference> refe
rences) { | 2991 Comment.full(List<Token> tokens, CommentType type, List<CommentReference> refe
rences) { |
| 2698 this._references = new NodeList<CommentReference>(this); | 2992 this._references = new NodeList<CommentReference>(this); |
| 2699 this._tokens = tokens; | 2993 this._tokens = tokens; |
| 2700 this._type = type; | 2994 this._type = type; |
| 2701 this._references.addAll(references); | 2995 this._references.addAll(references); |
| 2702 } | 2996 } |
| 2703 | 2997 |
| 2704 /** | 2998 /** |
| 2705 * Initialize a newly created comment. | 2999 * Initialize a newly created comment. |
| 3000 * |
| 2706 * @param tokens the tokens representing the comment | 3001 * @param tokens the tokens representing the comment |
| 2707 * @param type the type of the comment | 3002 * @param type the type of the comment |
| 2708 * @param references the references embedded within the documentation comment | 3003 * @param references the references embedded within the documentation comment |
| 2709 */ | 3004 */ |
| 2710 Comment({List<Token> tokens, CommentType type, List<CommentReference> referenc
es}) : this.full(tokens, type, references); | 3005 Comment({List<Token> tokens, CommentType type, List<CommentReference> referenc
es}) : this.full(tokens, type, references); |
| 2711 accept(ASTVisitor visitor) => visitor.visitComment(this); | 3006 accept(ASTVisitor visitor) => visitor.visitComment(this); |
| 2712 Token get beginToken => _tokens[0]; | 3007 Token get beginToken => _tokens[0]; |
| 2713 Token get endToken => _tokens[_tokens.length - 1]; | 3008 Token get endToken => _tokens[_tokens.length - 1]; |
| 2714 | 3009 |
| 2715 /** | 3010 /** |
| 2716 * Return the references embedded within the documentation comment. | 3011 * Return the references embedded within the documentation comment. |
| 3012 * |
| 2717 * @return the references embedded within the documentation comment | 3013 * @return the references embedded within the documentation comment |
| 2718 */ | 3014 */ |
| 2719 NodeList<CommentReference> get references => _references; | 3015 NodeList<CommentReference> get references => _references; |
| 2720 | 3016 |
| 2721 /** | 3017 /** |
| 2722 * Return the tokens representing the comment. | 3018 * Return the tokens representing the comment. |
| 3019 * |
| 2723 * @return the tokens representing the comment | 3020 * @return the tokens representing the comment |
| 2724 */ | 3021 */ |
| 2725 List<Token> get tokens => _tokens; | 3022 List<Token> get tokens => _tokens; |
| 2726 | 3023 |
| 2727 /** | 3024 /** |
| 2728 * Return `true` if this is a block comment. | 3025 * Return `true` if this is a block comment. |
| 3026 * |
| 2729 * @return `true` if this is a block comment | 3027 * @return `true` if this is a block comment |
| 2730 */ | 3028 */ |
| 2731 bool get isBlock => identical(_type, CommentType.BLOCK); | 3029 bool get isBlock => identical(_type, CommentType.BLOCK); |
| 2732 | 3030 |
| 2733 /** | 3031 /** |
| 2734 * Return `true` if this is a documentation comment. | 3032 * Return `true` if this is a documentation comment. |
| 3033 * |
| 2735 * @return `true` if this is a documentation comment | 3034 * @return `true` if this is a documentation comment |
| 2736 */ | 3035 */ |
| 2737 bool get isDocumentation => identical(_type, CommentType.DOCUMENTATION); | 3036 bool get isDocumentation => identical(_type, CommentType.DOCUMENTATION); |
| 2738 | 3037 |
| 2739 /** | 3038 /** |
| 2740 * Return `true` if this is an end-of-line comment. | 3039 * Return `true` if this is an end-of-line comment. |
| 3040 * |
| 2741 * @return `true` if this is an end-of-line comment | 3041 * @return `true` if this is an end-of-line comment |
| 2742 */ | 3042 */ |
| 2743 bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE); | 3043 bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE); |
| 2744 void visitChildren(ASTVisitor<Object> visitor) { | 3044 void visitChildren(ASTVisitor<Object> visitor) { |
| 2745 _references.accept(visitor); | 3045 _references.accept(visitor); |
| 2746 } | 3046 } |
| 2747 } | 3047 } |
| 2748 /** | 3048 /** |
| 2749 * The enumeration `CommentType` encodes all the different types of comments tha
t are | 3049 * The enumeration `CommentType` encodes all the different types of comments tha
t are |
| 2750 * recognized by the parser. | 3050 * recognized by the parser. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2774 final int ordinal; | 3074 final int ordinal; |
| 2775 CommentType(this.name, this.ordinal) { | 3075 CommentType(this.name, this.ordinal) { |
| 2776 } | 3076 } |
| 2777 int compareTo(CommentType other) => ordinal - other.ordinal; | 3077 int compareTo(CommentType other) => ordinal - other.ordinal; |
| 2778 int get hashCode => ordinal; | 3078 int get hashCode => ordinal; |
| 2779 String toString() => name; | 3079 String toString() => name; |
| 2780 } | 3080 } |
| 2781 /** | 3081 /** |
| 2782 * Instances of the class `CommentReference` represent a reference to a Dart ele
ment that is | 3082 * Instances of the class `CommentReference` represent a reference to a Dart ele
ment that is |
| 2783 * found within a documentation comment. | 3083 * found within a documentation comment. |
| 3084 * |
| 2784 * <pre> | 3085 * <pre> |
| 2785 * commentReference ::= | 3086 * commentReference ::= |
| 2786 * '\[' 'new'? [Identifier identifier] '\]' | 3087 * '[' 'new'? [Identifier] ']' |
| 2787 * </pre> | 3088 * </pre> |
| 3089 * |
| 2788 * @coverage dart.engine.ast | 3090 * @coverage dart.engine.ast |
| 2789 */ | 3091 */ |
| 2790 class CommentReference extends ASTNode { | 3092 class CommentReference extends ASTNode { |
| 2791 | 3093 |
| 2792 /** | 3094 /** |
| 2793 * The token representing the 'new' keyword, or `null` if there was no 'new' k
eyword. | 3095 * The token representing the 'new' keyword, or `null` if there was no 'new' k
eyword. |
| 2794 */ | 3096 */ |
| 2795 Token _newKeyword; | 3097 Token _newKeyword; |
| 2796 | 3098 |
| 2797 /** | 3099 /** |
| 2798 * The identifier being referenced. | 3100 * The identifier being referenced. |
| 2799 */ | 3101 */ |
| 2800 Identifier _identifier; | 3102 Identifier _identifier; |
| 2801 | 3103 |
| 2802 /** | 3104 /** |
| 2803 * Initialize a newly created reference to a Dart element. | 3105 * Initialize a newly created reference to a Dart element. |
| 3106 * |
| 2804 * @param newKeyword the token representing the 'new' keyword | 3107 * @param newKeyword the token representing the 'new' keyword |
| 2805 * @param identifier the identifier being referenced | 3108 * @param identifier the identifier being referenced |
| 2806 */ | 3109 */ |
| 2807 CommentReference.full(Token newKeyword, Identifier identifier) { | 3110 CommentReference.full(Token newKeyword, Identifier identifier) { |
| 2808 this._newKeyword = newKeyword; | 3111 this._newKeyword = newKeyword; |
| 2809 this._identifier = becomeParentOf(identifier); | 3112 this._identifier = becomeParentOf(identifier); |
| 2810 } | 3113 } |
| 2811 | 3114 |
| 2812 /** | 3115 /** |
| 2813 * Initialize a newly created reference to a Dart element. | 3116 * Initialize a newly created reference to a Dart element. |
| 3117 * |
| 2814 * @param newKeyword the token representing the 'new' keyword | 3118 * @param newKeyword the token representing the 'new' keyword |
| 2815 * @param identifier the identifier being referenced | 3119 * @param identifier the identifier being referenced |
| 2816 */ | 3120 */ |
| 2817 CommentReference({Token newKeyword, Identifier identifier}) : this.full(newKey
word, identifier); | 3121 CommentReference({Token newKeyword, Identifier identifier}) : this.full(newKey
word, identifier); |
| 2818 accept(ASTVisitor visitor) => visitor.visitCommentReference(this); | 3122 accept(ASTVisitor visitor) => visitor.visitCommentReference(this); |
| 2819 Token get beginToken => _identifier.beginToken; | 3123 Token get beginToken => _identifier.beginToken; |
| 2820 Token get endToken => _identifier.endToken; | 3124 Token get endToken => _identifier.endToken; |
| 2821 | 3125 |
| 2822 /** | 3126 /** |
| 2823 * Return the identifier being referenced. | 3127 * Return the identifier being referenced. |
| 3128 * |
| 2824 * @return the identifier being referenced | 3129 * @return the identifier being referenced |
| 2825 */ | 3130 */ |
| 2826 Identifier get identifier => _identifier; | 3131 Identifier get identifier => _identifier; |
| 2827 | 3132 |
| 2828 /** | 3133 /** |
| 2829 * Return the token representing the 'new' keyword, or `null` if there was no
'new' keyword. | 3134 * Return the token representing the 'new' keyword, or `null` if there was no
'new' keyword. |
| 3135 * |
| 2830 * @return the token representing the 'new' keyword | 3136 * @return the token representing the 'new' keyword |
| 2831 */ | 3137 */ |
| 2832 Token get newKeyword => _newKeyword; | 3138 Token get newKeyword => _newKeyword; |
| 2833 | 3139 |
| 2834 /** | 3140 /** |
| 2835 * Set the identifier being referenced to the given identifier. | 3141 * Set the identifier being referenced to the given identifier. |
| 3142 * |
| 2836 * @param identifier the identifier being referenced | 3143 * @param identifier the identifier being referenced |
| 2837 */ | 3144 */ |
| 2838 void set identifier(Identifier identifier2) { | 3145 void set identifier(Identifier identifier2) { |
| 2839 identifier2 = becomeParentOf(identifier2); | 3146 identifier2 = becomeParentOf(identifier2); |
| 2840 } | 3147 } |
| 2841 | 3148 |
| 2842 /** | 3149 /** |
| 2843 * Set the token representing the 'new' keyword to the given token. | 3150 * Set the token representing the 'new' keyword to the given token. |
| 3151 * |
| 2844 * @param newKeyword the token representing the 'new' keyword | 3152 * @param newKeyword the token representing the 'new' keyword |
| 2845 */ | 3153 */ |
| 2846 void set newKeyword(Token newKeyword2) { | 3154 void set newKeyword(Token newKeyword2) { |
| 2847 this._newKeyword = newKeyword2; | 3155 this._newKeyword = newKeyword2; |
| 2848 } | 3156 } |
| 2849 void visitChildren(ASTVisitor<Object> visitor) { | 3157 void visitChildren(ASTVisitor<Object> visitor) { |
| 2850 safelyVisitChild(_identifier, visitor); | 3158 safelyVisitChild(_identifier, visitor); |
| 2851 } | 3159 } |
| 2852 } | 3160 } |
| 2853 /** | 3161 /** |
| 2854 * Instances of the class `CompilationUnit` represent a compilation unit. | 3162 * Instances of the class `CompilationUnit` represent a compilation unit. |
| 2855 * | 3163 * |
| 2856 * While the grammar restricts the order of the directives and declarations with
in a compilation | 3164 * While the grammar restricts the order of the directives and declarations with
in a compilation |
| 2857 * unit, this class does not enforce those restrictions. In particular, the chil
dren of a | 3165 * unit, this class does not enforce those restrictions. In particular, the chil
dren of a |
| 2858 * compilation unit will be visited in lexical order even if lexical order does
not conform to the | 3166 * compilation unit will be visited in lexical order even if lexical order does
not conform to the |
| 2859 * restrictions of the grammar. | 3167 * restrictions of the grammar. |
| 3168 * |
| 2860 * <pre> | 3169 * <pre> |
| 2861 * compilationUnit ::= | 3170 * compilationUnit ::= |
| 2862 * directives declarations | 3171 * directives declarations |
| 2863 * directives ::=[ScriptTag scriptTag]? [LibraryDirective libraryDirective]? nam
espaceDirective* [PartDirective partDirective]| [PartOfDirective partOfDirective
]namespaceDirective ::=[ImportDirective importDirective]| [ExportDirective expor
tDirective]declarations ::=[CompilationUnitMember compilationUnitMember]</pre> | 3172 * |
| 3173 * directives ::= |
| 3174 * [ScriptTag]? [LibraryDirective]? namespaceDirective* [PartDirective]* |
| 3175 * | [PartOfDirective] |
| 3176 * |
| 3177 * namespaceDirective ::= |
| 3178 * [ImportDirective] |
| 3179 * | [ExportDirective] |
| 3180 * |
| 3181 * declarations ::= |
| 3182 * [CompilationUnitMember]* |
| 3183 * </pre> |
| 3184 * |
| 2864 * @coverage dart.engine.ast | 3185 * @coverage dart.engine.ast |
| 2865 */ | 3186 */ |
| 2866 class CompilationUnit extends ASTNode { | 3187 class CompilationUnit extends ASTNode { |
| 2867 | 3188 |
| 2868 /** | 3189 /** |
| 2869 * The first token in the token stream that was parsed to form this compilatio
n unit. | 3190 * The first token in the token stream that was parsed to form this compilatio
n unit. |
| 2870 */ | 3191 */ |
| 2871 Token _beginToken; | 3192 Token _beginToken; |
| 2872 | 3193 |
| 2873 /** | 3194 /** |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2908 */ | 3229 */ |
| 2909 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; | 3230 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; |
| 2910 | 3231 |
| 2911 /** | 3232 /** |
| 2912 * The resolution errors encountered when the receiver was resolved. | 3233 * The resolution errors encountered when the receiver was resolved. |
| 2913 */ | 3234 */ |
| 2914 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 3235 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2915 | 3236 |
| 2916 /** | 3237 /** |
| 2917 * Initialize a newly created compilation unit to have the given directives an
d declarations. | 3238 * Initialize a newly created compilation unit to have the given directives an
d declarations. |
| 3239 * |
| 2918 * @param beginToken the first token in the token stream | 3240 * @param beginToken the first token in the token stream |
| 2919 * @param scriptTag the script tag at the beginning of the compilation unit | 3241 * @param scriptTag the script tag at the beginning of the compilation unit |
| 2920 * @param directives the directives contained in this compilation unit | 3242 * @param directives the directives contained in this compilation unit |
| 2921 * @param declarations the declarations contained in this compilation unit | 3243 * @param declarations the declarations contained in this compilation unit |
| 2922 * @param endToken the last token in the token stream | 3244 * @param endToken the last token in the token stream |
| 2923 */ | 3245 */ |
| 2924 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di
rectives, List<CompilationUnitMember> declarations, Token endToken) { | 3246 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di
rectives, List<CompilationUnitMember> declarations, Token endToken) { |
| 2925 this._directives = new NodeList<Directive>(this); | 3247 this._directives = new NodeList<Directive>(this); |
| 2926 this._declarations = new NodeList<CompilationUnitMember>(this); | 3248 this._declarations = new NodeList<CompilationUnitMember>(this); |
| 2927 this._beginToken = beginToken; | 3249 this._beginToken = beginToken; |
| 2928 this._scriptTag = becomeParentOf(scriptTag); | 3250 this._scriptTag = becomeParentOf(scriptTag); |
| 2929 this._directives.addAll(directives); | 3251 this._directives.addAll(directives); |
| 2930 this._declarations.addAll(declarations); | 3252 this._declarations.addAll(declarations); |
| 2931 this._endToken = endToken; | 3253 this._endToken = endToken; |
| 2932 } | 3254 } |
| 2933 | 3255 |
| 2934 /** | 3256 /** |
| 2935 * Initialize a newly created compilation unit to have the given directives an
d declarations. | 3257 * Initialize a newly created compilation unit to have the given directives an
d declarations. |
| 3258 * |
| 2936 * @param beginToken the first token in the token stream | 3259 * @param beginToken the first token in the token stream |
| 2937 * @param scriptTag the script tag at the beginning of the compilation unit | 3260 * @param scriptTag the script tag at the beginning of the compilation unit |
| 2938 * @param directives the directives contained in this compilation unit | 3261 * @param directives the directives contained in this compilation unit |
| 2939 * @param declarations the declarations contained in this compilation unit | 3262 * @param declarations the declarations contained in this compilation unit |
| 2940 * @param endToken the last token in the token stream | 3263 * @param endToken the last token in the token stream |
| 2941 */ | 3264 */ |
| 2942 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct
ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg
inToken, scriptTag, directives, declarations, endToken); | 3265 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct
ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg
inToken, scriptTag, directives, declarations, endToken); |
| 2943 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); | 3266 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); |
| 2944 Token get beginToken => _beginToken; | 3267 Token get beginToken => _beginToken; |
| 2945 | 3268 |
| 2946 /** | 3269 /** |
| 2947 * Return the declarations contained in this compilation unit. | 3270 * Return the declarations contained in this compilation unit. |
| 3271 * |
| 2948 * @return the declarations contained in this compilation unit | 3272 * @return the declarations contained in this compilation unit |
| 2949 */ | 3273 */ |
| 2950 NodeList<CompilationUnitMember> get declarations => _declarations; | 3274 NodeList<CompilationUnitMember> get declarations => _declarations; |
| 2951 | 3275 |
| 2952 /** | 3276 /** |
| 2953 * Return the directives contained in this compilation unit. | 3277 * Return the directives contained in this compilation unit. |
| 3278 * |
| 2954 * @return the directives contained in this compilation unit | 3279 * @return the directives contained in this compilation unit |
| 2955 */ | 3280 */ |
| 2956 NodeList<Directive> get directives => _directives; | 3281 NodeList<Directive> get directives => _directives; |
| 2957 | 3282 |
| 2958 /** | 3283 /** |
| 2959 * Return the element associated with this compilation unit, or `null` if the
AST structure | 3284 * Return the element associated with this compilation unit, or `null` if the
AST structure |
| 2960 * has not been resolved. | 3285 * has not been resolved. |
| 3286 * |
| 2961 * @return the element associated with this compilation unit | 3287 * @return the element associated with this compilation unit |
| 2962 */ | 3288 */ |
| 2963 CompilationUnitElement get element => _element; | 3289 CompilationUnitElement get element => _element; |
| 2964 Token get endToken => _endToken; | 3290 Token get endToken => _endToken; |
| 2965 | 3291 |
| 2966 /** | 3292 /** |
| 2967 * Return an array containing all of the errors associated with the receiver.
If the receiver has | 3293 * Return an array containing all of the errors associated with the receiver.
If the receiver has |
| 2968 * not been resolved, then return `null`. | 3294 * not been resolved, then return `null`. |
| 3295 * |
| 2969 * @return an array of errors (contains no `null`s) or `null` if the receiver
has not | 3296 * @return an array of errors (contains no `null`s) or `null` if the receiver
has not |
| 2970 * been resolved | 3297 * been resolved |
| 2971 */ | 3298 */ |
| 2972 List<AnalysisError> get errors { | 3299 List<AnalysisError> get errors { |
| 2973 List<AnalysisError> parserErrors = parsingErrors; | 3300 List<AnalysisError> parserErrors = parsingErrors; |
| 2974 List<AnalysisError> resolverErrors = resolutionErrors; | 3301 List<AnalysisError> resolverErrors = resolutionErrors; |
| 2975 if (resolverErrors.length == 0) { | 3302 if (resolverErrors.length == 0) { |
| 2976 return parserErrors; | 3303 return parserErrors; |
| 2977 } else if (parserErrors.length == 0) { | 3304 } else if (parserErrors.length == 0) { |
| 2978 return resolverErrors; | 3305 return resolverErrors; |
| 2979 } else { | 3306 } else { |
| 2980 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); | 3307 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); |
| 2981 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); | 3308 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); |
| 2982 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); | 3309 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); |
| 2983 return allErrors; | 3310 return allErrors; |
| 2984 } | 3311 } |
| 2985 } | 3312 } |
| 2986 int get length { | 3313 int get length { |
| 2987 Token endToken = this.endToken; | 3314 Token endToken = this.endToken; |
| 2988 if (endToken == null) { | 3315 if (endToken == null) { |
| 2989 return 0; | 3316 return 0; |
| 2990 } | 3317 } |
| 2991 return endToken.offset + endToken.length; | 3318 return endToken.offset + endToken.length; |
| 2992 } | 3319 } |
| 2993 | 3320 |
| 2994 /** | 3321 /** |
| 2995 * Get the [LineInfo] object for this compilation unit. | 3322 * Get the [LineInfo] object for this compilation unit. |
| 3323 * |
| 2996 * @return the associated [LineInfo] | 3324 * @return the associated [LineInfo] |
| 2997 */ | 3325 */ |
| 2998 LineInfo get lineInfo => _lineInfo; | 3326 LineInfo get lineInfo => _lineInfo; |
| 2999 int get offset => 0; | 3327 int get offset => 0; |
| 3000 | 3328 |
| 3001 /** | 3329 /** |
| 3002 * Return an array containing all of the parsing errors associated with the re
ceiver. | 3330 * Return an array containing all of the parsing errors associated with the re
ceiver. |
| 3331 * |
| 3003 * @return an array of errors (not `null`, contains no `null`s). | 3332 * @return an array of errors (not `null`, contains no `null`s). |
| 3004 */ | 3333 */ |
| 3005 List<AnalysisError> get parsingErrors => _parsingErrors; | 3334 List<AnalysisError> get parsingErrors => _parsingErrors; |
| 3006 | 3335 |
| 3007 /** | 3336 /** |
| 3008 * Return an array containing all of the resolution errors associated with the
receiver. If the | 3337 * Return an array containing all of the resolution errors associated with the
receiver. If the |
| 3009 * receiver has not been resolved, then return `null`. | 3338 * receiver has not been resolved, then return `null`. |
| 3339 * |
| 3010 * @return an array of errors (contains no `null`s) or `null` if the receiver
has not | 3340 * @return an array of errors (contains no `null`s) or `null` if the receiver
has not |
| 3011 * been resolved | 3341 * been resolved |
| 3012 */ | 3342 */ |
| 3013 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 3343 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 3014 | 3344 |
| 3015 /** | 3345 /** |
| 3016 * Return the script tag at the beginning of the compilation unit, or `null` i
f there is no | 3346 * Return the script tag at the beginning of the compilation unit, or `null` i
f there is no |
| 3017 * script tag in this compilation unit. | 3347 * script tag in this compilation unit. |
| 3348 * |
| 3018 * @return the script tag at the beginning of the compilation unit | 3349 * @return the script tag at the beginning of the compilation unit |
| 3019 */ | 3350 */ |
| 3020 ScriptTag get scriptTag => _scriptTag; | 3351 ScriptTag get scriptTag => _scriptTag; |
| 3021 | 3352 |
| 3022 /** | 3353 /** |
| 3023 * Set the element associated with this compilation unit to the given element. | 3354 * Set the element associated with this compilation unit to the given element. |
| 3355 * |
| 3024 * @param element the element associated with this compilation unit | 3356 * @param element the element associated with this compilation unit |
| 3025 */ | 3357 */ |
| 3026 void set element(CompilationUnitElement element2) { | 3358 void set element(CompilationUnitElement element2) { |
| 3027 this._element = element2; | 3359 this._element = element2; |
| 3028 } | 3360 } |
| 3029 | 3361 |
| 3030 /** | 3362 /** |
| 3031 * Set the [LineInfo] object for this compilation unit. | 3363 * Set the [LineInfo] object for this compilation unit. |
| 3364 * |
| 3032 * @param errors LineInfo to associate with this compilation unit | 3365 * @param errors LineInfo to associate with this compilation unit |
| 3033 */ | 3366 */ |
| 3034 void set lineInfo(LineInfo lineInfo2) { | 3367 void set lineInfo(LineInfo lineInfo2) { |
| 3035 this._lineInfo = lineInfo2; | 3368 this._lineInfo = lineInfo2; |
| 3036 } | 3369 } |
| 3037 | 3370 |
| 3038 /** | 3371 /** |
| 3039 * Called to cache the parsing errors when the unit is parsed. | 3372 * Called to cache the parsing errors when the unit is parsed. |
| 3373 * |
| 3040 * @param errors an array of parsing errors, if `null` is passed, the error ar
ray is set to | 3374 * @param errors an array of parsing errors, if `null` is passed, the error ar
ray is set to |
| 3041 * an empty array, [AnalysisError#NO_ERRORS] | 3375 * an empty array, [AnalysisError#NO_ERRORS] |
| 3042 */ | 3376 */ |
| 3043 void set parsingErrors(List<AnalysisError> errors) { | 3377 void set parsingErrors(List<AnalysisError> errors) { |
| 3044 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; | 3378 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; |
| 3045 } | 3379 } |
| 3046 | 3380 |
| 3047 /** | 3381 /** |
| 3048 * Called to cache the resolution errors when the unit is resolved. | 3382 * Called to cache the resolution errors when the unit is resolved. |
| 3383 * |
| 3049 * @param errors an array of resolution errors, if `null` is passed, the error
array is set | 3384 * @param errors an array of resolution errors, if `null` is passed, the error
array is set |
| 3050 * to an empty array, [AnalysisError#NO_ERRORS] | 3385 * to an empty array, [AnalysisError#NO_ERRORS] |
| 3051 */ | 3386 */ |
| 3052 void set resolutionErrors(List<AnalysisError> errors) { | 3387 void set resolutionErrors(List<AnalysisError> errors) { |
| 3053 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors; | 3388 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors; |
| 3054 } | 3389 } |
| 3055 | 3390 |
| 3056 /** | 3391 /** |
| 3057 * Set the script tag at the beginning of the compilation unit to the given sc
ript tag. | 3392 * Set the script tag at the beginning of the compilation unit to the given sc
ript tag. |
| 3393 * |
| 3058 * @param scriptTag the script tag at the beginning of the compilation unit | 3394 * @param scriptTag the script tag at the beginning of the compilation unit |
| 3059 */ | 3395 */ |
| 3060 void set scriptTag(ScriptTag scriptTag2) { | 3396 void set scriptTag(ScriptTag scriptTag2) { |
| 3061 this._scriptTag = becomeParentOf(scriptTag2); | 3397 this._scriptTag = becomeParentOf(scriptTag2); |
| 3062 } | 3398 } |
| 3063 void visitChildren(ASTVisitor<Object> visitor) { | 3399 void visitChildren(ASTVisitor<Object> visitor) { |
| 3064 safelyVisitChild(_scriptTag, visitor); | 3400 safelyVisitChild(_scriptTag, visitor); |
| 3065 if (directivesAreBeforeDeclarations()) { | 3401 if (directivesAreBeforeDeclarations()) { |
| 3066 _directives.accept(visitor); | 3402 _directives.accept(visitor); |
| 3067 _declarations.accept(visitor); | 3403 _declarations.accept(visitor); |
| 3068 } else { | 3404 } else { |
| 3069 for (ASTNode child in sortedDirectivesAndDeclarations) { | 3405 for (ASTNode child in sortedDirectivesAndDeclarations) { |
| 3070 child.accept(visitor); | 3406 child.accept(visitor); |
| 3071 } | 3407 } |
| 3072 } | 3408 } |
| 3073 } | 3409 } |
| 3074 | 3410 |
| 3075 /** | 3411 /** |
| 3076 * Return `true` if all of the directives are lexically before any declaration
s. | 3412 * Return `true` if all of the directives are lexically before any declaration
s. |
| 3413 * |
| 3077 * @return `true` if all of the directives are lexically before any declaratio
ns | 3414 * @return `true` if all of the directives are lexically before any declaratio
ns |
| 3078 */ | 3415 */ |
| 3079 bool directivesAreBeforeDeclarations() { | 3416 bool directivesAreBeforeDeclarations() { |
| 3080 if (_directives.isEmpty || _declarations.isEmpty) { | 3417 if (_directives.isEmpty || _declarations.isEmpty) { |
| 3081 return true; | 3418 return true; |
| 3082 } | 3419 } |
| 3083 Directive lastDirective = _directives[_directives.length - 1]; | 3420 Directive lastDirective = _directives[_directives.length - 1]; |
| 3084 CompilationUnitMember firstDeclaration = _declarations[0]; | 3421 CompilationUnitMember firstDeclaration = _declarations[0]; |
| 3085 return lastDirective.offset < firstDeclaration.offset; | 3422 return lastDirective.offset < firstDeclaration.offset; |
| 3086 } | 3423 } |
| 3087 | 3424 |
| 3088 /** | 3425 /** |
| 3089 * Return an array containing all of the directives and declarations in this c
ompilation unit, | 3426 * Return an array containing all of the directives and declarations in this c
ompilation unit, |
| 3090 * sorted in lexical order. | 3427 * sorted in lexical order. |
| 3428 * |
| 3091 * @return the directives and declarations in this compilation unit in the ord
er in which they | 3429 * @return the directives and declarations in this compilation unit in the ord
er in which they |
| 3092 * appeared in the original source | 3430 * appeared in the original source |
| 3093 */ | 3431 */ |
| 3094 List<ASTNode> get sortedDirectivesAndDeclarations { | 3432 List<ASTNode> get sortedDirectivesAndDeclarations { |
| 3095 List<ASTNode> childList = new List<ASTNode>(); | 3433 List<ASTNode> childList = new List<ASTNode>(); |
| 3096 childList.addAll(_directives); | 3434 childList.addAll(_directives); |
| 3097 childList.addAll(_declarations); | 3435 childList.addAll(_declarations); |
| 3098 List<ASTNode> children = new List.from(childList); | 3436 List<ASTNode> children = new List.from(childList); |
| 3099 children.sort(ASTNode.LEXICAL_ORDER); | 3437 children.sort(ASTNode.LEXICAL_ORDER); |
| 3100 return children; | 3438 return children; |
| 3101 } | 3439 } |
| 3102 } | 3440 } |
| 3103 /** | 3441 /** |
| 3104 * Instances of the class `CompilationUnitMember` defines the behavior common to
nodes that | 3442 * Instances of the class `CompilationUnitMember` defines the behavior common to
nodes that |
| 3105 * declare a name within the scope of a compilation unit. | 3443 * declare a name within the scope of a compilation unit. |
| 3444 * |
| 3106 * <pre> | 3445 * <pre> |
| 3107 * compilationUnitMember ::=[ClassDeclaration classDeclaration]| [TypeAlias type
Alias]| [FunctionDeclaration functionDeclaration]| [MethodDeclaration getOrSetDe
claration]| [VariableDeclaration constantsDeclaration]| [VariableDeclaration var
iablesDeclaration]</pre> | 3446 * compilationUnitMember ::= |
| 3447 * [ClassDeclaration] |
| 3448 * | [TypeAlias] |
| 3449 * | [FunctionDeclaration] |
| 3450 * | [MethodDeclaration] |
| 3451 * | [VariableDeclaration] |
| 3452 * | [VariableDeclaration] |
| 3453 * </pre> |
| 3454 * |
| 3108 * @coverage dart.engine.ast | 3455 * @coverage dart.engine.ast |
| 3109 */ | 3456 */ |
| 3110 abstract class CompilationUnitMember extends Declaration { | 3457 abstract class CompilationUnitMember extends Declaration { |
| 3111 | 3458 |
| 3112 /** | 3459 /** |
| 3113 * Initialize a newly created generic compilation unit member. | 3460 * Initialize a newly created generic compilation unit member. |
| 3461 * |
| 3114 * @param comment the documentation comment associated with this member | 3462 * @param comment the documentation comment associated with this member |
| 3115 * @param metadata the annotations associated with this member | 3463 * @param metadata the annotations associated with this member |
| 3116 */ | 3464 */ |
| 3117 CompilationUnitMember.full(Comment comment, List<Annotation> metadata) : super
.full(comment, metadata) { | 3465 CompilationUnitMember.full(Comment comment, List<Annotation> metadata) : super
.full(comment, metadata) { |
| 3118 } | 3466 } |
| 3119 | 3467 |
| 3120 /** | 3468 /** |
| 3121 * Initialize a newly created generic compilation unit member. | 3469 * Initialize a newly created generic compilation unit member. |
| 3470 * |
| 3122 * @param comment the documentation comment associated with this member | 3471 * @param comment the documentation comment associated with this member |
| 3123 * @param metadata the annotations associated with this member | 3472 * @param metadata the annotations associated with this member |
| 3124 */ | 3473 */ |
| 3125 CompilationUnitMember({Comment comment, List<Annotation> metadata}) : this.ful
l(comment, metadata); | 3474 CompilationUnitMember({Comment comment, List<Annotation> metadata}) : this.ful
l(comment, metadata); |
| 3126 } | 3475 } |
| 3127 /** | 3476 /** |
| 3128 * Instances of the class `ConditionalExpression` represent a conditional expres
sion. | 3477 * Instances of the class `ConditionalExpression` represent a conditional expres
sion. |
| 3478 * |
| 3129 * <pre> | 3479 * <pre> |
| 3130 * conditionalExpression ::=[Expression condition] '?' [Expression thenExpressio
n] ':' [Expression elseExpression]</pre> | 3480 * conditionalExpression ::= |
| 3481 * [Expression] '?' [Expression] ':' [Expression] |
| 3482 * </pre> |
| 3483 * |
| 3131 * @coverage dart.engine.ast | 3484 * @coverage dart.engine.ast |
| 3132 */ | 3485 */ |
| 3133 class ConditionalExpression extends Expression { | 3486 class ConditionalExpression extends Expression { |
| 3134 | 3487 |
| 3135 /** | 3488 /** |
| 3136 * The condition used to determine which of the expressions is executed next. | 3489 * The condition used to determine which of the expressions is executed next. |
| 3137 */ | 3490 */ |
| 3138 Expression _condition; | 3491 Expression _condition; |
| 3139 | 3492 |
| 3140 /** | 3493 /** |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3152 */ | 3505 */ |
| 3153 Token _colon; | 3506 Token _colon; |
| 3154 | 3507 |
| 3155 /** | 3508 /** |
| 3156 * The expression that is executed if the condition evaluates to `false`. | 3509 * The expression that is executed if the condition evaluates to `false`. |
| 3157 */ | 3510 */ |
| 3158 Expression _elseExpression; | 3511 Expression _elseExpression; |
| 3159 | 3512 |
| 3160 /** | 3513 /** |
| 3161 * Initialize a newly created conditional expression. | 3514 * Initialize a newly created conditional expression. |
| 3515 * |
| 3162 * @param condition the condition used to determine which expression is execut
ed next | 3516 * @param condition the condition used to determine which expression is execut
ed next |
| 3163 * @param question the token used to separate the condition from the then expr
ession | 3517 * @param question the token used to separate the condition from the then expr
ession |
| 3164 * @param thenExpression the expression that is executed if the condition eval
uates to`true` | 3518 * @param thenExpression the expression that is executed if the condition eval
uates to |
| 3519 * `true` |
| 3165 * @param colon the token used to separate the then expression from the else e
xpression | 3520 * @param colon the token used to separate the then expression from the else e
xpression |
| 3166 * @param elseExpression the expression that is executed if the condition eval
uates to`false` | 3521 * @param elseExpression the expression that is executed if the condition eval
uates to |
| 3522 * `false` |
| 3167 */ | 3523 */ |
| 3168 ConditionalExpression.full(Expression condition, Token question, Expression th
enExpression, Token colon, Expression elseExpression) { | 3524 ConditionalExpression.full(Expression condition, Token question, Expression th
enExpression, Token colon, Expression elseExpression) { |
| 3169 this._condition = becomeParentOf(condition); | 3525 this._condition = becomeParentOf(condition); |
| 3170 this._question = question; | 3526 this._question = question; |
| 3171 this._thenExpression = becomeParentOf(thenExpression); | 3527 this._thenExpression = becomeParentOf(thenExpression); |
| 3172 this._colon = colon; | 3528 this._colon = colon; |
| 3173 this._elseExpression = becomeParentOf(elseExpression); | 3529 this._elseExpression = becomeParentOf(elseExpression); |
| 3174 } | 3530 } |
| 3175 | 3531 |
| 3176 /** | 3532 /** |
| 3177 * Initialize a newly created conditional expression. | 3533 * Initialize a newly created conditional expression. |
| 3534 * |
| 3178 * @param condition the condition used to determine which expression is execut
ed next | 3535 * @param condition the condition used to determine which expression is execut
ed next |
| 3179 * @param question the token used to separate the condition from the then expr
ession | 3536 * @param question the token used to separate the condition from the then expr
ession |
| 3180 * @param thenExpression the expression that is executed if the condition eval
uates to`true` | 3537 * @param thenExpression the expression that is executed if the condition eval
uates to |
| 3538 * `true` |
| 3181 * @param colon the token used to separate the then expression from the else e
xpression | 3539 * @param colon the token used to separate the then expression from the else e
xpression |
| 3182 * @param elseExpression the expression that is executed if the condition eval
uates to`false` | 3540 * @param elseExpression the expression that is executed if the condition eval
uates to |
| 3541 * `false` |
| 3183 */ | 3542 */ |
| 3184 ConditionalExpression({Expression condition, Token question, Expression thenEx
pression, Token colon, Expression elseExpression}) : this.full(condition, questi
on, thenExpression, colon, elseExpression); | 3543 ConditionalExpression({Expression condition, Token question, Expression thenEx
pression, Token colon, Expression elseExpression}) : this.full(condition, questi
on, thenExpression, colon, elseExpression); |
| 3185 accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this); | 3544 accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this); |
| 3186 Token get beginToken => _condition.beginToken; | 3545 Token get beginToken => _condition.beginToken; |
| 3187 | 3546 |
| 3188 /** | 3547 /** |
| 3189 * Return the token used to separate the then expression from the else express
ion. | 3548 * Return the token used to separate the then expression from the else express
ion. |
| 3549 * |
| 3190 * @return the token used to separate the then expression from the else expres
sion | 3550 * @return the token used to separate the then expression from the else expres
sion |
| 3191 */ | 3551 */ |
| 3192 Token get colon => _colon; | 3552 Token get colon => _colon; |
| 3193 | 3553 |
| 3194 /** | 3554 /** |
| 3195 * Return the condition used to determine which of the expressions is executed
next. | 3555 * Return the condition used to determine which of the expressions is executed
next. |
| 3556 * |
| 3196 * @return the condition used to determine which expression is executed next | 3557 * @return the condition used to determine which expression is executed next |
| 3197 */ | 3558 */ |
| 3198 Expression get condition => _condition; | 3559 Expression get condition => _condition; |
| 3199 | 3560 |
| 3200 /** | 3561 /** |
| 3201 * Return the expression that is executed if the condition evaluates to `false
`. | 3562 * Return the expression that is executed if the condition evaluates to `false
`. |
| 3563 * |
| 3202 * @return the expression that is executed if the condition evaluates to `fals
e` | 3564 * @return the expression that is executed if the condition evaluates to `fals
e` |
| 3203 */ | 3565 */ |
| 3204 Expression get elseExpression => _elseExpression; | 3566 Expression get elseExpression => _elseExpression; |
| 3205 Token get endToken => _elseExpression.endToken; | 3567 Token get endToken => _elseExpression.endToken; |
| 3206 | 3568 |
| 3207 /** | 3569 /** |
| 3208 * Return the token used to separate the condition from the then expression. | 3570 * Return the token used to separate the condition from the then expression. |
| 3571 * |
| 3209 * @return the token used to separate the condition from the then expression | 3572 * @return the token used to separate the condition from the then expression |
| 3210 */ | 3573 */ |
| 3211 Token get question => _question; | 3574 Token get question => _question; |
| 3212 | 3575 |
| 3213 /** | 3576 /** |
| 3214 * Return the expression that is executed if the condition evaluates to `true`
. | 3577 * Return the expression that is executed if the condition evaluates to `true`
. |
| 3578 * |
| 3215 * @return the expression that is executed if the condition evaluates to `true
` | 3579 * @return the expression that is executed if the condition evaluates to `true
` |
| 3216 */ | 3580 */ |
| 3217 Expression get thenExpression => _thenExpression; | 3581 Expression get thenExpression => _thenExpression; |
| 3218 | 3582 |
| 3219 /** | 3583 /** |
| 3220 * Set the token used to separate the then expression from the else expression
to the given token. | 3584 * Set the token used to separate the then expression from the else expression
to the given token. |
| 3585 * |
| 3221 * @param colon the token used to separate the then expression from the else e
xpression | 3586 * @param colon the token used to separate the then expression from the else e
xpression |
| 3222 */ | 3587 */ |
| 3223 void set colon(Token colon2) { | 3588 void set colon(Token colon2) { |
| 3224 this._colon = colon2; | 3589 this._colon = colon2; |
| 3225 } | 3590 } |
| 3226 | 3591 |
| 3227 /** | 3592 /** |
| 3228 * Set the condition used to determine which of the expressions is executed ne
xt to the given | 3593 * Set the condition used to determine which of the expressions is executed ne
xt to the given |
| 3229 * expression. | 3594 * expression. |
| 3595 * |
| 3230 * @param expression the condition used to determine which expression is execu
ted next | 3596 * @param expression the condition used to determine which expression is execu
ted next |
| 3231 */ | 3597 */ |
| 3232 void set condition(Expression expression) { | 3598 void set condition(Expression expression) { |
| 3233 _condition = becomeParentOf(expression); | 3599 _condition = becomeParentOf(expression); |
| 3234 } | 3600 } |
| 3235 | 3601 |
| 3236 /** | 3602 /** |
| 3237 * Set the expression that is executed if the condition evaluates to `false` t
o the given | 3603 * Set the expression that is executed if the condition evaluates to `false` t
o the given |
| 3238 * expression. | 3604 * expression. |
| 3605 * |
| 3239 * @param expression the expression that is executed if the condition evaluate
s to `false` | 3606 * @param expression the expression that is executed if the condition evaluate
s to `false` |
| 3240 */ | 3607 */ |
| 3241 void set elseExpression(Expression expression) { | 3608 void set elseExpression(Expression expression) { |
| 3242 _elseExpression = becomeParentOf(expression); | 3609 _elseExpression = becomeParentOf(expression); |
| 3243 } | 3610 } |
| 3244 | 3611 |
| 3245 /** | 3612 /** |
| 3246 * Set the token used to separate the condition from the then expression to th
e given token. | 3613 * Set the token used to separate the condition from the then expression to th
e given token. |
| 3614 * |
| 3247 * @param question the token used to separate the condition from the then expr
ession | 3615 * @param question the token used to separate the condition from the then expr
ession |
| 3248 */ | 3616 */ |
| 3249 void set question(Token question2) { | 3617 void set question(Token question2) { |
| 3250 this._question = question2; | 3618 this._question = question2; |
| 3251 } | 3619 } |
| 3252 | 3620 |
| 3253 /** | 3621 /** |
| 3254 * Set the expression that is executed if the condition evaluates to `true` to
the given | 3622 * Set the expression that is executed if the condition evaluates to `true` to
the given |
| 3255 * expression. | 3623 * expression. |
| 3624 * |
| 3256 * @param expression the expression that is executed if the condition evaluate
s to `true` | 3625 * @param expression the expression that is executed if the condition evaluate
s to `true` |
| 3257 */ | 3626 */ |
| 3258 void set thenExpression(Expression expression) { | 3627 void set thenExpression(Expression expression) { |
| 3259 _thenExpression = becomeParentOf(expression); | 3628 _thenExpression = becomeParentOf(expression); |
| 3260 } | 3629 } |
| 3261 void visitChildren(ASTVisitor<Object> visitor) { | 3630 void visitChildren(ASTVisitor<Object> visitor) { |
| 3262 safelyVisitChild(_condition, visitor); | 3631 safelyVisitChild(_condition, visitor); |
| 3263 safelyVisitChild(_thenExpression, visitor); | 3632 safelyVisitChild(_thenExpression, visitor); |
| 3264 safelyVisitChild(_elseExpression, visitor); | 3633 safelyVisitChild(_elseExpression, visitor); |
| 3265 } | 3634 } |
| 3266 } | 3635 } |
| 3267 /** | 3636 /** |
| 3268 * Instances of the class `ConstructorDeclaration` represent a constructor decla
ration. | 3637 * Instances of the class `ConstructorDeclaration` represent a constructor decla
ration. |
| 3638 * |
| 3269 * <pre> | 3639 * <pre> |
| 3270 * constructorDeclaration ::= | 3640 * constructorDeclaration ::= |
| 3271 * constructorSignature [FunctionBody body]? | 3641 * constructorSignature [FunctionBody]? |
| 3272 * | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier name]
)? arguments | 3642 * | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])?
arguments |
| 3643 * |
| 3273 * constructorSignature ::= | 3644 * constructorSignature ::= |
| 3274 * 'external'? constructorName formalParameterList initializerList? | 3645 * 'external'? constructorName formalParameterList initializerList? |
| 3275 * | 'external'? 'factory' factoryName formalParameterList initializerList? | 3646 * | 'external'? 'factory' factoryName formalParameterList initializerList? |
| 3276 * | 'external'? 'const' constructorName formalParameterList initializerList? | 3647 * | 'external'? 'const' constructorName formalParameterList initializerList? |
| 3277 * constructorName ::=[SimpleIdentifier returnType] ('.' [SimpleIdentifier name]
)? | 3648 * |
| 3278 * factoryName ::=[Identifier returnType] ('.' [SimpleIdentifier name])? | 3649 * constructorName ::= |
| 3650 * [SimpleIdentifier] ('.' [SimpleIdentifier])? |
| 3651 * |
| 3652 * factoryName ::= |
| 3653 * [Identifier] ('.' [SimpleIdentifier])? |
| 3654 * |
| 3279 * initializerList ::= | 3655 * initializerList ::= |
| 3280 * ':' [ConstructorInitializer initializer] (',' [ConstructorInitializer initial
izer]) | 3656 * ':' [ConstructorInitializer] (',' [ConstructorInitializer])* |
| 3281 * </pre> | 3657 * </pre> |
| 3658 * |
| 3282 * @coverage dart.engine.ast | 3659 * @coverage dart.engine.ast |
| 3283 */ | 3660 */ |
| 3284 class ConstructorDeclaration extends ClassMember { | 3661 class ConstructorDeclaration extends ClassMember { |
| 3285 | 3662 |
| 3286 /** | 3663 /** |
| 3287 * The token for the 'external' keyword, or `null` if the constructor is not e
xternal. | 3664 * The token for the 'external' keyword, or `null` if the constructor is not e
xternal. |
| 3288 */ | 3665 */ |
| 3289 Token _externalKeyword; | 3666 Token _externalKeyword; |
| 3290 | 3667 |
| 3291 /** | 3668 /** |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3345 */ | 3722 */ |
| 3346 ConstructorName _redirectedConstructor; | 3723 ConstructorName _redirectedConstructor; |
| 3347 | 3724 |
| 3348 /** | 3725 /** |
| 3349 * The body of the constructor, or `null` if the constructor does not have a b
ody. | 3726 * The body of the constructor, or `null` if the constructor does not have a b
ody. |
| 3350 */ | 3727 */ |
| 3351 FunctionBody _body; | 3728 FunctionBody _body; |
| 3352 | 3729 |
| 3353 /** | 3730 /** |
| 3354 * Initialize a newly created constructor declaration. | 3731 * Initialize a newly created constructor declaration. |
| 3732 * |
| 3355 * @param externalKeyword the token for the 'external' keyword | 3733 * @param externalKeyword the token for the 'external' keyword |
| 3356 * @param comment the documentation comment associated with this constructor | 3734 * @param comment the documentation comment associated with this constructor |
| 3357 * @param metadata the annotations associated with this constructor | 3735 * @param metadata the annotations associated with this constructor |
| 3358 * @param constKeyword the token for the 'const' keyword | 3736 * @param constKeyword the token for the 'const' keyword |
| 3359 * @param factoryKeyword the token for the 'factory' keyword | 3737 * @param factoryKeyword the token for the 'factory' keyword |
| 3360 * @param returnType the return type of the constructor | 3738 * @param returnType the return type of the constructor |
| 3361 * @param period the token for the period before the constructor name | 3739 * @param period the token for the period before the constructor name |
| 3362 * @param name the name of the constructor | 3740 * @param name the name of the constructor |
| 3363 * @param parameters the parameters associated with the constructor | 3741 * @param parameters the parameters associated with the constructor |
| 3364 * @param separator the token for the colon or equals before the initializers | 3742 * @param separator the token for the colon or equals before the initializers |
| 3365 * @param initializers the initializers associated with the constructor | 3743 * @param initializers the initializers associated with the constructor |
| 3366 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be | 3744 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be |
| 3367 * redirected | 3745 * redirected |
| 3368 * @param body the body of the constructor | 3746 * @param body the body of the constructor |
| 3369 */ | 3747 */ |
| 3370 ConstructorDeclaration.full(Comment comment, List<Annotation> metadata, Token
externalKeyword, Token constKeyword, Token factoryKeyword, Identifier returnType
, Token period, SimpleIdentifier name, FormalParameterList parameters, Token sep
arator, List<ConstructorInitializer> initializers, ConstructorName redirectedCon
structor, FunctionBody body) : super.full(comment, metadata) { | 3748 ConstructorDeclaration.full(Comment comment, List<Annotation> metadata, Token
externalKeyword, Token constKeyword, Token factoryKeyword, Identifier returnType
, Token period, SimpleIdentifier name, FormalParameterList parameters, Token sep
arator, List<ConstructorInitializer> initializers, ConstructorName redirectedCon
structor, FunctionBody body) : super.full(comment, metadata) { |
| 3371 this._initializers = new NodeList<ConstructorInitializer>(this); | 3749 this._initializers = new NodeList<ConstructorInitializer>(this); |
| 3372 this._externalKeyword = externalKeyword; | 3750 this._externalKeyword = externalKeyword; |
| 3373 this._constKeyword = constKeyword; | 3751 this._constKeyword = constKeyword; |
| 3374 this._factoryKeyword = factoryKeyword; | 3752 this._factoryKeyword = factoryKeyword; |
| 3375 this._returnType = becomeParentOf(returnType); | 3753 this._returnType = becomeParentOf(returnType); |
| 3376 this._period = period; | 3754 this._period = period; |
| 3377 this._name = becomeParentOf(name); | 3755 this._name = becomeParentOf(name); |
| 3378 this._parameters = becomeParentOf(parameters); | 3756 this._parameters = becomeParentOf(parameters); |
| 3379 this._separator = separator; | 3757 this._separator = separator; |
| 3380 this._initializers.addAll(initializers); | 3758 this._initializers.addAll(initializers); |
| 3381 this._redirectedConstructor = becomeParentOf(redirectedConstructor); | 3759 this._redirectedConstructor = becomeParentOf(redirectedConstructor); |
| 3382 this._body = becomeParentOf(body); | 3760 this._body = becomeParentOf(body); |
| 3383 } | 3761 } |
| 3384 | 3762 |
| 3385 /** | 3763 /** |
| 3386 * Initialize a newly created constructor declaration. | 3764 * Initialize a newly created constructor declaration. |
| 3765 * |
| 3387 * @param externalKeyword the token for the 'external' keyword | 3766 * @param externalKeyword the token for the 'external' keyword |
| 3388 * @param comment the documentation comment associated with this constructor | 3767 * @param comment the documentation comment associated with this constructor |
| 3389 * @param metadata the annotations associated with this constructor | 3768 * @param metadata the annotations associated with this constructor |
| 3390 * @param constKeyword the token for the 'const' keyword | 3769 * @param constKeyword the token for the 'const' keyword |
| 3391 * @param factoryKeyword the token for the 'factory' keyword | 3770 * @param factoryKeyword the token for the 'factory' keyword |
| 3392 * @param returnType the return type of the constructor | 3771 * @param returnType the return type of the constructor |
| 3393 * @param period the token for the period before the constructor name | 3772 * @param period the token for the period before the constructor name |
| 3394 * @param name the name of the constructor | 3773 * @param name the name of the constructor |
| 3395 * @param parameters the parameters associated with the constructor | 3774 * @param parameters the parameters associated with the constructor |
| 3396 * @param separator the token for the colon or equals before the initializers | 3775 * @param separator the token for the colon or equals before the initializers |
| 3397 * @param initializers the initializers associated with the constructor | 3776 * @param initializers the initializers associated with the constructor |
| 3398 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be | 3777 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be |
| 3399 * redirected | 3778 * redirected |
| 3400 * @param body the body of the constructor | 3779 * @param body the body of the constructor |
| 3401 */ | 3780 */ |
| 3402 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); | 3781 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); |
| 3403 accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this); | 3782 accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this); |
| 3404 | 3783 |
| 3405 /** | 3784 /** |
| 3406 * Return the body of the constructor, or `null` if the constructor does not h
ave a body. | 3785 * Return the body of the constructor, or `null` if the constructor does not h
ave a body. |
| 3786 * |
| 3407 * @return the body of the constructor | 3787 * @return the body of the constructor |
| 3408 */ | 3788 */ |
| 3409 FunctionBody get body => _body; | 3789 FunctionBody get body => _body; |
| 3410 | 3790 |
| 3411 /** | 3791 /** |
| 3412 * Return the token for the 'const' keyword. | 3792 * Return the token for the 'const' keyword. |
| 3793 * |
| 3413 * @return the token for the 'const' keyword | 3794 * @return the token for the 'const' keyword |
| 3414 */ | 3795 */ |
| 3415 Token get constKeyword => _constKeyword; | 3796 Token get constKeyword => _constKeyword; |
| 3416 ConstructorElement get element => _element; | 3797 ConstructorElement get element => _element; |
| 3417 Token get endToken { | 3798 Token get endToken { |
| 3418 if (_body != null) { | 3799 if (_body != null) { |
| 3419 return _body.endToken; | 3800 return _body.endToken; |
| 3420 } else if (!_initializers.isEmpty) { | 3801 } else if (!_initializers.isEmpty) { |
| 3421 return _initializers.endToken; | 3802 return _initializers.endToken; |
| 3422 } | 3803 } |
| 3423 return _parameters.endToken; | 3804 return _parameters.endToken; |
| 3424 } | 3805 } |
| 3425 | 3806 |
| 3426 /** | 3807 /** |
| 3427 * Return the token for the 'external' keyword, or `null` if the constructor i
s not | 3808 * Return the token for the 'external' keyword, or `null` if the constructor i
s not |
| 3428 * external. | 3809 * external. |
| 3810 * |
| 3429 * @return the token for the 'external' keyword | 3811 * @return the token for the 'external' keyword |
| 3430 */ | 3812 */ |
| 3431 Token get externalKeyword => _externalKeyword; | 3813 Token get externalKeyword => _externalKeyword; |
| 3432 | 3814 |
| 3433 /** | 3815 /** |
| 3434 * Return the token for the 'factory' keyword. | 3816 * Return the token for the 'factory' keyword. |
| 3817 * |
| 3435 * @return the token for the 'factory' keyword | 3818 * @return the token for the 'factory' keyword |
| 3436 */ | 3819 */ |
| 3437 Token get factoryKeyword => _factoryKeyword; | 3820 Token get factoryKeyword => _factoryKeyword; |
| 3438 | 3821 |
| 3439 /** | 3822 /** |
| 3440 * Return the initializers associated with the constructor. | 3823 * Return the initializers associated with the constructor. |
| 3824 * |
| 3441 * @return the initializers associated with the constructor | 3825 * @return the initializers associated with the constructor |
| 3442 */ | 3826 */ |
| 3443 NodeList<ConstructorInitializer> get initializers => _initializers; | 3827 NodeList<ConstructorInitializer> get initializers => _initializers; |
| 3444 | 3828 |
| 3445 /** | 3829 /** |
| 3446 * Return the name of the constructor, or `null` if the constructor being decl
ared is | 3830 * Return the name of the constructor, or `null` if the constructor being decl
ared is |
| 3447 * unnamed. | 3831 * unnamed. |
| 3832 * |
| 3448 * @return the name of the constructor | 3833 * @return the name of the constructor |
| 3449 */ | 3834 */ |
| 3450 SimpleIdentifier get name => _name; | 3835 SimpleIdentifier get name => _name; |
| 3451 | 3836 |
| 3452 /** | 3837 /** |
| 3453 * Return the parameters associated with the constructor. | 3838 * Return the parameters associated with the constructor. |
| 3839 * |
| 3454 * @return the parameters associated with the constructor | 3840 * @return the parameters associated with the constructor |
| 3455 */ | 3841 */ |
| 3456 FormalParameterList get parameters => _parameters; | 3842 FormalParameterList get parameters => _parameters; |
| 3457 | 3843 |
| 3458 /** | 3844 /** |
| 3459 * Return the token for the period before the constructor name, or `null` if t
he constructor | 3845 * Return the token for the period before the constructor name, or `null` if t
he constructor |
| 3460 * being declared is unnamed. | 3846 * being declared is unnamed. |
| 3847 * |
| 3461 * @return the token for the period before the constructor name | 3848 * @return the token for the period before the constructor name |
| 3462 */ | 3849 */ |
| 3463 Token get period => _period; | 3850 Token get period => _period; |
| 3464 | 3851 |
| 3465 /** | 3852 /** |
| 3466 * Return the name of the constructor to which this constructor will be redire
cted, or`null` if this is not a redirecting factory constructor. | 3853 * Return the name of the constructor to which this constructor will be redire
cted, or |
| 3854 * `null` if this is not a redirecting factory constructor. |
| 3855 * |
| 3467 * @return the name of the constructor to which this constructor will be redir
ected | 3856 * @return the name of the constructor to which this constructor will be redir
ected |
| 3468 */ | 3857 */ |
| 3469 ConstructorName get redirectedConstructor => _redirectedConstructor; | 3858 ConstructorName get redirectedConstructor => _redirectedConstructor; |
| 3470 | 3859 |
| 3471 /** | 3860 /** |
| 3472 * Return the type of object being created. This can be different than the typ
e in which the | 3861 * Return the type of object being created. This can be different than the typ
e in which the |
| 3473 * constructor is being declared if the constructor is the implementation of a
factory | 3862 * constructor is being declared if the constructor is the implementation of a
factory |
| 3474 * constructor. | 3863 * constructor. |
| 3864 * |
| 3475 * @return the type of object being created | 3865 * @return the type of object being created |
| 3476 */ | 3866 */ |
| 3477 Identifier get returnType => _returnType; | 3867 Identifier get returnType => _returnType; |
| 3478 | 3868 |
| 3479 /** | 3869 /** |
| 3480 * Return the token for the separator (colon or equals) before the initializer
s, or `null`if there are no initializers. | 3870 * Return the token for the separator (colon or equals) before the initializer
s, or `null` |
| 3871 * if there are no initializers. |
| 3872 * |
| 3481 * @return the token for the separator (colon or equals) before the initialize
rs | 3873 * @return the token for the separator (colon or equals) before the initialize
rs |
| 3482 */ | 3874 */ |
| 3483 Token get separator => _separator; | 3875 Token get separator => _separator; |
| 3484 | 3876 |
| 3485 /** | 3877 /** |
| 3486 * Set the body of the constructor to the given function body. | 3878 * Set the body of the constructor to the given function body. |
| 3879 * |
| 3487 * @param functionBody the body of the constructor | 3880 * @param functionBody the body of the constructor |
| 3488 */ | 3881 */ |
| 3489 void set body(FunctionBody functionBody) { | 3882 void set body(FunctionBody functionBody) { |
| 3490 _body = becomeParentOf(functionBody); | 3883 _body = becomeParentOf(functionBody); |
| 3491 } | 3884 } |
| 3492 | 3885 |
| 3493 /** | 3886 /** |
| 3494 * Set the token for the 'const' keyword to the given token. | 3887 * Set the token for the 'const' keyword to the given token. |
| 3888 * |
| 3495 * @param constKeyword the token for the 'const' keyword | 3889 * @param constKeyword the token for the 'const' keyword |
| 3496 */ | 3890 */ |
| 3497 void set constKeyword(Token constKeyword2) { | 3891 void set constKeyword(Token constKeyword2) { |
| 3498 this._constKeyword = constKeyword2; | 3892 this._constKeyword = constKeyword2; |
| 3499 } | 3893 } |
| 3500 | 3894 |
| 3501 /** | 3895 /** |
| 3502 * Set the element associated with this constructor to the given element. | 3896 * Set the element associated with this constructor to the given element. |
| 3897 * |
| 3503 * @param element the element associated with this constructor | 3898 * @param element the element associated with this constructor |
| 3504 */ | 3899 */ |
| 3505 void set element(ConstructorElement element2) { | 3900 void set element(ConstructorElement element2) { |
| 3506 this._element = element2; | 3901 this._element = element2; |
| 3507 } | 3902 } |
| 3508 | 3903 |
| 3509 /** | 3904 /** |
| 3510 * Set the token for the 'external' keyword to the given token. | 3905 * Set the token for the 'external' keyword to the given token. |
| 3906 * |
| 3511 * @param externalKeyword the token for the 'external' keyword | 3907 * @param externalKeyword the token for the 'external' keyword |
| 3512 */ | 3908 */ |
| 3513 void set externalKeyword(Token externalKeyword2) { | 3909 void set externalKeyword(Token externalKeyword2) { |
| 3514 this._externalKeyword = externalKeyword2; | 3910 this._externalKeyword = externalKeyword2; |
| 3515 } | 3911 } |
| 3516 | 3912 |
| 3517 /** | 3913 /** |
| 3518 * Set the token for the 'factory' keyword to the given token. | 3914 * Set the token for the 'factory' keyword to the given token. |
| 3915 * |
| 3519 * @param factoryKeyword the token for the 'factory' keyword | 3916 * @param factoryKeyword the token for the 'factory' keyword |
| 3520 */ | 3917 */ |
| 3521 void set factoryKeyword(Token factoryKeyword2) { | 3918 void set factoryKeyword(Token factoryKeyword2) { |
| 3522 this._factoryKeyword = factoryKeyword2; | 3919 this._factoryKeyword = factoryKeyword2; |
| 3523 } | 3920 } |
| 3524 | 3921 |
| 3525 /** | 3922 /** |
| 3526 * Set the name of the constructor to the given identifier. | 3923 * Set the name of the constructor to the given identifier. |
| 3924 * |
| 3527 * @param identifier the name of the constructor | 3925 * @param identifier the name of the constructor |
| 3528 */ | 3926 */ |
| 3529 void set name(SimpleIdentifier identifier) { | 3927 void set name(SimpleIdentifier identifier) { |
| 3530 _name = becomeParentOf(identifier); | 3928 _name = becomeParentOf(identifier); |
| 3531 } | 3929 } |
| 3532 | 3930 |
| 3533 /** | 3931 /** |
| 3534 * Set the parameters associated with the constructor to the given list of par
ameters. | 3932 * Set the parameters associated with the constructor to the given list of par
ameters. |
| 3933 * |
| 3535 * @param parameters the parameters associated with the constructor | 3934 * @param parameters the parameters associated with the constructor |
| 3536 */ | 3935 */ |
| 3537 void set parameters(FormalParameterList parameters2) { | 3936 void set parameters(FormalParameterList parameters2) { |
| 3538 this._parameters = becomeParentOf(parameters2); | 3937 this._parameters = becomeParentOf(parameters2); |
| 3539 } | 3938 } |
| 3540 | 3939 |
| 3541 /** | 3940 /** |
| 3542 * Set the token for the period before the constructor name to the given token
. | 3941 * Set the token for the period before the constructor name to the given token
. |
| 3942 * |
| 3543 * @param period the token for the period before the constructor name | 3943 * @param period the token for the period before the constructor name |
| 3544 */ | 3944 */ |
| 3545 void set period(Token period2) { | 3945 void set period(Token period2) { |
| 3546 this._period = period2; | 3946 this._period = period2; |
| 3547 } | 3947 } |
| 3548 | 3948 |
| 3549 /** | 3949 /** |
| 3550 * Set the name of the constructor to which this constructor will be redirecte
d to the given | 3950 * Set the name of the constructor to which this constructor will be redirecte
d to the given |
| 3551 * constructor name. | 3951 * constructor name. |
| 3952 * |
| 3552 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be | 3953 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be |
| 3553 * redirected | 3954 * redirected |
| 3554 */ | 3955 */ |
| 3555 void set redirectedConstructor(ConstructorName redirectedConstructor2) { | 3956 void set redirectedConstructor(ConstructorName redirectedConstructor2) { |
| 3556 this._redirectedConstructor = becomeParentOf(redirectedConstructor2); | 3957 this._redirectedConstructor = becomeParentOf(redirectedConstructor2); |
| 3557 } | 3958 } |
| 3558 | 3959 |
| 3559 /** | 3960 /** |
| 3560 * Set the type of object being created to the given type name. | 3961 * Set the type of object being created to the given type name. |
| 3962 * |
| 3561 * @param typeName the type of object being created | 3963 * @param typeName the type of object being created |
| 3562 */ | 3964 */ |
| 3563 void set returnType(Identifier typeName) { | 3965 void set returnType(Identifier typeName) { |
| 3564 _returnType = becomeParentOf(typeName); | 3966 _returnType = becomeParentOf(typeName); |
| 3565 } | 3967 } |
| 3566 | 3968 |
| 3567 /** | 3969 /** |
| 3568 * Set the token for the separator (colon or equals) before the initializers t
o the given token. | 3970 * Set the token for the separator (colon or equals) before the initializers t
o the given token. |
| 3971 * |
| 3569 * @param separator the token for the separator (colon or equals) before the i
nitializers | 3972 * @param separator the token for the separator (colon or equals) before the i
nitializers |
| 3570 */ | 3973 */ |
| 3571 void set separator(Token separator2) { | 3974 void set separator(Token separator2) { |
| 3572 this._separator = separator2; | 3975 this._separator = separator2; |
| 3573 } | 3976 } |
| 3574 void visitChildren(ASTVisitor<Object> visitor) { | 3977 void visitChildren(ASTVisitor<Object> visitor) { |
| 3575 super.visitChildren(visitor); | 3978 super.visitChildren(visitor); |
| 3576 safelyVisitChild(_returnType, visitor); | 3979 safelyVisitChild(_returnType, visitor); |
| 3577 safelyVisitChild(_name, visitor); | 3980 safelyVisitChild(_name, visitor); |
| 3578 safelyVisitChild(_parameters, visitor); | 3981 safelyVisitChild(_parameters, visitor); |
| 3579 _initializers.accept(visitor); | 3982 _initializers.accept(visitor); |
| 3580 safelyVisitChild(_redirectedConstructor, visitor); | 3983 safelyVisitChild(_redirectedConstructor, visitor); |
| 3581 safelyVisitChild(_body, visitor); | 3984 safelyVisitChild(_body, visitor); |
| 3582 } | 3985 } |
| 3583 Token get firstTokenAfterCommentAndMetadata { | 3986 Token get firstTokenAfterCommentAndMetadata { |
| 3584 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword
]); | 3987 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword
]); |
| 3585 if (leftMost2 != null) { | 3988 if (leftMost2 != null) { |
| 3586 return leftMost2; | 3989 return leftMost2; |
| 3587 } | 3990 } |
| 3588 return _returnType.beginToken; | 3991 return _returnType.beginToken; |
| 3589 } | 3992 } |
| 3590 | 3993 |
| 3591 /** | 3994 /** |
| 3592 * Return the left-most of the given tokens, or `null` if there are no tokens
given or if | 3995 * Return the left-most of the given tokens, or `null` if there are no tokens
given or if |
| 3593 * all of the given tokens are `null`. | 3996 * all of the given tokens are `null`. |
| 3997 * |
| 3594 * @param tokens the tokens being compared to find the left-most token | 3998 * @param tokens the tokens being compared to find the left-most token |
| 3595 * @return the left-most of the given tokens | 3999 * @return the left-most of the given tokens |
| 3596 */ | 4000 */ |
| 3597 Token leftMost(List<Token> tokens) { | 4001 Token leftMost(List<Token> tokens) { |
| 3598 Token leftMost = null; | 4002 Token leftMost = null; |
| 3599 int offset = 2147483647; | 4003 int offset = 2147483647; |
| 3600 for (Token token in tokens) { | 4004 for (Token token in tokens) { |
| 3601 if (token != null && token.offset < offset) { | 4005 if (token != null && token.offset < offset) { |
| 3602 leftMost = token; | 4006 leftMost = token; |
| 3603 } | 4007 } |
| 3604 } | 4008 } |
| 3605 return leftMost; | 4009 return leftMost; |
| 3606 } | 4010 } |
| 3607 } | 4011 } |
| 3608 /** | 4012 /** |
| 3609 * Instances of the class `ConstructorFieldInitializer` represent the initializa
tion of a | 4013 * Instances of the class `ConstructorFieldInitializer` represent the initializa
tion of a |
| 3610 * field within a constructor's initialization list. | 4014 * field within a constructor's initialization list. |
| 4015 * |
| 3611 * <pre> | 4016 * <pre> |
| 3612 * fieldInitializer ::= | 4017 * fieldInitializer ::= |
| 3613 * ('this' '.')? [SimpleIdentifier fieldName] '=' [Expression conditionalExpress
ion cascadeSection*]</pre> | 4018 * ('this' '.')? [SimpleIdentifier] '=' [Expression] |
| 4019 * </pre> |
| 4020 * |
| 3614 * @coverage dart.engine.ast | 4021 * @coverage dart.engine.ast |
| 3615 */ | 4022 */ |
| 3616 class ConstructorFieldInitializer extends ConstructorInitializer { | 4023 class ConstructorFieldInitializer extends ConstructorInitializer { |
| 3617 | 4024 |
| 3618 /** | 4025 /** |
| 3619 * The token for the 'this' keyword, or `null` if there is no 'this' keyword. | 4026 * The token for the 'this' keyword, or `null` if there is no 'this' keyword. |
| 3620 */ | 4027 */ |
| 3621 Token _keyword; | 4028 Token _keyword; |
| 3622 | 4029 |
| 3623 /** | 4030 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3637 Token _equals; | 4044 Token _equals; |
| 3638 | 4045 |
| 3639 /** | 4046 /** |
| 3640 * The expression computing the value to which the field will be initialized. | 4047 * The expression computing the value to which the field will be initialized. |
| 3641 */ | 4048 */ |
| 3642 Expression _expression; | 4049 Expression _expression; |
| 3643 | 4050 |
| 3644 /** | 4051 /** |
| 3645 * Initialize a newly created field initializer to initialize the field with t
he given name to the | 4052 * Initialize a newly created field initializer to initialize the field with t
he given name to the |
| 3646 * value of the given expression. | 4053 * value of the given expression. |
| 4054 * |
| 3647 * @param keyword the token for the 'this' keyword | 4055 * @param keyword the token for the 'this' keyword |
| 3648 * @param period the token for the period after the 'this' keyword | 4056 * @param period the token for the period after the 'this' keyword |
| 3649 * @param fieldName the name of the field being initialized | 4057 * @param fieldName the name of the field being initialized |
| 3650 * @param equals the token for the equal sign between the field name and the e
xpression | 4058 * @param equals the token for the equal sign between the field name and the e
xpression |
| 3651 * @param expression the expression computing the value to which the field wil
l be initialized | 4059 * @param expression the expression computing the value to which the field wil
l be initialized |
| 3652 */ | 4060 */ |
| 3653 ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier
fieldName, Token equals, Expression expression) { | 4061 ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier
fieldName, Token equals, Expression expression) { |
| 3654 this._keyword = keyword; | 4062 this._keyword = keyword; |
| 3655 this._period = period; | 4063 this._period = period; |
| 3656 this._fieldName = becomeParentOf(fieldName); | 4064 this._fieldName = becomeParentOf(fieldName); |
| 3657 this._equals = equals; | 4065 this._equals = equals; |
| 3658 this._expression = becomeParentOf(expression); | 4066 this._expression = becomeParentOf(expression); |
| 3659 } | 4067 } |
| 3660 | 4068 |
| 3661 /** | 4069 /** |
| 3662 * Initialize a newly created field initializer to initialize the field with t
he given name to the | 4070 * Initialize a newly created field initializer to initialize the field with t
he given name to the |
| 3663 * value of the given expression. | 4071 * value of the given expression. |
| 4072 * |
| 3664 * @param keyword the token for the 'this' keyword | 4073 * @param keyword the token for the 'this' keyword |
| 3665 * @param period the token for the period after the 'this' keyword | 4074 * @param period the token for the period after the 'this' keyword |
| 3666 * @param fieldName the name of the field being initialized | 4075 * @param fieldName the name of the field being initialized |
| 3667 * @param equals the token for the equal sign between the field name and the e
xpression | 4076 * @param equals the token for the equal sign between the field name and the e
xpression |
| 3668 * @param expression the expression computing the value to which the field wil
l be initialized | 4077 * @param expression the expression computing the value to which the field wil
l be initialized |
| 3669 */ | 4078 */ |
| 3670 ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fie
ldName, Token equals, Expression expression}) : this.full(keyword, period, field
Name, equals, expression); | 4079 ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fie
ldName, Token equals, Expression expression}) : this.full(keyword, period, field
Name, equals, expression); |
| 3671 accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this); | 4080 accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this); |
| 3672 Token get beginToken { | 4081 Token get beginToken { |
| 3673 if (_keyword != null) { | 4082 if (_keyword != null) { |
| 3674 return _keyword; | 4083 return _keyword; |
| 3675 } | 4084 } |
| 3676 return _fieldName.beginToken; | 4085 return _fieldName.beginToken; |
| 3677 } | 4086 } |
| 3678 Token get endToken => _expression.endToken; | 4087 Token get endToken => _expression.endToken; |
| 3679 | 4088 |
| 3680 /** | 4089 /** |
| 3681 * Return the token for the equal sign between the field name and the expressi
on. | 4090 * Return the token for the equal sign between the field name and the expressi
on. |
| 4091 * |
| 3682 * @return the token for the equal sign between the field name and the express
ion | 4092 * @return the token for the equal sign between the field name and the express
ion |
| 3683 */ | 4093 */ |
| 3684 Token get equals => _equals; | 4094 Token get equals => _equals; |
| 3685 | 4095 |
| 3686 /** | 4096 /** |
| 3687 * Return the expression computing the value to which the field will be initia
lized. | 4097 * Return the expression computing the value to which the field will be initia
lized. |
| 4098 * |
| 3688 * @return the expression computing the value to which the field will be initi
alized | 4099 * @return the expression computing the value to which the field will be initi
alized |
| 3689 */ | 4100 */ |
| 3690 Expression get expression => _expression; | 4101 Expression get expression => _expression; |
| 3691 | 4102 |
| 3692 /** | 4103 /** |
| 3693 * Return the name of the field being initialized. | 4104 * Return the name of the field being initialized. |
| 4105 * |
| 3694 * @return the name of the field being initialized | 4106 * @return the name of the field being initialized |
| 3695 */ | 4107 */ |
| 3696 SimpleIdentifier get fieldName => _fieldName; | 4108 SimpleIdentifier get fieldName => _fieldName; |
| 3697 | 4109 |
| 3698 /** | 4110 /** |
| 3699 * Return the token for the 'this' keyword, or `null` if there is no 'this' ke
yword. | 4111 * Return the token for the 'this' keyword, or `null` if there is no 'this' ke
yword. |
| 4112 * |
| 3700 * @return the token for the 'this' keyword | 4113 * @return the token for the 'this' keyword |
| 3701 */ | 4114 */ |
| 3702 Token get keyword => _keyword; | 4115 Token get keyword => _keyword; |
| 3703 | 4116 |
| 3704 /** | 4117 /** |
| 3705 * Return the token for the period after the 'this' keyword, or `null` if ther
e is no 'this' | 4118 * Return the token for the period after the 'this' keyword, or `null` if ther
e is no 'this' |
| 3706 * keyword. | 4119 * keyword. |
| 4120 * |
| 3707 * @return the token for the period after the 'this' keyword | 4121 * @return the token for the period after the 'this' keyword |
| 3708 */ | 4122 */ |
| 3709 Token get period => _period; | 4123 Token get period => _period; |
| 3710 | 4124 |
| 3711 /** | 4125 /** |
| 3712 * Set the token for the equal sign between the field name and the expression
to the given token. | 4126 * Set the token for the equal sign between the field name and the expression
to the given token. |
| 4127 * |
| 3713 * @param equals the token for the equal sign between the field name and the e
xpression | 4128 * @param equals the token for the equal sign between the field name and the e
xpression |
| 3714 */ | 4129 */ |
| 3715 void set equals(Token equals2) { | 4130 void set equals(Token equals2) { |
| 3716 this._equals = equals2; | 4131 this._equals = equals2; |
| 3717 } | 4132 } |
| 3718 | 4133 |
| 3719 /** | 4134 /** |
| 3720 * Set the expression computing the value to which the field will be initializ
ed to the given | 4135 * Set the expression computing the value to which the field will be initializ
ed to the given |
| 3721 * expression. | 4136 * expression. |
| 4137 * |
| 3722 * @param expression the expression computing the value to which the field wil
l be initialized | 4138 * @param expression the expression computing the value to which the field wil
l be initialized |
| 3723 */ | 4139 */ |
| 3724 void set expression(Expression expression2) { | 4140 void set expression(Expression expression2) { |
| 3725 this._expression = becomeParentOf(expression2); | 4141 this._expression = becomeParentOf(expression2); |
| 3726 } | 4142 } |
| 3727 | 4143 |
| 3728 /** | 4144 /** |
| 3729 * Set the name of the field being initialized to the given identifier. | 4145 * Set the name of the field being initialized to the given identifier. |
| 4146 * |
| 3730 * @param identifier the name of the field being initialized | 4147 * @param identifier the name of the field being initialized |
| 3731 */ | 4148 */ |
| 3732 void set fieldName(SimpleIdentifier identifier) { | 4149 void set fieldName(SimpleIdentifier identifier) { |
| 3733 _fieldName = becomeParentOf(identifier); | 4150 _fieldName = becomeParentOf(identifier); |
| 3734 } | 4151 } |
| 3735 | 4152 |
| 3736 /** | 4153 /** |
| 3737 * Set the token for the 'this' keyword to the given token. | 4154 * Set the token for the 'this' keyword to the given token. |
| 4155 * |
| 3738 * @param keyword the token for the 'this' keyword | 4156 * @param keyword the token for the 'this' keyword |
| 3739 */ | 4157 */ |
| 3740 void set keyword(Token keyword2) { | 4158 void set keyword(Token keyword2) { |
| 3741 this._keyword = keyword2; | 4159 this._keyword = keyword2; |
| 3742 } | 4160 } |
| 3743 | 4161 |
| 3744 /** | 4162 /** |
| 3745 * Set the token for the period after the 'this' keyword to the given token. | 4163 * Set the token for the period after the 'this' keyword to the given token. |
| 4164 * |
| 3746 * @param period the token for the period after the 'this' keyword | 4165 * @param period the token for the period after the 'this' keyword |
| 3747 */ | 4166 */ |
| 3748 void set period(Token period2) { | 4167 void set period(Token period2) { |
| 3749 this._period = period2; | 4168 this._period = period2; |
| 3750 } | 4169 } |
| 3751 void visitChildren(ASTVisitor<Object> visitor) { | 4170 void visitChildren(ASTVisitor<Object> visitor) { |
| 3752 safelyVisitChild(_fieldName, visitor); | 4171 safelyVisitChild(_fieldName, visitor); |
| 3753 safelyVisitChild(_expression, visitor); | 4172 safelyVisitChild(_expression, visitor); |
| 3754 } | 4173 } |
| 3755 } | 4174 } |
| 3756 /** | 4175 /** |
| 3757 * Instances of the class `ConstructorInitializer` defines the behavior of nodes
that can | 4176 * Instances of the class `ConstructorInitializer` defines the behavior of nodes
that can |
| 3758 * occur in the initializer list of a constructor declaration. | 4177 * occur in the initializer list of a constructor declaration. |
| 4178 * |
| 3759 * <pre> | 4179 * <pre> |
| 3760 * constructorInitializer ::=[SuperConstructorInvocation superInvocation]| [Cons
tructorFieldInitializer fieldInitializer]</pre> | 4180 * constructorInitializer ::= |
| 4181 * [SuperConstructorInvocation] |
| 4182 * | [ConstructorFieldInitializer] |
| 4183 * </pre> |
| 4184 * |
| 3761 * @coverage dart.engine.ast | 4185 * @coverage dart.engine.ast |
| 3762 */ | 4186 */ |
| 3763 abstract class ConstructorInitializer extends ASTNode { | 4187 abstract class ConstructorInitializer extends ASTNode { |
| 3764 } | 4188 } |
| 3765 /** | 4189 /** |
| 3766 * Instances of the class `ConstructorName` represent the name of the constructo
r. | 4190 * Instances of the class `ConstructorName` represent the name of the constructo
r. |
| 4191 * |
| 3767 * <pre> | 4192 * <pre> |
| 3768 * constructorName: | 4193 * constructorName: |
| 3769 * type ('.' identifier)? | 4194 * type ('.' identifier)? |
| 3770 * </pre> | 4195 * </pre> |
| 4196 * |
| 3771 * @coverage dart.engine.ast | 4197 * @coverage dart.engine.ast |
| 3772 */ | 4198 */ |
| 3773 class ConstructorName extends ASTNode { | 4199 class ConstructorName extends ASTNode { |
| 3774 | 4200 |
| 3775 /** | 4201 /** |
| 3776 * The name of the type defining the constructor. | 4202 * The name of the type defining the constructor. |
| 3777 */ | 4203 */ |
| 3778 TypeName _type; | 4204 TypeName _type; |
| 3779 | 4205 |
| 3780 /** | 4206 /** |
| 3781 * The token for the period before the constructor name, or `null` if the spec
ified | 4207 * The token for the period before the constructor name, or `null` if the spec
ified |
| 3782 * constructor is the unnamed constructor. | 4208 * constructor is the unnamed constructor. |
| 3783 */ | 4209 */ |
| 3784 Token _period; | 4210 Token _period; |
| 3785 | 4211 |
| 3786 /** | 4212 /** |
| 3787 * The name of the constructor, or `null` if the specified constructor is the
unnamed | 4213 * The name of the constructor, or `null` if the specified constructor is the
unnamed |
| 3788 * constructor. | 4214 * constructor. |
| 3789 */ | 4215 */ |
| 3790 SimpleIdentifier _name; | 4216 SimpleIdentifier _name; |
| 3791 | 4217 |
| 3792 /** | 4218 /** |
| 3793 * The element associated with this constructor name based on static type info
rmation, or`null` if the AST structure has not been resolved or if this construc
tor name could not | 4219 * The element associated with this constructor name based on static type info
rmation, or |
| 4220 * `null` if the AST structure has not been resolved or if this constructor na
me could not |
| 3794 * be resolved. | 4221 * be resolved. |
| 3795 */ | 4222 */ |
| 3796 ConstructorElement _staticElement; | 4223 ConstructorElement _staticElement; |
| 3797 | 4224 |
| 3798 /** | 4225 /** |
| 3799 * The element associated with this constructor name based on propagated type
information, or`null` if the AST structure has not been resolved or if this cons
tructor name could not | 4226 * The element associated with this constructor name based on propagated type
information, or |
| 4227 * `null` if the AST structure has not been resolved or if this constructor na
me could not |
| 3800 * be resolved. | 4228 * be resolved. |
| 3801 */ | 4229 */ |
| 3802 ConstructorElement _propagatedElement; | 4230 ConstructorElement _propagatedElement; |
| 3803 | 4231 |
| 3804 /** | 4232 /** |
| 3805 * Initialize a newly created constructor name. | 4233 * Initialize a newly created constructor name. |
| 4234 * |
| 3806 * @param type the name of the type defining the constructor | 4235 * @param type the name of the type defining the constructor |
| 3807 * @param period the token for the period before the constructor name | 4236 * @param period the token for the period before the constructor name |
| 3808 * @param name the name of the constructor | 4237 * @param name the name of the constructor |
| 3809 */ | 4238 */ |
| 3810 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) { | 4239 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) { |
| 3811 this._type = becomeParentOf(type); | 4240 this._type = becomeParentOf(type); |
| 3812 this._period = period; | 4241 this._period = period; |
| 3813 this._name = becomeParentOf(name); | 4242 this._name = becomeParentOf(name); |
| 3814 } | 4243 } |
| 3815 | 4244 |
| 3816 /** | 4245 /** |
| 3817 * Initialize a newly created constructor name. | 4246 * Initialize a newly created constructor name. |
| 4247 * |
| 3818 * @param type the name of the type defining the constructor | 4248 * @param type the name of the type defining the constructor |
| 3819 * @param period the token for the period before the constructor name | 4249 * @param period the token for the period before the constructor name |
| 3820 * @param name the name of the constructor | 4250 * @param name the name of the constructor |
| 3821 */ | 4251 */ |
| 3822 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f
ull(type, period, name); | 4252 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f
ull(type, period, name); |
| 3823 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); | 4253 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); |
| 3824 Token get beginToken => _type.beginToken; | 4254 Token get beginToken => _type.beginToken; |
| 3825 | 4255 |
| 3826 /** | 4256 /** |
| 3827 * Return the element associated with this constructor name based on propagate
d type information, | 4257 * Return the element associated with this constructor name based on propagate
d type information, |
| 3828 * or `null` if the AST structure has not been resolved or if this constructor
name could | 4258 * or `null` if the AST structure has not been resolved or if this constructor
name could |
| 3829 * not be resolved. | 4259 * not be resolved. |
| 4260 * |
| 3830 * @return the element associated with this constructor name | 4261 * @return the element associated with this constructor name |
| 3831 */ | 4262 */ |
| 3832 ConstructorElement get element => _propagatedElement; | 4263 ConstructorElement get element => _propagatedElement; |
| 3833 Token get endToken { | 4264 Token get endToken { |
| 3834 if (_name != null) { | 4265 if (_name != null) { |
| 3835 return _name.endToken; | 4266 return _name.endToken; |
| 3836 } | 4267 } |
| 3837 return _type.endToken; | 4268 return _type.endToken; |
| 3838 } | 4269 } |
| 3839 | 4270 |
| 3840 /** | 4271 /** |
| 3841 * Return the name of the constructor, or `null` if the specified constructor
is the unnamed | 4272 * Return the name of the constructor, or `null` if the specified constructor
is the unnamed |
| 3842 * constructor. | 4273 * constructor. |
| 4274 * |
| 3843 * @return the name of the constructor | 4275 * @return the name of the constructor |
| 3844 */ | 4276 */ |
| 3845 SimpleIdentifier get name => _name; | 4277 SimpleIdentifier get name => _name; |
| 3846 | 4278 |
| 3847 /** | 4279 /** |
| 3848 * Return the token for the period before the constructor name, or `null` if t
he specified | 4280 * Return the token for the period before the constructor name, or `null` if t
he specified |
| 3849 * constructor is the unnamed constructor. | 4281 * constructor is the unnamed constructor. |
| 4282 * |
| 3850 * @return the token for the period before the constructor name | 4283 * @return the token for the period before the constructor name |
| 3851 */ | 4284 */ |
| 3852 Token get period => _period; | 4285 Token get period => _period; |
| 3853 | 4286 |
| 3854 /** | 4287 /** |
| 3855 * Return the element associated with this constructor name based on static ty
pe information, or`null` if the AST structure has not been resolved or if this c
onstructor name could not | 4288 * Return the element associated with this constructor name based on static ty
pe information, or |
| 4289 * `null` if the AST structure has not been resolved or if this constructor na
me could not |
| 3856 * be resolved. | 4290 * be resolved. |
| 4291 * |
| 3857 * @return the element associated with this constructor name | 4292 * @return the element associated with this constructor name |
| 3858 */ | 4293 */ |
| 3859 ConstructorElement get staticElement => _staticElement; | 4294 ConstructorElement get staticElement => _staticElement; |
| 3860 | 4295 |
| 3861 /** | 4296 /** |
| 3862 * Return the name of the type defining the constructor. | 4297 * Return the name of the type defining the constructor. |
| 4298 * |
| 3863 * @return the name of the type defining the constructor | 4299 * @return the name of the type defining the constructor |
| 3864 */ | 4300 */ |
| 3865 TypeName get type => _type; | 4301 TypeName get type => _type; |
| 3866 | 4302 |
| 3867 /** | 4303 /** |
| 3868 * Set the element associated with this constructor name based on propagated t
ype information to | 4304 * Set the element associated with this constructor name based on propagated t
ype information to |
| 3869 * the given element. | 4305 * the given element. |
| 4306 * |
| 3870 * @param element the element to be associated with this constructor name | 4307 * @param element the element to be associated with this constructor name |
| 3871 */ | 4308 */ |
| 3872 void set element(ConstructorElement element2) { | 4309 void set element(ConstructorElement element2) { |
| 3873 _propagatedElement = element2; | 4310 _propagatedElement = element2; |
| 3874 } | 4311 } |
| 3875 | 4312 |
| 3876 /** | 4313 /** |
| 3877 * Set the name of the constructor to the given name. | 4314 * Set the name of the constructor to the given name. |
| 4315 * |
| 3878 * @param name the name of the constructor | 4316 * @param name the name of the constructor |
| 3879 */ | 4317 */ |
| 3880 void set name(SimpleIdentifier name2) { | 4318 void set name(SimpleIdentifier name2) { |
| 3881 this._name = becomeParentOf(name2); | 4319 this._name = becomeParentOf(name2); |
| 3882 } | 4320 } |
| 3883 | 4321 |
| 3884 /** | 4322 /** |
| 3885 * Return the token for the period before the constructor name to the given to
ken. | 4323 * Return the token for the period before the constructor name to the given to
ken. |
| 4324 * |
| 3886 * @param period the token for the period before the constructor name | 4325 * @param period the token for the period before the constructor name |
| 3887 */ | 4326 */ |
| 3888 void set period(Token period2) { | 4327 void set period(Token period2) { |
| 3889 this._period = period2; | 4328 this._period = period2; |
| 3890 } | 4329 } |
| 3891 | 4330 |
| 3892 /** | 4331 /** |
| 3893 * Set the element associated with this constructor name based on static type
information to the | 4332 * Set the element associated with this constructor name based on static type
information to the |
| 3894 * given element. | 4333 * given element. |
| 4334 * |
| 3895 * @param element the element to be associated with this constructor name | 4335 * @param element the element to be associated with this constructor name |
| 3896 */ | 4336 */ |
| 3897 void set staticElement(ConstructorElement element) { | 4337 void set staticElement(ConstructorElement element) { |
| 3898 _staticElement = element; | 4338 _staticElement = element; |
| 3899 } | 4339 } |
| 3900 | 4340 |
| 3901 /** | 4341 /** |
| 3902 * Set the name of the type defining the constructor to the given type name. | 4342 * Set the name of the type defining the constructor to the given type name. |
| 4343 * |
| 3903 * @param type the name of the type defining the constructor | 4344 * @param type the name of the type defining the constructor |
| 3904 */ | 4345 */ |
| 3905 void set type(TypeName type2) { | 4346 void set type(TypeName type2) { |
| 3906 this._type = becomeParentOf(type2); | 4347 this._type = becomeParentOf(type2); |
| 3907 } | 4348 } |
| 3908 void visitChildren(ASTVisitor<Object> visitor) { | 4349 void visitChildren(ASTVisitor<Object> visitor) { |
| 3909 safelyVisitChild(_type, visitor); | 4350 safelyVisitChild(_type, visitor); |
| 3910 safelyVisitChild(_name, visitor); | 4351 safelyVisitChild(_name, visitor); |
| 3911 } | 4352 } |
| 3912 } | 4353 } |
| 3913 /** | 4354 /** |
| 3914 * Instances of the class `ContinueStatement` represent a continue statement. | 4355 * Instances of the class `ContinueStatement` represent a continue statement. |
| 4356 * |
| 3915 * <pre> | 4357 * <pre> |
| 3916 * continueStatement ::= | 4358 * continueStatement ::= |
| 3917 * 'continue' [SimpleIdentifier label]? ';' | 4359 * 'continue' [SimpleIdentifier]? ';' |
| 3918 * </pre> | 4360 * </pre> |
| 4361 * |
| 3919 * @coverage dart.engine.ast | 4362 * @coverage dart.engine.ast |
| 3920 */ | 4363 */ |
| 3921 class ContinueStatement extends Statement { | 4364 class ContinueStatement extends Statement { |
| 3922 | 4365 |
| 3923 /** | 4366 /** |
| 3924 * The token representing the 'continue' keyword. | 4367 * The token representing the 'continue' keyword. |
| 3925 */ | 4368 */ |
| 3926 Token _keyword; | 4369 Token _keyword; |
| 3927 | 4370 |
| 3928 /** | 4371 /** |
| 3929 * The label associated with the statement, or `null` if there is no label. | 4372 * The label associated with the statement, or `null` if there is no label. |
| 3930 */ | 4373 */ |
| 3931 SimpleIdentifier _label; | 4374 SimpleIdentifier _label; |
| 3932 | 4375 |
| 3933 /** | 4376 /** |
| 3934 * The semicolon terminating the statement. | 4377 * The semicolon terminating the statement. |
| 3935 */ | 4378 */ |
| 3936 Token _semicolon; | 4379 Token _semicolon; |
| 3937 | 4380 |
| 3938 /** | 4381 /** |
| 3939 * Initialize a newly created continue statement. | 4382 * Initialize a newly created continue statement. |
| 4383 * |
| 3940 * @param keyword the token representing the 'continue' keyword | 4384 * @param keyword the token representing the 'continue' keyword |
| 3941 * @param label the label associated with the statement | 4385 * @param label the label associated with the statement |
| 3942 * @param semicolon the semicolon terminating the statement | 4386 * @param semicolon the semicolon terminating the statement |
| 3943 */ | 4387 */ |
| 3944 ContinueStatement.full(Token keyword, SimpleIdentifier label, Token semicolon)
{ | 4388 ContinueStatement.full(Token keyword, SimpleIdentifier label, Token semicolon)
{ |
| 3945 this._keyword = keyword; | 4389 this._keyword = keyword; |
| 3946 this._label = becomeParentOf(label); | 4390 this._label = becomeParentOf(label); |
| 3947 this._semicolon = semicolon; | 4391 this._semicolon = semicolon; |
| 3948 } | 4392 } |
| 3949 | 4393 |
| 3950 /** | 4394 /** |
| 3951 * Initialize a newly created continue statement. | 4395 * Initialize a newly created continue statement. |
| 4396 * |
| 3952 * @param keyword the token representing the 'continue' keyword | 4397 * @param keyword the token representing the 'continue' keyword |
| 3953 * @param label the label associated with the statement | 4398 * @param label the label associated with the statement |
| 3954 * @param semicolon the semicolon terminating the statement | 4399 * @param semicolon the semicolon terminating the statement |
| 3955 */ | 4400 */ |
| 3956 ContinueStatement({Token keyword, SimpleIdentifier label, Token semicolon}) :
this.full(keyword, label, semicolon); | 4401 ContinueStatement({Token keyword, SimpleIdentifier label, Token semicolon}) :
this.full(keyword, label, semicolon); |
| 3957 accept(ASTVisitor visitor) => visitor.visitContinueStatement(this); | 4402 accept(ASTVisitor visitor) => visitor.visitContinueStatement(this); |
| 3958 Token get beginToken => _keyword; | 4403 Token get beginToken => _keyword; |
| 3959 Token get endToken => _semicolon; | 4404 Token get endToken => _semicolon; |
| 3960 | 4405 |
| 3961 /** | 4406 /** |
| 3962 * Return the token representing the 'continue' keyword. | 4407 * Return the token representing the 'continue' keyword. |
| 4408 * |
| 3963 * @return the token representing the 'continue' keyword | 4409 * @return the token representing the 'continue' keyword |
| 3964 */ | 4410 */ |
| 3965 Token get keyword => _keyword; | 4411 Token get keyword => _keyword; |
| 3966 | 4412 |
| 3967 /** | 4413 /** |
| 3968 * Return the label associated with the statement, or `null` if there is no la
bel. | 4414 * Return the label associated with the statement, or `null` if there is no la
bel. |
| 4415 * |
| 3969 * @return the label associated with the statement | 4416 * @return the label associated with the statement |
| 3970 */ | 4417 */ |
| 3971 SimpleIdentifier get label => _label; | 4418 SimpleIdentifier get label => _label; |
| 3972 | 4419 |
| 3973 /** | 4420 /** |
| 3974 * Return the semicolon terminating the statement. | 4421 * Return the semicolon terminating the statement. |
| 4422 * |
| 3975 * @return the semicolon terminating the statement | 4423 * @return the semicolon terminating the statement |
| 3976 */ | 4424 */ |
| 3977 Token get semicolon => _semicolon; | 4425 Token get semicolon => _semicolon; |
| 3978 | 4426 |
| 3979 /** | 4427 /** |
| 3980 * Set the token representing the 'continue' keyword to the given token. | 4428 * Set the token representing the 'continue' keyword to the given token. |
| 4429 * |
| 3981 * @param keyword the token representing the 'continue' keyword | 4430 * @param keyword the token representing the 'continue' keyword |
| 3982 */ | 4431 */ |
| 3983 void set keyword(Token keyword2) { | 4432 void set keyword(Token keyword2) { |
| 3984 this._keyword = keyword2; | 4433 this._keyword = keyword2; |
| 3985 } | 4434 } |
| 3986 | 4435 |
| 3987 /** | 4436 /** |
| 3988 * Set the label associated with the statement to the given label. | 4437 * Set the label associated with the statement to the given label. |
| 4438 * |
| 3989 * @param identifier the label associated with the statement | 4439 * @param identifier the label associated with the statement |
| 3990 */ | 4440 */ |
| 3991 void set label(SimpleIdentifier identifier) { | 4441 void set label(SimpleIdentifier identifier) { |
| 3992 _label = becomeParentOf(identifier); | 4442 _label = becomeParentOf(identifier); |
| 3993 } | 4443 } |
| 3994 | 4444 |
| 3995 /** | 4445 /** |
| 3996 * Set the semicolon terminating the statement to the given token. | 4446 * Set the semicolon terminating the statement to the given token. |
| 4447 * |
| 3997 * @param semicolon the semicolon terminating the statement | 4448 * @param semicolon the semicolon terminating the statement |
| 3998 */ | 4449 */ |
| 3999 void set semicolon(Token semicolon2) { | 4450 void set semicolon(Token semicolon2) { |
| 4000 this._semicolon = semicolon2; | 4451 this._semicolon = semicolon2; |
| 4001 } | 4452 } |
| 4002 void visitChildren(ASTVisitor<Object> visitor) { | 4453 void visitChildren(ASTVisitor<Object> visitor) { |
| 4003 safelyVisitChild(_label, visitor); | 4454 safelyVisitChild(_label, visitor); |
| 4004 } | 4455 } |
| 4005 } | 4456 } |
| 4006 /** | 4457 /** |
| 4007 * The abstract class `Declaration` defines the behavior common to nodes that re
present the | 4458 * The abstract class `Declaration` defines the behavior common to nodes that re
present the |
| 4008 * declaration of a name. Each declared name is visible within a name scope. | 4459 * declaration of a name. Each declared name is visible within a name scope. |
| 4460 * |
| 4009 * @coverage dart.engine.ast | 4461 * @coverage dart.engine.ast |
| 4010 */ | 4462 */ |
| 4011 abstract class Declaration extends AnnotatedNode { | 4463 abstract class Declaration extends AnnotatedNode { |
| 4012 | 4464 |
| 4013 /** | 4465 /** |
| 4014 * Initialize a newly created declaration. | 4466 * Initialize a newly created declaration. |
| 4467 * |
| 4015 * @param comment the documentation comment associated with this declaration | 4468 * @param comment the documentation comment associated with this declaration |
| 4016 * @param metadata the annotations associated with this declaration | 4469 * @param metadata the annotations associated with this declaration |
| 4017 */ | 4470 */ |
| 4018 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { | 4471 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { |
| 4019 } | 4472 } |
| 4020 | 4473 |
| 4021 /** | 4474 /** |
| 4022 * Initialize a newly created declaration. | 4475 * Initialize a newly created declaration. |
| 4476 * |
| 4023 * @param comment the documentation comment associated with this declaration | 4477 * @param comment the documentation comment associated with this declaration |
| 4024 * @param metadata the annotations associated with this declaration | 4478 * @param metadata the annotations associated with this declaration |
| 4025 */ | 4479 */ |
| 4026 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); | 4480 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); |
| 4027 | 4481 |
| 4028 /** | 4482 /** |
| 4029 * Return the element associated with this declaration, or `null` if either th
is node | 4483 * Return the element associated with this declaration, or `null` if either th
is node |
| 4030 * corresponds to a list of declarations or if the AST structure has not been
resolved. | 4484 * corresponds to a list of declarations or if the AST structure has not been
resolved. |
| 4485 * |
| 4031 * @return the element associated with this declaration | 4486 * @return the element associated with this declaration |
| 4032 */ | 4487 */ |
| 4033 Element get element; | 4488 Element get element; |
| 4034 } | 4489 } |
| 4035 /** | 4490 /** |
| 4036 * Instances of the class `DeclaredIdentifier` represent the declaration of a si
ngle | 4491 * Instances of the class `DeclaredIdentifier` represent the declaration of a si
ngle |
| 4037 * identifier. | 4492 * identifier. |
| 4493 * |
| 4038 * <pre> | 4494 * <pre> |
| 4039 * declaredIdentifier ::= | 4495 * declaredIdentifier ::= |
| 4040 * ([Annotation metadata] finalConstVarOrType [SimpleIdentifier identifier]</pre
> | 4496 * ([Annotation] finalConstVarOrType [SimpleIdentifier] |
| 4497 * </pre> |
| 4498 * |
| 4041 * @coverage dart.engine.ast | 4499 * @coverage dart.engine.ast |
| 4042 */ | 4500 */ |
| 4043 class DeclaredIdentifier extends Declaration { | 4501 class DeclaredIdentifier extends Declaration { |
| 4044 | 4502 |
| 4045 /** | 4503 /** |
| 4046 * The token representing either the 'final', 'const' or 'var' keyword, or `nu
ll` if no | 4504 * The token representing either the 'final', 'const' or 'var' keyword, or `nu
ll` if no |
| 4047 * keyword was used. | 4505 * keyword was used. |
| 4048 */ | 4506 */ |
| 4049 Token _keyword; | 4507 Token _keyword; |
| 4050 | 4508 |
| 4051 /** | 4509 /** |
| 4052 * The name of the declared type of the parameter, or `null` if the parameter
does not have | 4510 * The name of the declared type of the parameter, or `null` if the parameter
does not have |
| 4053 * a declared type. | 4511 * a declared type. |
| 4054 */ | 4512 */ |
| 4055 TypeName _type; | 4513 TypeName _type; |
| 4056 | 4514 |
| 4057 /** | 4515 /** |
| 4058 * The name of the variable being declared. | 4516 * The name of the variable being declared. |
| 4059 */ | 4517 */ |
| 4060 SimpleIdentifier _identifier; | 4518 SimpleIdentifier _identifier; |
| 4061 | 4519 |
| 4062 /** | 4520 /** |
| 4063 * Initialize a newly created formal parameter. | 4521 * Initialize a newly created formal parameter. |
| 4522 * |
| 4064 * @param comment the documentation comment associated with this parameter | 4523 * @param comment the documentation comment associated with this parameter |
| 4065 * @param metadata the annotations associated with this parameter | 4524 * @param metadata the annotations associated with this parameter |
| 4066 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4525 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 4067 * @param type the name of the declared type of the parameter | 4526 * @param type the name of the declared type of the parameter |
| 4068 * @param identifier the name of the parameter being declared | 4527 * @param identifier the name of the parameter being declared |
| 4069 */ | 4528 */ |
| 4070 DeclaredIdentifier.full(Comment comment, List<Annotation> metadata, Token keyw
ord, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata)
{ | 4529 DeclaredIdentifier.full(Comment comment, List<Annotation> metadata, Token keyw
ord, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata)
{ |
| 4071 this._keyword = keyword; | 4530 this._keyword = keyword; |
| 4072 this._type = becomeParentOf(type); | 4531 this._type = becomeParentOf(type); |
| 4073 this._identifier = becomeParentOf(identifier); | 4532 this._identifier = becomeParentOf(identifier); |
| 4074 } | 4533 } |
| 4075 | 4534 |
| 4076 /** | 4535 /** |
| 4077 * Initialize a newly created formal parameter. | 4536 * Initialize a newly created formal parameter. |
| 4537 * |
| 4078 * @param comment the documentation comment associated with this parameter | 4538 * @param comment the documentation comment associated with this parameter |
| 4079 * @param metadata the annotations associated with this parameter | 4539 * @param metadata the annotations associated with this parameter |
| 4080 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4540 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 4081 * @param type the name of the declared type of the parameter | 4541 * @param type the name of the declared type of the parameter |
| 4082 * @param identifier the name of the parameter being declared | 4542 * @param identifier the name of the parameter being declared |
| 4083 */ | 4543 */ |
| 4084 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); | 4544 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); |
| 4085 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); | 4545 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); |
| 4086 LocalVariableElement get element { | 4546 LocalVariableElement get element { |
| 4087 SimpleIdentifier identifier = this.identifier; | 4547 SimpleIdentifier identifier = this.identifier; |
| 4088 if (identifier == null) { | 4548 if (identifier == null) { |
| 4089 return null; | 4549 return null; |
| 4090 } | 4550 } |
| 4091 return identifier.element as LocalVariableElement; | 4551 return identifier.element as LocalVariableElement; |
| 4092 } | 4552 } |
| 4093 Token get endToken => _identifier.endToken; | 4553 Token get endToken => _identifier.endToken; |
| 4094 | 4554 |
| 4095 /** | 4555 /** |
| 4096 * Return the name of the variable being declared. | 4556 * Return the name of the variable being declared. |
| 4557 * |
| 4097 * @return the name of the variable being declared | 4558 * @return the name of the variable being declared |
| 4098 */ | 4559 */ |
| 4099 SimpleIdentifier get identifier => _identifier; | 4560 SimpleIdentifier get identifier => _identifier; |
| 4100 | 4561 |
| 4101 /** | 4562 /** |
| 4102 * Return the token representing either the 'final', 'const' or 'var' keyword. | 4563 * Return the token representing either the 'final', 'const' or 'var' keyword. |
| 4564 * |
| 4103 * @return the token representing either the 'final', 'const' or 'var' keyword | 4565 * @return the token representing either the 'final', 'const' or 'var' keyword |
| 4104 */ | 4566 */ |
| 4105 Token get keyword => _keyword; | 4567 Token get keyword => _keyword; |
| 4106 | 4568 |
| 4107 /** | 4569 /** |
| 4108 * Return the name of the declared type of the parameter, or `null` if the par
ameter does | 4570 * Return the name of the declared type of the parameter, or `null` if the par
ameter does |
| 4109 * not have a declared type. | 4571 * not have a declared type. |
| 4572 * |
| 4110 * @return the name of the declared type of the parameter | 4573 * @return the name of the declared type of the parameter |
| 4111 */ | 4574 */ |
| 4112 TypeName get type => _type; | 4575 TypeName get type => _type; |
| 4113 | 4576 |
| 4114 /** | 4577 /** |
| 4115 * Return `true` if this variable was declared with the 'const' modifier. | 4578 * Return `true` if this variable was declared with the 'const' modifier. |
| 4579 * |
| 4116 * @return `true` if this variable was declared with the 'const' modifier | 4580 * @return `true` if this variable was declared with the 'const' modifier |
| 4117 */ | 4581 */ |
| 4118 bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.CONST); | 4582 bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.CONST); |
| 4119 | 4583 |
| 4120 /** | 4584 /** |
| 4121 * Return `true` if this variable was declared with the 'final' modifier. Vari
ables that are | 4585 * Return `true` if this variable was declared with the 'final' modifier. Vari
ables that are |
| 4122 * declared with the 'const' modifier will return `false` even though they are
implicitly | 4586 * declared with the 'const' modifier will return `false` even though they are
implicitly |
| 4123 * final. | 4587 * final. |
| 4588 * |
| 4124 * @return `true` if this variable was declared with the 'final' modifier | 4589 * @return `true` if this variable was declared with the 'final' modifier |
| 4125 */ | 4590 */ |
| 4126 bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.FINAL); | 4591 bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.FINAL); |
| 4127 | 4592 |
| 4128 /** | 4593 /** |
| 4129 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 4594 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
| 4595 * |
| 4130 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4596 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 4131 */ | 4597 */ |
| 4132 void set keyword(Token keyword2) { | 4598 void set keyword(Token keyword2) { |
| 4133 this._keyword = keyword2; | 4599 this._keyword = keyword2; |
| 4134 } | 4600 } |
| 4135 | 4601 |
| 4136 /** | 4602 /** |
| 4137 * Set the name of the declared type of the parameter to the given type name. | 4603 * Set the name of the declared type of the parameter to the given type name. |
| 4604 * |
| 4138 * @param typeName the name of the declared type of the parameter | 4605 * @param typeName the name of the declared type of the parameter |
| 4139 */ | 4606 */ |
| 4140 void set type(TypeName typeName) { | 4607 void set type(TypeName typeName) { |
| 4141 _type = becomeParentOf(typeName); | 4608 _type = becomeParentOf(typeName); |
| 4142 } | 4609 } |
| 4143 void visitChildren(ASTVisitor<Object> visitor) { | 4610 void visitChildren(ASTVisitor<Object> visitor) { |
| 4144 super.visitChildren(visitor); | 4611 super.visitChildren(visitor); |
| 4145 safelyVisitChild(_type, visitor); | 4612 safelyVisitChild(_type, visitor); |
| 4146 safelyVisitChild(_identifier, visitor); | 4613 safelyVisitChild(_identifier, visitor); |
| 4147 } | 4614 } |
| 4148 Token get firstTokenAfterCommentAndMetadata { | 4615 Token get firstTokenAfterCommentAndMetadata { |
| 4149 if (_keyword != null) { | 4616 if (_keyword != null) { |
| 4150 return _keyword; | 4617 return _keyword; |
| 4151 } else if (_type != null) { | 4618 } else if (_type != null) { |
| 4152 return _type.beginToken; | 4619 return _type.beginToken; |
| 4153 } | 4620 } |
| 4154 return _identifier.beginToken; | 4621 return _identifier.beginToken; |
| 4155 } | 4622 } |
| 4156 } | 4623 } |
| 4157 /** | 4624 /** |
| 4158 * Instances of the class `DefaultFormalParameter` represent a formal parameter
with a default | 4625 * Instances of the class `DefaultFormalParameter` represent a formal parameter
with a default |
| 4159 * value. There are two kinds of parameters that are both represented by this cl
ass: named formal | 4626 * value. There are two kinds of parameters that are both represented by this cl
ass: named formal |
| 4160 * parameters and positional formal parameters. | 4627 * parameters and positional formal parameters. |
| 4628 * |
| 4161 * <pre> | 4629 * <pre> |
| 4162 * defaultFormalParameter ::=[NormalFormalParameter normalFormalParameter] ('='
[Expression defaultValue])? | 4630 * defaultFormalParameter ::= |
| 4163 * defaultNamedParameter ::=[NormalFormalParameter normalFormalParameter] (':' [
Expression defaultValue])? | 4631 * [NormalFormalParameter] ('=' [Expression])? |
| 4632 * |
| 4633 * defaultNamedParameter ::= |
| 4634 * [NormalFormalParameter] (':' [Expression])? |
| 4164 * </pre> | 4635 * </pre> |
| 4636 * |
| 4165 * @coverage dart.engine.ast | 4637 * @coverage dart.engine.ast |
| 4166 */ | 4638 */ |
| 4167 class DefaultFormalParameter extends FormalParameter { | 4639 class DefaultFormalParameter extends FormalParameter { |
| 4168 | 4640 |
| 4169 /** | 4641 /** |
| 4170 * The formal parameter with which the default value is associated. | 4642 * The formal parameter with which the default value is associated. |
| 4171 */ | 4643 */ |
| 4172 NormalFormalParameter _parameter; | 4644 NormalFormalParameter _parameter; |
| 4173 | 4645 |
| 4174 /** | 4646 /** |
| 4175 * The kind of this parameter. | 4647 * The kind of this parameter. |
| 4176 */ | 4648 */ |
| 4177 ParameterKind _kind; | 4649 ParameterKind _kind; |
| 4178 | 4650 |
| 4179 /** | 4651 /** |
| 4180 * The token separating the parameter from the default value, or `null` if the
re is no | 4652 * The token separating the parameter from the default value, or `null` if the
re is no |
| 4181 * default value. | 4653 * default value. |
| 4182 */ | 4654 */ |
| 4183 Token _separator; | 4655 Token _separator; |
| 4184 | 4656 |
| 4185 /** | 4657 /** |
| 4186 * The expression computing the default value for the parameter, or `null` if
there is no | 4658 * The expression computing the default value for the parameter, or `null` if
there is no |
| 4187 * default value. | 4659 * default value. |
| 4188 */ | 4660 */ |
| 4189 Expression _defaultValue; | 4661 Expression _defaultValue; |
| 4190 | 4662 |
| 4191 /** | 4663 /** |
| 4192 * Initialize a newly created default formal parameter. | 4664 * Initialize a newly created default formal parameter. |
| 4665 * |
| 4193 * @param parameter the formal parameter with which the default value is assoc
iated | 4666 * @param parameter the formal parameter with which the default value is assoc
iated |
| 4194 * @param kind the kind of this parameter | 4667 * @param kind the kind of this parameter |
| 4195 * @param separator the token separating the parameter from the default value | 4668 * @param separator the token separating the parameter from the default value |
| 4196 * @param defaultValue the expression computing the default value for the para
meter | 4669 * @param defaultValue the expression computing the default value for the para
meter |
| 4197 */ | 4670 */ |
| 4198 DefaultFormalParameter.full(NormalFormalParameter parameter, ParameterKind kin
d, Token separator, Expression defaultValue) { | 4671 DefaultFormalParameter.full(NormalFormalParameter parameter, ParameterKind kin
d, Token separator, Expression defaultValue) { |
| 4199 this._parameter = becomeParentOf(parameter); | 4672 this._parameter = becomeParentOf(parameter); |
| 4200 this._kind = kind; | 4673 this._kind = kind; |
| 4201 this._separator = separator; | 4674 this._separator = separator; |
| 4202 this._defaultValue = becomeParentOf(defaultValue); | 4675 this._defaultValue = becomeParentOf(defaultValue); |
| 4203 } | 4676 } |
| 4204 | 4677 |
| 4205 /** | 4678 /** |
| 4206 * Initialize a newly created default formal parameter. | 4679 * Initialize a newly created default formal parameter. |
| 4680 * |
| 4207 * @param parameter the formal parameter with which the default value is assoc
iated | 4681 * @param parameter the formal parameter with which the default value is assoc
iated |
| 4208 * @param kind the kind of this parameter | 4682 * @param kind the kind of this parameter |
| 4209 * @param separator the token separating the parameter from the default value | 4683 * @param separator the token separating the parameter from the default value |
| 4210 * @param defaultValue the expression computing the default value for the para
meter | 4684 * @param defaultValue the expression computing the default value for the para
meter |
| 4211 */ | 4685 */ |
| 4212 DefaultFormalParameter({NormalFormalParameter parameter, ParameterKind kind, T
oken separator, Expression defaultValue}) : this.full(parameter, kind, separator
, defaultValue); | 4686 DefaultFormalParameter({NormalFormalParameter parameter, ParameterKind kind, T
oken separator, Expression defaultValue}) : this.full(parameter, kind, separator
, defaultValue); |
| 4213 accept(ASTVisitor visitor) => visitor.visitDefaultFormalParameter(this); | 4687 accept(ASTVisitor visitor) => visitor.visitDefaultFormalParameter(this); |
| 4214 Token get beginToken => _parameter.beginToken; | 4688 Token get beginToken => _parameter.beginToken; |
| 4215 | 4689 |
| 4216 /** | 4690 /** |
| 4217 * Return the expression computing the default value for the parameter, or `nu
ll` if there | 4691 * Return the expression computing the default value for the parameter, or `nu
ll` if there |
| 4218 * is no default value. | 4692 * is no default value. |
| 4693 * |
| 4219 * @return the expression computing the default value for the parameter | 4694 * @return the expression computing the default value for the parameter |
| 4220 */ | 4695 */ |
| 4221 Expression get defaultValue => _defaultValue; | 4696 Expression get defaultValue => _defaultValue; |
| 4222 Token get endToken { | 4697 Token get endToken { |
| 4223 if (_defaultValue != null) { | 4698 if (_defaultValue != null) { |
| 4224 return _defaultValue.endToken; | 4699 return _defaultValue.endToken; |
| 4225 } | 4700 } |
| 4226 return _parameter.endToken; | 4701 return _parameter.endToken; |
| 4227 } | 4702 } |
| 4228 SimpleIdentifier get identifier => _parameter.identifier; | 4703 SimpleIdentifier get identifier => _parameter.identifier; |
| 4229 ParameterKind get kind => _kind; | 4704 ParameterKind get kind => _kind; |
| 4230 | 4705 |
| 4231 /** | 4706 /** |
| 4232 * Return the formal parameter with which the default value is associated. | 4707 * Return the formal parameter with which the default value is associated. |
| 4708 * |
| 4233 * @return the formal parameter with which the default value is associated | 4709 * @return the formal parameter with which the default value is associated |
| 4234 */ | 4710 */ |
| 4235 NormalFormalParameter get parameter => _parameter; | 4711 NormalFormalParameter get parameter => _parameter; |
| 4236 | 4712 |
| 4237 /** | 4713 /** |
| 4238 * Return the token separating the parameter from the default value, or `null`
if there is | 4714 * Return the token separating the parameter from the default value, or `null`
if there is |
| 4239 * no default value. | 4715 * no default value. |
| 4716 * |
| 4240 * @return the token separating the parameter from the default value | 4717 * @return the token separating the parameter from the default value |
| 4241 */ | 4718 */ |
| 4242 Token get separator => _separator; | 4719 Token get separator => _separator; |
| 4243 | 4720 |
| 4244 /** | 4721 /** |
| 4245 * Return `true` if this parameter was declared with the 'const' modifier. | 4722 * Return `true` if this parameter was declared with the 'const' modifier. |
| 4723 * |
| 4246 * @return `true` if this parameter was declared with the 'const' modifier | 4724 * @return `true` if this parameter was declared with the 'const' modifier |
| 4247 */ | 4725 */ |
| 4248 bool get isConst => _parameter != null && _parameter.isConst; | 4726 bool get isConst => _parameter != null && _parameter.isConst; |
| 4249 | 4727 |
| 4250 /** | 4728 /** |
| 4251 * Return `true` if this parameter was declared with the 'final' modifier. Par
ameters that | 4729 * Return `true` if this parameter was declared with the 'final' modifier. Par
ameters that |
| 4252 * are declared with the 'const' modifier will return `false` even though they
are | 4730 * are declared with the 'const' modifier will return `false` even though they
are |
| 4253 * implicitly final. | 4731 * implicitly final. |
| 4732 * |
| 4254 * @return `true` if this parameter was declared with the 'final' modifier | 4733 * @return `true` if this parameter was declared with the 'final' modifier |
| 4255 */ | 4734 */ |
| 4256 bool get isFinal => _parameter != null && _parameter.isFinal; | 4735 bool get isFinal => _parameter != null && _parameter.isFinal; |
| 4257 | 4736 |
| 4258 /** | 4737 /** |
| 4259 * Set the expression computing the default value for the parameter to the giv
en expression. | 4738 * Set the expression computing the default value for the parameter to the giv
en expression. |
| 4739 * |
| 4260 * @param expression the expression computing the default value for the parame
ter | 4740 * @param expression the expression computing the default value for the parame
ter |
| 4261 */ | 4741 */ |
| 4262 void set defaultValue(Expression expression) { | 4742 void set defaultValue(Expression expression) { |
| 4263 _defaultValue = becomeParentOf(expression); | 4743 _defaultValue = becomeParentOf(expression); |
| 4264 } | 4744 } |
| 4265 | 4745 |
| 4266 /** | 4746 /** |
| 4267 * Set the kind of this parameter to the given kind. | 4747 * Set the kind of this parameter to the given kind. |
| 4748 * |
| 4268 * @param kind the kind of this parameter | 4749 * @param kind the kind of this parameter |
| 4269 */ | 4750 */ |
| 4270 void set kind(ParameterKind kind2) { | 4751 void set kind(ParameterKind kind2) { |
| 4271 this._kind = kind2; | 4752 this._kind = kind2; |
| 4272 } | 4753 } |
| 4273 | 4754 |
| 4274 /** | 4755 /** |
| 4275 * Set the formal parameter with which the default value is associated to the
given parameter. | 4756 * Set the formal parameter with which the default value is associated to the
given parameter. |
| 4757 * |
| 4276 * @param formalParameter the formal parameter with which the default value is
associated | 4758 * @param formalParameter the formal parameter with which the default value is
associated |
| 4277 */ | 4759 */ |
| 4278 void set parameter(NormalFormalParameter formalParameter) { | 4760 void set parameter(NormalFormalParameter formalParameter) { |
| 4279 _parameter = becomeParentOf(formalParameter); | 4761 _parameter = becomeParentOf(formalParameter); |
| 4280 } | 4762 } |
| 4281 | 4763 |
| 4282 /** | 4764 /** |
| 4283 * Set the token separating the parameter from the default value to the given
token. | 4765 * Set the token separating the parameter from the default value to the given
token. |
| 4766 * |
| 4284 * @param separator the token separating the parameter from the default value | 4767 * @param separator the token separating the parameter from the default value |
| 4285 */ | 4768 */ |
| 4286 void set separator(Token separator2) { | 4769 void set separator(Token separator2) { |
| 4287 this._separator = separator2; | 4770 this._separator = separator2; |
| 4288 } | 4771 } |
| 4289 void visitChildren(ASTVisitor<Object> visitor) { | 4772 void visitChildren(ASTVisitor<Object> visitor) { |
| 4290 safelyVisitChild(_parameter, visitor); | 4773 safelyVisitChild(_parameter, visitor); |
| 4291 safelyVisitChild(_defaultValue, visitor); | 4774 safelyVisitChild(_defaultValue, visitor); |
| 4292 } | 4775 } |
| 4293 } | 4776 } |
| 4294 /** | 4777 /** |
| 4295 * The abstract class `Directive` defines the behavior common to nodes that repr
esent a | 4778 * The abstract class `Directive` defines the behavior common to nodes that repr
esent a |
| 4296 * directive. | 4779 * directive. |
| 4780 * |
| 4297 * <pre> | 4781 * <pre> |
| 4298 * directive ::=[ExportDirective exportDirective]| [ImportDirective importDirect
ive]| [LibraryDirective libraryDirective]| [PartDirective partDirective]| [PartO
fDirective partOfDirective]</pre> | 4782 * directive ::= |
| 4783 * [ExportDirective] |
| 4784 * | [ImportDirective] |
| 4785 * | [LibraryDirective] |
| 4786 * | [PartDirective] |
| 4787 * | [PartOfDirective] |
| 4788 * </pre> |
| 4789 * |
| 4299 * @coverage dart.engine.ast | 4790 * @coverage dart.engine.ast |
| 4300 */ | 4791 */ |
| 4301 abstract class Directive extends AnnotatedNode { | 4792 abstract class Directive extends AnnotatedNode { |
| 4302 | 4793 |
| 4303 /** | 4794 /** |
| 4304 * The element associated with this directive, or `null` if the AST structure
has not been | 4795 * The element associated with this directive, or `null` if the AST structure
has not been |
| 4305 * resolved or if this directive could not be resolved. | 4796 * resolved or if this directive could not be resolved. |
| 4306 */ | 4797 */ |
| 4307 Element _element; | 4798 Element _element; |
| 4308 | 4799 |
| 4309 /** | 4800 /** |
| 4310 * Initialize a newly create directive. | 4801 * Initialize a newly create directive. |
| 4802 * |
| 4311 * @param comment the documentation comment associated with this directive | 4803 * @param comment the documentation comment associated with this directive |
| 4312 * @param metadata the annotations associated with the directive | 4804 * @param metadata the annotations associated with the directive |
| 4313 */ | 4805 */ |
| 4314 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen
t, metadata) { | 4806 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen
t, metadata) { |
| 4315 } | 4807 } |
| 4316 | 4808 |
| 4317 /** | 4809 /** |
| 4318 * Initialize a newly create directive. | 4810 * Initialize a newly create directive. |
| 4811 * |
| 4319 * @param comment the documentation comment associated with this directive | 4812 * @param comment the documentation comment associated with this directive |
| 4320 * @param metadata the annotations associated with the directive | 4813 * @param metadata the annotations associated with the directive |
| 4321 */ | 4814 */ |
| 4322 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m
etadata); | 4815 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m
etadata); |
| 4323 | 4816 |
| 4324 /** | 4817 /** |
| 4325 * Return the element associated with this directive, or `null` if the AST str
ucture has not | 4818 * Return the element associated with this directive, or `null` if the AST str
ucture has not |
| 4326 * been resolved or if this directive could not be resolved. Examples of the l
atter case include a | 4819 * been resolved or if this directive could not be resolved. Examples of the l
atter case include a |
| 4327 * directive that contains an invalid URL or a URL that does not exist. | 4820 * directive that contains an invalid URL or a URL that does not exist. |
| 4821 * |
| 4328 * @return the element associated with this directive | 4822 * @return the element associated with this directive |
| 4329 */ | 4823 */ |
| 4330 Element get element => _element; | 4824 Element get element => _element; |
| 4331 | 4825 |
| 4332 /** | 4826 /** |
| 4333 * Return the token representing the keyword that introduces this directive ('
import', 'export', | 4827 * Return the token representing the keyword that introduces this directive ('
import', 'export', |
| 4334 * 'library' or 'part'). | 4828 * 'library' or 'part'). |
| 4829 * |
| 4335 * @return the token representing the keyword that introduces this directive | 4830 * @return the token representing the keyword that introduces this directive |
| 4336 */ | 4831 */ |
| 4337 Token get keyword; | 4832 Token get keyword; |
| 4338 | 4833 |
| 4339 /** | 4834 /** |
| 4340 * Set the element associated with this directive to the given element. | 4835 * Set the element associated with this directive to the given element. |
| 4836 * |
| 4341 * @param element the element associated with this directive | 4837 * @param element the element associated with this directive |
| 4342 */ | 4838 */ |
| 4343 void set element(Element element2) { | 4839 void set element(Element element2) { |
| 4344 this._element = element2; | 4840 this._element = element2; |
| 4345 } | 4841 } |
| 4346 } | 4842 } |
| 4347 /** | 4843 /** |
| 4348 * Instances of the class `DoStatement` represent a do statement. | 4844 * Instances of the class `DoStatement` represent a do statement. |
| 4845 * |
| 4349 * <pre> | 4846 * <pre> |
| 4350 * doStatement ::= | 4847 * doStatement ::= |
| 4351 * 'do' [Statement body] 'while' '(' [Expression condition] ')' ';' | 4848 * 'do' [Statement] 'while' '(' [Expression] ')' ';' |
| 4352 * </pre> | 4849 * </pre> |
| 4850 * |
| 4353 * @coverage dart.engine.ast | 4851 * @coverage dart.engine.ast |
| 4354 */ | 4852 */ |
| 4355 class DoStatement extends Statement { | 4853 class DoStatement extends Statement { |
| 4356 | 4854 |
| 4357 /** | 4855 /** |
| 4358 * The token representing the 'do' keyword. | 4856 * The token representing the 'do' keyword. |
| 4359 */ | 4857 */ |
| 4360 Token _doKeyword; | 4858 Token _doKeyword; |
| 4361 | 4859 |
| 4362 /** | 4860 /** |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4384 */ | 4882 */ |
| 4385 Token _rightParenthesis; | 4883 Token _rightParenthesis; |
| 4386 | 4884 |
| 4387 /** | 4885 /** |
| 4388 * The semicolon terminating the statement. | 4886 * The semicolon terminating the statement. |
| 4389 */ | 4887 */ |
| 4390 Token _semicolon; | 4888 Token _semicolon; |
| 4391 | 4889 |
| 4392 /** | 4890 /** |
| 4393 * Initialize a newly created do loop. | 4891 * Initialize a newly created do loop. |
| 4892 * |
| 4394 * @param doKeyword the token representing the 'do' keyword | 4893 * @param doKeyword the token representing the 'do' keyword |
| 4395 * @param body the body of the loop | 4894 * @param body the body of the loop |
| 4396 * @param whileKeyword the token representing the 'while' keyword | 4895 * @param whileKeyword the token representing the 'while' keyword |
| 4397 * @param leftParenthesis the left parenthesis | 4896 * @param leftParenthesis the left parenthesis |
| 4398 * @param condition the condition that determines when the loop will terminate | 4897 * @param condition the condition that determines when the loop will terminate |
| 4399 * @param rightParenthesis the right parenthesis | 4898 * @param rightParenthesis the right parenthesis |
| 4400 * @param semicolon the semicolon terminating the statement | 4899 * @param semicolon the semicolon terminating the statement |
| 4401 */ | 4900 */ |
| 4402 DoStatement.full(Token doKeyword, Statement body, Token whileKeyword, Token le
ftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) { | 4901 DoStatement.full(Token doKeyword, Statement body, Token whileKeyword, Token le
ftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) { |
| 4403 this._doKeyword = doKeyword; | 4902 this._doKeyword = doKeyword; |
| 4404 this._body = becomeParentOf(body); | 4903 this._body = becomeParentOf(body); |
| 4405 this._whileKeyword = whileKeyword; | 4904 this._whileKeyword = whileKeyword; |
| 4406 this._leftParenthesis = leftParenthesis; | 4905 this._leftParenthesis = leftParenthesis; |
| 4407 this._condition = becomeParentOf(condition); | 4906 this._condition = becomeParentOf(condition); |
| 4408 this._rightParenthesis = rightParenthesis; | 4907 this._rightParenthesis = rightParenthesis; |
| 4409 this._semicolon = semicolon; | 4908 this._semicolon = semicolon; |
| 4410 } | 4909 } |
| 4411 | 4910 |
| 4412 /** | 4911 /** |
| 4413 * Initialize a newly created do loop. | 4912 * Initialize a newly created do loop. |
| 4913 * |
| 4414 * @param doKeyword the token representing the 'do' keyword | 4914 * @param doKeyword the token representing the 'do' keyword |
| 4415 * @param body the body of the loop | 4915 * @param body the body of the loop |
| 4416 * @param whileKeyword the token representing the 'while' keyword | 4916 * @param whileKeyword the token representing the 'while' keyword |
| 4417 * @param leftParenthesis the left parenthesis | 4917 * @param leftParenthesis the left parenthesis |
| 4418 * @param condition the condition that determines when the loop will terminate | 4918 * @param condition the condition that determines when the loop will terminate |
| 4419 * @param rightParenthesis the right parenthesis | 4919 * @param rightParenthesis the right parenthesis |
| 4420 * @param semicolon the semicolon terminating the statement | 4920 * @param semicolon the semicolon terminating the statement |
| 4421 */ | 4921 */ |
| 4422 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); | 4922 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); |
| 4423 accept(ASTVisitor visitor) => visitor.visitDoStatement(this); | 4923 accept(ASTVisitor visitor) => visitor.visitDoStatement(this); |
| 4424 Token get beginToken => _doKeyword; | 4924 Token get beginToken => _doKeyword; |
| 4425 | 4925 |
| 4426 /** | 4926 /** |
| 4427 * Return the body of the loop. | 4927 * Return the body of the loop. |
| 4928 * |
| 4428 * @return the body of the loop | 4929 * @return the body of the loop |
| 4429 */ | 4930 */ |
| 4430 Statement get body => _body; | 4931 Statement get body => _body; |
| 4431 | 4932 |
| 4432 /** | 4933 /** |
| 4433 * Return the condition that determines when the loop will terminate. | 4934 * Return the condition that determines when the loop will terminate. |
| 4935 * |
| 4434 * @return the condition that determines when the loop will terminate | 4936 * @return the condition that determines when the loop will terminate |
| 4435 */ | 4937 */ |
| 4436 Expression get condition => _condition; | 4938 Expression get condition => _condition; |
| 4437 | 4939 |
| 4438 /** | 4940 /** |
| 4439 * Return the token representing the 'do' keyword. | 4941 * Return the token representing the 'do' keyword. |
| 4942 * |
| 4440 * @return the token representing the 'do' keyword | 4943 * @return the token representing the 'do' keyword |
| 4441 */ | 4944 */ |
| 4442 Token get doKeyword => _doKeyword; | 4945 Token get doKeyword => _doKeyword; |
| 4443 Token get endToken => _semicolon; | 4946 Token get endToken => _semicolon; |
| 4444 | 4947 |
| 4445 /** | 4948 /** |
| 4446 * Return the left parenthesis. | 4949 * Return the left parenthesis. |
| 4950 * |
| 4447 * @return the left parenthesis | 4951 * @return the left parenthesis |
| 4448 */ | 4952 */ |
| 4449 Token get leftParenthesis => _leftParenthesis; | 4953 Token get leftParenthesis => _leftParenthesis; |
| 4450 | 4954 |
| 4451 /** | 4955 /** |
| 4452 * Return the right parenthesis. | 4956 * Return the right parenthesis. |
| 4957 * |
| 4453 * @return the right parenthesis | 4958 * @return the right parenthesis |
| 4454 */ | 4959 */ |
| 4455 Token get rightParenthesis => _rightParenthesis; | 4960 Token get rightParenthesis => _rightParenthesis; |
| 4456 | 4961 |
| 4457 /** | 4962 /** |
| 4458 * Return the semicolon terminating the statement. | 4963 * Return the semicolon terminating the statement. |
| 4964 * |
| 4459 * @return the semicolon terminating the statement | 4965 * @return the semicolon terminating the statement |
| 4460 */ | 4966 */ |
| 4461 Token get semicolon => _semicolon; | 4967 Token get semicolon => _semicolon; |
| 4462 | 4968 |
| 4463 /** | 4969 /** |
| 4464 * Return the token representing the 'while' keyword. | 4970 * Return the token representing the 'while' keyword. |
| 4971 * |
| 4465 * @return the token representing the 'while' keyword | 4972 * @return the token representing the 'while' keyword |
| 4466 */ | 4973 */ |
| 4467 Token get whileKeyword => _whileKeyword; | 4974 Token get whileKeyword => _whileKeyword; |
| 4468 | 4975 |
| 4469 /** | 4976 /** |
| 4470 * Set the body of the loop to the given statement. | 4977 * Set the body of the loop to the given statement. |
| 4978 * |
| 4471 * @param statement the body of the loop | 4979 * @param statement the body of the loop |
| 4472 */ | 4980 */ |
| 4473 void set body(Statement statement) { | 4981 void set body(Statement statement) { |
| 4474 _body = becomeParentOf(statement); | 4982 _body = becomeParentOf(statement); |
| 4475 } | 4983 } |
| 4476 | 4984 |
| 4477 /** | 4985 /** |
| 4478 * Set the condition that determines when the loop will terminate to the given
expression. | 4986 * Set the condition that determines when the loop will terminate to the given
expression. |
| 4987 * |
| 4479 * @param expression the condition that determines when the loop will terminat
e | 4988 * @param expression the condition that determines when the loop will terminat
e |
| 4480 */ | 4989 */ |
| 4481 void set condition(Expression expression) { | 4990 void set condition(Expression expression) { |
| 4482 _condition = becomeParentOf(expression); | 4991 _condition = becomeParentOf(expression); |
| 4483 } | 4992 } |
| 4484 | 4993 |
| 4485 /** | 4994 /** |
| 4486 * Set the token representing the 'do' keyword to the given token. | 4995 * Set the token representing the 'do' keyword to the given token. |
| 4996 * |
| 4487 * @param doKeyword the token representing the 'do' keyword | 4997 * @param doKeyword the token representing the 'do' keyword |
| 4488 */ | 4998 */ |
| 4489 void set doKeyword(Token doKeyword2) { | 4999 void set doKeyword(Token doKeyword2) { |
| 4490 this._doKeyword = doKeyword2; | 5000 this._doKeyword = doKeyword2; |
| 4491 } | 5001 } |
| 4492 | 5002 |
| 4493 /** | 5003 /** |
| 4494 * Set the left parenthesis to the given token. | 5004 * Set the left parenthesis to the given token. |
| 5005 * |
| 4495 * @param parenthesis the left parenthesis | 5006 * @param parenthesis the left parenthesis |
| 4496 */ | 5007 */ |
| 4497 void set leftParenthesis(Token parenthesis) { | 5008 void set leftParenthesis(Token parenthesis) { |
| 4498 _leftParenthesis = parenthesis; | 5009 _leftParenthesis = parenthesis; |
| 4499 } | 5010 } |
| 4500 | 5011 |
| 4501 /** | 5012 /** |
| 4502 * Set the right parenthesis to the given token. | 5013 * Set the right parenthesis to the given token. |
| 5014 * |
| 4503 * @param parenthesis the right parenthesis | 5015 * @param parenthesis the right parenthesis |
| 4504 */ | 5016 */ |
| 4505 void set rightParenthesis(Token parenthesis) { | 5017 void set rightParenthesis(Token parenthesis) { |
| 4506 _rightParenthesis = parenthesis; | 5018 _rightParenthesis = parenthesis; |
| 4507 } | 5019 } |
| 4508 | 5020 |
| 4509 /** | 5021 /** |
| 4510 * Set the semicolon terminating the statement to the given token. | 5022 * Set the semicolon terminating the statement to the given token. |
| 5023 * |
| 4511 * @param semicolon the semicolon terminating the statement | 5024 * @param semicolon the semicolon terminating the statement |
| 4512 */ | 5025 */ |
| 4513 void set semicolon(Token semicolon2) { | 5026 void set semicolon(Token semicolon2) { |
| 4514 this._semicolon = semicolon2; | 5027 this._semicolon = semicolon2; |
| 4515 } | 5028 } |
| 4516 | 5029 |
| 4517 /** | 5030 /** |
| 4518 * Set the token representing the 'while' keyword to the given token. | 5031 * Set the token representing the 'while' keyword to the given token. |
| 5032 * |
| 4519 * @param whileKeyword the token representing the 'while' keyword | 5033 * @param whileKeyword the token representing the 'while' keyword |
| 4520 */ | 5034 */ |
| 4521 void set whileKeyword(Token whileKeyword2) { | 5035 void set whileKeyword(Token whileKeyword2) { |
| 4522 this._whileKeyword = whileKeyword2; | 5036 this._whileKeyword = whileKeyword2; |
| 4523 } | 5037 } |
| 4524 void visitChildren(ASTVisitor<Object> visitor) { | 5038 void visitChildren(ASTVisitor<Object> visitor) { |
| 4525 safelyVisitChild(_body, visitor); | 5039 safelyVisitChild(_body, visitor); |
| 4526 safelyVisitChild(_condition, visitor); | 5040 safelyVisitChild(_condition, visitor); |
| 4527 } | 5041 } |
| 4528 } | 5042 } |
| 4529 /** | 5043 /** |
| 4530 * Instances of the class `DoubleLiteral` represent a floating point literal exp
ression. | 5044 * Instances of the class `DoubleLiteral` represent a floating point literal exp
ression. |
| 5045 * |
| 4531 * <pre> | 5046 * <pre> |
| 4532 * doubleLiteral ::= | 5047 * doubleLiteral ::= |
| 4533 * decimalDigit+ ('.' decimalDigit*)? exponent? | 5048 * decimalDigit+ ('.' decimalDigit*)? exponent? |
| 4534 * | '.' decimalDigit+ exponent? | 5049 * | '.' decimalDigit+ exponent? |
| 5050 * |
| 4535 * exponent ::= | 5051 * exponent ::= |
| 4536 * ('e' | 'E') ('+' | '-')? decimalDigit+ | 5052 * ('e' | 'E') ('+' | '-')? decimalDigit+ |
| 4537 * </pre> | 5053 * </pre> |
| 5054 * |
| 4538 * @coverage dart.engine.ast | 5055 * @coverage dart.engine.ast |
| 4539 */ | 5056 */ |
| 4540 class DoubleLiteral extends Literal { | 5057 class DoubleLiteral extends Literal { |
| 4541 | 5058 |
| 4542 /** | 5059 /** |
| 4543 * The token representing the literal. | 5060 * The token representing the literal. |
| 4544 */ | 5061 */ |
| 4545 Token _literal; | 5062 Token _literal; |
| 4546 | 5063 |
| 4547 /** | 5064 /** |
| 4548 * The value of the literal. | 5065 * The value of the literal. |
| 4549 */ | 5066 */ |
| 4550 double _value = 0.0; | 5067 double _value = 0.0; |
| 4551 | 5068 |
| 4552 /** | 5069 /** |
| 4553 * Initialize a newly created floating point literal. | 5070 * Initialize a newly created floating point literal. |
| 5071 * |
| 4554 * @param literal the token representing the literal | 5072 * @param literal the token representing the literal |
| 4555 * @param value the value of the literal | 5073 * @param value the value of the literal |
| 4556 */ | 5074 */ |
| 4557 DoubleLiteral.full(Token literal, double value) { | 5075 DoubleLiteral.full(Token literal, double value) { |
| 4558 this._literal = literal; | 5076 this._literal = literal; |
| 4559 this._value = value; | 5077 this._value = value; |
| 4560 } | 5078 } |
| 4561 | 5079 |
| 4562 /** | 5080 /** |
| 4563 * Initialize a newly created floating point literal. | 5081 * Initialize a newly created floating point literal. |
| 5082 * |
| 4564 * @param literal the token representing the literal | 5083 * @param literal the token representing the literal |
| 4565 * @param value the value of the literal | 5084 * @param value the value of the literal |
| 4566 */ | 5085 */ |
| 4567 DoubleLiteral({Token literal, double value}) : this.full(literal, value); | 5086 DoubleLiteral({Token literal, double value}) : this.full(literal, value); |
| 4568 accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this); | 5087 accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this); |
| 4569 Token get beginToken => _literal; | 5088 Token get beginToken => _literal; |
| 4570 Token get endToken => _literal; | 5089 Token get endToken => _literal; |
| 4571 | 5090 |
| 4572 /** | 5091 /** |
| 4573 * Return the token representing the literal. | 5092 * Return the token representing the literal. |
| 5093 * |
| 4574 * @return the token representing the literal | 5094 * @return the token representing the literal |
| 4575 */ | 5095 */ |
| 4576 Token get literal => _literal; | 5096 Token get literal => _literal; |
| 4577 | 5097 |
| 4578 /** | 5098 /** |
| 4579 * Return the value of the literal. | 5099 * Return the value of the literal. |
| 5100 * |
| 4580 * @return the value of the literal | 5101 * @return the value of the literal |
| 4581 */ | 5102 */ |
| 4582 double get value => _value; | 5103 double get value => _value; |
| 4583 | 5104 |
| 4584 /** | 5105 /** |
| 4585 * Set the token representing the literal to the given token. | 5106 * Set the token representing the literal to the given token. |
| 5107 * |
| 4586 * @param literal the token representing the literal | 5108 * @param literal the token representing the literal |
| 4587 */ | 5109 */ |
| 4588 void set literal(Token literal2) { | 5110 void set literal(Token literal2) { |
| 4589 this._literal = literal2; | 5111 this._literal = literal2; |
| 4590 } | 5112 } |
| 4591 | 5113 |
| 4592 /** | 5114 /** |
| 4593 * Set the value of the literal to the given value. | 5115 * Set the value of the literal to the given value. |
| 5116 * |
| 4594 * @param value the value of the literal | 5117 * @param value the value of the literal |
| 4595 */ | 5118 */ |
| 4596 void set value(double value2) { | 5119 void set value(double value2) { |
| 4597 this._value = value2; | 5120 this._value = value2; |
| 4598 } | 5121 } |
| 4599 void visitChildren(ASTVisitor<Object> visitor) { | 5122 void visitChildren(ASTVisitor<Object> visitor) { |
| 4600 } | 5123 } |
| 4601 } | 5124 } |
| 4602 /** | 5125 /** |
| 4603 * Instances of the class `EmptyFunctionBody` represent an empty function body,
which can only | 5126 * Instances of the class `EmptyFunctionBody` represent an empty function body,
which can only |
| 4604 * appear in constructors or abstract methods. | 5127 * appear in constructors or abstract methods. |
| 5128 * |
| 4605 * <pre> | 5129 * <pre> |
| 4606 * emptyFunctionBody ::= | 5130 * emptyFunctionBody ::= |
| 4607 * ';' | 5131 * ';' |
| 4608 * </pre> | 5132 * </pre> |
| 5133 * |
| 4609 * @coverage dart.engine.ast | 5134 * @coverage dart.engine.ast |
| 4610 */ | 5135 */ |
| 4611 class EmptyFunctionBody extends FunctionBody { | 5136 class EmptyFunctionBody extends FunctionBody { |
| 4612 | 5137 |
| 4613 /** | 5138 /** |
| 4614 * The token representing the semicolon that marks the end of the function bod
y. | 5139 * The token representing the semicolon that marks the end of the function bod
y. |
| 4615 */ | 5140 */ |
| 4616 Token _semicolon; | 5141 Token _semicolon; |
| 4617 | 5142 |
| 4618 /** | 5143 /** |
| 4619 * Initialize a newly created function body. | 5144 * Initialize a newly created function body. |
| 5145 * |
| 4620 * @param semicolon the token representing the semicolon that marks the end of
the function body | 5146 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 4621 */ | 5147 */ |
| 4622 EmptyFunctionBody.full(Token semicolon) { | 5148 EmptyFunctionBody.full(Token semicolon) { |
| 4623 this._semicolon = semicolon; | 5149 this._semicolon = semicolon; |
| 4624 } | 5150 } |
| 4625 | 5151 |
| 4626 /** | 5152 /** |
| 4627 * Initialize a newly created function body. | 5153 * Initialize a newly created function body. |
| 5154 * |
| 4628 * @param semicolon the token representing the semicolon that marks the end of
the function body | 5155 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 4629 */ | 5156 */ |
| 4630 EmptyFunctionBody({Token semicolon}) : this.full(semicolon); | 5157 EmptyFunctionBody({Token semicolon}) : this.full(semicolon); |
| 4631 accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this); | 5158 accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this); |
| 4632 Token get beginToken => _semicolon; | 5159 Token get beginToken => _semicolon; |
| 4633 Token get endToken => _semicolon; | 5160 Token get endToken => _semicolon; |
| 4634 | 5161 |
| 4635 /** | 5162 /** |
| 4636 * Return the token representing the semicolon that marks the end of the funct
ion body. | 5163 * Return the token representing the semicolon that marks the end of the funct
ion body. |
| 5164 * |
| 4637 * @return the token representing the semicolon that marks the end of the func
tion body | 5165 * @return the token representing the semicolon that marks the end of the func
tion body |
| 4638 */ | 5166 */ |
| 4639 Token get semicolon => _semicolon; | 5167 Token get semicolon => _semicolon; |
| 4640 | 5168 |
| 4641 /** | 5169 /** |
| 4642 * Set the token representing the semicolon that marks the end of the function
body to the given | 5170 * Set the token representing the semicolon that marks the end of the function
body to the given |
| 4643 * token. | 5171 * token. |
| 5172 * |
| 4644 * @param semicolon the token representing the semicolon that marks the end of
the function body | 5173 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 4645 */ | 5174 */ |
| 4646 void set semicolon(Token semicolon2) { | 5175 void set semicolon(Token semicolon2) { |
| 4647 this._semicolon = semicolon2; | 5176 this._semicolon = semicolon2; |
| 4648 } | 5177 } |
| 4649 void visitChildren(ASTVisitor<Object> visitor) { | 5178 void visitChildren(ASTVisitor<Object> visitor) { |
| 4650 } | 5179 } |
| 4651 } | 5180 } |
| 4652 /** | 5181 /** |
| 4653 * Instances of the class `EmptyStatement` represent an empty statement. | 5182 * Instances of the class `EmptyStatement` represent an empty statement. |
| 5183 * |
| 4654 * <pre> | 5184 * <pre> |
| 4655 * emptyStatement ::= | 5185 * emptyStatement ::= |
| 4656 * ';' | 5186 * ';' |
| 4657 * </pre> | 5187 * </pre> |
| 5188 * |
| 4658 * @coverage dart.engine.ast | 5189 * @coverage dart.engine.ast |
| 4659 */ | 5190 */ |
| 4660 class EmptyStatement extends Statement { | 5191 class EmptyStatement extends Statement { |
| 4661 | 5192 |
| 4662 /** | 5193 /** |
| 4663 * The semicolon terminating the statement. | 5194 * The semicolon terminating the statement. |
| 4664 */ | 5195 */ |
| 4665 Token _semicolon; | 5196 Token _semicolon; |
| 4666 | 5197 |
| 4667 /** | 5198 /** |
| 4668 * Initialize a newly created empty statement. | 5199 * Initialize a newly created empty statement. |
| 5200 * |
| 4669 * @param semicolon the semicolon terminating the statement | 5201 * @param semicolon the semicolon terminating the statement |
| 4670 */ | 5202 */ |
| 4671 EmptyStatement.full(Token semicolon) { | 5203 EmptyStatement.full(Token semicolon) { |
| 4672 this._semicolon = semicolon; | 5204 this._semicolon = semicolon; |
| 4673 } | 5205 } |
| 4674 | 5206 |
| 4675 /** | 5207 /** |
| 4676 * Initialize a newly created empty statement. | 5208 * Initialize a newly created empty statement. |
| 5209 * |
| 4677 * @param semicolon the semicolon terminating the statement | 5210 * @param semicolon the semicolon terminating the statement |
| 4678 */ | 5211 */ |
| 4679 EmptyStatement({Token semicolon}) : this.full(semicolon); | 5212 EmptyStatement({Token semicolon}) : this.full(semicolon); |
| 4680 accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this); | 5213 accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this); |
| 4681 Token get beginToken => _semicolon; | 5214 Token get beginToken => _semicolon; |
| 4682 Token get endToken => _semicolon; | 5215 Token get endToken => _semicolon; |
| 4683 | 5216 |
| 4684 /** | 5217 /** |
| 4685 * Return the semicolon terminating the statement. | 5218 * Return the semicolon terminating the statement. |
| 5219 * |
| 4686 * @return the semicolon terminating the statement | 5220 * @return the semicolon terminating the statement |
| 4687 */ | 5221 */ |
| 4688 Token get semicolon => _semicolon; | 5222 Token get semicolon => _semicolon; |
| 4689 | 5223 |
| 4690 /** | 5224 /** |
| 4691 * Set the semicolon terminating the statement to the given token. | 5225 * Set the semicolon terminating the statement to the given token. |
| 5226 * |
| 4692 * @param semicolon the semicolon terminating the statement | 5227 * @param semicolon the semicolon terminating the statement |
| 4693 */ | 5228 */ |
| 4694 void set semicolon(Token semicolon2) { | 5229 void set semicolon(Token semicolon2) { |
| 4695 this._semicolon = semicolon2; | 5230 this._semicolon = semicolon2; |
| 4696 } | 5231 } |
| 4697 void visitChildren(ASTVisitor<Object> visitor) { | 5232 void visitChildren(ASTVisitor<Object> visitor) { |
| 4698 } | 5233 } |
| 4699 } | 5234 } |
| 4700 /** | 5235 /** |
| 4701 * Ephemeral identifiers are created as needed to mimic the presence of an empty
identifier. | 5236 * Ephemeral identifiers are created as needed to mimic the presence of an empty
identifier. |
| 5237 * |
| 4702 * @coverage dart.engine.ast | 5238 * @coverage dart.engine.ast |
| 4703 */ | 5239 */ |
| 4704 class EphemeralIdentifier extends SimpleIdentifier { | 5240 class EphemeralIdentifier extends SimpleIdentifier { |
| 4705 EphemeralIdentifier.full(ASTNode parent, int location) : super.full(new Token(
TokenType.IDENTIFIER, location)) { | 5241 EphemeralIdentifier.full(ASTNode parent, int location) : super.full(new Token(
TokenType.IDENTIFIER, location)) { |
| 4706 parent.becomeParentOf(this); | 5242 parent.becomeParentOf(this); |
| 4707 } | 5243 } |
| 4708 EphemeralIdentifier({ASTNode parent, int location}) : this.full(parent, locati
on); | 5244 EphemeralIdentifier({ASTNode parent, int location}) : this.full(parent, locati
on); |
| 4709 } | 5245 } |
| 4710 /** | 5246 /** |
| 4711 * Instances of the class `ExportDirective` represent an export directive. | 5247 * Instances of the class `ExportDirective` represent an export directive. |
| 5248 * |
| 4712 * <pre> | 5249 * <pre> |
| 4713 * exportDirective ::=[Annotation metadata] 'export' [StringLiteral libraryUri]
[Combinator combinator]* ';' | 5250 * exportDirective ::= |
| 5251 * [Annotation] 'export' [StringLiteral] [Combinator]* ';' |
| 4714 * </pre> | 5252 * </pre> |
| 5253 * |
| 4715 * @coverage dart.engine.ast | 5254 * @coverage dart.engine.ast |
| 4716 */ | 5255 */ |
| 4717 class ExportDirective extends NamespaceDirective { | 5256 class ExportDirective extends NamespaceDirective { |
| 4718 | 5257 |
| 4719 /** | 5258 /** |
| 4720 * Initialize a newly created export directive. | 5259 * Initialize a newly created export directive. |
| 5260 * |
| 4721 * @param comment the documentation comment associated with this directive | 5261 * @param comment the documentation comment associated with this directive |
| 4722 * @param metadata the annotations associated with the directive | 5262 * @param metadata the annotations associated with the directive |
| 4723 * @param keyword the token representing the 'export' keyword | 5263 * @param keyword the token representing the 'export' keyword |
| 4724 * @param libraryUri the URI of the library being exported | 5264 * @param libraryUri the URI of the library being exported |
| 4725 * @param combinators the combinators used to control which names are exported | 5265 * @param combinators the combinators used to control which names are exported |
| 4726 * @param semicolon the semicolon terminating the directive | 5266 * @param semicolon the semicolon terminating the directive |
| 4727 */ | 5267 */ |
| 4728 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) { | 5268 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) { |
| 4729 } | 5269 } |
| 4730 | 5270 |
| 4731 /** | 5271 /** |
| 4732 * Initialize a newly created export directive. | 5272 * Initialize a newly created export directive. |
| 5273 * |
| 4733 * @param comment the documentation comment associated with this directive | 5274 * @param comment the documentation comment associated with this directive |
| 4734 * @param metadata the annotations associated with the directive | 5275 * @param metadata the annotations associated with the directive |
| 4735 * @param keyword the token representing the 'export' keyword | 5276 * @param keyword the token representing the 'export' keyword |
| 4736 * @param libraryUri the URI of the library being exported | 5277 * @param libraryUri the URI of the library being exported |
| 4737 * @param combinators the combinators used to control which names are exported | 5278 * @param combinators the combinators used to control which names are exported |
| 4738 * @param semicolon the semicolon terminating the directive | 5279 * @param semicolon the semicolon terminating the directive |
| 4739 */ | 5280 */ |
| 4740 ExportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : this.f
ull(comment, metadata, keyword, libraryUri, combinators, semicolon); | 5281 ExportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : this.f
ull(comment, metadata, keyword, libraryUri, combinators, semicolon); |
| 4741 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); | 5282 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); |
| 4742 LibraryElement get uriElement { | 5283 LibraryElement get uriElement { |
| 4743 Element element = this.element; | 5284 Element element = this.element; |
| 4744 if (element is ExportElement) { | 5285 if (element is ExportElement) { |
| 4745 return ((element as ExportElement)).exportedLibrary; | 5286 return ((element as ExportElement)).exportedLibrary; |
| 4746 } | 5287 } |
| 4747 return null; | 5288 return null; |
| 4748 } | 5289 } |
| 4749 void visitChildren(ASTVisitor<Object> visitor) { | 5290 void visitChildren(ASTVisitor<Object> visitor) { |
| 4750 super.visitChildren(visitor); | 5291 super.visitChildren(visitor); |
| 4751 combinators.accept(visitor); | 5292 combinators.accept(visitor); |
| 4752 } | 5293 } |
| 4753 } | 5294 } |
| 4754 /** | 5295 /** |
| 4755 * Instances of the class `Expression` defines the behavior common to nodes that
represent an | 5296 * Instances of the class `Expression` defines the behavior common to nodes that
represent an |
| 4756 * expression. | 5297 * expression. |
| 5298 * |
| 4757 * <pre> | 5299 * <pre> |
| 4758 * expression ::=[AssignmentExpression assignmentExpression]| [ConditionalExpres
sion conditionalExpression] cascadeSection | 5300 * expression ::= |
| 4759 * | [ThrowExpression throwExpression]</pre> | 5301 * [AssignmentExpression] |
| 5302 * | [ConditionalExpression] cascadeSection* |
| 5303 * | [ThrowExpression] |
| 5304 * </pre> |
| 5305 * |
| 4760 * @coverage dart.engine.ast | 5306 * @coverage dart.engine.ast |
| 4761 */ | 5307 */ |
| 4762 abstract class Expression extends ASTNode { | 5308 abstract class Expression extends ASTNode { |
| 4763 | 5309 |
| 4764 /** | 5310 /** |
| 4765 * The static type of this expression, or `null` if the AST structure has not
been resolved. | 5311 * The static type of this expression, or `null` if the AST structure has not
been resolved. |
| 4766 */ | 5312 */ |
| 4767 Type2 _staticType; | 5313 Type2 _staticType; |
| 4768 | 5314 |
| 4769 /** | 5315 /** |
| 4770 * The propagated type of this expression, or `null` if type propagation has n
ot been | 5316 * The propagated type of this expression, or `null` if type propagation has n
ot been |
| 4771 * performed on the AST structure. | 5317 * performed on the AST structure. |
| 4772 */ | 5318 */ |
| 4773 Type2 _propagatedType; | 5319 Type2 _propagatedType; |
| 4774 | 5320 |
| 4775 /** | 5321 /** |
| 4776 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, | 5322 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, |
| 4777 * and the function being invoked is known based on propagated type informatio
n, and this | 5323 * and the function being invoked is known based on propagated type informatio
n, and this |
| 4778 * expression corresponds to one of the parameters of the function being invok
ed, then return the | 5324 * expression corresponds to one of the parameters of the function being invok
ed, then return the |
| 4779 * parameter element representing the parameter to which the value of this exp
ression will be | 5325 * parameter element representing the parameter to which the value of this exp
ression will be |
| 4780 * bound. Otherwise, return `null`. | 5326 * bound. Otherwise, return `null`. |
| 5327 * |
| 4781 * @return the parameter element representing the parameter to which the value
of this expression | 5328 * @return the parameter element representing the parameter to which the value
of this expression |
| 4782 * will be bound | 5329 * will be bound |
| 4783 */ | 5330 */ |
| 4784 ParameterElement get parameterElement { | 5331 ParameterElement get parameterElement { |
| 4785 ASTNode parent = this.parent; | 5332 ASTNode parent = this.parent; |
| 4786 if (parent is ArgumentList) { | 5333 if (parent is ArgumentList) { |
| 4787 return ((parent as ArgumentList)).getPropagatedParameterElementFor(this); | 5334 return ((parent as ArgumentList)).getPropagatedParameterElementFor(this); |
| 4788 } else if (parent is IndexExpression) { | 5335 } else if (parent is IndexExpression) { |
| 4789 IndexExpression indexExpression = parent as IndexExpression; | 5336 IndexExpression indexExpression = parent as IndexExpression; |
| 4790 if (identical(indexExpression.index, this)) { | 5337 if (identical(indexExpression.index, this)) { |
| 4791 return indexExpression.propagatedParameterElementForIndex; | 5338 return indexExpression.propagatedParameterElementForIndex; |
| 4792 } | 5339 } |
| 4793 } else if (parent is BinaryExpression) { | 5340 } else if (parent is BinaryExpression) { |
| 4794 BinaryExpression binaryExpression = parent as BinaryExpression; | 5341 BinaryExpression binaryExpression = parent as BinaryExpression; |
| 4795 if (identical(binaryExpression.rightOperand, this)) { | 5342 if (identical(binaryExpression.rightOperand, this)) { |
| 4796 return binaryExpression.propagatedParameterElementForRightOperand; | 5343 return binaryExpression.propagatedParameterElementForRightOperand; |
| 4797 } | 5344 } |
| 4798 } else if (parent is PrefixExpression) { | 5345 } else if (parent is PrefixExpression) { |
| 4799 return ((parent as PrefixExpression)).propagatedParameterElementForOperand
; | 5346 return ((parent as PrefixExpression)).propagatedParameterElementForOperand
; |
| 4800 } else if (parent is PostfixExpression) { | 5347 } else if (parent is PostfixExpression) { |
| 4801 return ((parent as PostfixExpression)).propagatedParameterElementForOperan
d; | 5348 return ((parent as PostfixExpression)).propagatedParameterElementForOperan
d; |
| 4802 } | 5349 } |
| 4803 return null; | 5350 return null; |
| 4804 } | 5351 } |
| 4805 | 5352 |
| 4806 /** | 5353 /** |
| 4807 * Return the propagated type of this expression, or `null` if type propagatio
n has not been | 5354 * Return the propagated type of this expression, or `null` if type propagatio
n has not been |
| 4808 * performed on the AST structure. | 5355 * performed on the AST structure. |
| 5356 * |
| 4809 * @return the propagated type of this expression | 5357 * @return the propagated type of this expression |
| 4810 */ | 5358 */ |
| 4811 Type2 get propagatedType => _propagatedType; | 5359 Type2 get propagatedType => _propagatedType; |
| 4812 | 5360 |
| 4813 /** | 5361 /** |
| 4814 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, | 5362 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, |
| 4815 * and the function being invoked is known based on static type information, a
nd this expression | 5363 * and the function being invoked is known based on static type information, a
nd this expression |
| 4816 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter | 5364 * corresponds to one of the parameters of the function being invoked, then re
turn the parameter |
| 4817 * element representing the parameter to which the value of this expression wi
ll be bound. | 5365 * element representing the parameter to which the value of this expression wi
ll be bound. |
| 4818 * Otherwise, return `null`. | 5366 * Otherwise, return `null`. |
| 5367 * |
| 4819 * @return the parameter element representing the parameter to which the value
of this expression | 5368 * @return the parameter element representing the parameter to which the value
of this expression |
| 4820 * will be bound | 5369 * will be bound |
| 4821 */ | 5370 */ |
| 4822 ParameterElement get staticParameterElement { | 5371 ParameterElement get staticParameterElement { |
| 4823 ASTNode parent = this.parent; | 5372 ASTNode parent = this.parent; |
| 4824 if (parent is ArgumentList) { | 5373 if (parent is ArgumentList) { |
| 4825 return ((parent as ArgumentList)).getStaticParameterElementFor(this); | 5374 return ((parent as ArgumentList)).getStaticParameterElementFor(this); |
| 4826 } else if (parent is IndexExpression) { | 5375 } else if (parent is IndexExpression) { |
| 4827 IndexExpression indexExpression = parent as IndexExpression; | 5376 IndexExpression indexExpression = parent as IndexExpression; |
| 4828 if (identical(indexExpression.index, this)) { | 5377 if (identical(indexExpression.index, this)) { |
| 4829 return indexExpression.staticParameterElementForIndex; | 5378 return indexExpression.staticParameterElementForIndex; |
| 4830 } | 5379 } |
| 4831 } else if (parent is BinaryExpression) { | 5380 } else if (parent is BinaryExpression) { |
| 4832 BinaryExpression binaryExpression = parent as BinaryExpression; | 5381 BinaryExpression binaryExpression = parent as BinaryExpression; |
| 4833 if (identical(binaryExpression.rightOperand, this)) { | 5382 if (identical(binaryExpression.rightOperand, this)) { |
| 4834 return binaryExpression.staticParameterElementForRightOperand; | 5383 return binaryExpression.staticParameterElementForRightOperand; |
| 4835 } | 5384 } |
| 4836 } else if (parent is PrefixExpression) { | 5385 } else if (parent is PrefixExpression) { |
| 4837 return ((parent as PrefixExpression)).staticParameterElementForOperand; | 5386 return ((parent as PrefixExpression)).staticParameterElementForOperand; |
| 4838 } else if (parent is PostfixExpression) { | 5387 } else if (parent is PostfixExpression) { |
| 4839 return ((parent as PostfixExpression)).staticParameterElementForOperand; | 5388 return ((parent as PostfixExpression)).staticParameterElementForOperand; |
| 4840 } | 5389 } |
| 4841 return null; | 5390 return null; |
| 4842 } | 5391 } |
| 4843 | 5392 |
| 4844 /** | 5393 /** |
| 4845 * Return the static type of this expression, or `null` if the AST structure h
as not been | 5394 * Return the static type of this expression, or `null` if the AST structure h
as not been |
| 4846 * resolved. | 5395 * resolved. |
| 5396 * |
| 4847 * @return the static type of this expression | 5397 * @return the static type of this expression |
| 4848 */ | 5398 */ |
| 4849 Type2 get staticType => _staticType; | 5399 Type2 get staticType => _staticType; |
| 4850 | 5400 |
| 4851 /** | 5401 /** |
| 4852 * Return `true` if this expression is syntactically valid for the LHS of an[A
ssignmentExpression assignment expression]. | 5402 * Return `true` if this expression is syntactically valid for the LHS of an |
| 5403 * [AssignmentExpression]. |
| 5404 * |
| 4853 * @return `true` if this expression matches the `assignableExpression` produc
tion | 5405 * @return `true` if this expression matches the `assignableExpression` produc
tion |
| 4854 */ | 5406 */ |
| 4855 bool get isAssignable => false; | 5407 bool get isAssignable => false; |
| 4856 | 5408 |
| 4857 /** | 5409 /** |
| 4858 * Set the propagated type of this expression to the given type. | 5410 * Set the propagated type of this expression to the given type. |
| 5411 * |
| 4859 * @param propagatedType the propagated type of this expression | 5412 * @param propagatedType the propagated type of this expression |
| 4860 */ | 5413 */ |
| 4861 void set propagatedType(Type2 propagatedType2) { | 5414 void set propagatedType(Type2 propagatedType2) { |
| 4862 this._propagatedType = propagatedType2; | 5415 this._propagatedType = propagatedType2; |
| 4863 } | 5416 } |
| 4864 | 5417 |
| 4865 /** | 5418 /** |
| 4866 * Set the static type of this expression to the given type. | 5419 * Set the static type of this expression to the given type. |
| 5420 * |
| 4867 * @param staticType the static type of this expression | 5421 * @param staticType the static type of this expression |
| 4868 */ | 5422 */ |
| 4869 void set staticType(Type2 staticType2) { | 5423 void set staticType(Type2 staticType2) { |
| 4870 this._staticType = staticType2; | 5424 this._staticType = staticType2; |
| 4871 } | 5425 } |
| 4872 } | 5426 } |
| 4873 /** | 5427 /** |
| 4874 * Instances of the class `ExpressionFunctionBody` represent a function body con
sisting of a | 5428 * Instances of the class `ExpressionFunctionBody` represent a function body con
sisting of a |
| 4875 * single expression. | 5429 * single expression. |
| 5430 * |
| 4876 * <pre> | 5431 * <pre> |
| 4877 * expressionFunctionBody ::= | 5432 * expressionFunctionBody ::= |
| 4878 * '=>' [Expression expression] ';' | 5433 * '=>' [Expression] ';' |
| 4879 * </pre> | 5434 * </pre> |
| 5435 * |
| 4880 * @coverage dart.engine.ast | 5436 * @coverage dart.engine.ast |
| 4881 */ | 5437 */ |
| 4882 class ExpressionFunctionBody extends FunctionBody { | 5438 class ExpressionFunctionBody extends FunctionBody { |
| 4883 | 5439 |
| 4884 /** | 5440 /** |
| 4885 * The token introducing the expression that represents the body of the functi
on. | 5441 * The token introducing the expression that represents the body of the functi
on. |
| 4886 */ | 5442 */ |
| 4887 Token _functionDefinition; | 5443 Token _functionDefinition; |
| 4888 | 5444 |
| 4889 /** | 5445 /** |
| 4890 * The expression representing the body of the function. | 5446 * The expression representing the body of the function. |
| 4891 */ | 5447 */ |
| 4892 Expression _expression; | 5448 Expression _expression; |
| 4893 | 5449 |
| 4894 /** | 5450 /** |
| 4895 * The semicolon terminating the statement. | 5451 * The semicolon terminating the statement. |
| 4896 */ | 5452 */ |
| 4897 Token _semicolon; | 5453 Token _semicolon; |
| 4898 | 5454 |
| 4899 /** | 5455 /** |
| 4900 * Initialize a newly created function body consisting of a block of statement
s. | 5456 * Initialize a newly created function body consisting of a block of statement
s. |
| 5457 * |
| 4901 * @param functionDefinition the token introducing the expression that represe
nts the body of the | 5458 * @param functionDefinition the token introducing the expression that represe
nts the body of the |
| 4902 * function | 5459 * function |
| 4903 * @param expression the expression representing the body of the function | 5460 * @param expression the expression representing the body of the function |
| 4904 * @param semicolon the semicolon terminating the statement | 5461 * @param semicolon the semicolon terminating the statement |
| 4905 */ | 5462 */ |
| 4906 ExpressionFunctionBody.full(Token functionDefinition, Expression expression, T
oken semicolon) { | 5463 ExpressionFunctionBody.full(Token functionDefinition, Expression expression, T
oken semicolon) { |
| 4907 this._functionDefinition = functionDefinition; | 5464 this._functionDefinition = functionDefinition; |
| 4908 this._expression = becomeParentOf(expression); | 5465 this._expression = becomeParentOf(expression); |
| 4909 this._semicolon = semicolon; | 5466 this._semicolon = semicolon; |
| 4910 } | 5467 } |
| 4911 | 5468 |
| 4912 /** | 5469 /** |
| 4913 * Initialize a newly created function body consisting of a block of statement
s. | 5470 * Initialize a newly created function body consisting of a block of statement
s. |
| 5471 * |
| 4914 * @param functionDefinition the token introducing the expression that represe
nts the body of the | 5472 * @param functionDefinition the token introducing the expression that represe
nts the body of the |
| 4915 * function | 5473 * function |
| 4916 * @param expression the expression representing the body of the function | 5474 * @param expression the expression representing the body of the function |
| 4917 * @param semicolon the semicolon terminating the statement | 5475 * @param semicolon the semicolon terminating the statement |
| 4918 */ | 5476 */ |
| 4919 ExpressionFunctionBody({Token functionDefinition, Expression expression, Token
semicolon}) : this.full(functionDefinition, expression, semicolon); | 5477 ExpressionFunctionBody({Token functionDefinition, Expression expression, Token
semicolon}) : this.full(functionDefinition, expression, semicolon); |
| 4920 accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this); | 5478 accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this); |
| 4921 Token get beginToken => _functionDefinition; | 5479 Token get beginToken => _functionDefinition; |
| 4922 Token get endToken { | 5480 Token get endToken { |
| 4923 if (_semicolon != null) { | 5481 if (_semicolon != null) { |
| 4924 return _semicolon; | 5482 return _semicolon; |
| 4925 } | 5483 } |
| 4926 return _expression.endToken; | 5484 return _expression.endToken; |
| 4927 } | 5485 } |
| 4928 | 5486 |
| 4929 /** | 5487 /** |
| 4930 * Return the expression representing the body of the function. | 5488 * Return the expression representing the body of the function. |
| 5489 * |
| 4931 * @return the expression representing the body of the function | 5490 * @return the expression representing the body of the function |
| 4932 */ | 5491 */ |
| 4933 Expression get expression => _expression; | 5492 Expression get expression => _expression; |
| 4934 | 5493 |
| 4935 /** | 5494 /** |
| 4936 * Return the token introducing the expression that represents the body of the
function. | 5495 * Return the token introducing the expression that represents the body of the
function. |
| 5496 * |
| 4937 * @return the function definition token | 5497 * @return the function definition token |
| 4938 */ | 5498 */ |
| 4939 Token get functionDefinition => _functionDefinition; | 5499 Token get functionDefinition => _functionDefinition; |
| 4940 | 5500 |
| 4941 /** | 5501 /** |
| 4942 * Return the semicolon terminating the statement. | 5502 * Return the semicolon terminating the statement. |
| 5503 * |
| 4943 * @return the semicolon terminating the statement | 5504 * @return the semicolon terminating the statement |
| 4944 */ | 5505 */ |
| 4945 Token get semicolon => _semicolon; | 5506 Token get semicolon => _semicolon; |
| 4946 | 5507 |
| 4947 /** | 5508 /** |
| 4948 * Set the expression representing the body of the function to the given expre
ssion. | 5509 * Set the expression representing the body of the function to the given expre
ssion. |
| 5510 * |
| 4949 * @param expression the expression representing the body of the function | 5511 * @param expression the expression representing the body of the function |
| 4950 */ | 5512 */ |
| 4951 void set expression(Expression expression2) { | 5513 void set expression(Expression expression2) { |
| 4952 this._expression = becomeParentOf(expression2); | 5514 this._expression = becomeParentOf(expression2); |
| 4953 } | 5515 } |
| 4954 | 5516 |
| 4955 /** | 5517 /** |
| 4956 * Set the token introducing the expression that represents the body of the fu
nction to the given | 5518 * Set the token introducing the expression that represents the body of the fu
nction to the given |
| 4957 * token. | 5519 * token. |
| 5520 * |
| 4958 * @param functionDefinition the function definition token | 5521 * @param functionDefinition the function definition token |
| 4959 */ | 5522 */ |
| 4960 void set functionDefinition(Token functionDefinition2) { | 5523 void set functionDefinition(Token functionDefinition2) { |
| 4961 this._functionDefinition = functionDefinition2; | 5524 this._functionDefinition = functionDefinition2; |
| 4962 } | 5525 } |
| 4963 | 5526 |
| 4964 /** | 5527 /** |
| 4965 * Set the semicolon terminating the statement to the given token. | 5528 * Set the semicolon terminating the statement to the given token. |
| 5529 * |
| 4966 * @param semicolon the semicolon terminating the statement | 5530 * @param semicolon the semicolon terminating the statement |
| 4967 */ | 5531 */ |
| 4968 void set semicolon(Token semicolon2) { | 5532 void set semicolon(Token semicolon2) { |
| 4969 this._semicolon = semicolon2; | 5533 this._semicolon = semicolon2; |
| 4970 } | 5534 } |
| 4971 void visitChildren(ASTVisitor<Object> visitor) { | 5535 void visitChildren(ASTVisitor<Object> visitor) { |
| 4972 safelyVisitChild(_expression, visitor); | 5536 safelyVisitChild(_expression, visitor); |
| 4973 } | 5537 } |
| 4974 } | 5538 } |
| 4975 /** | 5539 /** |
| 4976 * Instances of the class `ExpressionStatement` wrap an expression as a statemen
t. | 5540 * Instances of the class `ExpressionStatement` wrap an expression as a statemen
t. |
| 5541 * |
| 4977 * <pre> | 5542 * <pre> |
| 4978 * expressionStatement ::=[Expression expression]? ';' | 5543 * expressionStatement ::= |
| 5544 * [Expression]? ';' |
| 4979 * </pre> | 5545 * </pre> |
| 5546 * |
| 4980 * @coverage dart.engine.ast | 5547 * @coverage dart.engine.ast |
| 4981 */ | 5548 */ |
| 4982 class ExpressionStatement extends Statement { | 5549 class ExpressionStatement extends Statement { |
| 4983 | 5550 |
| 4984 /** | 5551 /** |
| 4985 * The expression that comprises the statement. | 5552 * The expression that comprises the statement. |
| 4986 */ | 5553 */ |
| 4987 Expression _expression; | 5554 Expression _expression; |
| 4988 | 5555 |
| 4989 /** | 5556 /** |
| 4990 * The semicolon terminating the statement, or `null` if the expression is a f
unction | 5557 * The semicolon terminating the statement, or `null` if the expression is a f
unction |
| 4991 * expression and isn't followed by a semicolon. | 5558 * expression and isn't followed by a semicolon. |
| 4992 */ | 5559 */ |
| 4993 Token _semicolon; | 5560 Token _semicolon; |
| 4994 | 5561 |
| 4995 /** | 5562 /** |
| 4996 * Initialize a newly created expression statement. | 5563 * Initialize a newly created expression statement. |
| 5564 * |
| 4997 * @param expression the expression that comprises the statement | 5565 * @param expression the expression that comprises the statement |
| 4998 * @param semicolon the semicolon terminating the statement | 5566 * @param semicolon the semicolon terminating the statement |
| 4999 */ | 5567 */ |
| 5000 ExpressionStatement.full(Expression expression, Token semicolon) { | 5568 ExpressionStatement.full(Expression expression, Token semicolon) { |
| 5001 this._expression = becomeParentOf(expression); | 5569 this._expression = becomeParentOf(expression); |
| 5002 this._semicolon = semicolon; | 5570 this._semicolon = semicolon; |
| 5003 } | 5571 } |
| 5004 | 5572 |
| 5005 /** | 5573 /** |
| 5006 * Initialize a newly created expression statement. | 5574 * Initialize a newly created expression statement. |
| 5575 * |
| 5007 * @param expression the expression that comprises the statement | 5576 * @param expression the expression that comprises the statement |
| 5008 * @param semicolon the semicolon terminating the statement | 5577 * @param semicolon the semicolon terminating the statement |
| 5009 */ | 5578 */ |
| 5010 ExpressionStatement({Expression expression, Token semicolon}) : this.full(expr
ession, semicolon); | 5579 ExpressionStatement({Expression expression, Token semicolon}) : this.full(expr
ession, semicolon); |
| 5011 accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this); | 5580 accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this); |
| 5012 Token get beginToken => _expression.beginToken; | 5581 Token get beginToken => _expression.beginToken; |
| 5013 Token get endToken { | 5582 Token get endToken { |
| 5014 if (_semicolon != null) { | 5583 if (_semicolon != null) { |
| 5015 return _semicolon; | 5584 return _semicolon; |
| 5016 } | 5585 } |
| 5017 return _expression.endToken; | 5586 return _expression.endToken; |
| 5018 } | 5587 } |
| 5019 | 5588 |
| 5020 /** | 5589 /** |
| 5021 * Return the expression that comprises the statement. | 5590 * Return the expression that comprises the statement. |
| 5591 * |
| 5022 * @return the expression that comprises the statement | 5592 * @return the expression that comprises the statement |
| 5023 */ | 5593 */ |
| 5024 Expression get expression => _expression; | 5594 Expression get expression => _expression; |
| 5025 | 5595 |
| 5026 /** | 5596 /** |
| 5027 * Return the semicolon terminating the statement. | 5597 * Return the semicolon terminating the statement. |
| 5598 * |
| 5028 * @return the semicolon terminating the statement | 5599 * @return the semicolon terminating the statement |
| 5029 */ | 5600 */ |
| 5030 Token get semicolon => _semicolon; | 5601 Token get semicolon => _semicolon; |
| 5031 bool get isSynthetic => _expression.isSynthetic && _semicolon.isSynthetic; | 5602 bool get isSynthetic => _expression.isSynthetic && _semicolon.isSynthetic; |
| 5032 | 5603 |
| 5033 /** | 5604 /** |
| 5034 * Set the expression that comprises the statement to the given expression. | 5605 * Set the expression that comprises the statement to the given expression. |
| 5606 * |
| 5035 * @param expression the expression that comprises the statement | 5607 * @param expression the expression that comprises the statement |
| 5036 */ | 5608 */ |
| 5037 void set expression(Expression expression2) { | 5609 void set expression(Expression expression2) { |
| 5038 this._expression = becomeParentOf(expression2); | 5610 this._expression = becomeParentOf(expression2); |
| 5039 } | 5611 } |
| 5040 | 5612 |
| 5041 /** | 5613 /** |
| 5042 * Set the semicolon terminating the statement to the given token. | 5614 * Set the semicolon terminating the statement to the given token. |
| 5615 * |
| 5043 * @param semicolon the semicolon terminating the statement | 5616 * @param semicolon the semicolon terminating the statement |
| 5044 */ | 5617 */ |
| 5045 void set semicolon(Token semicolon2) { | 5618 void set semicolon(Token semicolon2) { |
| 5046 this._semicolon = semicolon2; | 5619 this._semicolon = semicolon2; |
| 5047 } | 5620 } |
| 5048 void visitChildren(ASTVisitor<Object> visitor) { | 5621 void visitChildren(ASTVisitor<Object> visitor) { |
| 5049 safelyVisitChild(_expression, visitor); | 5622 safelyVisitChild(_expression, visitor); |
| 5050 } | 5623 } |
| 5051 } | 5624 } |
| 5052 /** | 5625 /** |
| 5053 * Instances of the class `ExtendsClause` represent the "extends" clause in a cl
ass | 5626 * Instances of the class `ExtendsClause` represent the "extends" clause in a cl
ass |
| 5054 * declaration. | 5627 * declaration. |
| 5628 * |
| 5055 * <pre> | 5629 * <pre> |
| 5056 * extendsClause ::= | 5630 * extendsClause ::= |
| 5057 * 'extends' [TypeName superclass]</pre> | 5631 * 'extends' [TypeName] |
| 5632 * </pre> |
| 5633 * |
| 5058 * @coverage dart.engine.ast | 5634 * @coverage dart.engine.ast |
| 5059 */ | 5635 */ |
| 5060 class ExtendsClause extends ASTNode { | 5636 class ExtendsClause extends ASTNode { |
| 5061 | 5637 |
| 5062 /** | 5638 /** |
| 5063 * The token representing the 'extends' keyword. | 5639 * The token representing the 'extends' keyword. |
| 5064 */ | 5640 */ |
| 5065 Token _keyword; | 5641 Token _keyword; |
| 5066 | 5642 |
| 5067 /** | 5643 /** |
| 5068 * The name of the class that is being extended. | 5644 * The name of the class that is being extended. |
| 5069 */ | 5645 */ |
| 5070 TypeName _superclass; | 5646 TypeName _superclass; |
| 5071 | 5647 |
| 5072 /** | 5648 /** |
| 5073 * Initialize a newly created extends clause. | 5649 * Initialize a newly created extends clause. |
| 5650 * |
| 5074 * @param keyword the token representing the 'extends' keyword | 5651 * @param keyword the token representing the 'extends' keyword |
| 5075 * @param superclass the name of the class that is being extended | 5652 * @param superclass the name of the class that is being extended |
| 5076 */ | 5653 */ |
| 5077 ExtendsClause.full(Token keyword, TypeName superclass) { | 5654 ExtendsClause.full(Token keyword, TypeName superclass) { |
| 5078 this._keyword = keyword; | 5655 this._keyword = keyword; |
| 5079 this._superclass = becomeParentOf(superclass); | 5656 this._superclass = becomeParentOf(superclass); |
| 5080 } | 5657 } |
| 5081 | 5658 |
| 5082 /** | 5659 /** |
| 5083 * Initialize a newly created extends clause. | 5660 * Initialize a newly created extends clause. |
| 5661 * |
| 5084 * @param keyword the token representing the 'extends' keyword | 5662 * @param keyword the token representing the 'extends' keyword |
| 5085 * @param superclass the name of the class that is being extended | 5663 * @param superclass the name of the class that is being extended |
| 5086 */ | 5664 */ |
| 5087 ExtendsClause({Token keyword, TypeName superclass}) : this.full(keyword, super
class); | 5665 ExtendsClause({Token keyword, TypeName superclass}) : this.full(keyword, super
class); |
| 5088 accept(ASTVisitor visitor) => visitor.visitExtendsClause(this); | 5666 accept(ASTVisitor visitor) => visitor.visitExtendsClause(this); |
| 5089 Token get beginToken => _keyword; | 5667 Token get beginToken => _keyword; |
| 5090 Token get endToken => _superclass.endToken; | 5668 Token get endToken => _superclass.endToken; |
| 5091 | 5669 |
| 5092 /** | 5670 /** |
| 5093 * Return the token representing the 'extends' keyword. | 5671 * Return the token representing the 'extends' keyword. |
| 5672 * |
| 5094 * @return the token representing the 'extends' keyword | 5673 * @return the token representing the 'extends' keyword |
| 5095 */ | 5674 */ |
| 5096 Token get keyword => _keyword; | 5675 Token get keyword => _keyword; |
| 5097 | 5676 |
| 5098 /** | 5677 /** |
| 5099 * Return the name of the class that is being extended. | 5678 * Return the name of the class that is being extended. |
| 5679 * |
| 5100 * @return the name of the class that is being extended | 5680 * @return the name of the class that is being extended |
| 5101 */ | 5681 */ |
| 5102 TypeName get superclass => _superclass; | 5682 TypeName get superclass => _superclass; |
| 5103 | 5683 |
| 5104 /** | 5684 /** |
| 5105 * Set the token representing the 'extends' keyword to the given token. | 5685 * Set the token representing the 'extends' keyword to the given token. |
| 5686 * |
| 5106 * @param keyword the token representing the 'extends' keyword | 5687 * @param keyword the token representing the 'extends' keyword |
| 5107 */ | 5688 */ |
| 5108 void set keyword(Token keyword2) { | 5689 void set keyword(Token keyword2) { |
| 5109 this._keyword = keyword2; | 5690 this._keyword = keyword2; |
| 5110 } | 5691 } |
| 5111 | 5692 |
| 5112 /** | 5693 /** |
| 5113 * Set the name of the class that is being extended to the given name. | 5694 * Set the name of the class that is being extended to the given name. |
| 5695 * |
| 5114 * @param name the name of the class that is being extended | 5696 * @param name the name of the class that is being extended |
| 5115 */ | 5697 */ |
| 5116 void set superclass(TypeName name) { | 5698 void set superclass(TypeName name) { |
| 5117 _superclass = becomeParentOf(name); | 5699 _superclass = becomeParentOf(name); |
| 5118 } | 5700 } |
| 5119 void visitChildren(ASTVisitor<Object> visitor) { | 5701 void visitChildren(ASTVisitor<Object> visitor) { |
| 5120 safelyVisitChild(_superclass, visitor); | 5702 safelyVisitChild(_superclass, visitor); |
| 5121 } | 5703 } |
| 5122 } | 5704 } |
| 5123 /** | 5705 /** |
| 5124 * Instances of the class `FieldDeclaration` represent the declaration of one or
more fields | 5706 * Instances of the class `FieldDeclaration` represent the declaration of one or
more fields |
| 5125 * of the same type. | 5707 * of the same type. |
| 5708 * |
| 5126 * <pre> | 5709 * <pre> |
| 5127 * fieldDeclaration ::= | 5710 * fieldDeclaration ::= |
| 5128 * 'static'? [VariableDeclarationList fieldList] ';' | 5711 * 'static'? [VariableDeclarationList] ';' |
| 5129 * </pre> | 5712 * </pre> |
| 5713 * |
| 5130 * @coverage dart.engine.ast | 5714 * @coverage dart.engine.ast |
| 5131 */ | 5715 */ |
| 5132 class FieldDeclaration extends ClassMember { | 5716 class FieldDeclaration extends ClassMember { |
| 5133 | 5717 |
| 5134 /** | 5718 /** |
| 5135 * The token representing the 'static' keyword, or `null` if the fields are no
t static. | 5719 * The token representing the 'static' keyword, or `null` if the fields are no
t static. |
| 5136 */ | 5720 */ |
| 5137 Token _keyword; | 5721 Token _keyword; |
| 5138 | 5722 |
| 5139 /** | 5723 /** |
| 5140 * The fields being declared. | 5724 * The fields being declared. |
| 5141 */ | 5725 */ |
| 5142 VariableDeclarationList _fieldList; | 5726 VariableDeclarationList _fieldList; |
| 5143 | 5727 |
| 5144 /** | 5728 /** |
| 5145 * The semicolon terminating the declaration. | 5729 * The semicolon terminating the declaration. |
| 5146 */ | 5730 */ |
| 5147 Token _semicolon; | 5731 Token _semicolon; |
| 5148 | 5732 |
| 5149 /** | 5733 /** |
| 5150 * Initialize a newly created field declaration. | 5734 * Initialize a newly created field declaration. |
| 5735 * |
| 5151 * @param comment the documentation comment associated with this field | 5736 * @param comment the documentation comment associated with this field |
| 5152 * @param metadata the annotations associated with this field | 5737 * @param metadata the annotations associated with this field |
| 5153 * @param keyword the token representing the 'static' keyword | 5738 * @param keyword the token representing the 'static' keyword |
| 5154 * @param fieldList the fields being declared | 5739 * @param fieldList the fields being declared |
| 5155 * @param semicolon the semicolon terminating the declaration | 5740 * @param semicolon the semicolon terminating the declaration |
| 5156 */ | 5741 */ |
| 5157 FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token keywor
d, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, met
adata) { | 5742 FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token keywor
d, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, met
adata) { |
| 5158 this._keyword = keyword; | 5743 this._keyword = keyword; |
| 5159 this._fieldList = becomeParentOf(fieldList); | 5744 this._fieldList = becomeParentOf(fieldList); |
| 5160 this._semicolon = semicolon; | 5745 this._semicolon = semicolon; |
| 5161 } | 5746 } |
| 5162 | 5747 |
| 5163 /** | 5748 /** |
| 5164 * Initialize a newly created field declaration. | 5749 * Initialize a newly created field declaration. |
| 5750 * |
| 5165 * @param comment the documentation comment associated with this field | 5751 * @param comment the documentation comment associated with this field |
| 5166 * @param metadata the annotations associated with this field | 5752 * @param metadata the annotations associated with this field |
| 5167 * @param keyword the token representing the 'static' keyword | 5753 * @param keyword the token representing the 'static' keyword |
| 5168 * @param fieldList the fields being declared | 5754 * @param fieldList the fields being declared |
| 5169 * @param semicolon the semicolon terminating the declaration | 5755 * @param semicolon the semicolon terminating the declaration |
| 5170 */ | 5756 */ |
| 5171 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V
ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat
a, keyword, fieldList, semicolon); | 5757 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V
ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat
a, keyword, fieldList, semicolon); |
| 5172 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); | 5758 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); |
| 5173 Element get element => null; | 5759 Element get element => null; |
| 5174 Token get endToken => _semicolon; | 5760 Token get endToken => _semicolon; |
| 5175 | 5761 |
| 5176 /** | 5762 /** |
| 5177 * Return the fields being declared. | 5763 * Return the fields being declared. |
| 5764 * |
| 5178 * @return the fields being declared | 5765 * @return the fields being declared |
| 5179 */ | 5766 */ |
| 5180 VariableDeclarationList get fields => _fieldList; | 5767 VariableDeclarationList get fields => _fieldList; |
| 5181 | 5768 |
| 5182 /** | 5769 /** |
| 5183 * Return the token representing the 'static' keyword, or `null` if the fields
are not | 5770 * Return the token representing the 'static' keyword, or `null` if the fields
are not |
| 5184 * static. | 5771 * static. |
| 5772 * |
| 5185 * @return the token representing the 'static' keyword | 5773 * @return the token representing the 'static' keyword |
| 5186 */ | 5774 */ |
| 5187 Token get keyword => _keyword; | 5775 Token get keyword => _keyword; |
| 5188 | 5776 |
| 5189 /** | 5777 /** |
| 5190 * Return the semicolon terminating the declaration. | 5778 * Return the semicolon terminating the declaration. |
| 5779 * |
| 5191 * @return the semicolon terminating the declaration | 5780 * @return the semicolon terminating the declaration |
| 5192 */ | 5781 */ |
| 5193 Token get semicolon => _semicolon; | 5782 Token get semicolon => _semicolon; |
| 5194 | 5783 |
| 5195 /** | 5784 /** |
| 5196 * Return `true` if the fields are static. | 5785 * Return `true` if the fields are static. |
| 5786 * |
| 5197 * @return `true` if the fields are declared to be static | 5787 * @return `true` if the fields are declared to be static |
| 5198 */ | 5788 */ |
| 5199 bool get isStatic => _keyword != null; | 5789 bool get isStatic => _keyword != null; |
| 5200 | 5790 |
| 5201 /** | 5791 /** |
| 5202 * Set the fields being declared to the given list of variables. | 5792 * Set the fields being declared to the given list of variables. |
| 5793 * |
| 5203 * @param fieldList the fields being declared | 5794 * @param fieldList the fields being declared |
| 5204 */ | 5795 */ |
| 5205 void set fields(VariableDeclarationList fieldList) { | 5796 void set fields(VariableDeclarationList fieldList) { |
| 5206 fieldList = becomeParentOf(fieldList); | 5797 fieldList = becomeParentOf(fieldList); |
| 5207 } | 5798 } |
| 5208 | 5799 |
| 5209 /** | 5800 /** |
| 5210 * Set the token representing the 'static' keyword to the given token. | 5801 * Set the token representing the 'static' keyword to the given token. |
| 5802 * |
| 5211 * @param keyword the token representing the 'static' keyword | 5803 * @param keyword the token representing the 'static' keyword |
| 5212 */ | 5804 */ |
| 5213 void set keyword(Token keyword2) { | 5805 void set keyword(Token keyword2) { |
| 5214 this._keyword = keyword2; | 5806 this._keyword = keyword2; |
| 5215 } | 5807 } |
| 5216 | 5808 |
| 5217 /** | 5809 /** |
| 5218 * Set the semicolon terminating the declaration to the given token. | 5810 * Set the semicolon terminating the declaration to the given token. |
| 5811 * |
| 5219 * @param semicolon the semicolon terminating the declaration | 5812 * @param semicolon the semicolon terminating the declaration |
| 5220 */ | 5813 */ |
| 5221 void set semicolon(Token semicolon2) { | 5814 void set semicolon(Token semicolon2) { |
| 5222 this._semicolon = semicolon2; | 5815 this._semicolon = semicolon2; |
| 5223 } | 5816 } |
| 5224 void visitChildren(ASTVisitor<Object> visitor) { | 5817 void visitChildren(ASTVisitor<Object> visitor) { |
| 5225 super.visitChildren(visitor); | 5818 super.visitChildren(visitor); |
| 5226 safelyVisitChild(_fieldList, visitor); | 5819 safelyVisitChild(_fieldList, visitor); |
| 5227 } | 5820 } |
| 5228 Token get firstTokenAfterCommentAndMetadata { | 5821 Token get firstTokenAfterCommentAndMetadata { |
| 5229 if (_keyword != null) { | 5822 if (_keyword != null) { |
| 5230 return _keyword; | 5823 return _keyword; |
| 5231 } | 5824 } |
| 5232 return _fieldList.beginToken; | 5825 return _fieldList.beginToken; |
| 5233 } | 5826 } |
| 5234 } | 5827 } |
| 5235 /** | 5828 /** |
| 5236 * Instances of the class `FieldFormalParameter` represent a field formal parame
ter. | 5829 * Instances of the class `FieldFormalParameter` represent a field formal parame
ter. |
| 5830 * |
| 5237 * <pre> | 5831 * <pre> |
| 5238 * fieldFormalParameter ::= | 5832 * fieldFormalParameter ::= |
| 5239 * ('final' [TypeName type] | 'const' [TypeName type] | 'var' | [TypeName type])
? 'this' '.' [SimpleIdentifier identifier]</pre> | 5833 * ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? 'this' '.
' [SimpleIdentifier] |
| 5834 * </pre> |
| 5835 * |
| 5240 * @coverage dart.engine.ast | 5836 * @coverage dart.engine.ast |
| 5241 */ | 5837 */ |
| 5242 class FieldFormalParameter extends NormalFormalParameter { | 5838 class FieldFormalParameter extends NormalFormalParameter { |
| 5243 | 5839 |
| 5244 /** | 5840 /** |
| 5245 * The token representing either the 'final', 'const' or 'var' keyword, or `nu
ll` if no | 5841 * The token representing either the 'final', 'const' or 'var' keyword, or `nu
ll` if no |
| 5246 * keyword was used. | 5842 * keyword was used. |
| 5247 */ | 5843 */ |
| 5248 Token _keyword; | 5844 Token _keyword; |
| 5249 | 5845 |
| 5250 /** | 5846 /** |
| 5251 * The name of the declared type of the parameter, or `null` if the parameter
does not have | 5847 * The name of the declared type of the parameter, or `null` if the parameter
does not have |
| 5252 * a declared type. | 5848 * a declared type. |
| 5253 */ | 5849 */ |
| 5254 TypeName _type; | 5850 TypeName _type; |
| 5255 | 5851 |
| 5256 /** | 5852 /** |
| 5257 * The token representing the 'this' keyword. | 5853 * The token representing the 'this' keyword. |
| 5258 */ | 5854 */ |
| 5259 Token _thisToken; | 5855 Token _thisToken; |
| 5260 | 5856 |
| 5261 /** | 5857 /** |
| 5262 * The token representing the period. | 5858 * The token representing the period. |
| 5263 */ | 5859 */ |
| 5264 Token _period; | 5860 Token _period; |
| 5265 | 5861 |
| 5266 /** | 5862 /** |
| 5267 * Initialize a newly created formal parameter. | 5863 * Initialize a newly created formal parameter. |
| 5864 * |
| 5268 * @param comment the documentation comment associated with this parameter | 5865 * @param comment the documentation comment associated with this parameter |
| 5269 * @param metadata the annotations associated with this parameter | 5866 * @param metadata the annotations associated with this parameter |
| 5270 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5867 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 5271 * @param type the name of the declared type of the parameter | 5868 * @param type the name of the declared type of the parameter |
| 5272 * @param thisToken the token representing the 'this' keyword | 5869 * @param thisToken the token representing the 'this' keyword |
| 5273 * @param period the token representing the period | 5870 * @param period the token representing the period |
| 5274 * @param identifier the name of the parameter being declared | 5871 * @param identifier the name of the parameter being declared |
| 5275 */ | 5872 */ |
| 5276 FieldFormalParameter.full(Comment comment, List<Annotation> metadata, Token ke
yword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier
) : super.full(comment, metadata, identifier) { | 5873 FieldFormalParameter.full(Comment comment, List<Annotation> metadata, Token ke
yword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier
) : super.full(comment, metadata, identifier) { |
| 5277 this._keyword = keyword; | 5874 this._keyword = keyword; |
| 5278 this._type = becomeParentOf(type); | 5875 this._type = becomeParentOf(type); |
| 5279 this._thisToken = thisToken; | 5876 this._thisToken = thisToken; |
| 5280 this._period = period; | 5877 this._period = period; |
| 5281 } | 5878 } |
| 5282 | 5879 |
| 5283 /** | 5880 /** |
| 5284 * Initialize a newly created formal parameter. | 5881 * Initialize a newly created formal parameter. |
| 5882 * |
| 5285 * @param comment the documentation comment associated with this parameter | 5883 * @param comment the documentation comment associated with this parameter |
| 5286 * @param metadata the annotations associated with this parameter | 5884 * @param metadata the annotations associated with this parameter |
| 5287 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5885 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 5288 * @param type the name of the declared type of the parameter | 5886 * @param type the name of the declared type of the parameter |
| 5289 * @param thisToken the token representing the 'this' keyword | 5887 * @param thisToken the token representing the 'this' keyword |
| 5290 * @param period the token representing the period | 5888 * @param period the token representing the period |
| 5291 * @param identifier the name of the parameter being declared | 5889 * @param identifier the name of the parameter being declared |
| 5292 */ | 5890 */ |
| 5293 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); | 5891 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); |
| 5294 accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this); | 5892 accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this); |
| 5295 Token get beginToken { | 5893 Token get beginToken { |
| 5296 if (_keyword != null) { | 5894 if (_keyword != null) { |
| 5297 return _keyword; | 5895 return _keyword; |
| 5298 } else if (_type != null) { | 5896 } else if (_type != null) { |
| 5299 return _type.beginToken; | 5897 return _type.beginToken; |
| 5300 } | 5898 } |
| 5301 return _thisToken; | 5899 return _thisToken; |
| 5302 } | 5900 } |
| 5303 Token get endToken => identifier.endToken; | 5901 Token get endToken => identifier.endToken; |
| 5304 | 5902 |
| 5305 /** | 5903 /** |
| 5306 * Return the token representing either the 'final', 'const' or 'var' keyword. | 5904 * Return the token representing either the 'final', 'const' or 'var' keyword. |
| 5905 * |
| 5307 * @return the token representing either the 'final', 'const' or 'var' keyword | 5906 * @return the token representing either the 'final', 'const' or 'var' keyword |
| 5308 */ | 5907 */ |
| 5309 Token get keyword => _keyword; | 5908 Token get keyword => _keyword; |
| 5310 | 5909 |
| 5311 /** | 5910 /** |
| 5312 * Return the token representing the period. | 5911 * Return the token representing the period. |
| 5912 * |
| 5313 * @return the token representing the period | 5913 * @return the token representing the period |
| 5314 */ | 5914 */ |
| 5315 Token get period => _period; | 5915 Token get period => _period; |
| 5316 | 5916 |
| 5317 /** | 5917 /** |
| 5318 * Return the token representing the 'this' keyword. | 5918 * Return the token representing the 'this' keyword. |
| 5919 * |
| 5319 * @return the token representing the 'this' keyword | 5920 * @return the token representing the 'this' keyword |
| 5320 */ | 5921 */ |
| 5321 Token get thisToken => _thisToken; | 5922 Token get thisToken => _thisToken; |
| 5322 | 5923 |
| 5323 /** | 5924 /** |
| 5324 * Return the name of the declared type of the parameter, or `null` if the par
ameter does | 5925 * Return the name of the declared type of the parameter, or `null` if the par
ameter does |
| 5325 * not have a declared type. | 5926 * not have a declared type. |
| 5927 * |
| 5326 * @return the name of the declared type of the parameter | 5928 * @return the name of the declared type of the parameter |
| 5327 */ | 5929 */ |
| 5328 TypeName get type => _type; | 5930 TypeName get type => _type; |
| 5329 bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.CONST); | 5931 bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.CONST); |
| 5330 bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.FINAL); | 5932 bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.FINAL); |
| 5331 | 5933 |
| 5332 /** | 5934 /** |
| 5333 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 5935 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
| 5936 * |
| 5334 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5937 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 5335 */ | 5938 */ |
| 5336 void set keyword(Token keyword2) { | 5939 void set keyword(Token keyword2) { |
| 5337 this._keyword = keyword2; | 5940 this._keyword = keyword2; |
| 5338 } | 5941 } |
| 5339 | 5942 |
| 5340 /** | 5943 /** |
| 5341 * Set the token representing the period to the given token. | 5944 * Set the token representing the period to the given token. |
| 5945 * |
| 5342 * @param period the token representing the period | 5946 * @param period the token representing the period |
| 5343 */ | 5947 */ |
| 5344 void set period(Token period2) { | 5948 void set period(Token period2) { |
| 5345 this._period = period2; | 5949 this._period = period2; |
| 5346 } | 5950 } |
| 5347 | 5951 |
| 5348 /** | 5952 /** |
| 5349 * Set the token representing the 'this' keyword to the given token. | 5953 * Set the token representing the 'this' keyword to the given token. |
| 5954 * |
| 5350 * @param thisToken the token representing the 'this' keyword | 5955 * @param thisToken the token representing the 'this' keyword |
| 5351 */ | 5956 */ |
| 5352 void set thisToken(Token thisToken2) { | 5957 void set thisToken(Token thisToken2) { |
| 5353 this._thisToken = thisToken2; | 5958 this._thisToken = thisToken2; |
| 5354 } | 5959 } |
| 5355 | 5960 |
| 5356 /** | 5961 /** |
| 5357 * Set the name of the declared type of the parameter to the given type name. | 5962 * Set the name of the declared type of the parameter to the given type name. |
| 5963 * |
| 5358 * @param typeName the name of the declared type of the parameter | 5964 * @param typeName the name of the declared type of the parameter |
| 5359 */ | 5965 */ |
| 5360 void set type(TypeName typeName) { | 5966 void set type(TypeName typeName) { |
| 5361 _type = becomeParentOf(typeName); | 5967 _type = becomeParentOf(typeName); |
| 5362 } | 5968 } |
| 5363 void visitChildren(ASTVisitor<Object> visitor) { | 5969 void visitChildren(ASTVisitor<Object> visitor) { |
| 5364 super.visitChildren(visitor); | 5970 super.visitChildren(visitor); |
| 5365 safelyVisitChild(_type, visitor); | 5971 safelyVisitChild(_type, visitor); |
| 5366 safelyVisitChild(identifier, visitor); | 5972 safelyVisitChild(identifier, visitor); |
| 5367 } | 5973 } |
| 5368 } | 5974 } |
| 5369 /** | 5975 /** |
| 5370 * Instances of the class `ForEachStatement` represent a for-each statement. | 5976 * Instances of the class `ForEachStatement` represent a for-each statement. |
| 5977 * |
| 5371 * <pre> | 5978 * <pre> |
| 5372 * forEachStatement ::= | 5979 * forEachStatement ::= |
| 5373 * 'for' '(' [SimpleFormalParameter loopParameter] 'in' [Expression iterator] ')
' [Block body]</pre> | 5980 * 'for' '(' [SimpleFormalParameter] 'in' [Expression] ')' [Block] |
| 5981 * </pre> |
| 5982 * |
| 5374 * @coverage dart.engine.ast | 5983 * @coverage dart.engine.ast |
| 5375 */ | 5984 */ |
| 5376 class ForEachStatement extends Statement { | 5985 class ForEachStatement extends Statement { |
| 5377 | 5986 |
| 5378 /** | 5987 /** |
| 5379 * The token representing the 'for' keyword. | 5988 * The token representing the 'for' keyword. |
| 5380 */ | 5989 */ |
| 5381 Token _forKeyword; | 5990 Token _forKeyword; |
| 5382 | 5991 |
| 5383 /** | 5992 /** |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5405 */ | 6014 */ |
| 5406 Token _rightParenthesis; | 6015 Token _rightParenthesis; |
| 5407 | 6016 |
| 5408 /** | 6017 /** |
| 5409 * The body of the loop. | 6018 * The body of the loop. |
| 5410 */ | 6019 */ |
| 5411 Statement _body; | 6020 Statement _body; |
| 5412 | 6021 |
| 5413 /** | 6022 /** |
| 5414 * Initialize a newly created for-each statement. | 6023 * Initialize a newly created for-each statement. |
| 6024 * |
| 5415 * @param forKeyword the token representing the 'for' keyword | 6025 * @param forKeyword the token representing the 'for' keyword |
| 5416 * @param leftParenthesis the left parenthesis | 6026 * @param leftParenthesis the left parenthesis |
| 5417 * @param loopVariable the declaration of the loop variable | 6027 * @param loopVariable the declaration of the loop variable |
| 5418 * @param iterator the expression evaluated to produce the iterator | 6028 * @param iterator the expression evaluated to produce the iterator |
| 5419 * @param rightParenthesis the right parenthesis | 6029 * @param rightParenthesis the right parenthesis |
| 5420 * @param body the body of the loop | 6030 * @param body the body of the loop |
| 5421 */ | 6031 */ |
| 5422 ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentif
ier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis,
Statement body) { | 6032 ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentif
ier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis,
Statement body) { |
| 5423 this._forKeyword = forKeyword; | 6033 this._forKeyword = forKeyword; |
| 5424 this._leftParenthesis = leftParenthesis; | 6034 this._leftParenthesis = leftParenthesis; |
| 5425 this._loopVariable = becomeParentOf(loopVariable); | 6035 this._loopVariable = becomeParentOf(loopVariable); |
| 5426 this._inKeyword = inKeyword; | 6036 this._inKeyword = inKeyword; |
| 5427 this._iterator = becomeParentOf(iterator); | 6037 this._iterator = becomeParentOf(iterator); |
| 5428 this._rightParenthesis = rightParenthesis; | 6038 this._rightParenthesis = rightParenthesis; |
| 5429 this._body = becomeParentOf(body); | 6039 this._body = becomeParentOf(body); |
| 5430 } | 6040 } |
| 5431 | 6041 |
| 5432 /** | 6042 /** |
| 5433 * Initialize a newly created for-each statement. | 6043 * Initialize a newly created for-each statement. |
| 6044 * |
| 5434 * @param forKeyword the token representing the 'for' keyword | 6045 * @param forKeyword the token representing the 'for' keyword |
| 5435 * @param leftParenthesis the left parenthesis | 6046 * @param leftParenthesis the left parenthesis |
| 5436 * @param loopVariable the declaration of the loop variable | 6047 * @param loopVariable the declaration of the loop variable |
| 5437 * @param iterator the expression evaluated to produce the iterator | 6048 * @param iterator the expression evaluated to produce the iterator |
| 5438 * @param rightParenthesis the right parenthesis | 6049 * @param rightParenthesis the right parenthesis |
| 5439 * @param body the body of the loop | 6050 * @param body the body of the loop |
| 5440 */ | 6051 */ |
| 5441 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); | 6052 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); |
| 5442 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); | 6053 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); |
| 5443 Token get beginToken => _forKeyword; | 6054 Token get beginToken => _forKeyword; |
| 5444 | 6055 |
| 5445 /** | 6056 /** |
| 5446 * Return the body of the loop. | 6057 * Return the body of the loop. |
| 6058 * |
| 5447 * @return the body of the loop | 6059 * @return the body of the loop |
| 5448 */ | 6060 */ |
| 5449 Statement get body => _body; | 6061 Statement get body => _body; |
| 5450 Token get endToken => _body.endToken; | 6062 Token get endToken => _body.endToken; |
| 5451 | 6063 |
| 5452 /** | 6064 /** |
| 5453 * Return the token representing the 'for' keyword. | 6065 * Return the token representing the 'for' keyword. |
| 6066 * |
| 5454 * @return the token representing the 'for' keyword | 6067 * @return the token representing the 'for' keyword |
| 5455 */ | 6068 */ |
| 5456 Token get forKeyword => _forKeyword; | 6069 Token get forKeyword => _forKeyword; |
| 5457 | 6070 |
| 5458 /** | 6071 /** |
| 5459 * Return the token representing the 'in' keyword. | 6072 * Return the token representing the 'in' keyword. |
| 6073 * |
| 5460 * @return the token representing the 'in' keyword | 6074 * @return the token representing the 'in' keyword |
| 5461 */ | 6075 */ |
| 5462 Token get inKeyword => _inKeyword; | 6076 Token get inKeyword => _inKeyword; |
| 5463 | 6077 |
| 5464 /** | 6078 /** |
| 5465 * Return the expression evaluated to produce the iterator. | 6079 * Return the expression evaluated to produce the iterator. |
| 6080 * |
| 5466 * @return the expression evaluated to produce the iterator | 6081 * @return the expression evaluated to produce the iterator |
| 5467 */ | 6082 */ |
| 5468 Expression get iterator => _iterator; | 6083 Expression get iterator => _iterator; |
| 5469 | 6084 |
| 5470 /** | 6085 /** |
| 5471 * Return the left parenthesis. | 6086 * Return the left parenthesis. |
| 6087 * |
| 5472 * @return the left parenthesis | 6088 * @return the left parenthesis |
| 5473 */ | 6089 */ |
| 5474 Token get leftParenthesis => _leftParenthesis; | 6090 Token get leftParenthesis => _leftParenthesis; |
| 5475 | 6091 |
| 5476 /** | 6092 /** |
| 5477 * Return the declaration of the loop variable. | 6093 * Return the declaration of the loop variable. |
| 6094 * |
| 5478 * @return the declaration of the loop variable | 6095 * @return the declaration of the loop variable |
| 5479 */ | 6096 */ |
| 5480 DeclaredIdentifier get loopVariable => _loopVariable; | 6097 DeclaredIdentifier get loopVariable => _loopVariable; |
| 5481 | 6098 |
| 5482 /** | 6099 /** |
| 5483 * Return the right parenthesis. | 6100 * Return the right parenthesis. |
| 6101 * |
| 5484 * @return the right parenthesis | 6102 * @return the right parenthesis |
| 5485 */ | 6103 */ |
| 5486 Token get rightParenthesis => _rightParenthesis; | 6104 Token get rightParenthesis => _rightParenthesis; |
| 5487 | 6105 |
| 5488 /** | 6106 /** |
| 5489 * Set the body of the loop to the given block. | 6107 * Set the body of the loop to the given block. |
| 6108 * |
| 5490 * @param body the body of the loop | 6109 * @param body the body of the loop |
| 5491 */ | 6110 */ |
| 5492 void set body(Statement body2) { | 6111 void set body(Statement body2) { |
| 5493 this._body = becomeParentOf(body2); | 6112 this._body = becomeParentOf(body2); |
| 5494 } | 6113 } |
| 5495 | 6114 |
| 5496 /** | 6115 /** |
| 5497 * Set the token representing the 'for' keyword to the given token. | 6116 * Set the token representing the 'for' keyword to the given token. |
| 6117 * |
| 5498 * @param forKeyword the token representing the 'for' keyword | 6118 * @param forKeyword the token representing the 'for' keyword |
| 5499 */ | 6119 */ |
| 5500 void set forKeyword(Token forKeyword2) { | 6120 void set forKeyword(Token forKeyword2) { |
| 5501 this._forKeyword = forKeyword2; | 6121 this._forKeyword = forKeyword2; |
| 5502 } | 6122 } |
| 5503 | 6123 |
| 5504 /** | 6124 /** |
| 5505 * Set the token representing the 'in' keyword to the given token. | 6125 * Set the token representing the 'in' keyword to the given token. |
| 6126 * |
| 5506 * @param inKeyword the token representing the 'in' keyword | 6127 * @param inKeyword the token representing the 'in' keyword |
| 5507 */ | 6128 */ |
| 5508 void set inKeyword(Token inKeyword2) { | 6129 void set inKeyword(Token inKeyword2) { |
| 5509 this._inKeyword = inKeyword2; | 6130 this._inKeyword = inKeyword2; |
| 5510 } | 6131 } |
| 5511 | 6132 |
| 5512 /** | 6133 /** |
| 5513 * Set the expression evaluated to produce the iterator to the given expressio
n. | 6134 * Set the expression evaluated to produce the iterator to the given expressio
n. |
| 6135 * |
| 5514 * @param expression the expression evaluated to produce the iterator | 6136 * @param expression the expression evaluated to produce the iterator |
| 5515 */ | 6137 */ |
| 5516 void set iterator(Expression expression) { | 6138 void set iterator(Expression expression) { |
| 5517 _iterator = becomeParentOf(expression); | 6139 _iterator = becomeParentOf(expression); |
| 5518 } | 6140 } |
| 5519 | 6141 |
| 5520 /** | 6142 /** |
| 5521 * Set the left parenthesis to the given token. | 6143 * Set the left parenthesis to the given token. |
| 6144 * |
| 5522 * @param leftParenthesis the left parenthesis | 6145 * @param leftParenthesis the left parenthesis |
| 5523 */ | 6146 */ |
| 5524 void set leftParenthesis(Token leftParenthesis2) { | 6147 void set leftParenthesis(Token leftParenthesis2) { |
| 5525 this._leftParenthesis = leftParenthesis2; | 6148 this._leftParenthesis = leftParenthesis2; |
| 5526 } | 6149 } |
| 5527 | 6150 |
| 5528 /** | 6151 /** |
| 5529 * Set the declaration of the loop variable to the given variable. | 6152 * Set the declaration of the loop variable to the given variable. |
| 6153 * |
| 5530 * @param variable the declaration of the loop variable | 6154 * @param variable the declaration of the loop variable |
| 5531 */ | 6155 */ |
| 5532 void set loopVariable(DeclaredIdentifier variable) { | 6156 void set loopVariable(DeclaredIdentifier variable) { |
| 5533 _loopVariable = becomeParentOf(variable); | 6157 _loopVariable = becomeParentOf(variable); |
| 5534 } | 6158 } |
| 5535 | 6159 |
| 5536 /** | 6160 /** |
| 5537 * Set the right parenthesis to the given token. | 6161 * Set the right parenthesis to the given token. |
| 6162 * |
| 5538 * @param rightParenthesis the right parenthesis | 6163 * @param rightParenthesis the right parenthesis |
| 5539 */ | 6164 */ |
| 5540 void set rightParenthesis(Token rightParenthesis2) { | 6165 void set rightParenthesis(Token rightParenthesis2) { |
| 5541 this._rightParenthesis = rightParenthesis2; | 6166 this._rightParenthesis = rightParenthesis2; |
| 5542 } | 6167 } |
| 5543 void visitChildren(ASTVisitor<Object> visitor) { | 6168 void visitChildren(ASTVisitor<Object> visitor) { |
| 5544 safelyVisitChild(_loopVariable, visitor); | 6169 safelyVisitChild(_loopVariable, visitor); |
| 5545 safelyVisitChild(_iterator, visitor); | 6170 safelyVisitChild(_iterator, visitor); |
| 5546 safelyVisitChild(_body, visitor); | 6171 safelyVisitChild(_body, visitor); |
| 5547 } | 6172 } |
| 5548 } | 6173 } |
| 5549 /** | 6174 /** |
| 5550 * Instances of the class `ForStatement` represent a for statement. | 6175 * Instances of the class `ForStatement` represent a for statement. |
| 6176 * |
| 5551 * <pre> | 6177 * <pre> |
| 5552 * forStatement ::= | 6178 * forStatement ::= |
| 5553 * 'for' '(' forLoopParts ')' [Statement statement]forLoopParts ::= | 6179 * 'for' '(' forLoopParts ')' [Statement] |
| 5554 * forInitializerStatement ';' [Expression expression]? ';' [Expression expressi
onList]? | 6180 * |
| 5555 * forInitializerStatement ::=[DefaultFormalParameter initializedVariableDeclara
tion]| [Expression expression]? | 6181 * forLoopParts ::= |
| 6182 * forInitializerStatement ';' [Expression]? ';' [Expression]? |
| 6183 * |
| 6184 * forInitializerStatement ::= |
| 6185 * [DefaultFormalParameter] |
| 6186 * | [Expression]? |
| 5556 * </pre> | 6187 * </pre> |
| 6188 * |
| 5557 * @coverage dart.engine.ast | 6189 * @coverage dart.engine.ast |
| 5558 */ | 6190 */ |
| 5559 class ForStatement extends Statement { | 6191 class ForStatement extends Statement { |
| 5560 | 6192 |
| 5561 /** | 6193 /** |
| 5562 * The token representing the 'for' keyword. | 6194 * The token representing the 'for' keyword. |
| 5563 */ | 6195 */ |
| 5564 Token _forKeyword; | 6196 Token _forKeyword; |
| 5565 | 6197 |
| 5566 /** | 6198 /** |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5607 */ | 6239 */ |
| 5608 Token _rightParenthesis; | 6240 Token _rightParenthesis; |
| 5609 | 6241 |
| 5610 /** | 6242 /** |
| 5611 * The body of the loop. | 6243 * The body of the loop. |
| 5612 */ | 6244 */ |
| 5613 Statement _body; | 6245 Statement _body; |
| 5614 | 6246 |
| 5615 /** | 6247 /** |
| 5616 * Initialize a newly created for statement. | 6248 * Initialize a newly created for statement. |
| 6249 * |
| 5617 * @param forKeyword the token representing the 'for' keyword | 6250 * @param forKeyword the token representing the 'for' keyword |
| 5618 * @param leftParenthesis the left parenthesis | 6251 * @param leftParenthesis the left parenthesis |
| 5619 * @param variableList the declaration of the loop variables | 6252 * @param variableList the declaration of the loop variables |
| 5620 * @param initialization the initialization expression | 6253 * @param initialization the initialization expression |
| 5621 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 6254 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
| 5622 * @param condition the condition used to determine when to terminate the loop | 6255 * @param condition the condition used to determine when to terminate the loop |
| 5623 * @param rightSeparator the semicolon separating the condition and the update
r | 6256 * @param rightSeparator the semicolon separating the condition and the update
r |
| 5624 * @param updaters the list of expressions run after each execution of the loo
p body | 6257 * @param updaters the list of expressions run after each execution of the loo
p body |
| 5625 * @param rightParenthesis the right parenthesis | 6258 * @param rightParenthesis the right parenthesis |
| 5626 * @param body the body of the loop | 6259 * @param body the body of the loop |
| 5627 */ | 6260 */ |
| 5628 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) { | 6261 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) { |
| 5629 this._updaters = new NodeList<Expression>(this); | 6262 this._updaters = new NodeList<Expression>(this); |
| 5630 this._forKeyword = forKeyword; | 6263 this._forKeyword = forKeyword; |
| 5631 this._leftParenthesis = leftParenthesis; | 6264 this._leftParenthesis = leftParenthesis; |
| 5632 this._variableList = becomeParentOf(variableList); | 6265 this._variableList = becomeParentOf(variableList); |
| 5633 this._initialization = becomeParentOf(initialization); | 6266 this._initialization = becomeParentOf(initialization); |
| 5634 this._leftSeparator = leftSeparator; | 6267 this._leftSeparator = leftSeparator; |
| 5635 this._condition = becomeParentOf(condition); | 6268 this._condition = becomeParentOf(condition); |
| 5636 this._rightSeparator = rightSeparator; | 6269 this._rightSeparator = rightSeparator; |
| 5637 this._updaters.addAll(updaters); | 6270 this._updaters.addAll(updaters); |
| 5638 this._rightParenthesis = rightParenthesis; | 6271 this._rightParenthesis = rightParenthesis; |
| 5639 this._body = becomeParentOf(body); | 6272 this._body = becomeParentOf(body); |
| 5640 } | 6273 } |
| 5641 | 6274 |
| 5642 /** | 6275 /** |
| 5643 * Initialize a newly created for statement. | 6276 * Initialize a newly created for statement. |
| 6277 * |
| 5644 * @param forKeyword the token representing the 'for' keyword | 6278 * @param forKeyword the token representing the 'for' keyword |
| 5645 * @param leftParenthesis the left parenthesis | 6279 * @param leftParenthesis the left parenthesis |
| 5646 * @param variableList the declaration of the loop variables | 6280 * @param variableList the declaration of the loop variables |
| 5647 * @param initialization the initialization expression | 6281 * @param initialization the initialization expression |
| 5648 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 6282 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
| 5649 * @param condition the condition used to determine when to terminate the loop | 6283 * @param condition the condition used to determine when to terminate the loop |
| 5650 * @param rightSeparator the semicolon separating the condition and the update
r | 6284 * @param rightSeparator the semicolon separating the condition and the update
r |
| 5651 * @param updaters the list of expressions run after each execution of the loo
p body | 6285 * @param updaters the list of expressions run after each execution of the loo
p body |
| 5652 * @param rightParenthesis the right parenthesis | 6286 * @param rightParenthesis the right parenthesis |
| 5653 * @param body the body of the loop | 6287 * @param body the body of the loop |
| 5654 */ | 6288 */ |
| 5655 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
); | 6289 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
); |
| 5656 accept(ASTVisitor visitor) => visitor.visitForStatement(this); | 6290 accept(ASTVisitor visitor) => visitor.visitForStatement(this); |
| 5657 Token get beginToken => _forKeyword; | 6291 Token get beginToken => _forKeyword; |
| 5658 | 6292 |
| 5659 /** | 6293 /** |
| 5660 * Return the body of the loop. | 6294 * Return the body of the loop. |
| 6295 * |
| 5661 * @return the body of the loop | 6296 * @return the body of the loop |
| 5662 */ | 6297 */ |
| 5663 Statement get body => _body; | 6298 Statement get body => _body; |
| 5664 | 6299 |
| 5665 /** | 6300 /** |
| 5666 * Return the condition used to determine when to terminate the loop. | 6301 * Return the condition used to determine when to terminate the loop. |
| 6302 * |
| 5667 * @return the condition used to determine when to terminate the loop | 6303 * @return the condition used to determine when to terminate the loop |
| 5668 */ | 6304 */ |
| 5669 Expression get condition => _condition; | 6305 Expression get condition => _condition; |
| 5670 Token get endToken => _body.endToken; | 6306 Token get endToken => _body.endToken; |
| 5671 | 6307 |
| 5672 /** | 6308 /** |
| 5673 * Return the token representing the 'for' keyword. | 6309 * Return the token representing the 'for' keyword. |
| 6310 * |
| 5674 * @return the token representing the 'for' keyword | 6311 * @return the token representing the 'for' keyword |
| 5675 */ | 6312 */ |
| 5676 Token get forKeyword => _forKeyword; | 6313 Token get forKeyword => _forKeyword; |
| 5677 | 6314 |
| 5678 /** | 6315 /** |
| 5679 * Return the initialization expression, or `null` if there is no initializati
on expression. | 6316 * Return the initialization expression, or `null` if there is no initializati
on expression. |
| 6317 * |
| 5680 * @return the initialization expression | 6318 * @return the initialization expression |
| 5681 */ | 6319 */ |
| 5682 Expression get initialization => _initialization; | 6320 Expression get initialization => _initialization; |
| 5683 | 6321 |
| 5684 /** | 6322 /** |
| 5685 * Return the left parenthesis. | 6323 * Return the left parenthesis. |
| 6324 * |
| 5686 * @return the left parenthesis | 6325 * @return the left parenthesis |
| 5687 */ | 6326 */ |
| 5688 Token get leftParenthesis => _leftParenthesis; | 6327 Token get leftParenthesis => _leftParenthesis; |
| 5689 | 6328 |
| 5690 /** | 6329 /** |
| 5691 * Return the semicolon separating the initializer and the condition. | 6330 * Return the semicolon separating the initializer and the condition. |
| 6331 * |
| 5692 * @return the semicolon separating the initializer and the condition | 6332 * @return the semicolon separating the initializer and the condition |
| 5693 */ | 6333 */ |
| 5694 Token get leftSeparator => _leftSeparator; | 6334 Token get leftSeparator => _leftSeparator; |
| 5695 | 6335 |
| 5696 /** | 6336 /** |
| 5697 * Return the right parenthesis. | 6337 * Return the right parenthesis. |
| 6338 * |
| 5698 * @return the right parenthesis | 6339 * @return the right parenthesis |
| 5699 */ | 6340 */ |
| 5700 Token get rightParenthesis => _rightParenthesis; | 6341 Token get rightParenthesis => _rightParenthesis; |
| 5701 | 6342 |
| 5702 /** | 6343 /** |
| 5703 * Return the semicolon separating the condition and the updater. | 6344 * Return the semicolon separating the condition and the updater. |
| 6345 * |
| 5704 * @return the semicolon separating the condition and the updater | 6346 * @return the semicolon separating the condition and the updater |
| 5705 */ | 6347 */ |
| 5706 Token get rightSeparator => _rightSeparator; | 6348 Token get rightSeparator => _rightSeparator; |
| 5707 | 6349 |
| 5708 /** | 6350 /** |
| 5709 * Return the list of expressions run after each execution of the loop body. | 6351 * Return the list of expressions run after each execution of the loop body. |
| 6352 * |
| 5710 * @return the list of expressions run after each execution of the loop body | 6353 * @return the list of expressions run after each execution of the loop body |
| 5711 */ | 6354 */ |
| 5712 NodeList<Expression> get updaters => _updaters; | 6355 NodeList<Expression> get updaters => _updaters; |
| 5713 | 6356 |
| 5714 /** | 6357 /** |
| 5715 * Return the declaration of the loop variables, or `null` if there are no var
iables. | 6358 * Return the declaration of the loop variables, or `null` if there are no var
iables. |
| 6359 * |
| 5716 * @return the declaration of the loop variables, or `null` if there are no va
riables | 6360 * @return the declaration of the loop variables, or `null` if there are no va
riables |
| 5717 */ | 6361 */ |
| 5718 VariableDeclarationList get variables => _variableList; | 6362 VariableDeclarationList get variables => _variableList; |
| 5719 | 6363 |
| 5720 /** | 6364 /** |
| 5721 * Set the body of the loop to the given statement. | 6365 * Set the body of the loop to the given statement. |
| 6366 * |
| 5722 * @param body the body of the loop | 6367 * @param body the body of the loop |
| 5723 */ | 6368 */ |
| 5724 void set body(Statement body2) { | 6369 void set body(Statement body2) { |
| 5725 this._body = becomeParentOf(body2); | 6370 this._body = becomeParentOf(body2); |
| 5726 } | 6371 } |
| 5727 | 6372 |
| 5728 /** | 6373 /** |
| 5729 * Set the condition used to determine when to terminate the loop to the given
expression. | 6374 * Set the condition used to determine when to terminate the loop to the given
expression. |
| 6375 * |
| 5730 * @param expression the condition used to determine when to terminate the loo
p | 6376 * @param expression the condition used to determine when to terminate the loo
p |
| 5731 */ | 6377 */ |
| 5732 void set condition(Expression expression) { | 6378 void set condition(Expression expression) { |
| 5733 _condition = becomeParentOf(expression); | 6379 _condition = becomeParentOf(expression); |
| 5734 } | 6380 } |
| 5735 | 6381 |
| 5736 /** | 6382 /** |
| 5737 * Set the token representing the 'for' keyword to the given token. | 6383 * Set the token representing the 'for' keyword to the given token. |
| 6384 * |
| 5738 * @param forKeyword the token representing the 'for' keyword | 6385 * @param forKeyword the token representing the 'for' keyword |
| 5739 */ | 6386 */ |
| 5740 void set forKeyword(Token forKeyword2) { | 6387 void set forKeyword(Token forKeyword2) { |
| 5741 this._forKeyword = forKeyword2; | 6388 this._forKeyword = forKeyword2; |
| 5742 } | 6389 } |
| 5743 | 6390 |
| 5744 /** | 6391 /** |
| 5745 * Set the initialization expression to the given expression. | 6392 * Set the initialization expression to the given expression. |
| 6393 * |
| 5746 * @param initialization the initialization expression | 6394 * @param initialization the initialization expression |
| 5747 */ | 6395 */ |
| 5748 void set initialization(Expression initialization2) { | 6396 void set initialization(Expression initialization2) { |
| 5749 this._initialization = becomeParentOf(initialization2); | 6397 this._initialization = becomeParentOf(initialization2); |
| 5750 } | 6398 } |
| 5751 | 6399 |
| 5752 /** | 6400 /** |
| 5753 * Set the left parenthesis to the given token. | 6401 * Set the left parenthesis to the given token. |
| 6402 * |
| 5754 * @param leftParenthesis the left parenthesis | 6403 * @param leftParenthesis the left parenthesis |
| 5755 */ | 6404 */ |
| 5756 void set leftParenthesis(Token leftParenthesis2) { | 6405 void set leftParenthesis(Token leftParenthesis2) { |
| 5757 this._leftParenthesis = leftParenthesis2; | 6406 this._leftParenthesis = leftParenthesis2; |
| 5758 } | 6407 } |
| 5759 | 6408 |
| 5760 /** | 6409 /** |
| 5761 * Set the semicolon separating the initializer and the condition to the given
token. | 6410 * Set the semicolon separating the initializer and the condition to the given
token. |
| 6411 * |
| 5762 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 6412 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
| 5763 */ | 6413 */ |
| 5764 void set leftSeparator(Token leftSeparator2) { | 6414 void set leftSeparator(Token leftSeparator2) { |
| 5765 this._leftSeparator = leftSeparator2; | 6415 this._leftSeparator = leftSeparator2; |
| 5766 } | 6416 } |
| 5767 | 6417 |
| 5768 /** | 6418 /** |
| 5769 * Set the right parenthesis to the given token. | 6419 * Set the right parenthesis to the given token. |
| 6420 * |
| 5770 * @param rightParenthesis the right parenthesis | 6421 * @param rightParenthesis the right parenthesis |
| 5771 */ | 6422 */ |
| 5772 void set rightParenthesis(Token rightParenthesis2) { | 6423 void set rightParenthesis(Token rightParenthesis2) { |
| 5773 this._rightParenthesis = rightParenthesis2; | 6424 this._rightParenthesis = rightParenthesis2; |
| 5774 } | 6425 } |
| 5775 | 6426 |
| 5776 /** | 6427 /** |
| 5777 * Set the semicolon separating the condition and the updater to the given tok
en. | 6428 * Set the semicolon separating the condition and the updater to the given tok
en. |
| 6429 * |
| 5778 * @param rightSeparator the semicolon separating the condition and the update
r | 6430 * @param rightSeparator the semicolon separating the condition and the update
r |
| 5779 */ | 6431 */ |
| 5780 void set rightSeparator(Token rightSeparator2) { | 6432 void set rightSeparator(Token rightSeparator2) { |
| 5781 this._rightSeparator = rightSeparator2; | 6433 this._rightSeparator = rightSeparator2; |
| 5782 } | 6434 } |
| 5783 | 6435 |
| 5784 /** | 6436 /** |
| 5785 * Set the declaration of the loop variables to the given parameter. | 6437 * Set the declaration of the loop variables to the given parameter. |
| 6438 * |
| 5786 * @param variableList the declaration of the loop variables | 6439 * @param variableList the declaration of the loop variables |
| 5787 */ | 6440 */ |
| 5788 void set variables(VariableDeclarationList variableList) { | 6441 void set variables(VariableDeclarationList variableList) { |
| 5789 variableList = becomeParentOf(variableList); | 6442 variableList = becomeParentOf(variableList); |
| 5790 } | 6443 } |
| 5791 void visitChildren(ASTVisitor<Object> visitor) { | 6444 void visitChildren(ASTVisitor<Object> visitor) { |
| 5792 safelyVisitChild(_variableList, visitor); | 6445 safelyVisitChild(_variableList, visitor); |
| 5793 safelyVisitChild(_initialization, visitor); | 6446 safelyVisitChild(_initialization, visitor); |
| 5794 safelyVisitChild(_condition, visitor); | 6447 safelyVisitChild(_condition, visitor); |
| 5795 _updaters.accept(visitor); | 6448 _updaters.accept(visitor); |
| 5796 safelyVisitChild(_body, visitor); | 6449 safelyVisitChild(_body, visitor); |
| 5797 } | 6450 } |
| 5798 } | 6451 } |
| 5799 /** | 6452 /** |
| 5800 * The abstract class `FormalParameter` defines the behavior of objects represen
ting a | 6453 * The abstract class `FormalParameter` defines the behavior of objects represen
ting a |
| 5801 * parameter to a function. | 6454 * parameter to a function. |
| 6455 * |
| 5802 * <pre> | 6456 * <pre> |
| 5803 * formalParameter ::=[NormalFormalParameter normalFormalParameter]| [DefaultFor
malParameter namedFormalParameter]| [DefaultFormalParameter optionalFormalParame
ter]</pre> | 6457 * formalParameter ::= |
| 6458 * [NormalFormalParameter] |
| 6459 * | [DefaultFormalParameter] |
| 6460 * | [DefaultFormalParameter] |
| 6461 * </pre> |
| 6462 * |
| 5804 * @coverage dart.engine.ast | 6463 * @coverage dart.engine.ast |
| 5805 */ | 6464 */ |
| 5806 abstract class FormalParameter extends ASTNode { | 6465 abstract class FormalParameter extends ASTNode { |
| 5807 | 6466 |
| 5808 /** | 6467 /** |
| 5809 * Return the element representing this parameter, or `null` if this parameter
has not been | 6468 * Return the element representing this parameter, or `null` if this parameter
has not been |
| 5810 * resolved. | 6469 * resolved. |
| 6470 * |
| 5811 * @return the element representing this parameter | 6471 * @return the element representing this parameter |
| 5812 */ | 6472 */ |
| 5813 ParameterElement get element { | 6473 ParameterElement get element { |
| 5814 SimpleIdentifier identifier = this.identifier; | 6474 SimpleIdentifier identifier = this.identifier; |
| 5815 if (identifier == null) { | 6475 if (identifier == null) { |
| 5816 return null; | 6476 return null; |
| 5817 } | 6477 } |
| 5818 return identifier.element as ParameterElement; | 6478 return identifier.element as ParameterElement; |
| 5819 } | 6479 } |
| 5820 | 6480 |
| 5821 /** | 6481 /** |
| 5822 * Return the name of the parameter being declared. | 6482 * Return the name of the parameter being declared. |
| 6483 * |
| 5823 * @return the name of the parameter being declared | 6484 * @return the name of the parameter being declared |
| 5824 */ | 6485 */ |
| 5825 SimpleIdentifier get identifier; | 6486 SimpleIdentifier get identifier; |
| 5826 | 6487 |
| 5827 /** | 6488 /** |
| 5828 * Return the kind of this parameter. | 6489 * Return the kind of this parameter. |
| 6490 * |
| 5829 * @return the kind of this parameter | 6491 * @return the kind of this parameter |
| 5830 */ | 6492 */ |
| 5831 ParameterKind get kind; | 6493 ParameterKind get kind; |
| 5832 } | 6494 } |
| 5833 /** | 6495 /** |
| 5834 * Instances of the class `FormalParameterList` represent the formal parameter l
ist of a | 6496 * Instances of the class `FormalParameterList` represent the formal parameter l
ist of a |
| 5835 * method declaration, function declaration, or function type alias. | 6497 * method declaration, function declaration, or function type alias. |
| 5836 * | 6498 * |
| 5837 * While the grammar requires all optional formal parameters to follow all of th
e normal formal | 6499 * While the grammar requires all optional formal parameters to follow all of th
e normal formal |
| 5838 * parameters and at most one grouping of optional formal parameters, this class
does not enforce | 6500 * parameters and at most one grouping of optional formal parameters, this class
does not enforce |
| 5839 * those constraints. All parameters are flattened into a single list, which can
have any or all | 6501 * those constraints. All parameters are flattened into a single list, which can
have any or all |
| 5840 * kinds of parameters (normal, named, and positional) in any order. | 6502 * kinds of parameters (normal, named, and positional) in any order. |
| 6503 * |
| 5841 * <pre> | 6504 * <pre> |
| 5842 * formalParameterList ::= | 6505 * formalParameterList ::= |
| 5843 * '(' ')' | 6506 * '(' ')' |
| 5844 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' | 6507 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' |
| 5845 * | '(' optionalFormalParameters ')' | 6508 * | '(' optionalFormalParameters ')' |
| 5846 * normalFormalParameters ::=[NormalFormalParameter normalFormalParameter] (','
[NormalFormalParameter normalFormalParameter]) | 6509 * |
| 6510 * normalFormalParameters ::= |
| 6511 * [NormalFormalParameter] (',' [NormalFormalParameter])* |
| 6512 * |
| 5847 * optionalFormalParameters ::= | 6513 * optionalFormalParameters ::= |
| 5848 * optionalPositionalFormalParameters | 6514 * optionalPositionalFormalParameters |
| 5849 * | namedFormalParameters | 6515 * | namedFormalParameters |
| 6516 * |
| 5850 * optionalPositionalFormalParameters ::= | 6517 * optionalPositionalFormalParameters ::= |
| 5851 * '\[' [DefaultFormalParameter positionalFormalParameter] (',' [DefaultFormalPa
rameter positionalFormalParameter])* '\]' | 6518 * '[' [DefaultFormalParameter] (',' [DefaultFormalParameter])* ']' |
| 6519 * |
| 5852 * namedFormalParameters ::= | 6520 * namedFormalParameters ::= |
| 5853 * '{' [DefaultFormalParameter namedFormalParameter] (',' [DefaultFormalParamete
r namedFormalParameter])* '}' | 6521 * '{' [DefaultFormalParameter] (',' [DefaultFormalParameter])* '}' |
| 5854 * </pre> | 6522 * </pre> |
| 6523 * |
| 5855 * @coverage dart.engine.ast | 6524 * @coverage dart.engine.ast |
| 5856 */ | 6525 */ |
| 5857 class FormalParameterList extends ASTNode { | 6526 class FormalParameterList extends ASTNode { |
| 5858 | 6527 |
| 5859 /** | 6528 /** |
| 5860 * The left parenthesis. | 6529 * The left parenthesis. |
| 5861 */ | 6530 */ |
| 5862 Token _leftParenthesis; | 6531 Token _leftParenthesis; |
| 5863 | 6532 |
| 5864 /** | 6533 /** |
| 5865 * The parameters associated with the method. | 6534 * The parameters associated with the method. |
| 5866 */ | 6535 */ |
| 5867 NodeList<FormalParameter> _parameters; | 6536 NodeList<FormalParameter> _parameters; |
| 5868 | 6537 |
| 5869 /** | 6538 /** |
| 5870 * The left square bracket ('\[') or left curly brace ('{') introducing the op
tional parameters. | 6539 * The left square bracket ('[') or left curly brace ('{') introducing the opt
ional parameters. |
| 5871 */ | 6540 */ |
| 5872 Token _leftDelimiter; | 6541 Token _leftDelimiter; |
| 5873 | 6542 |
| 5874 /** | 6543 /** |
| 5875 * The right square bracket ('\]') or right curly brace ('}') introducing the
optional parameters. | 6544 * The right square bracket (']') or right curly brace ('}') introducing the o
ptional parameters. |
| 5876 */ | 6545 */ |
| 5877 Token _rightDelimiter; | 6546 Token _rightDelimiter; |
| 5878 | 6547 |
| 5879 /** | 6548 /** |
| 5880 * The right parenthesis. | 6549 * The right parenthesis. |
| 5881 */ | 6550 */ |
| 5882 Token _rightParenthesis; | 6551 Token _rightParenthesis; |
| 5883 | 6552 |
| 5884 /** | 6553 /** |
| 5885 * Initialize a newly created parameter list. | 6554 * Initialize a newly created parameter list. |
| 6555 * |
| 5886 * @param leftParenthesis the left parenthesis | 6556 * @param leftParenthesis the left parenthesis |
| 5887 * @param parameters the parameters associated with the method | 6557 * @param parameters the parameters associated with the method |
| 5888 * @param leftDelimiter the left delimiter introducing the optional parameters | 6558 * @param leftDelimiter the left delimiter introducing the optional parameters |
| 5889 * @param rightDelimiter the right delimiter introducing the optional paramete
rs | 6559 * @param rightDelimiter the right delimiter introducing the optional paramete
rs |
| 5890 * @param rightParenthesis the right parenthesis | 6560 * @param rightParenthesis the right parenthesis |
| 5891 */ | 6561 */ |
| 5892 FormalParameterList.full(Token leftParenthesis, List<FormalParameter> paramete
rs, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis) { | 6562 FormalParameterList.full(Token leftParenthesis, List<FormalParameter> paramete
rs, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis) { |
| 5893 this._parameters = new NodeList<FormalParameter>(this); | 6563 this._parameters = new NodeList<FormalParameter>(this); |
| 5894 this._leftParenthesis = leftParenthesis; | 6564 this._leftParenthesis = leftParenthesis; |
| 5895 this._parameters.addAll(parameters); | 6565 this._parameters.addAll(parameters); |
| 5896 this._leftDelimiter = leftDelimiter; | 6566 this._leftDelimiter = leftDelimiter; |
| 5897 this._rightDelimiter = rightDelimiter; | 6567 this._rightDelimiter = rightDelimiter; |
| 5898 this._rightParenthesis = rightParenthesis; | 6568 this._rightParenthesis = rightParenthesis; |
| 5899 } | 6569 } |
| 5900 | 6570 |
| 5901 /** | 6571 /** |
| 5902 * Initialize a newly created parameter list. | 6572 * Initialize a newly created parameter list. |
| 6573 * |
| 5903 * @param leftParenthesis the left parenthesis | 6574 * @param leftParenthesis the left parenthesis |
| 5904 * @param parameters the parameters associated with the method | 6575 * @param parameters the parameters associated with the method |
| 5905 * @param leftDelimiter the left delimiter introducing the optional parameters | 6576 * @param leftDelimiter the left delimiter introducing the optional parameters |
| 5906 * @param rightDelimiter the right delimiter introducing the optional paramete
rs | 6577 * @param rightDelimiter the right delimiter introducing the optional paramete
rs |
| 5907 * @param rightParenthesis the right parenthesis | 6578 * @param rightParenthesis the right parenthesis |
| 5908 */ | 6579 */ |
| 5909 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters,
Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full(
leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis); | 6580 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters,
Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full(
leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis); |
| 5910 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); | 6581 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); |
| 5911 Token get beginToken => _leftParenthesis; | 6582 Token get beginToken => _leftParenthesis; |
| 5912 | 6583 |
| 5913 /** | 6584 /** |
| 5914 * Return an array containing the elements representing the parameters in this
list. The array | 6585 * Return an array containing the elements representing the parameters in this
list. The array |
| 5915 * will contain `null`s if the parameters in this list have not been resolved. | 6586 * will contain `null`s if the parameters in this list have not been resolved. |
| 6587 * |
| 5916 * @return the elements representing the parameters in this list | 6588 * @return the elements representing the parameters in this list |
| 5917 */ | 6589 */ |
| 5918 List<ParameterElement> get elements { | 6590 List<ParameterElement> get elements { |
| 5919 int count = _parameters.length; | 6591 int count = _parameters.length; |
| 5920 List<ParameterElement> types = new List<ParameterElement>(count); | 6592 List<ParameterElement> types = new List<ParameterElement>(count); |
| 5921 for (int i = 0; i < count; i++) { | 6593 for (int i = 0; i < count; i++) { |
| 5922 types[i] = _parameters[i].element; | 6594 types[i] = _parameters[i].element; |
| 5923 } | 6595 } |
| 5924 return types; | 6596 return types; |
| 5925 } | 6597 } |
| 5926 Token get endToken => _rightParenthesis; | 6598 Token get endToken => _rightParenthesis; |
| 5927 | 6599 |
| 5928 /** | 6600 /** |
| 5929 * Return the left square bracket ('\[') or left curly brace ('{') introducing
the optional | 6601 * Return the left square bracket ('[') or left curly brace ('{') introducing
the optional |
| 5930 * parameters. | 6602 * parameters. |
| 5931 * @return the left square bracket ('\[') or left curly brace ('{') introducin
g the optional | 6603 * |
| 5932 * parameters | 6604 * @return the left square bracket ('[') or left curly brace ('{') introducing
the optional |
| 6605 * parameters |
| 5933 */ | 6606 */ |
| 5934 Token get leftDelimiter => _leftDelimiter; | 6607 Token get leftDelimiter => _leftDelimiter; |
| 5935 | 6608 |
| 5936 /** | 6609 /** |
| 5937 * Return the left parenthesis. | 6610 * Return the left parenthesis. |
| 6611 * |
| 5938 * @return the left parenthesis | 6612 * @return the left parenthesis |
| 5939 */ | 6613 */ |
| 5940 Token get leftParenthesis => _leftParenthesis; | 6614 Token get leftParenthesis => _leftParenthesis; |
| 5941 | 6615 |
| 5942 /** | 6616 /** |
| 5943 * Return the parameters associated with the method. | 6617 * Return the parameters associated with the method. |
| 6618 * |
| 5944 * @return the parameters associated with the method | 6619 * @return the parameters associated with the method |
| 5945 */ | 6620 */ |
| 5946 NodeList<FormalParameter> get parameters => _parameters; | 6621 NodeList<FormalParameter> get parameters => _parameters; |
| 5947 | 6622 |
| 5948 /** | 6623 /** |
| 5949 * Return the right square bracket ('\]') or right curly brace ('}') introduci
ng the optional | 6624 * Return the right square bracket (']') or right curly brace ('}') introducin
g the optional |
| 5950 * parameters. | 6625 * parameters. |
| 5951 * @return the right square bracket ('\]') or right curly brace ('}') introduc
ing the optional | 6626 * |
| 5952 * parameters | 6627 * @return the right square bracket (']') or right curly brace ('}') introduci
ng the optional |
| 6628 * parameters |
| 5953 */ | 6629 */ |
| 5954 Token get rightDelimiter => _rightDelimiter; | 6630 Token get rightDelimiter => _rightDelimiter; |
| 5955 | 6631 |
| 5956 /** | 6632 /** |
| 5957 * Return the right parenthesis. | 6633 * Return the right parenthesis. |
| 6634 * |
| 5958 * @return the right parenthesis | 6635 * @return the right parenthesis |
| 5959 */ | 6636 */ |
| 5960 Token get rightParenthesis => _rightParenthesis; | 6637 Token get rightParenthesis => _rightParenthesis; |
| 5961 | 6638 |
| 5962 /** | 6639 /** |
| 5963 * Set the left square bracket ('\[') or left curly brace ('{') introducing th
e optional parameters | 6640 * Set the left square bracket ('[') or left curly brace ('{') introducing the
optional parameters |
| 5964 * to the given token. | 6641 * to the given token. |
| 6642 * |
| 5965 * @param bracket the left delimiter introducing the optional parameters | 6643 * @param bracket the left delimiter introducing the optional parameters |
| 5966 */ | 6644 */ |
| 5967 void set leftDelimiter(Token bracket) { | 6645 void set leftDelimiter(Token bracket) { |
| 5968 _leftDelimiter = bracket; | 6646 _leftDelimiter = bracket; |
| 5969 } | 6647 } |
| 5970 | 6648 |
| 5971 /** | 6649 /** |
| 5972 * Set the left parenthesis to the given token. | 6650 * Set the left parenthesis to the given token. |
| 6651 * |
| 5973 * @param parenthesis the left parenthesis | 6652 * @param parenthesis the left parenthesis |
| 5974 */ | 6653 */ |
| 5975 void set leftParenthesis(Token parenthesis) { | 6654 void set leftParenthesis(Token parenthesis) { |
| 5976 _leftParenthesis = parenthesis; | 6655 _leftParenthesis = parenthesis; |
| 5977 } | 6656 } |
| 5978 | 6657 |
| 5979 /** | 6658 /** |
| 5980 * Set the right square bracket ('\]') or right curly brace ('}') introducing
the optional | 6659 * Set the right square bracket (']') or right curly brace ('}') introducing t
he optional |
| 5981 * parameters to the given token. | 6660 * parameters to the given token. |
| 6661 * |
| 5982 * @param bracket the right delimiter introducing the optional parameters | 6662 * @param bracket the right delimiter introducing the optional parameters |
| 5983 */ | 6663 */ |
| 5984 void set rightDelimiter(Token bracket) { | 6664 void set rightDelimiter(Token bracket) { |
| 5985 _rightDelimiter = bracket; | 6665 _rightDelimiter = bracket; |
| 5986 } | 6666 } |
| 5987 | 6667 |
| 5988 /** | 6668 /** |
| 5989 * Set the right parenthesis to the given token. | 6669 * Set the right parenthesis to the given token. |
| 6670 * |
| 5990 * @param parenthesis the right parenthesis | 6671 * @param parenthesis the right parenthesis |
| 5991 */ | 6672 */ |
| 5992 void set rightParenthesis(Token parenthesis) { | 6673 void set rightParenthesis(Token parenthesis) { |
| 5993 _rightParenthesis = parenthesis; | 6674 _rightParenthesis = parenthesis; |
| 5994 } | 6675 } |
| 5995 void visitChildren(ASTVisitor<Object> visitor) { | 6676 void visitChildren(ASTVisitor<Object> visitor) { |
| 5996 _parameters.accept(visitor); | 6677 _parameters.accept(visitor); |
| 5997 } | 6678 } |
| 5998 } | 6679 } |
| 5999 /** | 6680 /** |
| 6000 * The abstract class `FunctionBody` defines the behavior common to objects repr
esenting the | 6681 * The abstract class `FunctionBody` defines the behavior common to objects repr
esenting the |
| 6001 * body of a function or method. | 6682 * body of a function or method. |
| 6683 * |
| 6002 * <pre> | 6684 * <pre> |
| 6003 * functionBody ::=[BlockFunctionBody blockFunctionBody]| [EmptyFunctionBody emp
tyFunctionBody]| [ExpressionFunctionBody expressionFunctionBody]</pre> | 6685 * functionBody ::= |
| 6686 * [BlockFunctionBody] |
| 6687 * | [EmptyFunctionBody] |
| 6688 * | [ExpressionFunctionBody] |
| 6689 * </pre> |
| 6690 * |
| 6004 * @coverage dart.engine.ast | 6691 * @coverage dart.engine.ast |
| 6005 */ | 6692 */ |
| 6006 abstract class FunctionBody extends ASTNode { | 6693 abstract class FunctionBody extends ASTNode { |
| 6007 } | 6694 } |
| 6008 /** | 6695 /** |
| 6009 * Instances of the class `FunctionDeclaration` wrap a [FunctionExpression funct
ion | 6696 * Instances of the class `FunctionDeclaration` wrap a [FunctionExpression] as a
top-level declaration. |
| 6010 * expression] as a top-level declaration. | 6697 * |
| 6011 * <pre> | 6698 * <pre> |
| 6012 * functionDeclaration ::= | 6699 * functionDeclaration ::= |
| 6013 * 'external' functionSignature | 6700 * 'external' functionSignature |
| 6014 * | functionSignature [FunctionBody functionBody]functionSignature ::=[Type ret
urnType]? ('get' | 'set')? [SimpleIdentifier functionName] [FormalParameterList
formalParameterList]</pre> | 6701 * | functionSignature [FunctionBody] |
| 6702 * |
| 6703 * functionSignature ::= |
| 6704 * [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList] |
| 6705 * </pre> |
| 6706 * |
| 6015 * @coverage dart.engine.ast | 6707 * @coverage dart.engine.ast |
| 6016 */ | 6708 */ |
| 6017 class FunctionDeclaration extends CompilationUnitMember { | 6709 class FunctionDeclaration extends CompilationUnitMember { |
| 6018 | 6710 |
| 6019 /** | 6711 /** |
| 6020 * The token representing the 'external' keyword, or `null` if this is not an
external | 6712 * The token representing the 'external' keyword, or `null` if this is not an
external |
| 6021 * function. | 6713 * function. |
| 6022 */ | 6714 */ |
| 6023 Token _externalKeyword; | 6715 Token _externalKeyword; |
| 6024 | 6716 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 6038 */ | 6730 */ |
| 6039 SimpleIdentifier _name; | 6731 SimpleIdentifier _name; |
| 6040 | 6732 |
| 6041 /** | 6733 /** |
| 6042 * The function expression being wrapped. | 6734 * The function expression being wrapped. |
| 6043 */ | 6735 */ |
| 6044 FunctionExpression _functionExpression; | 6736 FunctionExpression _functionExpression; |
| 6045 | 6737 |
| 6046 /** | 6738 /** |
| 6047 * Initialize a newly created function declaration. | 6739 * Initialize a newly created function declaration. |
| 6740 * |
| 6048 * @param comment the documentation comment associated with this function | 6741 * @param comment the documentation comment associated with this function |
| 6049 * @param metadata the annotations associated with this function | 6742 * @param metadata the annotations associated with this function |
| 6050 * @param externalKeyword the token representing the 'external' keyword | 6743 * @param externalKeyword the token representing the 'external' keyword |
| 6051 * @param returnType the return type of the function | 6744 * @param returnType the return type of the function |
| 6052 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 6745 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 6053 * @param name the name of the function | 6746 * @param name the name of the function |
| 6054 * @param functionExpression the function expression being wrapped | 6747 * @param functionExpression the function expression being wrapped |
| 6055 */ | 6748 */ |
| 6056 FunctionDeclaration.full(Comment comment, List<Annotation> metadata, Token ext
ernalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name,
FunctionExpression functionExpression) : super.full(comment, metadata) { | 6749 FunctionDeclaration.full(Comment comment, List<Annotation> metadata, Token ext
ernalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name,
FunctionExpression functionExpression) : super.full(comment, metadata) { |
| 6057 this._externalKeyword = externalKeyword; | 6750 this._externalKeyword = externalKeyword; |
| 6058 this._returnType = becomeParentOf(returnType); | 6751 this._returnType = becomeParentOf(returnType); |
| 6059 this._propertyKeyword = propertyKeyword; | 6752 this._propertyKeyword = propertyKeyword; |
| 6060 this._name = becomeParentOf(name); | 6753 this._name = becomeParentOf(name); |
| 6061 this._functionExpression = becomeParentOf(functionExpression); | 6754 this._functionExpression = becomeParentOf(functionExpression); |
| 6062 } | 6755 } |
| 6063 | 6756 |
| 6064 /** | 6757 /** |
| 6065 * Initialize a newly created function declaration. | 6758 * Initialize a newly created function declaration. |
| 6759 * |
| 6066 * @param comment the documentation comment associated with this function | 6760 * @param comment the documentation comment associated with this function |
| 6067 * @param metadata the annotations associated with this function | 6761 * @param metadata the annotations associated with this function |
| 6068 * @param externalKeyword the token representing the 'external' keyword | 6762 * @param externalKeyword the token representing the 'external' keyword |
| 6069 * @param returnType the return type of the function | 6763 * @param returnType the return type of the function |
| 6070 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 6764 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 6071 * @param name the name of the function | 6765 * @param name the name of the function |
| 6072 * @param functionExpression the function expression being wrapped | 6766 * @param functionExpression the function expression being wrapped |
| 6073 */ | 6767 */ |
| 6074 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); | 6768 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); |
| 6075 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); | 6769 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); |
| 6076 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; | 6770 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; |
| 6077 Token get endToken => _functionExpression.endToken; | 6771 Token get endToken => _functionExpression.endToken; |
| 6078 | 6772 |
| 6079 /** | 6773 /** |
| 6080 * Return the token representing the 'external' keyword, or `null` if this is
not an | 6774 * Return the token representing the 'external' keyword, or `null` if this is
not an |
| 6081 * external function. | 6775 * external function. |
| 6776 * |
| 6082 * @return the token representing the 'external' keyword | 6777 * @return the token representing the 'external' keyword |
| 6083 */ | 6778 */ |
| 6084 Token get externalKeyword => _externalKeyword; | 6779 Token get externalKeyword => _externalKeyword; |
| 6085 | 6780 |
| 6086 /** | 6781 /** |
| 6087 * Return the function expression being wrapped. | 6782 * Return the function expression being wrapped. |
| 6783 * |
| 6088 * @return the function expression being wrapped | 6784 * @return the function expression being wrapped |
| 6089 */ | 6785 */ |
| 6090 FunctionExpression get functionExpression => _functionExpression; | 6786 FunctionExpression get functionExpression => _functionExpression; |
| 6091 | 6787 |
| 6092 /** | 6788 /** |
| 6093 * Return the name of the function, or `null` if the function is not named. | 6789 * Return the name of the function, or `null` if the function is not named. |
| 6790 * |
| 6094 * @return the name of the function | 6791 * @return the name of the function |
| 6095 */ | 6792 */ |
| 6096 SimpleIdentifier get name => _name; | 6793 SimpleIdentifier get name => _name; |
| 6097 | 6794 |
| 6098 /** | 6795 /** |
| 6099 * Return the token representing the 'get' or 'set' keyword, or `null` if this
is a function | 6796 * Return the token representing the 'get' or 'set' keyword, or `null` if this
is a function |
| 6100 * declaration rather than a property declaration. | 6797 * declaration rather than a property declaration. |
| 6798 * |
| 6101 * @return the token representing the 'get' or 'set' keyword | 6799 * @return the token representing the 'get' or 'set' keyword |
| 6102 */ | 6800 */ |
| 6103 Token get propertyKeyword => _propertyKeyword; | 6801 Token get propertyKeyword => _propertyKeyword; |
| 6104 | 6802 |
| 6105 /** | 6803 /** |
| 6106 * Return the return type of the function, or `null` if no return type was dec
lared. | 6804 * Return the return type of the function, or `null` if no return type was dec
lared. |
| 6805 * |
| 6107 * @return the return type of the function | 6806 * @return the return type of the function |
| 6108 */ | 6807 */ |
| 6109 TypeName get returnType => _returnType; | 6808 TypeName get returnType => _returnType; |
| 6110 | 6809 |
| 6111 /** | 6810 /** |
| 6112 * Return `true` if this function declares a getter. | 6811 * Return `true` if this function declares a getter. |
| 6812 * |
| 6113 * @return `true` if this function declares a getter | 6813 * @return `true` if this function declares a getter |
| 6114 */ | 6814 */ |
| 6115 bool get isGetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.GET); | 6815 bool get isGetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.GET); |
| 6116 | 6816 |
| 6117 /** | 6817 /** |
| 6118 * Return `true` if this function declares a setter. | 6818 * Return `true` if this function declares a setter. |
| 6819 * |
| 6119 * @return `true` if this function declares a setter | 6820 * @return `true` if this function declares a setter |
| 6120 */ | 6821 */ |
| 6121 bool get isSetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.SET); | 6822 bool get isSetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.SET); |
| 6122 | 6823 |
| 6123 /** | 6824 /** |
| 6124 * Set the token representing the 'external' keyword to the given token. | 6825 * Set the token representing the 'external' keyword to the given token. |
| 6826 * |
| 6125 * @param externalKeyword the token representing the 'external' keyword | 6827 * @param externalKeyword the token representing the 'external' keyword |
| 6126 */ | 6828 */ |
| 6127 void set externalKeyword(Token externalKeyword2) { | 6829 void set externalKeyword(Token externalKeyword2) { |
| 6128 this._externalKeyword = externalKeyword2; | 6830 this._externalKeyword = externalKeyword2; |
| 6129 } | 6831 } |
| 6130 | 6832 |
| 6131 /** | 6833 /** |
| 6132 * Set the function expression being wrapped to the given function expression. | 6834 * Set the function expression being wrapped to the given function expression. |
| 6835 * |
| 6133 * @param functionExpression the function expression being wrapped | 6836 * @param functionExpression the function expression being wrapped |
| 6134 */ | 6837 */ |
| 6135 void set functionExpression(FunctionExpression functionExpression2) { | 6838 void set functionExpression(FunctionExpression functionExpression2) { |
| 6136 functionExpression2 = becomeParentOf(functionExpression2); | 6839 functionExpression2 = becomeParentOf(functionExpression2); |
| 6137 } | 6840 } |
| 6138 | 6841 |
| 6139 /** | 6842 /** |
| 6140 * Set the name of the function to the given identifier. | 6843 * Set the name of the function to the given identifier. |
| 6844 * |
| 6141 * @param identifier the name of the function | 6845 * @param identifier the name of the function |
| 6142 */ | 6846 */ |
| 6143 void set name(SimpleIdentifier identifier) { | 6847 void set name(SimpleIdentifier identifier) { |
| 6144 _name = becomeParentOf(identifier); | 6848 _name = becomeParentOf(identifier); |
| 6145 } | 6849 } |
| 6146 | 6850 |
| 6147 /** | 6851 /** |
| 6148 * Set the token representing the 'get' or 'set' keyword to the given token. | 6852 * Set the token representing the 'get' or 'set' keyword to the given token. |
| 6853 * |
| 6149 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 6854 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 6150 */ | 6855 */ |
| 6151 void set propertyKeyword(Token propertyKeyword2) { | 6856 void set propertyKeyword(Token propertyKeyword2) { |
| 6152 this._propertyKeyword = propertyKeyword2; | 6857 this._propertyKeyword = propertyKeyword2; |
| 6153 } | 6858 } |
| 6154 | 6859 |
| 6155 /** | 6860 /** |
| 6156 * Set the return type of the function to the given name. | 6861 * Set the return type of the function to the given name. |
| 6862 * |
| 6157 * @param name the return type of the function | 6863 * @param name the return type of the function |
| 6158 */ | 6864 */ |
| 6159 void set returnType(TypeName name) { | 6865 void set returnType(TypeName name) { |
| 6160 _returnType = becomeParentOf(name); | 6866 _returnType = becomeParentOf(name); |
| 6161 } | 6867 } |
| 6162 void visitChildren(ASTVisitor<Object> visitor) { | 6868 void visitChildren(ASTVisitor<Object> visitor) { |
| 6163 super.visitChildren(visitor); | 6869 super.visitChildren(visitor); |
| 6164 safelyVisitChild(_returnType, visitor); | 6870 safelyVisitChild(_returnType, visitor); |
| 6165 safelyVisitChild(_name, visitor); | 6871 safelyVisitChild(_name, visitor); |
| 6166 safelyVisitChild(_functionExpression, visitor); | 6872 safelyVisitChild(_functionExpression, visitor); |
| 6167 } | 6873 } |
| 6168 Token get firstTokenAfterCommentAndMetadata { | 6874 Token get firstTokenAfterCommentAndMetadata { |
| 6169 if (_externalKeyword != null) { | 6875 if (_externalKeyword != null) { |
| 6170 return _externalKeyword; | 6876 return _externalKeyword; |
| 6171 } | 6877 } |
| 6172 if (_returnType != null) { | 6878 if (_returnType != null) { |
| 6173 return _returnType.beginToken; | 6879 return _returnType.beginToken; |
| 6174 } else if (_propertyKeyword != null) { | 6880 } else if (_propertyKeyword != null) { |
| 6175 return _propertyKeyword; | 6881 return _propertyKeyword; |
| 6176 } else if (_name != null) { | 6882 } else if (_name != null) { |
| 6177 return _name.beginToken; | 6883 return _name.beginToken; |
| 6178 } | 6884 } |
| 6179 return _functionExpression.beginToken; | 6885 return _functionExpression.beginToken; |
| 6180 } | 6886 } |
| 6181 } | 6887 } |
| 6182 /** | 6888 /** |
| 6183 * Instances of the class `FunctionDeclarationStatement` wrap a [FunctionDeclara
tionfunction declaration] as a statement. | 6889 * Instances of the class `FunctionDeclarationStatement` wrap a [FunctionDeclara
tion |
| 6890 ] as a statement. |
| 6891 * |
| 6184 * @coverage dart.engine.ast | 6892 * @coverage dart.engine.ast |
| 6185 */ | 6893 */ |
| 6186 class FunctionDeclarationStatement extends Statement { | 6894 class FunctionDeclarationStatement extends Statement { |
| 6187 | 6895 |
| 6188 /** | 6896 /** |
| 6189 * The function declaration being wrapped. | 6897 * The function declaration being wrapped. |
| 6190 */ | 6898 */ |
| 6191 FunctionDeclaration _functionDeclaration; | 6899 FunctionDeclaration _functionDeclaration; |
| 6192 | 6900 |
| 6193 /** | 6901 /** |
| 6194 * Initialize a newly created function declaration statement. | 6902 * Initialize a newly created function declaration statement. |
| 6903 * |
| 6195 * @param functionDeclaration the the function declaration being wrapped | 6904 * @param functionDeclaration the the function declaration being wrapped |
| 6196 */ | 6905 */ |
| 6197 FunctionDeclarationStatement.full(FunctionDeclaration functionDeclaration) { | 6906 FunctionDeclarationStatement.full(FunctionDeclaration functionDeclaration) { |
| 6198 this._functionDeclaration = becomeParentOf(functionDeclaration); | 6907 this._functionDeclaration = becomeParentOf(functionDeclaration); |
| 6199 } | 6908 } |
| 6200 | 6909 |
| 6201 /** | 6910 /** |
| 6202 * Initialize a newly created function declaration statement. | 6911 * Initialize a newly created function declaration statement. |
| 6912 * |
| 6203 * @param functionDeclaration the the function declaration being wrapped | 6913 * @param functionDeclaration the the function declaration being wrapped |
| 6204 */ | 6914 */ |
| 6205 FunctionDeclarationStatement({FunctionDeclaration functionDeclaration}) : this
.full(functionDeclaration); | 6915 FunctionDeclarationStatement({FunctionDeclaration functionDeclaration}) : this
.full(functionDeclaration); |
| 6206 accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); | 6916 accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); |
| 6207 Token get beginToken => _functionDeclaration.beginToken; | 6917 Token get beginToken => _functionDeclaration.beginToken; |
| 6208 Token get endToken => _functionDeclaration.endToken; | 6918 Token get endToken => _functionDeclaration.endToken; |
| 6209 | 6919 |
| 6210 /** | 6920 /** |
| 6211 * Return the function declaration being wrapped. | 6921 * Return the function declaration being wrapped. |
| 6922 * |
| 6212 * @return the function declaration being wrapped | 6923 * @return the function declaration being wrapped |
| 6213 */ | 6924 */ |
| 6214 FunctionDeclaration get functionDeclaration => _functionDeclaration; | 6925 FunctionDeclaration get functionDeclaration => _functionDeclaration; |
| 6215 | 6926 |
| 6216 /** | 6927 /** |
| 6217 * Set the function declaration being wrapped to the given function declaratio
n. | 6928 * Set the function declaration being wrapped to the given function declaratio
n. |
| 6929 * |
| 6218 * @param functionDeclaration the function declaration being wrapped | 6930 * @param functionDeclaration the function declaration being wrapped |
| 6219 */ | 6931 */ |
| 6220 void set functionExpression(FunctionDeclaration functionDeclaration2) { | 6932 void set functionExpression(FunctionDeclaration functionDeclaration2) { |
| 6221 this._functionDeclaration = becomeParentOf(functionDeclaration2); | 6933 this._functionDeclaration = becomeParentOf(functionDeclaration2); |
| 6222 } | 6934 } |
| 6223 void visitChildren(ASTVisitor<Object> visitor) { | 6935 void visitChildren(ASTVisitor<Object> visitor) { |
| 6224 safelyVisitChild(_functionDeclaration, visitor); | 6936 safelyVisitChild(_functionDeclaration, visitor); |
| 6225 } | 6937 } |
| 6226 } | 6938 } |
| 6227 /** | 6939 /** |
| 6228 * Instances of the class `FunctionExpression` represent a function expression. | 6940 * Instances of the class `FunctionExpression` represent a function expression. |
| 6941 * |
| 6229 * <pre> | 6942 * <pre> |
| 6230 * functionExpression ::=[FormalParameterList formalParameterList] [FunctionBody
functionBody]</pre> | 6943 * functionExpression ::= |
| 6944 * [FormalParameterList] [FunctionBody] |
| 6945 * </pre> |
| 6946 * |
| 6231 * @coverage dart.engine.ast | 6947 * @coverage dart.engine.ast |
| 6232 */ | 6948 */ |
| 6233 class FunctionExpression extends Expression { | 6949 class FunctionExpression extends Expression { |
| 6234 | 6950 |
| 6235 /** | 6951 /** |
| 6236 * The parameters associated with the function. | 6952 * The parameters associated with the function. |
| 6237 */ | 6953 */ |
| 6238 FormalParameterList _parameters; | 6954 FormalParameterList _parameters; |
| 6239 | 6955 |
| 6240 /** | 6956 /** |
| 6241 * The body of the function, or `null` if this is an external function. | 6957 * The body of the function, or `null` if this is an external function. |
| 6242 */ | 6958 */ |
| 6243 FunctionBody _body; | 6959 FunctionBody _body; |
| 6244 | 6960 |
| 6245 /** | 6961 /** |
| 6246 * The element associated with the function, or `null` if the AST structure ha
s not been | 6962 * The element associated with the function, or `null` if the AST structure ha
s not been |
| 6247 * resolved. | 6963 * resolved. |
| 6248 */ | 6964 */ |
| 6249 ExecutableElement _element; | 6965 ExecutableElement _element; |
| 6250 | 6966 |
| 6251 /** | 6967 /** |
| 6252 * Initialize a newly created function declaration. | 6968 * Initialize a newly created function declaration. |
| 6969 * |
| 6253 * @param parameters the parameters associated with the function | 6970 * @param parameters the parameters associated with the function |
| 6254 * @param body the body of the function | 6971 * @param body the body of the function |
| 6255 */ | 6972 */ |
| 6256 FunctionExpression.full(FormalParameterList parameters, FunctionBody body) { | 6973 FunctionExpression.full(FormalParameterList parameters, FunctionBody body) { |
| 6257 this._parameters = becomeParentOf(parameters); | 6974 this._parameters = becomeParentOf(parameters); |
| 6258 this._body = becomeParentOf(body); | 6975 this._body = becomeParentOf(body); |
| 6259 } | 6976 } |
| 6260 | 6977 |
| 6261 /** | 6978 /** |
| 6262 * Initialize a newly created function declaration. | 6979 * Initialize a newly created function declaration. |
| 6980 * |
| 6263 * @param parameters the parameters associated with the function | 6981 * @param parameters the parameters associated with the function |
| 6264 * @param body the body of the function | 6982 * @param body the body of the function |
| 6265 */ | 6983 */ |
| 6266 FunctionExpression({FormalParameterList parameters, FunctionBody body}) : this
.full(parameters, body); | 6984 FunctionExpression({FormalParameterList parameters, FunctionBody body}) : this
.full(parameters, body); |
| 6267 accept(ASTVisitor visitor) => visitor.visitFunctionExpression(this); | 6985 accept(ASTVisitor visitor) => visitor.visitFunctionExpression(this); |
| 6268 Token get beginToken { | 6986 Token get beginToken { |
| 6269 if (_parameters != null) { | 6987 if (_parameters != null) { |
| 6270 return _parameters.beginToken; | 6988 return _parameters.beginToken; |
| 6271 } else if (_body != null) { | 6989 } else if (_body != null) { |
| 6272 return _body.beginToken; | 6990 return _body.beginToken; |
| 6273 } | 6991 } |
| 6274 throw new IllegalStateException("Non-external functions must have a body"); | 6992 throw new IllegalStateException("Non-external functions must have a body"); |
| 6275 } | 6993 } |
| 6276 | 6994 |
| 6277 /** | 6995 /** |
| 6278 * Return the body of the function, or `null` if this is an external function. | 6996 * Return the body of the function, or `null` if this is an external function. |
| 6997 * |
| 6279 * @return the body of the function | 6998 * @return the body of the function |
| 6280 */ | 6999 */ |
| 6281 FunctionBody get body => _body; | 7000 FunctionBody get body => _body; |
| 6282 | 7001 |
| 6283 /** | 7002 /** |
| 6284 * Return the element associated with this function, or `null` if the AST stru
cture has not | 7003 * Return the element associated with this function, or `null` if the AST stru
cture has not |
| 6285 * been resolved. | 7004 * been resolved. |
| 7005 * |
| 6286 * @return the element associated with this function | 7006 * @return the element associated with this function |
| 6287 */ | 7007 */ |
| 6288 ExecutableElement get element => _element; | 7008 ExecutableElement get element => _element; |
| 6289 Token get endToken { | 7009 Token get endToken { |
| 6290 if (_body != null) { | 7010 if (_body != null) { |
| 6291 return _body.endToken; | 7011 return _body.endToken; |
| 6292 } else if (_parameters != null) { | 7012 } else if (_parameters != null) { |
| 6293 return _parameters.endToken; | 7013 return _parameters.endToken; |
| 6294 } | 7014 } |
| 6295 throw new IllegalStateException("Non-external functions must have a body"); | 7015 throw new IllegalStateException("Non-external functions must have a body"); |
| 6296 } | 7016 } |
| 6297 | 7017 |
| 6298 /** | 7018 /** |
| 6299 * Return the parameters associated with the function. | 7019 * Return the parameters associated with the function. |
| 7020 * |
| 6300 * @return the parameters associated with the function | 7021 * @return the parameters associated with the function |
| 6301 */ | 7022 */ |
| 6302 FormalParameterList get parameters => _parameters; | 7023 FormalParameterList get parameters => _parameters; |
| 6303 | 7024 |
| 6304 /** | 7025 /** |
| 6305 * Set the body of the function to the given function body. | 7026 * Set the body of the function to the given function body. |
| 7027 * |
| 6306 * @param functionBody the body of the function | 7028 * @param functionBody the body of the function |
| 6307 */ | 7029 */ |
| 6308 void set body(FunctionBody functionBody) { | 7030 void set body(FunctionBody functionBody) { |
| 6309 _body = becomeParentOf(functionBody); | 7031 _body = becomeParentOf(functionBody); |
| 6310 } | 7032 } |
| 6311 | 7033 |
| 6312 /** | 7034 /** |
| 6313 * Set the element associated with this function to the given element. | 7035 * Set the element associated with this function to the given element. |
| 7036 * |
| 6314 * @param element the element associated with this function | 7037 * @param element the element associated with this function |
| 6315 */ | 7038 */ |
| 6316 void set element(ExecutableElement element2) { | 7039 void set element(ExecutableElement element2) { |
| 6317 this._element = element2; | 7040 this._element = element2; |
| 6318 } | 7041 } |
| 6319 | 7042 |
| 6320 /** | 7043 /** |
| 6321 * Set the parameters associated with the function to the given list of parame
ters. | 7044 * Set the parameters associated with the function to the given list of parame
ters. |
| 7045 * |
| 6322 * @param parameters the parameters associated with the function | 7046 * @param parameters the parameters associated with the function |
| 6323 */ | 7047 */ |
| 6324 void set parameters(FormalParameterList parameters2) { | 7048 void set parameters(FormalParameterList parameters2) { |
| 6325 this._parameters = becomeParentOf(parameters2); | 7049 this._parameters = becomeParentOf(parameters2); |
| 6326 } | 7050 } |
| 6327 void visitChildren(ASTVisitor<Object> visitor) { | 7051 void visitChildren(ASTVisitor<Object> visitor) { |
| 6328 safelyVisitChild(_parameters, visitor); | 7052 safelyVisitChild(_parameters, visitor); |
| 6329 safelyVisitChild(_body, visitor); | 7053 safelyVisitChild(_body, visitor); |
| 6330 } | 7054 } |
| 6331 } | 7055 } |
| 6332 /** | 7056 /** |
| 6333 * Instances of the class `FunctionExpressionInvocation` represent the invocatio
n of a | 7057 * Instances of the class `FunctionExpressionInvocation` represent the invocatio
n of a |
| 6334 * function resulting from evaluating an expression. Invocations of methods and
other forms of | 7058 * function resulting from evaluating an expression. Invocations of methods and
other forms of |
| 6335 * functions are represented by [MethodInvocation method invocation] nodes. Invo
cations of | 7059 * functions are represented by [MethodInvocation] nodes. Invocations of |
| 6336 * getters and setters are represented by either [PrefixedIdentifier prefixed id
entifier] or[PropertyAccess property access] nodes. | 7060 * getters and setters are represented by either [PrefixedIdentifier] or |
| 7061 * [PropertyAccess] nodes. |
| 7062 * |
| 6337 * <pre> | 7063 * <pre> |
| 6338 * functionExpressionInvoction ::=[Expression function] [ArgumentList argumentLi
st]</pre> | 7064 * functionExpressionInvoction ::= |
| 7065 * [Expression] [ArgumentList] |
| 7066 * </pre> |
| 7067 * |
| 6339 * @coverage dart.engine.ast | 7068 * @coverage dart.engine.ast |
| 6340 */ | 7069 */ |
| 6341 class FunctionExpressionInvocation extends Expression { | 7070 class FunctionExpressionInvocation extends Expression { |
| 6342 | 7071 |
| 6343 /** | 7072 /** |
| 6344 * The expression producing the function being invoked. | 7073 * The expression producing the function being invoked. |
| 6345 */ | 7074 */ |
| 6346 Expression _function; | 7075 Expression _function; |
| 6347 | 7076 |
| 6348 /** | 7077 /** |
| 6349 * The list of arguments to the function. | 7078 * The list of arguments to the function. |
| 6350 */ | 7079 */ |
| 6351 ArgumentList _argumentList; | 7080 ArgumentList _argumentList; |
| 6352 | 7081 |
| 6353 /** | 7082 /** |
| 6354 * The element associated with the function being invoked based on static type
information, or`null` if the AST structure has not been resolved or the functio
n could not be resolved. | 7083 * The element associated with the function being invoked based on static type
information, or |
| 7084 * `null` if the AST structure has not been resolved or the function could not
be resolved. |
| 6355 */ | 7085 */ |
| 6356 ExecutableElement _staticElement; | 7086 ExecutableElement _staticElement; |
| 6357 | 7087 |
| 6358 /** | 7088 /** |
| 6359 * The element associated with the function being invoked based on propagated
type information, or`null` if the AST structure has not been resolved or the fun
ction could not be resolved. | 7089 * The element associated with the function being invoked based on propagated
type information, or |
| 7090 * `null` if the AST structure has not been resolved or the function could not
be resolved. |
| 6360 */ | 7091 */ |
| 6361 ExecutableElement _propagatedElement; | 7092 ExecutableElement _propagatedElement; |
| 6362 | 7093 |
| 6363 /** | 7094 /** |
| 6364 * Initialize a newly created function expression invocation. | 7095 * Initialize a newly created function expression invocation. |
| 7096 * |
| 6365 * @param function the expression producing the function being invoked | 7097 * @param function the expression producing the function being invoked |
| 6366 * @param argumentList the list of arguments to the method | 7098 * @param argumentList the list of arguments to the method |
| 6367 */ | 7099 */ |
| 6368 FunctionExpressionInvocation.full(Expression function, ArgumentList argumentLi
st) { | 7100 FunctionExpressionInvocation.full(Expression function, ArgumentList argumentLi
st) { |
| 6369 this._function = becomeParentOf(function); | 7101 this._function = becomeParentOf(function); |
| 6370 this._argumentList = becomeParentOf(argumentList); | 7102 this._argumentList = becomeParentOf(argumentList); |
| 6371 } | 7103 } |
| 6372 | 7104 |
| 6373 /** | 7105 /** |
| 6374 * Initialize a newly created function expression invocation. | 7106 * Initialize a newly created function expression invocation. |
| 7107 * |
| 6375 * @param function the expression producing the function being invoked | 7108 * @param function the expression producing the function being invoked |
| 6376 * @param argumentList the list of arguments to the method | 7109 * @param argumentList the list of arguments to the method |
| 6377 */ | 7110 */ |
| 6378 FunctionExpressionInvocation({Expression function, ArgumentList argumentList})
: this.full(function, argumentList); | 7111 FunctionExpressionInvocation({Expression function, ArgumentList argumentList})
: this.full(function, argumentList); |
| 6379 accept(ASTVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); | 7112 accept(ASTVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); |
| 6380 | 7113 |
| 6381 /** | 7114 /** |
| 6382 * Return the list of arguments to the method. | 7115 * Return the list of arguments to the method. |
| 7116 * |
| 6383 * @return the list of arguments to the method | 7117 * @return the list of arguments to the method |
| 6384 */ | 7118 */ |
| 6385 ArgumentList get argumentList => _argumentList; | 7119 ArgumentList get argumentList => _argumentList; |
| 6386 Token get beginToken => _function.beginToken; | 7120 Token get beginToken => _function.beginToken; |
| 6387 | 7121 |
| 6388 /** | 7122 /** |
| 6389 * Return the element associated with the function being invoked based on prop
agated type | 7123 * Return the element associated with the function being invoked based on prop
agated type |
| 6390 * information, or `null` if the AST structure has not been resolved or the fu
nction could | 7124 * information, or `null` if the AST structure has not been resolved or the fu
nction could |
| 6391 * not be resolved. One common example of the latter case is an expression who
se value can change | 7125 * not be resolved. One common example of the latter case is an expression who
se value can change |
| 6392 * over time. | 7126 * over time. |
| 7127 * |
| 6393 * @return the element associated with the function being invoked | 7128 * @return the element associated with the function being invoked |
| 6394 */ | 7129 */ |
| 6395 ExecutableElement get element => _propagatedElement; | 7130 ExecutableElement get element => _propagatedElement; |
| 6396 Token get endToken => _argumentList.endToken; | 7131 Token get endToken => _argumentList.endToken; |
| 6397 | 7132 |
| 6398 /** | 7133 /** |
| 6399 * Return the expression producing the function being invoked. | 7134 * Return the expression producing the function being invoked. |
| 7135 * |
| 6400 * @return the expression producing the function being invoked | 7136 * @return the expression producing the function being invoked |
| 6401 */ | 7137 */ |
| 6402 Expression get function => _function; | 7138 Expression get function => _function; |
| 6403 | 7139 |
| 6404 /** | 7140 /** |
| 6405 * Return the element associated with the function being invoked based on stat
ic type information, | 7141 * Return the element associated with the function being invoked based on stat
ic type information, |
| 6406 * or `null` if the AST structure has not been resolved or the function could
not be | 7142 * or `null` if the AST structure has not been resolved or the function could
not be |
| 6407 * resolved. One common example of the latter case is an expression whose valu
e can change over | 7143 * resolved. One common example of the latter case is an expression whose valu
e can change over |
| 6408 * time. | 7144 * time. |
| 7145 * |
| 6409 * @return the element associated with the function | 7146 * @return the element associated with the function |
| 6410 */ | 7147 */ |
| 6411 ExecutableElement get staticElement => _staticElement; | 7148 ExecutableElement get staticElement => _staticElement; |
| 6412 | 7149 |
| 6413 /** | 7150 /** |
| 6414 * Set the list of arguments to the method to the given list. | 7151 * Set the list of arguments to the method to the given list. |
| 7152 * |
| 6415 * @param argumentList the list of arguments to the method | 7153 * @param argumentList the list of arguments to the method |
| 6416 */ | 7154 */ |
| 6417 void set argumentList(ArgumentList argumentList2) { | 7155 void set argumentList(ArgumentList argumentList2) { |
| 6418 this._argumentList = becomeParentOf(argumentList2); | 7156 this._argumentList = becomeParentOf(argumentList2); |
| 6419 } | 7157 } |
| 6420 | 7158 |
| 6421 /** | 7159 /** |
| 6422 * Set the element associated with the function being invoked based on propaga
ted type information | 7160 * Set the element associated with the function being invoked based on propaga
ted type information |
| 6423 * to the given element. | 7161 * to the given element. |
| 7162 * |
| 6424 * @param element the element to be associated with the function being invoked | 7163 * @param element the element to be associated with the function being invoked |
| 6425 */ | 7164 */ |
| 6426 void set element(ExecutableElement element2) { | 7165 void set element(ExecutableElement element2) { |
| 6427 _propagatedElement = element2; | 7166 _propagatedElement = element2; |
| 6428 } | 7167 } |
| 6429 | 7168 |
| 6430 /** | 7169 /** |
| 6431 * Set the expression producing the function being invoked to the given expres
sion. | 7170 * Set the expression producing the function being invoked to the given expres
sion. |
| 7171 * |
| 6432 * @param function the expression producing the function being invoked | 7172 * @param function the expression producing the function being invoked |
| 6433 */ | 7173 */ |
| 6434 void set function(Expression function2) { | 7174 void set function(Expression function2) { |
| 6435 function2 = becomeParentOf(function2); | 7175 function2 = becomeParentOf(function2); |
| 6436 } | 7176 } |
| 6437 | 7177 |
| 6438 /** | 7178 /** |
| 6439 * Set the element associated with the function being invoked based on static
type information to | 7179 * Set the element associated with the function being invoked based on static
type information to |
| 6440 * the given element. | 7180 * the given element. |
| 7181 * |
| 6441 * @param element the element to be associated with the function | 7182 * @param element the element to be associated with the function |
| 6442 */ | 7183 */ |
| 6443 void set staticElement(ExecutableElement element) { | 7184 void set staticElement(ExecutableElement element) { |
| 6444 this._staticElement = element; | 7185 this._staticElement = element; |
| 6445 } | 7186 } |
| 6446 void visitChildren(ASTVisitor<Object> visitor) { | 7187 void visitChildren(ASTVisitor<Object> visitor) { |
| 6447 safelyVisitChild(_function, visitor); | 7188 safelyVisitChild(_function, visitor); |
| 6448 safelyVisitChild(_argumentList, visitor); | 7189 safelyVisitChild(_argumentList, visitor); |
| 6449 } | 7190 } |
| 6450 } | 7191 } |
| 6451 /** | 7192 /** |
| 6452 * Instances of the class `FunctionTypeAlias` represent a function type alias. | 7193 * Instances of the class `FunctionTypeAlias` represent a function type alias. |
| 7194 * |
| 6453 * <pre> | 7195 * <pre> |
| 6454 * functionTypeAlias ::= | 7196 * functionTypeAlias ::= |
| 6455 * functionPrefix [TypeParameterList typeParameterList]? [FormalParameterList fo
rmalParameterList] ';' | 7197 * functionPrefix [TypeParameterList]? [FormalParameterList] ';' |
| 6456 * functionPrefix ::=[TypeName returnType]? [SimpleIdentifier name]</pre> | 7198 * |
| 7199 * functionPrefix ::= |
| 7200 * [TypeName]? [SimpleIdentifier] |
| 7201 * </pre> |
| 7202 * |
| 6457 * @coverage dart.engine.ast | 7203 * @coverage dart.engine.ast |
| 6458 */ | 7204 */ |
| 6459 class FunctionTypeAlias extends TypeAlias { | 7205 class FunctionTypeAlias extends TypeAlias { |
| 6460 | 7206 |
| 6461 /** | 7207 /** |
| 6462 * The name of the return type of the function type being defined, or `null` i
f no return | 7208 * The name of the return type of the function type being defined, or `null` i
f no return |
| 6463 * type was given. | 7209 * type was given. |
| 6464 */ | 7210 */ |
| 6465 TypeName _returnType; | 7211 TypeName _returnType; |
| 6466 | 7212 |
| 6467 /** | 7213 /** |
| 6468 * The name of the function type being declared. | 7214 * The name of the function type being declared. |
| 6469 */ | 7215 */ |
| 6470 SimpleIdentifier _name; | 7216 SimpleIdentifier _name; |
| 6471 | 7217 |
| 6472 /** | 7218 /** |
| 6473 * The type parameters for the function type, or `null` if the function type d
oes not have | 7219 * The type parameters for the function type, or `null` if the function type d
oes not have |
| 6474 * any type parameters. | 7220 * any type parameters. |
| 6475 */ | 7221 */ |
| 6476 TypeParameterList _typeParameters; | 7222 TypeParameterList _typeParameters; |
| 6477 | 7223 |
| 6478 /** | 7224 /** |
| 6479 * The parameters associated with the function type. | 7225 * The parameters associated with the function type. |
| 6480 */ | 7226 */ |
| 6481 FormalParameterList _parameters; | 7227 FormalParameterList _parameters; |
| 6482 | 7228 |
| 6483 /** | 7229 /** |
| 6484 * Initialize a newly created function type alias. | 7230 * Initialize a newly created function type alias. |
| 7231 * |
| 6485 * @param comment the documentation comment associated with this type alias | 7232 * @param comment the documentation comment associated with this type alias |
| 6486 * @param metadata the annotations associated with this type alias | 7233 * @param metadata the annotations associated with this type alias |
| 6487 * @param keyword the token representing the 'typedef' keyword | 7234 * @param keyword the token representing the 'typedef' keyword |
| 6488 * @param returnType the name of the return type of the function type being de
fined | 7235 * @param returnType the name of the return type of the function type being de
fined |
| 6489 * @param name the name of the type being declared | 7236 * @param name the name of the type being declared |
| 6490 * @param typeParameters the type parameters for the type | 7237 * @param typeParameters the type parameters for the type |
| 6491 * @param parameters the parameters associated with the function | 7238 * @param parameters the parameters associated with the function |
| 6492 * @param semicolon the semicolon terminating the declaration | 7239 * @param semicolon the semicolon terminating the declaration |
| 6493 */ | 7240 */ |
| 6494 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) { | 7241 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) { |
| 6495 this._returnType = becomeParentOf(returnType); | 7242 this._returnType = becomeParentOf(returnType); |
| 6496 this._name = becomeParentOf(name); | 7243 this._name = becomeParentOf(name); |
| 6497 this._typeParameters = becomeParentOf(typeParameters); | 7244 this._typeParameters = becomeParentOf(typeParameters); |
| 6498 this._parameters = becomeParentOf(parameters); | 7245 this._parameters = becomeParentOf(parameters); |
| 6499 } | 7246 } |
| 6500 | 7247 |
| 6501 /** | 7248 /** |
| 6502 * Initialize a newly created function type alias. | 7249 * Initialize a newly created function type alias. |
| 7250 * |
| 6503 * @param comment the documentation comment associated with this type alias | 7251 * @param comment the documentation comment associated with this type alias |
| 6504 * @param metadata the annotations associated with this type alias | 7252 * @param metadata the annotations associated with this type alias |
| 6505 * @param keyword the token representing the 'typedef' keyword | 7253 * @param keyword the token representing the 'typedef' keyword |
| 6506 * @param returnType the name of the return type of the function type being de
fined | 7254 * @param returnType the name of the return type of the function type being de
fined |
| 6507 * @param name the name of the type being declared | 7255 * @param name the name of the type being declared |
| 6508 * @param typeParameters the type parameters for the type | 7256 * @param typeParameters the type parameters for the type |
| 6509 * @param parameters the parameters associated with the function | 7257 * @param parameters the parameters associated with the function |
| 6510 * @param semicolon the semicolon terminating the declaration | 7258 * @param semicolon the semicolon terminating the declaration |
| 6511 */ | 7259 */ |
| 6512 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); | 7260 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); |
| 6513 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); | 7261 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); |
| 6514 FunctionTypeAliasElement get element => _name != null ? (_name.element as Func
tionTypeAliasElement) : null; | 7262 FunctionTypeAliasElement get element => _name != null ? (_name.element as Func
tionTypeAliasElement) : null; |
| 6515 | 7263 |
| 6516 /** | 7264 /** |
| 6517 * Return the name of the function type being declared. | 7265 * Return the name of the function type being declared. |
| 7266 * |
| 6518 * @return the name of the function type being declared | 7267 * @return the name of the function type being declared |
| 6519 */ | 7268 */ |
| 6520 SimpleIdentifier get name => _name; | 7269 SimpleIdentifier get name => _name; |
| 6521 | 7270 |
| 6522 /** | 7271 /** |
| 6523 * Return the parameters associated with the function type. | 7272 * Return the parameters associated with the function type. |
| 7273 * |
| 6524 * @return the parameters associated with the function type | 7274 * @return the parameters associated with the function type |
| 6525 */ | 7275 */ |
| 6526 FormalParameterList get parameters => _parameters; | 7276 FormalParameterList get parameters => _parameters; |
| 6527 | 7277 |
| 6528 /** | 7278 /** |
| 6529 * Return the name of the return type of the function type being defined, or `
null` if no | 7279 * Return the name of the return type of the function type being defined, or `
null` if no |
| 6530 * return type was given. | 7280 * return type was given. |
| 7281 * |
| 6531 * @return the name of the return type of the function type being defined | 7282 * @return the name of the return type of the function type being defined |
| 6532 */ | 7283 */ |
| 6533 TypeName get returnType => _returnType; | 7284 TypeName get returnType => _returnType; |
| 6534 | 7285 |
| 6535 /** | 7286 /** |
| 6536 * Return the type parameters for the function type, or `null` if the function
type does not | 7287 * Return the type parameters for the function type, or `null` if the function
type does not |
| 6537 * have any type parameters. | 7288 * have any type parameters. |
| 7289 * |
| 6538 * @return the type parameters for the function type | 7290 * @return the type parameters for the function type |
| 6539 */ | 7291 */ |
| 6540 TypeParameterList get typeParameters => _typeParameters; | 7292 TypeParameterList get typeParameters => _typeParameters; |
| 6541 | 7293 |
| 6542 /** | 7294 /** |
| 6543 * Set the name of the function type being declared to the given identifier. | 7295 * Set the name of the function type being declared to the given identifier. |
| 7296 * |
| 6544 * @param name the name of the function type being declared | 7297 * @param name the name of the function type being declared |
| 6545 */ | 7298 */ |
| 6546 void set name(SimpleIdentifier name2) { | 7299 void set name(SimpleIdentifier name2) { |
| 6547 this._name = becomeParentOf(name2); | 7300 this._name = becomeParentOf(name2); |
| 6548 } | 7301 } |
| 6549 | 7302 |
| 6550 /** | 7303 /** |
| 6551 * Set the parameters associated with the function type to the given list of p
arameters. | 7304 * Set the parameters associated with the function type to the given list of p
arameters. |
| 7305 * |
| 6552 * @param parameters the parameters associated with the function type | 7306 * @param parameters the parameters associated with the function type |
| 6553 */ | 7307 */ |
| 6554 void set parameters(FormalParameterList parameters2) { | 7308 void set parameters(FormalParameterList parameters2) { |
| 6555 this._parameters = becomeParentOf(parameters2); | 7309 this._parameters = becomeParentOf(parameters2); |
| 6556 } | 7310 } |
| 6557 | 7311 |
| 6558 /** | 7312 /** |
| 6559 * Set the name of the return type of the function type being defined to the g
iven type name. | 7313 * Set the name of the return type of the function type being defined to the g
iven type name. |
| 7314 * |
| 6560 * @param typeName the name of the return type of the function type being defi
ned | 7315 * @param typeName the name of the return type of the function type being defi
ned |
| 6561 */ | 7316 */ |
| 6562 void set returnType(TypeName typeName) { | 7317 void set returnType(TypeName typeName) { |
| 6563 _returnType = becomeParentOf(typeName); | 7318 _returnType = becomeParentOf(typeName); |
| 6564 } | 7319 } |
| 6565 | 7320 |
| 6566 /** | 7321 /** |
| 6567 * Set the type parameters for the function type to the given list of paramete
rs. | 7322 * Set the type parameters for the function type to the given list of paramete
rs. |
| 7323 * |
| 6568 * @param typeParameters the type parameters for the function type | 7324 * @param typeParameters the type parameters for the function type |
| 6569 */ | 7325 */ |
| 6570 void set typeParameters(TypeParameterList typeParameters2) { | 7326 void set typeParameters(TypeParameterList typeParameters2) { |
| 6571 this._typeParameters = becomeParentOf(typeParameters2); | 7327 this._typeParameters = becomeParentOf(typeParameters2); |
| 6572 } | 7328 } |
| 6573 void visitChildren(ASTVisitor<Object> visitor) { | 7329 void visitChildren(ASTVisitor<Object> visitor) { |
| 6574 super.visitChildren(visitor); | 7330 super.visitChildren(visitor); |
| 6575 safelyVisitChild(_returnType, visitor); | 7331 safelyVisitChild(_returnType, visitor); |
| 6576 safelyVisitChild(_name, visitor); | 7332 safelyVisitChild(_name, visitor); |
| 6577 safelyVisitChild(_typeParameters, visitor); | 7333 safelyVisitChild(_typeParameters, visitor); |
| 6578 safelyVisitChild(_parameters, visitor); | 7334 safelyVisitChild(_parameters, visitor); |
| 6579 } | 7335 } |
| 6580 } | 7336 } |
| 6581 /** | 7337 /** |
| 6582 * Instances of the class `FunctionTypedFormalParameter` represent a function-ty
ped formal | 7338 * Instances of the class `FunctionTypedFormalParameter` represent a function-ty
ped formal |
| 6583 * parameter. | 7339 * parameter. |
| 7340 * |
| 6584 * <pre> | 7341 * <pre> |
| 6585 * functionSignature ::=[TypeName returnType]? [SimpleIdentifier identifier] [Fo
rmalParameterList formalParameterList]</pre> | 7342 * functionSignature ::= |
| 7343 * [TypeName]? [SimpleIdentifier] [FormalParameterList] |
| 7344 * </pre> |
| 7345 * |
| 6586 * @coverage dart.engine.ast | 7346 * @coverage dart.engine.ast |
| 6587 */ | 7347 */ |
| 6588 class FunctionTypedFormalParameter extends NormalFormalParameter { | 7348 class FunctionTypedFormalParameter extends NormalFormalParameter { |
| 6589 | 7349 |
| 6590 /** | 7350 /** |
| 6591 * The return type of the function, or `null` if the function does not have a
return type. | 7351 * The return type of the function, or `null` if the function does not have a
return type. |
| 6592 */ | 7352 */ |
| 6593 TypeName _returnType; | 7353 TypeName _returnType; |
| 6594 | 7354 |
| 6595 /** | 7355 /** |
| 6596 * The parameters of the function-typed parameter. | 7356 * The parameters of the function-typed parameter. |
| 6597 */ | 7357 */ |
| 6598 FormalParameterList _parameters; | 7358 FormalParameterList _parameters; |
| 6599 | 7359 |
| 6600 /** | 7360 /** |
| 6601 * Initialize a newly created formal parameter. | 7361 * Initialize a newly created formal parameter. |
| 7362 * |
| 6602 * @param comment the documentation comment associated with this parameter | 7363 * @param comment the documentation comment associated with this parameter |
| 6603 * @param metadata the annotations associated with this parameter | 7364 * @param metadata the annotations associated with this parameter |
| 6604 * @param returnType the return type of the function, or `null` if the functio
n does not | 7365 * @param returnType the return type of the function, or `null` if the functio
n does not |
| 6605 * have a return type | 7366 * have a return type |
| 6606 * @param identifier the name of the function-typed parameter | 7367 * @param identifier the name of the function-typed parameter |
| 6607 * @param parameters the parameters of the function-typed parameter | 7368 * @param parameters the parameters of the function-typed parameter |
| 6608 */ | 7369 */ |
| 6609 FunctionTypedFormalParameter.full(Comment comment, List<Annotation> metadata,
TypeName returnType, SimpleIdentifier identifier, FormalParameterList parameters
) : super.full(comment, metadata, identifier) { | 7370 FunctionTypedFormalParameter.full(Comment comment, List<Annotation> metadata,
TypeName returnType, SimpleIdentifier identifier, FormalParameterList parameters
) : super.full(comment, metadata, identifier) { |
| 6610 this._returnType = becomeParentOf(returnType); | 7371 this._returnType = becomeParentOf(returnType); |
| 6611 this._parameters = becomeParentOf(parameters); | 7372 this._parameters = becomeParentOf(parameters); |
| 6612 } | 7373 } |
| 6613 | 7374 |
| 6614 /** | 7375 /** |
| 6615 * Initialize a newly created formal parameter. | 7376 * Initialize a newly created formal parameter. |
| 7377 * |
| 6616 * @param comment the documentation comment associated with this parameter | 7378 * @param comment the documentation comment associated with this parameter |
| 6617 * @param metadata the annotations associated with this parameter | 7379 * @param metadata the annotations associated with this parameter |
| 6618 * @param returnType the return type of the function, or `null` if the functio
n does not | 7380 * @param returnType the return type of the function, or `null` if the functio
n does not |
| 6619 * have a return type | 7381 * have a return type |
| 6620 * @param identifier the name of the function-typed parameter | 7382 * @param identifier the name of the function-typed parameter |
| 6621 * @param parameters the parameters of the function-typed parameter | 7383 * @param parameters the parameters of the function-typed parameter |
| 6622 */ | 7384 */ |
| 6623 FunctionTypedFormalParameter({Comment comment, List<Annotation> metadata, Type
Name returnType, SimpleIdentifier identifier, FormalParameterList parameters}) :
this.full(comment, metadata, returnType, identifier, parameters); | 7385 FunctionTypedFormalParameter({Comment comment, List<Annotation> metadata, Type
Name returnType, SimpleIdentifier identifier, FormalParameterList parameters}) :
this.full(comment, metadata, returnType, identifier, parameters); |
| 6624 accept(ASTVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); | 7386 accept(ASTVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); |
| 6625 Token get beginToken { | 7387 Token get beginToken { |
| 6626 if (_returnType != null) { | 7388 if (_returnType != null) { |
| 6627 return _returnType.beginToken; | 7389 return _returnType.beginToken; |
| 6628 } | 7390 } |
| 6629 return identifier.beginToken; | 7391 return identifier.beginToken; |
| 6630 } | 7392 } |
| 6631 Token get endToken => _parameters.endToken; | 7393 Token get endToken => _parameters.endToken; |
| 6632 | 7394 |
| 6633 /** | 7395 /** |
| 6634 * Return the parameters of the function-typed parameter. | 7396 * Return the parameters of the function-typed parameter. |
| 7397 * |
| 6635 * @return the parameters of the function-typed parameter | 7398 * @return the parameters of the function-typed parameter |
| 6636 */ | 7399 */ |
| 6637 FormalParameterList get parameters => _parameters; | 7400 FormalParameterList get parameters => _parameters; |
| 6638 | 7401 |
| 6639 /** | 7402 /** |
| 6640 * Return the return type of the function, or `null` if the function does not
have a return | 7403 * Return the return type of the function, or `null` if the function does not
have a return |
| 6641 * type. | 7404 * type. |
| 7405 * |
| 6642 * @return the return type of the function | 7406 * @return the return type of the function |
| 6643 */ | 7407 */ |
| 6644 TypeName get returnType => _returnType; | 7408 TypeName get returnType => _returnType; |
| 6645 bool get isConst => false; | 7409 bool get isConst => false; |
| 6646 bool get isFinal => false; | 7410 bool get isFinal => false; |
| 6647 | 7411 |
| 6648 /** | 7412 /** |
| 6649 * Set the parameters of the function-typed parameter to the given parameters. | 7413 * Set the parameters of the function-typed parameter to the given parameters. |
| 7414 * |
| 6650 * @param parameters the parameters of the function-typed parameter | 7415 * @param parameters the parameters of the function-typed parameter |
| 6651 */ | 7416 */ |
| 6652 void set parameters(FormalParameterList parameters2) { | 7417 void set parameters(FormalParameterList parameters2) { |
| 6653 this._parameters = becomeParentOf(parameters2); | 7418 this._parameters = becomeParentOf(parameters2); |
| 6654 } | 7419 } |
| 6655 | 7420 |
| 6656 /** | 7421 /** |
| 6657 * Set the return type of the function to the given type. | 7422 * Set the return type of the function to the given type. |
| 7423 * |
| 6658 * @param returnType the return type of the function | 7424 * @param returnType the return type of the function |
| 6659 */ | 7425 */ |
| 6660 void set returnType(TypeName returnType2) { | 7426 void set returnType(TypeName returnType2) { |
| 6661 this._returnType = becomeParentOf(returnType2); | 7427 this._returnType = becomeParentOf(returnType2); |
| 6662 } | 7428 } |
| 6663 void visitChildren(ASTVisitor<Object> visitor) { | 7429 void visitChildren(ASTVisitor<Object> visitor) { |
| 6664 super.visitChildren(visitor); | 7430 super.visitChildren(visitor); |
| 6665 safelyVisitChild(_returnType, visitor); | 7431 safelyVisitChild(_returnType, visitor); |
| 6666 safelyVisitChild(identifier, visitor); | 7432 safelyVisitChild(identifier, visitor); |
| 6667 safelyVisitChild(_parameters, visitor); | 7433 safelyVisitChild(_parameters, visitor); |
| 6668 } | 7434 } |
| 6669 } | 7435 } |
| 6670 /** | 7436 /** |
| 6671 * Instances of the class `HideCombinator` represent a combinator that restricts
the names | 7437 * Instances of the class `HideCombinator` represent a combinator that restricts
the names |
| 6672 * being imported to those that are not in a given list. | 7438 * being imported to those that are not in a given list. |
| 7439 * |
| 6673 * <pre> | 7440 * <pre> |
| 6674 * hideCombinator ::= | 7441 * hideCombinator ::= |
| 6675 * 'hide' [SimpleIdentifier identifier] (',' [SimpleIdentifier identifier]) | 7442 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* |
| 6676 * </pre> | 7443 * </pre> |
| 7444 * |
| 6677 * @coverage dart.engine.ast | 7445 * @coverage dart.engine.ast |
| 6678 */ | 7446 */ |
| 6679 class HideCombinator extends Combinator { | 7447 class HideCombinator extends Combinator { |
| 6680 | 7448 |
| 6681 /** | 7449 /** |
| 6682 * The list of names from the library that are hidden by this combinator. | 7450 * The list of names from the library that are hidden by this combinator. |
| 6683 */ | 7451 */ |
| 6684 NodeList<SimpleIdentifier> _hiddenNames; | 7452 NodeList<SimpleIdentifier> _hiddenNames; |
| 6685 | 7453 |
| 6686 /** | 7454 /** |
| 6687 * Initialize a newly created import show combinator. | 7455 * Initialize a newly created import show combinator. |
| 7456 * |
| 6688 * @param keyword the comma introducing the combinator | 7457 * @param keyword the comma introducing the combinator |
| 6689 * @param hiddenNames the list of names from the library that are hidden by th
is combinator | 7458 * @param hiddenNames the list of names from the library that are hidden by th
is combinator |
| 6690 */ | 7459 */ |
| 6691 HideCombinator.full(Token keyword, List<SimpleIdentifier> hiddenNames) : super
.full(keyword) { | 7460 HideCombinator.full(Token keyword, List<SimpleIdentifier> hiddenNames) : super
.full(keyword) { |
| 6692 this._hiddenNames = new NodeList<SimpleIdentifier>(this); | 7461 this._hiddenNames = new NodeList<SimpleIdentifier>(this); |
| 6693 this._hiddenNames.addAll(hiddenNames); | 7462 this._hiddenNames.addAll(hiddenNames); |
| 6694 } | 7463 } |
| 6695 | 7464 |
| 6696 /** | 7465 /** |
| 6697 * Initialize a newly created import show combinator. | 7466 * Initialize a newly created import show combinator. |
| 7467 * |
| 6698 * @param keyword the comma introducing the combinator | 7468 * @param keyword the comma introducing the combinator |
| 6699 * @param hiddenNames the list of names from the library that are hidden by th
is combinator | 7469 * @param hiddenNames the list of names from the library that are hidden by th
is combinator |
| 6700 */ | 7470 */ |
| 6701 HideCombinator({Token keyword, List<SimpleIdentifier> hiddenNames}) : this.ful
l(keyword, hiddenNames); | 7471 HideCombinator({Token keyword, List<SimpleIdentifier> hiddenNames}) : this.ful
l(keyword, hiddenNames); |
| 6702 accept(ASTVisitor visitor) => visitor.visitHideCombinator(this); | 7472 accept(ASTVisitor visitor) => visitor.visitHideCombinator(this); |
| 6703 Token get endToken => _hiddenNames.endToken; | 7473 Token get endToken => _hiddenNames.endToken; |
| 6704 | 7474 |
| 6705 /** | 7475 /** |
| 6706 * Return the list of names from the library that are hidden by this combinato
r. | 7476 * Return the list of names from the library that are hidden by this combinato
r. |
| 7477 * |
| 6707 * @return the list of names from the library that are hidden by this combinat
or | 7478 * @return the list of names from the library that are hidden by this combinat
or |
| 6708 */ | 7479 */ |
| 6709 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames; | 7480 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames; |
| 6710 void visitChildren(ASTVisitor<Object> visitor) { | 7481 void visitChildren(ASTVisitor<Object> visitor) { |
| 6711 _hiddenNames.accept(visitor); | 7482 _hiddenNames.accept(visitor); |
| 6712 } | 7483 } |
| 6713 } | 7484 } |
| 6714 /** | 7485 /** |
| 6715 * The abstract class `Identifier` defines the behavior common to nodes that rep
resent an | 7486 * The abstract class `Identifier` defines the behavior common to nodes that rep
resent an |
| 6716 * identifier. | 7487 * identifier. |
| 7488 * |
| 6717 * <pre> | 7489 * <pre> |
| 6718 * identifier ::=[SimpleIdentifier simpleIdentifier]| [PrefixedIdentifier prefix
edIdentifier]</pre> | 7490 * identifier ::= |
| 7491 * [SimpleIdentifier] |
| 7492 * | [PrefixedIdentifier] |
| 7493 * </pre> |
| 7494 * |
| 6719 * @coverage dart.engine.ast | 7495 * @coverage dart.engine.ast |
| 6720 */ | 7496 */ |
| 6721 abstract class Identifier extends Expression { | 7497 abstract class Identifier extends Expression { |
| 6722 | 7498 |
| 6723 /** | 7499 /** |
| 6724 * Return `true` if the given name is visible only within the library in which
it is | 7500 * Return `true` if the given name is visible only within the library in which
it is |
| 6725 * declared. | 7501 * declared. |
| 7502 * |
| 6726 * @param name the name being tested | 7503 * @param name the name being tested |
| 6727 * @return `true` if the given name is private | 7504 * @return `true` if the given name is private |
| 6728 */ | 7505 */ |
| 6729 static bool isPrivateName(String name) => name.startsWith("_"); | 7506 static bool isPrivateName(String name) => name.startsWith("_"); |
| 6730 | 7507 |
| 6731 /** | 7508 /** |
| 6732 * Return the element associated with this identifier based on propagated type
information, or`null` if the AST structure has not been resolved or if this ide
ntifier could not be | 7509 * Return the element associated with this identifier based on propagated type
information, or |
| 7510 * `null` if the AST structure has not been resolved or if this identifier cou
ld not be |
| 6733 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope | 7511 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope |
| 6734 * in which it appears. | 7512 * in which it appears. |
| 7513 * |
| 6735 * @return the element associated with this identifier | 7514 * @return the element associated with this identifier |
| 6736 */ | 7515 */ |
| 6737 Element get element; | 7516 Element get element; |
| 6738 | 7517 |
| 6739 /** | 7518 /** |
| 6740 * Return the lexical representation of the identifier. | 7519 * Return the lexical representation of the identifier. |
| 7520 * |
| 6741 * @return the lexical representation of the identifier | 7521 * @return the lexical representation of the identifier |
| 6742 */ | 7522 */ |
| 6743 String get name; | 7523 String get name; |
| 6744 | 7524 |
| 6745 /** | 7525 /** |
| 6746 * Return the element associated with this identifier based on static type inf
ormation, or`null` if the AST structure has not been resolved or if this identif
ier could not be | 7526 * Return the element associated with this identifier based on static type inf
ormation, or |
| 7527 * `null` if the AST structure has not been resolved or if this identifier cou
ld not be |
| 6747 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope | 7528 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope |
| 6748 * in which it appears | 7529 * in which it appears |
| 7530 * |
| 6749 * @return the element associated with the operator | 7531 * @return the element associated with the operator |
| 6750 */ | 7532 */ |
| 6751 Element get staticElement; | 7533 Element get staticElement; |
| 6752 bool get isAssignable => true; | 7534 bool get isAssignable => true; |
| 6753 } | 7535 } |
| 6754 /** | 7536 /** |
| 6755 * Instances of the class `IfStatement` represent an if statement. | 7537 * Instances of the class `IfStatement` represent an if statement. |
| 7538 * |
| 6756 * <pre> | 7539 * <pre> |
| 6757 * ifStatement ::= | 7540 * ifStatement ::= |
| 6758 * 'if' '(' [Expression expression] ')' [Statement thenStatement] ('else' [State
ment elseStatement])? | 7541 * 'if' '(' [Expression] ')' [Statement] ('else' [Statement])? |
| 6759 * </pre> | 7542 * </pre> |
| 7543 * |
| 6760 * @coverage dart.engine.ast | 7544 * @coverage dart.engine.ast |
| 6761 */ | 7545 */ |
| 6762 class IfStatement extends Statement { | 7546 class IfStatement extends Statement { |
| 6763 | 7547 |
| 6764 /** | 7548 /** |
| 6765 * The token representing the 'if' keyword. | 7549 * The token representing the 'if' keyword. |
| 6766 */ | 7550 */ |
| 6767 Token _ifKeyword; | 7551 Token _ifKeyword; |
| 6768 | 7552 |
| 6769 /** | 7553 /** |
| (...skipping 22 matching lines...) Expand all Loading... |
| 6792 Token _elseKeyword; | 7576 Token _elseKeyword; |
| 6793 | 7577 |
| 6794 /** | 7578 /** |
| 6795 * The statement that is executed if the condition evaluates to `false`, or `n
ull` if | 7579 * The statement that is executed if the condition evaluates to `false`, or `n
ull` if |
| 6796 * there is no else statement. | 7580 * there is no else statement. |
| 6797 */ | 7581 */ |
| 6798 Statement _elseStatement; | 7582 Statement _elseStatement; |
| 6799 | 7583 |
| 6800 /** | 7584 /** |
| 6801 * Initialize a newly created if statement. | 7585 * Initialize a newly created if statement. |
| 7586 * |
| 6802 * @param ifKeyword the token representing the 'if' keyword | 7587 * @param ifKeyword the token representing the 'if' keyword |
| 6803 * @param leftParenthesis the left parenthesis | 7588 * @param leftParenthesis the left parenthesis |
| 6804 * @param condition the condition used to determine which of the statements is
executed next | 7589 * @param condition the condition used to determine which of the statements is
executed next |
| 6805 * @param rightParenthesis the right parenthesis | 7590 * @param rightParenthesis the right parenthesis |
| 6806 * @param thenStatement the statement that is executed if the condition evalua
tes to `true` | 7591 * @param thenStatement the statement that is executed if the condition evalua
tes to `true` |
| 6807 * @param elseKeyword the token representing the 'else' keyword | 7592 * @param elseKeyword the token representing the 'else' keyword |
| 6808 * @param elseStatement the statement that is executed if the condition evalua
tes to `false` | 7593 * @param elseStatement the statement that is executed if the condition evalua
tes to `false` |
| 6809 */ | 7594 */ |
| 6810 IfStatement.full(Token ifKeyword, Token leftParenthesis, Expression condition,
Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement e
lseStatement) { | 7595 IfStatement.full(Token ifKeyword, Token leftParenthesis, Expression condition,
Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement e
lseStatement) { |
| 6811 this._ifKeyword = ifKeyword; | 7596 this._ifKeyword = ifKeyword; |
| 6812 this._leftParenthesis = leftParenthesis; | 7597 this._leftParenthesis = leftParenthesis; |
| 6813 this._condition = becomeParentOf(condition); | 7598 this._condition = becomeParentOf(condition); |
| 6814 this._rightParenthesis = rightParenthesis; | 7599 this._rightParenthesis = rightParenthesis; |
| 6815 this._thenStatement = becomeParentOf(thenStatement); | 7600 this._thenStatement = becomeParentOf(thenStatement); |
| 6816 this._elseKeyword = elseKeyword; | 7601 this._elseKeyword = elseKeyword; |
| 6817 this._elseStatement = becomeParentOf(elseStatement); | 7602 this._elseStatement = becomeParentOf(elseStatement); |
| 6818 } | 7603 } |
| 6819 | 7604 |
| 6820 /** | 7605 /** |
| 6821 * Initialize a newly created if statement. | 7606 * Initialize a newly created if statement. |
| 7607 * |
| 6822 * @param ifKeyword the token representing the 'if' keyword | 7608 * @param ifKeyword the token representing the 'if' keyword |
| 6823 * @param leftParenthesis the left parenthesis | 7609 * @param leftParenthesis the left parenthesis |
| 6824 * @param condition the condition used to determine which of the statements is
executed next | 7610 * @param condition the condition used to determine which of the statements is
executed next |
| 6825 * @param rightParenthesis the right parenthesis | 7611 * @param rightParenthesis the right parenthesis |
| 6826 * @param thenStatement the statement that is executed if the condition evalua
tes to `true` | 7612 * @param thenStatement the statement that is executed if the condition evalua
tes to `true` |
| 6827 * @param elseKeyword the token representing the 'else' keyword | 7613 * @param elseKeyword the token representing the 'else' keyword |
| 6828 * @param elseStatement the statement that is executed if the condition evalua
tes to `false` | 7614 * @param elseStatement the statement that is executed if the condition evalua
tes to `false` |
| 6829 */ | 7615 */ |
| 6830 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); | 7616 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); |
| 6831 accept(ASTVisitor visitor) => visitor.visitIfStatement(this); | 7617 accept(ASTVisitor visitor) => visitor.visitIfStatement(this); |
| 6832 Token get beginToken => _ifKeyword; | 7618 Token get beginToken => _ifKeyword; |
| 6833 | 7619 |
| 6834 /** | 7620 /** |
| 6835 * Return the condition used to determine which of the statements is executed
next. | 7621 * Return the condition used to determine which of the statements is executed
next. |
| 7622 * |
| 6836 * @return the condition used to determine which statement is executed next | 7623 * @return the condition used to determine which statement is executed next |
| 6837 */ | 7624 */ |
| 6838 Expression get condition => _condition; | 7625 Expression get condition => _condition; |
| 6839 | 7626 |
| 6840 /** | 7627 /** |
| 6841 * Return the token representing the 'else' keyword. | 7628 * Return the token representing the 'else' keyword. |
| 7629 * |
| 6842 * @return the token representing the 'else' keyword | 7630 * @return the token representing the 'else' keyword |
| 6843 */ | 7631 */ |
| 6844 Token get elseKeyword => _elseKeyword; | 7632 Token get elseKeyword => _elseKeyword; |
| 6845 | 7633 |
| 6846 /** | 7634 /** |
| 6847 * Return the statement that is executed if the condition evaluates to `false`
, or`null` if there is no else statement. | 7635 * Return the statement that is executed if the condition evaluates to `false`
, or |
| 7636 * `null` if there is no else statement. |
| 7637 * |
| 6848 * @return the statement that is executed if the condition evaluates to `false
` | 7638 * @return the statement that is executed if the condition evaluates to `false
` |
| 6849 */ | 7639 */ |
| 6850 Statement get elseStatement => _elseStatement; | 7640 Statement get elseStatement => _elseStatement; |
| 6851 Token get endToken { | 7641 Token get endToken { |
| 6852 if (_elseStatement != null) { | 7642 if (_elseStatement != null) { |
| 6853 return _elseStatement.endToken; | 7643 return _elseStatement.endToken; |
| 6854 } | 7644 } |
| 6855 return _thenStatement.endToken; | 7645 return _thenStatement.endToken; |
| 6856 } | 7646 } |
| 6857 | 7647 |
| 6858 /** | 7648 /** |
| 6859 * Return the token representing the 'if' keyword. | 7649 * Return the token representing the 'if' keyword. |
| 7650 * |
| 6860 * @return the token representing the 'if' keyword | 7651 * @return the token representing the 'if' keyword |
| 6861 */ | 7652 */ |
| 6862 Token get ifKeyword => _ifKeyword; | 7653 Token get ifKeyword => _ifKeyword; |
| 6863 | 7654 |
| 6864 /** | 7655 /** |
| 6865 * Return the left parenthesis. | 7656 * Return the left parenthesis. |
| 7657 * |
| 6866 * @return the left parenthesis | 7658 * @return the left parenthesis |
| 6867 */ | 7659 */ |
| 6868 Token get leftParenthesis => _leftParenthesis; | 7660 Token get leftParenthesis => _leftParenthesis; |
| 6869 | 7661 |
| 6870 /** | 7662 /** |
| 6871 * Return the right parenthesis. | 7663 * Return the right parenthesis. |
| 7664 * |
| 6872 * @return the right parenthesis | 7665 * @return the right parenthesis |
| 6873 */ | 7666 */ |
| 6874 Token get rightParenthesis => _rightParenthesis; | 7667 Token get rightParenthesis => _rightParenthesis; |
| 6875 | 7668 |
| 6876 /** | 7669 /** |
| 6877 * Return the statement that is executed if the condition evaluates to `true`. | 7670 * Return the statement that is executed if the condition evaluates to `true`. |
| 7671 * |
| 6878 * @return the statement that is executed if the condition evaluates to `true` | 7672 * @return the statement that is executed if the condition evaluates to `true` |
| 6879 */ | 7673 */ |
| 6880 Statement get thenStatement => _thenStatement; | 7674 Statement get thenStatement => _thenStatement; |
| 6881 | 7675 |
| 6882 /** | 7676 /** |
| 6883 * Set the condition used to determine which of the statements is executed nex
t to the given | 7677 * Set the condition used to determine which of the statements is executed nex
t to the given |
| 6884 * expression. | 7678 * expression. |
| 7679 * |
| 6885 * @param expression the condition used to determine which statement is execut
ed next | 7680 * @param expression the condition used to determine which statement is execut
ed next |
| 6886 */ | 7681 */ |
| 6887 void set condition(Expression expression) { | 7682 void set condition(Expression expression) { |
| 6888 _condition = becomeParentOf(expression); | 7683 _condition = becomeParentOf(expression); |
| 6889 } | 7684 } |
| 6890 | 7685 |
| 6891 /** | 7686 /** |
| 6892 * Set the token representing the 'else' keyword to the given token. | 7687 * Set the token representing the 'else' keyword to the given token. |
| 7688 * |
| 6893 * @param elseKeyword the token representing the 'else' keyword | 7689 * @param elseKeyword the token representing the 'else' keyword |
| 6894 */ | 7690 */ |
| 6895 void set elseKeyword(Token elseKeyword2) { | 7691 void set elseKeyword(Token elseKeyword2) { |
| 6896 this._elseKeyword = elseKeyword2; | 7692 this._elseKeyword = elseKeyword2; |
| 6897 } | 7693 } |
| 6898 | 7694 |
| 6899 /** | 7695 /** |
| 6900 * Set the statement that is executed if the condition evaluates to `false` to
the given | 7696 * Set the statement that is executed if the condition evaluates to `false` to
the given |
| 6901 * statement. | 7697 * statement. |
| 7698 * |
| 6902 * @param statement the statement that is executed if the condition evaluates
to `false` | 7699 * @param statement the statement that is executed if the condition evaluates
to `false` |
| 6903 */ | 7700 */ |
| 6904 void set elseStatement(Statement statement) { | 7701 void set elseStatement(Statement statement) { |
| 6905 _elseStatement = becomeParentOf(statement); | 7702 _elseStatement = becomeParentOf(statement); |
| 6906 } | 7703 } |
| 6907 | 7704 |
| 6908 /** | 7705 /** |
| 6909 * Set the token representing the 'if' keyword to the given token. | 7706 * Set the token representing the 'if' keyword to the given token. |
| 7707 * |
| 6910 * @param ifKeyword the token representing the 'if' keyword | 7708 * @param ifKeyword the token representing the 'if' keyword |
| 6911 */ | 7709 */ |
| 6912 void set ifKeyword(Token ifKeyword2) { | 7710 void set ifKeyword(Token ifKeyword2) { |
| 6913 this._ifKeyword = ifKeyword2; | 7711 this._ifKeyword = ifKeyword2; |
| 6914 } | 7712 } |
| 6915 | 7713 |
| 6916 /** | 7714 /** |
| 6917 * Set the left parenthesis to the given token. | 7715 * Set the left parenthesis to the given token. |
| 7716 * |
| 6918 * @param leftParenthesis the left parenthesis | 7717 * @param leftParenthesis the left parenthesis |
| 6919 */ | 7718 */ |
| 6920 void set leftParenthesis(Token leftParenthesis2) { | 7719 void set leftParenthesis(Token leftParenthesis2) { |
| 6921 this._leftParenthesis = leftParenthesis2; | 7720 this._leftParenthesis = leftParenthesis2; |
| 6922 } | 7721 } |
| 6923 | 7722 |
| 6924 /** | 7723 /** |
| 6925 * Set the right parenthesis to the given token. | 7724 * Set the right parenthesis to the given token. |
| 7725 * |
| 6926 * @param rightParenthesis the right parenthesis | 7726 * @param rightParenthesis the right parenthesis |
| 6927 */ | 7727 */ |
| 6928 void set rightParenthesis(Token rightParenthesis2) { | 7728 void set rightParenthesis(Token rightParenthesis2) { |
| 6929 this._rightParenthesis = rightParenthesis2; | 7729 this._rightParenthesis = rightParenthesis2; |
| 6930 } | 7730 } |
| 6931 | 7731 |
| 6932 /** | 7732 /** |
| 6933 * Set the statement that is executed if the condition evaluates to `true` to
the given | 7733 * Set the statement that is executed if the condition evaluates to `true` to
the given |
| 6934 * statement. | 7734 * statement. |
| 7735 * |
| 6935 * @param statement the statement that is executed if the condition evaluates
to `true` | 7736 * @param statement the statement that is executed if the condition evaluates
to `true` |
| 6936 */ | 7737 */ |
| 6937 void set thenStatement(Statement statement) { | 7738 void set thenStatement(Statement statement) { |
| 6938 _thenStatement = becomeParentOf(statement); | 7739 _thenStatement = becomeParentOf(statement); |
| 6939 } | 7740 } |
| 6940 void visitChildren(ASTVisitor<Object> visitor) { | 7741 void visitChildren(ASTVisitor<Object> visitor) { |
| 6941 safelyVisitChild(_condition, visitor); | 7742 safelyVisitChild(_condition, visitor); |
| 6942 safelyVisitChild(_thenStatement, visitor); | 7743 safelyVisitChild(_thenStatement, visitor); |
| 6943 safelyVisitChild(_elseStatement, visitor); | 7744 safelyVisitChild(_elseStatement, visitor); |
| 6944 } | 7745 } |
| 6945 } | 7746 } |
| 6946 /** | 7747 /** |
| 6947 * Instances of the class `ImplementsClause` represent the "implements" clause i
n an class | 7748 * Instances of the class `ImplementsClause` represent the "implements" clause i
n an class |
| 6948 * declaration. | 7749 * declaration. |
| 7750 * |
| 6949 * <pre> | 7751 * <pre> |
| 6950 * implementsClause ::= | 7752 * implementsClause ::= |
| 6951 * 'implements' [TypeName superclass] (',' [TypeName superclass]) | 7753 * 'implements' [TypeName] (',' [TypeName])* |
| 6952 * </pre> | 7754 * </pre> |
| 7755 * |
| 6953 * @coverage dart.engine.ast | 7756 * @coverage dart.engine.ast |
| 6954 */ | 7757 */ |
| 6955 class ImplementsClause extends ASTNode { | 7758 class ImplementsClause extends ASTNode { |
| 6956 | 7759 |
| 6957 /** | 7760 /** |
| 6958 * The token representing the 'implements' keyword. | 7761 * The token representing the 'implements' keyword. |
| 6959 */ | 7762 */ |
| 6960 Token _keyword; | 7763 Token _keyword; |
| 6961 | 7764 |
| 6962 /** | 7765 /** |
| 6963 * The interfaces that are being implemented. | 7766 * The interfaces that are being implemented. |
| 6964 */ | 7767 */ |
| 6965 NodeList<TypeName> _interfaces; | 7768 NodeList<TypeName> _interfaces; |
| 6966 | 7769 |
| 6967 /** | 7770 /** |
| 6968 * Initialize a newly created extends clause. | 7771 * Initialize a newly created extends clause. |
| 7772 * |
| 6969 * @param keyword the token representing the 'implements' keyword | 7773 * @param keyword the token representing the 'implements' keyword |
| 6970 * @param interfaces the interfaces that are being implemented | 7774 * @param interfaces the interfaces that are being implemented |
| 6971 */ | 7775 */ |
| 6972 ImplementsClause.full(Token keyword, List<TypeName> interfaces) { | 7776 ImplementsClause.full(Token keyword, List<TypeName> interfaces) { |
| 6973 this._interfaces = new NodeList<TypeName>(this); | 7777 this._interfaces = new NodeList<TypeName>(this); |
| 6974 this._keyword = keyword; | 7778 this._keyword = keyword; |
| 6975 this._interfaces.addAll(interfaces); | 7779 this._interfaces.addAll(interfaces); |
| 6976 } | 7780 } |
| 6977 | 7781 |
| 6978 /** | 7782 /** |
| 6979 * Initialize a newly created extends clause. | 7783 * Initialize a newly created extends clause. |
| 7784 * |
| 6980 * @param keyword the token representing the 'implements' keyword | 7785 * @param keyword the token representing the 'implements' keyword |
| 6981 * @param interfaces the interfaces that are being implemented | 7786 * @param interfaces the interfaces that are being implemented |
| 6982 */ | 7787 */ |
| 6983 ImplementsClause({Token keyword, List<TypeName> interfaces}) : this.full(keywo
rd, interfaces); | 7788 ImplementsClause({Token keyword, List<TypeName> interfaces}) : this.full(keywo
rd, interfaces); |
| 6984 accept(ASTVisitor visitor) => visitor.visitImplementsClause(this); | 7789 accept(ASTVisitor visitor) => visitor.visitImplementsClause(this); |
| 6985 Token get beginToken => _keyword; | 7790 Token get beginToken => _keyword; |
| 6986 Token get endToken => _interfaces.endToken; | 7791 Token get endToken => _interfaces.endToken; |
| 6987 | 7792 |
| 6988 /** | 7793 /** |
| 6989 * Return the list of the interfaces that are being implemented. | 7794 * Return the list of the interfaces that are being implemented. |
| 7795 * |
| 6990 * @return the list of the interfaces that are being implemented | 7796 * @return the list of the interfaces that are being implemented |
| 6991 */ | 7797 */ |
| 6992 NodeList<TypeName> get interfaces => _interfaces; | 7798 NodeList<TypeName> get interfaces => _interfaces; |
| 6993 | 7799 |
| 6994 /** | 7800 /** |
| 6995 * Return the token representing the 'implements' keyword. | 7801 * Return the token representing the 'implements' keyword. |
| 7802 * |
| 6996 * @return the token representing the 'implements' keyword | 7803 * @return the token representing the 'implements' keyword |
| 6997 */ | 7804 */ |
| 6998 Token get keyword => _keyword; | 7805 Token get keyword => _keyword; |
| 6999 | 7806 |
| 7000 /** | 7807 /** |
| 7001 * Set the token representing the 'implements' keyword to the given token. | 7808 * Set the token representing the 'implements' keyword to the given token. |
| 7809 * |
| 7002 * @param keyword the token representing the 'implements' keyword | 7810 * @param keyword the token representing the 'implements' keyword |
| 7003 */ | 7811 */ |
| 7004 void set keyword(Token keyword2) { | 7812 void set keyword(Token keyword2) { |
| 7005 this._keyword = keyword2; | 7813 this._keyword = keyword2; |
| 7006 } | 7814 } |
| 7007 void visitChildren(ASTVisitor<Object> visitor) { | 7815 void visitChildren(ASTVisitor<Object> visitor) { |
| 7008 _interfaces.accept(visitor); | 7816 _interfaces.accept(visitor); |
| 7009 } | 7817 } |
| 7010 } | 7818 } |
| 7011 /** | 7819 /** |
| 7012 * Instances of the class `ImportDirective` represent an import directive. | 7820 * Instances of the class `ImportDirective` represent an import directive. |
| 7821 * |
| 7013 * <pre> | 7822 * <pre> |
| 7014 * importDirective ::=[Annotation metadata] 'import' [StringLiteral libraryUri]
('as' identifier)? [Combinator combinator]* ';' | 7823 * importDirective ::= |
| 7824 * [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]* ';
' |
| 7015 * </pre> | 7825 * </pre> |
| 7826 * |
| 7016 * @coverage dart.engine.ast | 7827 * @coverage dart.engine.ast |
| 7017 */ | 7828 */ |
| 7018 class ImportDirective extends NamespaceDirective { | 7829 class ImportDirective extends NamespaceDirective { |
| 7019 | 7830 |
| 7020 /** | 7831 /** |
| 7021 * The token representing the 'as' token, or `null` if the imported names are
not prefixed. | 7832 * The token representing the 'as' token, or `null` if the imported names are
not prefixed. |
| 7022 */ | 7833 */ |
| 7023 Token _asToken; | 7834 Token _asToken; |
| 7024 | 7835 |
| 7025 /** | 7836 /** |
| 7026 * The prefix to be used with the imported names, or `null` if the imported na
mes are not | 7837 * The prefix to be used with the imported names, or `null` if the imported na
mes are not |
| 7027 * prefixed. | 7838 * prefixed. |
| 7028 */ | 7839 */ |
| 7029 SimpleIdentifier _prefix; | 7840 SimpleIdentifier _prefix; |
| 7030 | 7841 |
| 7031 /** | 7842 /** |
| 7032 * Initialize a newly created import directive. | 7843 * Initialize a newly created import directive. |
| 7844 * |
| 7033 * @param comment the documentation comment associated with this directive | 7845 * @param comment the documentation comment associated with this directive |
| 7034 * @param metadata the annotations associated with the directive | 7846 * @param metadata the annotations associated with the directive |
| 7035 * @param keyword the token representing the 'import' keyword | 7847 * @param keyword the token representing the 'import' keyword |
| 7036 * @param libraryUri the URI of the library being imported | 7848 * @param libraryUri the URI of the library being imported |
| 7037 * @param asToken the token representing the 'as' token | 7849 * @param asToken the token representing the 'as' token |
| 7038 * @param prefix the prefix to be used with the imported names | 7850 * @param prefix the prefix to be used with the imported names |
| 7039 * @param combinators the combinators used to control how names are imported | 7851 * @param combinators the combinators used to control how names are imported |
| 7040 * @param semicolon the semicolon terminating the directive | 7852 * @param semicolon the semicolon terminating the directive |
| 7041 */ | 7853 */ |
| 7042 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) { | 7854 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) { |
| 7043 this._asToken = asToken; | 7855 this._asToken = asToken; |
| 7044 this._prefix = becomeParentOf(prefix); | 7856 this._prefix = becomeParentOf(prefix); |
| 7045 } | 7857 } |
| 7046 | 7858 |
| 7047 /** | 7859 /** |
| 7048 * Initialize a newly created import directive. | 7860 * Initialize a newly created import directive. |
| 7861 * |
| 7049 * @param comment the documentation comment associated with this directive | 7862 * @param comment the documentation comment associated with this directive |
| 7050 * @param metadata the annotations associated with the directive | 7863 * @param metadata the annotations associated with the directive |
| 7051 * @param keyword the token representing the 'import' keyword | 7864 * @param keyword the token representing the 'import' keyword |
| 7052 * @param libraryUri the URI of the library being imported | 7865 * @param libraryUri the URI of the library being imported |
| 7053 * @param asToken the token representing the 'as' token | 7866 * @param asToken the token representing the 'as' token |
| 7054 * @param prefix the prefix to be used with the imported names | 7867 * @param prefix the prefix to be used with the imported names |
| 7055 * @param combinators the combinators used to control how names are imported | 7868 * @param combinators the combinators used to control how names are imported |
| 7056 * @param semicolon the semicolon terminating the directive | 7869 * @param semicolon the semicolon terminating the directive |
| 7057 */ | 7870 */ |
| 7058 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); | 7871 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); |
| 7059 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); | 7872 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); |
| 7060 | 7873 |
| 7061 /** | 7874 /** |
| 7062 * Return the token representing the 'as' token, or `null` if the imported nam
es are not | 7875 * Return the token representing the 'as' token, or `null` if the imported nam
es are not |
| 7063 * prefixed. | 7876 * prefixed. |
| 7877 * |
| 7064 * @return the token representing the 'as' token | 7878 * @return the token representing the 'as' token |
| 7065 */ | 7879 */ |
| 7066 Token get asToken => _asToken; | 7880 Token get asToken => _asToken; |
| 7067 | 7881 |
| 7068 /** | 7882 /** |
| 7069 * Return the prefix to be used with the imported names, or `null` if the impo
rted names are | 7883 * Return the prefix to be used with the imported names, or `null` if the impo
rted names are |
| 7070 * not prefixed. | 7884 * not prefixed. |
| 7885 * |
| 7071 * @return the prefix to be used with the imported names | 7886 * @return the prefix to be used with the imported names |
| 7072 */ | 7887 */ |
| 7073 SimpleIdentifier get prefix => _prefix; | 7888 SimpleIdentifier get prefix => _prefix; |
| 7074 LibraryElement get uriElement { | 7889 LibraryElement get uriElement { |
| 7075 Element element = this.element; | 7890 Element element = this.element; |
| 7076 if (element is ImportElement) { | 7891 if (element is ImportElement) { |
| 7077 return ((element as ImportElement)).importedLibrary; | 7892 return ((element as ImportElement)).importedLibrary; |
| 7078 } | 7893 } |
| 7079 return null; | 7894 return null; |
| 7080 } | 7895 } |
| 7081 | 7896 |
| 7082 /** | 7897 /** |
| 7083 * Set the token representing the 'as' token to the given token. | 7898 * Set the token representing the 'as' token to the given token. |
| 7899 * |
| 7084 * @param asToken the token representing the 'as' token | 7900 * @param asToken the token representing the 'as' token |
| 7085 */ | 7901 */ |
| 7086 void set asToken(Token asToken2) { | 7902 void set asToken(Token asToken2) { |
| 7087 this._asToken = asToken2; | 7903 this._asToken = asToken2; |
| 7088 } | 7904 } |
| 7089 | 7905 |
| 7090 /** | 7906 /** |
| 7091 * Set the prefix to be used with the imported names to the given identifier. | 7907 * Set the prefix to be used with the imported names to the given identifier. |
| 7908 * |
| 7092 * @param prefix the prefix to be used with the imported names | 7909 * @param prefix the prefix to be used with the imported names |
| 7093 */ | 7910 */ |
| 7094 void set prefix(SimpleIdentifier prefix2) { | 7911 void set prefix(SimpleIdentifier prefix2) { |
| 7095 this._prefix = becomeParentOf(prefix2); | 7912 this._prefix = becomeParentOf(prefix2); |
| 7096 } | 7913 } |
| 7097 void visitChildren(ASTVisitor<Object> visitor) { | 7914 void visitChildren(ASTVisitor<Object> visitor) { |
| 7098 super.visitChildren(visitor); | 7915 super.visitChildren(visitor); |
| 7099 safelyVisitChild(_prefix, visitor); | 7916 safelyVisitChild(_prefix, visitor); |
| 7100 combinators.accept(visitor); | 7917 combinators.accept(visitor); |
| 7101 } | 7918 } |
| 7102 } | 7919 } |
| 7103 /** | 7920 /** |
| 7104 * Instances of the class `IndexExpression` represent an index expression. | 7921 * Instances of the class `IndexExpression` represent an index expression. |
| 7922 * |
| 7105 * <pre> | 7923 * <pre> |
| 7106 * indexExpression ::=[Expression target] '\[' [Expression index] '\]' | 7924 * indexExpression ::= |
| 7925 * [Expression] '[' [Expression] ']' |
| 7107 * </pre> | 7926 * </pre> |
| 7927 * |
| 7108 * @coverage dart.engine.ast | 7928 * @coverage dart.engine.ast |
| 7109 */ | 7929 */ |
| 7110 class IndexExpression extends Expression { | 7930 class IndexExpression extends Expression { |
| 7111 | 7931 |
| 7112 /** | 7932 /** |
| 7113 * The expression used to compute the object being indexed, or `null` if this
index | 7933 * The expression used to compute the object being indexed, or `null` if this
index |
| 7114 * expression is part of a cascade expression. | 7934 * expression is part of a cascade expression. |
| 7115 */ | 7935 */ |
| 7116 Expression _target; | 7936 Expression _target; |
| 7117 | 7937 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 7130 * The expression used to compute the index. | 7950 * The expression used to compute the index. |
| 7131 */ | 7951 */ |
| 7132 Expression _index; | 7952 Expression _index; |
| 7133 | 7953 |
| 7134 /** | 7954 /** |
| 7135 * The right square bracket. | 7955 * The right square bracket. |
| 7136 */ | 7956 */ |
| 7137 Token _rightBracket; | 7957 Token _rightBracket; |
| 7138 | 7958 |
| 7139 /** | 7959 /** |
| 7140 * The element associated with the operator based on the static type of the ta
rget, or`null` if the AST structure has not been resolved or if the operator cou
ld not be | 7960 * The element associated with the operator based on the static type of the ta
rget, or |
| 7961 * `null` if the AST structure has not been resolved or if the operator could
not be |
| 7141 * resolved. | 7962 * resolved. |
| 7142 */ | 7963 */ |
| 7143 MethodElement _staticElement; | 7964 MethodElement _staticElement; |
| 7144 | 7965 |
| 7145 /** | 7966 /** |
| 7146 * The element associated with the operator based on the propagated type of th
e target, or`null` if the AST structure has not been resolved or if the operator
could not be | 7967 * The element associated with the operator based on the propagated type of th
e target, or |
| 7968 * `null` if the AST structure has not been resolved or if the operator could
not be |
| 7147 * resolved. | 7969 * resolved. |
| 7148 */ | 7970 */ |
| 7149 MethodElement _propagatedElement; | 7971 MethodElement _propagatedElement; |
| 7150 | 7972 |
| 7151 /** | 7973 /** |
| 7152 * Initialize a newly created index expression. | 7974 * Initialize a newly created index expression. |
| 7975 * |
| 7153 * @param target the expression used to compute the object being indexed | 7976 * @param target the expression used to compute the object being indexed |
| 7154 * @param leftBracket the left square bracket | 7977 * @param leftBracket the left square bracket |
| 7155 * @param index the expression used to compute the index | 7978 * @param index the expression used to compute the index |
| 7156 * @param rightBracket the right square bracket | 7979 * @param rightBracket the right square bracket |
| 7157 */ | 7980 */ |
| 7158 IndexExpression.forTarget_full(Expression target2, Token leftBracket2, Express
ion index2, Token rightBracket2) { | 7981 IndexExpression.forTarget_full(Expression target2, Token leftBracket2, Express
ion index2, Token rightBracket2) { |
| 7159 _jtd_constructor_58_impl(target2, leftBracket2, index2, rightBracket2); | 7982 _jtd_constructor_58_impl(target2, leftBracket2, index2, rightBracket2); |
| 7160 } | 7983 } |
| 7161 | 7984 |
| 7162 /** | 7985 /** |
| 7163 * Initialize a newly created index expression. | 7986 * Initialize a newly created index expression. |
| 7987 * |
| 7164 * @param target the expression used to compute the object being indexed | 7988 * @param target the expression used to compute the object being indexed |
| 7165 * @param leftBracket the left square bracket | 7989 * @param leftBracket the left square bracket |
| 7166 * @param index the expression used to compute the index | 7990 * @param index the expression used to compute the index |
| 7167 * @param rightBracket the right square bracket | 7991 * @param rightBracket the right square bracket |
| 7168 */ | 7992 */ |
| 7169 IndexExpression.forTarget({Expression target2, Token leftBracket2, Expression
index2, Token rightBracket2}) : this.forTarget_full(target2, leftBracket2, index
2, rightBracket2); | 7993 IndexExpression.forTarget({Expression target2, Token leftBracket2, Expression
index2, Token rightBracket2}) : this.forTarget_full(target2, leftBracket2, index
2, rightBracket2); |
| 7170 _jtd_constructor_58_impl(Expression target2, Token leftBracket2, Expression in
dex2, Token rightBracket2) { | 7994 _jtd_constructor_58_impl(Expression target2, Token leftBracket2, Expression in
dex2, Token rightBracket2) { |
| 7171 this._target = becomeParentOf(target2); | 7995 this._target = becomeParentOf(target2); |
| 7172 this._leftBracket = leftBracket2; | 7996 this._leftBracket = leftBracket2; |
| 7173 this._index = becomeParentOf(index2); | 7997 this._index = becomeParentOf(index2); |
| 7174 this._rightBracket = rightBracket2; | 7998 this._rightBracket = rightBracket2; |
| 7175 } | 7999 } |
| 7176 | 8000 |
| 7177 /** | 8001 /** |
| 7178 * Initialize a newly created index expression. | 8002 * Initialize a newly created index expression. |
| 8003 * |
| 7179 * @param period the period ("..") before a cascaded index expression | 8004 * @param period the period ("..") before a cascaded index expression |
| 7180 * @param leftBracket the left square bracket | 8005 * @param leftBracket the left square bracket |
| 7181 * @param index the expression used to compute the index | 8006 * @param index the expression used to compute the index |
| 7182 * @param rightBracket the right square bracket | 8007 * @param rightBracket the right square bracket |
| 7183 */ | 8008 */ |
| 7184 IndexExpression.forCascade_full(Token period2, Token leftBracket2, Expression
index2, Token rightBracket2) { | 8009 IndexExpression.forCascade_full(Token period2, Token leftBracket2, Expression
index2, Token rightBracket2) { |
| 7185 _jtd_constructor_59_impl(period2, leftBracket2, index2, rightBracket2); | 8010 _jtd_constructor_59_impl(period2, leftBracket2, index2, rightBracket2); |
| 7186 } | 8011 } |
| 7187 | 8012 |
| 7188 /** | 8013 /** |
| 7189 * Initialize a newly created index expression. | 8014 * Initialize a newly created index expression. |
| 8015 * |
| 7190 * @param period the period ("..") before a cascaded index expression | 8016 * @param period the period ("..") before a cascaded index expression |
| 7191 * @param leftBracket the left square bracket | 8017 * @param leftBracket the left square bracket |
| 7192 * @param index the expression used to compute the index | 8018 * @param index the expression used to compute the index |
| 7193 * @param rightBracket the right square bracket | 8019 * @param rightBracket the right square bracket |
| 7194 */ | 8020 */ |
| 7195 IndexExpression.forCascade({Token period2, Token leftBracket2, Expression inde
x2, Token rightBracket2}) : this.forCascade_full(period2, leftBracket2, index2,
rightBracket2); | 8021 IndexExpression.forCascade({Token period2, Token leftBracket2, Expression inde
x2, Token rightBracket2}) : this.forCascade_full(period2, leftBracket2, index2,
rightBracket2); |
| 7196 _jtd_constructor_59_impl(Token period2, Token leftBracket2, Expression index2,
Token rightBracket2) { | 8022 _jtd_constructor_59_impl(Token period2, Token leftBracket2, Expression index2,
Token rightBracket2) { |
| 7197 this._period = period2; | 8023 this._period = period2; |
| 7198 this._leftBracket = leftBracket2; | 8024 this._leftBracket = leftBracket2; |
| 7199 this._index = becomeParentOf(index2); | 8025 this._index = becomeParentOf(index2); |
| 7200 this._rightBracket = rightBracket2; | 8026 this._rightBracket = rightBracket2; |
| 7201 } | 8027 } |
| 7202 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); | 8028 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); |
| 7203 | 8029 |
| 7204 /** | 8030 /** |
| 7205 * Return the expression used to compute the object being indexed, or `null` i
f this index | 8031 * Return the expression used to compute the object being indexed, or `null` i
f this index |
| 7206 * expression is part of a cascade expression. | 8032 * expression is part of a cascade expression. |
| 8033 * |
| 7207 * @return the expression used to compute the object being indexed | 8034 * @return the expression used to compute the object being indexed |
| 7208 * @see #getRealTarget() | 8035 * @see #getRealTarget() |
| 7209 */ | 8036 */ |
| 7210 Expression get array => _target; | 8037 Expression get array => _target; |
| 7211 Token get beginToken { | 8038 Token get beginToken { |
| 7212 if (_target != null) { | 8039 if (_target != null) { |
| 7213 return _target.beginToken; | 8040 return _target.beginToken; |
| 7214 } | 8041 } |
| 7215 return _period; | 8042 return _period; |
| 7216 } | 8043 } |
| 7217 | 8044 |
| 7218 /** | 8045 /** |
| 7219 * Return the element associated with the operator based on the propagated typ
e of the target, or`null` if the AST structure has not been resolved or if the o
perator could not be | 8046 * Return the element associated with the operator based on the propagated typ
e of the target, or |
| 8047 * `null` if the AST structure has not been resolved or if the operator could
not be |
| 7220 * resolved. One example of the latter case is an operator that is not defined
for the type of the | 8048 * resolved. One example of the latter case is an operator that is not defined
for the type of the |
| 7221 * target. | 8049 * target. |
| 8050 * |
| 7222 * @return the element associated with this operator | 8051 * @return the element associated with this operator |
| 7223 */ | 8052 */ |
| 7224 MethodElement get element => _propagatedElement; | 8053 MethodElement get element => _propagatedElement; |
| 7225 Token get endToken => _rightBracket; | 8054 Token get endToken => _rightBracket; |
| 7226 | 8055 |
| 7227 /** | 8056 /** |
| 7228 * Return the expression used to compute the index. | 8057 * Return the expression used to compute the index. |
| 8058 * |
| 7229 * @return the expression used to compute the index | 8059 * @return the expression used to compute the index |
| 7230 */ | 8060 */ |
| 7231 Expression get index => _index; | 8061 Expression get index => _index; |
| 7232 | 8062 |
| 7233 /** | 8063 /** |
| 7234 * Return the left square bracket. | 8064 * Return the left square bracket. |
| 8065 * |
| 7235 * @return the left square bracket | 8066 * @return the left square bracket |
| 7236 */ | 8067 */ |
| 7237 Token get leftBracket => _leftBracket; | 8068 Token get leftBracket => _leftBracket; |
| 7238 | 8069 |
| 7239 /** | 8070 /** |
| 7240 * Return the period ("..") before a cascaded index expression, or `null` if t
his index | 8071 * Return the period ("..") before a cascaded index expression, or `null` if t
his index |
| 7241 * expression is not part of a cascade expression. | 8072 * expression is not part of a cascade expression. |
| 8073 * |
| 7242 * @return the period ("..") before a cascaded index expression | 8074 * @return the period ("..") before a cascaded index expression |
| 7243 */ | 8075 */ |
| 7244 Token get period => _period; | 8076 Token get period => _period; |
| 7245 | 8077 |
| 7246 /** | 8078 /** |
| 7247 * Return the expression used to compute the object being indexed. If this ind
ex expression is not | 8079 * Return the expression used to compute the object being indexed. If this ind
ex expression is not |
| 7248 * part of a cascade expression, then this is the same as [getArray]. If this
index | 8080 * part of a cascade expression, then this is the same as [getArray]. If this
index |
| 7249 * expression is part of a cascade expression, then the target expression stor
ed with the cascade | 8081 * expression is part of a cascade expression, then the target expression stor
ed with the cascade |
| 7250 * expression is returned. | 8082 * expression is returned. |
| 8083 * |
| 7251 * @return the expression used to compute the object being indexed | 8084 * @return the expression used to compute the object being indexed |
| 7252 * @see #getArray() | 8085 * @see #getArray() |
| 7253 */ | 8086 */ |
| 7254 Expression get realTarget { | 8087 Expression get realTarget { |
| 7255 if (isCascaded) { | 8088 if (isCascaded) { |
| 7256 ASTNode ancestor = parent; | 8089 ASTNode ancestor = parent; |
| 7257 while (ancestor is! CascadeExpression) { | 8090 while (ancestor is! CascadeExpression) { |
| 7258 if (ancestor == null) { | 8091 if (ancestor == null) { |
| 7259 return _target; | 8092 return _target; |
| 7260 } | 8093 } |
| 7261 ancestor = ancestor.parent; | 8094 ancestor = ancestor.parent; |
| 7262 } | 8095 } |
| 7263 return ((ancestor as CascadeExpression)).target; | 8096 return ((ancestor as CascadeExpression)).target; |
| 7264 } | 8097 } |
| 7265 return _target; | 8098 return _target; |
| 7266 } | 8099 } |
| 7267 | 8100 |
| 7268 /** | 8101 /** |
| 7269 * Return the right square bracket. | 8102 * Return the right square bracket. |
| 8103 * |
| 7270 * @return the right square bracket | 8104 * @return the right square bracket |
| 7271 */ | 8105 */ |
| 7272 Token get rightBracket => _rightBracket; | 8106 Token get rightBracket => _rightBracket; |
| 7273 | 8107 |
| 7274 /** | 8108 /** |
| 7275 * Return the element associated with the operator based on the static type of
the target, or`null` if the AST structure has not been resolved or if the opera
tor could not be | 8109 * Return the element associated with the operator based on the static type of
the target, or |
| 8110 * `null` if the AST structure has not been resolved or if the operator could
not be |
| 7276 * resolved. One example of the latter case is an operator that is not defined
for the type of the | 8111 * resolved. One example of the latter case is an operator that is not defined
for the type of the |
| 7277 * target. | 8112 * target. |
| 8113 * |
| 7278 * @return the element associated with the operator | 8114 * @return the element associated with the operator |
| 7279 */ | 8115 */ |
| 7280 MethodElement get staticElement => _staticElement; | 8116 MethodElement get staticElement => _staticElement; |
| 7281 | 8117 |
| 7282 /** | 8118 /** |
| 7283 * Return `true` if this expression is computing a right-hand value. | 8119 * Return `true` if this expression is computing a right-hand value. |
| 7284 * | 8120 * |
| 7285 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e | 8121 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e |
| 7286 * they mutually exclusive. In other words, it is possible for both methods to
return `true`when invoked on the same node. | 8122 * they mutually exclusive. In other words, it is possible for both methods to
return `true` |
| 7287 * @return `true` if this expression is in a context where the operator '\[\]'
will be invoked | 8123 * when invoked on the same node. |
| 8124 * |
| 8125 * @return `true` if this expression is in a context where the operator '[]' w
ill be invoked |
| 7288 */ | 8126 */ |
| 7289 bool inGetterContext() { | 8127 bool inGetterContext() { |
| 7290 ASTNode parent = this.parent; | 8128 ASTNode parent = this.parent; |
| 7291 if (parent is AssignmentExpression) { | 8129 if (parent is AssignmentExpression) { |
| 7292 AssignmentExpression assignment = parent as AssignmentExpression; | 8130 AssignmentExpression assignment = parent as AssignmentExpression; |
| 7293 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { | 8131 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { |
| 7294 return false; | 8132 return false; |
| 7295 } | 8133 } |
| 7296 } | 8134 } |
| 7297 return true; | 8135 return true; |
| 7298 } | 8136 } |
| 7299 | 8137 |
| 7300 /** | 8138 /** |
| 7301 * Return `true` if this expression is computing a left-hand value. | 8139 * Return `true` if this expression is computing a left-hand value. |
| 7302 * | 8140 * |
| 7303 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e | 8141 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e |
| 7304 * they mutually exclusive. In other words, it is possible for both methods to
return `true`when invoked on the same node. | 8142 * they mutually exclusive. In other words, it is possible for both methods to
return `true` |
| 7305 * @return `true` if this expression is in a context where the operator '\[\]=
' will be | 8143 * when invoked on the same node. |
| 7306 * invoked | 8144 * |
| 8145 * @return `true` if this expression is in a context where the operator '[]='
will be |
| 8146 * invoked |
| 7307 */ | 8147 */ |
| 7308 bool inSetterContext() { | 8148 bool inSetterContext() { |
| 7309 ASTNode parent = this.parent; | 8149 ASTNode parent = this.parent; |
| 7310 if (parent is PrefixExpression) { | 8150 if (parent is PrefixExpression) { |
| 7311 return ((parent as PrefixExpression)).operator.type.isIncrementOperator; | 8151 return ((parent as PrefixExpression)).operator.type.isIncrementOperator; |
| 7312 } else if (parent is PostfixExpression) { | 8152 } else if (parent is PostfixExpression) { |
| 7313 return true; | 8153 return true; |
| 7314 } else if (parent is AssignmentExpression) { | 8154 } else if (parent is AssignmentExpression) { |
| 7315 return identical(((parent as AssignmentExpression)).leftHandSide, this); | 8155 return identical(((parent as AssignmentExpression)).leftHandSide, this); |
| 7316 } | 8156 } |
| 7317 return false; | 8157 return false; |
| 7318 } | 8158 } |
| 7319 bool get isAssignable => true; | 8159 bool get isAssignable => true; |
| 7320 | 8160 |
| 7321 /** | 8161 /** |
| 7322 * Return `true` if this expression is cascaded. If it is, then the target of
this | 8162 * Return `true` if this expression is cascaded. If it is, then the target of
this |
| 7323 * expression is not stored locally but is stored in the nearest ancestor that
is a[CascadeExpression]. | 8163 * expression is not stored locally but is stored in the nearest ancestor that
is a |
| 8164 * [CascadeExpression]. |
| 8165 * |
| 7324 * @return `true` if this expression is cascaded | 8166 * @return `true` if this expression is cascaded |
| 7325 */ | 8167 */ |
| 7326 bool get isCascaded => _period != null; | 8168 bool get isCascaded => _period != null; |
| 7327 | 8169 |
| 7328 /** | 8170 /** |
| 7329 * Set the expression used to compute the object being indexed to the given ex
pression. | 8171 * Set the expression used to compute the object being indexed to the given ex
pression. |
| 8172 * |
| 7330 * @param expression the expression used to compute the object being indexed | 8173 * @param expression the expression used to compute the object being indexed |
| 7331 */ | 8174 */ |
| 7332 void set array(Expression expression) { | 8175 void set array(Expression expression) { |
| 7333 _target = becomeParentOf(expression); | 8176 _target = becomeParentOf(expression); |
| 7334 } | 8177 } |
| 7335 | 8178 |
| 7336 /** | 8179 /** |
| 7337 * Set the element associated with the operator based on the propagated type o
f the target to the | 8180 * Set the element associated with the operator based on the propagated type o
f the target to the |
| 7338 * given element. | 8181 * given element. |
| 8182 * |
| 7339 * @param element the element to be associated with this operator | 8183 * @param element the element to be associated with this operator |
| 7340 */ | 8184 */ |
| 7341 void set element(MethodElement element2) { | 8185 void set element(MethodElement element2) { |
| 7342 _propagatedElement = element2; | 8186 _propagatedElement = element2; |
| 7343 } | 8187 } |
| 7344 | 8188 |
| 7345 /** | 8189 /** |
| 7346 * Set the expression used to compute the index to the given expression. | 8190 * Set the expression used to compute the index to the given expression. |
| 8191 * |
| 7347 * @param expression the expression used to compute the index | 8192 * @param expression the expression used to compute the index |
| 7348 */ | 8193 */ |
| 7349 void set index(Expression expression) { | 8194 void set index(Expression expression) { |
| 7350 _index = becomeParentOf(expression); | 8195 _index = becomeParentOf(expression); |
| 7351 } | 8196 } |
| 7352 | 8197 |
| 7353 /** | 8198 /** |
| 7354 * Set the left square bracket to the given token. | 8199 * Set the left square bracket to the given token. |
| 8200 * |
| 7355 * @param bracket the left square bracket | 8201 * @param bracket the left square bracket |
| 7356 */ | 8202 */ |
| 7357 void set leftBracket(Token bracket) { | 8203 void set leftBracket(Token bracket) { |
| 7358 _leftBracket = bracket; | 8204 _leftBracket = bracket; |
| 7359 } | 8205 } |
| 7360 | 8206 |
| 7361 /** | 8207 /** |
| 7362 * Set the period ("..") before a cascaded index expression to the given token
. | 8208 * Set the period ("..") before a cascaded index expression to the given token
. |
| 8209 * |
| 7363 * @param period the period ("..") before a cascaded index expression | 8210 * @param period the period ("..") before a cascaded index expression |
| 7364 */ | 8211 */ |
| 7365 void set period(Token period2) { | 8212 void set period(Token period2) { |
| 7366 this._period = period2; | 8213 this._period = period2; |
| 7367 } | 8214 } |
| 7368 | 8215 |
| 7369 /** | 8216 /** |
| 7370 * Set the right square bracket to the given token. | 8217 * Set the right square bracket to the given token. |
| 8218 * |
| 7371 * @param bracket the right square bracket | 8219 * @param bracket the right square bracket |
| 7372 */ | 8220 */ |
| 7373 void set rightBracket(Token bracket) { | 8221 void set rightBracket(Token bracket) { |
| 7374 _rightBracket = bracket; | 8222 _rightBracket = bracket; |
| 7375 } | 8223 } |
| 7376 | 8224 |
| 7377 /** | 8225 /** |
| 7378 * Set the element associated with the operator based on the static type of th
e target to the | 8226 * Set the element associated with the operator based on the static type of th
e target to the |
| 7379 * given element. | 8227 * given element. |
| 8228 * |
| 7380 * @param element the static element to be associated with the operator | 8229 * @param element the static element to be associated with the operator |
| 7381 */ | 8230 */ |
| 7382 void set staticElement(MethodElement element) { | 8231 void set staticElement(MethodElement element) { |
| 7383 _staticElement = element; | 8232 _staticElement = element; |
| 7384 } | 8233 } |
| 7385 void visitChildren(ASTVisitor<Object> visitor) { | 8234 void visitChildren(ASTVisitor<Object> visitor) { |
| 7386 safelyVisitChild(_target, visitor); | 8235 safelyVisitChild(_target, visitor); |
| 7387 safelyVisitChild(_index, visitor); | 8236 safelyVisitChild(_index, visitor); |
| 7388 } | 8237 } |
| 7389 | 8238 |
| 7390 /** | 8239 /** |
| 7391 * If the AST structure has been resolved, and the function being invoked is k
nown based on | 8240 * If the AST structure has been resolved, and the function being invoked is k
nown based on |
| 7392 * propagated type information, then return the parameter element representing
the parameter to | 8241 * propagated type information, then return the parameter element representing
the parameter to |
| 7393 * which the value of the index expression will be bound. Otherwise, return `n
ull`. | 8242 * which the value of the index expression will be bound. Otherwise, return `n
ull`. |
| 7394 * | 8243 * |
| 7395 * This method is only intended to be used by [Expression#getParameterElement]
. | 8244 * This method is only intended to be used by [Expression#getParameterElement]
. |
| 8245 * |
| 7396 * @return the parameter element representing the parameter to which the value
of the index | 8246 * @return the parameter element representing the parameter to which the value
of the index |
| 7397 * expression will be bound | 8247 * expression will be bound |
| 7398 */ | 8248 */ |
| 7399 ParameterElement get propagatedParameterElementForIndex { | 8249 ParameterElement get propagatedParameterElementForIndex { |
| 7400 if (_propagatedElement == null) { | 8250 if (_propagatedElement == null) { |
| 7401 return null; | 8251 return null; |
| 7402 } | 8252 } |
| 7403 List<ParameterElement> parameters = _propagatedElement.parameters; | 8253 List<ParameterElement> parameters = _propagatedElement.parameters; |
| 7404 if (parameters.length < 1) { | 8254 if (parameters.length < 1) { |
| 7405 return null; | 8255 return null; |
| 7406 } | 8256 } |
| 7407 return parameters[0]; | 8257 return parameters[0]; |
| 7408 } | 8258 } |
| 7409 | 8259 |
| 7410 /** | 8260 /** |
| 7411 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 8261 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
| 7412 * type information, then return the parameter element representing the parame
ter to which the | 8262 * type information, then return the parameter element representing the parame
ter to which the |
| 7413 * value of the index expression will be bound. Otherwise, return `null`. | 8263 * value of the index expression will be bound. Otherwise, return `null`. |
| 7414 * | 8264 * |
| 7415 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. | 8265 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. |
| 8266 * |
| 7416 * @return the parameter element representing the parameter to which the value
of the index | 8267 * @return the parameter element representing the parameter to which the value
of the index |
| 7417 * expression will be bound | 8268 * expression will be bound |
| 7418 */ | 8269 */ |
| 7419 ParameterElement get staticParameterElementForIndex { | 8270 ParameterElement get staticParameterElementForIndex { |
| 7420 if (_staticElement == null) { | 8271 if (_staticElement == null) { |
| 7421 return null; | 8272 return null; |
| 7422 } | 8273 } |
| 7423 List<ParameterElement> parameters = _staticElement.parameters; | 8274 List<ParameterElement> parameters = _staticElement.parameters; |
| 7424 if (parameters.length < 1) { | 8275 if (parameters.length < 1) { |
| 7425 return null; | 8276 return null; |
| 7426 } | 8277 } |
| 7427 return parameters[0]; | 8278 return parameters[0]; |
| 7428 } | 8279 } |
| 7429 } | 8280 } |
| 7430 /** | 8281 /** |
| 7431 * Instances of the class `InstanceCreationExpression` represent an instance cre
ation | 8282 * Instances of the class `InstanceCreationExpression` represent an instance cre
ation |
| 7432 * expression. | 8283 * expression. |
| 8284 * |
| 7433 * <pre> | 8285 * <pre> |
| 7434 * newExpression ::= | 8286 * newExpression ::= |
| 7435 * ('new' | 'const') [TypeName type] ('.' [SimpleIdentifier identifier])? [Argum
entList argumentList]</pre> | 8287 * ('new' | 'const') [TypeName] ('.' [SimpleIdentifier])? [ArgumentList] |
| 8288 * </pre> |
| 8289 * |
| 7436 * @coverage dart.engine.ast | 8290 * @coverage dart.engine.ast |
| 7437 */ | 8291 */ |
| 7438 class InstanceCreationExpression extends Expression { | 8292 class InstanceCreationExpression extends Expression { |
| 7439 | 8293 |
| 7440 /** | 8294 /** |
| 7441 * The keyword used to indicate how an object should be created. | 8295 * The keyword used to indicate how an object should be created. |
| 7442 */ | 8296 */ |
| 7443 Token _keyword; | 8297 Token _keyword; |
| 7444 | 8298 |
| 7445 /** | 8299 /** |
| 7446 * The name of the constructor to be invoked. | 8300 * The name of the constructor to be invoked. |
| 7447 */ | 8301 */ |
| 7448 ConstructorName _constructorName; | 8302 ConstructorName _constructorName; |
| 7449 | 8303 |
| 7450 /** | 8304 /** |
| 7451 * The list of arguments to the constructor. | 8305 * The list of arguments to the constructor. |
| 7452 */ | 8306 */ |
| 7453 ArgumentList _argumentList; | 8307 ArgumentList _argumentList; |
| 7454 | 8308 |
| 7455 /** | 8309 /** |
| 7456 * The element associated with the constructor based on static type informatio
n, or `null`if the AST structure has not been resolved or if the constructor cou
ld not be resolved. | 8310 * The element associated with the constructor based on static type informatio
n, or `null` |
| 8311 * if the AST structure has not been resolved or if the constructor could not
be resolved. |
| 7457 */ | 8312 */ |
| 7458 ConstructorElement _staticElement; | 8313 ConstructorElement _staticElement; |
| 7459 | 8314 |
| 7460 /** | 8315 /** |
| 7461 * The element associated with the constructor based on propagated type inform
ation, or`null` if the AST structure has not been resolved or if the constructor
could not be | 8316 * The element associated with the constructor based on propagated type inform
ation, or |
| 8317 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 7462 * resolved. | 8318 * resolved. |
| 7463 */ | 8319 */ |
| 7464 ConstructorElement _propagatedElement; | 8320 ConstructorElement _propagatedElement; |
| 7465 | 8321 |
| 7466 /** | 8322 /** |
| 7467 * Initialize a newly created instance creation expression. | 8323 * Initialize a newly created instance creation expression. |
| 8324 * |
| 7468 * @param keyword the keyword used to indicate how an object should be created | 8325 * @param keyword the keyword used to indicate how an object should be created |
| 7469 * @param constructorName the name of the constructor to be invoked | 8326 * @param constructorName the name of the constructor to be invoked |
| 7470 * @param argumentList the list of arguments to the constructor | 8327 * @param argumentList the list of arguments to the constructor |
| 7471 */ | 8328 */ |
| 7472 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName
, ArgumentList argumentList) { | 8329 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName
, ArgumentList argumentList) { |
| 7473 this._keyword = keyword; | 8330 this._keyword = keyword; |
| 7474 this._constructorName = becomeParentOf(constructorName); | 8331 this._constructorName = becomeParentOf(constructorName); |
| 7475 this._argumentList = becomeParentOf(argumentList); | 8332 this._argumentList = becomeParentOf(argumentList); |
| 7476 } | 8333 } |
| 7477 | 8334 |
| 7478 /** | 8335 /** |
| 7479 * Initialize a newly created instance creation expression. | 8336 * Initialize a newly created instance creation expression. |
| 8337 * |
| 7480 * @param keyword the keyword used to indicate how an object should be created | 8338 * @param keyword the keyword used to indicate how an object should be created |
| 7481 * @param constructorName the name of the constructor to be invoked | 8339 * @param constructorName the name of the constructor to be invoked |
| 7482 * @param argumentList the list of arguments to the constructor | 8340 * @param argumentList the list of arguments to the constructor |
| 7483 */ | 8341 */ |
| 7484 InstanceCreationExpression({Token keyword, ConstructorName constructorName, Ar
gumentList argumentList}) : this.full(keyword, constructorName, argumentList); | 8342 InstanceCreationExpression({Token keyword, ConstructorName constructorName, Ar
gumentList argumentList}) : this.full(keyword, constructorName, argumentList); |
| 7485 accept(ASTVisitor visitor) => visitor.visitInstanceCreationExpression(this); | 8343 accept(ASTVisitor visitor) => visitor.visitInstanceCreationExpression(this); |
| 7486 | 8344 |
| 7487 /** | 8345 /** |
| 7488 * Return the list of arguments to the constructor. | 8346 * Return the list of arguments to the constructor. |
| 8347 * |
| 7489 * @return the list of arguments to the constructor | 8348 * @return the list of arguments to the constructor |
| 7490 */ | 8349 */ |
| 7491 ArgumentList get argumentList => _argumentList; | 8350 ArgumentList get argumentList => _argumentList; |
| 7492 Token get beginToken => _keyword; | 8351 Token get beginToken => _keyword; |
| 7493 | 8352 |
| 7494 /** | 8353 /** |
| 7495 * Return the name of the constructor to be invoked. | 8354 * Return the name of the constructor to be invoked. |
| 8355 * |
| 7496 * @return the name of the constructor to be invoked | 8356 * @return the name of the constructor to be invoked |
| 7497 */ | 8357 */ |
| 7498 ConstructorName get constructorName => _constructorName; | 8358 ConstructorName get constructorName => _constructorName; |
| 7499 | 8359 |
| 7500 /** | 8360 /** |
| 7501 * Return the element associated with the constructor based on propagated type
information, or`null` if the AST structure has not been resolved or if the cons
tructor could not be | 8361 * Return the element associated with the constructor based on propagated type
information, or |
| 8362 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 7502 * resolved. | 8363 * resolved. |
| 8364 * |
| 7503 * @return the element associated with the constructor | 8365 * @return the element associated with the constructor |
| 7504 */ | 8366 */ |
| 7505 ConstructorElement get element => _propagatedElement; | 8367 ConstructorElement get element => _propagatedElement; |
| 7506 Token get endToken => _argumentList.endToken; | 8368 Token get endToken => _argumentList.endToken; |
| 7507 | 8369 |
| 7508 /** | 8370 /** |
| 7509 * Return the keyword used to indicate how an object should be created. | 8371 * Return the keyword used to indicate how an object should be created. |
| 8372 * |
| 7510 * @return the keyword used to indicate how an object should be created | 8373 * @return the keyword used to indicate how an object should be created |
| 7511 */ | 8374 */ |
| 7512 Token get keyword => _keyword; | 8375 Token get keyword => _keyword; |
| 7513 | 8376 |
| 7514 /** | 8377 /** |
| 7515 * Return the element associated with the constructor based on static type inf
ormation, or`null` if the AST structure has not been resolved or if the construc
tor could not be | 8378 * Return the element associated with the constructor based on static type inf
ormation, or |
| 8379 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 7516 * resolved. | 8380 * resolved. |
| 8381 * |
| 7517 * @return the element associated with the constructor | 8382 * @return the element associated with the constructor |
| 7518 */ | 8383 */ |
| 7519 ConstructorElement get staticElement => _staticElement; | 8384 ConstructorElement get staticElement => _staticElement; |
| 7520 | 8385 |
| 7521 /** | 8386 /** |
| 7522 * Return `true` if this creation expression is used to invoke a constant cons
tructor. | 8387 * Return `true` if this creation expression is used to invoke a constant cons
tructor. |
| 8388 * |
| 7523 * @return `true` if this creation expression is used to invoke a constant con
structor | 8389 * @return `true` if this creation expression is used to invoke a constant con
structor |
| 7524 */ | 8390 */ |
| 7525 bool get isConst => _keyword is KeywordToken && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 8391 bool get isConst => _keyword is KeywordToken && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
| 7526 | 8392 |
| 7527 /** | 8393 /** |
| 7528 * Set the list of arguments to the constructor to the given list. | 8394 * Set the list of arguments to the constructor to the given list. |
| 8395 * |
| 7529 * @param argumentList the list of arguments to the constructor | 8396 * @param argumentList the list of arguments to the constructor |
| 7530 */ | 8397 */ |
| 7531 void set argumentList(ArgumentList argumentList2) { | 8398 void set argumentList(ArgumentList argumentList2) { |
| 7532 this._argumentList = becomeParentOf(argumentList2); | 8399 this._argumentList = becomeParentOf(argumentList2); |
| 7533 } | 8400 } |
| 7534 | 8401 |
| 7535 /** | 8402 /** |
| 7536 * Set the name of the constructor to be invoked to the given name. | 8403 * Set the name of the constructor to be invoked to the given name. |
| 8404 * |
| 7537 * @param constructorName the name of the constructor to be invoked | 8405 * @param constructorName the name of the constructor to be invoked |
| 7538 */ | 8406 */ |
| 7539 void set constructorName(ConstructorName constructorName2) { | 8407 void set constructorName(ConstructorName constructorName2) { |
| 7540 this._constructorName = constructorName2; | 8408 this._constructorName = constructorName2; |
| 7541 } | 8409 } |
| 7542 | 8410 |
| 7543 /** | 8411 /** |
| 7544 * Set the element associated with the constructor based on propagated type in
formation to the | 8412 * Set the element associated with the constructor based on propagated type in
formation to the |
| 7545 * given element. | 8413 * given element. |
| 8414 * |
| 7546 * @param element the element to be associated with the constructor | 8415 * @param element the element to be associated with the constructor |
| 7547 */ | 8416 */ |
| 7548 void set element(ConstructorElement element2) { | 8417 void set element(ConstructorElement element2) { |
| 7549 this._propagatedElement = element2; | 8418 this._propagatedElement = element2; |
| 7550 } | 8419 } |
| 7551 | 8420 |
| 7552 /** | 8421 /** |
| 7553 * Set the keyword used to indicate how an object should be created to the giv
en keyword. | 8422 * Set the keyword used to indicate how an object should be created to the giv
en keyword. |
| 8423 * |
| 7554 * @param keyword the keyword used to indicate how an object should be created | 8424 * @param keyword the keyword used to indicate how an object should be created |
| 7555 */ | 8425 */ |
| 7556 void set keyword(Token keyword2) { | 8426 void set keyword(Token keyword2) { |
| 7557 this._keyword = keyword2; | 8427 this._keyword = keyword2; |
| 7558 } | 8428 } |
| 7559 | 8429 |
| 7560 /** | 8430 /** |
| 7561 * Set the element associated with the constructor based on static type inform
ation to the given | 8431 * Set the element associated with the constructor based on static type inform
ation to the given |
| 7562 * element. | 8432 * element. |
| 8433 * |
| 7563 * @param element the element to be associated with the constructor | 8434 * @param element the element to be associated with the constructor |
| 7564 */ | 8435 */ |
| 7565 void set staticElement(ConstructorElement element) { | 8436 void set staticElement(ConstructorElement element) { |
| 7566 this._staticElement = element; | 8437 this._staticElement = element; |
| 7567 } | 8438 } |
| 7568 void visitChildren(ASTVisitor<Object> visitor) { | 8439 void visitChildren(ASTVisitor<Object> visitor) { |
| 7569 safelyVisitChild(_constructorName, visitor); | 8440 safelyVisitChild(_constructorName, visitor); |
| 7570 safelyVisitChild(_argumentList, visitor); | 8441 safelyVisitChild(_argumentList, visitor); |
| 7571 } | 8442 } |
| 7572 } | 8443 } |
| 7573 /** | 8444 /** |
| 7574 * Instances of the class `IntegerLiteral` represent an integer literal expressi
on. | 8445 * Instances of the class `IntegerLiteral` represent an integer literal expressi
on. |
| 8446 * |
| 7575 * <pre> | 8447 * <pre> |
| 7576 * integerLiteral ::= | 8448 * integerLiteral ::= |
| 7577 * decimalIntegerLiteral | 8449 * decimalIntegerLiteral |
| 7578 * | hexidecimalIntegerLiteral | 8450 * | hexidecimalIntegerLiteral |
| 8451 * |
| 7579 * decimalIntegerLiteral ::= | 8452 * decimalIntegerLiteral ::= |
| 7580 * decimalDigit+ | 8453 * decimalDigit+ |
| 8454 * |
| 7581 * hexidecimalIntegerLiteral ::= | 8455 * hexidecimalIntegerLiteral ::= |
| 7582 * '0x' hexidecimalDigit+ | 8456 * '0x' hexidecimalDigit+ |
| 7583 * | '0X' hexidecimalDigit+ | 8457 * | '0X' hexidecimalDigit+ |
| 7584 * </pre> | 8458 * </pre> |
| 8459 * |
| 7585 * @coverage dart.engine.ast | 8460 * @coverage dart.engine.ast |
| 7586 */ | 8461 */ |
| 7587 class IntegerLiteral extends Literal { | 8462 class IntegerLiteral extends Literal { |
| 7588 | 8463 |
| 7589 /** | 8464 /** |
| 7590 * The token representing the literal. | 8465 * The token representing the literal. |
| 7591 */ | 8466 */ |
| 7592 Token _literal; | 8467 Token _literal; |
| 7593 | 8468 |
| 7594 /** | 8469 /** |
| 7595 * The value of the literal. | 8470 * The value of the literal. |
| 7596 */ | 8471 */ |
| 7597 int _value = 0; | 8472 int _value = 0; |
| 7598 | 8473 |
| 7599 /** | 8474 /** |
| 7600 * Initialize a newly created integer literal. | 8475 * Initialize a newly created integer literal. |
| 8476 * |
| 7601 * @param literal the token representing the literal | 8477 * @param literal the token representing the literal |
| 7602 * @param value the value of the literal | 8478 * @param value the value of the literal |
| 7603 */ | 8479 */ |
| 7604 IntegerLiteral.full(Token literal, int value) { | 8480 IntegerLiteral.full(Token literal, int value) { |
| 7605 this._literal = literal; | 8481 this._literal = literal; |
| 7606 this._value = value; | 8482 this._value = value; |
| 7607 } | 8483 } |
| 7608 | 8484 |
| 7609 /** | 8485 /** |
| 7610 * Initialize a newly created integer literal. | 8486 * Initialize a newly created integer literal. |
| 8487 * |
| 7611 * @param literal the token representing the literal | 8488 * @param literal the token representing the literal |
| 7612 * @param value the value of the literal | 8489 * @param value the value of the literal |
| 7613 */ | 8490 */ |
| 7614 IntegerLiteral({Token literal, int value}) : this.full(literal, value); | 8491 IntegerLiteral({Token literal, int value}) : this.full(literal, value); |
| 7615 accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this); | 8492 accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this); |
| 7616 Token get beginToken => _literal; | 8493 Token get beginToken => _literal; |
| 7617 Token get endToken => _literal; | 8494 Token get endToken => _literal; |
| 7618 | 8495 |
| 7619 /** | 8496 /** |
| 7620 * Return the token representing the literal. | 8497 * Return the token representing the literal. |
| 8498 * |
| 7621 * @return the token representing the literal | 8499 * @return the token representing the literal |
| 7622 */ | 8500 */ |
| 7623 Token get literal => _literal; | 8501 Token get literal => _literal; |
| 7624 | 8502 |
| 7625 /** | 8503 /** |
| 7626 * Return the value of the literal. | 8504 * Return the value of the literal. |
| 8505 * |
| 7627 * @return the value of the literal | 8506 * @return the value of the literal |
| 7628 */ | 8507 */ |
| 7629 int get value => _value; | 8508 int get value => _value; |
| 7630 | 8509 |
| 7631 /** | 8510 /** |
| 7632 * Set the token representing the literal to the given token. | 8511 * Set the token representing the literal to the given token. |
| 8512 * |
| 7633 * @param literal the token representing the literal | 8513 * @param literal the token representing the literal |
| 7634 */ | 8514 */ |
| 7635 void set literal(Token literal2) { | 8515 void set literal(Token literal2) { |
| 7636 this._literal = literal2; | 8516 this._literal = literal2; |
| 7637 } | 8517 } |
| 7638 | 8518 |
| 7639 /** | 8519 /** |
| 7640 * Set the value of the literal to the given value. | 8520 * Set the value of the literal to the given value. |
| 8521 * |
| 7641 * @param value the value of the literal | 8522 * @param value the value of the literal |
| 7642 */ | 8523 */ |
| 7643 void set value(int value2) { | 8524 void set value(int value2) { |
| 7644 this._value = value2; | 8525 this._value = value2; |
| 7645 } | 8526 } |
| 7646 void visitChildren(ASTVisitor<Object> visitor) { | 8527 void visitChildren(ASTVisitor<Object> visitor) { |
| 7647 } | 8528 } |
| 7648 } | 8529 } |
| 7649 /** | 8530 /** |
| 7650 * The abstract class `InterpolationElement` defines the behavior common to elem
ents within a[StringInterpolation string interpolation]. | 8531 * The abstract class `InterpolationElement` defines the behavior common to elem
ents within a |
| 8532 * [StringInterpolation]. |
| 8533 * |
| 7651 * <pre> | 8534 * <pre> |
| 7652 * interpolationElement ::=[InterpolationExpression interpolationExpression]| [I
nterpolationString interpolationString]</pre> | 8535 * interpolationElement ::= |
| 8536 * [InterpolationExpression] |
| 8537 * | [InterpolationString] |
| 8538 * </pre> |
| 8539 * |
| 7653 * @coverage dart.engine.ast | 8540 * @coverage dart.engine.ast |
| 7654 */ | 8541 */ |
| 7655 abstract class InterpolationElement extends ASTNode { | 8542 abstract class InterpolationElement extends ASTNode { |
| 7656 } | 8543 } |
| 7657 /** | 8544 /** |
| 7658 * Instances of the class `InterpolationExpression` represent an expression embe
dded in a | 8545 * Instances of the class `InterpolationExpression` represent an expression embe
dded in a |
| 7659 * string interpolation. | 8546 * string interpolation. |
| 8547 * |
| 7660 * <pre> | 8548 * <pre> |
| 7661 * interpolationExpression ::= | 8549 * interpolationExpression ::= |
| 7662 * '$' [SimpleIdentifier identifier]| '$' '{' [Expression expression] '}' | 8550 * '$' [SimpleIdentifier] |
| 8551 * | '$' '{' [Expression] '}' |
| 7663 * </pre> | 8552 * </pre> |
| 8553 * |
| 7664 * @coverage dart.engine.ast | 8554 * @coverage dart.engine.ast |
| 7665 */ | 8555 */ |
| 7666 class InterpolationExpression extends InterpolationElement { | 8556 class InterpolationExpression extends InterpolationElement { |
| 7667 | 8557 |
| 7668 /** | 8558 /** |
| 7669 * The token used to introduce the interpolation expression; either '$' if the
expression is a | 8559 * The token used to introduce the interpolation expression; either '$' if the
expression is a |
| 7670 * simple identifier or '${' if the expression is a full expression. | 8560 * simple identifier or '${' if the expression is a full expression. |
| 7671 */ | 8561 */ |
| 7672 Token _leftBracket; | 8562 Token _leftBracket; |
| 7673 | 8563 |
| 7674 /** | 8564 /** |
| 7675 * The expression to be evaluated for the value to be converted into a string. | 8565 * The expression to be evaluated for the value to be converted into a string. |
| 7676 */ | 8566 */ |
| 7677 Expression _expression; | 8567 Expression _expression; |
| 7678 | 8568 |
| 7679 /** | 8569 /** |
| 7680 * The right curly bracket, or `null` if the expression is an identifier witho
ut brackets. | 8570 * The right curly bracket, or `null` if the expression is an identifier witho
ut brackets. |
| 7681 */ | 8571 */ |
| 7682 Token _rightBracket; | 8572 Token _rightBracket; |
| 7683 | 8573 |
| 7684 /** | 8574 /** |
| 7685 * Initialize a newly created interpolation expression. | 8575 * Initialize a newly created interpolation expression. |
| 8576 * |
| 7686 * @param leftBracket the left curly bracket | 8577 * @param leftBracket the left curly bracket |
| 7687 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 8578 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
| 7688 * @param rightBracket the right curly bracket | 8579 * @param rightBracket the right curly bracket |
| 7689 */ | 8580 */ |
| 7690 InterpolationExpression.full(Token leftBracket, Expression expression, Token r
ightBracket) { | 8581 InterpolationExpression.full(Token leftBracket, Expression expression, Token r
ightBracket) { |
| 7691 this._leftBracket = leftBracket; | 8582 this._leftBracket = leftBracket; |
| 7692 this._expression = becomeParentOf(expression); | 8583 this._expression = becomeParentOf(expression); |
| 7693 this._rightBracket = rightBracket; | 8584 this._rightBracket = rightBracket; |
| 7694 } | 8585 } |
| 7695 | 8586 |
| 7696 /** | 8587 /** |
| 7697 * Initialize a newly created interpolation expression. | 8588 * Initialize a newly created interpolation expression. |
| 8589 * |
| 7698 * @param leftBracket the left curly bracket | 8590 * @param leftBracket the left curly bracket |
| 7699 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 8591 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
| 7700 * @param rightBracket the right curly bracket | 8592 * @param rightBracket the right curly bracket |
| 7701 */ | 8593 */ |
| 7702 InterpolationExpression({Token leftBracket, Expression expression, Token right
Bracket}) : this.full(leftBracket, expression, rightBracket); | 8594 InterpolationExpression({Token leftBracket, Expression expression, Token right
Bracket}) : this.full(leftBracket, expression, rightBracket); |
| 7703 accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this); | 8595 accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this); |
| 7704 Token get beginToken => _leftBracket; | 8596 Token get beginToken => _leftBracket; |
| 7705 Token get endToken { | 8597 Token get endToken { |
| 7706 if (_rightBracket != null) { | 8598 if (_rightBracket != null) { |
| 7707 return _rightBracket; | 8599 return _rightBracket; |
| 7708 } | 8600 } |
| 7709 return _expression.endToken; | 8601 return _expression.endToken; |
| 7710 } | 8602 } |
| 7711 | 8603 |
| 7712 /** | 8604 /** |
| 7713 * Return the expression to be evaluated for the value to be converted into a
string. | 8605 * Return the expression to be evaluated for the value to be converted into a
string. |
| 8606 * |
| 7714 * @return the expression to be evaluated for the value to be converted into a
string | 8607 * @return the expression to be evaluated for the value to be converted into a
string |
| 7715 */ | 8608 */ |
| 7716 Expression get expression => _expression; | 8609 Expression get expression => _expression; |
| 7717 | 8610 |
| 7718 /** | 8611 /** |
| 7719 * Return the left curly bracket. | 8612 * Return the left curly bracket. |
| 8613 * |
| 7720 * @return the left curly bracket | 8614 * @return the left curly bracket |
| 7721 */ | 8615 */ |
| 7722 Token get leftBracket => _leftBracket; | 8616 Token get leftBracket => _leftBracket; |
| 7723 | 8617 |
| 7724 /** | 8618 /** |
| 7725 * Return the right curly bracket. | 8619 * Return the right curly bracket. |
| 8620 * |
| 7726 * @return the right curly bracket | 8621 * @return the right curly bracket |
| 7727 */ | 8622 */ |
| 7728 Token get rightBracket => _rightBracket; | 8623 Token get rightBracket => _rightBracket; |
| 7729 | 8624 |
| 7730 /** | 8625 /** |
| 7731 * Set the expression to be evaluated for the value to be converted into a str
ing to the given | 8626 * Set the expression to be evaluated for the value to be converted into a str
ing to the given |
| 7732 * expression. | 8627 * expression. |
| 8628 * |
| 7733 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 8629 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
| 7734 */ | 8630 */ |
| 7735 void set expression(Expression expression2) { | 8631 void set expression(Expression expression2) { |
| 7736 this._expression = becomeParentOf(expression2); | 8632 this._expression = becomeParentOf(expression2); |
| 7737 } | 8633 } |
| 7738 | 8634 |
| 7739 /** | 8635 /** |
| 7740 * Set the left curly bracket to the given token. | 8636 * Set the left curly bracket to the given token. |
| 8637 * |
| 7741 * @param leftBracket the left curly bracket | 8638 * @param leftBracket the left curly bracket |
| 7742 */ | 8639 */ |
| 7743 void set leftBracket(Token leftBracket2) { | 8640 void set leftBracket(Token leftBracket2) { |
| 7744 this._leftBracket = leftBracket2; | 8641 this._leftBracket = leftBracket2; |
| 7745 } | 8642 } |
| 7746 | 8643 |
| 7747 /** | 8644 /** |
| 7748 * Set the right curly bracket to the given token. | 8645 * Set the right curly bracket to the given token. |
| 8646 * |
| 7749 * @param rightBracket the right curly bracket | 8647 * @param rightBracket the right curly bracket |
| 7750 */ | 8648 */ |
| 7751 void set rightBracket(Token rightBracket2) { | 8649 void set rightBracket(Token rightBracket2) { |
| 7752 this._rightBracket = rightBracket2; | 8650 this._rightBracket = rightBracket2; |
| 7753 } | 8651 } |
| 7754 void visitChildren(ASTVisitor<Object> visitor) { | 8652 void visitChildren(ASTVisitor<Object> visitor) { |
| 7755 safelyVisitChild(_expression, visitor); | 8653 safelyVisitChild(_expression, visitor); |
| 7756 } | 8654 } |
| 7757 } | 8655 } |
| 7758 /** | 8656 /** |
| 7759 * Instances of the class `InterpolationString` represent a non-empty substring
of an | 8657 * Instances of the class `InterpolationString` represent a non-empty substring
of an |
| 7760 * interpolated string. | 8658 * interpolated string. |
| 8659 * |
| 7761 * <pre> | 8660 * <pre> |
| 7762 * interpolationString ::= | 8661 * interpolationString ::= |
| 7763 * characters | 8662 * characters |
| 7764 * </pre> | 8663 * </pre> |
| 8664 * |
| 7765 * @coverage dart.engine.ast | 8665 * @coverage dart.engine.ast |
| 7766 */ | 8666 */ |
| 7767 class InterpolationString extends InterpolationElement { | 8667 class InterpolationString extends InterpolationElement { |
| 7768 | 8668 |
| 7769 /** | 8669 /** |
| 7770 * The characters that will be added to the string. | 8670 * The characters that will be added to the string. |
| 7771 */ | 8671 */ |
| 7772 Token _contents; | 8672 Token _contents; |
| 7773 | 8673 |
| 7774 /** | 8674 /** |
| 7775 * The value of the literal. | 8675 * The value of the literal. |
| 7776 */ | 8676 */ |
| 7777 String _value; | 8677 String _value; |
| 7778 | 8678 |
| 7779 /** | 8679 /** |
| 7780 * Initialize a newly created string of characters that are part of a string i
nterpolation. | 8680 * Initialize a newly created string of characters that are part of a string i
nterpolation. |
| 8681 * |
| 7781 * @param the characters that will be added to the string | 8682 * @param the characters that will be added to the string |
| 7782 * @param value the value of the literal | 8683 * @param value the value of the literal |
| 7783 */ | 8684 */ |
| 7784 InterpolationString.full(Token contents, String value) { | 8685 InterpolationString.full(Token contents, String value) { |
| 7785 this._contents = contents; | 8686 this._contents = contents; |
| 7786 this._value = value; | 8687 this._value = value; |
| 7787 } | 8688 } |
| 7788 | 8689 |
| 7789 /** | 8690 /** |
| 7790 * Initialize a newly created string of characters that are part of a string i
nterpolation. | 8691 * Initialize a newly created string of characters that are part of a string i
nterpolation. |
| 8692 * |
| 7791 * @param the characters that will be added to the string | 8693 * @param the characters that will be added to the string |
| 7792 * @param value the value of the literal | 8694 * @param value the value of the literal |
| 7793 */ | 8695 */ |
| 7794 InterpolationString({Token contents, String value}) : this.full(contents, valu
e); | 8696 InterpolationString({Token contents, String value}) : this.full(contents, valu
e); |
| 7795 accept(ASTVisitor visitor) => visitor.visitInterpolationString(this); | 8697 accept(ASTVisitor visitor) => visitor.visitInterpolationString(this); |
| 7796 Token get beginToken => _contents; | 8698 Token get beginToken => _contents; |
| 7797 | 8699 |
| 7798 /** | 8700 /** |
| 7799 * Return the characters that will be added to the string. | 8701 * Return the characters that will be added to the string. |
| 8702 * |
| 7800 * @return the characters that will be added to the string | 8703 * @return the characters that will be added to the string |
| 7801 */ | 8704 */ |
| 7802 Token get contents => _contents; | 8705 Token get contents => _contents; |
| 7803 Token get endToken => _contents; | 8706 Token get endToken => _contents; |
| 7804 | 8707 |
| 7805 /** | 8708 /** |
| 7806 * Return the value of the literal. | 8709 * Return the value of the literal. |
| 8710 * |
| 7807 * @return the value of the literal | 8711 * @return the value of the literal |
| 7808 */ | 8712 */ |
| 7809 String get value => _value; | 8713 String get value => _value; |
| 7810 | 8714 |
| 7811 /** | 8715 /** |
| 7812 * Set the characters that will be added to the string to those in the given s
tring. | 8716 * Set the characters that will be added to the string to those in the given s
tring. |
| 8717 * |
| 7813 * @param string the characters that will be added to the string | 8718 * @param string the characters that will be added to the string |
| 7814 */ | 8719 */ |
| 7815 void set contents(Token string) { | 8720 void set contents(Token string) { |
| 7816 _contents = string; | 8721 _contents = string; |
| 7817 } | 8722 } |
| 7818 | 8723 |
| 7819 /** | 8724 /** |
| 7820 * Set the value of the literal to the given string. | 8725 * Set the value of the literal to the given string. |
| 8726 * |
| 7821 * @param string the value of the literal | 8727 * @param string the value of the literal |
| 7822 */ | 8728 */ |
| 7823 void set value(String string) { | 8729 void set value(String string) { |
| 7824 _value = string; | 8730 _value = string; |
| 7825 } | 8731 } |
| 7826 void visitChildren(ASTVisitor<Object> visitor) { | 8732 void visitChildren(ASTVisitor<Object> visitor) { |
| 7827 } | 8733 } |
| 7828 } | 8734 } |
| 7829 /** | 8735 /** |
| 7830 * Instances of the class `IsExpression` represent an is expression. | 8736 * Instances of the class `IsExpression` represent an is expression. |
| 8737 * |
| 7831 * <pre> | 8738 * <pre> |
| 7832 * isExpression ::=[Expression expression] 'is' '!'? [TypeName type]</pre> | 8739 * isExpression ::= |
| 8740 * [Expression] 'is' '!'? [TypeName] |
| 8741 * </pre> |
| 8742 * |
| 7833 * @coverage dart.engine.ast | 8743 * @coverage dart.engine.ast |
| 7834 */ | 8744 */ |
| 7835 class IsExpression extends Expression { | 8745 class IsExpression extends Expression { |
| 7836 | 8746 |
| 7837 /** | 8747 /** |
| 7838 * The expression used to compute the value whose type is being tested. | 8748 * The expression used to compute the value whose type is being tested. |
| 7839 */ | 8749 */ |
| 7840 Expression _expression; | 8750 Expression _expression; |
| 7841 | 8751 |
| 7842 /** | 8752 /** |
| 7843 * The is operator. | 8753 * The is operator. |
| 7844 */ | 8754 */ |
| 7845 Token _isOperator; | 8755 Token _isOperator; |
| 7846 | 8756 |
| 7847 /** | 8757 /** |
| 7848 * The not operator, or `null` if the sense of the test is not negated. | 8758 * The not operator, or `null` if the sense of the test is not negated. |
| 7849 */ | 8759 */ |
| 7850 Token _notOperator; | 8760 Token _notOperator; |
| 7851 | 8761 |
| 7852 /** | 8762 /** |
| 7853 * The name of the type being tested for. | 8763 * The name of the type being tested for. |
| 7854 */ | 8764 */ |
| 7855 TypeName _type; | 8765 TypeName _type; |
| 7856 | 8766 |
| 7857 /** | 8767 /** |
| 7858 * Initialize a newly created is expression. | 8768 * Initialize a newly created is expression. |
| 8769 * |
| 7859 * @param expression the expression used to compute the value whose type is be
ing tested | 8770 * @param expression the expression used to compute the value whose type is be
ing tested |
| 7860 * @param isOperator the is operator | 8771 * @param isOperator the is operator |
| 7861 * @param notOperator the not operator, or `null` if the sense of the test is
not negated | 8772 * @param notOperator the not operator, or `null` if the sense of the test is
not negated |
| 7862 * @param type the name of the type being tested for | 8773 * @param type the name of the type being tested for |
| 7863 */ | 8774 */ |
| 7864 IsExpression.full(Expression expression, Token isOperator, Token notOperator,
TypeName type) { | 8775 IsExpression.full(Expression expression, Token isOperator, Token notOperator,
TypeName type) { |
| 7865 this._expression = becomeParentOf(expression); | 8776 this._expression = becomeParentOf(expression); |
| 7866 this._isOperator = isOperator; | 8777 this._isOperator = isOperator; |
| 7867 this._notOperator = notOperator; | 8778 this._notOperator = notOperator; |
| 7868 this._type = becomeParentOf(type); | 8779 this._type = becomeParentOf(type); |
| 7869 } | 8780 } |
| 7870 | 8781 |
| 7871 /** | 8782 /** |
| 7872 * Initialize a newly created is expression. | 8783 * Initialize a newly created is expression. |
| 8784 * |
| 7873 * @param expression the expression used to compute the value whose type is be
ing tested | 8785 * @param expression the expression used to compute the value whose type is be
ing tested |
| 7874 * @param isOperator the is operator | 8786 * @param isOperator the is operator |
| 7875 * @param notOperator the not operator, or `null` if the sense of the test is
not negated | 8787 * @param notOperator the not operator, or `null` if the sense of the test is
not negated |
| 7876 * @param type the name of the type being tested for | 8788 * @param type the name of the type being tested for |
| 7877 */ | 8789 */ |
| 7878 IsExpression({Expression expression, Token isOperator, Token notOperator, Type
Name type}) : this.full(expression, isOperator, notOperator, type); | 8790 IsExpression({Expression expression, Token isOperator, Token notOperator, Type
Name type}) : this.full(expression, isOperator, notOperator, type); |
| 7879 accept(ASTVisitor visitor) => visitor.visitIsExpression(this); | 8791 accept(ASTVisitor visitor) => visitor.visitIsExpression(this); |
| 7880 Token get beginToken => _expression.beginToken; | 8792 Token get beginToken => _expression.beginToken; |
| 7881 Token get endToken => _type.endToken; | 8793 Token get endToken => _type.endToken; |
| 7882 | 8794 |
| 7883 /** | 8795 /** |
| 7884 * Return the expression used to compute the value whose type is being tested. | 8796 * Return the expression used to compute the value whose type is being tested. |
| 8797 * |
| 7885 * @return the expression used to compute the value whose type is being tested | 8798 * @return the expression used to compute the value whose type is being tested |
| 7886 */ | 8799 */ |
| 7887 Expression get expression => _expression; | 8800 Expression get expression => _expression; |
| 7888 | 8801 |
| 7889 /** | 8802 /** |
| 7890 * Return the is operator being applied. | 8803 * Return the is operator being applied. |
| 8804 * |
| 7891 * @return the is operator being applied | 8805 * @return the is operator being applied |
| 7892 */ | 8806 */ |
| 7893 Token get isOperator => _isOperator; | 8807 Token get isOperator => _isOperator; |
| 7894 | 8808 |
| 7895 /** | 8809 /** |
| 7896 * Return the not operator being applied. | 8810 * Return the not operator being applied. |
| 8811 * |
| 7897 * @return the not operator being applied | 8812 * @return the not operator being applied |
| 7898 */ | 8813 */ |
| 7899 Token get notOperator => _notOperator; | 8814 Token get notOperator => _notOperator; |
| 7900 | 8815 |
| 7901 /** | 8816 /** |
| 7902 * Return the name of the type being tested for. | 8817 * Return the name of the type being tested for. |
| 8818 * |
| 7903 * @return the name of the type being tested for | 8819 * @return the name of the type being tested for |
| 7904 */ | 8820 */ |
| 7905 TypeName get type => _type; | 8821 TypeName get type => _type; |
| 7906 | 8822 |
| 7907 /** | 8823 /** |
| 7908 * Set the expression used to compute the value whose type is being tested to
the given | 8824 * Set the expression used to compute the value whose type is being tested to
the given |
| 7909 * expression. | 8825 * expression. |
| 8826 * |
| 7910 * @param expression the expression used to compute the value whose type is be
ing tested | 8827 * @param expression the expression used to compute the value whose type is be
ing tested |
| 7911 */ | 8828 */ |
| 7912 void set expression(Expression expression2) { | 8829 void set expression(Expression expression2) { |
| 7913 this._expression = becomeParentOf(expression2); | 8830 this._expression = becomeParentOf(expression2); |
| 7914 } | 8831 } |
| 7915 | 8832 |
| 7916 /** | 8833 /** |
| 7917 * Set the is operator being applied to the given operator. | 8834 * Set the is operator being applied to the given operator. |
| 8835 * |
| 7918 * @param isOperator the is operator being applied | 8836 * @param isOperator the is operator being applied |
| 7919 */ | 8837 */ |
| 7920 void set isOperator(Token isOperator2) { | 8838 void set isOperator(Token isOperator2) { |
| 7921 this._isOperator = isOperator2; | 8839 this._isOperator = isOperator2; |
| 7922 } | 8840 } |
| 7923 | 8841 |
| 7924 /** | 8842 /** |
| 7925 * Set the not operator being applied to the given operator. | 8843 * Set the not operator being applied to the given operator. |
| 8844 * |
| 7926 * @param notOperator the is operator being applied | 8845 * @param notOperator the is operator being applied |
| 7927 */ | 8846 */ |
| 7928 void set notOperator(Token notOperator2) { | 8847 void set notOperator(Token notOperator2) { |
| 7929 this._notOperator = notOperator2; | 8848 this._notOperator = notOperator2; |
| 7930 } | 8849 } |
| 7931 | 8850 |
| 7932 /** | 8851 /** |
| 7933 * Set the name of the type being tested for to the given name. | 8852 * Set the name of the type being tested for to the given name. |
| 8853 * |
| 7934 * @param name the name of the type being tested for | 8854 * @param name the name of the type being tested for |
| 7935 */ | 8855 */ |
| 7936 void set type(TypeName name) { | 8856 void set type(TypeName name) { |
| 7937 this._type = becomeParentOf(name); | 8857 this._type = becomeParentOf(name); |
| 7938 } | 8858 } |
| 7939 void visitChildren(ASTVisitor<Object> visitor) { | 8859 void visitChildren(ASTVisitor<Object> visitor) { |
| 7940 safelyVisitChild(_expression, visitor); | 8860 safelyVisitChild(_expression, visitor); |
| 7941 safelyVisitChild(_type, visitor); | 8861 safelyVisitChild(_type, visitor); |
| 7942 } | 8862 } |
| 7943 } | 8863 } |
| 7944 /** | 8864 /** |
| 7945 * Instances of the class `Label` represent a label. | 8865 * Instances of the class `Label` represent a label. |
| 8866 * |
| 7946 * <pre> | 8867 * <pre> |
| 7947 * label ::=[SimpleIdentifier label] ':' | 8868 * label ::= |
| 8869 * [SimpleIdentifier] ':' |
| 7948 * </pre> | 8870 * </pre> |
| 8871 * |
| 7949 * @coverage dart.engine.ast | 8872 * @coverage dart.engine.ast |
| 7950 */ | 8873 */ |
| 7951 class Label extends ASTNode { | 8874 class Label extends ASTNode { |
| 7952 | 8875 |
| 7953 /** | 8876 /** |
| 7954 * The label being associated with the statement. | 8877 * The label being associated with the statement. |
| 7955 */ | 8878 */ |
| 7956 SimpleIdentifier _label; | 8879 SimpleIdentifier _label; |
| 7957 | 8880 |
| 7958 /** | 8881 /** |
| 7959 * The colon that separates the label from the statement. | 8882 * The colon that separates the label from the statement. |
| 7960 */ | 8883 */ |
| 7961 Token _colon; | 8884 Token _colon; |
| 7962 | 8885 |
| 7963 /** | 8886 /** |
| 7964 * Initialize a newly created label. | 8887 * Initialize a newly created label. |
| 8888 * |
| 7965 * @param label the label being applied | 8889 * @param label the label being applied |
| 7966 * @param colon the colon that separates the label from whatever follows | 8890 * @param colon the colon that separates the label from whatever follows |
| 7967 */ | 8891 */ |
| 7968 Label.full(SimpleIdentifier label, Token colon) { | 8892 Label.full(SimpleIdentifier label, Token colon) { |
| 7969 this._label = becomeParentOf(label); | 8893 this._label = becomeParentOf(label); |
| 7970 this._colon = colon; | 8894 this._colon = colon; |
| 7971 } | 8895 } |
| 7972 | 8896 |
| 7973 /** | 8897 /** |
| 7974 * Initialize a newly created label. | 8898 * Initialize a newly created label. |
| 8899 * |
| 7975 * @param label the label being applied | 8900 * @param label the label being applied |
| 7976 * @param colon the colon that separates the label from whatever follows | 8901 * @param colon the colon that separates the label from whatever follows |
| 7977 */ | 8902 */ |
| 7978 Label({SimpleIdentifier label, Token colon}) : this.full(label, colon); | 8903 Label({SimpleIdentifier label, Token colon}) : this.full(label, colon); |
| 7979 accept(ASTVisitor visitor) => visitor.visitLabel(this); | 8904 accept(ASTVisitor visitor) => visitor.visitLabel(this); |
| 7980 Token get beginToken => _label.beginToken; | 8905 Token get beginToken => _label.beginToken; |
| 7981 | 8906 |
| 7982 /** | 8907 /** |
| 7983 * Return the colon that separates the label from the statement. | 8908 * Return the colon that separates the label from the statement. |
| 8909 * |
| 7984 * @return the colon that separates the label from the statement | 8910 * @return the colon that separates the label from the statement |
| 7985 */ | 8911 */ |
| 7986 Token get colon => _colon; | 8912 Token get colon => _colon; |
| 7987 Token get endToken => _colon; | 8913 Token get endToken => _colon; |
| 7988 | 8914 |
| 7989 /** | 8915 /** |
| 7990 * Return the label being associated with the statement. | 8916 * Return the label being associated with the statement. |
| 8917 * |
| 7991 * @return the label being associated with the statement | 8918 * @return the label being associated with the statement |
| 7992 */ | 8919 */ |
| 7993 SimpleIdentifier get label => _label; | 8920 SimpleIdentifier get label => _label; |
| 7994 | 8921 |
| 7995 /** | 8922 /** |
| 7996 * Set the colon that separates the label from the statement to the given toke
n. | 8923 * Set the colon that separates the label from the statement to the given toke
n. |
| 8924 * |
| 7997 * @param colon the colon that separates the label from the statement | 8925 * @param colon the colon that separates the label from the statement |
| 7998 */ | 8926 */ |
| 7999 void set colon(Token colon2) { | 8927 void set colon(Token colon2) { |
| 8000 this._colon = colon2; | 8928 this._colon = colon2; |
| 8001 } | 8929 } |
| 8002 | 8930 |
| 8003 /** | 8931 /** |
| 8004 * Set the label being associated with the statement to the given label. | 8932 * Set the label being associated with the statement to the given label. |
| 8933 * |
| 8005 * @param label the label being associated with the statement | 8934 * @param label the label being associated with the statement |
| 8006 */ | 8935 */ |
| 8007 void set label(SimpleIdentifier label2) { | 8936 void set label(SimpleIdentifier label2) { |
| 8008 this._label = becomeParentOf(label2); | 8937 this._label = becomeParentOf(label2); |
| 8009 } | 8938 } |
| 8010 void visitChildren(ASTVisitor<Object> visitor) { | 8939 void visitChildren(ASTVisitor<Object> visitor) { |
| 8011 safelyVisitChild(_label, visitor); | 8940 safelyVisitChild(_label, visitor); |
| 8012 } | 8941 } |
| 8013 } | 8942 } |
| 8014 /** | 8943 /** |
| 8015 * Instances of the class `LabeledStatement` represent a statement that has a la
bel associated | 8944 * Instances of the class `LabeledStatement` represent a statement that has a la
bel associated |
| 8016 * with them. | 8945 * with them. |
| 8946 * |
| 8017 * <pre> | 8947 * <pre> |
| 8018 * labeledStatement ::=[Label label]+ [Statement statement]</pre> | 8948 * labeledStatement ::= |
| 8949 * [Label]+ [Statement] |
| 8950 * </pre> |
| 8951 * |
| 8019 * @coverage dart.engine.ast | 8952 * @coverage dart.engine.ast |
| 8020 */ | 8953 */ |
| 8021 class LabeledStatement extends Statement { | 8954 class LabeledStatement extends Statement { |
| 8022 | 8955 |
| 8023 /** | 8956 /** |
| 8024 * The labels being associated with the statement. | 8957 * The labels being associated with the statement. |
| 8025 */ | 8958 */ |
| 8026 NodeList<Label> _labels; | 8959 NodeList<Label> _labels; |
| 8027 | 8960 |
| 8028 /** | 8961 /** |
| 8029 * The statement with which the labels are being associated. | 8962 * The statement with which the labels are being associated. |
| 8030 */ | 8963 */ |
| 8031 Statement _statement; | 8964 Statement _statement; |
| 8032 | 8965 |
| 8033 /** | 8966 /** |
| 8034 * Initialize a newly created labeled statement. | 8967 * Initialize a newly created labeled statement. |
| 8968 * |
| 8035 * @param labels the labels being associated with the statement | 8969 * @param labels the labels being associated with the statement |
| 8036 * @param statement the statement with which the labels are being associated | 8970 * @param statement the statement with which the labels are being associated |
| 8037 */ | 8971 */ |
| 8038 LabeledStatement.full(List<Label> labels, Statement statement) { | 8972 LabeledStatement.full(List<Label> labels, Statement statement) { |
| 8039 this._labels = new NodeList<Label>(this); | 8973 this._labels = new NodeList<Label>(this); |
| 8040 this._labels.addAll(labels); | 8974 this._labels.addAll(labels); |
| 8041 this._statement = becomeParentOf(statement); | 8975 this._statement = becomeParentOf(statement); |
| 8042 } | 8976 } |
| 8043 | 8977 |
| 8044 /** | 8978 /** |
| 8045 * Initialize a newly created labeled statement. | 8979 * Initialize a newly created labeled statement. |
| 8980 * |
| 8046 * @param labels the labels being associated with the statement | 8981 * @param labels the labels being associated with the statement |
| 8047 * @param statement the statement with which the labels are being associated | 8982 * @param statement the statement with which the labels are being associated |
| 8048 */ | 8983 */ |
| 8049 LabeledStatement({List<Label> labels, Statement statement}) : this.full(labels
, statement); | 8984 LabeledStatement({List<Label> labels, Statement statement}) : this.full(labels
, statement); |
| 8050 accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this); | 8985 accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this); |
| 8051 Token get beginToken { | 8986 Token get beginToken { |
| 8052 if (!_labels.isEmpty) { | 8987 if (!_labels.isEmpty) { |
| 8053 return _labels.beginToken; | 8988 return _labels.beginToken; |
| 8054 } | 8989 } |
| 8055 return _statement.beginToken; | 8990 return _statement.beginToken; |
| 8056 } | 8991 } |
| 8057 Token get endToken => _statement.endToken; | 8992 Token get endToken => _statement.endToken; |
| 8058 | 8993 |
| 8059 /** | 8994 /** |
| 8060 * Return the labels being associated with the statement. | 8995 * Return the labels being associated with the statement. |
| 8996 * |
| 8061 * @return the labels being associated with the statement | 8997 * @return the labels being associated with the statement |
| 8062 */ | 8998 */ |
| 8063 NodeList<Label> get labels => _labels; | 8999 NodeList<Label> get labels => _labels; |
| 8064 | 9000 |
| 8065 /** | 9001 /** |
| 8066 * Return the statement with which the labels are being associated. | 9002 * Return the statement with which the labels are being associated. |
| 9003 * |
| 8067 * @return the statement with which the labels are being associated | 9004 * @return the statement with which the labels are being associated |
| 8068 */ | 9005 */ |
| 8069 Statement get statement => _statement; | 9006 Statement get statement => _statement; |
| 8070 | 9007 |
| 8071 /** | 9008 /** |
| 8072 * Set the statement with which the labels are being associated to the given s
tatement. | 9009 * Set the statement with which the labels are being associated to the given s
tatement. |
| 9010 * |
| 8073 * @param statement the statement with which the labels are being associated | 9011 * @param statement the statement with which the labels are being associated |
| 8074 */ | 9012 */ |
| 8075 void set statement(Statement statement2) { | 9013 void set statement(Statement statement2) { |
| 8076 this._statement = becomeParentOf(statement2); | 9014 this._statement = becomeParentOf(statement2); |
| 8077 } | 9015 } |
| 8078 void visitChildren(ASTVisitor<Object> visitor) { | 9016 void visitChildren(ASTVisitor<Object> visitor) { |
| 8079 _labels.accept(visitor); | 9017 _labels.accept(visitor); |
| 8080 safelyVisitChild(_statement, visitor); | 9018 safelyVisitChild(_statement, visitor); |
| 8081 } | 9019 } |
| 8082 } | 9020 } |
| 8083 /** | 9021 /** |
| 8084 * Instances of the class `LibraryDirective` represent a library directive. | 9022 * Instances of the class `LibraryDirective` represent a library directive. |
| 9023 * |
| 8085 * <pre> | 9024 * <pre> |
| 8086 * libraryDirective ::=[Annotation metadata] 'library' [Identifier name] ';' | 9025 * libraryDirective ::= |
| 9026 * [Annotation] 'library' [Identifier] ';' |
| 8087 * </pre> | 9027 * </pre> |
| 9028 * |
| 8088 * @coverage dart.engine.ast | 9029 * @coverage dart.engine.ast |
| 8089 */ | 9030 */ |
| 8090 class LibraryDirective extends Directive { | 9031 class LibraryDirective extends Directive { |
| 8091 | 9032 |
| 8092 /** | 9033 /** |
| 8093 * The token representing the 'library' token. | 9034 * The token representing the 'library' token. |
| 8094 */ | 9035 */ |
| 8095 Token _libraryToken; | 9036 Token _libraryToken; |
| 8096 | 9037 |
| 8097 /** | 9038 /** |
| 8098 * The name of the library being defined. | 9039 * The name of the library being defined. |
| 8099 */ | 9040 */ |
| 8100 LibraryIdentifier _name; | 9041 LibraryIdentifier _name; |
| 8101 | 9042 |
| 8102 /** | 9043 /** |
| 8103 * The semicolon terminating the directive. | 9044 * The semicolon terminating the directive. |
| 8104 */ | 9045 */ |
| 8105 Token _semicolon; | 9046 Token _semicolon; |
| 8106 | 9047 |
| 8107 /** | 9048 /** |
| 8108 * Initialize a newly created library directive. | 9049 * Initialize a newly created library directive. |
| 9050 * |
| 8109 * @param comment the documentation comment associated with this directive | 9051 * @param comment the documentation comment associated with this directive |
| 8110 * @param metadata the annotations associated with the directive | 9052 * @param metadata the annotations associated with the directive |
| 8111 * @param libraryToken the token representing the 'library' token | 9053 * @param libraryToken the token representing the 'library' token |
| 8112 * @param name the name of the library being defined | 9054 * @param name the name of the library being defined |
| 8113 * @param semicolon the semicolon terminating the directive | 9055 * @param semicolon the semicolon terminating the directive |
| 8114 */ | 9056 */ |
| 8115 LibraryDirective.full(Comment comment, List<Annotation> metadata, Token librar
yToken, LibraryIdentifier name, Token semicolon) : super.full(comment, metadata)
{ | 9057 LibraryDirective.full(Comment comment, List<Annotation> metadata, Token librar
yToken, LibraryIdentifier name, Token semicolon) : super.full(comment, metadata)
{ |
| 8116 this._libraryToken = libraryToken; | 9058 this._libraryToken = libraryToken; |
| 8117 this._name = becomeParentOf(name); | 9059 this._name = becomeParentOf(name); |
| 8118 this._semicolon = semicolon; | 9060 this._semicolon = semicolon; |
| 8119 } | 9061 } |
| 8120 | 9062 |
| 8121 /** | 9063 /** |
| 8122 * Initialize a newly created library directive. | 9064 * Initialize a newly created library directive. |
| 9065 * |
| 8123 * @param comment the documentation comment associated with this directive | 9066 * @param comment the documentation comment associated with this directive |
| 8124 * @param metadata the annotations associated with the directive | 9067 * @param metadata the annotations associated with the directive |
| 8125 * @param libraryToken the token representing the 'library' token | 9068 * @param libraryToken the token representing the 'library' token |
| 8126 * @param name the name of the library being defined | 9069 * @param name the name of the library being defined |
| 8127 * @param semicolon the semicolon terminating the directive | 9070 * @param semicolon the semicolon terminating the directive |
| 8128 */ | 9071 */ |
| 8129 LibraryDirective({Comment comment, List<Annotation> metadata, Token libraryTok
en, LibraryIdentifier name, Token semicolon}) : this.full(comment, metadata, lib
raryToken, name, semicolon); | 9072 LibraryDirective({Comment comment, List<Annotation> metadata, Token libraryTok
en, LibraryIdentifier name, Token semicolon}) : this.full(comment, metadata, lib
raryToken, name, semicolon); |
| 8130 accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this); | 9073 accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this); |
| 8131 Token get endToken => _semicolon; | 9074 Token get endToken => _semicolon; |
| 8132 Token get keyword => _libraryToken; | 9075 Token get keyword => _libraryToken; |
| 8133 | 9076 |
| 8134 /** | 9077 /** |
| 8135 * Return the token representing the 'library' token. | 9078 * Return the token representing the 'library' token. |
| 9079 * |
| 8136 * @return the token representing the 'library' token | 9080 * @return the token representing the 'library' token |
| 8137 */ | 9081 */ |
| 8138 Token get libraryToken => _libraryToken; | 9082 Token get libraryToken => _libraryToken; |
| 8139 | 9083 |
| 8140 /** | 9084 /** |
| 8141 * Return the name of the library being defined. | 9085 * Return the name of the library being defined. |
| 9086 * |
| 8142 * @return the name of the library being defined | 9087 * @return the name of the library being defined |
| 8143 */ | 9088 */ |
| 8144 LibraryIdentifier get name => _name; | 9089 LibraryIdentifier get name => _name; |
| 8145 | 9090 |
| 8146 /** | 9091 /** |
| 8147 * Return the semicolon terminating the directive. | 9092 * Return the semicolon terminating the directive. |
| 9093 * |
| 8148 * @return the semicolon terminating the directive | 9094 * @return the semicolon terminating the directive |
| 8149 */ | 9095 */ |
| 8150 Token get semicolon => _semicolon; | 9096 Token get semicolon => _semicolon; |
| 8151 | 9097 |
| 8152 /** | 9098 /** |
| 8153 * Set the token representing the 'library' token to the given token. | 9099 * Set the token representing the 'library' token to the given token. |
| 9100 * |
| 8154 * @param libraryToken the token representing the 'library' token | 9101 * @param libraryToken the token representing the 'library' token |
| 8155 */ | 9102 */ |
| 8156 void set libraryToken(Token libraryToken2) { | 9103 void set libraryToken(Token libraryToken2) { |
| 8157 this._libraryToken = libraryToken2; | 9104 this._libraryToken = libraryToken2; |
| 8158 } | 9105 } |
| 8159 | 9106 |
| 8160 /** | 9107 /** |
| 8161 * Set the name of the library being defined to the given name. | 9108 * Set the name of the library being defined to the given name. |
| 9109 * |
| 8162 * @param name the name of the library being defined | 9110 * @param name the name of the library being defined |
| 8163 */ | 9111 */ |
| 8164 void set name(LibraryIdentifier name2) { | 9112 void set name(LibraryIdentifier name2) { |
| 8165 this._name = becomeParentOf(name2); | 9113 this._name = becomeParentOf(name2); |
| 8166 } | 9114 } |
| 8167 | 9115 |
| 8168 /** | 9116 /** |
| 8169 * Set the semicolon terminating the directive to the given token. | 9117 * Set the semicolon terminating the directive to the given token. |
| 9118 * |
| 8170 * @param semicolon the semicolon terminating the directive | 9119 * @param semicolon the semicolon terminating the directive |
| 8171 */ | 9120 */ |
| 8172 void set semicolon(Token semicolon2) { | 9121 void set semicolon(Token semicolon2) { |
| 8173 this._semicolon = semicolon2; | 9122 this._semicolon = semicolon2; |
| 8174 } | 9123 } |
| 8175 void visitChildren(ASTVisitor<Object> visitor) { | 9124 void visitChildren(ASTVisitor<Object> visitor) { |
| 8176 super.visitChildren(visitor); | 9125 super.visitChildren(visitor); |
| 8177 safelyVisitChild(_name, visitor); | 9126 safelyVisitChild(_name, visitor); |
| 8178 } | 9127 } |
| 8179 Token get firstTokenAfterCommentAndMetadata => _libraryToken; | 9128 Token get firstTokenAfterCommentAndMetadata => _libraryToken; |
| 8180 } | 9129 } |
| 8181 /** | 9130 /** |
| 8182 * Instances of the class `LibraryIdentifier` represent the identifier for a lib
rary. | 9131 * Instances of the class `LibraryIdentifier` represent the identifier for a lib
rary. |
| 9132 * |
| 8183 * <pre> | 9133 * <pre> |
| 8184 * libraryIdentifier ::=[SimpleIdentifier component] ('.' [SimpleIdentifier comp
onent]) | 9134 * libraryIdentifier ::= |
| 9135 * [SimpleIdentifier] ('.' [SimpleIdentifier])* |
| 8185 * </pre> | 9136 * </pre> |
| 9137 * |
| 8186 * @coverage dart.engine.ast | 9138 * @coverage dart.engine.ast |
| 8187 */ | 9139 */ |
| 8188 class LibraryIdentifier extends Identifier { | 9140 class LibraryIdentifier extends Identifier { |
| 8189 | 9141 |
| 8190 /** | 9142 /** |
| 8191 * The components of the identifier. | 9143 * The components of the identifier. |
| 8192 */ | 9144 */ |
| 8193 NodeList<SimpleIdentifier> _components; | 9145 NodeList<SimpleIdentifier> _components; |
| 8194 | 9146 |
| 8195 /** | 9147 /** |
| 8196 * Initialize a newly created prefixed identifier. | 9148 * Initialize a newly created prefixed identifier. |
| 9149 * |
| 8197 * @param components the components of the identifier | 9150 * @param components the components of the identifier |
| 8198 */ | 9151 */ |
| 8199 LibraryIdentifier.full(List<SimpleIdentifier> components) { | 9152 LibraryIdentifier.full(List<SimpleIdentifier> components) { |
| 8200 this._components = new NodeList<SimpleIdentifier>(this); | 9153 this._components = new NodeList<SimpleIdentifier>(this); |
| 8201 this._components.addAll(components); | 9154 this._components.addAll(components); |
| 8202 } | 9155 } |
| 8203 | 9156 |
| 8204 /** | 9157 /** |
| 8205 * Initialize a newly created prefixed identifier. | 9158 * Initialize a newly created prefixed identifier. |
| 9159 * |
| 8206 * @param components the components of the identifier | 9160 * @param components the components of the identifier |
| 8207 */ | 9161 */ |
| 8208 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components)
; | 9162 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components)
; |
| 8209 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); | 9163 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); |
| 8210 Token get beginToken => _components.beginToken; | 9164 Token get beginToken => _components.beginToken; |
| 8211 | 9165 |
| 8212 /** | 9166 /** |
| 8213 * Return the components of the identifier. | 9167 * Return the components of the identifier. |
| 9168 * |
| 8214 * @return the components of the identifier | 9169 * @return the components of the identifier |
| 8215 */ | 9170 */ |
| 8216 NodeList<SimpleIdentifier> get components => _components; | 9171 NodeList<SimpleIdentifier> get components => _components; |
| 8217 Element get element => null; | 9172 Element get element => null; |
| 8218 Token get endToken => _components.endToken; | 9173 Token get endToken => _components.endToken; |
| 8219 String get name { | 9174 String get name { |
| 8220 JavaStringBuilder builder = new JavaStringBuilder(); | 9175 JavaStringBuilder builder = new JavaStringBuilder(); |
| 8221 bool needsPeriod = false; | 9176 bool needsPeriod = false; |
| 8222 for (SimpleIdentifier identifier in _components) { | 9177 for (SimpleIdentifier identifier in _components) { |
| 8223 if (needsPeriod) { | 9178 if (needsPeriod) { |
| 8224 builder.append("."); | 9179 builder.append("."); |
| 8225 } else { | 9180 } else { |
| 8226 needsPeriod = true; | 9181 needsPeriod = true; |
| 8227 } | 9182 } |
| 8228 builder.append(identifier.name); | 9183 builder.append(identifier.name); |
| 8229 } | 9184 } |
| 8230 return builder.toString(); | 9185 return builder.toString(); |
| 8231 } | 9186 } |
| 8232 Element get staticElement => null; | 9187 Element get staticElement => null; |
| 8233 void visitChildren(ASTVisitor<Object> visitor) { | 9188 void visitChildren(ASTVisitor<Object> visitor) { |
| 8234 _components.accept(visitor); | 9189 _components.accept(visitor); |
| 8235 } | 9190 } |
| 8236 } | 9191 } |
| 8237 /** | 9192 /** |
| 8238 * Instances of the class `ListLiteral` represent a list literal. | 9193 * Instances of the class `ListLiteral` represent a list literal. |
| 9194 * |
| 8239 * <pre> | 9195 * <pre> |
| 8240 * listLiteral ::= | 9196 * listLiteral ::= |
| 8241 * 'const'? ('<' [TypeName type] '>')? '\[' ([Expression expressionList] ','?)?
'\]' | 9197 * 'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']' |
| 8242 * </pre> | 9198 * </pre> |
| 9199 * |
| 8243 * @coverage dart.engine.ast | 9200 * @coverage dart.engine.ast |
| 8244 */ | 9201 */ |
| 8245 class ListLiteral extends TypedLiteral { | 9202 class ListLiteral extends TypedLiteral { |
| 8246 | 9203 |
| 8247 /** | 9204 /** |
| 8248 * The left square bracket. | 9205 * The left square bracket. |
| 8249 */ | 9206 */ |
| 8250 Token _leftBracket; | 9207 Token _leftBracket; |
| 8251 | 9208 |
| 8252 /** | 9209 /** |
| 8253 * The expressions used to compute the elements of the list. | 9210 * The expressions used to compute the elements of the list. |
| 8254 */ | 9211 */ |
| 8255 NodeList<Expression> _elements; | 9212 NodeList<Expression> _elements; |
| 8256 | 9213 |
| 8257 /** | 9214 /** |
| 8258 * The right square bracket. | 9215 * The right square bracket. |
| 8259 */ | 9216 */ |
| 8260 Token _rightBracket; | 9217 Token _rightBracket; |
| 8261 | 9218 |
| 8262 /** | 9219 /** |
| 8263 * Initialize a newly created list literal. | 9220 * Initialize a newly created list literal. |
| 9221 * |
| 8264 * @param modifier the const modifier associated with this literal | 9222 * @param modifier the const modifier associated with this literal |
| 8265 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type | 9223 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type |
| 8266 * arguments were declared | 9224 * arguments were declared |
| 8267 * @param leftBracket the left square bracket | 9225 * @param leftBracket the left square bracket |
| 8268 * @param elements the expressions used to compute the elements of the list | 9226 * @param elements the expressions used to compute the elements of the list |
| 8269 * @param rightBracket the right square bracket | 9227 * @param rightBracket the right square bracket |
| 8270 */ | 9228 */ |
| 8271 ListLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBra
cket, List<Expression> elements, Token rightBracket) : super.full(modifier, type
Arguments) { | 9229 ListLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBra
cket, List<Expression> elements, Token rightBracket) : super.full(modifier, type
Arguments) { |
| 8272 this._elements = new NodeList<Expression>(this); | 9230 this._elements = new NodeList<Expression>(this); |
| 8273 this._leftBracket = leftBracket; | 9231 this._leftBracket = leftBracket; |
| 8274 this._elements.addAll(elements); | 9232 this._elements.addAll(elements); |
| 8275 this._rightBracket = rightBracket; | 9233 this._rightBracket = rightBracket; |
| 8276 } | 9234 } |
| 8277 | 9235 |
| 8278 /** | 9236 /** |
| 8279 * Initialize a newly created list literal. | 9237 * Initialize a newly created list literal. |
| 9238 * |
| 8280 * @param modifier the const modifier associated with this literal | 9239 * @param modifier the const modifier associated with this literal |
| 8281 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type | 9240 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type |
| 8282 * arguments were declared | 9241 * arguments were declared |
| 8283 * @param leftBracket the left square bracket | 9242 * @param leftBracket the left square bracket |
| 8284 * @param elements the expressions used to compute the elements of the list | 9243 * @param elements the expressions used to compute the elements of the list |
| 8285 * @param rightBracket the right square bracket | 9244 * @param rightBracket the right square bracket |
| 8286 */ | 9245 */ |
| 8287 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); | 9246 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); |
| 8288 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); | 9247 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); |
| 8289 Token get beginToken { | 9248 Token get beginToken { |
| 8290 Token token = modifier; | 9249 Token token = modifier; |
| 8291 if (token != null) { | 9250 if (token != null) { |
| 8292 return token; | 9251 return token; |
| 8293 } | 9252 } |
| 8294 TypeArgumentList typeArguments = this.typeArguments; | 9253 TypeArgumentList typeArguments = this.typeArguments; |
| 8295 if (typeArguments != null) { | 9254 if (typeArguments != null) { |
| 8296 return typeArguments.beginToken; | 9255 return typeArguments.beginToken; |
| 8297 } | 9256 } |
| 8298 return _leftBracket; | 9257 return _leftBracket; |
| 8299 } | 9258 } |
| 8300 | 9259 |
| 8301 /** | 9260 /** |
| 8302 * Return the expressions used to compute the elements of the list. | 9261 * Return the expressions used to compute the elements of the list. |
| 9262 * |
| 8303 * @return the expressions used to compute the elements of the list | 9263 * @return the expressions used to compute the elements of the list |
| 8304 */ | 9264 */ |
| 8305 NodeList<Expression> get elements => _elements; | 9265 NodeList<Expression> get elements => _elements; |
| 8306 Token get endToken => _rightBracket; | 9266 Token get endToken => _rightBracket; |
| 8307 | 9267 |
| 8308 /** | 9268 /** |
| 8309 * Return the left square bracket. | 9269 * Return the left square bracket. |
| 9270 * |
| 8310 * @return the left square bracket | 9271 * @return the left square bracket |
| 8311 */ | 9272 */ |
| 8312 Token get leftBracket => _leftBracket; | 9273 Token get leftBracket => _leftBracket; |
| 8313 | 9274 |
| 8314 /** | 9275 /** |
| 8315 * Return the right square bracket. | 9276 * Return the right square bracket. |
| 9277 * |
| 8316 * @return the right square bracket | 9278 * @return the right square bracket |
| 8317 */ | 9279 */ |
| 8318 Token get rightBracket => _rightBracket; | 9280 Token get rightBracket => _rightBracket; |
| 8319 | 9281 |
| 8320 /** | 9282 /** |
| 8321 * Set the left square bracket to the given token. | 9283 * Set the left square bracket to the given token. |
| 9284 * |
| 8322 * @param bracket the left square bracket | 9285 * @param bracket the left square bracket |
| 8323 */ | 9286 */ |
| 8324 void set leftBracket(Token bracket) { | 9287 void set leftBracket(Token bracket) { |
| 8325 _leftBracket = bracket; | 9288 _leftBracket = bracket; |
| 8326 } | 9289 } |
| 8327 | 9290 |
| 8328 /** | 9291 /** |
| 8329 * Set the right square bracket to the given token. | 9292 * Set the right square bracket to the given token. |
| 9293 * |
| 8330 * @param bracket the right square bracket | 9294 * @param bracket the right square bracket |
| 8331 */ | 9295 */ |
| 8332 void set rightBracket(Token bracket) { | 9296 void set rightBracket(Token bracket) { |
| 8333 _rightBracket = bracket; | 9297 _rightBracket = bracket; |
| 8334 } | 9298 } |
| 8335 void visitChildren(ASTVisitor<Object> visitor) { | 9299 void visitChildren(ASTVisitor<Object> visitor) { |
| 8336 super.visitChildren(visitor); | 9300 super.visitChildren(visitor); |
| 8337 _elements.accept(visitor); | 9301 _elements.accept(visitor); |
| 8338 } | 9302 } |
| 8339 } | 9303 } |
| 8340 /** | 9304 /** |
| 8341 * The abstract class `Literal` defines the behavior common to nodes that repres
ent a literal | 9305 * The abstract class `Literal` defines the behavior common to nodes that repres
ent a literal |
| 8342 * expression. | 9306 * expression. |
| 9307 * |
| 8343 * <pre> | 9308 * <pre> |
| 8344 * literal ::=[BooleanLiteral booleanLiteral]| [DoubleLiteral doubleLiteral]| [I
ntegerLiteral integerLiteral]| [ListLiteral listLiteral]| [MapLiteral mapLiteral
]| [NullLiteral nullLiteral]| [StringLiteral stringLiteral]</pre> | 9309 * literal ::= |
| 9310 * [BooleanLiteral] |
| 9311 * | [DoubleLiteral] |
| 9312 * | [IntegerLiteral] |
| 9313 * | [ListLiteral] |
| 9314 * | [MapLiteral] |
| 9315 * | [NullLiteral] |
| 9316 * | [StringLiteral] |
| 9317 * </pre> |
| 9318 * |
| 8345 * @coverage dart.engine.ast | 9319 * @coverage dart.engine.ast |
| 8346 */ | 9320 */ |
| 8347 abstract class Literal extends Expression { | 9321 abstract class Literal extends Expression { |
| 8348 } | 9322 } |
| 8349 /** | 9323 /** |
| 8350 * Instances of the class `MapLiteral` represent a literal map. | 9324 * Instances of the class `MapLiteral` represent a literal map. |
| 9325 * |
| 8351 * <pre> | 9326 * <pre> |
| 8352 * mapLiteral ::= | 9327 * mapLiteral ::= |
| 8353 * 'const'? ('<' [TypeName type] (',' [TypeName type])* '>')? '{' ([MapLiteralEn
try entry] (',' [MapLiteralEntry entry])* ','?)? '}' | 9328 * 'const'? ('<' [TypeName] (',' [TypeName])* '>')? '{' ([MapLiteralEntry] (
',' [MapLiteralEntry])* ','?)? '}' |
| 8354 * </pre> | 9329 * </pre> |
| 9330 * |
| 8355 * @coverage dart.engine.ast | 9331 * @coverage dart.engine.ast |
| 8356 */ | 9332 */ |
| 8357 class MapLiteral extends TypedLiteral { | 9333 class MapLiteral extends TypedLiteral { |
| 8358 | 9334 |
| 8359 /** | 9335 /** |
| 8360 * The left curly bracket. | 9336 * The left curly bracket. |
| 8361 */ | 9337 */ |
| 8362 Token _leftBracket; | 9338 Token _leftBracket; |
| 8363 | 9339 |
| 8364 /** | 9340 /** |
| 8365 * The entries in the map. | 9341 * The entries in the map. |
| 8366 */ | 9342 */ |
| 8367 NodeList<MapLiteralEntry> _entries; | 9343 NodeList<MapLiteralEntry> _entries; |
| 8368 | 9344 |
| 8369 /** | 9345 /** |
| 8370 * The right curly bracket. | 9346 * The right curly bracket. |
| 8371 */ | 9347 */ |
| 8372 Token _rightBracket; | 9348 Token _rightBracket; |
| 8373 | 9349 |
| 8374 /** | 9350 /** |
| 8375 * Initialize a newly created map literal. | 9351 * Initialize a newly created map literal. |
| 9352 * |
| 8376 * @param modifier the const modifier associated with this literal | 9353 * @param modifier the const modifier associated with this literal |
| 8377 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type | 9354 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type |
| 8378 * arguments were declared | 9355 * arguments were declared |
| 8379 * @param leftBracket the left curly bracket | 9356 * @param leftBracket the left curly bracket |
| 8380 * @param entries the entries in the map | 9357 * @param entries the entries in the map |
| 8381 * @param rightBracket the right curly bracket | 9358 * @param rightBracket the right curly bracket |
| 8382 */ | 9359 */ |
| 8383 MapLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBrac
ket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(modifier, t
ypeArguments) { | 9360 MapLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBrac
ket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(modifier, t
ypeArguments) { |
| 8384 this._entries = new NodeList<MapLiteralEntry>(this); | 9361 this._entries = new NodeList<MapLiteralEntry>(this); |
| 8385 this._leftBracket = leftBracket; | 9362 this._leftBracket = leftBracket; |
| 8386 this._entries.addAll(entries); | 9363 this._entries.addAll(entries); |
| 8387 this._rightBracket = rightBracket; | 9364 this._rightBracket = rightBracket; |
| 8388 } | 9365 } |
| 8389 | 9366 |
| 8390 /** | 9367 /** |
| 8391 * Initialize a newly created map literal. | 9368 * Initialize a newly created map literal. |
| 9369 * |
| 8392 * @param modifier the const modifier associated with this literal | 9370 * @param modifier the const modifier associated with this literal |
| 8393 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type | 9371 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type |
| 8394 * arguments were declared | 9372 * arguments were declared |
| 8395 * @param leftBracket the left curly bracket | 9373 * @param leftBracket the left curly bracket |
| 8396 * @param entries the entries in the map | 9374 * @param entries the entries in the map |
| 8397 * @param rightBracket the right curly bracket | 9375 * @param rightBracket the right curly bracket |
| 8398 */ | 9376 */ |
| 8399 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); | 9377 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); |
| 8400 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); | 9378 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); |
| 8401 Token get beginToken { | 9379 Token get beginToken { |
| 8402 Token token = modifier; | 9380 Token token = modifier; |
| 8403 if (token != null) { | 9381 if (token != null) { |
| 8404 return token; | 9382 return token; |
| 8405 } | 9383 } |
| 8406 TypeArgumentList typeArguments = this.typeArguments; | 9384 TypeArgumentList typeArguments = this.typeArguments; |
| 8407 if (typeArguments != null) { | 9385 if (typeArguments != null) { |
| 8408 return typeArguments.beginToken; | 9386 return typeArguments.beginToken; |
| 8409 } | 9387 } |
| 8410 return _leftBracket; | 9388 return _leftBracket; |
| 8411 } | 9389 } |
| 8412 Token get endToken => _rightBracket; | 9390 Token get endToken => _rightBracket; |
| 8413 | 9391 |
| 8414 /** | 9392 /** |
| 8415 * Return the entries in the map. | 9393 * Return the entries in the map. |
| 9394 * |
| 8416 * @return the entries in the map | 9395 * @return the entries in the map |
| 8417 */ | 9396 */ |
| 8418 NodeList<MapLiteralEntry> get entries => _entries; | 9397 NodeList<MapLiteralEntry> get entries => _entries; |
| 8419 | 9398 |
| 8420 /** | 9399 /** |
| 8421 * Return the left curly bracket. | 9400 * Return the left curly bracket. |
| 9401 * |
| 8422 * @return the left curly bracket | 9402 * @return the left curly bracket |
| 8423 */ | 9403 */ |
| 8424 Token get leftBracket => _leftBracket; | 9404 Token get leftBracket => _leftBracket; |
| 8425 | 9405 |
| 8426 /** | 9406 /** |
| 8427 * Return the right curly bracket. | 9407 * Return the right curly bracket. |
| 9408 * |
| 8428 * @return the right curly bracket | 9409 * @return the right curly bracket |
| 8429 */ | 9410 */ |
| 8430 Token get rightBracket => _rightBracket; | 9411 Token get rightBracket => _rightBracket; |
| 8431 | 9412 |
| 8432 /** | 9413 /** |
| 8433 * Set the left curly bracket to the given token. | 9414 * Set the left curly bracket to the given token. |
| 9415 * |
| 8434 * @param bracket the left curly bracket | 9416 * @param bracket the left curly bracket |
| 8435 */ | 9417 */ |
| 8436 void set leftBracket(Token bracket) { | 9418 void set leftBracket(Token bracket) { |
| 8437 _leftBracket = bracket; | 9419 _leftBracket = bracket; |
| 8438 } | 9420 } |
| 8439 | 9421 |
| 8440 /** | 9422 /** |
| 8441 * Set the right curly bracket to the given token. | 9423 * Set the right curly bracket to the given token. |
| 9424 * |
| 8442 * @param bracket the right curly bracket | 9425 * @param bracket the right curly bracket |
| 8443 */ | 9426 */ |
| 8444 void set rightBracket(Token bracket) { | 9427 void set rightBracket(Token bracket) { |
| 8445 _rightBracket = bracket; | 9428 _rightBracket = bracket; |
| 8446 } | 9429 } |
| 8447 void visitChildren(ASTVisitor<Object> visitor) { | 9430 void visitChildren(ASTVisitor<Object> visitor) { |
| 8448 super.visitChildren(visitor); | 9431 super.visitChildren(visitor); |
| 8449 _entries.accept(visitor); | 9432 _entries.accept(visitor); |
| 8450 } | 9433 } |
| 8451 } | 9434 } |
| 8452 /** | 9435 /** |
| 8453 * Instances of the class `MapLiteralEntry` represent a single key/value pair in
a map | 9436 * Instances of the class `MapLiteralEntry` represent a single key/value pair in
a map |
| 8454 * literal. | 9437 * literal. |
| 9438 * |
| 8455 * <pre> | 9439 * <pre> |
| 8456 * mapLiteralEntry ::=[Expression key] ':' [Expression value]</pre> | 9440 * mapLiteralEntry ::= |
| 9441 * [Expression] ':' [Expression] |
| 9442 * </pre> |
| 9443 * |
| 8457 * @coverage dart.engine.ast | 9444 * @coverage dart.engine.ast |
| 8458 */ | 9445 */ |
| 8459 class MapLiteralEntry extends ASTNode { | 9446 class MapLiteralEntry extends ASTNode { |
| 8460 | 9447 |
| 8461 /** | 9448 /** |
| 8462 * The expression computing the key with which the value will be associated. | 9449 * The expression computing the key with which the value will be associated. |
| 8463 */ | 9450 */ |
| 8464 Expression _key; | 9451 Expression _key; |
| 8465 | 9452 |
| 8466 /** | 9453 /** |
| 8467 * The colon that separates the key from the value. | 9454 * The colon that separates the key from the value. |
| 8468 */ | 9455 */ |
| 8469 Token _separator; | 9456 Token _separator; |
| 8470 | 9457 |
| 8471 /** | 9458 /** |
| 8472 * The expression computing the value that will be associated with the key. | 9459 * The expression computing the value that will be associated with the key. |
| 8473 */ | 9460 */ |
| 8474 Expression _value; | 9461 Expression _value; |
| 8475 | 9462 |
| 8476 /** | 9463 /** |
| 8477 * Initialize a newly created map literal entry. | 9464 * Initialize a newly created map literal entry. |
| 9465 * |
| 8478 * @param key the expression computing the key with which the value will be as
sociated | 9466 * @param key the expression computing the key with which the value will be as
sociated |
| 8479 * @param separator the colon that separates the key from the value | 9467 * @param separator the colon that separates the key from the value |
| 8480 * @param value the expression computing the value that will be associated wit
h the key | 9468 * @param value the expression computing the value that will be associated wit
h the key |
| 8481 */ | 9469 */ |
| 8482 MapLiteralEntry.full(Expression key, Token separator, Expression value) { | 9470 MapLiteralEntry.full(Expression key, Token separator, Expression value) { |
| 8483 this._key = becomeParentOf(key); | 9471 this._key = becomeParentOf(key); |
| 8484 this._separator = separator; | 9472 this._separator = separator; |
| 8485 this._value = becomeParentOf(value); | 9473 this._value = becomeParentOf(value); |
| 8486 } | 9474 } |
| 8487 | 9475 |
| 8488 /** | 9476 /** |
| 8489 * Initialize a newly created map literal entry. | 9477 * Initialize a newly created map literal entry. |
| 9478 * |
| 8490 * @param key the expression computing the key with which the value will be as
sociated | 9479 * @param key the expression computing the key with which the value will be as
sociated |
| 8491 * @param separator the colon that separates the key from the value | 9480 * @param separator the colon that separates the key from the value |
| 8492 * @param value the expression computing the value that will be associated wit
h the key | 9481 * @param value the expression computing the value that will be associated wit
h the key |
| 8493 */ | 9482 */ |
| 8494 MapLiteralEntry({Expression key, Token separator, Expression value}) : this.fu
ll(key, separator, value); | 9483 MapLiteralEntry({Expression key, Token separator, Expression value}) : this.fu
ll(key, separator, value); |
| 8495 accept(ASTVisitor visitor) => visitor.visitMapLiteralEntry(this); | 9484 accept(ASTVisitor visitor) => visitor.visitMapLiteralEntry(this); |
| 8496 Token get beginToken => _key.beginToken; | 9485 Token get beginToken => _key.beginToken; |
| 8497 Token get endToken => _value.endToken; | 9486 Token get endToken => _value.endToken; |
| 8498 | 9487 |
| 8499 /** | 9488 /** |
| 8500 * Return the expression computing the key with which the value will be associ
ated. | 9489 * Return the expression computing the key with which the value will be associ
ated. |
| 9490 * |
| 8501 * @return the expression computing the key with which the value will be assoc
iated | 9491 * @return the expression computing the key with which the value will be assoc
iated |
| 8502 */ | 9492 */ |
| 8503 Expression get key => _key; | 9493 Expression get key => _key; |
| 8504 | 9494 |
| 8505 /** | 9495 /** |
| 8506 * Return the colon that separates the key from the value. | 9496 * Return the colon that separates the key from the value. |
| 9497 * |
| 8507 * @return the colon that separates the key from the value | 9498 * @return the colon that separates the key from the value |
| 8508 */ | 9499 */ |
| 8509 Token get separator => _separator; | 9500 Token get separator => _separator; |
| 8510 | 9501 |
| 8511 /** | 9502 /** |
| 8512 * Return the expression computing the value that will be associated with the
key. | 9503 * Return the expression computing the value that will be associated with the
key. |
| 9504 * |
| 8513 * @return the expression computing the value that will be associated with the
key | 9505 * @return the expression computing the value that will be associated with the
key |
| 8514 */ | 9506 */ |
| 8515 Expression get value => _value; | 9507 Expression get value => _value; |
| 8516 | 9508 |
| 8517 /** | 9509 /** |
| 8518 * Set the expression computing the key with which the value will be associate
d to the given | 9510 * Set the expression computing the key with which the value will be associate
d to the given |
| 8519 * string. | 9511 * string. |
| 9512 * |
| 8520 * @param string the expression computing the key with which the value will be
associated | 9513 * @param string the expression computing the key with which the value will be
associated |
| 8521 */ | 9514 */ |
| 8522 void set key(Expression string) { | 9515 void set key(Expression string) { |
| 8523 _key = becomeParentOf(string); | 9516 _key = becomeParentOf(string); |
| 8524 } | 9517 } |
| 8525 | 9518 |
| 8526 /** | 9519 /** |
| 8527 * Set the colon that separates the key from the value to the given token. | 9520 * Set the colon that separates the key from the value to the given token. |
| 9521 * |
| 8528 * @param separator the colon that separates the key from the value | 9522 * @param separator the colon that separates the key from the value |
| 8529 */ | 9523 */ |
| 8530 void set separator(Token separator2) { | 9524 void set separator(Token separator2) { |
| 8531 this._separator = separator2; | 9525 this._separator = separator2; |
| 8532 } | 9526 } |
| 8533 | 9527 |
| 8534 /** | 9528 /** |
| 8535 * Set the expression computing the value that will be associated with the key
to the given | 9529 * Set the expression computing the value that will be associated with the key
to the given |
| 8536 * expression. | 9530 * expression. |
| 9531 * |
| 8537 * @param expression the expression computing the value that will be associate
d with the key | 9532 * @param expression the expression computing the value that will be associate
d with the key |
| 8538 */ | 9533 */ |
| 8539 void set value(Expression expression) { | 9534 void set value(Expression expression) { |
| 8540 _value = becomeParentOf(expression); | 9535 _value = becomeParentOf(expression); |
| 8541 } | 9536 } |
| 8542 void visitChildren(ASTVisitor<Object> visitor) { | 9537 void visitChildren(ASTVisitor<Object> visitor) { |
| 8543 safelyVisitChild(_key, visitor); | 9538 safelyVisitChild(_key, visitor); |
| 8544 safelyVisitChild(_value, visitor); | 9539 safelyVisitChild(_value, visitor); |
| 8545 } | 9540 } |
| 8546 } | 9541 } |
| 8547 /** | 9542 /** |
| 8548 * Instances of the class `MethodDeclaration` represent a method declaration. | 9543 * Instances of the class `MethodDeclaration` represent a method declaration. |
| 9544 * |
| 8549 * <pre> | 9545 * <pre> |
| 8550 * methodDeclaration ::= | 9546 * methodDeclaration ::= |
| 8551 * methodSignature [FunctionBody body]methodSignature ::= | 9547 * methodSignature [FunctionBody] |
| 8552 * 'external'? ('abstract' | 'static')? [Type returnType]? ('get' | 'set')? meth
odName[FormalParameterList formalParameterList]methodName ::=[SimpleIdentifier n
ame]| 'operator' [SimpleIdentifier operator]</pre> | 9548 * |
| 9549 * methodSignature ::= |
| 9550 * 'external'? ('abstract' | 'static')? [Type]? ('get' | 'set')? methodName |
| 9551 * [FormalParameterList] |
| 9552 * |
| 9553 * methodName ::= |
| 9554 * [SimpleIdentifier] |
| 9555 * | 'operator' [SimpleIdentifier] |
| 9556 * </pre> |
| 9557 * |
| 8553 * @coverage dart.engine.ast | 9558 * @coverage dart.engine.ast |
| 8554 */ | 9559 */ |
| 8555 class MethodDeclaration extends ClassMember { | 9560 class MethodDeclaration extends ClassMember { |
| 8556 | 9561 |
| 8557 /** | 9562 /** |
| 8558 * The token for the 'external' keyword, or `null` if the constructor is not e
xternal. | 9563 * The token for the 'external' keyword, or `null` if the constructor is not e
xternal. |
| 8559 */ | 9564 */ |
| 8560 Token _externalKeyword; | 9565 Token _externalKeyword; |
| 8561 | 9566 |
| 8562 /** | 9567 /** |
| (...skipping 29 matching lines...) Expand all Loading... |
| 8592 */ | 9597 */ |
| 8593 FormalParameterList _parameters; | 9598 FormalParameterList _parameters; |
| 8594 | 9599 |
| 8595 /** | 9600 /** |
| 8596 * The body of the method. | 9601 * The body of the method. |
| 8597 */ | 9602 */ |
| 8598 FunctionBody _body; | 9603 FunctionBody _body; |
| 8599 | 9604 |
| 8600 /** | 9605 /** |
| 8601 * Initialize a newly created method declaration. | 9606 * Initialize a newly created method declaration. |
| 9607 * |
| 8602 * @param externalKeyword the token for the 'external' keyword | 9608 * @param externalKeyword the token for the 'external' keyword |
| 8603 * @param comment the documentation comment associated with this method | 9609 * @param comment the documentation comment associated with this method |
| 8604 * @param metadata the annotations associated with this method | 9610 * @param metadata the annotations associated with this method |
| 8605 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 9611 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
| 8606 * @param returnType the return type of the method | 9612 * @param returnType the return type of the method |
| 8607 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 9613 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 8608 * @param operatorKeyword the token representing the 'operator' keyword | 9614 * @param operatorKeyword the token representing the 'operator' keyword |
| 8609 * @param name the name of the method | 9615 * @param name the name of the method |
| 8610 * @param parameters the parameters associated with the method, or `null` if t
his method | 9616 * @param parameters the parameters associated with the method, or `null` if t
his method |
| 8611 * declares a getter | 9617 * declares a getter |
| 8612 * @param body the body of the method | 9618 * @param body the body of the method |
| 8613 */ | 9619 */ |
| 8614 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) { | 9620 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) { |
| 8615 this._externalKeyword = externalKeyword; | 9621 this._externalKeyword = externalKeyword; |
| 8616 this._modifierKeyword = modifierKeyword; | 9622 this._modifierKeyword = modifierKeyword; |
| 8617 this._returnType = becomeParentOf(returnType); | 9623 this._returnType = becomeParentOf(returnType); |
| 8618 this._propertyKeyword = propertyKeyword; | 9624 this._propertyKeyword = propertyKeyword; |
| 8619 this._operatorKeyword = operatorKeyword; | 9625 this._operatorKeyword = operatorKeyword; |
| 8620 this._name = becomeParentOf(name); | 9626 this._name = becomeParentOf(name); |
| 8621 this._parameters = becomeParentOf(parameters); | 9627 this._parameters = becomeParentOf(parameters); |
| 8622 this._body = becomeParentOf(body); | 9628 this._body = becomeParentOf(body); |
| 8623 } | 9629 } |
| 8624 | 9630 |
| 8625 /** | 9631 /** |
| 8626 * Initialize a newly created method declaration. | 9632 * Initialize a newly created method declaration. |
| 9633 * |
| 8627 * @param externalKeyword the token for the 'external' keyword | 9634 * @param externalKeyword the token for the 'external' keyword |
| 8628 * @param comment the documentation comment associated with this method | 9635 * @param comment the documentation comment associated with this method |
| 8629 * @param metadata the annotations associated with this method | 9636 * @param metadata the annotations associated with this method |
| 8630 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 9637 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
| 8631 * @param returnType the return type of the method | 9638 * @param returnType the return type of the method |
| 8632 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 9639 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 8633 * @param operatorKeyword the token representing the 'operator' keyword | 9640 * @param operatorKeyword the token representing the 'operator' keyword |
| 8634 * @param name the name of the method | 9641 * @param name the name of the method |
| 8635 * @param parameters the parameters associated with the method, or `null` if t
his method | 9642 * @param parameters the parameters associated with the method, or `null` if t
his method |
| 8636 * declares a getter | 9643 * declares a getter |
| 8637 * @param body the body of the method | 9644 * @param body the body of the method |
| 8638 */ | 9645 */ |
| 8639 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); | 9646 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); |
| 8640 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); | 9647 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); |
| 8641 | 9648 |
| 8642 /** | 9649 /** |
| 8643 * Return the body of the method. | 9650 * Return the body of the method. |
| 9651 * |
| 8644 * @return the body of the method | 9652 * @return the body of the method |
| 8645 */ | 9653 */ |
| 8646 FunctionBody get body => _body; | 9654 FunctionBody get body => _body; |
| 8647 | 9655 |
| 8648 /** | 9656 /** |
| 8649 * Return the element associated with this method, or `null` if the AST struct
ure has not | 9657 * Return the element associated with this method, or `null` if the AST struct
ure has not |
| 8650 * been resolved. The element can either be a [MethodElement], if this represe
nts the | 9658 * been resolved. The element can either be a [MethodElement], if this represe
nts the |
| 8651 * declaration of a normal method, or a [PropertyAccessorElement] if this repr
esents the | 9659 * declaration of a normal method, or a [PropertyAccessorElement] if this repr
esents the |
| 8652 * declaration of either a getter or a setter. | 9660 * declaration of either a getter or a setter. |
| 9661 * |
| 8653 * @return the element associated with this method | 9662 * @return the element associated with this method |
| 8654 */ | 9663 */ |
| 8655 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; | 9664 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; |
| 8656 Token get endToken => _body.endToken; | 9665 Token get endToken => _body.endToken; |
| 8657 | 9666 |
| 8658 /** | 9667 /** |
| 8659 * Return the token for the 'external' keyword, or `null` if the constructor i
s not | 9668 * Return the token for the 'external' keyword, or `null` if the constructor i
s not |
| 8660 * external. | 9669 * external. |
| 9670 * |
| 8661 * @return the token for the 'external' keyword | 9671 * @return the token for the 'external' keyword |
| 8662 */ | 9672 */ |
| 8663 Token get externalKeyword => _externalKeyword; | 9673 Token get externalKeyword => _externalKeyword; |
| 8664 | 9674 |
| 8665 /** | 9675 /** |
| 8666 * Return the token representing the 'abstract' or 'static' keyword, or `null`
if neither | 9676 * Return the token representing the 'abstract' or 'static' keyword, or `null`
if neither |
| 8667 * modifier was specified. | 9677 * modifier was specified. |
| 9678 * |
| 8668 * @return the token representing the 'abstract' or 'static' keyword | 9679 * @return the token representing the 'abstract' or 'static' keyword |
| 8669 */ | 9680 */ |
| 8670 Token get modifierKeyword => _modifierKeyword; | 9681 Token get modifierKeyword => _modifierKeyword; |
| 8671 | 9682 |
| 8672 /** | 9683 /** |
| 8673 * Return the name of the method. | 9684 * Return the name of the method. |
| 9685 * |
| 8674 * @return the name of the method | 9686 * @return the name of the method |
| 8675 */ | 9687 */ |
| 8676 SimpleIdentifier get name => _name; | 9688 SimpleIdentifier get name => _name; |
| 8677 | 9689 |
| 8678 /** | 9690 /** |
| 8679 * Return the token representing the 'operator' keyword, or `null` if this met
hod does not | 9691 * Return the token representing the 'operator' keyword, or `null` if this met
hod does not |
| 8680 * declare an operator. | 9692 * declare an operator. |
| 9693 * |
| 8681 * @return the token representing the 'operator' keyword | 9694 * @return the token representing the 'operator' keyword |
| 8682 */ | 9695 */ |
| 8683 Token get operatorKeyword => _operatorKeyword; | 9696 Token get operatorKeyword => _operatorKeyword; |
| 8684 | 9697 |
| 8685 /** | 9698 /** |
| 8686 * Return the parameters associated with the method, or `null` if this method
declares a | 9699 * Return the parameters associated with the method, or `null` if this method
declares a |
| 8687 * getter. | 9700 * getter. |
| 9701 * |
| 8688 * @return the parameters associated with the method | 9702 * @return the parameters associated with the method |
| 8689 */ | 9703 */ |
| 8690 FormalParameterList get parameters => _parameters; | 9704 FormalParameterList get parameters => _parameters; |
| 8691 | 9705 |
| 8692 /** | 9706 /** |
| 8693 * Return the token representing the 'get' or 'set' keyword, or `null` if this
is a method | 9707 * Return the token representing the 'get' or 'set' keyword, or `null` if this
is a method |
| 8694 * declaration rather than a property declaration. | 9708 * declaration rather than a property declaration. |
| 9709 * |
| 8695 * @return the token representing the 'get' or 'set' keyword | 9710 * @return the token representing the 'get' or 'set' keyword |
| 8696 */ | 9711 */ |
| 8697 Token get propertyKeyword => _propertyKeyword; | 9712 Token get propertyKeyword => _propertyKeyword; |
| 8698 | 9713 |
| 8699 /** | 9714 /** |
| 8700 * Return the return type of the method, or `null` if no return type was decla
red. | 9715 * Return the return type of the method, or `null` if no return type was decla
red. |
| 9716 * |
| 8701 * @return the return type of the method | 9717 * @return the return type of the method |
| 8702 */ | 9718 */ |
| 8703 TypeName get returnType => _returnType; | 9719 TypeName get returnType => _returnType; |
| 8704 | 9720 |
| 8705 /** | 9721 /** |
| 8706 * Return `true` if this method is declared to be an abstract method. | 9722 * Return `true` if this method is declared to be an abstract method. |
| 9723 * |
| 8707 * @return `true` if this method is declared to be an abstract method | 9724 * @return `true` if this method is declared to be an abstract method |
| 8708 */ | 9725 */ |
| 8709 bool get isAbstract => _externalKeyword == null && (_body is EmptyFunctionBody
); | 9726 bool get isAbstract => _externalKeyword == null && (_body is EmptyFunctionBody
); |
| 8710 | 9727 |
| 8711 /** | 9728 /** |
| 8712 * Return `true` if this method declares a getter. | 9729 * Return `true` if this method declares a getter. |
| 9730 * |
| 8713 * @return `true` if this method declares a getter | 9731 * @return `true` if this method declares a getter |
| 8714 */ | 9732 */ |
| 8715 bool get isGetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.GET); | 9733 bool get isGetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.GET); |
| 8716 | 9734 |
| 8717 /** | 9735 /** |
| 8718 * Return `true` if this method declares an operator. | 9736 * Return `true` if this method declares an operator. |
| 9737 * |
| 8719 * @return `true` if this method declares an operator | 9738 * @return `true` if this method declares an operator |
| 8720 */ | 9739 */ |
| 8721 bool get isOperator => _operatorKeyword != null; | 9740 bool get isOperator => _operatorKeyword != null; |
| 8722 | 9741 |
| 8723 /** | 9742 /** |
| 8724 * Return `true` if this method declares a setter. | 9743 * Return `true` if this method declares a setter. |
| 9744 * |
| 8725 * @return `true` if this method declares a setter | 9745 * @return `true` if this method declares a setter |
| 8726 */ | 9746 */ |
| 8727 bool get isSetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.SET); | 9747 bool get isSetter => _propertyKeyword != null && identical(((_propertyKeyword
as KeywordToken)).keyword, Keyword.SET); |
| 8728 | 9748 |
| 8729 /** | 9749 /** |
| 8730 * Return `true` if this method is declared to be a static method. | 9750 * Return `true` if this method is declared to be a static method. |
| 9751 * |
| 8731 * @return `true` if this method is declared to be a static method | 9752 * @return `true` if this method is declared to be a static method |
| 8732 */ | 9753 */ |
| 8733 bool get isStatic => _modifierKeyword != null && identical(((_modifierKeyword
as KeywordToken)).keyword, Keyword.STATIC); | 9754 bool get isStatic => _modifierKeyword != null && identical(((_modifierKeyword
as KeywordToken)).keyword, Keyword.STATIC); |
| 8734 | 9755 |
| 8735 /** | 9756 /** |
| 8736 * Set the body of the method to the given function body. | 9757 * Set the body of the method to the given function body. |
| 9758 * |
| 8737 * @param functionBody the body of the method | 9759 * @param functionBody the body of the method |
| 8738 */ | 9760 */ |
| 8739 void set body(FunctionBody functionBody) { | 9761 void set body(FunctionBody functionBody) { |
| 8740 _body = becomeParentOf(functionBody); | 9762 _body = becomeParentOf(functionBody); |
| 8741 } | 9763 } |
| 8742 | 9764 |
| 8743 /** | 9765 /** |
| 8744 * Set the token for the 'external' keyword to the given token. | 9766 * Set the token for the 'external' keyword to the given token. |
| 9767 * |
| 8745 * @param externalKeyword the token for the 'external' keyword | 9768 * @param externalKeyword the token for the 'external' keyword |
| 8746 */ | 9769 */ |
| 8747 void set externalKeyword(Token externalKeyword2) { | 9770 void set externalKeyword(Token externalKeyword2) { |
| 8748 this._externalKeyword = externalKeyword2; | 9771 this._externalKeyword = externalKeyword2; |
| 8749 } | 9772 } |
| 8750 | 9773 |
| 8751 /** | 9774 /** |
| 8752 * Set the token representing the 'abstract' or 'static' keyword to the given
token. | 9775 * Set the token representing the 'abstract' or 'static' keyword to the given
token. |
| 9776 * |
| 8753 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 9777 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
| 8754 */ | 9778 */ |
| 8755 void set modifierKeyword(Token modifierKeyword2) { | 9779 void set modifierKeyword(Token modifierKeyword2) { |
| 8756 this._modifierKeyword = modifierKeyword2; | 9780 this._modifierKeyword = modifierKeyword2; |
| 8757 } | 9781 } |
| 8758 | 9782 |
| 8759 /** | 9783 /** |
| 8760 * Set the name of the method to the given identifier. | 9784 * Set the name of the method to the given identifier. |
| 9785 * |
| 8761 * @param identifier the name of the method | 9786 * @param identifier the name of the method |
| 8762 */ | 9787 */ |
| 8763 void set name(SimpleIdentifier identifier) { | 9788 void set name(SimpleIdentifier identifier) { |
| 8764 _name = becomeParentOf(identifier); | 9789 _name = becomeParentOf(identifier); |
| 8765 } | 9790 } |
| 8766 | 9791 |
| 8767 /** | 9792 /** |
| 8768 * Set the token representing the 'operator' keyword to the given token. | 9793 * Set the token representing the 'operator' keyword to the given token. |
| 9794 * |
| 8769 * @param operatorKeyword the token representing the 'operator' keyword | 9795 * @param operatorKeyword the token representing the 'operator' keyword |
| 8770 */ | 9796 */ |
| 8771 void set operatorKeyword(Token operatorKeyword2) { | 9797 void set operatorKeyword(Token operatorKeyword2) { |
| 8772 this._operatorKeyword = operatorKeyword2; | 9798 this._operatorKeyword = operatorKeyword2; |
| 8773 } | 9799 } |
| 8774 | 9800 |
| 8775 /** | 9801 /** |
| 8776 * Set the parameters associated with the method to the given list of paramete
rs. | 9802 * Set the parameters associated with the method to the given list of paramete
rs. |
| 9803 * |
| 8777 * @param parameters the parameters associated with the method | 9804 * @param parameters the parameters associated with the method |
| 8778 */ | 9805 */ |
| 8779 void set parameters(FormalParameterList parameters2) { | 9806 void set parameters(FormalParameterList parameters2) { |
| 8780 this._parameters = becomeParentOf(parameters2); | 9807 this._parameters = becomeParentOf(parameters2); |
| 8781 } | 9808 } |
| 8782 | 9809 |
| 8783 /** | 9810 /** |
| 8784 * Set the token representing the 'get' or 'set' keyword to the given token. | 9811 * Set the token representing the 'get' or 'set' keyword to the given token. |
| 9812 * |
| 8785 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 9813 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
| 8786 */ | 9814 */ |
| 8787 void set propertyKeyword(Token propertyKeyword2) { | 9815 void set propertyKeyword(Token propertyKeyword2) { |
| 8788 this._propertyKeyword = propertyKeyword2; | 9816 this._propertyKeyword = propertyKeyword2; |
| 8789 } | 9817 } |
| 8790 | 9818 |
| 8791 /** | 9819 /** |
| 8792 * Set the return type of the method to the given type name. | 9820 * Set the return type of the method to the given type name. |
| 9821 * |
| 8793 * @param typeName the return type of the method | 9822 * @param typeName the return type of the method |
| 8794 */ | 9823 */ |
| 8795 void set returnType(TypeName typeName) { | 9824 void set returnType(TypeName typeName) { |
| 8796 _returnType = becomeParentOf(typeName); | 9825 _returnType = becomeParentOf(typeName); |
| 8797 } | 9826 } |
| 8798 void visitChildren(ASTVisitor<Object> visitor) { | 9827 void visitChildren(ASTVisitor<Object> visitor) { |
| 8799 super.visitChildren(visitor); | 9828 super.visitChildren(visitor); |
| 8800 safelyVisitChild(_returnType, visitor); | 9829 safelyVisitChild(_returnType, visitor); |
| 8801 safelyVisitChild(_name, visitor); | 9830 safelyVisitChild(_name, visitor); |
| 8802 safelyVisitChild(_parameters, visitor); | 9831 safelyVisitChild(_parameters, visitor); |
| 8803 safelyVisitChild(_body, visitor); | 9832 safelyVisitChild(_body, visitor); |
| 8804 } | 9833 } |
| 8805 Token get firstTokenAfterCommentAndMetadata { | 9834 Token get firstTokenAfterCommentAndMetadata { |
| 8806 if (_modifierKeyword != null) { | 9835 if (_modifierKeyword != null) { |
| 8807 return _modifierKeyword; | 9836 return _modifierKeyword; |
| 8808 } else if (_returnType != null) { | 9837 } else if (_returnType != null) { |
| 8809 return _returnType.beginToken; | 9838 return _returnType.beginToken; |
| 8810 } else if (_propertyKeyword != null) { | 9839 } else if (_propertyKeyword != null) { |
| 8811 return _propertyKeyword; | 9840 return _propertyKeyword; |
| 8812 } else if (_operatorKeyword != null) { | 9841 } else if (_operatorKeyword != null) { |
| 8813 return _operatorKeyword; | 9842 return _operatorKeyword; |
| 8814 } | 9843 } |
| 8815 return _name.beginToken; | 9844 return _name.beginToken; |
| 8816 } | 9845 } |
| 8817 } | 9846 } |
| 8818 /** | 9847 /** |
| 8819 * Instances of the class `MethodInvocation` represent the invocation of either
a function or | 9848 * Instances of the class `MethodInvocation` represent the invocation of either
a function or |
| 8820 * a method. Invocations of functions resulting from evaluating an expression ar
e represented by[FunctionExpressionInvocation function expression invocation] no
des. Invocations of getters | 9849 * a method. Invocations of functions resulting from evaluating an expression ar
e represented by |
| 8821 * and setters are represented by either [PrefixedIdentifier prefixed identifier
] or[PropertyAccess property access] nodes. | 9850 * [FunctionExpressionInvocation] nodes. Invocations of getters |
| 9851 * and setters are represented by either [PrefixedIdentifier] or |
| 9852 * [PropertyAccess] nodes. |
| 9853 * |
| 8822 * <pre> | 9854 * <pre> |
| 8823 * methodInvoction ::= | 9855 * methodInvoction ::= |
| 8824 * ([Expression target] '.')? [SimpleIdentifier methodName] [ArgumentList argume
ntList]</pre> | 9856 * ([Expression] '.')? [SimpleIdentifier] [ArgumentList] |
| 9857 * </pre> |
| 9858 * |
| 8825 * @coverage dart.engine.ast | 9859 * @coverage dart.engine.ast |
| 8826 */ | 9860 */ |
| 8827 class MethodInvocation extends Expression { | 9861 class MethodInvocation extends Expression { |
| 8828 | 9862 |
| 8829 /** | 9863 /** |
| 8830 * The expression producing the object on which the method is defined, or `nul
l` if there is | 9864 * The expression producing the object on which the method is defined, or `nul
l` if there is |
| 8831 * no target (that is, the target is implicitly `this`). | 9865 * no target (that is, the target is implicitly `this`). |
| 8832 */ | 9866 */ |
| 8833 Expression _target; | 9867 Expression _target; |
| 8834 | 9868 |
| 8835 /** | 9869 /** |
| 8836 * The period that separates the target from the method name, or `null` if the
re is no | 9870 * The period that separates the target from the method name, or `null` if the
re is no |
| 8837 * target. | 9871 * target. |
| 8838 */ | 9872 */ |
| 8839 Token _period; | 9873 Token _period; |
| 8840 | 9874 |
| 8841 /** | 9875 /** |
| 8842 * The name of the method being invoked. | 9876 * The name of the method being invoked. |
| 8843 */ | 9877 */ |
| 8844 SimpleIdentifier _methodName; | 9878 SimpleIdentifier _methodName; |
| 8845 | 9879 |
| 8846 /** | 9880 /** |
| 8847 * The list of arguments to the method. | 9881 * The list of arguments to the method. |
| 8848 */ | 9882 */ |
| 8849 ArgumentList _argumentList; | 9883 ArgumentList _argumentList; |
| 8850 | 9884 |
| 8851 /** | 9885 /** |
| 8852 * Initialize a newly created method invocation. | 9886 * Initialize a newly created method invocation. |
| 9887 * |
| 8853 * @param target the expression producing the object on which the method is de
fined | 9888 * @param target the expression producing the object on which the method is de
fined |
| 8854 * @param period the period that separates the target from the method name | 9889 * @param period the period that separates the target from the method name |
| 8855 * @param methodName the name of the method being invoked | 9890 * @param methodName the name of the method being invoked |
| 8856 * @param argumentList the list of arguments to the method | 9891 * @param argumentList the list of arguments to the method |
| 8857 */ | 9892 */ |
| 8858 MethodInvocation.full(Expression target, Token period, SimpleIdentifier method
Name, ArgumentList argumentList) { | 9893 MethodInvocation.full(Expression target, Token period, SimpleIdentifier method
Name, ArgumentList argumentList) { |
| 8859 this._target = becomeParentOf(target); | 9894 this._target = becomeParentOf(target); |
| 8860 this._period = period; | 9895 this._period = period; |
| 8861 this._methodName = becomeParentOf(methodName); | 9896 this._methodName = becomeParentOf(methodName); |
| 8862 this._argumentList = becomeParentOf(argumentList); | 9897 this._argumentList = becomeParentOf(argumentList); |
| 8863 } | 9898 } |
| 8864 | 9899 |
| 8865 /** | 9900 /** |
| 8866 * Initialize a newly created method invocation. | 9901 * Initialize a newly created method invocation. |
| 9902 * |
| 8867 * @param target the expression producing the object on which the method is de
fined | 9903 * @param target the expression producing the object on which the method is de
fined |
| 8868 * @param period the period that separates the target from the method name | 9904 * @param period the period that separates the target from the method name |
| 8869 * @param methodName the name of the method being invoked | 9905 * @param methodName the name of the method being invoked |
| 8870 * @param argumentList the list of arguments to the method | 9906 * @param argumentList the list of arguments to the method |
| 8871 */ | 9907 */ |
| 8872 MethodInvocation({Expression target, Token period, SimpleIdentifier methodName
, ArgumentList argumentList}) : this.full(target, period, methodName, argumentLi
st); | 9908 MethodInvocation({Expression target, Token period, SimpleIdentifier methodName
, ArgumentList argumentList}) : this.full(target, period, methodName, argumentLi
st); |
| 8873 accept(ASTVisitor visitor) => visitor.visitMethodInvocation(this); | 9909 accept(ASTVisitor visitor) => visitor.visitMethodInvocation(this); |
| 8874 | 9910 |
| 8875 /** | 9911 /** |
| 8876 * Return the list of arguments to the method. | 9912 * Return the list of arguments to the method. |
| 9913 * |
| 8877 * @return the list of arguments to the method | 9914 * @return the list of arguments to the method |
| 8878 */ | 9915 */ |
| 8879 ArgumentList get argumentList => _argumentList; | 9916 ArgumentList get argumentList => _argumentList; |
| 8880 Token get beginToken { | 9917 Token get beginToken { |
| 8881 if (_target != null) { | 9918 if (_target != null) { |
| 8882 return _target.beginToken; | 9919 return _target.beginToken; |
| 8883 } else if (_period != null) { | 9920 } else if (_period != null) { |
| 8884 return _period; | 9921 return _period; |
| 8885 } | 9922 } |
| 8886 return _methodName.beginToken; | 9923 return _methodName.beginToken; |
| 8887 } | 9924 } |
| 8888 Token get endToken => _argumentList.endToken; | 9925 Token get endToken => _argumentList.endToken; |
| 8889 | 9926 |
| 8890 /** | 9927 /** |
| 8891 * Return the name of the method being invoked. | 9928 * Return the name of the method being invoked. |
| 9929 * |
| 8892 * @return the name of the method being invoked | 9930 * @return the name of the method being invoked |
| 8893 */ | 9931 */ |
| 8894 SimpleIdentifier get methodName => _methodName; | 9932 SimpleIdentifier get methodName => _methodName; |
| 8895 | 9933 |
| 8896 /** | 9934 /** |
| 8897 * Return the period that separates the target from the method name, or `null`
if there is | 9935 * Return the period that separates the target from the method name, or `null`
if there is |
| 8898 * no target. | 9936 * no target. |
| 9937 * |
| 8899 * @return the period that separates the target from the method name | 9938 * @return the period that separates the target from the method name |
| 8900 */ | 9939 */ |
| 8901 Token get period => _period; | 9940 Token get period => _period; |
| 8902 | 9941 |
| 8903 /** | 9942 /** |
| 8904 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not | 9943 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not |
| 8905 * part of a cascade expression, then this is the same as [getTarget]. If this
invocation | 9944 * part of a cascade expression, then this is the same as [getTarget]. If this
invocation |
| 8906 * is part of a cascade expression, then the target stored with the cascade ex
pression is | 9945 * is part of a cascade expression, then the target stored with the cascade ex
pression is |
| 8907 * returned. | 9946 * returned. |
| 9947 * |
| 8908 * @return the expression used to compute the receiver of the invocation | 9948 * @return the expression used to compute the receiver of the invocation |
| 8909 * @see #getTarget() | 9949 * @see #getTarget() |
| 8910 */ | 9950 */ |
| 8911 Expression get realTarget { | 9951 Expression get realTarget { |
| 8912 if (isCascaded) { | 9952 if (isCascaded) { |
| 8913 ASTNode ancestor = parent; | 9953 ASTNode ancestor = parent; |
| 8914 while (ancestor is! CascadeExpression) { | 9954 while (ancestor is! CascadeExpression) { |
| 8915 if (ancestor == null) { | 9955 if (ancestor == null) { |
| 8916 return _target; | 9956 return _target; |
| 8917 } | 9957 } |
| 8918 ancestor = ancestor.parent; | 9958 ancestor = ancestor.parent; |
| 8919 } | 9959 } |
| 8920 return ((ancestor as CascadeExpression)).target; | 9960 return ((ancestor as CascadeExpression)).target; |
| 8921 } | 9961 } |
| 8922 return _target; | 9962 return _target; |
| 8923 } | 9963 } |
| 8924 | 9964 |
| 8925 /** | 9965 /** |
| 8926 * Return the expression producing the object on which the method is defined,
or `null` if | 9966 * Return the expression producing the object on which the method is defined,
or `null` if |
| 8927 * there is no target (that is, the target is implicitly `this`) or if this me
thod | 9967 * there is no target (that is, the target is implicitly `this`) or if this me
thod |
| 8928 * invocation is part of a cascade expression. | 9968 * invocation is part of a cascade expression. |
| 9969 * |
| 8929 * @return the expression producing the object on which the method is defined | 9970 * @return the expression producing the object on which the method is defined |
| 8930 * @see #getRealTarget() | 9971 * @see #getRealTarget() |
| 8931 */ | 9972 */ |
| 8932 Expression get target => _target; | 9973 Expression get target => _target; |
| 8933 | 9974 |
| 8934 /** | 9975 /** |
| 8935 * Return `true` if this expression is cascaded. If it is, then the target of
this | 9976 * Return `true` if this expression is cascaded. If it is, then the target of
this |
| 8936 * expression is not stored locally but is stored in the nearest ancestor that
is a[CascadeExpression]. | 9977 * expression is not stored locally but is stored in the nearest ancestor that
is a |
| 9978 * [CascadeExpression]. |
| 9979 * |
| 8937 * @return `true` if this expression is cascaded | 9980 * @return `true` if this expression is cascaded |
| 8938 */ | 9981 */ |
| 8939 bool get isCascaded => _period != null && identical(_period.type, TokenType.PE
RIOD_PERIOD); | 9982 bool get isCascaded => _period != null && identical(_period.type, TokenType.PE
RIOD_PERIOD); |
| 8940 | 9983 |
| 8941 /** | 9984 /** |
| 8942 * Set the list of arguments to the method to the given list. | 9985 * Set the list of arguments to the method to the given list. |
| 9986 * |
| 8943 * @param argumentList the list of arguments to the method | 9987 * @param argumentList the list of arguments to the method |
| 8944 */ | 9988 */ |
| 8945 void set argumentList(ArgumentList argumentList2) { | 9989 void set argumentList(ArgumentList argumentList2) { |
| 8946 this._argumentList = becomeParentOf(argumentList2); | 9990 this._argumentList = becomeParentOf(argumentList2); |
| 8947 } | 9991 } |
| 8948 | 9992 |
| 8949 /** | 9993 /** |
| 8950 * Set the name of the method being invoked to the given identifier. | 9994 * Set the name of the method being invoked to the given identifier. |
| 9995 * |
| 8951 * @param identifier the name of the method being invoked | 9996 * @param identifier the name of the method being invoked |
| 8952 */ | 9997 */ |
| 8953 void set methodName(SimpleIdentifier identifier) { | 9998 void set methodName(SimpleIdentifier identifier) { |
| 8954 _methodName = becomeParentOf(identifier); | 9999 _methodName = becomeParentOf(identifier); |
| 8955 } | 10000 } |
| 8956 | 10001 |
| 8957 /** | 10002 /** |
| 8958 * Set the period that separates the target from the method name to the given
token. | 10003 * Set the period that separates the target from the method name to the given
token. |
| 10004 * |
| 8959 * @param period the period that separates the target from the method name | 10005 * @param period the period that separates the target from the method name |
| 8960 */ | 10006 */ |
| 8961 void set period(Token period2) { | 10007 void set period(Token period2) { |
| 8962 this._period = period2; | 10008 this._period = period2; |
| 8963 } | 10009 } |
| 8964 | 10010 |
| 8965 /** | 10011 /** |
| 8966 * Set the expression producing the object on which the method is defined to t
he given expression. | 10012 * Set the expression producing the object on which the method is defined to t
he given expression. |
| 10013 * |
| 8967 * @param expression the expression producing the object on which the method i
s defined | 10014 * @param expression the expression producing the object on which the method i
s defined |
| 8968 */ | 10015 */ |
| 8969 void set target(Expression expression) { | 10016 void set target(Expression expression) { |
| 8970 _target = becomeParentOf(expression); | 10017 _target = becomeParentOf(expression); |
| 8971 } | 10018 } |
| 8972 void visitChildren(ASTVisitor<Object> visitor) { | 10019 void visitChildren(ASTVisitor<Object> visitor) { |
| 8973 safelyVisitChild(_target, visitor); | 10020 safelyVisitChild(_target, visitor); |
| 8974 safelyVisitChild(_methodName, visitor); | 10021 safelyVisitChild(_methodName, visitor); |
| 8975 safelyVisitChild(_argumentList, visitor); | 10022 safelyVisitChild(_argumentList, visitor); |
| 8976 } | 10023 } |
| 8977 } | 10024 } |
| 8978 /** | 10025 /** |
| 8979 * Instances of the class `NamedExpression` represent an expression that has a n
ame associated | 10026 * Instances of the class `NamedExpression` represent an expression that has a n
ame associated |
| 8980 * with it. They are used in method invocations when there are named parameters. | 10027 * with it. They are used in method invocations when there are named parameters. |
| 10028 * |
| 8981 * <pre> | 10029 * <pre> |
| 8982 * namedExpression ::=[Label name] [Expression expression]</pre> | 10030 * namedExpression ::= |
| 10031 * [Label] [Expression] |
| 10032 * </pre> |
| 10033 * |
| 8983 * @coverage dart.engine.ast | 10034 * @coverage dart.engine.ast |
| 8984 */ | 10035 */ |
| 8985 class NamedExpression extends Expression { | 10036 class NamedExpression extends Expression { |
| 8986 | 10037 |
| 8987 /** | 10038 /** |
| 8988 * The name associated with the expression. | 10039 * The name associated with the expression. |
| 8989 */ | 10040 */ |
| 8990 Label _name; | 10041 Label _name; |
| 8991 | 10042 |
| 8992 /** | 10043 /** |
| 8993 * The expression with which the name is associated. | 10044 * The expression with which the name is associated. |
| 8994 */ | 10045 */ |
| 8995 Expression _expression; | 10046 Expression _expression; |
| 8996 | 10047 |
| 8997 /** | 10048 /** |
| 8998 * Initialize a newly created named expression. | 10049 * Initialize a newly created named expression. |
| 10050 * |
| 8999 * @param name the name associated with the expression | 10051 * @param name the name associated with the expression |
| 9000 * @param expression the expression with which the name is associated | 10052 * @param expression the expression with which the name is associated |
| 9001 */ | 10053 */ |
| 9002 NamedExpression.full(Label name, Expression expression) { | 10054 NamedExpression.full(Label name, Expression expression) { |
| 9003 this._name = becomeParentOf(name); | 10055 this._name = becomeParentOf(name); |
| 9004 this._expression = becomeParentOf(expression); | 10056 this._expression = becomeParentOf(expression); |
| 9005 } | 10057 } |
| 9006 | 10058 |
| 9007 /** | 10059 /** |
| 9008 * Initialize a newly created named expression. | 10060 * Initialize a newly created named expression. |
| 10061 * |
| 9009 * @param name the name associated with the expression | 10062 * @param name the name associated with the expression |
| 9010 * @param expression the expression with which the name is associated | 10063 * @param expression the expression with which the name is associated |
| 9011 */ | 10064 */ |
| 9012 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); | 10065 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); |
| 9013 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); | 10066 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); |
| 9014 Token get beginToken => _name.beginToken; | 10067 Token get beginToken => _name.beginToken; |
| 9015 | 10068 |
| 9016 /** | 10069 /** |
| 9017 * Return the element representing the parameter being named by this expressio
n, or `null`if the AST structure has not been resolved or if there is no paramet
er with the same name as | 10070 * Return the element representing the parameter being named by this expressio
n, or `null` |
| 10071 * if the AST structure has not been resolved or if there is no parameter with
the same name as |
| 9018 * this expression. | 10072 * this expression. |
| 10073 * |
| 9019 * @return the element representing the parameter being named by this expressi
on | 10074 * @return the element representing the parameter being named by this expressi
on |
| 9020 */ | 10075 */ |
| 9021 ParameterElement get element { | 10076 ParameterElement get element { |
| 9022 Element element = _name.label.element; | 10077 Element element = _name.label.element; |
| 9023 if (element is ParameterElement) { | 10078 if (element is ParameterElement) { |
| 9024 return element as ParameterElement; | 10079 return element as ParameterElement; |
| 9025 } | 10080 } |
| 9026 return null; | 10081 return null; |
| 9027 } | 10082 } |
| 9028 Token get endToken => _expression.endToken; | 10083 Token get endToken => _expression.endToken; |
| 9029 | 10084 |
| 9030 /** | 10085 /** |
| 9031 * Return the expression with which the name is associated. | 10086 * Return the expression with which the name is associated. |
| 10087 * |
| 9032 * @return the expression with which the name is associated | 10088 * @return the expression with which the name is associated |
| 9033 */ | 10089 */ |
| 9034 Expression get expression => _expression; | 10090 Expression get expression => _expression; |
| 9035 | 10091 |
| 9036 /** | 10092 /** |
| 9037 * Return the name associated with the expression. | 10093 * Return the name associated with the expression. |
| 10094 * |
| 9038 * @return the name associated with the expression | 10095 * @return the name associated with the expression |
| 9039 */ | 10096 */ |
| 9040 Label get name => _name; | 10097 Label get name => _name; |
| 9041 | 10098 |
| 9042 /** | 10099 /** |
| 9043 * Set the expression with which the name is associated to the given expressio
n. | 10100 * Set the expression with which the name is associated to the given expressio
n. |
| 10101 * |
| 9044 * @param expression the expression with which the name is associated | 10102 * @param expression the expression with which the name is associated |
| 9045 */ | 10103 */ |
| 9046 void set expression(Expression expression2) { | 10104 void set expression(Expression expression2) { |
| 9047 this._expression = becomeParentOf(expression2); | 10105 this._expression = becomeParentOf(expression2); |
| 9048 } | 10106 } |
| 9049 | 10107 |
| 9050 /** | 10108 /** |
| 9051 * Set the name associated with the expression to the given identifier. | 10109 * Set the name associated with the expression to the given identifier. |
| 10110 * |
| 9052 * @param identifier the name associated with the expression | 10111 * @param identifier the name associated with the expression |
| 9053 */ | 10112 */ |
| 9054 void set name(Label identifier) { | 10113 void set name(Label identifier) { |
| 9055 _name = becomeParentOf(identifier); | 10114 _name = becomeParentOf(identifier); |
| 9056 } | 10115 } |
| 9057 void visitChildren(ASTVisitor<Object> visitor) { | 10116 void visitChildren(ASTVisitor<Object> visitor) { |
| 9058 safelyVisitChild(_name, visitor); | 10117 safelyVisitChild(_name, visitor); |
| 9059 safelyVisitChild(_expression, visitor); | 10118 safelyVisitChild(_expression, visitor); |
| 9060 } | 10119 } |
| 9061 } | 10120 } |
| 9062 /** | 10121 /** |
| 9063 * The abstract class `NamespaceDirective` defines the behavior common to nodes
that represent | 10122 * The abstract class `NamespaceDirective` defines the behavior common to nodes
that represent |
| 9064 * a directive that impacts the namespace of a library. | 10123 * a directive that impacts the namespace of a library. |
| 10124 * |
| 9065 * <pre> | 10125 * <pre> |
| 9066 * directive ::=[ExportDirective exportDirective]| [ImportDirective importDirect
ive]</pre> | 10126 * directive ::= |
| 10127 * [ExportDirective] |
| 10128 * | [ImportDirective] |
| 10129 * </pre> |
| 10130 * |
| 9067 * @coverage dart.engine.ast | 10131 * @coverage dart.engine.ast |
| 9068 */ | 10132 */ |
| 9069 abstract class NamespaceDirective extends UriBasedDirective { | 10133 abstract class NamespaceDirective extends UriBasedDirective { |
| 9070 | 10134 |
| 9071 /** | 10135 /** |
| 9072 * The token representing the 'import' or 'export' keyword. | 10136 * The token representing the 'import' or 'export' keyword. |
| 9073 */ | 10137 */ |
| 9074 Token _keyword; | 10138 Token _keyword; |
| 9075 | 10139 |
| 9076 /** | 10140 /** |
| 9077 * The combinators used to control which names are imported or exported. | 10141 * The combinators used to control which names are imported or exported. |
| 9078 */ | 10142 */ |
| 9079 NodeList<Combinator> _combinators; | 10143 NodeList<Combinator> _combinators; |
| 9080 | 10144 |
| 9081 /** | 10145 /** |
| 9082 * The semicolon terminating the directive. | 10146 * The semicolon terminating the directive. |
| 9083 */ | 10147 */ |
| 9084 Token _semicolon; | 10148 Token _semicolon; |
| 9085 | 10149 |
| 9086 /** | 10150 /** |
| 9087 * Initialize a newly created namespace directive. | 10151 * Initialize a newly created namespace directive. |
| 10152 * |
| 9088 * @param comment the documentation comment associated with this directive | 10153 * @param comment the documentation comment associated with this directive |
| 9089 * @param metadata the annotations associated with the directive | 10154 * @param metadata the annotations associated with the directive |
| 9090 * @param keyword the token representing the 'import' or 'export' keyword | 10155 * @param keyword the token representing the 'import' or 'export' keyword |
| 9091 * @param libraryUri the URI of the library being imported or exported | 10156 * @param libraryUri the URI of the library being imported or exported |
| 9092 * @param combinators the combinators used to control which names are imported
or exported | 10157 * @param combinators the combinators used to control which names are imported
or exported |
| 9093 * @param semicolon the semicolon terminating the directive | 10158 * @param semicolon the semicolon terminating the directive |
| 9094 */ | 10159 */ |
| 9095 NamespaceDirective.full(Comment comment, List<Annotation> metadata, Token keyw
ord, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) :
super.full(comment, metadata, libraryUri) { | 10160 NamespaceDirective.full(Comment comment, List<Annotation> metadata, Token keyw
ord, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) :
super.full(comment, metadata, libraryUri) { |
| 9096 this._combinators = new NodeList<Combinator>(this); | 10161 this._combinators = new NodeList<Combinator>(this); |
| 9097 this._keyword = keyword; | 10162 this._keyword = keyword; |
| 9098 this._combinators.addAll(combinators); | 10163 this._combinators.addAll(combinators); |
| 9099 this._semicolon = semicolon; | 10164 this._semicolon = semicolon; |
| 9100 } | 10165 } |
| 9101 | 10166 |
| 9102 /** | 10167 /** |
| 9103 * Initialize a newly created namespace directive. | 10168 * Initialize a newly created namespace directive. |
| 10169 * |
| 9104 * @param comment the documentation comment associated with this directive | 10170 * @param comment the documentation comment associated with this directive |
| 9105 * @param metadata the annotations associated with the directive | 10171 * @param metadata the annotations associated with the directive |
| 9106 * @param keyword the token representing the 'import' or 'export' keyword | 10172 * @param keyword the token representing the 'import' or 'export' keyword |
| 9107 * @param libraryUri the URI of the library being imported or exported | 10173 * @param libraryUri the URI of the library being imported or exported |
| 9108 * @param combinators the combinators used to control which names are imported
or exported | 10174 * @param combinators the combinators used to control which names are imported
or exported |
| 9109 * @param semicolon the semicolon terminating the directive | 10175 * @param semicolon the semicolon terminating the directive |
| 9110 */ | 10176 */ |
| 9111 NamespaceDirective({Comment comment, List<Annotation> metadata, Token keyword,
StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : thi
s.full(comment, metadata, keyword, libraryUri, combinators, semicolon); | 10177 NamespaceDirective({Comment comment, List<Annotation> metadata, Token keyword,
StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : thi
s.full(comment, metadata, keyword, libraryUri, combinators, semicolon); |
| 9112 | 10178 |
| 9113 /** | 10179 /** |
| 9114 * Return the combinators used to control how names are imported or exported. | 10180 * Return the combinators used to control how names are imported or exported. |
| 10181 * |
| 9115 * @return the combinators used to control how names are imported or exported | 10182 * @return the combinators used to control how names are imported or exported |
| 9116 */ | 10183 */ |
| 9117 NodeList<Combinator> get combinators => _combinators; | 10184 NodeList<Combinator> get combinators => _combinators; |
| 9118 Token get endToken => _semicolon; | 10185 Token get endToken => _semicolon; |
| 9119 Token get keyword => _keyword; | 10186 Token get keyword => _keyword; |
| 9120 | 10187 |
| 9121 /** | 10188 /** |
| 9122 * Return the semicolon terminating the directive. | 10189 * Return the semicolon terminating the directive. |
| 10190 * |
| 9123 * @return the semicolon terminating the directive | 10191 * @return the semicolon terminating the directive |
| 9124 */ | 10192 */ |
| 9125 Token get semicolon => _semicolon; | 10193 Token get semicolon => _semicolon; |
| 9126 LibraryElement get uriElement; | 10194 LibraryElement get uriElement; |
| 9127 | 10195 |
| 9128 /** | 10196 /** |
| 9129 * Set the token representing the 'import' or 'export' keyword to the given to
ken. | 10197 * Set the token representing the 'import' or 'export' keyword to the given to
ken. |
| 10198 * |
| 9130 * @param exportToken the token representing the 'import' or 'export' keyword | 10199 * @param exportToken the token representing the 'import' or 'export' keyword |
| 9131 */ | 10200 */ |
| 9132 void set keyword(Token exportToken) { | 10201 void set keyword(Token exportToken) { |
| 9133 this._keyword = exportToken; | 10202 this._keyword = exportToken; |
| 9134 } | 10203 } |
| 9135 | 10204 |
| 9136 /** | 10205 /** |
| 9137 * Set the semicolon terminating the directive to the given token. | 10206 * Set the semicolon terminating the directive to the given token. |
| 10207 * |
| 9138 * @param semicolon the semicolon terminating the directive | 10208 * @param semicolon the semicolon terminating the directive |
| 9139 */ | 10209 */ |
| 9140 void set semicolon(Token semicolon2) { | 10210 void set semicolon(Token semicolon2) { |
| 9141 this._semicolon = semicolon2; | 10211 this._semicolon = semicolon2; |
| 9142 } | 10212 } |
| 9143 Token get firstTokenAfterCommentAndMetadata => _keyword; | 10213 Token get firstTokenAfterCommentAndMetadata => _keyword; |
| 9144 } | 10214 } |
| 9145 /** | 10215 /** |
| 9146 * Instances of the class `NativeFunctionBody` represent a function body that co
nsists of a | 10216 * Instances of the class `NativeFunctionBody` represent a function body that co
nsists of a |
| 9147 * native keyword followed by a string literal. | 10217 * native keyword followed by a string literal. |
| 10218 * |
| 9148 * <pre> | 10219 * <pre> |
| 9149 * nativeFunctionBody ::= | 10220 * nativeFunctionBody ::= |
| 9150 * 'native' [SimpleStringLiteral simpleStringLiteral] ';' | 10221 * 'native' [SimpleStringLiteral] ';' |
| 9151 * </pre> | 10222 * </pre> |
| 10223 * |
| 9152 * @coverage dart.engine.ast | 10224 * @coverage dart.engine.ast |
| 9153 */ | 10225 */ |
| 9154 class NativeFunctionBody extends FunctionBody { | 10226 class NativeFunctionBody extends FunctionBody { |
| 9155 | 10227 |
| 9156 /** | 10228 /** |
| 9157 * The token representing 'native' that marks the start of the function body. | 10229 * The token representing 'native' that marks the start of the function body. |
| 9158 */ | 10230 */ |
| 9159 Token _nativeToken; | 10231 Token _nativeToken; |
| 9160 | 10232 |
| 9161 /** | 10233 /** |
| 9162 * The string literal, after the 'native' token. | 10234 * The string literal, after the 'native' token. |
| 9163 */ | 10235 */ |
| 9164 StringLiteral _stringLiteral; | 10236 StringLiteral _stringLiteral; |
| 9165 | 10237 |
| 9166 /** | 10238 /** |
| 9167 * The token representing the semicolon that marks the end of the function bod
y. | 10239 * The token representing the semicolon that marks the end of the function bod
y. |
| 9168 */ | 10240 */ |
| 9169 Token _semicolon; | 10241 Token _semicolon; |
| 9170 | 10242 |
| 9171 /** | 10243 /** |
| 9172 * Initialize a newly created function body consisting of the 'native' token,
a string literal, | 10244 * Initialize a newly created function body consisting of the 'native' token,
a string literal, |
| 9173 * and a semicolon. | 10245 * and a semicolon. |
| 10246 * |
| 9174 * @param nativeToken the token representing 'native' that marks the start of
the function body | 10247 * @param nativeToken the token representing 'native' that marks the start of
the function body |
| 9175 * @param stringLiteral the string literal | 10248 * @param stringLiteral the string literal |
| 9176 * @param semicolon the token representing the semicolon that marks the end of
the function body | 10249 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 9177 */ | 10250 */ |
| 9178 NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token
semicolon) { | 10251 NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token
semicolon) { |
| 9179 this._nativeToken = nativeToken; | 10252 this._nativeToken = nativeToken; |
| 9180 this._stringLiteral = becomeParentOf(stringLiteral); | 10253 this._stringLiteral = becomeParentOf(stringLiteral); |
| 9181 this._semicolon = semicolon; | 10254 this._semicolon = semicolon; |
| 9182 } | 10255 } |
| 9183 | 10256 |
| 9184 /** | 10257 /** |
| 9185 * Initialize a newly created function body consisting of the 'native' token,
a string literal, | 10258 * Initialize a newly created function body consisting of the 'native' token,
a string literal, |
| 9186 * and a semicolon. | 10259 * and a semicolon. |
| 10260 * |
| 9187 * @param nativeToken the token representing 'native' that marks the start of
the function body | 10261 * @param nativeToken the token representing 'native' that marks the start of
the function body |
| 9188 * @param stringLiteral the string literal | 10262 * @param stringLiteral the string literal |
| 9189 * @param semicolon the token representing the semicolon that marks the end of
the function body | 10263 * @param semicolon the token representing the semicolon that marks the end of
the function body |
| 9190 */ | 10264 */ |
| 9191 NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semi
colon}) : this.full(nativeToken, stringLiteral, semicolon); | 10265 NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semi
colon}) : this.full(nativeToken, stringLiteral, semicolon); |
| 9192 accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this); | 10266 accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this); |
| 9193 Token get beginToken => _nativeToken; | 10267 Token get beginToken => _nativeToken; |
| 9194 Token get endToken => _semicolon; | 10268 Token get endToken => _semicolon; |
| 9195 | 10269 |
| 9196 /** | 10270 /** |
| 9197 * Return the simple identifier representing the 'native' token. | 10271 * Return the simple identifier representing the 'native' token. |
| 10272 * |
| 9198 * @return the simple identifier representing the 'native' token | 10273 * @return the simple identifier representing the 'native' token |
| 9199 */ | 10274 */ |
| 9200 Token get nativeToken => _nativeToken; | 10275 Token get nativeToken => _nativeToken; |
| 9201 | 10276 |
| 9202 /** | 10277 /** |
| 9203 * Return the token representing the semicolon that marks the end of the funct
ion body. | 10278 * Return the token representing the semicolon that marks the end of the funct
ion body. |
| 10279 * |
| 9204 * @return the token representing the semicolon that marks the end of the func
tion body | 10280 * @return the token representing the semicolon that marks the end of the func
tion body |
| 9205 */ | 10281 */ |
| 9206 Token get semicolon => _semicolon; | 10282 Token get semicolon => _semicolon; |
| 9207 | 10283 |
| 9208 /** | 10284 /** |
| 9209 * Return the string literal representing the string after the 'native' token. | 10285 * Return the string literal representing the string after the 'native' token. |
| 10286 * |
| 9210 * @return the string literal representing the string after the 'native' token | 10287 * @return the string literal representing the string after the 'native' token |
| 9211 */ | 10288 */ |
| 9212 StringLiteral get stringLiteral => _stringLiteral; | 10289 StringLiteral get stringLiteral => _stringLiteral; |
| 9213 void visitChildren(ASTVisitor<Object> visitor) { | 10290 void visitChildren(ASTVisitor<Object> visitor) { |
| 9214 safelyVisitChild(_stringLiteral, visitor); | 10291 safelyVisitChild(_stringLiteral, visitor); |
| 9215 } | 10292 } |
| 9216 } | 10293 } |
| 9217 /** | 10294 /** |
| 9218 * The abstract class `NormalFormalParameter` defines the behavior common to for
mal parameters | 10295 * The abstract class `NormalFormalParameter` defines the behavior common to for
mal parameters |
| 9219 * that are required (are not optional). | 10296 * that are required (are not optional). |
| 10297 * |
| 9220 * <pre> | 10298 * <pre> |
| 9221 * normalFormalParameter ::=[FunctionTypedFormalParameter functionSignature]| [F
ieldFormalParameter fieldFormalParameter]| [SimpleFormalParameter simpleFormalPa
rameter]</pre> | 10299 * normalFormalParameter ::= |
| 10300 * [FunctionTypedFormalParameter] |
| 10301 * | [FieldFormalParameter] |
| 10302 * | [SimpleFormalParameter] |
| 10303 * </pre> |
| 10304 * |
| 9222 * @coverage dart.engine.ast | 10305 * @coverage dart.engine.ast |
| 9223 */ | 10306 */ |
| 9224 abstract class NormalFormalParameter extends FormalParameter { | 10307 abstract class NormalFormalParameter extends FormalParameter { |
| 9225 | 10308 |
| 9226 /** | 10309 /** |
| 9227 * The documentation comment associated with this parameter, or `null` if this
parameter | 10310 * The documentation comment associated with this parameter, or `null` if this
parameter |
| 9228 * does not have a documentation comment associated with it. | 10311 * does not have a documentation comment associated with it. |
| 9229 */ | 10312 */ |
| 9230 Comment _comment; | 10313 Comment _comment; |
| 9231 | 10314 |
| 9232 /** | 10315 /** |
| 9233 * The annotations associated with this parameter. | 10316 * The annotations associated with this parameter. |
| 9234 */ | 10317 */ |
| 9235 NodeList<Annotation> _metadata; | 10318 NodeList<Annotation> _metadata; |
| 9236 | 10319 |
| 9237 /** | 10320 /** |
| 9238 * The name of the parameter being declared. | 10321 * The name of the parameter being declared. |
| 9239 */ | 10322 */ |
| 9240 SimpleIdentifier _identifier; | 10323 SimpleIdentifier _identifier; |
| 9241 | 10324 |
| 9242 /** | 10325 /** |
| 9243 * Initialize a newly created formal parameter. | 10326 * Initialize a newly created formal parameter. |
| 10327 * |
| 9244 * @param comment the documentation comment associated with this parameter | 10328 * @param comment the documentation comment associated with this parameter |
| 9245 * @param metadata the annotations associated with this parameter | 10329 * @param metadata the annotations associated with this parameter |
| 9246 * @param identifier the name of the parameter being declared | 10330 * @param identifier the name of the parameter being declared |
| 9247 */ | 10331 */ |
| 9248 NormalFormalParameter.full(Comment comment, List<Annotation> metadata, SimpleI
dentifier identifier) { | 10332 NormalFormalParameter.full(Comment comment, List<Annotation> metadata, SimpleI
dentifier identifier) { |
| 9249 this._metadata = new NodeList<Annotation>(this); | 10333 this._metadata = new NodeList<Annotation>(this); |
| 9250 this._comment = becomeParentOf(comment); | 10334 this._comment = becomeParentOf(comment); |
| 9251 this._metadata.addAll(metadata); | 10335 this._metadata.addAll(metadata); |
| 9252 this._identifier = becomeParentOf(identifier); | 10336 this._identifier = becomeParentOf(identifier); |
| 9253 } | 10337 } |
| 9254 | 10338 |
| 9255 /** | 10339 /** |
| 9256 * Initialize a newly created formal parameter. | 10340 * Initialize a newly created formal parameter. |
| 10341 * |
| 9257 * @param comment the documentation comment associated with this parameter | 10342 * @param comment the documentation comment associated with this parameter |
| 9258 * @param metadata the annotations associated with this parameter | 10343 * @param metadata the annotations associated with this parameter |
| 9259 * @param identifier the name of the parameter being declared | 10344 * @param identifier the name of the parameter being declared |
| 9260 */ | 10345 */ |
| 9261 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); | 10346 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); |
| 9262 | 10347 |
| 9263 /** | 10348 /** |
| 9264 * Return the documentation comment associated with this parameter, or `null`
if this | 10349 * Return the documentation comment associated with this parameter, or `null`
if this |
| 9265 * parameter does not have a documentation comment associated with it. | 10350 * parameter does not have a documentation comment associated with it. |
| 10351 * |
| 9266 * @return the documentation comment associated with this parameter | 10352 * @return the documentation comment associated with this parameter |
| 9267 */ | 10353 */ |
| 9268 Comment get documentationComment => _comment; | 10354 Comment get documentationComment => _comment; |
| 9269 SimpleIdentifier get identifier => _identifier; | 10355 SimpleIdentifier get identifier => _identifier; |
| 9270 ParameterKind get kind { | 10356 ParameterKind get kind { |
| 9271 ASTNode parent = this.parent; | 10357 ASTNode parent = this.parent; |
| 9272 if (parent is DefaultFormalParameter) { | 10358 if (parent is DefaultFormalParameter) { |
| 9273 return ((parent as DefaultFormalParameter)).kind; | 10359 return ((parent as DefaultFormalParameter)).kind; |
| 9274 } | 10360 } |
| 9275 return ParameterKind.REQUIRED; | 10361 return ParameterKind.REQUIRED; |
| 9276 } | 10362 } |
| 9277 | 10363 |
| 9278 /** | 10364 /** |
| 9279 * Return the annotations associated with this parameter. | 10365 * Return the annotations associated with this parameter. |
| 10366 * |
| 9280 * @return the annotations associated with this parameter | 10367 * @return the annotations associated with this parameter |
| 9281 */ | 10368 */ |
| 9282 NodeList<Annotation> get metadata => _metadata; | 10369 NodeList<Annotation> get metadata => _metadata; |
| 9283 | 10370 |
| 9284 /** | 10371 /** |
| 9285 * Return `true` if this parameter was declared with the 'const' modifier. | 10372 * Return `true` if this parameter was declared with the 'const' modifier. |
| 10373 * |
| 9286 * @return `true` if this parameter was declared with the 'const' modifier | 10374 * @return `true` if this parameter was declared with the 'const' modifier |
| 9287 */ | 10375 */ |
| 9288 bool get isConst; | 10376 bool get isConst; |
| 9289 | 10377 |
| 9290 /** | 10378 /** |
| 9291 * Return `true` if this parameter was declared with the 'final' modifier. Par
ameters that | 10379 * Return `true` if this parameter was declared with the 'final' modifier. Par
ameters that |
| 9292 * are declared with the 'const' modifier will return `false` even though they
are | 10380 * are declared with the 'const' modifier will return `false` even though they
are |
| 9293 * implicitly final. | 10381 * implicitly final. |
| 10382 * |
| 9294 * @return `true` if this parameter was declared with the 'final' modifier | 10383 * @return `true` if this parameter was declared with the 'final' modifier |
| 9295 */ | 10384 */ |
| 9296 bool get isFinal; | 10385 bool get isFinal; |
| 9297 | 10386 |
| 9298 /** | 10387 /** |
| 9299 * Set the documentation comment associated with this parameter to the given c
omment | 10388 * Set the documentation comment associated with this parameter to the given c
omment |
| 10389 * |
| 9300 * @param comment the documentation comment to be associated with this paramet
er | 10390 * @param comment the documentation comment to be associated with this paramet
er |
| 9301 */ | 10391 */ |
| 9302 void set documentationComment(Comment comment2) { | 10392 void set documentationComment(Comment comment2) { |
| 9303 this._comment = becomeParentOf(comment2); | 10393 this._comment = becomeParentOf(comment2); |
| 9304 } | 10394 } |
| 9305 | 10395 |
| 9306 /** | 10396 /** |
| 9307 * Set the name of the parameter being declared to the given identifier. | 10397 * Set the name of the parameter being declared to the given identifier. |
| 10398 * |
| 9308 * @param identifier the name of the parameter being declared | 10399 * @param identifier the name of the parameter being declared |
| 9309 */ | 10400 */ |
| 9310 void set identifier(SimpleIdentifier identifier2) { | 10401 void set identifier(SimpleIdentifier identifier2) { |
| 9311 this._identifier = becomeParentOf(identifier2); | 10402 this._identifier = becomeParentOf(identifier2); |
| 9312 } | 10403 } |
| 9313 void visitChildren(ASTVisitor<Object> visitor) { | 10404 void visitChildren(ASTVisitor<Object> visitor) { |
| 9314 if (commentIsBeforeAnnotations()) { | 10405 if (commentIsBeforeAnnotations()) { |
| 9315 safelyVisitChild(_comment, visitor); | 10406 safelyVisitChild(_comment, visitor); |
| 9316 _metadata.accept(visitor); | 10407 _metadata.accept(visitor); |
| 9317 } else { | 10408 } else { |
| 9318 for (ASTNode child in sortedCommentAndAnnotations) { | 10409 for (ASTNode child in sortedCommentAndAnnotations) { |
| 9319 child.accept(visitor); | 10410 child.accept(visitor); |
| 9320 } | 10411 } |
| 9321 } | 10412 } |
| 9322 } | 10413 } |
| 9323 | 10414 |
| 9324 /** | 10415 /** |
| 9325 * Return `true` if the comment is lexically before any annotations. | 10416 * Return `true` if the comment is lexically before any annotations. |
| 10417 * |
| 9326 * @return `true` if the comment is lexically before any annotations | 10418 * @return `true` if the comment is lexically before any annotations |
| 9327 */ | 10419 */ |
| 9328 bool commentIsBeforeAnnotations() { | 10420 bool commentIsBeforeAnnotations() { |
| 9329 if (_comment == null || _metadata.isEmpty) { | 10421 if (_comment == null || _metadata.isEmpty) { |
| 9330 return true; | 10422 return true; |
| 9331 } | 10423 } |
| 9332 Annotation firstAnnotation = _metadata[0]; | 10424 Annotation firstAnnotation = _metadata[0]; |
| 9333 return _comment.offset < firstAnnotation.offset; | 10425 return _comment.offset < firstAnnotation.offset; |
| 9334 } | 10426 } |
| 9335 | 10427 |
| 9336 /** | 10428 /** |
| 9337 * Return an array containing the comment and annotations associated with this
parameter, sorted | 10429 * Return an array containing the comment and annotations associated with this
parameter, sorted |
| 9338 * in lexical order. | 10430 * in lexical order. |
| 10431 * |
| 9339 * @return the comment and annotations associated with this parameter in the o
rder in which they | 10432 * @return the comment and annotations associated with this parameter in the o
rder in which they |
| 9340 * appeared in the original source | 10433 * appeared in the original source |
| 9341 */ | 10434 */ |
| 9342 List<ASTNode> get sortedCommentAndAnnotations { | 10435 List<ASTNode> get sortedCommentAndAnnotations { |
| 9343 List<ASTNode> childList = new List<ASTNode>(); | 10436 List<ASTNode> childList = new List<ASTNode>(); |
| 9344 childList.add(_comment); | 10437 childList.add(_comment); |
| 9345 childList.addAll(_metadata); | 10438 childList.addAll(_metadata); |
| 9346 List<ASTNode> children = new List.from(childList); | 10439 List<ASTNode> children = new List.from(childList); |
| 9347 children.sort(ASTNode.LEXICAL_ORDER); | 10440 children.sort(ASTNode.LEXICAL_ORDER); |
| 9348 return children; | 10441 return children; |
| 9349 } | 10442 } |
| 9350 } | 10443 } |
| 9351 /** | 10444 /** |
| 9352 * Instances of the class `NullLiteral` represent a null literal expression. | 10445 * Instances of the class `NullLiteral` represent a null literal expression. |
| 10446 * |
| 9353 * <pre> | 10447 * <pre> |
| 9354 * nullLiteral ::= | 10448 * nullLiteral ::= |
| 9355 * 'null' | 10449 * 'null' |
| 9356 * </pre> | 10450 * </pre> |
| 10451 * |
| 9357 * @coverage dart.engine.ast | 10452 * @coverage dart.engine.ast |
| 9358 */ | 10453 */ |
| 9359 class NullLiteral extends Literal { | 10454 class NullLiteral extends Literal { |
| 9360 | 10455 |
| 9361 /** | 10456 /** |
| 9362 * The token representing the literal. | 10457 * The token representing the literal. |
| 9363 */ | 10458 */ |
| 9364 Token _literal; | 10459 Token _literal; |
| 9365 | 10460 |
| 9366 /** | 10461 /** |
| 9367 * Initialize a newly created null literal. | 10462 * Initialize a newly created null literal. |
| 10463 * |
| 9368 * @param token the token representing the literal | 10464 * @param token the token representing the literal |
| 9369 */ | 10465 */ |
| 9370 NullLiteral.full(Token token) { | 10466 NullLiteral.full(Token token) { |
| 9371 this._literal = token; | 10467 this._literal = token; |
| 9372 } | 10468 } |
| 9373 | 10469 |
| 9374 /** | 10470 /** |
| 9375 * Initialize a newly created null literal. | 10471 * Initialize a newly created null literal. |
| 10472 * |
| 9376 * @param token the token representing the literal | 10473 * @param token the token representing the literal |
| 9377 */ | 10474 */ |
| 9378 NullLiteral({Token token}) : this.full(token); | 10475 NullLiteral({Token token}) : this.full(token); |
| 9379 accept(ASTVisitor visitor) => visitor.visitNullLiteral(this); | 10476 accept(ASTVisitor visitor) => visitor.visitNullLiteral(this); |
| 9380 Token get beginToken => _literal; | 10477 Token get beginToken => _literal; |
| 9381 Token get endToken => _literal; | 10478 Token get endToken => _literal; |
| 9382 | 10479 |
| 9383 /** | 10480 /** |
| 9384 * Return the token representing the literal. | 10481 * Return the token representing the literal. |
| 10482 * |
| 9385 * @return the token representing the literal | 10483 * @return the token representing the literal |
| 9386 */ | 10484 */ |
| 9387 Token get literal => _literal; | 10485 Token get literal => _literal; |
| 9388 | 10486 |
| 9389 /** | 10487 /** |
| 9390 * Set the token representing the literal to the given token. | 10488 * Set the token representing the literal to the given token. |
| 10489 * |
| 9391 * @param literal the token representing the literal | 10490 * @param literal the token representing the literal |
| 9392 */ | 10491 */ |
| 9393 void set literal(Token literal2) { | 10492 void set literal(Token literal2) { |
| 9394 this._literal = literal2; | 10493 this._literal = literal2; |
| 9395 } | 10494 } |
| 9396 void visitChildren(ASTVisitor<Object> visitor) { | 10495 void visitChildren(ASTVisitor<Object> visitor) { |
| 9397 } | 10496 } |
| 9398 } | 10497 } |
| 9399 /** | 10498 /** |
| 9400 * Instances of the class `ParenthesizedExpression` represent a parenthesized ex
pression. | 10499 * Instances of the class `ParenthesizedExpression` represent a parenthesized ex
pression. |
| 10500 * |
| 9401 * <pre> | 10501 * <pre> |
| 9402 * parenthesizedExpression ::= | 10502 * parenthesizedExpression ::= |
| 9403 * '(' [Expression expression] ')' | 10503 * '(' [Expression] ')' |
| 9404 * </pre> | 10504 * </pre> |
| 10505 * |
| 9405 * @coverage dart.engine.ast | 10506 * @coverage dart.engine.ast |
| 9406 */ | 10507 */ |
| 9407 class ParenthesizedExpression extends Expression { | 10508 class ParenthesizedExpression extends Expression { |
| 9408 | 10509 |
| 9409 /** | 10510 /** |
| 9410 * The left parenthesis. | 10511 * The left parenthesis. |
| 9411 */ | 10512 */ |
| 9412 Token _leftParenthesis; | 10513 Token _leftParenthesis; |
| 9413 | 10514 |
| 9414 /** | 10515 /** |
| 9415 * The expression within the parentheses. | 10516 * The expression within the parentheses. |
| 9416 */ | 10517 */ |
| 9417 Expression _expression; | 10518 Expression _expression; |
| 9418 | 10519 |
| 9419 /** | 10520 /** |
| 9420 * The right parenthesis. | 10521 * The right parenthesis. |
| 9421 */ | 10522 */ |
| 9422 Token _rightParenthesis; | 10523 Token _rightParenthesis; |
| 9423 | 10524 |
| 9424 /** | 10525 /** |
| 9425 * Initialize a newly created parenthesized expression. | 10526 * Initialize a newly created parenthesized expression. |
| 10527 * |
| 9426 * @param leftParenthesis the left parenthesis | 10528 * @param leftParenthesis the left parenthesis |
| 9427 * @param expression the expression within the parentheses | 10529 * @param expression the expression within the parentheses |
| 9428 * @param rightParenthesis the right parenthesis | 10530 * @param rightParenthesis the right parenthesis |
| 9429 */ | 10531 */ |
| 9430 ParenthesizedExpression.full(Token leftParenthesis, Expression expression, Tok
en rightParenthesis) { | 10532 ParenthesizedExpression.full(Token leftParenthesis, Expression expression, Tok
en rightParenthesis) { |
| 9431 this._leftParenthesis = leftParenthesis; | 10533 this._leftParenthesis = leftParenthesis; |
| 9432 this._expression = becomeParentOf(expression); | 10534 this._expression = becomeParentOf(expression); |
| 9433 this._rightParenthesis = rightParenthesis; | 10535 this._rightParenthesis = rightParenthesis; |
| 9434 } | 10536 } |
| 9435 | 10537 |
| 9436 /** | 10538 /** |
| 9437 * Initialize a newly created parenthesized expression. | 10539 * Initialize a newly created parenthesized expression. |
| 10540 * |
| 9438 * @param leftParenthesis the left parenthesis | 10541 * @param leftParenthesis the left parenthesis |
| 9439 * @param expression the expression within the parentheses | 10542 * @param expression the expression within the parentheses |
| 9440 * @param rightParenthesis the right parenthesis | 10543 * @param rightParenthesis the right parenthesis |
| 9441 */ | 10544 */ |
| 9442 ParenthesizedExpression({Token leftParenthesis, Expression expression, Token r
ightParenthesis}) : this.full(leftParenthesis, expression, rightParenthesis); | 10545 ParenthesizedExpression({Token leftParenthesis, Expression expression, Token r
ightParenthesis}) : this.full(leftParenthesis, expression, rightParenthesis); |
| 9443 accept(ASTVisitor visitor) => visitor.visitParenthesizedExpression(this); | 10546 accept(ASTVisitor visitor) => visitor.visitParenthesizedExpression(this); |
| 9444 Token get beginToken => _leftParenthesis; | 10547 Token get beginToken => _leftParenthesis; |
| 9445 Token get endToken => _rightParenthesis; | 10548 Token get endToken => _rightParenthesis; |
| 9446 | 10549 |
| 9447 /** | 10550 /** |
| 9448 * Return the expression within the parentheses. | 10551 * Return the expression within the parentheses. |
| 10552 * |
| 9449 * @return the expression within the parentheses | 10553 * @return the expression within the parentheses |
| 9450 */ | 10554 */ |
| 9451 Expression get expression => _expression; | 10555 Expression get expression => _expression; |
| 9452 | 10556 |
| 9453 /** | 10557 /** |
| 9454 * Return the left parenthesis. | 10558 * Return the left parenthesis. |
| 10559 * |
| 9455 * @return the left parenthesis | 10560 * @return the left parenthesis |
| 9456 */ | 10561 */ |
| 9457 Token get leftParenthesis => _leftParenthesis; | 10562 Token get leftParenthesis => _leftParenthesis; |
| 9458 | 10563 |
| 9459 /** | 10564 /** |
| 9460 * Return the right parenthesis. | 10565 * Return the right parenthesis. |
| 10566 * |
| 9461 * @return the right parenthesis | 10567 * @return the right parenthesis |
| 9462 */ | 10568 */ |
| 9463 Token get rightParenthesis => _rightParenthesis; | 10569 Token get rightParenthesis => _rightParenthesis; |
| 9464 | 10570 |
| 9465 /** | 10571 /** |
| 9466 * Set the expression within the parentheses to the given expression. | 10572 * Set the expression within the parentheses to the given expression. |
| 10573 * |
| 9467 * @param expression the expression within the parentheses | 10574 * @param expression the expression within the parentheses |
| 9468 */ | 10575 */ |
| 9469 void set expression(Expression expression2) { | 10576 void set expression(Expression expression2) { |
| 9470 this._expression = becomeParentOf(expression2); | 10577 this._expression = becomeParentOf(expression2); |
| 9471 } | 10578 } |
| 9472 | 10579 |
| 9473 /** | 10580 /** |
| 9474 * Set the left parenthesis to the given token. | 10581 * Set the left parenthesis to the given token. |
| 10582 * |
| 9475 * @param parenthesis the left parenthesis | 10583 * @param parenthesis the left parenthesis |
| 9476 */ | 10584 */ |
| 9477 void set leftParenthesis(Token parenthesis) { | 10585 void set leftParenthesis(Token parenthesis) { |
| 9478 _leftParenthesis = parenthesis; | 10586 _leftParenthesis = parenthesis; |
| 9479 } | 10587 } |
| 9480 | 10588 |
| 9481 /** | 10589 /** |
| 9482 * Set the right parenthesis to the given token. | 10590 * Set the right parenthesis to the given token. |
| 10591 * |
| 9483 * @param parenthesis the right parenthesis | 10592 * @param parenthesis the right parenthesis |
| 9484 */ | 10593 */ |
| 9485 void set rightParenthesis(Token parenthesis) { | 10594 void set rightParenthesis(Token parenthesis) { |
| 9486 _rightParenthesis = parenthesis; | 10595 _rightParenthesis = parenthesis; |
| 9487 } | 10596 } |
| 9488 void visitChildren(ASTVisitor<Object> visitor) { | 10597 void visitChildren(ASTVisitor<Object> visitor) { |
| 9489 safelyVisitChild(_expression, visitor); | 10598 safelyVisitChild(_expression, visitor); |
| 9490 } | 10599 } |
| 9491 } | 10600 } |
| 9492 /** | 10601 /** |
| 9493 * Instances of the class `PartDirective` represent a part directive. | 10602 * Instances of the class `PartDirective` represent a part directive. |
| 10603 * |
| 9494 * <pre> | 10604 * <pre> |
| 9495 * partDirective ::=[Annotation metadata] 'part' [StringLiteral partUri] ';' | 10605 * partDirective ::= |
| 10606 * [Annotation] 'part' [StringLiteral] ';' |
| 9496 * </pre> | 10607 * </pre> |
| 10608 * |
| 9497 * @coverage dart.engine.ast | 10609 * @coverage dart.engine.ast |
| 9498 */ | 10610 */ |
| 9499 class PartDirective extends UriBasedDirective { | 10611 class PartDirective extends UriBasedDirective { |
| 9500 | 10612 |
| 9501 /** | 10613 /** |
| 9502 * The token representing the 'part' token. | 10614 * The token representing the 'part' token. |
| 9503 */ | 10615 */ |
| 9504 Token _partToken; | 10616 Token _partToken; |
| 9505 | 10617 |
| 9506 /** | 10618 /** |
| 9507 * The semicolon terminating the directive. | 10619 * The semicolon terminating the directive. |
| 9508 */ | 10620 */ |
| 9509 Token _semicolon; | 10621 Token _semicolon; |
| 9510 | 10622 |
| 9511 /** | 10623 /** |
| 9512 * Initialize a newly created part directive. | 10624 * Initialize a newly created part directive. |
| 10625 * |
| 9513 * @param comment the documentation comment associated with this directive | 10626 * @param comment the documentation comment associated with this directive |
| 9514 * @param metadata the annotations associated with the directive | 10627 * @param metadata the annotations associated with the directive |
| 9515 * @param partToken the token representing the 'part' token | 10628 * @param partToken the token representing the 'part' token |
| 9516 * @param partUri the URI of the part being included | 10629 * @param partUri the URI of the part being included |
| 9517 * @param semicolon the semicolon terminating the directive | 10630 * @param semicolon the semicolon terminating the directive |
| 9518 */ | 10631 */ |
| 9519 PartDirective.full(Comment comment, List<Annotation> metadata, Token partToken
, StringLiteral partUri, Token semicolon) : super.full(comment, metadata, partUr
i) { | 10632 PartDirective.full(Comment comment, List<Annotation> metadata, Token partToken
, StringLiteral partUri, Token semicolon) : super.full(comment, metadata, partUr
i) { |
| 9520 this._partToken = partToken; | 10633 this._partToken = partToken; |
| 9521 this._semicolon = semicolon; | 10634 this._semicolon = semicolon; |
| 9522 } | 10635 } |
| 9523 | 10636 |
| 9524 /** | 10637 /** |
| 9525 * Initialize a newly created part directive. | 10638 * Initialize a newly created part directive. |
| 10639 * |
| 9526 * @param comment the documentation comment associated with this directive | 10640 * @param comment the documentation comment associated with this directive |
| 9527 * @param metadata the annotations associated with the directive | 10641 * @param metadata the annotations associated with the directive |
| 9528 * @param partToken the token representing the 'part' token | 10642 * @param partToken the token representing the 'part' token |
| 9529 * @param partUri the URI of the part being included | 10643 * @param partUri the URI of the part being included |
| 9530 * @param semicolon the semicolon terminating the directive | 10644 * @param semicolon the semicolon terminating the directive |
| 9531 */ | 10645 */ |
| 9532 PartDirective({Comment comment, List<Annotation> metadata, Token partToken, St
ringLiteral partUri, Token semicolon}) : this.full(comment, metadata, partToken,
partUri, semicolon); | 10646 PartDirective({Comment comment, List<Annotation> metadata, Token partToken, St
ringLiteral partUri, Token semicolon}) : this.full(comment, metadata, partToken,
partUri, semicolon); |
| 9533 accept(ASTVisitor visitor) => visitor.visitPartDirective(this); | 10647 accept(ASTVisitor visitor) => visitor.visitPartDirective(this); |
| 9534 Token get endToken => _semicolon; | 10648 Token get endToken => _semicolon; |
| 9535 Token get keyword => _partToken; | 10649 Token get keyword => _partToken; |
| 9536 | 10650 |
| 9537 /** | 10651 /** |
| 9538 * Return the token representing the 'part' token. | 10652 * Return the token representing the 'part' token. |
| 10653 * |
| 9539 * @return the token representing the 'part' token | 10654 * @return the token representing the 'part' token |
| 9540 */ | 10655 */ |
| 9541 Token get partToken => _partToken; | 10656 Token get partToken => _partToken; |
| 9542 | 10657 |
| 9543 /** | 10658 /** |
| 9544 * Return the semicolon terminating the directive. | 10659 * Return the semicolon terminating the directive. |
| 10660 * |
| 9545 * @return the semicolon terminating the directive | 10661 * @return the semicolon terminating the directive |
| 9546 */ | 10662 */ |
| 9547 Token get semicolon => _semicolon; | 10663 Token get semicolon => _semicolon; |
| 9548 CompilationUnitElement get uriElement => element as CompilationUnitElement; | 10664 CompilationUnitElement get uriElement => element as CompilationUnitElement; |
| 9549 | 10665 |
| 9550 /** | 10666 /** |
| 9551 * Set the token representing the 'part' token to the given token. | 10667 * Set the token representing the 'part' token to the given token. |
| 10668 * |
| 9552 * @param partToken the token representing the 'part' token | 10669 * @param partToken the token representing the 'part' token |
| 9553 */ | 10670 */ |
| 9554 void set partToken(Token partToken2) { | 10671 void set partToken(Token partToken2) { |
| 9555 this._partToken = partToken2; | 10672 this._partToken = partToken2; |
| 9556 } | 10673 } |
| 9557 | 10674 |
| 9558 /** | 10675 /** |
| 9559 * Set the semicolon terminating the directive to the given token. | 10676 * Set the semicolon terminating the directive to the given token. |
| 10677 * |
| 9560 * @param semicolon the semicolon terminating the directive | 10678 * @param semicolon the semicolon terminating the directive |
| 9561 */ | 10679 */ |
| 9562 void set semicolon(Token semicolon2) { | 10680 void set semicolon(Token semicolon2) { |
| 9563 this._semicolon = semicolon2; | 10681 this._semicolon = semicolon2; |
| 9564 } | 10682 } |
| 9565 Token get firstTokenAfterCommentAndMetadata => _partToken; | 10683 Token get firstTokenAfterCommentAndMetadata => _partToken; |
| 9566 } | 10684 } |
| 9567 /** | 10685 /** |
| 9568 * Instances of the class `PartOfDirective` represent a part-of directive. | 10686 * Instances of the class `PartOfDirective` represent a part-of directive. |
| 10687 * |
| 9569 * <pre> | 10688 * <pre> |
| 9570 * partOfDirective ::=[Annotation metadata] 'part' 'of' [Identifier libraryName]
';' | 10689 * partOfDirective ::= |
| 10690 * [Annotation] 'part' 'of' [Identifier] ';' |
| 9571 * </pre> | 10691 * </pre> |
| 10692 * |
| 9572 * @coverage dart.engine.ast | 10693 * @coverage dart.engine.ast |
| 9573 */ | 10694 */ |
| 9574 class PartOfDirective extends Directive { | 10695 class PartOfDirective extends Directive { |
| 9575 | 10696 |
| 9576 /** | 10697 /** |
| 9577 * The token representing the 'part' token. | 10698 * The token representing the 'part' token. |
| 9578 */ | 10699 */ |
| 9579 Token _partToken; | 10700 Token _partToken; |
| 9580 | 10701 |
| 9581 /** | 10702 /** |
| 9582 * The token representing the 'of' token. | 10703 * The token representing the 'of' token. |
| 9583 */ | 10704 */ |
| 9584 Token _ofToken; | 10705 Token _ofToken; |
| 9585 | 10706 |
| 9586 /** | 10707 /** |
| 9587 * The name of the library that the containing compilation unit is part of. | 10708 * The name of the library that the containing compilation unit is part of. |
| 9588 */ | 10709 */ |
| 9589 LibraryIdentifier _libraryName; | 10710 LibraryIdentifier _libraryName; |
| 9590 | 10711 |
| 9591 /** | 10712 /** |
| 9592 * The semicolon terminating the directive. | 10713 * The semicolon terminating the directive. |
| 9593 */ | 10714 */ |
| 9594 Token _semicolon; | 10715 Token _semicolon; |
| 9595 | 10716 |
| 9596 /** | 10717 /** |
| 9597 * Initialize a newly created part-of directive. | 10718 * Initialize a newly created part-of directive. |
| 10719 * |
| 9598 * @param comment the documentation comment associated with this directive | 10720 * @param comment the documentation comment associated with this directive |
| 9599 * @param metadata the annotations associated with the directive | 10721 * @param metadata the annotations associated with the directive |
| 9600 * @param partToken the token representing the 'part' token | 10722 * @param partToken the token representing the 'part' token |
| 9601 * @param ofToken the token representing the 'of' token | 10723 * @param ofToken the token representing the 'of' token |
| 9602 * @param libraryName the name of the library that the containing compilation
unit is part of | 10724 * @param libraryName the name of the library that the containing compilation
unit is part of |
| 9603 * @param semicolon the semicolon terminating the directive | 10725 * @param semicolon the semicolon terminating the directive |
| 9604 */ | 10726 */ |
| 9605 PartOfDirective.full(Comment comment, List<Annotation> metadata, Token partTok
en, Token ofToken, LibraryIdentifier libraryName, Token semicolon) : super.full(
comment, metadata) { | 10727 PartOfDirective.full(Comment comment, List<Annotation> metadata, Token partTok
en, Token ofToken, LibraryIdentifier libraryName, Token semicolon) : super.full(
comment, metadata) { |
| 9606 this._partToken = partToken; | 10728 this._partToken = partToken; |
| 9607 this._ofToken = ofToken; | 10729 this._ofToken = ofToken; |
| 9608 this._libraryName = becomeParentOf(libraryName); | 10730 this._libraryName = becomeParentOf(libraryName); |
| 9609 this._semicolon = semicolon; | 10731 this._semicolon = semicolon; |
| 9610 } | 10732 } |
| 9611 | 10733 |
| 9612 /** | 10734 /** |
| 9613 * Initialize a newly created part-of directive. | 10735 * Initialize a newly created part-of directive. |
| 10736 * |
| 9614 * @param comment the documentation comment associated with this directive | 10737 * @param comment the documentation comment associated with this directive |
| 9615 * @param metadata the annotations associated with the directive | 10738 * @param metadata the annotations associated with the directive |
| 9616 * @param partToken the token representing the 'part' token | 10739 * @param partToken the token representing the 'part' token |
| 9617 * @param ofToken the token representing the 'of' token | 10740 * @param ofToken the token representing the 'of' token |
| 9618 * @param libraryName the name of the library that the containing compilation
unit is part of | 10741 * @param libraryName the name of the library that the containing compilation
unit is part of |
| 9619 * @param semicolon the semicolon terminating the directive | 10742 * @param semicolon the semicolon terminating the directive |
| 9620 */ | 10743 */ |
| 9621 PartOfDirective({Comment comment, List<Annotation> metadata, Token partToken,
Token ofToken, LibraryIdentifier libraryName, Token semicolon}) : this.full(comm
ent, metadata, partToken, ofToken, libraryName, semicolon); | 10744 PartOfDirective({Comment comment, List<Annotation> metadata, Token partToken,
Token ofToken, LibraryIdentifier libraryName, Token semicolon}) : this.full(comm
ent, metadata, partToken, ofToken, libraryName, semicolon); |
| 9622 accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this); | 10745 accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this); |
| 9623 Token get endToken => _semicolon; | 10746 Token get endToken => _semicolon; |
| 9624 Token get keyword => _partToken; | 10747 Token get keyword => _partToken; |
| 9625 | 10748 |
| 9626 /** | 10749 /** |
| 9627 * Return the name of the library that the containing compilation unit is part
of. | 10750 * Return the name of the library that the containing compilation unit is part
of. |
| 10751 * |
| 9628 * @return the name of the library that the containing compilation unit is par
t of | 10752 * @return the name of the library that the containing compilation unit is par
t of |
| 9629 */ | 10753 */ |
| 9630 LibraryIdentifier get libraryName => _libraryName; | 10754 LibraryIdentifier get libraryName => _libraryName; |
| 9631 | 10755 |
| 9632 /** | 10756 /** |
| 9633 * Return the token representing the 'of' token. | 10757 * Return the token representing the 'of' token. |
| 10758 * |
| 9634 * @return the token representing the 'of' token | 10759 * @return the token representing the 'of' token |
| 9635 */ | 10760 */ |
| 9636 Token get ofToken => _ofToken; | 10761 Token get ofToken => _ofToken; |
| 9637 | 10762 |
| 9638 /** | 10763 /** |
| 9639 * Return the token representing the 'part' token. | 10764 * Return the token representing the 'part' token. |
| 10765 * |
| 9640 * @return the token representing the 'part' token | 10766 * @return the token representing the 'part' token |
| 9641 */ | 10767 */ |
| 9642 Token get partToken => _partToken; | 10768 Token get partToken => _partToken; |
| 9643 | 10769 |
| 9644 /** | 10770 /** |
| 9645 * Return the semicolon terminating the directive. | 10771 * Return the semicolon terminating the directive. |
| 10772 * |
| 9646 * @return the semicolon terminating the directive | 10773 * @return the semicolon terminating the directive |
| 9647 */ | 10774 */ |
| 9648 Token get semicolon => _semicolon; | 10775 Token get semicolon => _semicolon; |
| 9649 | 10776 |
| 9650 /** | 10777 /** |
| 9651 * Set the name of the library that the containing compilation unit is part of
to the given name. | 10778 * Set the name of the library that the containing compilation unit is part of
to the given name. |
| 10779 * |
| 9652 * @param libraryName the name of the library that the containing compilation
unit is part of | 10780 * @param libraryName the name of the library that the containing compilation
unit is part of |
| 9653 */ | 10781 */ |
| 9654 void set libraryName(LibraryIdentifier libraryName2) { | 10782 void set libraryName(LibraryIdentifier libraryName2) { |
| 9655 this._libraryName = becomeParentOf(libraryName2); | 10783 this._libraryName = becomeParentOf(libraryName2); |
| 9656 } | 10784 } |
| 9657 | 10785 |
| 9658 /** | 10786 /** |
| 9659 * Set the token representing the 'of' token to the given token. | 10787 * Set the token representing the 'of' token to the given token. |
| 10788 * |
| 9660 * @param ofToken the token representing the 'of' token | 10789 * @param ofToken the token representing the 'of' token |
| 9661 */ | 10790 */ |
| 9662 void set ofToken(Token ofToken2) { | 10791 void set ofToken(Token ofToken2) { |
| 9663 this._ofToken = ofToken2; | 10792 this._ofToken = ofToken2; |
| 9664 } | 10793 } |
| 9665 | 10794 |
| 9666 /** | 10795 /** |
| 9667 * Set the token representing the 'part' token to the given token. | 10796 * Set the token representing the 'part' token to the given token. |
| 10797 * |
| 9668 * @param partToken the token representing the 'part' token | 10798 * @param partToken the token representing the 'part' token |
| 9669 */ | 10799 */ |
| 9670 void set partToken(Token partToken2) { | 10800 void set partToken(Token partToken2) { |
| 9671 this._partToken = partToken2; | 10801 this._partToken = partToken2; |
| 9672 } | 10802 } |
| 9673 | 10803 |
| 9674 /** | 10804 /** |
| 9675 * Set the semicolon terminating the directive to the given token. | 10805 * Set the semicolon terminating the directive to the given token. |
| 10806 * |
| 9676 * @param semicolon the semicolon terminating the directive | 10807 * @param semicolon the semicolon terminating the directive |
| 9677 */ | 10808 */ |
| 9678 void set semicolon(Token semicolon2) { | 10809 void set semicolon(Token semicolon2) { |
| 9679 this._semicolon = semicolon2; | 10810 this._semicolon = semicolon2; |
| 9680 } | 10811 } |
| 9681 void visitChildren(ASTVisitor<Object> visitor) { | 10812 void visitChildren(ASTVisitor<Object> visitor) { |
| 9682 super.visitChildren(visitor); | 10813 super.visitChildren(visitor); |
| 9683 safelyVisitChild(_libraryName, visitor); | 10814 safelyVisitChild(_libraryName, visitor); |
| 9684 } | 10815 } |
| 9685 Token get firstTokenAfterCommentAndMetadata => _partToken; | 10816 Token get firstTokenAfterCommentAndMetadata => _partToken; |
| 9686 } | 10817 } |
| 9687 /** | 10818 /** |
| 9688 * Instances of the class `PostfixExpression` represent a postfix unary expressi
on. | 10819 * Instances of the class `PostfixExpression` represent a postfix unary expressi
on. |
| 10820 * |
| 9689 * <pre> | 10821 * <pre> |
| 9690 * postfixExpression ::=[Expression operand] [Token operator]</pre> | 10822 * postfixExpression ::= |
| 10823 * [Expression] [Token] |
| 10824 * </pre> |
| 10825 * |
| 9691 * @coverage dart.engine.ast | 10826 * @coverage dart.engine.ast |
| 9692 */ | 10827 */ |
| 9693 class PostfixExpression extends Expression { | 10828 class PostfixExpression extends Expression { |
| 9694 | 10829 |
| 9695 /** | 10830 /** |
| 9696 * The expression computing the operand for the operator. | 10831 * The expression computing the operand for the operator. |
| 9697 */ | 10832 */ |
| 9698 Expression _operand; | 10833 Expression _operand; |
| 9699 | 10834 |
| 9700 /** | 10835 /** |
| 9701 * The postfix operator being applied to the operand. | 10836 * The postfix operator being applied to the operand. |
| 9702 */ | 10837 */ |
| 9703 Token _operator; | 10838 Token _operator; |
| 9704 | 10839 |
| 9705 /** | 10840 /** |
| 9706 * The element associated with this the operator based on the propagated type
of the operand, or`null` if the AST structure has not been resolved, if the oper
ator is not user definable, | 10841 * The element associated with this the operator based on the propagated type
of the operand, or |
| 10842 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9707 * or if the operator could not be resolved. | 10843 * or if the operator could not be resolved. |
| 9708 */ | 10844 */ |
| 9709 MethodElement _propagatedElement; | 10845 MethodElement _propagatedElement; |
| 9710 | 10846 |
| 9711 /** | 10847 /** |
| 9712 * The element associated with the operator based on the static type of the op
erand, or`null` if the AST structure has not been resolved, if the operator is n
ot user definable, | 10848 * The element associated with the operator based on the static type of the op
erand, or |
| 10849 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9713 * or if the operator could not be resolved. | 10850 * or if the operator could not be resolved. |
| 9714 */ | 10851 */ |
| 9715 MethodElement _staticElement; | 10852 MethodElement _staticElement; |
| 9716 | 10853 |
| 9717 /** | 10854 /** |
| 9718 * Initialize a newly created postfix expression. | 10855 * Initialize a newly created postfix expression. |
| 10856 * |
| 9719 * @param operand the expression computing the operand for the operator | 10857 * @param operand the expression computing the operand for the operator |
| 9720 * @param operator the postfix operator being applied to the operand | 10858 * @param operator the postfix operator being applied to the operand |
| 9721 */ | 10859 */ |
| 9722 PostfixExpression.full(Expression operand, Token operator) { | 10860 PostfixExpression.full(Expression operand, Token operator) { |
| 9723 this._operand = becomeParentOf(operand); | 10861 this._operand = becomeParentOf(operand); |
| 9724 this._operator = operator; | 10862 this._operator = operator; |
| 9725 } | 10863 } |
| 9726 | 10864 |
| 9727 /** | 10865 /** |
| 9728 * Initialize a newly created postfix expression. | 10866 * Initialize a newly created postfix expression. |
| 10867 * |
| 9729 * @param operand the expression computing the operand for the operator | 10868 * @param operand the expression computing the operand for the operator |
| 9730 * @param operator the postfix operator being applied to the operand | 10869 * @param operator the postfix operator being applied to the operand |
| 9731 */ | 10870 */ |
| 9732 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o
perator); | 10871 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o
perator); |
| 9733 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); | 10872 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); |
| 9734 Token get beginToken => _operand.beginToken; | 10873 Token get beginToken => _operand.beginToken; |
| 9735 | 10874 |
| 9736 /** | 10875 /** |
| 9737 * Return the element associated with the operator based on the propagated typ
e of the operand, or`null` if the AST structure has not been resolved, if the op
erator is not user definable, | 10876 * Return the element associated with the operator based on the propagated typ
e of the operand, or |
| 10877 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9738 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 10878 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9739 * not defined for the type of the operand. | 10879 * not defined for the type of the operand. |
| 10880 * |
| 9740 * @return the element associated with the operator | 10881 * @return the element associated with the operator |
| 9741 */ | 10882 */ |
| 9742 MethodElement get element => _propagatedElement; | 10883 MethodElement get element => _propagatedElement; |
| 9743 Token get endToken => _operator; | 10884 Token get endToken => _operator; |
| 9744 | 10885 |
| 9745 /** | 10886 /** |
| 9746 * Return the expression computing the operand for the operator. | 10887 * Return the expression computing the operand for the operator. |
| 10888 * |
| 9747 * @return the expression computing the operand for the operator | 10889 * @return the expression computing the operand for the operator |
| 9748 */ | 10890 */ |
| 9749 Expression get operand => _operand; | 10891 Expression get operand => _operand; |
| 9750 | 10892 |
| 9751 /** | 10893 /** |
| 9752 * Return the postfix operator being applied to the operand. | 10894 * Return the postfix operator being applied to the operand. |
| 10895 * |
| 9753 * @return the postfix operator being applied to the operand | 10896 * @return the postfix operator being applied to the operand |
| 9754 */ | 10897 */ |
| 9755 Token get operator => _operator; | 10898 Token get operator => _operator; |
| 9756 | 10899 |
| 9757 /** | 10900 /** |
| 9758 * Return the element associated with the operator based on the static type of
the operand, or`null` if the AST structure has not been resolved, if the operat
or is not user definable, | 10901 * Return the element associated with the operator based on the static type of
the operand, or |
| 10902 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9759 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 10903 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9760 * not defined for the type of the operand. | 10904 * not defined for the type of the operand. |
| 10905 * |
| 9761 * @return the element associated with the operator | 10906 * @return the element associated with the operator |
| 9762 */ | 10907 */ |
| 9763 MethodElement get staticElement => _staticElement; | 10908 MethodElement get staticElement => _staticElement; |
| 9764 | 10909 |
| 9765 /** | 10910 /** |
| 9766 * Set the element associated with the operator based on the propagated type o
f the operand to the | 10911 * Set the element associated with the operator based on the propagated type o
f the operand to the |
| 9767 * given element. | 10912 * given element. |
| 10913 * |
| 9768 * @param element the element to be associated with the operator | 10914 * @param element the element to be associated with the operator |
| 9769 */ | 10915 */ |
| 9770 void set element(MethodElement element2) { | 10916 void set element(MethodElement element2) { |
| 9771 _propagatedElement = element2; | 10917 _propagatedElement = element2; |
| 9772 } | 10918 } |
| 9773 | 10919 |
| 9774 /** | 10920 /** |
| 9775 * Set the expression computing the operand for the operator to the given expr
ession. | 10921 * Set the expression computing the operand for the operator to the given expr
ession. |
| 10922 * |
| 9776 * @param expression the expression computing the operand for the operator | 10923 * @param expression the expression computing the operand for the operator |
| 9777 */ | 10924 */ |
| 9778 void set operand(Expression expression) { | 10925 void set operand(Expression expression) { |
| 9779 _operand = becomeParentOf(expression); | 10926 _operand = becomeParentOf(expression); |
| 9780 } | 10927 } |
| 9781 | 10928 |
| 9782 /** | 10929 /** |
| 9783 * Set the postfix operator being applied to the operand to the given operator
. | 10930 * Set the postfix operator being applied to the operand to the given operator
. |
| 10931 * |
| 9784 * @param operator the postfix operator being applied to the operand | 10932 * @param operator the postfix operator being applied to the operand |
| 9785 */ | 10933 */ |
| 9786 void set operator(Token operator2) { | 10934 void set operator(Token operator2) { |
| 9787 this._operator = operator2; | 10935 this._operator = operator2; |
| 9788 } | 10936 } |
| 9789 | 10937 |
| 9790 /** | 10938 /** |
| 9791 * Set the element associated with the operator based on the static type of th
e operand to the | 10939 * Set the element associated with the operator based on the static type of th
e operand to the |
| 9792 * given element. | 10940 * given element. |
| 10941 * |
| 9793 * @param element the element to be associated with the operator | 10942 * @param element the element to be associated with the operator |
| 9794 */ | 10943 */ |
| 9795 void set staticElement(MethodElement element) { | 10944 void set staticElement(MethodElement element) { |
| 9796 _staticElement = element; | 10945 _staticElement = element; |
| 9797 } | 10946 } |
| 9798 void visitChildren(ASTVisitor<Object> visitor) { | 10947 void visitChildren(ASTVisitor<Object> visitor) { |
| 9799 safelyVisitChild(_operand, visitor); | 10948 safelyVisitChild(_operand, visitor); |
| 9800 } | 10949 } |
| 9801 | 10950 |
| 9802 /** | 10951 /** |
| 9803 * If the AST structure has been resolved, and the function being invoked is k
nown based on | 10952 * If the AST structure has been resolved, and the function being invoked is k
nown based on |
| 9804 * propagated type information, then return the parameter element representing
the parameter to | 10953 * propagated type information, then return the parameter element representing
the parameter to |
| 9805 * which the value of the operand will be bound. Otherwise, return `null`. | 10954 * which the value of the operand will be bound. Otherwise, return `null`. |
| 9806 * | 10955 * |
| 9807 * This method is only intended to be used by [Expression#getParameterElement]
. | 10956 * This method is only intended to be used by [Expression#getParameterElement]
. |
| 10957 * |
| 9808 * @return the parameter element representing the parameter to which the value
of the right | 10958 * @return the parameter element representing the parameter to which the value
of the right |
| 9809 * operand will be bound | 10959 * operand will be bound |
| 9810 */ | 10960 */ |
| 9811 ParameterElement get propagatedParameterElementForOperand { | 10961 ParameterElement get propagatedParameterElementForOperand { |
| 9812 if (_propagatedElement == null) { | 10962 if (_propagatedElement == null) { |
| 9813 return null; | 10963 return null; |
| 9814 } | 10964 } |
| 9815 List<ParameterElement> parameters = _propagatedElement.parameters; | 10965 List<ParameterElement> parameters = _propagatedElement.parameters; |
| 9816 if (parameters.length < 1) { | 10966 if (parameters.length < 1) { |
| 9817 return null; | 10967 return null; |
| 9818 } | 10968 } |
| 9819 return parameters[0]; | 10969 return parameters[0]; |
| 9820 } | 10970 } |
| 9821 | 10971 |
| 9822 /** | 10972 /** |
| 9823 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 10973 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
| 9824 * type information, then return the parameter element representing the parame
ter to which the | 10974 * type information, then return the parameter element representing the parame
ter to which the |
| 9825 * value of the operand will be bound. Otherwise, return `null`. | 10975 * value of the operand will be bound. Otherwise, return `null`. |
| 9826 * | 10976 * |
| 9827 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. | 10977 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. |
| 10978 * |
| 9828 * @return the parameter element representing the parameter to which the value
of the right | 10979 * @return the parameter element representing the parameter to which the value
of the right |
| 9829 * operand will be bound | 10980 * operand will be bound |
| 9830 */ | 10981 */ |
| 9831 ParameterElement get staticParameterElementForOperand { | 10982 ParameterElement get staticParameterElementForOperand { |
| 9832 if (_staticElement == null) { | 10983 if (_staticElement == null) { |
| 9833 return null; | 10984 return null; |
| 9834 } | 10985 } |
| 9835 List<ParameterElement> parameters = _staticElement.parameters; | 10986 List<ParameterElement> parameters = _staticElement.parameters; |
| 9836 if (parameters.length < 1) { | 10987 if (parameters.length < 1) { |
| 9837 return null; | 10988 return null; |
| 9838 } | 10989 } |
| 9839 return parameters[0]; | 10990 return parameters[0]; |
| 9840 } | 10991 } |
| 9841 } | 10992 } |
| 9842 /** | 10993 /** |
| 9843 * Instances of the class `PrefixExpression` represent a prefix unary expression
. | 10994 * Instances of the class `PrefixExpression` represent a prefix unary expression
. |
| 10995 * |
| 9844 * <pre> | 10996 * <pre> |
| 9845 * prefixExpression ::=[Token operator] [Expression operand]</pre> | 10997 * prefixExpression ::= |
| 10998 * [Token] [Expression] |
| 10999 * </pre> |
| 11000 * |
| 9846 * @coverage dart.engine.ast | 11001 * @coverage dart.engine.ast |
| 9847 */ | 11002 */ |
| 9848 class PrefixExpression extends Expression { | 11003 class PrefixExpression extends Expression { |
| 9849 | 11004 |
| 9850 /** | 11005 /** |
| 9851 * The prefix operator being applied to the operand. | 11006 * The prefix operator being applied to the operand. |
| 9852 */ | 11007 */ |
| 9853 Token _operator; | 11008 Token _operator; |
| 9854 | 11009 |
| 9855 /** | 11010 /** |
| 9856 * The expression computing the operand for the operator. | 11011 * The expression computing the operand for the operator. |
| 9857 */ | 11012 */ |
| 9858 Expression _operand; | 11013 Expression _operand; |
| 9859 | 11014 |
| 9860 /** | 11015 /** |
| 9861 * The element associated with the operator based on the static type of the op
erand, or`null` if the AST structure has not been resolved, if the operator is n
ot user definable, | 11016 * The element associated with the operator based on the static type of the op
erand, or |
| 11017 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9862 * or if the operator could not be resolved. | 11018 * or if the operator could not be resolved. |
| 9863 */ | 11019 */ |
| 9864 MethodElement _staticElement; | 11020 MethodElement _staticElement; |
| 9865 | 11021 |
| 9866 /** | 11022 /** |
| 9867 * The element associated with the operator based on the propagated type of th
e operand, or`null` if the AST structure has not been resolved, if the operator
is not user definable, | 11023 * The element associated with the operator based on the propagated type of th
e operand, or |
| 11024 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9868 * or if the operator could not be resolved. | 11025 * or if the operator could not be resolved. |
| 9869 */ | 11026 */ |
| 9870 MethodElement _propagatedElement; | 11027 MethodElement _propagatedElement; |
| 9871 | 11028 |
| 9872 /** | 11029 /** |
| 9873 * Initialize a newly created prefix expression. | 11030 * Initialize a newly created prefix expression. |
| 11031 * |
| 9874 * @param operator the prefix operator being applied to the operand | 11032 * @param operator the prefix operator being applied to the operand |
| 9875 * @param operand the expression computing the operand for the operator | 11033 * @param operand the expression computing the operand for the operator |
| 9876 */ | 11034 */ |
| 9877 PrefixExpression.full(Token operator, Expression operand) { | 11035 PrefixExpression.full(Token operator, Expression operand) { |
| 9878 this._operator = operator; | 11036 this._operator = operator; |
| 9879 this._operand = becomeParentOf(operand); | 11037 this._operand = becomeParentOf(operand); |
| 9880 } | 11038 } |
| 9881 | 11039 |
| 9882 /** | 11040 /** |
| 9883 * Initialize a newly created prefix expression. | 11041 * Initialize a newly created prefix expression. |
| 11042 * |
| 9884 * @param operator the prefix operator being applied to the operand | 11043 * @param operator the prefix operator being applied to the operand |
| 9885 * @param operand the expression computing the operand for the operator | 11044 * @param operand the expression computing the operand for the operator |
| 9886 */ | 11045 */ |
| 9887 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o
perand); | 11046 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o
perand); |
| 9888 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); | 11047 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); |
| 9889 Token get beginToken => _operator; | 11048 Token get beginToken => _operator; |
| 9890 | 11049 |
| 9891 /** | 11050 /** |
| 9892 * Return the element associated with the operator based on the propagated typ
e of the operand, or`null` if the AST structure has not been resolved, if the op
erator is not user definable, | 11051 * Return the element associated with the operator based on the propagated typ
e of the operand, or |
| 11052 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9893 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 11053 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9894 * not defined for the type of the operand. | 11054 * not defined for the type of the operand. |
| 11055 * |
| 9895 * @return the element associated with the operator | 11056 * @return the element associated with the operator |
| 9896 */ | 11057 */ |
| 9897 MethodElement get element => _propagatedElement; | 11058 MethodElement get element => _propagatedElement; |
| 9898 Token get endToken => _operand.endToken; | 11059 Token get endToken => _operand.endToken; |
| 9899 | 11060 |
| 9900 /** | 11061 /** |
| 9901 * Return the expression computing the operand for the operator. | 11062 * Return the expression computing the operand for the operator. |
| 11063 * |
| 9902 * @return the expression computing the operand for the operator | 11064 * @return the expression computing the operand for the operator |
| 9903 */ | 11065 */ |
| 9904 Expression get operand => _operand; | 11066 Expression get operand => _operand; |
| 9905 | 11067 |
| 9906 /** | 11068 /** |
| 9907 * Return the prefix operator being applied to the operand. | 11069 * Return the prefix operator being applied to the operand. |
| 11070 * |
| 9908 * @return the prefix operator being applied to the operand | 11071 * @return the prefix operator being applied to the operand |
| 9909 */ | 11072 */ |
| 9910 Token get operator => _operator; | 11073 Token get operator => _operator; |
| 9911 | 11074 |
| 9912 /** | 11075 /** |
| 9913 * Return the element associated with the operator based on the static type of
the operand, or`null` if the AST structure has not been resolved, if the operat
or is not user definable, | 11076 * Return the element associated with the operator based on the static type of
the operand, or |
| 11077 * `null` if the AST structure has not been resolved, if the operator is not u
ser definable, |
| 9914 * or if the operator could not be resolved. One example of the latter case is
an operator that is | 11078 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9915 * not defined for the type of the operand. | 11079 * not defined for the type of the operand. |
| 11080 * |
| 9916 * @return the element associated with the operator | 11081 * @return the element associated with the operator |
| 9917 */ | 11082 */ |
| 9918 MethodElement get staticElement => _staticElement; | 11083 MethodElement get staticElement => _staticElement; |
| 9919 | 11084 |
| 9920 /** | 11085 /** |
| 9921 * Set the element associated with the operator based on the propagated type o
f the operand to the | 11086 * Set the element associated with the operator based on the propagated type o
f the operand to the |
| 9922 * given element. | 11087 * given element. |
| 11088 * |
| 9923 * @param element the element to be associated with the operator | 11089 * @param element the element to be associated with the operator |
| 9924 */ | 11090 */ |
| 9925 void set element(MethodElement element2) { | 11091 void set element(MethodElement element2) { |
| 9926 _propagatedElement = element2; | 11092 _propagatedElement = element2; |
| 9927 } | 11093 } |
| 9928 | 11094 |
| 9929 /** | 11095 /** |
| 9930 * Set the expression computing the operand for the operator to the given expr
ession. | 11096 * Set the expression computing the operand for the operator to the given expr
ession. |
| 11097 * |
| 9931 * @param expression the expression computing the operand for the operator | 11098 * @param expression the expression computing the operand for the operator |
| 9932 */ | 11099 */ |
| 9933 void set operand(Expression expression) { | 11100 void set operand(Expression expression) { |
| 9934 _operand = becomeParentOf(expression); | 11101 _operand = becomeParentOf(expression); |
| 9935 } | 11102 } |
| 9936 | 11103 |
| 9937 /** | 11104 /** |
| 9938 * Set the prefix operator being applied to the operand to the given operator. | 11105 * Set the prefix operator being applied to the operand to the given operator. |
| 11106 * |
| 9939 * @param operator the prefix operator being applied to the operand | 11107 * @param operator the prefix operator being applied to the operand |
| 9940 */ | 11108 */ |
| 9941 void set operator(Token operator2) { | 11109 void set operator(Token operator2) { |
| 9942 this._operator = operator2; | 11110 this._operator = operator2; |
| 9943 } | 11111 } |
| 9944 | 11112 |
| 9945 /** | 11113 /** |
| 9946 * Set the element associated with the operator based on the static type of th
e operand to the | 11114 * Set the element associated with the operator based on the static type of th
e operand to the |
| 9947 * given element. | 11115 * given element. |
| 11116 * |
| 9948 * @param element the static element to be associated with the operator | 11117 * @param element the static element to be associated with the operator |
| 9949 */ | 11118 */ |
| 9950 void set staticElement(MethodElement element) { | 11119 void set staticElement(MethodElement element) { |
| 9951 _staticElement = element; | 11120 _staticElement = element; |
| 9952 } | 11121 } |
| 9953 void visitChildren(ASTVisitor<Object> visitor) { | 11122 void visitChildren(ASTVisitor<Object> visitor) { |
| 9954 safelyVisitChild(_operand, visitor); | 11123 safelyVisitChild(_operand, visitor); |
| 9955 } | 11124 } |
| 9956 | 11125 |
| 9957 /** | 11126 /** |
| 9958 * If the AST structure has been resolved, and the function being invoked is k
nown based on | 11127 * If the AST structure has been resolved, and the function being invoked is k
nown based on |
| 9959 * propagated type information, then return the parameter element representing
the parameter to | 11128 * propagated type information, then return the parameter element representing
the parameter to |
| 9960 * which the value of the operand will be bound. Otherwise, return `null`. | 11129 * which the value of the operand will be bound. Otherwise, return `null`. |
| 9961 * | 11130 * |
| 9962 * This method is only intended to be used by [Expression#getParameterElement]
. | 11131 * This method is only intended to be used by [Expression#getParameterElement]
. |
| 11132 * |
| 9963 * @return the parameter element representing the parameter to which the value
of the right | 11133 * @return the parameter element representing the parameter to which the value
of the right |
| 9964 * operand will be bound | 11134 * operand will be bound |
| 9965 */ | 11135 */ |
| 9966 ParameterElement get propagatedParameterElementForOperand { | 11136 ParameterElement get propagatedParameterElementForOperand { |
| 9967 if (_propagatedElement == null) { | 11137 if (_propagatedElement == null) { |
| 9968 return null; | 11138 return null; |
| 9969 } | 11139 } |
| 9970 List<ParameterElement> parameters = _propagatedElement.parameters; | 11140 List<ParameterElement> parameters = _propagatedElement.parameters; |
| 9971 if (parameters.length < 1) { | 11141 if (parameters.length < 1) { |
| 9972 return null; | 11142 return null; |
| 9973 } | 11143 } |
| 9974 return parameters[0]; | 11144 return parameters[0]; |
| 9975 } | 11145 } |
| 9976 | 11146 |
| 9977 /** | 11147 /** |
| 9978 * If the AST structure has been resolved, and the function being invoked is k
nown based on static | 11148 * If the AST structure has been resolved, and the function being invoked is k
nown based on static |
| 9979 * type information, then return the parameter element representing the parame
ter to which the | 11149 * type information, then return the parameter element representing the parame
ter to which the |
| 9980 * value of the operand will be bound. Otherwise, return `null`. | 11150 * value of the operand will be bound. Otherwise, return `null`. |
| 9981 * | 11151 * |
| 9982 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. | 11152 * This method is only intended to be used by [Expression#getStaticParameterEl
ement]. |
| 11153 * |
| 9983 * @return the parameter element representing the parameter to which the value
of the right | 11154 * @return the parameter element representing the parameter to which the value
of the right |
| 9984 * operand will be bound | 11155 * operand will be bound |
| 9985 */ | 11156 */ |
| 9986 ParameterElement get staticParameterElementForOperand { | 11157 ParameterElement get staticParameterElementForOperand { |
| 9987 if (_staticElement == null) { | 11158 if (_staticElement == null) { |
| 9988 return null; | 11159 return null; |
| 9989 } | 11160 } |
| 9990 List<ParameterElement> parameters = _staticElement.parameters; | 11161 List<ParameterElement> parameters = _staticElement.parameters; |
| 9991 if (parameters.length < 1) { | 11162 if (parameters.length < 1) { |
| 9992 return null; | 11163 return null; |
| 9993 } | 11164 } |
| 9994 return parameters[0]; | 11165 return parameters[0]; |
| 9995 } | 11166 } |
| 9996 } | 11167 } |
| 9997 /** | 11168 /** |
| 9998 * Instances of the class `PrefixedIdentifier` represent either an identifier th
at is prefixed | 11169 * Instances of the class `PrefixedIdentifier` represent either an identifier th
at is prefixed |
| 9999 * or an access to an object property where the target of the property access is
a simple | 11170 * or an access to an object property where the target of the property access is
a simple |
| 10000 * identifier. | 11171 * identifier. |
| 11172 * |
| 10001 * <pre> | 11173 * <pre> |
| 10002 * prefixedIdentifier ::=[SimpleIdentifier prefix] '.' [SimpleIdentifier identif
ier]</pre> | 11174 * prefixedIdentifier ::= |
| 11175 * [SimpleIdentifier] '.' [SimpleIdentifier] |
| 11176 * </pre> |
| 11177 * |
| 10003 * @coverage dart.engine.ast | 11178 * @coverage dart.engine.ast |
| 10004 */ | 11179 */ |
| 10005 class PrefixedIdentifier extends Identifier { | 11180 class PrefixedIdentifier extends Identifier { |
| 10006 | 11181 |
| 10007 /** | 11182 /** |
| 10008 * The prefix associated with the library in which the identifier is defined. | 11183 * The prefix associated with the library in which the identifier is defined. |
| 10009 */ | 11184 */ |
| 10010 SimpleIdentifier _prefix; | 11185 SimpleIdentifier _prefix; |
| 10011 | 11186 |
| 10012 /** | 11187 /** |
| 10013 * The period used to separate the prefix from the identifier. | 11188 * The period used to separate the prefix from the identifier. |
| 10014 */ | 11189 */ |
| 10015 Token _period; | 11190 Token _period; |
| 10016 | 11191 |
| 10017 /** | 11192 /** |
| 10018 * The identifier being prefixed. | 11193 * The identifier being prefixed. |
| 10019 */ | 11194 */ |
| 10020 SimpleIdentifier _identifier; | 11195 SimpleIdentifier _identifier; |
| 10021 | 11196 |
| 10022 /** | 11197 /** |
| 10023 * Initialize a newly created prefixed identifier. | 11198 * Initialize a newly created prefixed identifier. |
| 11199 * |
| 10024 * @param prefix the identifier being prefixed | 11200 * @param prefix the identifier being prefixed |
| 10025 * @param period the period used to separate the prefix from the identifier | 11201 * @param period the period used to separate the prefix from the identifier |
| 10026 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 11202 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
| 10027 */ | 11203 */ |
| 10028 PrefixedIdentifier.full(SimpleIdentifier prefix, Token period, SimpleIdentifie
r identifier) { | 11204 PrefixedIdentifier.full(SimpleIdentifier prefix, Token period, SimpleIdentifie
r identifier) { |
| 10029 this._prefix = becomeParentOf(prefix); | 11205 this._prefix = becomeParentOf(prefix); |
| 10030 this._period = period; | 11206 this._period = period; |
| 10031 this._identifier = becomeParentOf(identifier); | 11207 this._identifier = becomeParentOf(identifier); |
| 10032 } | 11208 } |
| 10033 | 11209 |
| 10034 /** | 11210 /** |
| 10035 * Initialize a newly created prefixed identifier. | 11211 * Initialize a newly created prefixed identifier. |
| 11212 * |
| 10036 * @param prefix the identifier being prefixed | 11213 * @param prefix the identifier being prefixed |
| 10037 * @param period the period used to separate the prefix from the identifier | 11214 * @param period the period used to separate the prefix from the identifier |
| 10038 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 11215 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
| 10039 */ | 11216 */ |
| 10040 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id
entifier}) : this.full(prefix, period, identifier); | 11217 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id
entifier}) : this.full(prefix, period, identifier); |
| 10041 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); | 11218 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); |
| 10042 Token get beginToken => _prefix.beginToken; | 11219 Token get beginToken => _prefix.beginToken; |
| 10043 Element get element { | 11220 Element get element { |
| 10044 if (_identifier == null) { | 11221 if (_identifier == null) { |
| 10045 return null; | 11222 return null; |
| 10046 } | 11223 } |
| 10047 return _identifier.element; | 11224 return _identifier.element; |
| 10048 } | 11225 } |
| 10049 Token get endToken => _identifier.endToken; | 11226 Token get endToken => _identifier.endToken; |
| 10050 | 11227 |
| 10051 /** | 11228 /** |
| 10052 * Return the identifier being prefixed. | 11229 * Return the identifier being prefixed. |
| 11230 * |
| 10053 * @return the identifier being prefixed | 11231 * @return the identifier being prefixed |
| 10054 */ | 11232 */ |
| 10055 SimpleIdentifier get identifier => _identifier; | 11233 SimpleIdentifier get identifier => _identifier; |
| 10056 String get name => "${_prefix.name}.${_identifier.name}"; | 11234 String get name => "${_prefix.name}.${_identifier.name}"; |
| 10057 | 11235 |
| 10058 /** | 11236 /** |
| 10059 * Return the period used to separate the prefix from the identifier. | 11237 * Return the period used to separate the prefix from the identifier. |
| 11238 * |
| 10060 * @return the period used to separate the prefix from the identifier | 11239 * @return the period used to separate the prefix from the identifier |
| 10061 */ | 11240 */ |
| 10062 Token get period => _period; | 11241 Token get period => _period; |
| 10063 | 11242 |
| 10064 /** | 11243 /** |
| 10065 * Return the prefix associated with the library in which the identifier is de
fined. | 11244 * Return the prefix associated with the library in which the identifier is de
fined. |
| 11245 * |
| 10066 * @return the prefix associated with the library in which the identifier is d
efined | 11246 * @return the prefix associated with the library in which the identifier is d
efined |
| 10067 */ | 11247 */ |
| 10068 SimpleIdentifier get prefix => _prefix; | 11248 SimpleIdentifier get prefix => _prefix; |
| 10069 Element get staticElement { | 11249 Element get staticElement { |
| 10070 if (_identifier == null) { | 11250 if (_identifier == null) { |
| 10071 return null; | 11251 return null; |
| 10072 } | 11252 } |
| 10073 return _identifier.staticElement; | 11253 return _identifier.staticElement; |
| 10074 } | 11254 } |
| 10075 | 11255 |
| 10076 /** | 11256 /** |
| 10077 * Set the identifier being prefixed to the given identifier. | 11257 * Set the identifier being prefixed to the given identifier. |
| 11258 * |
| 10078 * @param identifier the identifier being prefixed | 11259 * @param identifier the identifier being prefixed |
| 10079 */ | 11260 */ |
| 10080 void set identifier(SimpleIdentifier identifier2) { | 11261 void set identifier(SimpleIdentifier identifier2) { |
| 10081 this._identifier = becomeParentOf(identifier2); | 11262 this._identifier = becomeParentOf(identifier2); |
| 10082 } | 11263 } |
| 10083 | 11264 |
| 10084 /** | 11265 /** |
| 10085 * Set the period used to separate the prefix from the identifier to the given
token. | 11266 * Set the period used to separate the prefix from the identifier to the given
token. |
| 11267 * |
| 10086 * @param period the period used to separate the prefix from the identifier | 11268 * @param period the period used to separate the prefix from the identifier |
| 10087 */ | 11269 */ |
| 10088 void set period(Token period2) { | 11270 void set period(Token period2) { |
| 10089 this._period = period2; | 11271 this._period = period2; |
| 10090 } | 11272 } |
| 10091 | 11273 |
| 10092 /** | 11274 /** |
| 10093 * Set the prefix associated with the library in which the identifier is defin
ed to the given | 11275 * Set the prefix associated with the library in which the identifier is defin
ed to the given |
| 10094 * identifier. | 11276 * identifier. |
| 11277 * |
| 10095 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 11278 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
| 10096 */ | 11279 */ |
| 10097 void set prefix(SimpleIdentifier identifier) { | 11280 void set prefix(SimpleIdentifier identifier) { |
| 10098 _prefix = becomeParentOf(identifier); | 11281 _prefix = becomeParentOf(identifier); |
| 10099 } | 11282 } |
| 10100 void visitChildren(ASTVisitor<Object> visitor) { | 11283 void visitChildren(ASTVisitor<Object> visitor) { |
| 10101 safelyVisitChild(_prefix, visitor); | 11284 safelyVisitChild(_prefix, visitor); |
| 10102 safelyVisitChild(_identifier, visitor); | 11285 safelyVisitChild(_identifier, visitor); |
| 10103 } | 11286 } |
| 10104 } | 11287 } |
| 10105 /** | 11288 /** |
| 10106 * Instances of the class `PropertyAccess` represent the access of a property of
an object. | 11289 * Instances of the class `PropertyAccess` represent the access of a property of
an object. |
| 10107 * | 11290 * |
| 10108 * Note, however, that accesses to properties of objects can also be represented
as[PrefixedIdentifier prefixed identifier] nodes in cases where the target is a
lso a simple | 11291 * Note, however, that accesses to properties of objects can also be represented
as |
| 11292 * [PrefixedIdentifier] nodes in cases where the target is also a simple |
| 10109 * identifier. | 11293 * identifier. |
| 11294 * |
| 10110 * <pre> | 11295 * <pre> |
| 10111 * propertyAccess ::=[Expression target] '.' [SimpleIdentifier propertyName]</pr
e> | 11296 * propertyAccess ::= |
| 11297 * [Expression] '.' [SimpleIdentifier] |
| 11298 * </pre> |
| 11299 * |
| 10112 * @coverage dart.engine.ast | 11300 * @coverage dart.engine.ast |
| 10113 */ | 11301 */ |
| 10114 class PropertyAccess extends Expression { | 11302 class PropertyAccess extends Expression { |
| 10115 | 11303 |
| 10116 /** | 11304 /** |
| 10117 * The expression computing the object defining the property being accessed. | 11305 * The expression computing the object defining the property being accessed. |
| 10118 */ | 11306 */ |
| 10119 Expression _target; | 11307 Expression _target; |
| 10120 | 11308 |
| 10121 /** | 11309 /** |
| 10122 * The property access operator. | 11310 * The property access operator. |
| 10123 */ | 11311 */ |
| 10124 Token _operator; | 11312 Token _operator; |
| 10125 | 11313 |
| 10126 /** | 11314 /** |
| 10127 * The name of the property being accessed. | 11315 * The name of the property being accessed. |
| 10128 */ | 11316 */ |
| 10129 SimpleIdentifier _propertyName; | 11317 SimpleIdentifier _propertyName; |
| 10130 | 11318 |
| 10131 /** | 11319 /** |
| 10132 * Initialize a newly created property access expression. | 11320 * Initialize a newly created property access expression. |
| 11321 * |
| 10133 * @param target the expression computing the object defining the property bei
ng accessed | 11322 * @param target the expression computing the object defining the property bei
ng accessed |
| 10134 * @param operator the property access operator | 11323 * @param operator the property access operator |
| 10135 * @param propertyName the name of the property being accessed | 11324 * @param propertyName the name of the property being accessed |
| 10136 */ | 11325 */ |
| 10137 PropertyAccess.full(Expression target, Token operator, SimpleIdentifier proper
tyName) { | 11326 PropertyAccess.full(Expression target, Token operator, SimpleIdentifier proper
tyName) { |
| 10138 this._target = becomeParentOf(target); | 11327 this._target = becomeParentOf(target); |
| 10139 this._operator = operator; | 11328 this._operator = operator; |
| 10140 this._propertyName = becomeParentOf(propertyName); | 11329 this._propertyName = becomeParentOf(propertyName); |
| 10141 } | 11330 } |
| 10142 | 11331 |
| 10143 /** | 11332 /** |
| 10144 * Initialize a newly created property access expression. | 11333 * Initialize a newly created property access expression. |
| 11334 * |
| 10145 * @param target the expression computing the object defining the property bei
ng accessed | 11335 * @param target the expression computing the object defining the property bei
ng accessed |
| 10146 * @param operator the property access operator | 11336 * @param operator the property access operator |
| 10147 * @param propertyName the name of the property being accessed | 11337 * @param propertyName the name of the property being accessed |
| 10148 */ | 11338 */ |
| 10149 PropertyAccess({Expression target, Token operator, SimpleIdentifier propertyNa
me}) : this.full(target, operator, propertyName); | 11339 PropertyAccess({Expression target, Token operator, SimpleIdentifier propertyNa
me}) : this.full(target, operator, propertyName); |
| 10150 accept(ASTVisitor visitor) => visitor.visitPropertyAccess(this); | 11340 accept(ASTVisitor visitor) => visitor.visitPropertyAccess(this); |
| 10151 Token get beginToken { | 11341 Token get beginToken { |
| 10152 if (_target != null) { | 11342 if (_target != null) { |
| 10153 return _target.beginToken; | 11343 return _target.beginToken; |
| 10154 } | 11344 } |
| 10155 return _operator; | 11345 return _operator; |
| 10156 } | 11346 } |
| 10157 Token get endToken => _propertyName.endToken; | 11347 Token get endToken => _propertyName.endToken; |
| 10158 | 11348 |
| 10159 /** | 11349 /** |
| 10160 * Return the property access operator. | 11350 * Return the property access operator. |
| 11351 * |
| 10161 * @return the property access operator | 11352 * @return the property access operator |
| 10162 */ | 11353 */ |
| 10163 Token get operator => _operator; | 11354 Token get operator => _operator; |
| 10164 | 11355 |
| 10165 /** | 11356 /** |
| 10166 * Return the name of the property being accessed. | 11357 * Return the name of the property being accessed. |
| 11358 * |
| 10167 * @return the name of the property being accessed | 11359 * @return the name of the property being accessed |
| 10168 */ | 11360 */ |
| 10169 SimpleIdentifier get propertyName => _propertyName; | 11361 SimpleIdentifier get propertyName => _propertyName; |
| 10170 | 11362 |
| 10171 /** | 11363 /** |
| 10172 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not | 11364 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not |
| 10173 * part of a cascade expression, then this is the same as [getTarget]. If this
invocation | 11365 * part of a cascade expression, then this is the same as [getTarget]. If this
invocation |
| 10174 * is part of a cascade expression, then the target stored with the cascade ex
pression is | 11366 * is part of a cascade expression, then the target stored with the cascade ex
pression is |
| 10175 * returned. | 11367 * returned. |
| 11368 * |
| 10176 * @return the expression used to compute the receiver of the invocation | 11369 * @return the expression used to compute the receiver of the invocation |
| 10177 * @see #getTarget() | 11370 * @see #getTarget() |
| 10178 */ | 11371 */ |
| 10179 Expression get realTarget { | 11372 Expression get realTarget { |
| 10180 if (isCascaded) { | 11373 if (isCascaded) { |
| 10181 ASTNode ancestor = parent; | 11374 ASTNode ancestor = parent; |
| 10182 while (ancestor is! CascadeExpression) { | 11375 while (ancestor is! CascadeExpression) { |
| 10183 if (ancestor == null) { | 11376 if (ancestor == null) { |
| 10184 return _target; | 11377 return _target; |
| 10185 } | 11378 } |
| 10186 ancestor = ancestor.parent; | 11379 ancestor = ancestor.parent; |
| 10187 } | 11380 } |
| 10188 return ((ancestor as CascadeExpression)).target; | 11381 return ((ancestor as CascadeExpression)).target; |
| 10189 } | 11382 } |
| 10190 return _target; | 11383 return _target; |
| 10191 } | 11384 } |
| 10192 | 11385 |
| 10193 /** | 11386 /** |
| 10194 * Return the expression computing the object defining the property being acce
ssed, or`null` if this property access is part of a cascade expression. | 11387 * Return the expression computing the object defining the property being acce
ssed, or |
| 11388 * `null` if this property access is part of a cascade expression. |
| 11389 * |
| 10195 * @return the expression computing the object defining the property being acc
essed | 11390 * @return the expression computing the object defining the property being acc
essed |
| 10196 * @see #getRealTarget() | 11391 * @see #getRealTarget() |
| 10197 */ | 11392 */ |
| 10198 Expression get target => _target; | 11393 Expression get target => _target; |
| 10199 bool get isAssignable => true; | 11394 bool get isAssignable => true; |
| 10200 | 11395 |
| 10201 /** | 11396 /** |
| 10202 * Return `true` if this expression is cascaded. If it is, then the target of
this | 11397 * Return `true` if this expression is cascaded. If it is, then the target of
this |
| 10203 * expression is not stored locally but is stored in the nearest ancestor that
is a[CascadeExpression]. | 11398 * expression is not stored locally but is stored in the nearest ancestor that
is a |
| 11399 * [CascadeExpression]. |
| 11400 * |
| 10204 * @return `true` if this expression is cascaded | 11401 * @return `true` if this expression is cascaded |
| 10205 */ | 11402 */ |
| 10206 bool get isCascaded => _operator != null && identical(_operator.type, TokenTyp
e.PERIOD_PERIOD); | 11403 bool get isCascaded => _operator != null && identical(_operator.type, TokenTyp
e.PERIOD_PERIOD); |
| 10207 | 11404 |
| 10208 /** | 11405 /** |
| 10209 * Set the property access operator to the given token. | 11406 * Set the property access operator to the given token. |
| 11407 * |
| 10210 * @param operator the property access operator | 11408 * @param operator the property access operator |
| 10211 */ | 11409 */ |
| 10212 void set operator(Token operator2) { | 11410 void set operator(Token operator2) { |
| 10213 this._operator = operator2; | 11411 this._operator = operator2; |
| 10214 } | 11412 } |
| 10215 | 11413 |
| 10216 /** | 11414 /** |
| 10217 * Set the name of the property being accessed to the given identifier. | 11415 * Set the name of the property being accessed to the given identifier. |
| 11416 * |
| 10218 * @param identifier the name of the property being accessed | 11417 * @param identifier the name of the property being accessed |
| 10219 */ | 11418 */ |
| 10220 void set propertyName(SimpleIdentifier identifier) { | 11419 void set propertyName(SimpleIdentifier identifier) { |
| 10221 _propertyName = becomeParentOf(identifier); | 11420 _propertyName = becomeParentOf(identifier); |
| 10222 } | 11421 } |
| 10223 | 11422 |
| 10224 /** | 11423 /** |
| 10225 * Set the expression computing the object defining the property being accesse
d to the given | 11424 * Set the expression computing the object defining the property being accesse
d to the given |
| 10226 * expression. | 11425 * expression. |
| 11426 * |
| 10227 * @param expression the expression computing the object defining the property
being accessed | 11427 * @param expression the expression computing the object defining the property
being accessed |
| 10228 */ | 11428 */ |
| 10229 void set target(Expression expression) { | 11429 void set target(Expression expression) { |
| 10230 _target = becomeParentOf(expression); | 11430 _target = becomeParentOf(expression); |
| 10231 } | 11431 } |
| 10232 void visitChildren(ASTVisitor<Object> visitor) { | 11432 void visitChildren(ASTVisitor<Object> visitor) { |
| 10233 safelyVisitChild(_target, visitor); | 11433 safelyVisitChild(_target, visitor); |
| 10234 safelyVisitChild(_propertyName, visitor); | 11434 safelyVisitChild(_propertyName, visitor); |
| 10235 } | 11435 } |
| 10236 } | 11436 } |
| 10237 /** | 11437 /** |
| 10238 * Instances of the class `RedirectingConstructorInvocation` represent the invoc
ation of a | 11438 * Instances of the class `RedirectingConstructorInvocation` represent the invoc
ation of a |
| 10239 * another constructor in the same class from within a constructor's initializat
ion list. | 11439 * another constructor in the same class from within a constructor's initializat
ion list. |
| 11440 * |
| 10240 * <pre> | 11441 * <pre> |
| 10241 * redirectingConstructorInvocation ::= | 11442 * redirectingConstructorInvocation ::= |
| 10242 * 'this' ('.' identifier)? arguments | 11443 * 'this' ('.' identifier)? arguments |
| 10243 * </pre> | 11444 * </pre> |
| 11445 * |
| 10244 * @coverage dart.engine.ast | 11446 * @coverage dart.engine.ast |
| 10245 */ | 11447 */ |
| 10246 class RedirectingConstructorInvocation extends ConstructorInitializer { | 11448 class RedirectingConstructorInvocation extends ConstructorInitializer { |
| 10247 | 11449 |
| 10248 /** | 11450 /** |
| 10249 * The token for the 'this' keyword. | 11451 * The token for the 'this' keyword. |
| 10250 */ | 11452 */ |
| 10251 Token _keyword; | 11453 Token _keyword; |
| 10252 | 11454 |
| 10253 /** | 11455 /** |
| 10254 * The token for the period before the name of the constructor that is being i
nvoked, or`null` if the unnamed constructor is being invoked. | 11456 * The token for the period before the name of the constructor that is being i
nvoked, or |
| 11457 * `null` if the unnamed constructor is being invoked. |
| 10255 */ | 11458 */ |
| 10256 Token _period; | 11459 Token _period; |
| 10257 | 11460 |
| 10258 /** | 11461 /** |
| 10259 * The name of the constructor that is being invoked, or `null` if the unnamed
constructor | 11462 * The name of the constructor that is being invoked, or `null` if the unnamed
constructor |
| 10260 * is being invoked. | 11463 * is being invoked. |
| 10261 */ | 11464 */ |
| 10262 SimpleIdentifier _constructorName; | 11465 SimpleIdentifier _constructorName; |
| 10263 | 11466 |
| 10264 /** | 11467 /** |
| 10265 * The list of arguments to the constructor. | 11468 * The list of arguments to the constructor. |
| 10266 */ | 11469 */ |
| 10267 ArgumentList _argumentList; | 11470 ArgumentList _argumentList; |
| 10268 | 11471 |
| 10269 /** | 11472 /** |
| 10270 * The element associated with the constructor based on static type informatio
n, or `null`if the AST structure has not been resolved or if the constructor cou
ld not be resolved. | 11473 * The element associated with the constructor based on static type informatio
n, or `null` |
| 11474 * if the AST structure has not been resolved or if the constructor could not
be resolved. |
| 10271 */ | 11475 */ |
| 10272 ConstructorElement _staticElement; | 11476 ConstructorElement _staticElement; |
| 10273 | 11477 |
| 10274 /** | 11478 /** |
| 10275 * The element associated with the constructor based on propagated type inform
ation, or`null` if the AST structure has not been resolved or if the constructor
could not be | 11479 * The element associated with the constructor based on propagated type inform
ation, or |
| 11480 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 10276 * resolved. | 11481 * resolved. |
| 10277 */ | 11482 */ |
| 10278 ConstructorElement _propagatedElement; | 11483 ConstructorElement _propagatedElement; |
| 10279 | 11484 |
| 10280 /** | 11485 /** |
| 10281 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name | 11486 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name |
| 10282 * with the given arguments. | 11487 * with the given arguments. |
| 11488 * |
| 10283 * @param keyword the token for the 'this' keyword | 11489 * @param keyword the token for the 'this' keyword |
| 10284 * @param period the token for the period before the name of the constructor t
hat is being invoked | 11490 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 10285 * @param constructorName the name of the constructor that is being invoked | 11491 * @param constructorName the name of the constructor that is being invoked |
| 10286 * @param argumentList the list of arguments to the constructor | 11492 * @param argumentList the list of arguments to the constructor |
| 10287 */ | 11493 */ |
| 10288 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent
ifier constructorName, ArgumentList argumentList) { | 11494 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent
ifier constructorName, ArgumentList argumentList) { |
| 10289 this._keyword = keyword; | 11495 this._keyword = keyword; |
| 10290 this._period = period; | 11496 this._period = period; |
| 10291 this._constructorName = becomeParentOf(constructorName); | 11497 this._constructorName = becomeParentOf(constructorName); |
| 10292 this._argumentList = becomeParentOf(argumentList); | 11498 this._argumentList = becomeParentOf(argumentList); |
| 10293 } | 11499 } |
| 10294 | 11500 |
| 10295 /** | 11501 /** |
| 10296 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name | 11502 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name |
| 10297 * with the given arguments. | 11503 * with the given arguments. |
| 11504 * |
| 10298 * @param keyword the token for the 'this' keyword | 11505 * @param keyword the token for the 'this' keyword |
| 10299 * @param period the token for the period before the name of the constructor t
hat is being invoked | 11506 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 10300 * @param constructorName the name of the constructor that is being invoked | 11507 * @param constructorName the name of the constructor that is being invoked |
| 10301 * @param argumentList the list of arguments to the constructor | 11508 * @param argumentList the list of arguments to the constructor |
| 10302 */ | 11509 */ |
| 10303 RedirectingConstructorInvocation({Token keyword, Token period, SimpleIdentifie
r constructorName, ArgumentList argumentList}) : this.full(keyword, period, cons
tructorName, argumentList); | 11510 RedirectingConstructorInvocation({Token keyword, Token period, SimpleIdentifie
r constructorName, ArgumentList argumentList}) : this.full(keyword, period, cons
tructorName, argumentList); |
| 10304 accept(ASTVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th
is); | 11511 accept(ASTVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th
is); |
| 10305 | 11512 |
| 10306 /** | 11513 /** |
| 10307 * Return the list of arguments to the constructor. | 11514 * Return the list of arguments to the constructor. |
| 11515 * |
| 10308 * @return the list of arguments to the constructor | 11516 * @return the list of arguments to the constructor |
| 10309 */ | 11517 */ |
| 10310 ArgumentList get argumentList => _argumentList; | 11518 ArgumentList get argumentList => _argumentList; |
| 10311 Token get beginToken => _keyword; | 11519 Token get beginToken => _keyword; |
| 10312 | 11520 |
| 10313 /** | 11521 /** |
| 10314 * Return the name of the constructor that is being invoked, or `null` if the
unnamed | 11522 * Return the name of the constructor that is being invoked, or `null` if the
unnamed |
| 10315 * constructor is being invoked. | 11523 * constructor is being invoked. |
| 11524 * |
| 10316 * @return the name of the constructor that is being invoked | 11525 * @return the name of the constructor that is being invoked |
| 10317 */ | 11526 */ |
| 10318 SimpleIdentifier get constructorName => _constructorName; | 11527 SimpleIdentifier get constructorName => _constructorName; |
| 10319 | 11528 |
| 10320 /** | 11529 /** |
| 10321 * Return the element associated with the constructor based on propagated type
information, or`null` if the AST structure has not been resolved or if the cons
tructor could not be | 11530 * Return the element associated with the constructor based on propagated type
information, or |
| 11531 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 10322 * resolved. | 11532 * resolved. |
| 11533 * |
| 10323 * @return the element associated with the super constructor | 11534 * @return the element associated with the super constructor |
| 10324 */ | 11535 */ |
| 10325 ConstructorElement get element => _propagatedElement; | 11536 ConstructorElement get element => _propagatedElement; |
| 10326 Token get endToken => _argumentList.endToken; | 11537 Token get endToken => _argumentList.endToken; |
| 10327 | 11538 |
| 10328 /** | 11539 /** |
| 10329 * Return the token for the 'this' keyword. | 11540 * Return the token for the 'this' keyword. |
| 11541 * |
| 10330 * @return the token for the 'this' keyword | 11542 * @return the token for the 'this' keyword |
| 10331 */ | 11543 */ |
| 10332 Token get keyword => _keyword; | 11544 Token get keyword => _keyword; |
| 10333 | 11545 |
| 10334 /** | 11546 /** |
| 10335 * Return the token for the period before the name of the constructor that is
being invoked, or`null` if the unnamed constructor is being invoked. | 11547 * Return the token for the period before the name of the constructor that is
being invoked, or |
| 11548 * `null` if the unnamed constructor is being invoked. |
| 11549 * |
| 10336 * @return the token for the period before the name of the constructor that is
being invoked | 11550 * @return the token for the period before the name of the constructor that is
being invoked |
| 10337 */ | 11551 */ |
| 10338 Token get period => _period; | 11552 Token get period => _period; |
| 10339 | 11553 |
| 10340 /** | 11554 /** |
| 10341 * Return the element associated with the constructor based on static type inf
ormation, or`null` if the AST structure has not been resolved or if the construc
tor could not be | 11555 * Return the element associated with the constructor based on static type inf
ormation, or |
| 11556 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 10342 * resolved. | 11557 * resolved. |
| 11558 * |
| 10343 * @return the element associated with the constructor | 11559 * @return the element associated with the constructor |
| 10344 */ | 11560 */ |
| 10345 ConstructorElement get staticElement => _staticElement; | 11561 ConstructorElement get staticElement => _staticElement; |
| 10346 | 11562 |
| 10347 /** | 11563 /** |
| 10348 * Set the list of arguments to the constructor to the given list. | 11564 * Set the list of arguments to the constructor to the given list. |
| 11565 * |
| 10349 * @param argumentList the list of arguments to the constructor | 11566 * @param argumentList the list of arguments to the constructor |
| 10350 */ | 11567 */ |
| 10351 void set argumentList(ArgumentList argumentList2) { | 11568 void set argumentList(ArgumentList argumentList2) { |
| 10352 this._argumentList = becomeParentOf(argumentList2); | 11569 this._argumentList = becomeParentOf(argumentList2); |
| 10353 } | 11570 } |
| 10354 | 11571 |
| 10355 /** | 11572 /** |
| 10356 * Set the name of the constructor that is being invoked to the given identifi
er. | 11573 * Set the name of the constructor that is being invoked to the given identifi
er. |
| 11574 * |
| 10357 * @param identifier the name of the constructor that is being invoked | 11575 * @param identifier the name of the constructor that is being invoked |
| 10358 */ | 11576 */ |
| 10359 void set constructorName(SimpleIdentifier identifier) { | 11577 void set constructorName(SimpleIdentifier identifier) { |
| 10360 _constructorName = becomeParentOf(identifier); | 11578 _constructorName = becomeParentOf(identifier); |
| 10361 } | 11579 } |
| 10362 | 11580 |
| 10363 /** | 11581 /** |
| 10364 * Set the element associated with the constructor based on propagated type in
formation to the | 11582 * Set the element associated with the constructor based on propagated type in
formation to the |
| 10365 * given element. | 11583 * given element. |
| 11584 * |
| 10366 * @param element the element to be associated with the constructor | 11585 * @param element the element to be associated with the constructor |
| 10367 */ | 11586 */ |
| 10368 void set element(ConstructorElement element2) { | 11587 void set element(ConstructorElement element2) { |
| 10369 _propagatedElement = element2; | 11588 _propagatedElement = element2; |
| 10370 } | 11589 } |
| 10371 | 11590 |
| 10372 /** | 11591 /** |
| 10373 * Set the token for the 'this' keyword to the given token. | 11592 * Set the token for the 'this' keyword to the given token. |
| 11593 * |
| 10374 * @param keyword the token for the 'this' keyword | 11594 * @param keyword the token for the 'this' keyword |
| 10375 */ | 11595 */ |
| 10376 void set keyword(Token keyword2) { | 11596 void set keyword(Token keyword2) { |
| 10377 this._keyword = keyword2; | 11597 this._keyword = keyword2; |
| 10378 } | 11598 } |
| 10379 | 11599 |
| 10380 /** | 11600 /** |
| 10381 * Set the token for the period before the name of the constructor that is bei
ng invoked to the | 11601 * Set the token for the period before the name of the constructor that is bei
ng invoked to the |
| 10382 * given token. | 11602 * given token. |
| 11603 * |
| 10383 * @param period the token for the period before the name of the constructor t
hat is being invoked | 11604 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 10384 */ | 11605 */ |
| 10385 void set period(Token period2) { | 11606 void set period(Token period2) { |
| 10386 this._period = period2; | 11607 this._period = period2; |
| 10387 } | 11608 } |
| 10388 | 11609 |
| 10389 /** | 11610 /** |
| 10390 * Set the element associated with the constructor based on static type inform
ation to the given | 11611 * Set the element associated with the constructor based on static type inform
ation to the given |
| 10391 * element. | 11612 * element. |
| 11613 * |
| 10392 * @param element the element to be associated with the constructor | 11614 * @param element the element to be associated with the constructor |
| 10393 */ | 11615 */ |
| 10394 void set staticElement(ConstructorElement element) { | 11616 void set staticElement(ConstructorElement element) { |
| 10395 this._staticElement = element; | 11617 this._staticElement = element; |
| 10396 } | 11618 } |
| 10397 void visitChildren(ASTVisitor<Object> visitor) { | 11619 void visitChildren(ASTVisitor<Object> visitor) { |
| 10398 safelyVisitChild(_constructorName, visitor); | 11620 safelyVisitChild(_constructorName, visitor); |
| 10399 safelyVisitChild(_argumentList, visitor); | 11621 safelyVisitChild(_argumentList, visitor); |
| 10400 } | 11622 } |
| 10401 } | 11623 } |
| 10402 /** | 11624 /** |
| 10403 * Instances of the class `RethrowExpression` represent a rethrow expression. | 11625 * Instances of the class `RethrowExpression` represent a rethrow expression. |
| 11626 * |
| 10404 * <pre> | 11627 * <pre> |
| 10405 * rethrowExpression ::= | 11628 * rethrowExpression ::= |
| 10406 * 'rethrow' | 11629 * 'rethrow' |
| 10407 * </pre> | 11630 * </pre> |
| 11631 * |
| 10408 * @coverage dart.engine.ast | 11632 * @coverage dart.engine.ast |
| 10409 */ | 11633 */ |
| 10410 class RethrowExpression extends Expression { | 11634 class RethrowExpression extends Expression { |
| 10411 | 11635 |
| 10412 /** | 11636 /** |
| 10413 * The token representing the 'rethrow' keyword. | 11637 * The token representing the 'rethrow' keyword. |
| 10414 */ | 11638 */ |
| 10415 Token _keyword; | 11639 Token _keyword; |
| 10416 | 11640 |
| 10417 /** | 11641 /** |
| 10418 * Initialize a newly created rethrow expression. | 11642 * Initialize a newly created rethrow expression. |
| 11643 * |
| 10419 * @param keyword the token representing the 'rethrow' keyword | 11644 * @param keyword the token representing the 'rethrow' keyword |
| 10420 */ | 11645 */ |
| 10421 RethrowExpression.full(Token keyword) { | 11646 RethrowExpression.full(Token keyword) { |
| 10422 this._keyword = keyword; | 11647 this._keyword = keyword; |
| 10423 } | 11648 } |
| 10424 | 11649 |
| 10425 /** | 11650 /** |
| 10426 * Initialize a newly created rethrow expression. | 11651 * Initialize a newly created rethrow expression. |
| 11652 * |
| 10427 * @param keyword the token representing the 'rethrow' keyword | 11653 * @param keyword the token representing the 'rethrow' keyword |
| 10428 */ | 11654 */ |
| 10429 RethrowExpression({Token keyword}) : this.full(keyword); | 11655 RethrowExpression({Token keyword}) : this.full(keyword); |
| 10430 accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this); | 11656 accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this); |
| 10431 Token get beginToken => _keyword; | 11657 Token get beginToken => _keyword; |
| 10432 Token get endToken => _keyword; | 11658 Token get endToken => _keyword; |
| 10433 | 11659 |
| 10434 /** | 11660 /** |
| 10435 * Return the token representing the 'rethrow' keyword. | 11661 * Return the token representing the 'rethrow' keyword. |
| 11662 * |
| 10436 * @return the token representing the 'rethrow' keyword | 11663 * @return the token representing the 'rethrow' keyword |
| 10437 */ | 11664 */ |
| 10438 Token get keyword => _keyword; | 11665 Token get keyword => _keyword; |
| 10439 | 11666 |
| 10440 /** | 11667 /** |
| 10441 * Set the token representing the 'rethrow' keyword to the given token. | 11668 * Set the token representing the 'rethrow' keyword to the given token. |
| 11669 * |
| 10442 * @param keyword the token representing the 'rethrow' keyword | 11670 * @param keyword the token representing the 'rethrow' keyword |
| 10443 */ | 11671 */ |
| 10444 void set keyword(Token keyword2) { | 11672 void set keyword(Token keyword2) { |
| 10445 this._keyword = keyword2; | 11673 this._keyword = keyword2; |
| 10446 } | 11674 } |
| 10447 void visitChildren(ASTVisitor<Object> visitor) { | 11675 void visitChildren(ASTVisitor<Object> visitor) { |
| 10448 } | 11676 } |
| 10449 } | 11677 } |
| 10450 /** | 11678 /** |
| 10451 * Instances of the class `ReturnStatement` represent a return statement. | 11679 * Instances of the class `ReturnStatement` represent a return statement. |
| 11680 * |
| 10452 * <pre> | 11681 * <pre> |
| 10453 * returnStatement ::= | 11682 * returnStatement ::= |
| 10454 * 'return' [Expression expression]? ';' | 11683 * 'return' [Expression]? ';' |
| 10455 * </pre> | 11684 * </pre> |
| 11685 * |
| 10456 * @coverage dart.engine.ast | 11686 * @coverage dart.engine.ast |
| 10457 */ | 11687 */ |
| 10458 class ReturnStatement extends Statement { | 11688 class ReturnStatement extends Statement { |
| 10459 | 11689 |
| 10460 /** | 11690 /** |
| 10461 * The token representing the 'return' keyword. | 11691 * The token representing the 'return' keyword. |
| 10462 */ | 11692 */ |
| 10463 Token _keyword; | 11693 Token _keyword; |
| 10464 | 11694 |
| 10465 /** | 11695 /** |
| 10466 * The expression computing the value to be returned, or `null` if no explicit
value was | 11696 * The expression computing the value to be returned, or `null` if no explicit
value was |
| 10467 * provided. | 11697 * provided. |
| 10468 */ | 11698 */ |
| 10469 Expression _expression; | 11699 Expression _expression; |
| 10470 | 11700 |
| 10471 /** | 11701 /** |
| 10472 * The semicolon terminating the statement. | 11702 * The semicolon terminating the statement. |
| 10473 */ | 11703 */ |
| 10474 Token _semicolon; | 11704 Token _semicolon; |
| 10475 | 11705 |
| 10476 /** | 11706 /** |
| 10477 * Initialize a newly created return statement. | 11707 * Initialize a newly created return statement. |
| 11708 * |
| 10478 * @param keyword the token representing the 'return' keyword | 11709 * @param keyword the token representing the 'return' keyword |
| 10479 * @param expression the expression computing the value to be returned | 11710 * @param expression the expression computing the value to be returned |
| 10480 * @param semicolon the semicolon terminating the statement | 11711 * @param semicolon the semicolon terminating the statement |
| 10481 */ | 11712 */ |
| 10482 ReturnStatement.full(Token keyword, Expression expression, Token semicolon) { | 11713 ReturnStatement.full(Token keyword, Expression expression, Token semicolon) { |
| 10483 this._keyword = keyword; | 11714 this._keyword = keyword; |
| 10484 this._expression = becomeParentOf(expression); | 11715 this._expression = becomeParentOf(expression); |
| 10485 this._semicolon = semicolon; | 11716 this._semicolon = semicolon; |
| 10486 } | 11717 } |
| 10487 | 11718 |
| 10488 /** | 11719 /** |
| 10489 * Initialize a newly created return statement. | 11720 * Initialize a newly created return statement. |
| 11721 * |
| 10490 * @param keyword the token representing the 'return' keyword | 11722 * @param keyword the token representing the 'return' keyword |
| 10491 * @param expression the expression computing the value to be returned | 11723 * @param expression the expression computing the value to be returned |
| 10492 * @param semicolon the semicolon terminating the statement | 11724 * @param semicolon the semicolon terminating the statement |
| 10493 */ | 11725 */ |
| 10494 ReturnStatement({Token keyword, Expression expression, Token semicolon}) : thi
s.full(keyword, expression, semicolon); | 11726 ReturnStatement({Token keyword, Expression expression, Token semicolon}) : thi
s.full(keyword, expression, semicolon); |
| 10495 accept(ASTVisitor visitor) => visitor.visitReturnStatement(this); | 11727 accept(ASTVisitor visitor) => visitor.visitReturnStatement(this); |
| 10496 Token get beginToken => _keyword; | 11728 Token get beginToken => _keyword; |
| 10497 Token get endToken => _semicolon; | 11729 Token get endToken => _semicolon; |
| 10498 | 11730 |
| 10499 /** | 11731 /** |
| 10500 * Return the expression computing the value to be returned, or `null` if no e
xplicit value | 11732 * Return the expression computing the value to be returned, or `null` if no e
xplicit value |
| 10501 * was provided. | 11733 * was provided. |
| 11734 * |
| 10502 * @return the expression computing the value to be returned | 11735 * @return the expression computing the value to be returned |
| 10503 */ | 11736 */ |
| 10504 Expression get expression => _expression; | 11737 Expression get expression => _expression; |
| 10505 | 11738 |
| 10506 /** | 11739 /** |
| 10507 * Return the token representing the 'return' keyword. | 11740 * Return the token representing the 'return' keyword. |
| 11741 * |
| 10508 * @return the token representing the 'return' keyword | 11742 * @return the token representing the 'return' keyword |
| 10509 */ | 11743 */ |
| 10510 Token get keyword => _keyword; | 11744 Token get keyword => _keyword; |
| 10511 | 11745 |
| 10512 /** | 11746 /** |
| 10513 * Return the semicolon terminating the statement. | 11747 * Return the semicolon terminating the statement. |
| 11748 * |
| 10514 * @return the semicolon terminating the statement | 11749 * @return the semicolon terminating the statement |
| 10515 */ | 11750 */ |
| 10516 Token get semicolon => _semicolon; | 11751 Token get semicolon => _semicolon; |
| 10517 | 11752 |
| 10518 /** | 11753 /** |
| 10519 * Set the expression computing the value to be returned to the given expressi
on. | 11754 * Set the expression computing the value to be returned to the given expressi
on. |
| 11755 * |
| 10520 * @param expression the expression computing the value to be returned | 11756 * @param expression the expression computing the value to be returned |
| 10521 */ | 11757 */ |
| 10522 void set expression(Expression expression2) { | 11758 void set expression(Expression expression2) { |
| 10523 this._expression = becomeParentOf(expression2); | 11759 this._expression = becomeParentOf(expression2); |
| 10524 } | 11760 } |
| 10525 | 11761 |
| 10526 /** | 11762 /** |
| 10527 * Set the token representing the 'return' keyword to the given token. | 11763 * Set the token representing the 'return' keyword to the given token. |
| 11764 * |
| 10528 * @param keyword the token representing the 'return' keyword | 11765 * @param keyword the token representing the 'return' keyword |
| 10529 */ | 11766 */ |
| 10530 void set keyword(Token keyword2) { | 11767 void set keyword(Token keyword2) { |
| 10531 this._keyword = keyword2; | 11768 this._keyword = keyword2; |
| 10532 } | 11769 } |
| 10533 | 11770 |
| 10534 /** | 11771 /** |
| 10535 * Set the semicolon terminating the statement to the given token. | 11772 * Set the semicolon terminating the statement to the given token. |
| 11773 * |
| 10536 * @param semicolon the semicolon terminating the statement | 11774 * @param semicolon the semicolon terminating the statement |
| 10537 */ | 11775 */ |
| 10538 void set semicolon(Token semicolon2) { | 11776 void set semicolon(Token semicolon2) { |
| 10539 this._semicolon = semicolon2; | 11777 this._semicolon = semicolon2; |
| 10540 } | 11778 } |
| 10541 void visitChildren(ASTVisitor<Object> visitor) { | 11779 void visitChildren(ASTVisitor<Object> visitor) { |
| 10542 safelyVisitChild(_expression, visitor); | 11780 safelyVisitChild(_expression, visitor); |
| 10543 } | 11781 } |
| 10544 } | 11782 } |
| 10545 /** | 11783 /** |
| 10546 * Instances of the class `ScriptTag` represent the script tag that can optional
ly occur at | 11784 * Instances of the class `ScriptTag` represent the script tag that can optional
ly occur at |
| 10547 * the beginning of a compilation unit. | 11785 * the beginning of a compilation unit. |
| 11786 * |
| 10548 * <pre> | 11787 * <pre> |
| 10549 * scriptTag ::= | 11788 * scriptTag ::= |
| 10550 * '#!' (~NEWLINE)* NEWLINE | 11789 * '#!' (~NEWLINE)* NEWLINE |
| 10551 * </pre> | 11790 * </pre> |
| 11791 * |
| 10552 * @coverage dart.engine.ast | 11792 * @coverage dart.engine.ast |
| 10553 */ | 11793 */ |
| 10554 class ScriptTag extends ASTNode { | 11794 class ScriptTag extends ASTNode { |
| 10555 | 11795 |
| 10556 /** | 11796 /** |
| 10557 * The token representing this script tag. | 11797 * The token representing this script tag. |
| 10558 */ | 11798 */ |
| 10559 Token _scriptTag; | 11799 Token _scriptTag; |
| 10560 | 11800 |
| 10561 /** | 11801 /** |
| 10562 * Initialize a newly created script tag. | 11802 * Initialize a newly created script tag. |
| 11803 * |
| 10563 * @param scriptTag the token representing this script tag | 11804 * @param scriptTag the token representing this script tag |
| 10564 */ | 11805 */ |
| 10565 ScriptTag.full(Token scriptTag) { | 11806 ScriptTag.full(Token scriptTag) { |
| 10566 this._scriptTag = scriptTag; | 11807 this._scriptTag = scriptTag; |
| 10567 } | 11808 } |
| 10568 | 11809 |
| 10569 /** | 11810 /** |
| 10570 * Initialize a newly created script tag. | 11811 * Initialize a newly created script tag. |
| 11812 * |
| 10571 * @param scriptTag the token representing this script tag | 11813 * @param scriptTag the token representing this script tag |
| 10572 */ | 11814 */ |
| 10573 ScriptTag({Token scriptTag}) : this.full(scriptTag); | 11815 ScriptTag({Token scriptTag}) : this.full(scriptTag); |
| 10574 accept(ASTVisitor visitor) => visitor.visitScriptTag(this); | 11816 accept(ASTVisitor visitor) => visitor.visitScriptTag(this); |
| 10575 Token get beginToken => _scriptTag; | 11817 Token get beginToken => _scriptTag; |
| 10576 Token get endToken => _scriptTag; | 11818 Token get endToken => _scriptTag; |
| 10577 | 11819 |
| 10578 /** | 11820 /** |
| 10579 * Return the token representing this script tag. | 11821 * Return the token representing this script tag. |
| 11822 * |
| 10580 * @return the token representing this script tag | 11823 * @return the token representing this script tag |
| 10581 */ | 11824 */ |
| 10582 Token get scriptTag => _scriptTag; | 11825 Token get scriptTag => _scriptTag; |
| 10583 | 11826 |
| 10584 /** | 11827 /** |
| 10585 * Set the token representing this script tag to the given script tag. | 11828 * Set the token representing this script tag to the given script tag. |
| 11829 * |
| 10586 * @param scriptTag the token representing this script tag | 11830 * @param scriptTag the token representing this script tag |
| 10587 */ | 11831 */ |
| 10588 void set scriptTag(Token scriptTag2) { | 11832 void set scriptTag(Token scriptTag2) { |
| 10589 this._scriptTag = scriptTag2; | 11833 this._scriptTag = scriptTag2; |
| 10590 } | 11834 } |
| 10591 void visitChildren(ASTVisitor<Object> visitor) { | 11835 void visitChildren(ASTVisitor<Object> visitor) { |
| 10592 } | 11836 } |
| 10593 } | 11837 } |
| 10594 /** | 11838 /** |
| 10595 * Instances of the class `ShowCombinator` represent a combinator that restricts
the names | 11839 * Instances of the class `ShowCombinator` represent a combinator that restricts
the names |
| 10596 * being imported to those in a given list. | 11840 * being imported to those in a given list. |
| 11841 * |
| 10597 * <pre> | 11842 * <pre> |
| 10598 * showCombinator ::= | 11843 * showCombinator ::= |
| 10599 * 'show' [SimpleIdentifier identifier] (',' [SimpleIdentifier identifier]) | 11844 * 'show' [SimpleIdentifier] (',' [SimpleIdentifier])* |
| 10600 * </pre> | 11845 * </pre> |
| 11846 * |
| 10601 * @coverage dart.engine.ast | 11847 * @coverage dart.engine.ast |
| 10602 */ | 11848 */ |
| 10603 class ShowCombinator extends Combinator { | 11849 class ShowCombinator extends Combinator { |
| 10604 | 11850 |
| 10605 /** | 11851 /** |
| 10606 * The list of names from the library that are made visible by this combinator
. | 11852 * The list of names from the library that are made visible by this combinator
. |
| 10607 */ | 11853 */ |
| 10608 NodeList<SimpleIdentifier> _shownNames; | 11854 NodeList<SimpleIdentifier> _shownNames; |
| 10609 | 11855 |
| 10610 /** | 11856 /** |
| 10611 * Initialize a newly created import show combinator. | 11857 * Initialize a newly created import show combinator. |
| 11858 * |
| 10612 * @param keyword the comma introducing the combinator | 11859 * @param keyword the comma introducing the combinator |
| 10613 * @param shownNames the list of names from the library that are made visible
by this combinator | 11860 * @param shownNames the list of names from the library that are made visible
by this combinator |
| 10614 */ | 11861 */ |
| 10615 ShowCombinator.full(Token keyword, List<SimpleIdentifier> shownNames) : super.
full(keyword) { | 11862 ShowCombinator.full(Token keyword, List<SimpleIdentifier> shownNames) : super.
full(keyword) { |
| 10616 this._shownNames = new NodeList<SimpleIdentifier>(this); | 11863 this._shownNames = new NodeList<SimpleIdentifier>(this); |
| 10617 this._shownNames.addAll(shownNames); | 11864 this._shownNames.addAll(shownNames); |
| 10618 } | 11865 } |
| 10619 | 11866 |
| 10620 /** | 11867 /** |
| 10621 * Initialize a newly created import show combinator. | 11868 * Initialize a newly created import show combinator. |
| 11869 * |
| 10622 * @param keyword the comma introducing the combinator | 11870 * @param keyword the comma introducing the combinator |
| 10623 * @param shownNames the list of names from the library that are made visible
by this combinator | 11871 * @param shownNames the list of names from the library that are made visible
by this combinator |
| 10624 */ | 11872 */ |
| 10625 ShowCombinator({Token keyword, List<SimpleIdentifier> shownNames}) : this.full
(keyword, shownNames); | 11873 ShowCombinator({Token keyword, List<SimpleIdentifier> shownNames}) : this.full
(keyword, shownNames); |
| 10626 accept(ASTVisitor visitor) => visitor.visitShowCombinator(this); | 11874 accept(ASTVisitor visitor) => visitor.visitShowCombinator(this); |
| 10627 Token get endToken => _shownNames.endToken; | 11875 Token get endToken => _shownNames.endToken; |
| 10628 | 11876 |
| 10629 /** | 11877 /** |
| 10630 * Return the list of names from the library that are made visible by this com
binator. | 11878 * Return the list of names from the library that are made visible by this com
binator. |
| 11879 * |
| 10631 * @return the list of names from the library that are made visible by this co
mbinator | 11880 * @return the list of names from the library that are made visible by this co
mbinator |
| 10632 */ | 11881 */ |
| 10633 NodeList<SimpleIdentifier> get shownNames => _shownNames; | 11882 NodeList<SimpleIdentifier> get shownNames => _shownNames; |
| 10634 void visitChildren(ASTVisitor<Object> visitor) { | 11883 void visitChildren(ASTVisitor<Object> visitor) { |
| 10635 _shownNames.accept(visitor); | 11884 _shownNames.accept(visitor); |
| 10636 } | 11885 } |
| 10637 } | 11886 } |
| 10638 /** | 11887 /** |
| 10639 * Instances of the class `SimpleFormalParameter` represent a simple formal para
meter. | 11888 * Instances of the class `SimpleFormalParameter` represent a simple formal para
meter. |
| 11889 * |
| 10640 * <pre> | 11890 * <pre> |
| 10641 * simpleFormalParameter ::= | 11891 * simpleFormalParameter ::= |
| 10642 * ('final' [TypeName type] | 'var' | [TypeName type])? [SimpleIdentifier identi
fier]</pre> | 11892 * ('final' [TypeName] | 'var' | [TypeName])? [SimpleIdentifier] |
| 11893 * </pre> |
| 11894 * |
| 10643 * @coverage dart.engine.ast | 11895 * @coverage dart.engine.ast |
| 10644 */ | 11896 */ |
| 10645 class SimpleFormalParameter extends NormalFormalParameter { | 11897 class SimpleFormalParameter extends NormalFormalParameter { |
| 10646 | 11898 |
| 10647 /** | 11899 /** |
| 10648 * The token representing either the 'final', 'const' or 'var' keyword, or `nu
ll` if no | 11900 * The token representing either the 'final', 'const' or 'var' keyword, or `nu
ll` if no |
| 10649 * keyword was used. | 11901 * keyword was used. |
| 10650 */ | 11902 */ |
| 10651 Token _keyword; | 11903 Token _keyword; |
| 10652 | 11904 |
| 10653 /** | 11905 /** |
| 10654 * The name of the declared type of the parameter, or `null` if the parameter
does not have | 11906 * The name of the declared type of the parameter, or `null` if the parameter
does not have |
| 10655 * a declared type. | 11907 * a declared type. |
| 10656 */ | 11908 */ |
| 10657 TypeName _type; | 11909 TypeName _type; |
| 10658 | 11910 |
| 10659 /** | 11911 /** |
| 10660 * Initialize a newly created formal parameter. | 11912 * Initialize a newly created formal parameter. |
| 11913 * |
| 10661 * @param comment the documentation comment associated with this parameter | 11914 * @param comment the documentation comment associated with this parameter |
| 10662 * @param metadata the annotations associated with this parameter | 11915 * @param metadata the annotations associated with this parameter |
| 10663 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 11916 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 10664 * @param type the name of the declared type of the parameter | 11917 * @param type the name of the declared type of the parameter |
| 10665 * @param identifier the name of the parameter being declared | 11918 * @param identifier the name of the parameter being declared |
| 10666 */ | 11919 */ |
| 10667 SimpleFormalParameter.full(Comment comment, List<Annotation> metadata, Token k
eyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metada
ta, identifier) { | 11920 SimpleFormalParameter.full(Comment comment, List<Annotation> metadata, Token k
eyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metada
ta, identifier) { |
| 10668 this._keyword = keyword; | 11921 this._keyword = keyword; |
| 10669 this._type = becomeParentOf(type); | 11922 this._type = becomeParentOf(type); |
| 10670 } | 11923 } |
| 10671 | 11924 |
| 10672 /** | 11925 /** |
| 10673 * Initialize a newly created formal parameter. | 11926 * Initialize a newly created formal parameter. |
| 11927 * |
| 10674 * @param comment the documentation comment associated with this parameter | 11928 * @param comment the documentation comment associated with this parameter |
| 10675 * @param metadata the annotations associated with this parameter | 11929 * @param metadata the annotations associated with this parameter |
| 10676 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 11930 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 10677 * @param type the name of the declared type of the parameter | 11931 * @param type the name of the declared type of the parameter |
| 10678 * @param identifier the name of the parameter being declared | 11932 * @param identifier the name of the parameter being declared |
| 10679 */ | 11933 */ |
| 10680 SimpleFormalParameter({Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata,
keyword, type, identifier); | 11934 SimpleFormalParameter({Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata,
keyword, type, identifier); |
| 10681 accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this); | 11935 accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this); |
| 10682 Token get beginToken { | 11936 Token get beginToken { |
| 10683 if (_keyword != null) { | 11937 if (_keyword != null) { |
| 10684 return _keyword; | 11938 return _keyword; |
| 10685 } else if (_type != null) { | 11939 } else if (_type != null) { |
| 10686 return _type.beginToken; | 11940 return _type.beginToken; |
| 10687 } | 11941 } |
| 10688 return identifier.beginToken; | 11942 return identifier.beginToken; |
| 10689 } | 11943 } |
| 10690 Token get endToken => identifier.endToken; | 11944 Token get endToken => identifier.endToken; |
| 10691 | 11945 |
| 10692 /** | 11946 /** |
| 10693 * Return the token representing either the 'final', 'const' or 'var' keyword. | 11947 * Return the token representing either the 'final', 'const' or 'var' keyword. |
| 11948 * |
| 10694 * @return the token representing either the 'final', 'const' or 'var' keyword | 11949 * @return the token representing either the 'final', 'const' or 'var' keyword |
| 10695 */ | 11950 */ |
| 10696 Token get keyword => _keyword; | 11951 Token get keyword => _keyword; |
| 10697 | 11952 |
| 10698 /** | 11953 /** |
| 10699 * Return the name of the declared type of the parameter, or `null` if the par
ameter does | 11954 * Return the name of the declared type of the parameter, or `null` if the par
ameter does |
| 10700 * not have a declared type. | 11955 * not have a declared type. |
| 11956 * |
| 10701 * @return the name of the declared type of the parameter | 11957 * @return the name of the declared type of the parameter |
| 10702 */ | 11958 */ |
| 10703 TypeName get type => _type; | 11959 TypeName get type => _type; |
| 10704 bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.CONST); | 11960 bool get isConst => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.CONST); |
| 10705 bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.FINAL); | 11961 bool get isFinal => (_keyword is KeywordToken) && identical(((_keyword as Keyw
ordToken)).keyword, Keyword.FINAL); |
| 10706 | 11962 |
| 10707 /** | 11963 /** |
| 10708 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 11964 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
| 11965 * |
| 10709 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 11966 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
| 10710 */ | 11967 */ |
| 10711 void set keyword(Token keyword2) { | 11968 void set keyword(Token keyword2) { |
| 10712 this._keyword = keyword2; | 11969 this._keyword = keyword2; |
| 10713 } | 11970 } |
| 10714 | 11971 |
| 10715 /** | 11972 /** |
| 10716 * Set the name of the declared type of the parameter to the given type name. | 11973 * Set the name of the declared type of the parameter to the given type name. |
| 11974 * |
| 10717 * @param typeName the name of the declared type of the parameter | 11975 * @param typeName the name of the declared type of the parameter |
| 10718 */ | 11976 */ |
| 10719 void set type(TypeName typeName) { | 11977 void set type(TypeName typeName) { |
| 10720 _type = becomeParentOf(typeName); | 11978 _type = becomeParentOf(typeName); |
| 10721 } | 11979 } |
| 10722 void visitChildren(ASTVisitor<Object> visitor) { | 11980 void visitChildren(ASTVisitor<Object> visitor) { |
| 10723 super.visitChildren(visitor); | 11981 super.visitChildren(visitor); |
| 10724 safelyVisitChild(_type, visitor); | 11982 safelyVisitChild(_type, visitor); |
| 10725 safelyVisitChild(identifier, visitor); | 11983 safelyVisitChild(identifier, visitor); |
| 10726 } | 11984 } |
| 10727 } | 11985 } |
| 10728 /** | 11986 /** |
| 10729 * Instances of the class `SimpleIdentifier` represent a simple identifier. | 11987 * Instances of the class `SimpleIdentifier` represent a simple identifier. |
| 11988 * |
| 10730 * <pre> | 11989 * <pre> |
| 10731 * simpleIdentifier ::= | 11990 * simpleIdentifier ::= |
| 10732 * initialCharacter internalCharacter | 11991 * initialCharacter internalCharacter* |
| 11992 * |
| 10733 * initialCharacter ::= '_' | '$' | letter | 11993 * initialCharacter ::= '_' | '$' | letter |
| 11994 * |
| 10734 * internalCharacter ::= '_' | '$' | letter | digit | 11995 * internalCharacter ::= '_' | '$' | letter | digit |
| 10735 * </pre> | 11996 * </pre> |
| 11997 * |
| 10736 * @coverage dart.engine.ast | 11998 * @coverage dart.engine.ast |
| 10737 */ | 11999 */ |
| 10738 class SimpleIdentifier extends Identifier { | 12000 class SimpleIdentifier extends Identifier { |
| 10739 | 12001 |
| 10740 /** | 12002 /** |
| 10741 * The token representing the identifier. | 12003 * The token representing the identifier. |
| 10742 */ | 12004 */ |
| 10743 Token _token; | 12005 Token _token; |
| 10744 | 12006 |
| 10745 /** | 12007 /** |
| 10746 * The element associated with this identifier based on static type informatio
n, or `null`if the AST structure has not been resolved or if this identifier cou
ld not be resolved. | 12008 * The element associated with this identifier based on static type informatio
n, or `null` |
| 12009 * if the AST structure has not been resolved or if this identifier could not
be resolved. |
| 10747 */ | 12010 */ |
| 10748 Element _staticElement; | 12011 Element _staticElement; |
| 10749 | 12012 |
| 10750 /** | 12013 /** |
| 10751 * The element associated with this identifier based on propagated type inform
ation, or`null` if the AST structure has not been resolved or if this identifier
could not be | 12014 * The element associated with this identifier based on propagated type inform
ation, or |
| 12015 * `null` if the AST structure has not been resolved or if this identifier cou
ld not be |
| 10752 * resolved. | 12016 * resolved. |
| 10753 */ | 12017 */ |
| 10754 Element _propagatedElement; | 12018 Element _propagatedElement; |
| 10755 | 12019 |
| 10756 /** | 12020 /** |
| 10757 * Initialize a newly created identifier. | 12021 * Initialize a newly created identifier. |
| 12022 * |
| 10758 * @param token the token representing the identifier | 12023 * @param token the token representing the identifier |
| 10759 */ | 12024 */ |
| 10760 SimpleIdentifier.full(Token token) { | 12025 SimpleIdentifier.full(Token token) { |
| 10761 this._token = token; | 12026 this._token = token; |
| 10762 } | 12027 } |
| 10763 | 12028 |
| 10764 /** | 12029 /** |
| 10765 * Initialize a newly created identifier. | 12030 * Initialize a newly created identifier. |
| 12031 * |
| 10766 * @param token the token representing the identifier | 12032 * @param token the token representing the identifier |
| 10767 */ | 12033 */ |
| 10768 SimpleIdentifier({Token token}) : this.full(token); | 12034 SimpleIdentifier({Token token}) : this.full(token); |
| 10769 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); | 12035 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); |
| 10770 Token get beginToken => _token; | 12036 Token get beginToken => _token; |
| 10771 Element get element => _propagatedElement; | 12037 Element get element => _propagatedElement; |
| 10772 Token get endToken => _token; | 12038 Token get endToken => _token; |
| 10773 String get name => _token.lexeme; | 12039 String get name => _token.lexeme; |
| 10774 Element get staticElement => _staticElement; | 12040 Element get staticElement => _staticElement; |
| 10775 | 12041 |
| 10776 /** | 12042 /** |
| 10777 * Return the token representing the identifier. | 12043 * Return the token representing the identifier. |
| 12044 * |
| 10778 * @return the token representing the identifier | 12045 * @return the token representing the identifier |
| 10779 */ | 12046 */ |
| 10780 Token get token => _token; | 12047 Token get token => _token; |
| 10781 | 12048 |
| 10782 /** | 12049 /** |
| 10783 * Return `true` if this identifier is the name being declared in a declaratio
n. | 12050 * Return `true` if this identifier is the name being declared in a declaratio
n. |
| 12051 * |
| 10784 * @return `true` if this identifier is the name being declared in a declarati
on | 12052 * @return `true` if this identifier is the name being declared in a declarati
on |
| 10785 */ | 12053 */ |
| 10786 bool inDeclarationContext() { | 12054 bool inDeclarationContext() { |
| 10787 ASTNode parent = this.parent; | 12055 ASTNode parent = this.parent; |
| 10788 if (parent is CatchClause) { | 12056 if (parent is CatchClause) { |
| 10789 CatchClause clause = parent as CatchClause; | 12057 CatchClause clause = parent as CatchClause; |
| 10790 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); | 12058 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); |
| 10791 } else if (parent is ClassDeclaration) { | 12059 } else if (parent is ClassDeclaration) { |
| 10792 return identical(this, ((parent as ClassDeclaration)).name); | 12060 return identical(this, ((parent as ClassDeclaration)).name); |
| 10793 } else if (parent is ClassTypeAlias) { | 12061 } else if (parent is ClassTypeAlias) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10809 } else if (parent is VariableDeclaration) { | 12077 } else if (parent is VariableDeclaration) { |
| 10810 return identical(this, ((parent as VariableDeclaration)).name); | 12078 return identical(this, ((parent as VariableDeclaration)).name); |
| 10811 } | 12079 } |
| 10812 return false; | 12080 return false; |
| 10813 } | 12081 } |
| 10814 | 12082 |
| 10815 /** | 12083 /** |
| 10816 * Return `true` if this expression is computing a right-hand value. | 12084 * Return `true` if this expression is computing a right-hand value. |
| 10817 * | 12085 * |
| 10818 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e | 12086 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e |
| 10819 * they mutually exclusive. In other words, it is possible for both methods to
return `true`when invoked on the same node. | 12087 * they mutually exclusive. In other words, it is possible for both methods to
return `true` |
| 12088 * when invoked on the same node. |
| 12089 * |
| 10820 * @return `true` if this expression is in a context where a getter will be in
voked | 12090 * @return `true` if this expression is in a context where a getter will be in
voked |
| 10821 */ | 12091 */ |
| 10822 bool inGetterContext() { | 12092 bool inGetterContext() { |
| 10823 ASTNode parent = this.parent; | 12093 ASTNode parent = this.parent; |
| 10824 ASTNode target = this; | 12094 ASTNode target = this; |
| 10825 if (parent is PrefixedIdentifier) { | 12095 if (parent is PrefixedIdentifier) { |
| 10826 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; | 12096 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; |
| 10827 if (identical(prefixed.prefix, this)) { | 12097 if (identical(prefixed.prefix, this)) { |
| 10828 return true; | 12098 return true; |
| 10829 } | 12099 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 10846 return false; | 12116 return false; |
| 10847 } | 12117 } |
| 10848 } | 12118 } |
| 10849 return true; | 12119 return true; |
| 10850 } | 12120 } |
| 10851 | 12121 |
| 10852 /** | 12122 /** |
| 10853 * Return `true` if this expression is computing a left-hand value. | 12123 * Return `true` if this expression is computing a left-hand value. |
| 10854 * | 12124 * |
| 10855 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e | 12125 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar
e |
| 10856 * they mutually exclusive. In other words, it is possible for both methods to
return `true`when invoked on the same node. | 12126 * they mutually exclusive. In other words, it is possible for both methods to
return `true` |
| 12127 * when invoked on the same node. |
| 12128 * |
| 10857 * @return `true` if this expression is in a context where a setter will be in
voked | 12129 * @return `true` if this expression is in a context where a setter will be in
voked |
| 10858 */ | 12130 */ |
| 10859 bool inSetterContext() { | 12131 bool inSetterContext() { |
| 10860 ASTNode parent = this.parent; | 12132 ASTNode parent = this.parent; |
| 10861 ASTNode target = this; | 12133 ASTNode target = this; |
| 10862 if (parent is PrefixedIdentifier) { | 12134 if (parent is PrefixedIdentifier) { |
| 10863 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; | 12135 PrefixedIdentifier prefixed = parent as PrefixedIdentifier; |
| 10864 if (identical(prefixed.prefix, this)) { | 12136 if (identical(prefixed.prefix, this)) { |
| 10865 return false; | 12137 return false; |
| 10866 } | 12138 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 10881 } else if (parent is AssignmentExpression) { | 12153 } else if (parent is AssignmentExpression) { |
| 10882 return identical(((parent as AssignmentExpression)).leftHandSide, target); | 12154 return identical(((parent as AssignmentExpression)).leftHandSide, target); |
| 10883 } | 12155 } |
| 10884 return false; | 12156 return false; |
| 10885 } | 12157 } |
| 10886 bool get isSynthetic => _token.isSynthetic; | 12158 bool get isSynthetic => _token.isSynthetic; |
| 10887 | 12159 |
| 10888 /** | 12160 /** |
| 10889 * Set the element associated with this identifier based on propagated type in
formation to the | 12161 * Set the element associated with this identifier based on propagated type in
formation to the |
| 10890 * given element. | 12162 * given element. |
| 12163 * |
| 10891 * @param element the element to be associated with this identifier | 12164 * @param element the element to be associated with this identifier |
| 10892 */ | 12165 */ |
| 10893 void set element(Element element2) { | 12166 void set element(Element element2) { |
| 10894 _propagatedElement = element2; | 12167 _propagatedElement = element2; |
| 10895 } | 12168 } |
| 10896 | 12169 |
| 10897 /** | 12170 /** |
| 10898 * Set the element associated with this identifier based on static type inform
ation to the given | 12171 * Set the element associated with this identifier based on static type inform
ation to the given |
| 10899 * element. | 12172 * element. |
| 12173 * |
| 10900 * @param element the element to be associated with this identifier | 12174 * @param element the element to be associated with this identifier |
| 10901 */ | 12175 */ |
| 10902 void set staticElement(Element element) { | 12176 void set staticElement(Element element) { |
| 10903 _staticElement = element; | 12177 _staticElement = element; |
| 10904 } | 12178 } |
| 10905 | 12179 |
| 10906 /** | 12180 /** |
| 10907 * Set the token representing the identifier to the given token. | 12181 * Set the token representing the identifier to the given token. |
| 12182 * |
| 10908 * @param token the token representing the literal | 12183 * @param token the token representing the literal |
| 10909 */ | 12184 */ |
| 10910 void set token(Token token2) { | 12185 void set token(Token token2) { |
| 10911 this._token = token2; | 12186 this._token = token2; |
| 10912 } | 12187 } |
| 10913 void visitChildren(ASTVisitor<Object> visitor) { | 12188 void visitChildren(ASTVisitor<Object> visitor) { |
| 10914 } | 12189 } |
| 10915 } | 12190 } |
| 10916 /** | 12191 /** |
| 10917 * Instances of the class `SimpleStringLiteral` represent a string literal expre
ssion that | 12192 * Instances of the class `SimpleStringLiteral` represent a string literal expre
ssion that |
| 10918 * does not contain any interpolations. | 12193 * does not contain any interpolations. |
| 12194 * |
| 10919 * <pre> | 12195 * <pre> |
| 10920 * simpleStringLiteral ::= | 12196 * simpleStringLiteral ::= |
| 10921 * rawStringLiteral | 12197 * rawStringLiteral |
| 10922 * | basicStringLiteral | 12198 * | basicStringLiteral |
| 12199 * |
| 10923 * rawStringLiteral ::= | 12200 * rawStringLiteral ::= |
| 10924 * '@' basicStringLiteral | 12201 * '@' basicStringLiteral |
| 12202 * |
| 10925 * simpleStringLiteral ::= | 12203 * simpleStringLiteral ::= |
| 10926 * multiLineStringLiteral | 12204 * multiLineStringLiteral |
| 10927 * | singleLineStringLiteral | 12205 * | singleLineStringLiteral |
| 12206 * |
| 10928 * multiLineStringLiteral ::= | 12207 * multiLineStringLiteral ::= |
| 10929 * "'''" characters "'''" | 12208 * "'''" characters "'''" |
| 10930 * | '"""' characters '"""' | 12209 * | '"""' characters '"""' |
| 12210 * |
| 10931 * singleLineStringLiteral ::= | 12211 * singleLineStringLiteral ::= |
| 10932 * "'" characters "'" | 12212 * "'" characters "'" |
| 10933 * '"' characters '"' | 12213 * '"' characters '"' |
| 10934 * </pre> | 12214 * </pre> |
| 12215 * |
| 10935 * @coverage dart.engine.ast | 12216 * @coverage dart.engine.ast |
| 10936 */ | 12217 */ |
| 10937 class SimpleStringLiteral extends StringLiteral { | 12218 class SimpleStringLiteral extends StringLiteral { |
| 10938 | 12219 |
| 10939 /** | 12220 /** |
| 10940 * The token representing the literal. | 12221 * The token representing the literal. |
| 10941 */ | 12222 */ |
| 10942 Token _literal; | 12223 Token _literal; |
| 10943 | 12224 |
| 10944 /** | 12225 /** |
| 10945 * The value of the literal. | 12226 * The value of the literal. |
| 10946 */ | 12227 */ |
| 10947 String _value; | 12228 String _value; |
| 10948 | 12229 |
| 10949 /** | 12230 /** |
| 10950 * Initialize a newly created simple string literal. | 12231 * Initialize a newly created simple string literal. |
| 12232 * |
| 10951 * @param literal the token representing the literal | 12233 * @param literal the token representing the literal |
| 10952 * @param value the value of the literal | 12234 * @param value the value of the literal |
| 10953 */ | 12235 */ |
| 10954 SimpleStringLiteral.full(Token literal, String value) { | 12236 SimpleStringLiteral.full(Token literal, String value) { |
| 10955 this._literal = literal; | 12237 this._literal = literal; |
| 10956 this._value = StringUtilities.intern(value); | 12238 this._value = StringUtilities.intern(value); |
| 10957 } | 12239 } |
| 10958 | 12240 |
| 10959 /** | 12241 /** |
| 10960 * Initialize a newly created simple string literal. | 12242 * Initialize a newly created simple string literal. |
| 12243 * |
| 10961 * @param literal the token representing the literal | 12244 * @param literal the token representing the literal |
| 10962 * @param value the value of the literal | 12245 * @param value the value of the literal |
| 10963 */ | 12246 */ |
| 10964 SimpleStringLiteral({Token literal, String value}) : this.full(literal, value)
; | 12247 SimpleStringLiteral({Token literal, String value}) : this.full(literal, value)
; |
| 10965 accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this); | 12248 accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this); |
| 10966 Token get beginToken => _literal; | 12249 Token get beginToken => _literal; |
| 10967 Token get endToken => _literal; | 12250 Token get endToken => _literal; |
| 10968 | 12251 |
| 10969 /** | 12252 /** |
| 10970 * Return the token representing the literal. | 12253 * Return the token representing the literal. |
| 12254 * |
| 10971 * @return the token representing the literal | 12255 * @return the token representing the literal |
| 10972 */ | 12256 */ |
| 10973 Token get literal => _literal; | 12257 Token get literal => _literal; |
| 10974 | 12258 |
| 10975 /** | 12259 /** |
| 10976 * Return the value of the literal. | 12260 * Return the value of the literal. |
| 12261 * |
| 10977 * @return the value of the literal | 12262 * @return the value of the literal |
| 10978 */ | 12263 */ |
| 10979 String get value => _value; | 12264 String get value => _value; |
| 10980 | 12265 |
| 10981 /** | 12266 /** |
| 10982 * Return `true` if this string literal is a multi-line string. | 12267 * Return `true` if this string literal is a multi-line string. |
| 12268 * |
| 10983 * @return `true` if this string literal is a multi-line string | 12269 * @return `true` if this string literal is a multi-line string |
| 10984 */ | 12270 */ |
| 10985 bool get isMultiline { | 12271 bool get isMultiline { |
| 10986 if (_value.length < 6) { | 12272 if (_value.length < 6) { |
| 10987 return false; | 12273 return false; |
| 10988 } | 12274 } |
| 10989 return _value.endsWith("\"\"\"") || _value.endsWith("'''"); | 12275 return _value.endsWith("\"\"\"") || _value.endsWith("'''"); |
| 10990 } | 12276 } |
| 10991 | 12277 |
| 10992 /** | 12278 /** |
| 10993 * Return `true` if this string literal is a raw string. | 12279 * Return `true` if this string literal is a raw string. |
| 12280 * |
| 10994 * @return `true` if this string literal is a raw string | 12281 * @return `true` if this string literal is a raw string |
| 10995 */ | 12282 */ |
| 10996 bool get isRaw => _value.codeUnitAt(0) == 0x40; | 12283 bool get isRaw => _value.codeUnitAt(0) == 0x40; |
| 10997 bool get isSynthetic => _literal.isSynthetic; | 12284 bool get isSynthetic => _literal.isSynthetic; |
| 10998 | 12285 |
| 10999 /** | 12286 /** |
| 11000 * Set the token representing the literal to the given token. | 12287 * Set the token representing the literal to the given token. |
| 12288 * |
| 11001 * @param literal the token representing the literal | 12289 * @param literal the token representing the literal |
| 11002 */ | 12290 */ |
| 11003 void set literal(Token literal2) { | 12291 void set literal(Token literal2) { |
| 11004 this._literal = literal2; | 12292 this._literal = literal2; |
| 11005 } | 12293 } |
| 11006 | 12294 |
| 11007 /** | 12295 /** |
| 11008 * Set the value of the literal to the given string. | 12296 * Set the value of the literal to the given string. |
| 12297 * |
| 11009 * @param string the value of the literal | 12298 * @param string the value of the literal |
| 11010 */ | 12299 */ |
| 11011 void set value(String string) { | 12300 void set value(String string) { |
| 11012 _value = StringUtilities.intern(_value); | 12301 _value = StringUtilities.intern(_value); |
| 11013 } | 12302 } |
| 11014 void visitChildren(ASTVisitor<Object> visitor) { | 12303 void visitChildren(ASTVisitor<Object> visitor) { |
| 11015 } | 12304 } |
| 11016 void appendStringValue(JavaStringBuilder builder) { | 12305 void appendStringValue(JavaStringBuilder builder) { |
| 11017 builder.append(value); | 12306 builder.append(value); |
| 11018 } | 12307 } |
| 11019 } | 12308 } |
| 11020 /** | 12309 /** |
| 11021 * Instances of the class `Statement` defines the behavior common to nodes that
represent a | 12310 * Instances of the class `Statement` defines the behavior common to nodes that
represent a |
| 11022 * statement. | 12311 * statement. |
| 12312 * |
| 11023 * <pre> | 12313 * <pre> |
| 11024 * statement ::=[Block block]| [VariableDeclarationStatement initializedVariable
Declaration ';']| [ForStatement forStatement]| [ForEachStatement forEachStatemen
t]| [WhileStatement whileStatement]| [DoStatement doStatement]| [SwitchStatement
switchStatement]| [IfStatement ifStatement]| [TryStatement tryStatement]| [Brea
kStatement breakStatement]| [ContinueStatement continueStatement]| [ReturnStatem
ent returnStatement]| [ExpressionStatement expressionStatement]| [FunctionDeclar
ationStatement functionSignature functionBody]</pre> | 12314 * statement ::= |
| 12315 * [Block] |
| 12316 * | [VariableDeclarationStatement] |
| 12317 * | [ForStatement] |
| 12318 * | [ForEachStatement] |
| 12319 * | [WhileStatement] |
| 12320 * | [DoStatement] |
| 12321 * | [SwitchStatement] |
| 12322 * | [IfStatement] |
| 12323 * | [TryStatement] |
| 12324 * | [BreakStatement] |
| 12325 * | [ContinueStatement] |
| 12326 * | [ReturnStatement] |
| 12327 * | [ExpressionStatement] |
| 12328 * | [FunctionDeclarationStatement] |
| 12329 * </pre> |
| 12330 * |
| 11025 * @coverage dart.engine.ast | 12331 * @coverage dart.engine.ast |
| 11026 */ | 12332 */ |
| 11027 abstract class Statement extends ASTNode { | 12333 abstract class Statement extends ASTNode { |
| 11028 } | 12334 } |
| 11029 /** | 12335 /** |
| 11030 * Instances of the class `StringInterpolation` represent a string interpolation
literal. | 12336 * Instances of the class `StringInterpolation` represent a string interpolation
literal. |
| 12337 * |
| 11031 * <pre> | 12338 * <pre> |
| 11032 * stringInterpolation ::= | 12339 * stringInterpolation ::= |
| 11033 * ''' [InterpolationElement interpolationElement]* ''' | 12340 * ''' [InterpolationElement]* ''' |
| 11034 * | '"' [InterpolationElement interpolationElement]* '"' | 12341 * | '"' [InterpolationElement]* '"' |
| 11035 * </pre> | 12342 * </pre> |
| 12343 * |
| 11036 * @coverage dart.engine.ast | 12344 * @coverage dart.engine.ast |
| 11037 */ | 12345 */ |
| 11038 class StringInterpolation extends StringLiteral { | 12346 class StringInterpolation extends StringLiteral { |
| 11039 | 12347 |
| 11040 /** | 12348 /** |
| 11041 * The elements that will be composed to produce the resulting string. | 12349 * The elements that will be composed to produce the resulting string. |
| 11042 */ | 12350 */ |
| 11043 NodeList<InterpolationElement> _elements; | 12351 NodeList<InterpolationElement> _elements; |
| 11044 | 12352 |
| 11045 /** | 12353 /** |
| 11046 * Initialize a newly created string interpolation expression. | 12354 * Initialize a newly created string interpolation expression. |
| 12355 * |
| 11047 * @param elements the elements that will be composed to produce the resulting
string | 12356 * @param elements the elements that will be composed to produce the resulting
string |
| 11048 */ | 12357 */ |
| 11049 StringInterpolation.full(List<InterpolationElement> elements) { | 12358 StringInterpolation.full(List<InterpolationElement> elements) { |
| 11050 this._elements = new NodeList<InterpolationElement>(this); | 12359 this._elements = new NodeList<InterpolationElement>(this); |
| 11051 this._elements.addAll(elements); | 12360 this._elements.addAll(elements); |
| 11052 } | 12361 } |
| 11053 | 12362 |
| 11054 /** | 12363 /** |
| 11055 * Initialize a newly created string interpolation expression. | 12364 * Initialize a newly created string interpolation expression. |
| 12365 * |
| 11056 * @param elements the elements that will be composed to produce the resulting
string | 12366 * @param elements the elements that will be composed to produce the resulting
string |
| 11057 */ | 12367 */ |
| 11058 StringInterpolation({List<InterpolationElement> elements}) : this.full(element
s); | 12368 StringInterpolation({List<InterpolationElement> elements}) : this.full(element
s); |
| 11059 accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this); | 12369 accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this); |
| 11060 Token get beginToken => _elements.beginToken; | 12370 Token get beginToken => _elements.beginToken; |
| 11061 | 12371 |
| 11062 /** | 12372 /** |
| 11063 * Return the elements that will be composed to produce the resulting string. | 12373 * Return the elements that will be composed to produce the resulting string. |
| 12374 * |
| 11064 * @return the elements that will be composed to produce the resulting string | 12375 * @return the elements that will be composed to produce the resulting string |
| 11065 */ | 12376 */ |
| 11066 NodeList<InterpolationElement> get elements => _elements; | 12377 NodeList<InterpolationElement> get elements => _elements; |
| 11067 Token get endToken => _elements.endToken; | 12378 Token get endToken => _elements.endToken; |
| 11068 void visitChildren(ASTVisitor<Object> visitor) { | 12379 void visitChildren(ASTVisitor<Object> visitor) { |
| 11069 _elements.accept(visitor); | 12380 _elements.accept(visitor); |
| 11070 } | 12381 } |
| 11071 void appendStringValue(JavaStringBuilder builder) { | 12382 void appendStringValue(JavaStringBuilder builder) { |
| 11072 throw new IllegalArgumentException(); | 12383 throw new IllegalArgumentException(); |
| 11073 } | 12384 } |
| 11074 } | 12385 } |
| 11075 /** | 12386 /** |
| 11076 * Instances of the class `StringLiteral` represent a string literal expression. | 12387 * Instances of the class `StringLiteral` represent a string literal expression. |
| 12388 * |
| 11077 * <pre> | 12389 * <pre> |
| 11078 * stringLiteral ::=[SimpleStringLiteral simpleStringLiteral]| [AdjacentStrings
adjacentStrings]| [StringInterpolation stringInterpolation]</pre> | 12390 * stringLiteral ::= |
| 12391 * [SimpleStringLiteral] |
| 12392 * | [AdjacentStrings] |
| 12393 * | [StringInterpolation] |
| 12394 * </pre> |
| 12395 * |
| 11079 * @coverage dart.engine.ast | 12396 * @coverage dart.engine.ast |
| 11080 */ | 12397 */ |
| 11081 abstract class StringLiteral extends Literal { | 12398 abstract class StringLiteral extends Literal { |
| 11082 | 12399 |
| 11083 /** | 12400 /** |
| 11084 * Return the value of the string literal, or `null` if the string is not a co
nstant string | 12401 * Return the value of the string literal, or `null` if the string is not a co
nstant string |
| 11085 * without any string interpolation. | 12402 * without any string interpolation. |
| 12403 * |
| 11086 * @return the value of the string literal | 12404 * @return the value of the string literal |
| 11087 */ | 12405 */ |
| 11088 String get stringValue { | 12406 String get stringValue { |
| 11089 JavaStringBuilder builder = new JavaStringBuilder(); | 12407 JavaStringBuilder builder = new JavaStringBuilder(); |
| 11090 try { | 12408 try { |
| 11091 appendStringValue(builder); | 12409 appendStringValue(builder); |
| 11092 } on IllegalArgumentException catch (exception) { | 12410 } on IllegalArgumentException catch (exception) { |
| 11093 return null; | 12411 return null; |
| 11094 } | 12412 } |
| 11095 return builder.toString(); | 12413 return builder.toString(); |
| 11096 } | 12414 } |
| 11097 | 12415 |
| 11098 /** | 12416 /** |
| 11099 * Append the value of the given string literal to the given string builder. | 12417 * Append the value of the given string literal to the given string builder. |
| 12418 * |
| 11100 * @param builder the builder to which the string's value is to be appended | 12419 * @param builder the builder to which the string's value is to be appended |
| 11101 * @throws IllegalArgumentException if the string is not a constant string wit
hout any string | 12420 * @throws IllegalArgumentException if the string is not a constant string wit
hout any string |
| 11102 * interpolation | 12421 * interpolation |
| 11103 */ | 12422 */ |
| 11104 void appendStringValue(JavaStringBuilder builder); | 12423 void appendStringValue(JavaStringBuilder builder); |
| 11105 } | 12424 } |
| 11106 /** | 12425 /** |
| 11107 * Instances of the class `SuperConstructorInvocation` represent the invocation
of a | 12426 * Instances of the class `SuperConstructorInvocation` represent the invocation
of a |
| 11108 * superclass' constructor from within a constructor's initialization list. | 12427 * superclass' constructor from within a constructor's initialization list. |
| 12428 * |
| 11109 * <pre> | 12429 * <pre> |
| 11110 * superInvocation ::= | 12430 * superInvocation ::= |
| 11111 * 'super' ('.' [SimpleIdentifier name])? [ArgumentList argumentList]</pre> | 12431 * 'super' ('.' [SimpleIdentifier])? [ArgumentList] |
| 12432 * </pre> |
| 12433 * |
| 11112 * @coverage dart.engine.ast | 12434 * @coverage dart.engine.ast |
| 11113 */ | 12435 */ |
| 11114 class SuperConstructorInvocation extends ConstructorInitializer { | 12436 class SuperConstructorInvocation extends ConstructorInitializer { |
| 11115 | 12437 |
| 11116 /** | 12438 /** |
| 11117 * The token for the 'super' keyword. | 12439 * The token for the 'super' keyword. |
| 11118 */ | 12440 */ |
| 11119 Token _keyword; | 12441 Token _keyword; |
| 11120 | 12442 |
| 11121 /** | 12443 /** |
| 11122 * The token for the period before the name of the constructor that is being i
nvoked, or`null` if the unnamed constructor is being invoked. | 12444 * The token for the period before the name of the constructor that is being i
nvoked, or |
| 12445 * `null` if the unnamed constructor is being invoked. |
| 11123 */ | 12446 */ |
| 11124 Token _period; | 12447 Token _period; |
| 11125 | 12448 |
| 11126 /** | 12449 /** |
| 11127 * The name of the constructor that is being invoked, or `null` if the unnamed
constructor | 12450 * The name of the constructor that is being invoked, or `null` if the unnamed
constructor |
| 11128 * is being invoked. | 12451 * is being invoked. |
| 11129 */ | 12452 */ |
| 11130 SimpleIdentifier _constructorName; | 12453 SimpleIdentifier _constructorName; |
| 11131 | 12454 |
| 11132 /** | 12455 /** |
| 11133 * The list of arguments to the constructor. | 12456 * The list of arguments to the constructor. |
| 11134 */ | 12457 */ |
| 11135 ArgumentList _argumentList; | 12458 ArgumentList _argumentList; |
| 11136 | 12459 |
| 11137 /** | 12460 /** |
| 11138 * The element associated with the constructor based on static type informatio
n, or `null`if the AST structure has not been resolved or if the constructor cou
ld not be resolved. | 12461 * The element associated with the constructor based on static type informatio
n, or `null` |
| 12462 * if the AST structure has not been resolved or if the constructor could not
be resolved. |
| 11139 */ | 12463 */ |
| 11140 ConstructorElement _staticElement; | 12464 ConstructorElement _staticElement; |
| 11141 | 12465 |
| 11142 /** | 12466 /** |
| 11143 * The element associated with the constructor based on propagated type inform
ation, or `null` if the AST structure has not been | 12467 * The element associated with the constructor based on propagated type inform
ation, or `null` if the AST structure has not been |
| 11144 * resolved or if the constructor could not be resolved. | 12468 * resolved or if the constructor could not be resolved. |
| 11145 */ | 12469 */ |
| 11146 ConstructorElement _propagatedElement; | 12470 ConstructorElement _propagatedElement; |
| 11147 | 12471 |
| 11148 /** | 12472 /** |
| 11149 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given | 12473 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given |
| 11150 * name with the given arguments. | 12474 * name with the given arguments. |
| 12475 * |
| 11151 * @param keyword the token for the 'super' keyword | 12476 * @param keyword the token for the 'super' keyword |
| 11152 * @param period the token for the period before the name of the constructor t
hat is being invoked | 12477 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 11153 * @param constructorName the name of the constructor that is being invoked | 12478 * @param constructorName the name of the constructor that is being invoked |
| 11154 * @param argumentList the list of arguments to the constructor | 12479 * @param argumentList the list of arguments to the constructor |
| 11155 */ | 12480 */ |
| 11156 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier
constructorName, ArgumentList argumentList) { | 12481 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier
constructorName, ArgumentList argumentList) { |
| 11157 this._keyword = keyword; | 12482 this._keyword = keyword; |
| 11158 this._period = period; | 12483 this._period = period; |
| 11159 this._constructorName = becomeParentOf(constructorName); | 12484 this._constructorName = becomeParentOf(constructorName); |
| 11160 this._argumentList = becomeParentOf(argumentList); | 12485 this._argumentList = becomeParentOf(argumentList); |
| 11161 } | 12486 } |
| 11162 | 12487 |
| 11163 /** | 12488 /** |
| 11164 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given | 12489 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given |
| 11165 * name with the given arguments. | 12490 * name with the given arguments. |
| 12491 * |
| 11166 * @param keyword the token for the 'super' keyword | 12492 * @param keyword the token for the 'super' keyword |
| 11167 * @param period the token for the period before the name of the constructor t
hat is being invoked | 12493 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 11168 * @param constructorName the name of the constructor that is being invoked | 12494 * @param constructorName the name of the constructor that is being invoked |
| 11169 * @param argumentList the list of arguments to the constructor | 12495 * @param argumentList the list of arguments to the constructor |
| 11170 */ | 12496 */ |
| 11171 SuperConstructorInvocation({Token keyword, Token period, SimpleIdentifier cons
tructorName, ArgumentList argumentList}) : this.full(keyword, period, constructo
rName, argumentList); | 12497 SuperConstructorInvocation({Token keyword, Token period, SimpleIdentifier cons
tructorName, ArgumentList argumentList}) : this.full(keyword, period, constructo
rName, argumentList); |
| 11172 accept(ASTVisitor visitor) => visitor.visitSuperConstructorInvocation(this); | 12498 accept(ASTVisitor visitor) => visitor.visitSuperConstructorInvocation(this); |
| 11173 | 12499 |
| 11174 /** | 12500 /** |
| 11175 * Return the list of arguments to the constructor. | 12501 * Return the list of arguments to the constructor. |
| 12502 * |
| 11176 * @return the list of arguments to the constructor | 12503 * @return the list of arguments to the constructor |
| 11177 */ | 12504 */ |
| 11178 ArgumentList get argumentList => _argumentList; | 12505 ArgumentList get argumentList => _argumentList; |
| 11179 Token get beginToken => _keyword; | 12506 Token get beginToken => _keyword; |
| 11180 | 12507 |
| 11181 /** | 12508 /** |
| 11182 * Return the name of the constructor that is being invoked, or `null` if the
unnamed | 12509 * Return the name of the constructor that is being invoked, or `null` if the
unnamed |
| 11183 * constructor is being invoked. | 12510 * constructor is being invoked. |
| 12511 * |
| 11184 * @return the name of the constructor that is being invoked | 12512 * @return the name of the constructor that is being invoked |
| 11185 */ | 12513 */ |
| 11186 SimpleIdentifier get constructorName => _constructorName; | 12514 SimpleIdentifier get constructorName => _constructorName; |
| 11187 | 12515 |
| 11188 /** | 12516 /** |
| 11189 * Return the element associated with the constructor based on propagated type
information, or`null` if the AST structure has not been resolved or if the cons
tructor could not be | 12517 * Return the element associated with the constructor based on propagated type
information, or |
| 12518 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 11190 * resolved. | 12519 * resolved. |
| 12520 * |
| 11191 * @return the element associated with the super constructor | 12521 * @return the element associated with the super constructor |
| 11192 */ | 12522 */ |
| 11193 ConstructorElement get element => _propagatedElement; | 12523 ConstructorElement get element => _propagatedElement; |
| 11194 Token get endToken => _argumentList.endToken; | 12524 Token get endToken => _argumentList.endToken; |
| 11195 | 12525 |
| 11196 /** | 12526 /** |
| 11197 * Return the token for the 'super' keyword. | 12527 * Return the token for the 'super' keyword. |
| 12528 * |
| 11198 * @return the token for the 'super' keyword | 12529 * @return the token for the 'super' keyword |
| 11199 */ | 12530 */ |
| 11200 Token get keyword => _keyword; | 12531 Token get keyword => _keyword; |
| 11201 | 12532 |
| 11202 /** | 12533 /** |
| 11203 * Return the token for the period before the name of the constructor that is
being invoked, or`null` if the unnamed constructor is being invoked. | 12534 * Return the token for the period before the name of the constructor that is
being invoked, or |
| 12535 * `null` if the unnamed constructor is being invoked. |
| 12536 * |
| 11204 * @return the token for the period before the name of the constructor that is
being invoked | 12537 * @return the token for the period before the name of the constructor that is
being invoked |
| 11205 */ | 12538 */ |
| 11206 Token get period => _period; | 12539 Token get period => _period; |
| 11207 | 12540 |
| 11208 /** | 12541 /** |
| 11209 * Return the element associated with the constructor based on static type inf
ormation, or`null` if the AST structure has not been resolved or if the construc
tor could not be | 12542 * Return the element associated with the constructor based on static type inf
ormation, or |
| 12543 * `null` if the AST structure has not been resolved or if the constructor cou
ld not be |
| 11210 * resolved. | 12544 * resolved. |
| 12545 * |
| 11211 * @return the element associated with the constructor | 12546 * @return the element associated with the constructor |
| 11212 */ | 12547 */ |
| 11213 ConstructorElement get staticElement => _staticElement; | 12548 ConstructorElement get staticElement => _staticElement; |
| 11214 | 12549 |
| 11215 /** | 12550 /** |
| 11216 * Set the list of arguments to the constructor to the given list. | 12551 * Set the list of arguments to the constructor to the given list. |
| 12552 * |
| 11217 * @param argumentList the list of arguments to the constructor | 12553 * @param argumentList the list of arguments to the constructor |
| 11218 */ | 12554 */ |
| 11219 void set argumentList(ArgumentList argumentList2) { | 12555 void set argumentList(ArgumentList argumentList2) { |
| 11220 this._argumentList = becomeParentOf(argumentList2); | 12556 this._argumentList = becomeParentOf(argumentList2); |
| 11221 } | 12557 } |
| 11222 | 12558 |
| 11223 /** | 12559 /** |
| 11224 * Set the name of the constructor that is being invoked to the given identifi
er. | 12560 * Set the name of the constructor that is being invoked to the given identifi
er. |
| 12561 * |
| 11225 * @param identifier the name of the constructor that is being invoked | 12562 * @param identifier the name of the constructor that is being invoked |
| 11226 */ | 12563 */ |
| 11227 void set constructorName(SimpleIdentifier identifier) { | 12564 void set constructorName(SimpleIdentifier identifier) { |
| 11228 _constructorName = becomeParentOf(identifier); | 12565 _constructorName = becomeParentOf(identifier); |
| 11229 } | 12566 } |
| 11230 | 12567 |
| 11231 /** | 12568 /** |
| 11232 * Set the element associated with the constructor based on propagated type in
formation to the | 12569 * Set the element associated with the constructor based on propagated type in
formation to the |
| 11233 * given element. | 12570 * given element. |
| 12571 * |
| 11234 * @param element the element to be associated with the constructor | 12572 * @param element the element to be associated with the constructor |
| 11235 */ | 12573 */ |
| 11236 void set element(ConstructorElement element2) { | 12574 void set element(ConstructorElement element2) { |
| 11237 _propagatedElement = element2; | 12575 _propagatedElement = element2; |
| 11238 } | 12576 } |
| 11239 | 12577 |
| 11240 /** | 12578 /** |
| 11241 * Set the token for the 'super' keyword to the given token. | 12579 * Set the token for the 'super' keyword to the given token. |
| 12580 * |
| 11242 * @param keyword the token for the 'super' keyword | 12581 * @param keyword the token for the 'super' keyword |
| 11243 */ | 12582 */ |
| 11244 void set keyword(Token keyword2) { | 12583 void set keyword(Token keyword2) { |
| 11245 this._keyword = keyword2; | 12584 this._keyword = keyword2; |
| 11246 } | 12585 } |
| 11247 | 12586 |
| 11248 /** | 12587 /** |
| 11249 * Set the token for the period before the name of the constructor that is bei
ng invoked to the | 12588 * Set the token for the period before the name of the constructor that is bei
ng invoked to the |
| 11250 * given token. | 12589 * given token. |
| 12590 * |
| 11251 * @param period the token for the period before the name of the constructor t
hat is being invoked | 12591 * @param period the token for the period before the name of the constructor t
hat is being invoked |
| 11252 */ | 12592 */ |
| 11253 void set period(Token period2) { | 12593 void set period(Token period2) { |
| 11254 this._period = period2; | 12594 this._period = period2; |
| 11255 } | 12595 } |
| 11256 | 12596 |
| 11257 /** | 12597 /** |
| 11258 * Set the element associated with the constructor based on static type inform
ation to the given | 12598 * Set the element associated with the constructor based on static type inform
ation to the given |
| 11259 * element. | 12599 * element. |
| 12600 * |
| 11260 * @param element the element to be associated with the constructor | 12601 * @param element the element to be associated with the constructor |
| 11261 */ | 12602 */ |
| 11262 void set staticElement(ConstructorElement element) { | 12603 void set staticElement(ConstructorElement element) { |
| 11263 this._staticElement = element; | 12604 this._staticElement = element; |
| 11264 } | 12605 } |
| 11265 void visitChildren(ASTVisitor<Object> visitor) { | 12606 void visitChildren(ASTVisitor<Object> visitor) { |
| 11266 safelyVisitChild(_constructorName, visitor); | 12607 safelyVisitChild(_constructorName, visitor); |
| 11267 safelyVisitChild(_argumentList, visitor); | 12608 safelyVisitChild(_argumentList, visitor); |
| 11268 } | 12609 } |
| 11269 } | 12610 } |
| 11270 /** | 12611 /** |
| 11271 * Instances of the class `SuperExpression` represent a super expression. | 12612 * Instances of the class `SuperExpression` represent a super expression. |
| 12613 * |
| 11272 * <pre> | 12614 * <pre> |
| 11273 * superExpression ::= | 12615 * superExpression ::= |
| 11274 * 'super' | 12616 * 'super' |
| 11275 * </pre> | 12617 * </pre> |
| 12618 * |
| 11276 * @coverage dart.engine.ast | 12619 * @coverage dart.engine.ast |
| 11277 */ | 12620 */ |
| 11278 class SuperExpression extends Expression { | 12621 class SuperExpression extends Expression { |
| 11279 | 12622 |
| 11280 /** | 12623 /** |
| 11281 * The token representing the keyword. | 12624 * The token representing the keyword. |
| 11282 */ | 12625 */ |
| 11283 Token _keyword; | 12626 Token _keyword; |
| 11284 | 12627 |
| 11285 /** | 12628 /** |
| 11286 * Initialize a newly created super expression. | 12629 * Initialize a newly created super expression. |
| 12630 * |
| 11287 * @param keyword the token representing the keyword | 12631 * @param keyword the token representing the keyword |
| 11288 */ | 12632 */ |
| 11289 SuperExpression.full(Token keyword) { | 12633 SuperExpression.full(Token keyword) { |
| 11290 this._keyword = keyword; | 12634 this._keyword = keyword; |
| 11291 } | 12635 } |
| 11292 | 12636 |
| 11293 /** | 12637 /** |
| 11294 * Initialize a newly created super expression. | 12638 * Initialize a newly created super expression. |
| 12639 * |
| 11295 * @param keyword the token representing the keyword | 12640 * @param keyword the token representing the keyword |
| 11296 */ | 12641 */ |
| 11297 SuperExpression({Token keyword}) : this.full(keyword); | 12642 SuperExpression({Token keyword}) : this.full(keyword); |
| 11298 accept(ASTVisitor visitor) => visitor.visitSuperExpression(this); | 12643 accept(ASTVisitor visitor) => visitor.visitSuperExpression(this); |
| 11299 Token get beginToken => _keyword; | 12644 Token get beginToken => _keyword; |
| 11300 Token get endToken => _keyword; | 12645 Token get endToken => _keyword; |
| 11301 | 12646 |
| 11302 /** | 12647 /** |
| 11303 * Return the token representing the keyword. | 12648 * Return the token representing the keyword. |
| 12649 * |
| 11304 * @return the token representing the keyword | 12650 * @return the token representing the keyword |
| 11305 */ | 12651 */ |
| 11306 Token get keyword => _keyword; | 12652 Token get keyword => _keyword; |
| 11307 | 12653 |
| 11308 /** | 12654 /** |
| 11309 * Set the token representing the keyword to the given token. | 12655 * Set the token representing the keyword to the given token. |
| 12656 * |
| 11310 * @param keyword the token representing the keyword | 12657 * @param keyword the token representing the keyword |
| 11311 */ | 12658 */ |
| 11312 void set keyword(Token keyword2) { | 12659 void set keyword(Token keyword2) { |
| 11313 this._keyword = keyword2; | 12660 this._keyword = keyword2; |
| 11314 } | 12661 } |
| 11315 void visitChildren(ASTVisitor<Object> visitor) { | 12662 void visitChildren(ASTVisitor<Object> visitor) { |
| 11316 } | 12663 } |
| 11317 } | 12664 } |
| 11318 /** | 12665 /** |
| 11319 * Instances of the class `SwitchCase` represent the case in a switch statement. | 12666 * Instances of the class `SwitchCase` represent the case in a switch statement. |
| 12667 * |
| 11320 * <pre> | 12668 * <pre> |
| 11321 * switchCase ::=[SimpleIdentifier label]* 'case' [Expression expression] ':' [S
tatement statement]</pre> | 12669 * switchCase ::= |
| 12670 * [SimpleIdentifier]* 'case' [Expression] ':' [Statement]* |
| 12671 * </pre> |
| 12672 * |
| 11322 * @coverage dart.engine.ast | 12673 * @coverage dart.engine.ast |
| 11323 */ | 12674 */ |
| 11324 class SwitchCase extends SwitchMember { | 12675 class SwitchCase extends SwitchMember { |
| 11325 | 12676 |
| 11326 /** | 12677 /** |
| 11327 * The expression controlling whether the statements will be executed. | 12678 * The expression controlling whether the statements will be executed. |
| 11328 */ | 12679 */ |
| 11329 Expression _expression; | 12680 Expression _expression; |
| 11330 | 12681 |
| 11331 /** | 12682 /** |
| 11332 * Initialize a newly created switch case. | 12683 * Initialize a newly created switch case. |
| 12684 * |
| 11333 * @param labels the labels associated with the switch member | 12685 * @param labels the labels associated with the switch member |
| 11334 * @param keyword the token representing the 'case' or 'default' keyword | 12686 * @param keyword the token representing the 'case' or 'default' keyword |
| 11335 * @param expression the expression controlling whether the statements will be
executed | 12687 * @param expression the expression controlling whether the statements will be
executed |
| 11336 * @param colon the colon separating the keyword or the expression from the st
atements | 12688 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11337 * @param statements the statements that will be executed if this switch membe
r is selected | 12689 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11338 */ | 12690 */ |
| 11339 SwitchCase.full(List<Label> labels, Token keyword, Expression expression, Toke
n colon, List<Statement> statements) : super.full(labels, keyword, colon, statem
ents) { | 12691 SwitchCase.full(List<Label> labels, Token keyword, Expression expression, Toke
n colon, List<Statement> statements) : super.full(labels, keyword, colon, statem
ents) { |
| 11340 this._expression = becomeParentOf(expression); | 12692 this._expression = becomeParentOf(expression); |
| 11341 } | 12693 } |
| 11342 | 12694 |
| 11343 /** | 12695 /** |
| 11344 * Initialize a newly created switch case. | 12696 * Initialize a newly created switch case. |
| 12697 * |
| 11345 * @param labels the labels associated with the switch member | 12698 * @param labels the labels associated with the switch member |
| 11346 * @param keyword the token representing the 'case' or 'default' keyword | 12699 * @param keyword the token representing the 'case' or 'default' keyword |
| 11347 * @param expression the expression controlling whether the statements will be
executed | 12700 * @param expression the expression controlling whether the statements will be
executed |
| 11348 * @param colon the colon separating the keyword or the expression from the st
atements | 12701 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11349 * @param statements the statements that will be executed if this switch membe
r is selected | 12702 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11350 */ | 12703 */ |
| 11351 SwitchCase({List<Label> labels, Token keyword, Expression expression, Token co
lon, List<Statement> statements}) : this.full(labels, keyword, expression, colon
, statements); | 12704 SwitchCase({List<Label> labels, Token keyword, Expression expression, Token co
lon, List<Statement> statements}) : this.full(labels, keyword, expression, colon
, statements); |
| 11352 accept(ASTVisitor visitor) => visitor.visitSwitchCase(this); | 12705 accept(ASTVisitor visitor) => visitor.visitSwitchCase(this); |
| 11353 | 12706 |
| 11354 /** | 12707 /** |
| 11355 * Return the expression controlling whether the statements will be executed. | 12708 * Return the expression controlling whether the statements will be executed. |
| 12709 * |
| 11356 * @return the expression controlling whether the statements will be executed | 12710 * @return the expression controlling whether the statements will be executed |
| 11357 */ | 12711 */ |
| 11358 Expression get expression => _expression; | 12712 Expression get expression => _expression; |
| 11359 | 12713 |
| 11360 /** | 12714 /** |
| 11361 * Set the expression controlling whether the statements will be executed to t
he given expression. | 12715 * Set the expression controlling whether the statements will be executed to t
he given expression. |
| 12716 * |
| 11362 * @param expression the expression controlling whether the statements will be
executed | 12717 * @param expression the expression controlling whether the statements will be
executed |
| 11363 */ | 12718 */ |
| 11364 void set expression(Expression expression2) { | 12719 void set expression(Expression expression2) { |
| 11365 this._expression = becomeParentOf(expression2); | 12720 this._expression = becomeParentOf(expression2); |
| 11366 } | 12721 } |
| 11367 void visitChildren(ASTVisitor<Object> visitor) { | 12722 void visitChildren(ASTVisitor<Object> visitor) { |
| 11368 labels.accept(visitor); | 12723 labels.accept(visitor); |
| 11369 safelyVisitChild(_expression, visitor); | 12724 safelyVisitChild(_expression, visitor); |
| 11370 statements.accept(visitor); | 12725 statements.accept(visitor); |
| 11371 } | 12726 } |
| 11372 } | 12727 } |
| 11373 /** | 12728 /** |
| 11374 * Instances of the class `SwitchDefault` represent the default case in a switch
statement. | 12729 * Instances of the class `SwitchDefault` represent the default case in a switch
statement. |
| 12730 * |
| 11375 * <pre> | 12731 * <pre> |
| 11376 * switchDefault ::=[SimpleIdentifier label]* 'default' ':' [Statement statement
]</pre> | 12732 * switchDefault ::= |
| 12733 * [SimpleIdentifier]* 'default' ':' [Statement]* |
| 12734 * </pre> |
| 12735 * |
| 11377 * @coverage dart.engine.ast | 12736 * @coverage dart.engine.ast |
| 11378 */ | 12737 */ |
| 11379 class SwitchDefault extends SwitchMember { | 12738 class SwitchDefault extends SwitchMember { |
| 11380 | 12739 |
| 11381 /** | 12740 /** |
| 11382 * Initialize a newly created switch default. | 12741 * Initialize a newly created switch default. |
| 12742 * |
| 11383 * @param labels the labels associated with the switch member | 12743 * @param labels the labels associated with the switch member |
| 11384 * @param keyword the token representing the 'case' or 'default' keyword | 12744 * @param keyword the token representing the 'case' or 'default' keyword |
| 11385 * @param colon the colon separating the keyword or the expression from the st
atements | 12745 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11386 * @param statements the statements that will be executed if this switch membe
r is selected | 12746 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11387 */ | 12747 */ |
| 11388 SwitchDefault.full(List<Label> labels, Token keyword, Token colon, List<Statem
ent> statements) : super.full(labels, keyword, colon, statements) { | 12748 SwitchDefault.full(List<Label> labels, Token keyword, Token colon, List<Statem
ent> statements) : super.full(labels, keyword, colon, statements) { |
| 11389 } | 12749 } |
| 11390 | 12750 |
| 11391 /** | 12751 /** |
| 11392 * Initialize a newly created switch default. | 12752 * Initialize a newly created switch default. |
| 12753 * |
| 11393 * @param labels the labels associated with the switch member | 12754 * @param labels the labels associated with the switch member |
| 11394 * @param keyword the token representing the 'case' or 'default' keyword | 12755 * @param keyword the token representing the 'case' or 'default' keyword |
| 11395 * @param colon the colon separating the keyword or the expression from the st
atements | 12756 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11396 * @param statements the statements that will be executed if this switch membe
r is selected | 12757 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11397 */ | 12758 */ |
| 11398 SwitchDefault({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); | 12759 SwitchDefault({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); |
| 11399 accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this); | 12760 accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this); |
| 11400 void visitChildren(ASTVisitor<Object> visitor) { | 12761 void visitChildren(ASTVisitor<Object> visitor) { |
| 11401 labels.accept(visitor); | 12762 labels.accept(visitor); |
| 11402 statements.accept(visitor); | 12763 statements.accept(visitor); |
| 11403 } | 12764 } |
| 11404 } | 12765 } |
| 11405 /** | 12766 /** |
| 11406 * The abstract class `SwitchMember` defines the behavior common to objects repr
esenting | 12767 * The abstract class `SwitchMember` defines the behavior common to objects repr
esenting |
| 11407 * elements within a switch statement. | 12768 * elements within a switch statement. |
| 12769 * |
| 11408 * <pre> | 12770 * <pre> |
| 11409 * switchMember ::= | 12771 * switchMember ::= |
| 11410 * switchCase | 12772 * switchCase |
| 11411 * | switchDefault | 12773 * | switchDefault |
| 11412 * </pre> | 12774 * </pre> |
| 12775 * |
| 11413 * @coverage dart.engine.ast | 12776 * @coverage dart.engine.ast |
| 11414 */ | 12777 */ |
| 11415 abstract class SwitchMember extends ASTNode { | 12778 abstract class SwitchMember extends ASTNode { |
| 11416 | 12779 |
| 11417 /** | 12780 /** |
| 11418 * The labels associated with the switch member. | 12781 * The labels associated with the switch member. |
| 11419 */ | 12782 */ |
| 11420 NodeList<Label> _labels; | 12783 NodeList<Label> _labels; |
| 11421 | 12784 |
| 11422 /** | 12785 /** |
| 11423 * The token representing the 'case' or 'default' keyword. | 12786 * The token representing the 'case' or 'default' keyword. |
| 11424 */ | 12787 */ |
| 11425 Token _keyword; | 12788 Token _keyword; |
| 11426 | 12789 |
| 11427 /** | 12790 /** |
| 11428 * The colon separating the keyword or the expression from the statements. | 12791 * The colon separating the keyword or the expression from the statements. |
| 11429 */ | 12792 */ |
| 11430 Token _colon; | 12793 Token _colon; |
| 11431 | 12794 |
| 11432 /** | 12795 /** |
| 11433 * The statements that will be executed if this switch member is selected. | 12796 * The statements that will be executed if this switch member is selected. |
| 11434 */ | 12797 */ |
| 11435 NodeList<Statement> _statements; | 12798 NodeList<Statement> _statements; |
| 11436 | 12799 |
| 11437 /** | 12800 /** |
| 11438 * Initialize a newly created switch member. | 12801 * Initialize a newly created switch member. |
| 12802 * |
| 11439 * @param labels the labels associated with the switch member | 12803 * @param labels the labels associated with the switch member |
| 11440 * @param keyword the token representing the 'case' or 'default' keyword | 12804 * @param keyword the token representing the 'case' or 'default' keyword |
| 11441 * @param colon the colon separating the keyword or the expression from the st
atements | 12805 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11442 * @param statements the statements that will be executed if this switch membe
r is selected | 12806 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11443 */ | 12807 */ |
| 11444 SwitchMember.full(List<Label> labels, Token keyword, Token colon, List<Stateme
nt> statements) { | 12808 SwitchMember.full(List<Label> labels, Token keyword, Token colon, List<Stateme
nt> statements) { |
| 11445 this._labels = new NodeList<Label>(this); | 12809 this._labels = new NodeList<Label>(this); |
| 11446 this._statements = new NodeList<Statement>(this); | 12810 this._statements = new NodeList<Statement>(this); |
| 11447 this._labels.addAll(labels); | 12811 this._labels.addAll(labels); |
| 11448 this._keyword = keyword; | 12812 this._keyword = keyword; |
| 11449 this._colon = colon; | 12813 this._colon = colon; |
| 11450 this._statements.addAll(statements); | 12814 this._statements.addAll(statements); |
| 11451 } | 12815 } |
| 11452 | 12816 |
| 11453 /** | 12817 /** |
| 11454 * Initialize a newly created switch member. | 12818 * Initialize a newly created switch member. |
| 12819 * |
| 11455 * @param labels the labels associated with the switch member | 12820 * @param labels the labels associated with the switch member |
| 11456 * @param keyword the token representing the 'case' or 'default' keyword | 12821 * @param keyword the token representing the 'case' or 'default' keyword |
| 11457 * @param colon the colon separating the keyword or the expression from the st
atements | 12822 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11458 * @param statements the statements that will be executed if this switch membe
r is selected | 12823 * @param statements the statements that will be executed if this switch membe
r is selected |
| 11459 */ | 12824 */ |
| 11460 SwitchMember({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); | 12825 SwitchMember({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); |
| 11461 Token get beginToken { | 12826 Token get beginToken { |
| 11462 if (!_labels.isEmpty) { | 12827 if (!_labels.isEmpty) { |
| 11463 return _labels.beginToken; | 12828 return _labels.beginToken; |
| 11464 } | 12829 } |
| 11465 return _keyword; | 12830 return _keyword; |
| 11466 } | 12831 } |
| 11467 | 12832 |
| 11468 /** | 12833 /** |
| 11469 * Return the colon separating the keyword or the expression from the statemen
ts. | 12834 * Return the colon separating the keyword or the expression from the statemen
ts. |
| 12835 * |
| 11470 * @return the colon separating the keyword or the expression from the stateme
nts | 12836 * @return the colon separating the keyword or the expression from the stateme
nts |
| 11471 */ | 12837 */ |
| 11472 Token get colon => _colon; | 12838 Token get colon => _colon; |
| 11473 Token get endToken { | 12839 Token get endToken { |
| 11474 if (!_statements.isEmpty) { | 12840 if (!_statements.isEmpty) { |
| 11475 return _statements.endToken; | 12841 return _statements.endToken; |
| 11476 } | 12842 } |
| 11477 return _colon; | 12843 return _colon; |
| 11478 } | 12844 } |
| 11479 | 12845 |
| 11480 /** | 12846 /** |
| 11481 * Return the token representing the 'case' or 'default' keyword. | 12847 * Return the token representing the 'case' or 'default' keyword. |
| 12848 * |
| 11482 * @return the token representing the 'case' or 'default' keyword | 12849 * @return the token representing the 'case' or 'default' keyword |
| 11483 */ | 12850 */ |
| 11484 Token get keyword => _keyword; | 12851 Token get keyword => _keyword; |
| 11485 | 12852 |
| 11486 /** | 12853 /** |
| 11487 * Return the labels associated with the switch member. | 12854 * Return the labels associated with the switch member. |
| 12855 * |
| 11488 * @return the labels associated with the switch member | 12856 * @return the labels associated with the switch member |
| 11489 */ | 12857 */ |
| 11490 NodeList<Label> get labels => _labels; | 12858 NodeList<Label> get labels => _labels; |
| 11491 | 12859 |
| 11492 /** | 12860 /** |
| 11493 * Return the statements that will be executed if this switch member is select
ed. | 12861 * Return the statements that will be executed if this switch member is select
ed. |
| 12862 * |
| 11494 * @return the statements that will be executed if this switch member is selec
ted | 12863 * @return the statements that will be executed if this switch member is selec
ted |
| 11495 */ | 12864 */ |
| 11496 NodeList<Statement> get statements => _statements; | 12865 NodeList<Statement> get statements => _statements; |
| 11497 | 12866 |
| 11498 /** | 12867 /** |
| 11499 * Set the colon separating the keyword or the expression from the statements
to the given token. | 12868 * Set the colon separating the keyword or the expression from the statements
to the given token. |
| 12869 * |
| 11500 * @param colon the colon separating the keyword or the expression from the st
atements | 12870 * @param colon the colon separating the keyword or the expression from the st
atements |
| 11501 */ | 12871 */ |
| 11502 void set colon(Token colon2) { | 12872 void set colon(Token colon2) { |
| 11503 this._colon = colon2; | 12873 this._colon = colon2; |
| 11504 } | 12874 } |
| 11505 | 12875 |
| 11506 /** | 12876 /** |
| 11507 * Set the token representing the 'case' or 'default' keyword to the given tok
en. | 12877 * Set the token representing the 'case' or 'default' keyword to the given tok
en. |
| 12878 * |
| 11508 * @param keyword the token representing the 'case' or 'default' keyword | 12879 * @param keyword the token representing the 'case' or 'default' keyword |
| 11509 */ | 12880 */ |
| 11510 void set keyword(Token keyword2) { | 12881 void set keyword(Token keyword2) { |
| 11511 this._keyword = keyword2; | 12882 this._keyword = keyword2; |
| 11512 } | 12883 } |
| 11513 } | 12884 } |
| 11514 /** | 12885 /** |
| 11515 * Instances of the class `SwitchStatement` represent a switch statement. | 12886 * Instances of the class `SwitchStatement` represent a switch statement. |
| 12887 * |
| 11516 * <pre> | 12888 * <pre> |
| 11517 * switchStatement ::= | 12889 * switchStatement ::= |
| 11518 * 'switch' '(' [Expression expression] ')' '{' [SwitchCase switchCase]* [Switch
Default defaultCase]? '}' | 12890 * 'switch' '(' [Expression] ')' '{' [SwitchCase]* [SwitchDefault]? '}' |
| 11519 * </pre> | 12891 * </pre> |
| 12892 * |
| 11520 * @coverage dart.engine.ast | 12893 * @coverage dart.engine.ast |
| 11521 */ | 12894 */ |
| 11522 class SwitchStatement extends Statement { | 12895 class SwitchStatement extends Statement { |
| 11523 | 12896 |
| 11524 /** | 12897 /** |
| 11525 * The token representing the 'switch' keyword. | 12898 * The token representing the 'switch' keyword. |
| 11526 */ | 12899 */ |
| 11527 Token _keyword; | 12900 Token _keyword; |
| 11528 | 12901 |
| 11529 /** | 12902 /** |
| (...skipping 21 matching lines...) Expand all Loading... |
| 11551 */ | 12924 */ |
| 11552 NodeList<SwitchMember> _members; | 12925 NodeList<SwitchMember> _members; |
| 11553 | 12926 |
| 11554 /** | 12927 /** |
| 11555 * The right curly bracket. | 12928 * The right curly bracket. |
| 11556 */ | 12929 */ |
| 11557 Token _rightBracket; | 12930 Token _rightBracket; |
| 11558 | 12931 |
| 11559 /** | 12932 /** |
| 11560 * Initialize a newly created switch statement. | 12933 * Initialize a newly created switch statement. |
| 12934 * |
| 11561 * @param keyword the token representing the 'switch' keyword | 12935 * @param keyword the token representing the 'switch' keyword |
| 11562 * @param leftParenthesis the left parenthesis | 12936 * @param leftParenthesis the left parenthesis |
| 11563 * @param expression the expression used to determine which of the switch memb
ers will be selected | 12937 * @param expression the expression used to determine which of the switch memb
ers will be selected |
| 11564 * @param rightParenthesis the right parenthesis | 12938 * @param rightParenthesis the right parenthesis |
| 11565 * @param leftBracket the left curly bracket | 12939 * @param leftBracket the left curly bracket |
| 11566 * @param members the switch members that can be selected by the expression | 12940 * @param members the switch members that can be selected by the expression |
| 11567 * @param rightBracket the right curly bracket | 12941 * @param rightBracket the right curly bracket |
| 11568 */ | 12942 */ |
| 11569 SwitchStatement.full(Token keyword, Token leftParenthesis, Expression expressi
on, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token
rightBracket) { | 12943 SwitchStatement.full(Token keyword, Token leftParenthesis, Expression expressi
on, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token
rightBracket) { |
| 11570 this._members = new NodeList<SwitchMember>(this); | 12944 this._members = new NodeList<SwitchMember>(this); |
| 11571 this._keyword = keyword; | 12945 this._keyword = keyword; |
| 11572 this._leftParenthesis = leftParenthesis; | 12946 this._leftParenthesis = leftParenthesis; |
| 11573 this._expression = becomeParentOf(expression); | 12947 this._expression = becomeParentOf(expression); |
| 11574 this._rightParenthesis = rightParenthesis; | 12948 this._rightParenthesis = rightParenthesis; |
| 11575 this._leftBracket = leftBracket; | 12949 this._leftBracket = leftBracket; |
| 11576 this._members.addAll(members); | 12950 this._members.addAll(members); |
| 11577 this._rightBracket = rightBracket; | 12951 this._rightBracket = rightBracket; |
| 11578 } | 12952 } |
| 11579 | 12953 |
| 11580 /** | 12954 /** |
| 11581 * Initialize a newly created switch statement. | 12955 * Initialize a newly created switch statement. |
| 12956 * |
| 11582 * @param keyword the token representing the 'switch' keyword | 12957 * @param keyword the token representing the 'switch' keyword |
| 11583 * @param leftParenthesis the left parenthesis | 12958 * @param leftParenthesis the left parenthesis |
| 11584 * @param expression the expression used to determine which of the switch memb
ers will be selected | 12959 * @param expression the expression used to determine which of the switch memb
ers will be selected |
| 11585 * @param rightParenthesis the right parenthesis | 12960 * @param rightParenthesis the right parenthesis |
| 11586 * @param leftBracket the left curly bracket | 12961 * @param leftBracket the left curly bracket |
| 11587 * @param members the switch members that can be selected by the expression | 12962 * @param members the switch members that can be selected by the expression |
| 11588 * @param rightBracket the right curly bracket | 12963 * @param rightBracket the right curly bracket |
| 11589 */ | 12964 */ |
| 11590 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); | 12965 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); |
| 11591 accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this); | 12966 accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this); |
| 11592 Token get beginToken => _keyword; | 12967 Token get beginToken => _keyword; |
| 11593 Token get endToken => _rightBracket; | 12968 Token get endToken => _rightBracket; |
| 11594 | 12969 |
| 11595 /** | 12970 /** |
| 11596 * Return the expression used to determine which of the switch members will be
selected. | 12971 * Return the expression used to determine which of the switch members will be
selected. |
| 12972 * |
| 11597 * @return the expression used to determine which of the switch members will b
e selected | 12973 * @return the expression used to determine which of the switch members will b
e selected |
| 11598 */ | 12974 */ |
| 11599 Expression get expression => _expression; | 12975 Expression get expression => _expression; |
| 11600 | 12976 |
| 11601 /** | 12977 /** |
| 11602 * Return the token representing the 'switch' keyword. | 12978 * Return the token representing the 'switch' keyword. |
| 12979 * |
| 11603 * @return the token representing the 'switch' keyword | 12980 * @return the token representing the 'switch' keyword |
| 11604 */ | 12981 */ |
| 11605 Token get keyword => _keyword; | 12982 Token get keyword => _keyword; |
| 11606 | 12983 |
| 11607 /** | 12984 /** |
| 11608 * Return the left curly bracket. | 12985 * Return the left curly bracket. |
| 12986 * |
| 11609 * @return the left curly bracket | 12987 * @return the left curly bracket |
| 11610 */ | 12988 */ |
| 11611 Token get leftBracket => _leftBracket; | 12989 Token get leftBracket => _leftBracket; |
| 11612 | 12990 |
| 11613 /** | 12991 /** |
| 11614 * Return the left parenthesis. | 12992 * Return the left parenthesis. |
| 12993 * |
| 11615 * @return the left parenthesis | 12994 * @return the left parenthesis |
| 11616 */ | 12995 */ |
| 11617 Token get leftParenthesis => _leftParenthesis; | 12996 Token get leftParenthesis => _leftParenthesis; |
| 11618 | 12997 |
| 11619 /** | 12998 /** |
| 11620 * Return the switch members that can be selected by the expression. | 12999 * Return the switch members that can be selected by the expression. |
| 13000 * |
| 11621 * @return the switch members that can be selected by the expression | 13001 * @return the switch members that can be selected by the expression |
| 11622 */ | 13002 */ |
| 11623 NodeList<SwitchMember> get members => _members; | 13003 NodeList<SwitchMember> get members => _members; |
| 11624 | 13004 |
| 11625 /** | 13005 /** |
| 11626 * Return the right curly bracket. | 13006 * Return the right curly bracket. |
| 13007 * |
| 11627 * @return the right curly bracket | 13008 * @return the right curly bracket |
| 11628 */ | 13009 */ |
| 11629 Token get rightBracket => _rightBracket; | 13010 Token get rightBracket => _rightBracket; |
| 11630 | 13011 |
| 11631 /** | 13012 /** |
| 11632 * Return the right parenthesis. | 13013 * Return the right parenthesis. |
| 13014 * |
| 11633 * @return the right parenthesis | 13015 * @return the right parenthesis |
| 11634 */ | 13016 */ |
| 11635 Token get rightParenthesis => _rightParenthesis; | 13017 Token get rightParenthesis => _rightParenthesis; |
| 11636 | 13018 |
| 11637 /** | 13019 /** |
| 11638 * Set the expression used to determine which of the switch members will be se
lected to the given | 13020 * Set the expression used to determine which of the switch members will be se
lected to the given |
| 11639 * expression. | 13021 * expression. |
| 13022 * |
| 11640 * @param expression the expression used to determine which of the switch memb
ers will be selected | 13023 * @param expression the expression used to determine which of the switch memb
ers will be selected |
| 11641 */ | 13024 */ |
| 11642 void set expression(Expression expression2) { | 13025 void set expression(Expression expression2) { |
| 11643 this._expression = becomeParentOf(expression2); | 13026 this._expression = becomeParentOf(expression2); |
| 11644 } | 13027 } |
| 11645 | 13028 |
| 11646 /** | 13029 /** |
| 11647 * Set the token representing the 'switch' keyword to the given token. | 13030 * Set the token representing the 'switch' keyword to the given token. |
| 13031 * |
| 11648 * @param keyword the token representing the 'switch' keyword | 13032 * @param keyword the token representing the 'switch' keyword |
| 11649 */ | 13033 */ |
| 11650 void set keyword(Token keyword2) { | 13034 void set keyword(Token keyword2) { |
| 11651 this._keyword = keyword2; | 13035 this._keyword = keyword2; |
| 11652 } | 13036 } |
| 11653 | 13037 |
| 11654 /** | 13038 /** |
| 11655 * Set the left curly bracket to the given token. | 13039 * Set the left curly bracket to the given token. |
| 13040 * |
| 11656 * @param leftBracket the left curly bracket | 13041 * @param leftBracket the left curly bracket |
| 11657 */ | 13042 */ |
| 11658 void set leftBracket(Token leftBracket2) { | 13043 void set leftBracket(Token leftBracket2) { |
| 11659 this._leftBracket = leftBracket2; | 13044 this._leftBracket = leftBracket2; |
| 11660 } | 13045 } |
| 11661 | 13046 |
| 11662 /** | 13047 /** |
| 11663 * Set the left parenthesis to the given token. | 13048 * Set the left parenthesis to the given token. |
| 13049 * |
| 11664 * @param leftParenthesis the left parenthesis | 13050 * @param leftParenthesis the left parenthesis |
| 11665 */ | 13051 */ |
| 11666 void set leftParenthesis(Token leftParenthesis2) { | 13052 void set leftParenthesis(Token leftParenthesis2) { |
| 11667 this._leftParenthesis = leftParenthesis2; | 13053 this._leftParenthesis = leftParenthesis2; |
| 11668 } | 13054 } |
| 11669 | 13055 |
| 11670 /** | 13056 /** |
| 11671 * Set the right curly bracket to the given token. | 13057 * Set the right curly bracket to the given token. |
| 13058 * |
| 11672 * @param rightBracket the right curly bracket | 13059 * @param rightBracket the right curly bracket |
| 11673 */ | 13060 */ |
| 11674 void set rightBracket(Token rightBracket2) { | 13061 void set rightBracket(Token rightBracket2) { |
| 11675 this._rightBracket = rightBracket2; | 13062 this._rightBracket = rightBracket2; |
| 11676 } | 13063 } |
| 11677 | 13064 |
| 11678 /** | 13065 /** |
| 11679 * Set the right parenthesis to the given token. | 13066 * Set the right parenthesis to the given token. |
| 13067 * |
| 11680 * @param rightParenthesis the right parenthesis | 13068 * @param rightParenthesis the right parenthesis |
| 11681 */ | 13069 */ |
| 11682 void set rightParenthesis(Token rightParenthesis2) { | 13070 void set rightParenthesis(Token rightParenthesis2) { |
| 11683 this._rightParenthesis = rightParenthesis2; | 13071 this._rightParenthesis = rightParenthesis2; |
| 11684 } | 13072 } |
| 11685 void visitChildren(ASTVisitor<Object> visitor) { | 13073 void visitChildren(ASTVisitor<Object> visitor) { |
| 11686 safelyVisitChild(_expression, visitor); | 13074 safelyVisitChild(_expression, visitor); |
| 11687 _members.accept(visitor); | 13075 _members.accept(visitor); |
| 11688 } | 13076 } |
| 11689 } | 13077 } |
| 11690 /** | 13078 /** |
| 11691 * Instances of the class `ThisExpression` represent a this expression. | 13079 * Instances of the class `ThisExpression` represent a this expression. |
| 13080 * |
| 11692 * <pre> | 13081 * <pre> |
| 11693 * thisExpression ::= | 13082 * thisExpression ::= |
| 11694 * 'this' | 13083 * 'this' |
| 11695 * </pre> | 13084 * </pre> |
| 13085 * |
| 11696 * @coverage dart.engine.ast | 13086 * @coverage dart.engine.ast |
| 11697 */ | 13087 */ |
| 11698 class ThisExpression extends Expression { | 13088 class ThisExpression extends Expression { |
| 11699 | 13089 |
| 11700 /** | 13090 /** |
| 11701 * The token representing the keyword. | 13091 * The token representing the keyword. |
| 11702 */ | 13092 */ |
| 11703 Token _keyword; | 13093 Token _keyword; |
| 11704 | 13094 |
| 11705 /** | 13095 /** |
| 11706 * Initialize a newly created this expression. | 13096 * Initialize a newly created this expression. |
| 13097 * |
| 11707 * @param keyword the token representing the keyword | 13098 * @param keyword the token representing the keyword |
| 11708 */ | 13099 */ |
| 11709 ThisExpression.full(Token keyword) { | 13100 ThisExpression.full(Token keyword) { |
| 11710 this._keyword = keyword; | 13101 this._keyword = keyword; |
| 11711 } | 13102 } |
| 11712 | 13103 |
| 11713 /** | 13104 /** |
| 11714 * Initialize a newly created this expression. | 13105 * Initialize a newly created this expression. |
| 13106 * |
| 11715 * @param keyword the token representing the keyword | 13107 * @param keyword the token representing the keyword |
| 11716 */ | 13108 */ |
| 11717 ThisExpression({Token keyword}) : this.full(keyword); | 13109 ThisExpression({Token keyword}) : this.full(keyword); |
| 11718 accept(ASTVisitor visitor) => visitor.visitThisExpression(this); | 13110 accept(ASTVisitor visitor) => visitor.visitThisExpression(this); |
| 11719 Token get beginToken => _keyword; | 13111 Token get beginToken => _keyword; |
| 11720 Token get endToken => _keyword; | 13112 Token get endToken => _keyword; |
| 11721 | 13113 |
| 11722 /** | 13114 /** |
| 11723 * Return the token representing the keyword. | 13115 * Return the token representing the keyword. |
| 13116 * |
| 11724 * @return the token representing the keyword | 13117 * @return the token representing the keyword |
| 11725 */ | 13118 */ |
| 11726 Token get keyword => _keyword; | 13119 Token get keyword => _keyword; |
| 11727 | 13120 |
| 11728 /** | 13121 /** |
| 11729 * Set the token representing the keyword to the given token. | 13122 * Set the token representing the keyword to the given token. |
| 13123 * |
| 11730 * @param keyword the token representing the keyword | 13124 * @param keyword the token representing the keyword |
| 11731 */ | 13125 */ |
| 11732 void set keyword(Token keyword2) { | 13126 void set keyword(Token keyword2) { |
| 11733 this._keyword = keyword2; | 13127 this._keyword = keyword2; |
| 11734 } | 13128 } |
| 11735 void visitChildren(ASTVisitor<Object> visitor) { | 13129 void visitChildren(ASTVisitor<Object> visitor) { |
| 11736 } | 13130 } |
| 11737 } | 13131 } |
| 11738 /** | 13132 /** |
| 11739 * Instances of the class `ThrowExpression` represent a throw expression. | 13133 * Instances of the class `ThrowExpression` represent a throw expression. |
| 13134 * |
| 11740 * <pre> | 13135 * <pre> |
| 11741 * throwExpression ::= | 13136 * throwExpression ::= |
| 11742 * 'throw' [Expression expression]</pre> | 13137 * 'throw' [Expression] |
| 13138 * </pre> |
| 13139 * |
| 11743 * @coverage dart.engine.ast | 13140 * @coverage dart.engine.ast |
| 11744 */ | 13141 */ |
| 11745 class ThrowExpression extends Expression { | 13142 class ThrowExpression extends Expression { |
| 11746 | 13143 |
| 11747 /** | 13144 /** |
| 11748 * The token representing the 'throw' keyword. | 13145 * The token representing the 'throw' keyword. |
| 11749 */ | 13146 */ |
| 11750 Token _keyword; | 13147 Token _keyword; |
| 11751 | 13148 |
| 11752 /** | 13149 /** |
| 11753 * The expression computing the exception to be thrown. | 13150 * The expression computing the exception to be thrown. |
| 11754 */ | 13151 */ |
| 11755 Expression _expression; | 13152 Expression _expression; |
| 11756 | 13153 |
| 11757 /** | 13154 /** |
| 11758 * Initialize a newly created throw expression. | 13155 * Initialize a newly created throw expression. |
| 13156 * |
| 11759 * @param keyword the token representing the 'throw' keyword | 13157 * @param keyword the token representing the 'throw' keyword |
| 11760 * @param expression the expression computing the exception to be thrown | 13158 * @param expression the expression computing the exception to be thrown |
| 11761 */ | 13159 */ |
| 11762 ThrowExpression.full(Token keyword, Expression expression) { | 13160 ThrowExpression.full(Token keyword, Expression expression) { |
| 11763 this._keyword = keyword; | 13161 this._keyword = keyword; |
| 11764 this._expression = becomeParentOf(expression); | 13162 this._expression = becomeParentOf(expression); |
| 11765 } | 13163 } |
| 11766 | 13164 |
| 11767 /** | 13165 /** |
| 11768 * Initialize a newly created throw expression. | 13166 * Initialize a newly created throw expression. |
| 13167 * |
| 11769 * @param keyword the token representing the 'throw' keyword | 13168 * @param keyword the token representing the 'throw' keyword |
| 11770 * @param expression the expression computing the exception to be thrown | 13169 * @param expression the expression computing the exception to be thrown |
| 11771 */ | 13170 */ |
| 11772 ThrowExpression({Token keyword, Expression expression}) : this.full(keyword, e
xpression); | 13171 ThrowExpression({Token keyword, Expression expression}) : this.full(keyword, e
xpression); |
| 11773 accept(ASTVisitor visitor) => visitor.visitThrowExpression(this); | 13172 accept(ASTVisitor visitor) => visitor.visitThrowExpression(this); |
| 11774 Token get beginToken => _keyword; | 13173 Token get beginToken => _keyword; |
| 11775 Token get endToken { | 13174 Token get endToken { |
| 11776 if (_expression != null) { | 13175 if (_expression != null) { |
| 11777 return _expression.endToken; | 13176 return _expression.endToken; |
| 11778 } | 13177 } |
| 11779 return _keyword; | 13178 return _keyword; |
| 11780 } | 13179 } |
| 11781 | 13180 |
| 11782 /** | 13181 /** |
| 11783 * Return the expression computing the exception to be thrown. | 13182 * Return the expression computing the exception to be thrown. |
| 13183 * |
| 11784 * @return the expression computing the exception to be thrown | 13184 * @return the expression computing the exception to be thrown |
| 11785 */ | 13185 */ |
| 11786 Expression get expression => _expression; | 13186 Expression get expression => _expression; |
| 11787 | 13187 |
| 11788 /** | 13188 /** |
| 11789 * Return the token representing the 'throw' keyword. | 13189 * Return the token representing the 'throw' keyword. |
| 13190 * |
| 11790 * @return the token representing the 'throw' keyword | 13191 * @return the token representing the 'throw' keyword |
| 11791 */ | 13192 */ |
| 11792 Token get keyword => _keyword; | 13193 Token get keyword => _keyword; |
| 11793 | 13194 |
| 11794 /** | 13195 /** |
| 11795 * Set the expression computing the exception to be thrown to the given expres
sion. | 13196 * Set the expression computing the exception to be thrown to the given expres
sion. |
| 13197 * |
| 11796 * @param expression the expression computing the exception to be thrown | 13198 * @param expression the expression computing the exception to be thrown |
| 11797 */ | 13199 */ |
| 11798 void set expression(Expression expression2) { | 13200 void set expression(Expression expression2) { |
| 11799 this._expression = becomeParentOf(expression2); | 13201 this._expression = becomeParentOf(expression2); |
| 11800 } | 13202 } |
| 11801 | 13203 |
| 11802 /** | 13204 /** |
| 11803 * Set the token representing the 'throw' keyword to the given token. | 13205 * Set the token representing the 'throw' keyword to the given token. |
| 13206 * |
| 11804 * @param keyword the token representing the 'throw' keyword | 13207 * @param keyword the token representing the 'throw' keyword |
| 11805 */ | 13208 */ |
| 11806 void set keyword(Token keyword2) { | 13209 void set keyword(Token keyword2) { |
| 11807 this._keyword = keyword2; | 13210 this._keyword = keyword2; |
| 11808 } | 13211 } |
| 11809 void visitChildren(ASTVisitor<Object> visitor) { | 13212 void visitChildren(ASTVisitor<Object> visitor) { |
| 11810 safelyVisitChild(_expression, visitor); | 13213 safelyVisitChild(_expression, visitor); |
| 11811 } | 13214 } |
| 11812 } | 13215 } |
| 11813 /** | 13216 /** |
| 11814 * Instances of the class `TopLevelVariableDeclaration` represent the declaratio
n of one or | 13217 * Instances of the class `TopLevelVariableDeclaration` represent the declaratio
n of one or |
| 11815 * more top-level variables of the same type. | 13218 * more top-level variables of the same type. |
| 13219 * |
| 11816 * <pre> | 13220 * <pre> |
| 11817 * topLevelVariableDeclaration ::= | 13221 * topLevelVariableDeclaration ::= |
| 11818 * ('final' | 'const') type? staticFinalDeclarationList ';' | 13222 * ('final' | 'const') type? staticFinalDeclarationList ';' |
| 11819 * | variableDeclaration ';' | 13223 * | variableDeclaration ';' |
| 11820 * </pre> | 13224 * </pre> |
| 13225 * |
| 11821 * @coverage dart.engine.ast | 13226 * @coverage dart.engine.ast |
| 11822 */ | 13227 */ |
| 11823 class TopLevelVariableDeclaration extends CompilationUnitMember { | 13228 class TopLevelVariableDeclaration extends CompilationUnitMember { |
| 11824 | 13229 |
| 11825 /** | 13230 /** |
| 11826 * The top-level variables being declared. | 13231 * The top-level variables being declared. |
| 11827 */ | 13232 */ |
| 11828 VariableDeclarationList _variableList; | 13233 VariableDeclarationList _variableList; |
| 11829 | 13234 |
| 11830 /** | 13235 /** |
| 11831 * The semicolon terminating the declaration. | 13236 * The semicolon terminating the declaration. |
| 11832 */ | 13237 */ |
| 11833 Token _semicolon; | 13238 Token _semicolon; |
| 11834 | 13239 |
| 11835 /** | 13240 /** |
| 11836 * Initialize a newly created top-level variable declaration. | 13241 * Initialize a newly created top-level variable declaration. |
| 13242 * |
| 11837 * @param comment the documentation comment associated with this variable | 13243 * @param comment the documentation comment associated with this variable |
| 11838 * @param metadata the annotations associated with this variable | 13244 * @param metadata the annotations associated with this variable |
| 11839 * @param variableList the top-level variables being declared | 13245 * @param variableList the top-level variables being declared |
| 11840 * @param semicolon the semicolon terminating the declaration | 13246 * @param semicolon the semicolon terminating the declaration |
| 11841 */ | 13247 */ |
| 11842 TopLevelVariableDeclaration.full(Comment comment, List<Annotation> metadata, V
ariableDeclarationList variableList, Token semicolon) : super.full(comment, meta
data) { | 13248 TopLevelVariableDeclaration.full(Comment comment, List<Annotation> metadata, V
ariableDeclarationList variableList, Token semicolon) : super.full(comment, meta
data) { |
| 11843 this._variableList = becomeParentOf(variableList); | 13249 this._variableList = becomeParentOf(variableList); |
| 11844 this._semicolon = semicolon; | 13250 this._semicolon = semicolon; |
| 11845 } | 13251 } |
| 11846 | 13252 |
| 11847 /** | 13253 /** |
| 11848 * Initialize a newly created top-level variable declaration. | 13254 * Initialize a newly created top-level variable declaration. |
| 13255 * |
| 11849 * @param comment the documentation comment associated with this variable | 13256 * @param comment the documentation comment associated with this variable |
| 11850 * @param metadata the annotations associated with this variable | 13257 * @param metadata the annotations associated with this variable |
| 11851 * @param variableList the top-level variables being declared | 13258 * @param variableList the top-level variables being declared |
| 11852 * @param semicolon the semicolon terminating the declaration | 13259 * @param semicolon the semicolon terminating the declaration |
| 11853 */ | 13260 */ |
| 11854 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia
bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata
, variableList, semicolon); | 13261 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia
bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata
, variableList, semicolon); |
| 11855 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); | 13262 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); |
| 11856 Element get element => null; | 13263 Element get element => null; |
| 11857 Token get endToken => _semicolon; | 13264 Token get endToken => _semicolon; |
| 11858 | 13265 |
| 11859 /** | 13266 /** |
| 11860 * Return the semicolon terminating the declaration. | 13267 * Return the semicolon terminating the declaration. |
| 13268 * |
| 11861 * @return the semicolon terminating the declaration | 13269 * @return the semicolon terminating the declaration |
| 11862 */ | 13270 */ |
| 11863 Token get semicolon => _semicolon; | 13271 Token get semicolon => _semicolon; |
| 11864 | 13272 |
| 11865 /** | 13273 /** |
| 11866 * Return the top-level variables being declared. | 13274 * Return the top-level variables being declared. |
| 13275 * |
| 11867 * @return the top-level variables being declared | 13276 * @return the top-level variables being declared |
| 11868 */ | 13277 */ |
| 11869 VariableDeclarationList get variables => _variableList; | 13278 VariableDeclarationList get variables => _variableList; |
| 11870 | 13279 |
| 11871 /** | 13280 /** |
| 11872 * Set the semicolon terminating the declaration to the given token. | 13281 * Set the semicolon terminating the declaration to the given token. |
| 13282 * |
| 11873 * @param semicolon the semicolon terminating the declaration | 13283 * @param semicolon the semicolon terminating the declaration |
| 11874 */ | 13284 */ |
| 11875 void set semicolon(Token semicolon2) { | 13285 void set semicolon(Token semicolon2) { |
| 11876 this._semicolon = semicolon2; | 13286 this._semicolon = semicolon2; |
| 11877 } | 13287 } |
| 11878 | 13288 |
| 11879 /** | 13289 /** |
| 11880 * Set the top-level variables being declared to the given list of variables. | 13290 * Set the top-level variables being declared to the given list of variables. |
| 13291 * |
| 11881 * @param variableList the top-level variables being declared | 13292 * @param variableList the top-level variables being declared |
| 11882 */ | 13293 */ |
| 11883 void set variables(VariableDeclarationList variableList) { | 13294 void set variables(VariableDeclarationList variableList) { |
| 11884 variableList = becomeParentOf(variableList); | 13295 variableList = becomeParentOf(variableList); |
| 11885 } | 13296 } |
| 11886 void visitChildren(ASTVisitor<Object> visitor) { | 13297 void visitChildren(ASTVisitor<Object> visitor) { |
| 11887 super.visitChildren(visitor); | 13298 super.visitChildren(visitor); |
| 11888 safelyVisitChild(_variableList, visitor); | 13299 safelyVisitChild(_variableList, visitor); |
| 11889 } | 13300 } |
| 11890 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; | 13301 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; |
| 11891 } | 13302 } |
| 11892 /** | 13303 /** |
| 11893 * Instances of the class `TryStatement` represent a try statement. | 13304 * Instances of the class `TryStatement` represent a try statement. |
| 13305 * |
| 11894 * <pre> | 13306 * <pre> |
| 11895 * tryStatement ::= | 13307 * tryStatement ::= |
| 11896 * 'try' [Block block] ([CatchClause catchClause]+ finallyClause? | finallyClaus
e) | 13308 * 'try' [Block] ([CatchClause]+ finallyClause? | finallyClause) |
| 13309 * |
| 11897 * finallyClause ::= | 13310 * finallyClause ::= |
| 11898 * 'finally' [Block block]</pre> | 13311 * 'finally' [Block] |
| 13312 * </pre> |
| 13313 * |
| 11899 * @coverage dart.engine.ast | 13314 * @coverage dart.engine.ast |
| 11900 */ | 13315 */ |
| 11901 class TryStatement extends Statement { | 13316 class TryStatement extends Statement { |
| 11902 | 13317 |
| 11903 /** | 13318 /** |
| 11904 * The token representing the 'try' keyword. | 13319 * The token representing the 'try' keyword. |
| 11905 */ | 13320 */ |
| 11906 Token _tryKeyword; | 13321 Token _tryKeyword; |
| 11907 | 13322 |
| 11908 /** | 13323 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 11922 Token _finallyKeyword; | 13337 Token _finallyKeyword; |
| 11923 | 13338 |
| 11924 /** | 13339 /** |
| 11925 * The finally clause contained in the try statement, or `null` if the stateme
nt does not | 13340 * The finally clause contained in the try statement, or `null` if the stateme
nt does not |
| 11926 * contain a finally clause. | 13341 * contain a finally clause. |
| 11927 */ | 13342 */ |
| 11928 Block _finallyClause; | 13343 Block _finallyClause; |
| 11929 | 13344 |
| 11930 /** | 13345 /** |
| 11931 * Initialize a newly created try statement. | 13346 * Initialize a newly created try statement. |
| 13347 * |
| 11932 * @param tryKeyword the token representing the 'try' keyword | 13348 * @param tryKeyword the token representing the 'try' keyword |
| 11933 * @param body the body of the statement | 13349 * @param body the body of the statement |
| 11934 * @param catchClauses the catch clauses contained in the try statement | 13350 * @param catchClauses the catch clauses contained in the try statement |
| 11935 * @param finallyKeyword the token representing the 'finally' keyword | 13351 * @param finallyKeyword the token representing the 'finally' keyword |
| 11936 * @param finallyClause the finally clause contained in the try statement | 13352 * @param finallyClause the finally clause contained in the try statement |
| 11937 */ | 13353 */ |
| 11938 TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses
, Token finallyKeyword, Block finallyClause) { | 13354 TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses
, Token finallyKeyword, Block finallyClause) { |
| 11939 this._catchClauses = new NodeList<CatchClause>(this); | 13355 this._catchClauses = new NodeList<CatchClause>(this); |
| 11940 this._tryKeyword = tryKeyword; | 13356 this._tryKeyword = tryKeyword; |
| 11941 this._body = becomeParentOf(body); | 13357 this._body = becomeParentOf(body); |
| 11942 this._catchClauses.addAll(catchClauses); | 13358 this._catchClauses.addAll(catchClauses); |
| 11943 this._finallyKeyword = finallyKeyword; | 13359 this._finallyKeyword = finallyKeyword; |
| 11944 this._finallyClause = becomeParentOf(finallyClause); | 13360 this._finallyClause = becomeParentOf(finallyClause); |
| 11945 } | 13361 } |
| 11946 | 13362 |
| 11947 /** | 13363 /** |
| 11948 * Initialize a newly created try statement. | 13364 * Initialize a newly created try statement. |
| 13365 * |
| 11949 * @param tryKeyword the token representing the 'try' keyword | 13366 * @param tryKeyword the token representing the 'try' keyword |
| 11950 * @param body the body of the statement | 13367 * @param body the body of the statement |
| 11951 * @param catchClauses the catch clauses contained in the try statement | 13368 * @param catchClauses the catch clauses contained in the try statement |
| 11952 * @param finallyKeyword the token representing the 'finally' keyword | 13369 * @param finallyKeyword the token representing the 'finally' keyword |
| 11953 * @param finallyClause the finally clause contained in the try statement | 13370 * @param finallyClause the finally clause contained in the try statement |
| 11954 */ | 13371 */ |
| 11955 TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, To
ken finallyKeyword, Block finallyClause}) : this.full(tryKeyword, body, catchCla
uses, finallyKeyword, finallyClause); | 13372 TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, To
ken finallyKeyword, Block finallyClause}) : this.full(tryKeyword, body, catchCla
uses, finallyKeyword, finallyClause); |
| 11956 accept(ASTVisitor visitor) => visitor.visitTryStatement(this); | 13373 accept(ASTVisitor visitor) => visitor.visitTryStatement(this); |
| 11957 Token get beginToken => _tryKeyword; | 13374 Token get beginToken => _tryKeyword; |
| 11958 | 13375 |
| 11959 /** | 13376 /** |
| 11960 * Return the body of the statement. | 13377 * Return the body of the statement. |
| 13378 * |
| 11961 * @return the body of the statement | 13379 * @return the body of the statement |
| 11962 */ | 13380 */ |
| 11963 Block get body => _body; | 13381 Block get body => _body; |
| 11964 | 13382 |
| 11965 /** | 13383 /** |
| 11966 * Return the catch clauses contained in the try statement. | 13384 * Return the catch clauses contained in the try statement. |
| 13385 * |
| 11967 * @return the catch clauses contained in the try statement | 13386 * @return the catch clauses contained in the try statement |
| 11968 */ | 13387 */ |
| 11969 NodeList<CatchClause> get catchClauses => _catchClauses; | 13388 NodeList<CatchClause> get catchClauses => _catchClauses; |
| 11970 Token get endToken { | 13389 Token get endToken { |
| 11971 if (_finallyClause != null) { | 13390 if (_finallyClause != null) { |
| 11972 return _finallyClause.endToken; | 13391 return _finallyClause.endToken; |
| 11973 } else if (_finallyKeyword != null) { | 13392 } else if (_finallyKeyword != null) { |
| 11974 return _finallyKeyword; | 13393 return _finallyKeyword; |
| 11975 } else if (!_catchClauses.isEmpty) { | 13394 } else if (!_catchClauses.isEmpty) { |
| 11976 return _catchClauses.endToken; | 13395 return _catchClauses.endToken; |
| 11977 } | 13396 } |
| 11978 return _body.endToken; | 13397 return _body.endToken; |
| 11979 } | 13398 } |
| 11980 | 13399 |
| 11981 /** | 13400 /** |
| 11982 * Return the finally clause contained in the try statement, or `null` if the
statement does | 13401 * Return the finally clause contained in the try statement, or `null` if the
statement does |
| 11983 * not contain a finally clause. | 13402 * not contain a finally clause. |
| 13403 * |
| 11984 * @return the finally clause contained in the try statement | 13404 * @return the finally clause contained in the try statement |
| 11985 */ | 13405 */ |
| 11986 Block get finallyClause => _finallyClause; | 13406 Block get finallyClause => _finallyClause; |
| 11987 | 13407 |
| 11988 /** | 13408 /** |
| 11989 * Return the token representing the 'finally' keyword, or `null` if the state
ment does not | 13409 * Return the token representing the 'finally' keyword, or `null` if the state
ment does not |
| 11990 * contain a finally clause. | 13410 * contain a finally clause. |
| 13411 * |
| 11991 * @return the token representing the 'finally' keyword | 13412 * @return the token representing the 'finally' keyword |
| 11992 */ | 13413 */ |
| 11993 Token get finallyKeyword => _finallyKeyword; | 13414 Token get finallyKeyword => _finallyKeyword; |
| 11994 | 13415 |
| 11995 /** | 13416 /** |
| 11996 * Return the token representing the 'try' keyword. | 13417 * Return the token representing the 'try' keyword. |
| 13418 * |
| 11997 * @return the token representing the 'try' keyword | 13419 * @return the token representing the 'try' keyword |
| 11998 */ | 13420 */ |
| 11999 Token get tryKeyword => _tryKeyword; | 13421 Token get tryKeyword => _tryKeyword; |
| 12000 | 13422 |
| 12001 /** | 13423 /** |
| 12002 * Set the body of the statement to the given block. | 13424 * Set the body of the statement to the given block. |
| 13425 * |
| 12003 * @param block the body of the statement | 13426 * @param block the body of the statement |
| 12004 */ | 13427 */ |
| 12005 void set body(Block block) { | 13428 void set body(Block block) { |
| 12006 _body = becomeParentOf(block); | 13429 _body = becomeParentOf(block); |
| 12007 } | 13430 } |
| 12008 | 13431 |
| 12009 /** | 13432 /** |
| 12010 * Set the finally clause contained in the try statement to the given block. | 13433 * Set the finally clause contained in the try statement to the given block. |
| 13434 * |
| 12011 * @param block the finally clause contained in the try statement | 13435 * @param block the finally clause contained in the try statement |
| 12012 */ | 13436 */ |
| 12013 void set finallyClause(Block block) { | 13437 void set finallyClause(Block block) { |
| 12014 _finallyClause = becomeParentOf(block); | 13438 _finallyClause = becomeParentOf(block); |
| 12015 } | 13439 } |
| 12016 | 13440 |
| 12017 /** | 13441 /** |
| 12018 * Set the token representing the 'finally' keyword to the given token. | 13442 * Set the token representing the 'finally' keyword to the given token. |
| 13443 * |
| 12019 * @param finallyKeyword the token representing the 'finally' keyword | 13444 * @param finallyKeyword the token representing the 'finally' keyword |
| 12020 */ | 13445 */ |
| 12021 void set finallyKeyword(Token finallyKeyword2) { | 13446 void set finallyKeyword(Token finallyKeyword2) { |
| 12022 this._finallyKeyword = finallyKeyword2; | 13447 this._finallyKeyword = finallyKeyword2; |
| 12023 } | 13448 } |
| 12024 | 13449 |
| 12025 /** | 13450 /** |
| 12026 * Set the token representing the 'try' keyword to the given token. | 13451 * Set the token representing the 'try' keyword to the given token. |
| 13452 * |
| 12027 * @param tryKeyword the token representing the 'try' keyword | 13453 * @param tryKeyword the token representing the 'try' keyword |
| 12028 */ | 13454 */ |
| 12029 void set tryKeyword(Token tryKeyword2) { | 13455 void set tryKeyword(Token tryKeyword2) { |
| 12030 this._tryKeyword = tryKeyword2; | 13456 this._tryKeyword = tryKeyword2; |
| 12031 } | 13457 } |
| 12032 void visitChildren(ASTVisitor<Object> visitor) { | 13458 void visitChildren(ASTVisitor<Object> visitor) { |
| 12033 safelyVisitChild(_body, visitor); | 13459 safelyVisitChild(_body, visitor); |
| 12034 _catchClauses.accept(visitor); | 13460 _catchClauses.accept(visitor); |
| 12035 safelyVisitChild(_finallyClause, visitor); | 13461 safelyVisitChild(_finallyClause, visitor); |
| 12036 } | 13462 } |
| 12037 } | 13463 } |
| 12038 /** | 13464 /** |
| 12039 * The abstract class `TypeAlias` defines the behavior common to declarations of
type aliases. | 13465 * The abstract class `TypeAlias` defines the behavior common to declarations of
type aliases. |
| 13466 * |
| 12040 * <pre> | 13467 * <pre> |
| 12041 * typeAlias ::= | 13468 * typeAlias ::= |
| 12042 * 'typedef' typeAliasBody | 13469 * 'typedef' typeAliasBody |
| 13470 * |
| 12043 * typeAliasBody ::= | 13471 * typeAliasBody ::= |
| 12044 * classTypeAlias | 13472 * classTypeAlias |
| 12045 * | functionTypeAlias | 13473 * | functionTypeAlias |
| 12046 * </pre> | 13474 * </pre> |
| 13475 * |
| 12047 * @coverage dart.engine.ast | 13476 * @coverage dart.engine.ast |
| 12048 */ | 13477 */ |
| 12049 abstract class TypeAlias extends CompilationUnitMember { | 13478 abstract class TypeAlias extends CompilationUnitMember { |
| 12050 | 13479 |
| 12051 /** | 13480 /** |
| 12052 * The token representing the 'typedef' keyword. | 13481 * The token representing the 'typedef' keyword. |
| 12053 */ | 13482 */ |
| 12054 Token _keyword; | 13483 Token _keyword; |
| 12055 | 13484 |
| 12056 /** | 13485 /** |
| 12057 * The semicolon terminating the declaration. | 13486 * The semicolon terminating the declaration. |
| 12058 */ | 13487 */ |
| 12059 Token _semicolon; | 13488 Token _semicolon; |
| 12060 | 13489 |
| 12061 /** | 13490 /** |
| 12062 * Initialize a newly created type alias. | 13491 * Initialize a newly created type alias. |
| 13492 * |
| 12063 * @param comment the documentation comment associated with this type alias | 13493 * @param comment the documentation comment associated with this type alias |
| 12064 * @param metadata the annotations associated with this type alias | 13494 * @param metadata the annotations associated with this type alias |
| 12065 * @param keyword the token representing the 'typedef' keyword | 13495 * @param keyword the token representing the 'typedef' keyword |
| 12066 * @param semicolon the semicolon terminating the declaration | 13496 * @param semicolon the semicolon terminating the declaration |
| 12067 */ | 13497 */ |
| 12068 TypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, Toke
n semicolon) : super.full(comment, metadata) { | 13498 TypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, Toke
n semicolon) : super.full(comment, metadata) { |
| 12069 this._keyword = keyword; | 13499 this._keyword = keyword; |
| 12070 this._semicolon = semicolon; | 13500 this._semicolon = semicolon; |
| 12071 } | 13501 } |
| 12072 | 13502 |
| 12073 /** | 13503 /** |
| 12074 * Initialize a newly created type alias. | 13504 * Initialize a newly created type alias. |
| 13505 * |
| 12075 * @param comment the documentation comment associated with this type alias | 13506 * @param comment the documentation comment associated with this type alias |
| 12076 * @param metadata the annotations associated with this type alias | 13507 * @param metadata the annotations associated with this type alias |
| 12077 * @param keyword the token representing the 'typedef' keyword | 13508 * @param keyword the token representing the 'typedef' keyword |
| 12078 * @param semicolon the semicolon terminating the declaration | 13509 * @param semicolon the semicolon terminating the declaration |
| 12079 */ | 13510 */ |
| 12080 TypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Token se
micolon}) : this.full(comment, metadata, keyword, semicolon); | 13511 TypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Token se
micolon}) : this.full(comment, metadata, keyword, semicolon); |
| 12081 Token get endToken => _semicolon; | 13512 Token get endToken => _semicolon; |
| 12082 | 13513 |
| 12083 /** | 13514 /** |
| 12084 * Return the token representing the 'typedef' keyword. | 13515 * Return the token representing the 'typedef' keyword. |
| 13516 * |
| 12085 * @return the token representing the 'typedef' keyword | 13517 * @return the token representing the 'typedef' keyword |
| 12086 */ | 13518 */ |
| 12087 Token get keyword => _keyword; | 13519 Token get keyword => _keyword; |
| 12088 | 13520 |
| 12089 /** | 13521 /** |
| 12090 * Return the semicolon terminating the declaration. | 13522 * Return the semicolon terminating the declaration. |
| 13523 * |
| 12091 * @return the semicolon terminating the declaration | 13524 * @return the semicolon terminating the declaration |
| 12092 */ | 13525 */ |
| 12093 Token get semicolon => _semicolon; | 13526 Token get semicolon => _semicolon; |
| 12094 | 13527 |
| 12095 /** | 13528 /** |
| 12096 * Set the token representing the 'typedef' keyword to the given token. | 13529 * Set the token representing the 'typedef' keyword to the given token. |
| 13530 * |
| 12097 * @param keyword the token representing the 'typedef' keyword | 13531 * @param keyword the token representing the 'typedef' keyword |
| 12098 */ | 13532 */ |
| 12099 void set keyword(Token keyword2) { | 13533 void set keyword(Token keyword2) { |
| 12100 this._keyword = keyword2; | 13534 this._keyword = keyword2; |
| 12101 } | 13535 } |
| 12102 | 13536 |
| 12103 /** | 13537 /** |
| 12104 * Set the semicolon terminating the declaration to the given token. | 13538 * Set the semicolon terminating the declaration to the given token. |
| 13539 * |
| 12105 * @param semicolon the semicolon terminating the declaration | 13540 * @param semicolon the semicolon terminating the declaration |
| 12106 */ | 13541 */ |
| 12107 void set semicolon(Token semicolon2) { | 13542 void set semicolon(Token semicolon2) { |
| 12108 this._semicolon = semicolon2; | 13543 this._semicolon = semicolon2; |
| 12109 } | 13544 } |
| 12110 Token get firstTokenAfterCommentAndMetadata => _keyword; | 13545 Token get firstTokenAfterCommentAndMetadata => _keyword; |
| 12111 } | 13546 } |
| 12112 /** | 13547 /** |
| 12113 * Instances of the class `TypeArgumentList` represent a list of type arguments. | 13548 * Instances of the class `TypeArgumentList` represent a list of type arguments. |
| 13549 * |
| 12114 * <pre> | 13550 * <pre> |
| 12115 * typeArguments ::= | 13551 * typeArguments ::= |
| 12116 * '<' typeName (',' typeName)* '>' | 13552 * '<' typeName (',' typeName)* '>' |
| 12117 * </pre> | 13553 * </pre> |
| 13554 * |
| 12118 * @coverage dart.engine.ast | 13555 * @coverage dart.engine.ast |
| 12119 */ | 13556 */ |
| 12120 class TypeArgumentList extends ASTNode { | 13557 class TypeArgumentList extends ASTNode { |
| 12121 | 13558 |
| 12122 /** | 13559 /** |
| 12123 * The left bracket. | 13560 * The left bracket. |
| 12124 */ | 13561 */ |
| 12125 Token _leftBracket; | 13562 Token _leftBracket; |
| 12126 | 13563 |
| 12127 /** | 13564 /** |
| 12128 * The type arguments associated with the type. | 13565 * The type arguments associated with the type. |
| 12129 */ | 13566 */ |
| 12130 NodeList<TypeName> _arguments; | 13567 NodeList<TypeName> _arguments; |
| 12131 | 13568 |
| 12132 /** | 13569 /** |
| 12133 * The right bracket. | 13570 * The right bracket. |
| 12134 */ | 13571 */ |
| 12135 Token _rightBracket; | 13572 Token _rightBracket; |
| 12136 | 13573 |
| 12137 /** | 13574 /** |
| 12138 * Initialize a newly created list of type arguments. | 13575 * Initialize a newly created list of type arguments. |
| 13576 * |
| 12139 * @param leftBracket the left bracket | 13577 * @param leftBracket the left bracket |
| 12140 * @param arguments the type arguments associated with the type | 13578 * @param arguments the type arguments associated with the type |
| 12141 * @param rightBracket the right bracket | 13579 * @param rightBracket the right bracket |
| 12142 */ | 13580 */ |
| 12143 TypeArgumentList.full(Token leftBracket, List<TypeName> arguments, Token right
Bracket) { | 13581 TypeArgumentList.full(Token leftBracket, List<TypeName> arguments, Token right
Bracket) { |
| 12144 this._arguments = new NodeList<TypeName>(this); | 13582 this._arguments = new NodeList<TypeName>(this); |
| 12145 this._leftBracket = leftBracket; | 13583 this._leftBracket = leftBracket; |
| 12146 this._arguments.addAll(arguments); | 13584 this._arguments.addAll(arguments); |
| 12147 this._rightBracket = rightBracket; | 13585 this._rightBracket = rightBracket; |
| 12148 } | 13586 } |
| 12149 | 13587 |
| 12150 /** | 13588 /** |
| 12151 * Initialize a newly created list of type arguments. | 13589 * Initialize a newly created list of type arguments. |
| 13590 * |
| 12152 * @param leftBracket the left bracket | 13591 * @param leftBracket the left bracket |
| 12153 * @param arguments the type arguments associated with the type | 13592 * @param arguments the type arguments associated with the type |
| 12154 * @param rightBracket the right bracket | 13593 * @param rightBracket the right bracket |
| 12155 */ | 13594 */ |
| 12156 TypeArgumentList({Token leftBracket, List<TypeName> arguments, Token rightBrac
ket}) : this.full(leftBracket, arguments, rightBracket); | 13595 TypeArgumentList({Token leftBracket, List<TypeName> arguments, Token rightBrac
ket}) : this.full(leftBracket, arguments, rightBracket); |
| 12157 accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this); | 13596 accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this); |
| 12158 | 13597 |
| 12159 /** | 13598 /** |
| 12160 * Return the type arguments associated with the type. | 13599 * Return the type arguments associated with the type. |
| 13600 * |
| 12161 * @return the type arguments associated with the type | 13601 * @return the type arguments associated with the type |
| 12162 */ | 13602 */ |
| 12163 NodeList<TypeName> get arguments => _arguments; | 13603 NodeList<TypeName> get arguments => _arguments; |
| 12164 Token get beginToken => _leftBracket; | 13604 Token get beginToken => _leftBracket; |
| 12165 Token get endToken => _rightBracket; | 13605 Token get endToken => _rightBracket; |
| 12166 | 13606 |
| 12167 /** | 13607 /** |
| 12168 * Return the left bracket. | 13608 * Return the left bracket. |
| 13609 * |
| 12169 * @return the left bracket | 13610 * @return the left bracket |
| 12170 */ | 13611 */ |
| 12171 Token get leftBracket => _leftBracket; | 13612 Token get leftBracket => _leftBracket; |
| 12172 | 13613 |
| 12173 /** | 13614 /** |
| 12174 * Return the right bracket. | 13615 * Return the right bracket. |
| 13616 * |
| 12175 * @return the right bracket | 13617 * @return the right bracket |
| 12176 */ | 13618 */ |
| 12177 Token get rightBracket => _rightBracket; | 13619 Token get rightBracket => _rightBracket; |
| 12178 | 13620 |
| 12179 /** | 13621 /** |
| 12180 * Set the left bracket to the given token. | 13622 * Set the left bracket to the given token. |
| 13623 * |
| 12181 * @param leftBracket the left bracket | 13624 * @param leftBracket the left bracket |
| 12182 */ | 13625 */ |
| 12183 void set leftBracket(Token leftBracket2) { | 13626 void set leftBracket(Token leftBracket2) { |
| 12184 this._leftBracket = leftBracket2; | 13627 this._leftBracket = leftBracket2; |
| 12185 } | 13628 } |
| 12186 | 13629 |
| 12187 /** | 13630 /** |
| 12188 * Set the right bracket to the given token. | 13631 * Set the right bracket to the given token. |
| 13632 * |
| 12189 * @param rightBracket the right bracket | 13633 * @param rightBracket the right bracket |
| 12190 */ | 13634 */ |
| 12191 void set rightBracket(Token rightBracket2) { | 13635 void set rightBracket(Token rightBracket2) { |
| 12192 this._rightBracket = rightBracket2; | 13636 this._rightBracket = rightBracket2; |
| 12193 } | 13637 } |
| 12194 void visitChildren(ASTVisitor<Object> visitor) { | 13638 void visitChildren(ASTVisitor<Object> visitor) { |
| 12195 _arguments.accept(visitor); | 13639 _arguments.accept(visitor); |
| 12196 } | 13640 } |
| 12197 } | 13641 } |
| 12198 /** | 13642 /** |
| 12199 * Instances of the class `TypeName` represent the name of a type, which can opt
ionally | 13643 * Instances of the class `TypeName` represent the name of a type, which can opt
ionally |
| 12200 * include type arguments. | 13644 * include type arguments. |
| 13645 * |
| 12201 * <pre> | 13646 * <pre> |
| 12202 * typeName ::=[Identifier identifier] typeArguments? | 13647 * typeName ::= |
| 13648 * [Identifier] typeArguments? |
| 12203 * </pre> | 13649 * </pre> |
| 13650 * |
| 12204 * @coverage dart.engine.ast | 13651 * @coverage dart.engine.ast |
| 12205 */ | 13652 */ |
| 12206 class TypeName extends ASTNode { | 13653 class TypeName extends ASTNode { |
| 12207 | 13654 |
| 12208 /** | 13655 /** |
| 12209 * The name of the type. | 13656 * The name of the type. |
| 12210 */ | 13657 */ |
| 12211 Identifier _name; | 13658 Identifier _name; |
| 12212 | 13659 |
| 12213 /** | 13660 /** |
| 12214 * The type arguments associated with the type, or `null` if there are no type
arguments. | 13661 * The type arguments associated with the type, or `null` if there are no type
arguments. |
| 12215 */ | 13662 */ |
| 12216 TypeArgumentList _typeArguments; | 13663 TypeArgumentList _typeArguments; |
| 12217 | 13664 |
| 12218 /** | 13665 /** |
| 12219 * The type being named, or `null` if the AST structure has not been resolved. | 13666 * The type being named, or `null` if the AST structure has not been resolved. |
| 12220 */ | 13667 */ |
| 12221 Type2 _type; | 13668 Type2 _type; |
| 12222 | 13669 |
| 12223 /** | 13670 /** |
| 12224 * Initialize a newly created type name. | 13671 * Initialize a newly created type name. |
| 13672 * |
| 12225 * @param name the name of the type | 13673 * @param name the name of the type |
| 12226 * @param typeArguments the type arguments associated with the type, or `null`
if there are | 13674 * @param typeArguments the type arguments associated with the type, or `null`
if there are |
| 12227 * no type arguments | 13675 * no type arguments |
| 12228 */ | 13676 */ |
| 12229 TypeName.full(Identifier name, TypeArgumentList typeArguments) { | 13677 TypeName.full(Identifier name, TypeArgumentList typeArguments) { |
| 12230 this._name = becomeParentOf(name); | 13678 this._name = becomeParentOf(name); |
| 12231 this._typeArguments = becomeParentOf(typeArguments); | 13679 this._typeArguments = becomeParentOf(typeArguments); |
| 12232 } | 13680 } |
| 12233 | 13681 |
| 12234 /** | 13682 /** |
| 12235 * Initialize a newly created type name. | 13683 * Initialize a newly created type name. |
| 13684 * |
| 12236 * @param name the name of the type | 13685 * @param name the name of the type |
| 12237 * @param typeArguments the type arguments associated with the type, or `null`
if there are | 13686 * @param typeArguments the type arguments associated with the type, or `null`
if there are |
| 12238 * no type arguments | 13687 * no type arguments |
| 12239 */ | 13688 */ |
| 12240 TypeName({Identifier name, TypeArgumentList typeArguments}) : this.full(name,
typeArguments); | 13689 TypeName({Identifier name, TypeArgumentList typeArguments}) : this.full(name,
typeArguments); |
| 12241 accept(ASTVisitor visitor) => visitor.visitTypeName(this); | 13690 accept(ASTVisitor visitor) => visitor.visitTypeName(this); |
| 12242 Token get beginToken => _name.beginToken; | 13691 Token get beginToken => _name.beginToken; |
| 12243 Token get endToken { | 13692 Token get endToken { |
| 12244 if (_typeArguments != null) { | 13693 if (_typeArguments != null) { |
| 12245 return _typeArguments.endToken; | 13694 return _typeArguments.endToken; |
| 12246 } | 13695 } |
| 12247 return _name.endToken; | 13696 return _name.endToken; |
| 12248 } | 13697 } |
| 12249 | 13698 |
| 12250 /** | 13699 /** |
| 12251 * Return the name of the type. | 13700 * Return the name of the type. |
| 13701 * |
| 12252 * @return the name of the type | 13702 * @return the name of the type |
| 12253 */ | 13703 */ |
| 12254 Identifier get name => _name; | 13704 Identifier get name => _name; |
| 12255 | 13705 |
| 12256 /** | 13706 /** |
| 12257 * Return the type being named, or `null` if the AST structure has not been re
solved. | 13707 * Return the type being named, or `null` if the AST structure has not been re
solved. |
| 13708 * |
| 12258 * @return the type being named | 13709 * @return the type being named |
| 12259 */ | 13710 */ |
| 12260 Type2 get type => _type; | 13711 Type2 get type => _type; |
| 12261 | 13712 |
| 12262 /** | 13713 /** |
| 12263 * Return the type arguments associated with the type, or `null` if there are
no type | 13714 * Return the type arguments associated with the type, or `null` if there are
no type |
| 12264 * arguments. | 13715 * arguments. |
| 13716 * |
| 12265 * @return the type arguments associated with the type | 13717 * @return the type arguments associated with the type |
| 12266 */ | 13718 */ |
| 12267 TypeArgumentList get typeArguments => _typeArguments; | 13719 TypeArgumentList get typeArguments => _typeArguments; |
| 12268 bool get isSynthetic => _name.isSynthetic && _typeArguments == null; | 13720 bool get isSynthetic => _name.isSynthetic && _typeArguments == null; |
| 12269 | 13721 |
| 12270 /** | 13722 /** |
| 12271 * Set the name of the type to the given identifier. | 13723 * Set the name of the type to the given identifier. |
| 13724 * |
| 12272 * @param identifier the name of the type | 13725 * @param identifier the name of the type |
| 12273 */ | 13726 */ |
| 12274 void set name(Identifier identifier) { | 13727 void set name(Identifier identifier) { |
| 12275 _name = becomeParentOf(identifier); | 13728 _name = becomeParentOf(identifier); |
| 12276 } | 13729 } |
| 12277 | 13730 |
| 12278 /** | 13731 /** |
| 12279 * Set the type being named to the given type. | 13732 * Set the type being named to the given type. |
| 13733 * |
| 12280 * @param type the type being named | 13734 * @param type the type being named |
| 12281 */ | 13735 */ |
| 12282 void set type(Type2 type2) { | 13736 void set type(Type2 type2) { |
| 12283 this._type = type2; | 13737 this._type = type2; |
| 12284 } | 13738 } |
| 12285 | 13739 |
| 12286 /** | 13740 /** |
| 12287 * Set the type arguments associated with the type to the given type arguments
. | 13741 * Set the type arguments associated with the type to the given type arguments
. |
| 13742 * |
| 12288 * @param typeArguments the type arguments associated with the type | 13743 * @param typeArguments the type arguments associated with the type |
| 12289 */ | 13744 */ |
| 12290 void set typeArguments(TypeArgumentList typeArguments2) { | 13745 void set typeArguments(TypeArgumentList typeArguments2) { |
| 12291 this._typeArguments = becomeParentOf(typeArguments2); | 13746 this._typeArguments = becomeParentOf(typeArguments2); |
| 12292 } | 13747 } |
| 12293 void visitChildren(ASTVisitor<Object> visitor) { | 13748 void visitChildren(ASTVisitor<Object> visitor) { |
| 12294 safelyVisitChild(_name, visitor); | 13749 safelyVisitChild(_name, visitor); |
| 12295 safelyVisitChild(_typeArguments, visitor); | 13750 safelyVisitChild(_typeArguments, visitor); |
| 12296 } | 13751 } |
| 12297 } | 13752 } |
| 12298 /** | 13753 /** |
| 12299 * Instances of the class `TypeParameter` represent a type parameter. | 13754 * Instances of the class `TypeParameter` represent a type parameter. |
| 13755 * |
| 12300 * <pre> | 13756 * <pre> |
| 12301 * typeParameter ::=[SimpleIdentifier name] ('extends' [TypeName bound])? | 13757 * typeParameter ::= |
| 13758 * [SimpleIdentifier] ('extends' [TypeName])? |
| 12302 * </pre> | 13759 * </pre> |
| 13760 * |
| 12303 * @coverage dart.engine.ast | 13761 * @coverage dart.engine.ast |
| 12304 */ | 13762 */ |
| 12305 class TypeParameter extends Declaration { | 13763 class TypeParameter extends Declaration { |
| 12306 | 13764 |
| 12307 /** | 13765 /** |
| 12308 * The name of the type parameter. | 13766 * The name of the type parameter. |
| 12309 */ | 13767 */ |
| 12310 SimpleIdentifier _name; | 13768 SimpleIdentifier _name; |
| 12311 | 13769 |
| 12312 /** | 13770 /** |
| 12313 * The token representing the 'extends' keyword, or `null` if there was no exp
licit upper | 13771 * The token representing the 'extends' keyword, or `null` if there was no exp
licit upper |
| 12314 * bound. | 13772 * bound. |
| 12315 */ | 13773 */ |
| 12316 Token _keyword; | 13774 Token _keyword; |
| 12317 | 13775 |
| 12318 /** | 13776 /** |
| 12319 * The name of the upper bound for legal arguments, or `null` if there was no
explicit upper | 13777 * The name of the upper bound for legal arguments, or `null` if there was no
explicit upper |
| 12320 * bound. | 13778 * bound. |
| 12321 */ | 13779 */ |
| 12322 TypeName _bound; | 13780 TypeName _bound; |
| 12323 | 13781 |
| 12324 /** | 13782 /** |
| 12325 * Initialize a newly created type parameter. | 13783 * Initialize a newly created type parameter. |
| 13784 * |
| 12326 * @param comment the documentation comment associated with the type parameter | 13785 * @param comment the documentation comment associated with the type parameter |
| 12327 * @param metadata the annotations associated with the type parameter | 13786 * @param metadata the annotations associated with the type parameter |
| 12328 * @param name the name of the type parameter | 13787 * @param name the name of the type parameter |
| 12329 * @param keyword the token representing the 'extends' keyword | 13788 * @param keyword the token representing the 'extends' keyword |
| 12330 * @param bound the name of the upper bound for legal arguments | 13789 * @param bound the name of the upper bound for legal arguments |
| 12331 */ | 13790 */ |
| 12332 TypeParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifie
r name, Token keyword, TypeName bound) : super.full(comment, metadata) { | 13791 TypeParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifie
r name, Token keyword, TypeName bound) : super.full(comment, metadata) { |
| 12333 this._name = becomeParentOf(name); | 13792 this._name = becomeParentOf(name); |
| 12334 this._keyword = keyword; | 13793 this._keyword = keyword; |
| 12335 this._bound = becomeParentOf(bound); | 13794 this._bound = becomeParentOf(bound); |
| 12336 } | 13795 } |
| 12337 | 13796 |
| 12338 /** | 13797 /** |
| 12339 * Initialize a newly created type parameter. | 13798 * Initialize a newly created type parameter. |
| 13799 * |
| 12340 * @param comment the documentation comment associated with the type parameter | 13800 * @param comment the documentation comment associated with the type parameter |
| 12341 * @param metadata the annotations associated with the type parameter | 13801 * @param metadata the annotations associated with the type parameter |
| 12342 * @param name the name of the type parameter | 13802 * @param name the name of the type parameter |
| 12343 * @param keyword the token representing the 'extends' keyword | 13803 * @param keyword the token representing the 'extends' keyword |
| 12344 * @param bound the name of the upper bound for legal arguments | 13804 * @param bound the name of the upper bound for legal arguments |
| 12345 */ | 13805 */ |
| 12346 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na
me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword
, bound); | 13806 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na
me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword
, bound); |
| 12347 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); | 13807 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); |
| 12348 | 13808 |
| 12349 /** | 13809 /** |
| 12350 * Return the name of the upper bound for legal arguments, or `null` if there
was no | 13810 * Return the name of the upper bound for legal arguments, or `null` if there
was no |
| 12351 * explicit upper bound. | 13811 * explicit upper bound. |
| 13812 * |
| 12352 * @return the name of the upper bound for legal arguments | 13813 * @return the name of the upper bound for legal arguments |
| 12353 */ | 13814 */ |
| 12354 TypeName get bound => _bound; | 13815 TypeName get bound => _bound; |
| 12355 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria
bleElement) : null; | 13816 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria
bleElement) : null; |
| 12356 Token get endToken { | 13817 Token get endToken { |
| 12357 if (_bound == null) { | 13818 if (_bound == null) { |
| 12358 return _name.endToken; | 13819 return _name.endToken; |
| 12359 } | 13820 } |
| 12360 return _bound.endToken; | 13821 return _bound.endToken; |
| 12361 } | 13822 } |
| 12362 | 13823 |
| 12363 /** | 13824 /** |
| 12364 * Return the token representing the 'assert' keyword. | 13825 * Return the token representing the 'assert' keyword. |
| 13826 * |
| 12365 * @return the token representing the 'assert' keyword | 13827 * @return the token representing the 'assert' keyword |
| 12366 */ | 13828 */ |
| 12367 Token get keyword => _keyword; | 13829 Token get keyword => _keyword; |
| 12368 | 13830 |
| 12369 /** | 13831 /** |
| 12370 * Return the name of the type parameter. | 13832 * Return the name of the type parameter. |
| 13833 * |
| 12371 * @return the name of the type parameter | 13834 * @return the name of the type parameter |
| 12372 */ | 13835 */ |
| 12373 SimpleIdentifier get name => _name; | 13836 SimpleIdentifier get name => _name; |
| 12374 | 13837 |
| 12375 /** | 13838 /** |
| 12376 * Set the name of the upper bound for legal arguments to the given type name. | 13839 * Set the name of the upper bound for legal arguments to the given type name. |
| 13840 * |
| 12377 * @param typeName the name of the upper bound for legal arguments | 13841 * @param typeName the name of the upper bound for legal arguments |
| 12378 */ | 13842 */ |
| 12379 void set bound(TypeName typeName) { | 13843 void set bound(TypeName typeName) { |
| 12380 _bound = becomeParentOf(typeName); | 13844 _bound = becomeParentOf(typeName); |
| 12381 } | 13845 } |
| 12382 | 13846 |
| 12383 /** | 13847 /** |
| 12384 * Set the token representing the 'assert' keyword to the given token. | 13848 * Set the token representing the 'assert' keyword to the given token. |
| 13849 * |
| 12385 * @param keyword the token representing the 'assert' keyword | 13850 * @param keyword the token representing the 'assert' keyword |
| 12386 */ | 13851 */ |
| 12387 void set keyword(Token keyword2) { | 13852 void set keyword(Token keyword2) { |
| 12388 this._keyword = keyword2; | 13853 this._keyword = keyword2; |
| 12389 } | 13854 } |
| 12390 | 13855 |
| 12391 /** | 13856 /** |
| 12392 * Set the name of the type parameter to the given identifier. | 13857 * Set the name of the type parameter to the given identifier. |
| 13858 * |
| 12393 * @param identifier the name of the type parameter | 13859 * @param identifier the name of the type parameter |
| 12394 */ | 13860 */ |
| 12395 void set name(SimpleIdentifier identifier) { | 13861 void set name(SimpleIdentifier identifier) { |
| 12396 _name = becomeParentOf(identifier); | 13862 _name = becomeParentOf(identifier); |
| 12397 } | 13863 } |
| 12398 void visitChildren(ASTVisitor<Object> visitor) { | 13864 void visitChildren(ASTVisitor<Object> visitor) { |
| 12399 super.visitChildren(visitor); | 13865 super.visitChildren(visitor); |
| 12400 safelyVisitChild(_name, visitor); | 13866 safelyVisitChild(_name, visitor); |
| 12401 safelyVisitChild(_bound, visitor); | 13867 safelyVisitChild(_bound, visitor); |
| 12402 } | 13868 } |
| 12403 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; | 13869 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; |
| 12404 } | 13870 } |
| 12405 /** | 13871 /** |
| 12406 * Instances of the class `TypeParameterList` represent type parameters within a
declaration. | 13872 * Instances of the class `TypeParameterList` represent type parameters within a
declaration. |
| 13873 * |
| 12407 * <pre> | 13874 * <pre> |
| 12408 * typeParameterList ::= | 13875 * typeParameterList ::= |
| 12409 * '<' [TypeParameter typeParameter] (',' [TypeParameter typeParameter])* '>' | 13876 * '<' [TypeParameter] (',' [TypeParameter])* '>' |
| 12410 * </pre> | 13877 * </pre> |
| 13878 * |
| 12411 * @coverage dart.engine.ast | 13879 * @coverage dart.engine.ast |
| 12412 */ | 13880 */ |
| 12413 class TypeParameterList extends ASTNode { | 13881 class TypeParameterList extends ASTNode { |
| 12414 | 13882 |
| 12415 /** | 13883 /** |
| 12416 * The left angle bracket. | 13884 * The left angle bracket. |
| 12417 */ | 13885 */ |
| 12418 Token _leftBracket; | 13886 Token _leftBracket; |
| 12419 | 13887 |
| 12420 /** | 13888 /** |
| 12421 * The type parameters in the list. | 13889 * The type parameters in the list. |
| 12422 */ | 13890 */ |
| 12423 NodeList<TypeParameter> _typeParameters; | 13891 NodeList<TypeParameter> _typeParameters; |
| 12424 | 13892 |
| 12425 /** | 13893 /** |
| 12426 * The right angle bracket. | 13894 * The right angle bracket. |
| 12427 */ | 13895 */ |
| 12428 Token _rightBracket; | 13896 Token _rightBracket; |
| 12429 | 13897 |
| 12430 /** | 13898 /** |
| 12431 * Initialize a newly created list of type parameters. | 13899 * Initialize a newly created list of type parameters. |
| 13900 * |
| 12432 * @param leftBracket the left angle bracket | 13901 * @param leftBracket the left angle bracket |
| 12433 * @param typeParameters the type parameters in the list | 13902 * @param typeParameters the type parameters in the list |
| 12434 * @param rightBracket the right angle bracket | 13903 * @param rightBracket the right angle bracket |
| 12435 */ | 13904 */ |
| 12436 TypeParameterList.full(Token leftBracket, List<TypeParameter> typeParameters,
Token rightBracket) { | 13905 TypeParameterList.full(Token leftBracket, List<TypeParameter> typeParameters,
Token rightBracket) { |
| 12437 this._typeParameters = new NodeList<TypeParameter>(this); | 13906 this._typeParameters = new NodeList<TypeParameter>(this); |
| 12438 this._leftBracket = leftBracket; | 13907 this._leftBracket = leftBracket; |
| 12439 this._typeParameters.addAll(typeParameters); | 13908 this._typeParameters.addAll(typeParameters); |
| 12440 this._rightBracket = rightBracket; | 13909 this._rightBracket = rightBracket; |
| 12441 } | 13910 } |
| 12442 | 13911 |
| 12443 /** | 13912 /** |
| 12444 * Initialize a newly created list of type parameters. | 13913 * Initialize a newly created list of type parameters. |
| 13914 * |
| 12445 * @param leftBracket the left angle bracket | 13915 * @param leftBracket the left angle bracket |
| 12446 * @param typeParameters the type parameters in the list | 13916 * @param typeParameters the type parameters in the list |
| 12447 * @param rightBracket the right angle bracket | 13917 * @param rightBracket the right angle bracket |
| 12448 */ | 13918 */ |
| 12449 TypeParameterList({Token leftBracket, List<TypeParameter> typeParameters, Toke
n rightBracket}) : this.full(leftBracket, typeParameters, rightBracket); | 13919 TypeParameterList({Token leftBracket, List<TypeParameter> typeParameters, Toke
n rightBracket}) : this.full(leftBracket, typeParameters, rightBracket); |
| 12450 accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this); | 13920 accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this); |
| 12451 Token get beginToken => _leftBracket; | 13921 Token get beginToken => _leftBracket; |
| 12452 Token get endToken => _rightBracket; | 13922 Token get endToken => _rightBracket; |
| 12453 | 13923 |
| 12454 /** | 13924 /** |
| 12455 * Return the left angle bracket. | 13925 * Return the left angle bracket. |
| 13926 * |
| 12456 * @return the left angle bracket | 13927 * @return the left angle bracket |
| 12457 */ | 13928 */ |
| 12458 Token get leftBracket => _leftBracket; | 13929 Token get leftBracket => _leftBracket; |
| 12459 | 13930 |
| 12460 /** | 13931 /** |
| 12461 * Return the right angle bracket. | 13932 * Return the right angle bracket. |
| 13933 * |
| 12462 * @return the right angle bracket | 13934 * @return the right angle bracket |
| 12463 */ | 13935 */ |
| 12464 Token get rightBracket => _rightBracket; | 13936 Token get rightBracket => _rightBracket; |
| 12465 | 13937 |
| 12466 /** | 13938 /** |
| 12467 * Return the type parameters for the type. | 13939 * Return the type parameters for the type. |
| 13940 * |
| 12468 * @return the type parameters for the type | 13941 * @return the type parameters for the type |
| 12469 */ | 13942 */ |
| 12470 NodeList<TypeParameter> get typeParameters => _typeParameters; | 13943 NodeList<TypeParameter> get typeParameters => _typeParameters; |
| 12471 void visitChildren(ASTVisitor<Object> visitor) { | 13944 void visitChildren(ASTVisitor<Object> visitor) { |
| 12472 _typeParameters.accept(visitor); | 13945 _typeParameters.accept(visitor); |
| 12473 } | 13946 } |
| 12474 } | 13947 } |
| 12475 /** | 13948 /** |
| 12476 * The abstract class `TypedLiteral` defines the behavior common to literals tha
t have a type | 13949 * The abstract class `TypedLiteral` defines the behavior common to literals tha
t have a type |
| 12477 * associated with them. | 13950 * associated with them. |
| 13951 * |
| 12478 * <pre> | 13952 * <pre> |
| 12479 * listLiteral ::=[ListLiteral listLiteral]| [MapLiteral mapLiteral]</pre> | 13953 * listLiteral ::= |
| 13954 * [ListLiteral] |
| 13955 * | [MapLiteral] |
| 13956 * </pre> |
| 13957 * |
| 12480 * @coverage dart.engine.ast | 13958 * @coverage dart.engine.ast |
| 12481 */ | 13959 */ |
| 12482 abstract class TypedLiteral extends Literal { | 13960 abstract class TypedLiteral extends Literal { |
| 12483 | 13961 |
| 12484 /** | 13962 /** |
| 12485 * The const modifier associated with this literal, or `null` if the literal i
s not a | 13963 * The const modifier associated with this literal, or `null` if the literal i
s not a |
| 12486 * constant. | 13964 * constant. |
| 12487 */ | 13965 */ |
| 12488 Token _modifier; | 13966 Token _modifier; |
| 12489 | 13967 |
| 12490 /** | 13968 /** |
| 12491 * The type argument associated with this literal, or `null` if no type argume
nts were | 13969 * The type argument associated with this literal, or `null` if no type argume
nts were |
| 12492 * declared. | 13970 * declared. |
| 12493 */ | 13971 */ |
| 12494 TypeArgumentList _typeArguments; | 13972 TypeArgumentList _typeArguments; |
| 12495 | 13973 |
| 12496 /** | 13974 /** |
| 12497 * Initialize a newly created typed literal. | 13975 * Initialize a newly created typed literal. |
| 13976 * |
| 12498 * @param modifier the const modifier associated with this literal | 13977 * @param modifier the const modifier associated with this literal |
| 12499 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type | 13978 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type |
| 12500 * arguments were declared | 13979 * arguments were declared |
| 12501 */ | 13980 */ |
| 12502 TypedLiteral.full(Token modifier, TypeArgumentList typeArguments) { | 13981 TypedLiteral.full(Token modifier, TypeArgumentList typeArguments) { |
| 12503 this._modifier = modifier; | 13982 this._modifier = modifier; |
| 12504 this._typeArguments = becomeParentOf(typeArguments); | 13983 this._typeArguments = becomeParentOf(typeArguments); |
| 12505 } | 13984 } |
| 12506 | 13985 |
| 12507 /** | 13986 /** |
| 12508 * Initialize a newly created typed literal. | 13987 * Initialize a newly created typed literal. |
| 13988 * |
| 12509 * @param modifier the const modifier associated with this literal | 13989 * @param modifier the const modifier associated with this literal |
| 12510 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type | 13990 * @param typeArguments the type argument associated with this literal, or `nu
ll` if no type |
| 12511 * arguments were declared | 13991 * arguments were declared |
| 12512 */ | 13992 */ |
| 12513 TypedLiteral({Token modifier, TypeArgumentList typeArguments}) : this.full(mod
ifier, typeArguments); | 13993 TypedLiteral({Token modifier, TypeArgumentList typeArguments}) : this.full(mod
ifier, typeArguments); |
| 12514 | 13994 |
| 12515 /** | 13995 /** |
| 12516 * Return the const modifier associated with this literal. | 13996 * Return the const modifier associated with this literal. |
| 13997 * |
| 12517 * @return the const modifier associated with this literal | 13998 * @return the const modifier associated with this literal |
| 12518 */ | 13999 */ |
| 12519 Token get modifier => _modifier; | 14000 Token get modifier => _modifier; |
| 12520 | 14001 |
| 12521 /** | 14002 /** |
| 12522 * Return the type argument associated with this literal, or `null` if no type
arguments | 14003 * Return the type argument associated with this literal, or `null` if no type
arguments |
| 12523 * were declared. | 14004 * were declared. |
| 14005 * |
| 12524 * @return the type argument associated with this literal | 14006 * @return the type argument associated with this literal |
| 12525 */ | 14007 */ |
| 12526 TypeArgumentList get typeArguments => _typeArguments; | 14008 TypeArgumentList get typeArguments => _typeArguments; |
| 12527 | 14009 |
| 12528 /** | 14010 /** |
| 12529 * Set the modifiers associated with this literal to the given modifiers. | 14011 * Set the modifiers associated with this literal to the given modifiers. |
| 14012 * |
| 12530 * @param modifiers the modifiers associated with this literal | 14013 * @param modifiers the modifiers associated with this literal |
| 12531 */ | 14014 */ |
| 12532 void set modifier(Token modifier2) { | 14015 void set modifier(Token modifier2) { |
| 12533 this._modifier = modifier2; | 14016 this._modifier = modifier2; |
| 12534 } | 14017 } |
| 12535 | 14018 |
| 12536 /** | 14019 /** |
| 12537 * Set the type argument associated with this literal to the given arguments. | 14020 * Set the type argument associated with this literal to the given arguments. |
| 14021 * |
| 12538 * @param typeArguments the type argument associated with this literal | 14022 * @param typeArguments the type argument associated with this literal |
| 12539 */ | 14023 */ |
| 12540 void set typeArguments(TypeArgumentList typeArguments2) { | 14024 void set typeArguments(TypeArgumentList typeArguments2) { |
| 12541 this._typeArguments = typeArguments2; | 14025 this._typeArguments = typeArguments2; |
| 12542 } | 14026 } |
| 12543 void visitChildren(ASTVisitor<Object> visitor) { | 14027 void visitChildren(ASTVisitor<Object> visitor) { |
| 12544 safelyVisitChild(_typeArguments, visitor); | 14028 safelyVisitChild(_typeArguments, visitor); |
| 12545 } | 14029 } |
| 12546 } | 14030 } |
| 12547 /** | 14031 /** |
| 12548 * The abstract class `UriBasedDirective` defines the behavior common to nodes t
hat represent | 14032 * The abstract class `UriBasedDirective` defines the behavior common to nodes t
hat represent |
| 12549 * a directive that references a URI. | 14033 * a directive that references a URI. |
| 14034 * |
| 12550 * <pre> | 14035 * <pre> |
| 12551 * uriBasedDirective ::=[ExportDirective exportDirective]| [ImportDirective impo
rtDirective]| [PartDirective partDirective]</pre> | 14036 * uriBasedDirective ::= |
| 14037 * [ExportDirective] |
| 14038 * | [ImportDirective] |
| 14039 * | [PartDirective] |
| 14040 * </pre> |
| 14041 * |
| 12552 * @coverage dart.engine.ast | 14042 * @coverage dart.engine.ast |
| 12553 */ | 14043 */ |
| 12554 abstract class UriBasedDirective extends Directive { | 14044 abstract class UriBasedDirective extends Directive { |
| 12555 | 14045 |
| 12556 /** | 14046 /** |
| 12557 * The URI referenced by this directive. | 14047 * The URI referenced by this directive. |
| 12558 */ | 14048 */ |
| 12559 StringLiteral _uri; | 14049 StringLiteral _uri; |
| 12560 | 14050 |
| 12561 /** | 14051 /** |
| 12562 * Initialize a newly create URI-based directive. | 14052 * Initialize a newly create URI-based directive. |
| 14053 * |
| 12563 * @param comment the documentation comment associated with this directive | 14054 * @param comment the documentation comment associated with this directive |
| 12564 * @param metadata the annotations associated with the directive | 14055 * @param metadata the annotations associated with the directive |
| 12565 * @param uri the URI referenced by this directive | 14056 * @param uri the URI referenced by this directive |
| 12566 */ | 14057 */ |
| 12567 UriBasedDirective.full(Comment comment, List<Annotation> metadata, StringLiter
al uri) : super.full(comment, metadata) { | 14058 UriBasedDirective.full(Comment comment, List<Annotation> metadata, StringLiter
al uri) : super.full(comment, metadata) { |
| 12568 this._uri = becomeParentOf(uri); | 14059 this._uri = becomeParentOf(uri); |
| 12569 } | 14060 } |
| 12570 | 14061 |
| 12571 /** | 14062 /** |
| 12572 * Initialize a newly create URI-based directive. | 14063 * Initialize a newly create URI-based directive. |
| 14064 * |
| 12573 * @param comment the documentation comment associated with this directive | 14065 * @param comment the documentation comment associated with this directive |
| 12574 * @param metadata the annotations associated with the directive | 14066 * @param metadata the annotations associated with the directive |
| 12575 * @param uri the URI referenced by this directive | 14067 * @param uri the URI referenced by this directive |
| 12576 */ | 14068 */ |
| 12577 UriBasedDirective({Comment comment, List<Annotation> metadata, StringLiteral u
ri}) : this.full(comment, metadata, uri); | 14069 UriBasedDirective({Comment comment, List<Annotation> metadata, StringLiteral u
ri}) : this.full(comment, metadata, uri); |
| 12578 | 14070 |
| 12579 /** | 14071 /** |
| 12580 * Return the URI referenced by this directive. | 14072 * Return the URI referenced by this directive. |
| 14073 * |
| 12581 * @return the URI referenced by this directive | 14074 * @return the URI referenced by this directive |
| 12582 */ | 14075 */ |
| 12583 StringLiteral get uri => _uri; | 14076 StringLiteral get uri => _uri; |
| 12584 | 14077 |
| 12585 /** | 14078 /** |
| 12586 * Return the element associated with the URI of this directive, or `null` if
the AST | 14079 * Return the element associated with the URI of this directive, or `null` if
the AST |
| 12587 * structure has not been resolved or if this URI could not be resolved. Examp
les of the latter | 14080 * structure has not been resolved or if this URI could not be resolved. Examp
les of the latter |
| 12588 * case include a directive that contains an invalid URL or a URL that does no
t exist. | 14081 * case include a directive that contains an invalid URL or a URL that does no
t exist. |
| 14082 * |
| 12589 * @return the element associated with this directive | 14083 * @return the element associated with this directive |
| 12590 */ | 14084 */ |
| 12591 Element get uriElement; | 14085 Element get uriElement; |
| 12592 | 14086 |
| 12593 /** | 14087 /** |
| 12594 * Set the URI referenced by this directive to the given URI. | 14088 * Set the URI referenced by this directive to the given URI. |
| 14089 * |
| 12595 * @param uri the URI referenced by this directive | 14090 * @param uri the URI referenced by this directive |
| 12596 */ | 14091 */ |
| 12597 void set uri(StringLiteral uri2) { | 14092 void set uri(StringLiteral uri2) { |
| 12598 this._uri = becomeParentOf(uri2); | 14093 this._uri = becomeParentOf(uri2); |
| 12599 } | 14094 } |
| 12600 void visitChildren(ASTVisitor<Object> visitor) { | 14095 void visitChildren(ASTVisitor<Object> visitor) { |
| 12601 super.visitChildren(visitor); | 14096 super.visitChildren(visitor); |
| 12602 safelyVisitChild(_uri, visitor); | 14097 safelyVisitChild(_uri, visitor); |
| 12603 } | 14098 } |
| 12604 } | 14099 } |
| 12605 /** | 14100 /** |
| 12606 * Instances of the class `VariableDeclaration` represent an identifier that has
an initial | 14101 * Instances of the class `VariableDeclaration` represent an identifier that has
an initial |
| 12607 * value associated with it. Instances of this class are always children of the
class[VariableDeclarationList]. | 14102 * value associated with it. Instances of this class are always children of the
class |
| 14103 * [VariableDeclarationList]. |
| 14104 * |
| 12608 * <pre> | 14105 * <pre> |
| 12609 * variableDeclaration ::=[SimpleIdentifier identifier] ('=' [Expression initial
Value])? | 14106 * variableDeclaration ::= |
| 14107 * [SimpleIdentifier] ('=' [Expression])? |
| 12610 * </pre> | 14108 * </pre> |
| 14109 * |
| 12611 * @coverage dart.engine.ast | 14110 * @coverage dart.engine.ast |
| 12612 */ | 14111 */ |
| 12613 class VariableDeclaration extends Declaration { | 14112 class VariableDeclaration extends Declaration { |
| 12614 | 14113 |
| 12615 /** | 14114 /** |
| 12616 * The name of the variable being declared. | 14115 * The name of the variable being declared. |
| 12617 */ | 14116 */ |
| 12618 SimpleIdentifier _name; | 14117 SimpleIdentifier _name; |
| 12619 | 14118 |
| 12620 /** | 14119 /** |
| 12621 * The equal sign separating the variable name from the initial value, or `nul
l` if the | 14120 * The equal sign separating the variable name from the initial value, or `nul
l` if the |
| 12622 * initial value was not specified. | 14121 * initial value was not specified. |
| 12623 */ | 14122 */ |
| 12624 Token _equals; | 14123 Token _equals; |
| 12625 | 14124 |
| 12626 /** | 14125 /** |
| 12627 * The expression used to compute the initial value for the variable, or `null
` if the | 14126 * The expression used to compute the initial value for the variable, or `null
` if the |
| 12628 * initial value was not specified. | 14127 * initial value was not specified. |
| 12629 */ | 14128 */ |
| 12630 Expression _initializer; | 14129 Expression _initializer; |
| 12631 | 14130 |
| 12632 /** | 14131 /** |
| 12633 * Initialize a newly created variable declaration. | 14132 * Initialize a newly created variable declaration. |
| 14133 * |
| 12634 * @param comment the documentation comment associated with this declaration | 14134 * @param comment the documentation comment associated with this declaration |
| 12635 * @param metadata the annotations associated with this member | 14135 * @param metadata the annotations associated with this member |
| 12636 * @param name the name of the variable being declared | 14136 * @param name the name of the variable being declared |
| 12637 * @param equals the equal sign separating the variable name from the initial
value | 14137 * @param equals the equal sign separating the variable name from the initial
value |
| 12638 * @param initializer the expression used to compute the initial value for the
variable | 14138 * @param initializer the expression used to compute the initial value for the
variable |
| 12639 */ | 14139 */ |
| 12640 VariableDeclaration.full(Comment comment, List<Annotation> metadata, SimpleIde
ntifier name, Token equals, Expression initializer) : super.full(comment, metada
ta) { | 14140 VariableDeclaration.full(Comment comment, List<Annotation> metadata, SimpleIde
ntifier name, Token equals, Expression initializer) : super.full(comment, metada
ta) { |
| 12641 this._name = becomeParentOf(name); | 14141 this._name = becomeParentOf(name); |
| 12642 this._equals = equals; | 14142 this._equals = equals; |
| 12643 this._initializer = becomeParentOf(initializer); | 14143 this._initializer = becomeParentOf(initializer); |
| 12644 } | 14144 } |
| 12645 | 14145 |
| 12646 /** | 14146 /** |
| 12647 * Initialize a newly created variable declaration. | 14147 * Initialize a newly created variable declaration. |
| 14148 * |
| 12648 * @param comment the documentation comment associated with this declaration | 14149 * @param comment the documentation comment associated with this declaration |
| 12649 * @param metadata the annotations associated with this member | 14150 * @param metadata the annotations associated with this member |
| 12650 * @param name the name of the variable being declared | 14151 * @param name the name of the variable being declared |
| 12651 * @param equals the equal sign separating the variable name from the initial
value | 14152 * @param equals the equal sign separating the variable name from the initial
value |
| 12652 * @param initializer the expression used to compute the initial value for the
variable | 14153 * @param initializer the expression used to compute the initial value for the
variable |
| 12653 */ | 14154 */ |
| 12654 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif
ier name, Token equals, Expression initializer}) : this.full(comment, metadata,
name, equals, initializer); | 14155 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif
ier name, Token equals, Expression initializer}) : this.full(comment, metadata,
name, equals, initializer); |
| 12655 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); | 14156 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); |
| 12656 | 14157 |
| 12657 /** | 14158 /** |
| (...skipping 16 matching lines...) Expand all Loading... |
| 12674 Token get endToken { | 14175 Token get endToken { |
| 12675 if (_initializer != null) { | 14176 if (_initializer != null) { |
| 12676 return _initializer.endToken; | 14177 return _initializer.endToken; |
| 12677 } | 14178 } |
| 12678 return _name.endToken; | 14179 return _name.endToken; |
| 12679 } | 14180 } |
| 12680 | 14181 |
| 12681 /** | 14182 /** |
| 12682 * Return the equal sign separating the variable name from the initial value,
or `null` if | 14183 * Return the equal sign separating the variable name from the initial value,
or `null` if |
| 12683 * the initial value was not specified. | 14184 * the initial value was not specified. |
| 14185 * |
| 12684 * @return the equal sign separating the variable name from the initial value | 14186 * @return the equal sign separating the variable name from the initial value |
| 12685 */ | 14187 */ |
| 12686 Token get equals => _equals; | 14188 Token get equals => _equals; |
| 12687 | 14189 |
| 12688 /** | 14190 /** |
| 12689 * Return the expression used to compute the initial value for the variable, o
r `null` if | 14191 * Return the expression used to compute the initial value for the variable, o
r `null` if |
| 12690 * the initial value was not specified. | 14192 * the initial value was not specified. |
| 14193 * |
| 12691 * @return the expression used to compute the initial value for the variable | 14194 * @return the expression used to compute the initial value for the variable |
| 12692 */ | 14195 */ |
| 12693 Expression get initializer => _initializer; | 14196 Expression get initializer => _initializer; |
| 12694 | 14197 |
| 12695 /** | 14198 /** |
| 12696 * Return the name of the variable being declared. | 14199 * Return the name of the variable being declared. |
| 14200 * |
| 12697 * @return the name of the variable being declared | 14201 * @return the name of the variable being declared |
| 12698 */ | 14202 */ |
| 12699 SimpleIdentifier get name => _name; | 14203 SimpleIdentifier get name => _name; |
| 12700 | 14204 |
| 12701 /** | 14205 /** |
| 12702 * Return `true` if this variable was declared with the 'const' modifier. | 14206 * Return `true` if this variable was declared with the 'const' modifier. |
| 14207 * |
| 12703 * @return `true` if this variable was declared with the 'const' modifier | 14208 * @return `true` if this variable was declared with the 'const' modifier |
| 12704 */ | 14209 */ |
| 12705 bool get isConst { | 14210 bool get isConst { |
| 12706 ASTNode parent = this.parent; | 14211 ASTNode parent = this.parent; |
| 12707 return parent is VariableDeclarationList && ((parent as VariableDeclarationL
ist)).isConst; | 14212 return parent is VariableDeclarationList && ((parent as VariableDeclarationL
ist)).isConst; |
| 12708 } | 14213 } |
| 12709 | 14214 |
| 12710 /** | 14215 /** |
| 12711 * Return `true` if this variable was declared with the 'final' modifier. Vari
ables that are | 14216 * Return `true` if this variable was declared with the 'final' modifier. Vari
ables that are |
| 12712 * declared with the 'const' modifier will return `false` even though they are
implicitly | 14217 * declared with the 'const' modifier will return `false` even though they are
implicitly |
| 12713 * final. | 14218 * final. |
| 14219 * |
| 12714 * @return `true` if this variable was declared with the 'final' modifier | 14220 * @return `true` if this variable was declared with the 'final' modifier |
| 12715 */ | 14221 */ |
| 12716 bool get isFinal { | 14222 bool get isFinal { |
| 12717 ASTNode parent = this.parent; | 14223 ASTNode parent = this.parent; |
| 12718 return parent is VariableDeclarationList && ((parent as VariableDeclarationL
ist)).isFinal; | 14224 return parent is VariableDeclarationList && ((parent as VariableDeclarationL
ist)).isFinal; |
| 12719 } | 14225 } |
| 12720 | 14226 |
| 12721 /** | 14227 /** |
| 12722 * Set the equal sign separating the variable name from the initial value to t
he given token. | 14228 * Set the equal sign separating the variable name from the initial value to t
he given token. |
| 14229 * |
| 12723 * @param equals the equal sign separating the variable name from the initial
value | 14230 * @param equals the equal sign separating the variable name from the initial
value |
| 12724 */ | 14231 */ |
| 12725 void set equals(Token equals2) { | 14232 void set equals(Token equals2) { |
| 12726 this._equals = equals2; | 14233 this._equals = equals2; |
| 12727 } | 14234 } |
| 12728 | 14235 |
| 12729 /** | 14236 /** |
| 12730 * Set the expression used to compute the initial value for the variable to th
e given expression. | 14237 * Set the expression used to compute the initial value for the variable to th
e given expression. |
| 14238 * |
| 12731 * @param initializer the expression used to compute the initial value for the
variable | 14239 * @param initializer the expression used to compute the initial value for the
variable |
| 12732 */ | 14240 */ |
| 12733 void set initializer(Expression initializer2) { | 14241 void set initializer(Expression initializer2) { |
| 12734 this._initializer = becomeParentOf(initializer2); | 14242 this._initializer = becomeParentOf(initializer2); |
| 12735 } | 14243 } |
| 12736 | 14244 |
| 12737 /** | 14245 /** |
| 12738 * Set the name of the variable being declared to the given identifier. | 14246 * Set the name of the variable being declared to the given identifier. |
| 14247 * |
| 12739 * @param name the name of the variable being declared | 14248 * @param name the name of the variable being declared |
| 12740 */ | 14249 */ |
| 12741 void set name(SimpleIdentifier name2) { | 14250 void set name(SimpleIdentifier name2) { |
| 12742 this._name = becomeParentOf(name2); | 14251 this._name = becomeParentOf(name2); |
| 12743 } | 14252 } |
| 12744 void visitChildren(ASTVisitor<Object> visitor) { | 14253 void visitChildren(ASTVisitor<Object> visitor) { |
| 12745 super.visitChildren(visitor); | 14254 super.visitChildren(visitor); |
| 12746 safelyVisitChild(_name, visitor); | 14255 safelyVisitChild(_name, visitor); |
| 12747 safelyVisitChild(_initializer, visitor); | 14256 safelyVisitChild(_initializer, visitor); |
| 12748 } | 14257 } |
| 12749 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; | 14258 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; |
| 12750 } | 14259 } |
| 12751 /** | 14260 /** |
| 12752 * Instances of the class `VariableDeclarationList` represent the declaration of
one or more | 14261 * Instances of the class `VariableDeclarationList` represent the declaration of
one or more |
| 12753 * variables of the same type. | 14262 * variables of the same type. |
| 14263 * |
| 12754 * <pre> | 14264 * <pre> |
| 12755 * variableDeclarationList ::= | 14265 * variableDeclarationList ::= |
| 12756 * finalConstVarOrType [VariableDeclaration variableDeclaration] (',' [VariableD
eclaration variableDeclaration]) | 14266 * finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])* |
| 14267 * |
| 12757 * finalConstVarOrType ::= | 14268 * finalConstVarOrType ::= |
| 12758 * | 'final' [TypeName type]? | 14269 * | 'final' [TypeName]? |
| 12759 * | 'const' [TypeName type]? | 14270 * | 'const' [TypeName]? |
| 12760 * | 'var' | 14271 * | 'var' |
| 12761 * | [TypeName type]</pre> | 14272 * | [TypeName] |
| 14273 * </pre> |
| 14274 * |
| 12762 * @coverage dart.engine.ast | 14275 * @coverage dart.engine.ast |
| 12763 */ | 14276 */ |
| 12764 class VariableDeclarationList extends AnnotatedNode { | 14277 class VariableDeclarationList extends AnnotatedNode { |
| 12765 | 14278 |
| 12766 /** | 14279 /** |
| 12767 * The token representing the 'final', 'const' or 'var' keyword, or `null` if
no keyword was | 14280 * The token representing the 'final', 'const' or 'var' keyword, or `null` if
no keyword was |
| 12768 * included. | 14281 * included. |
| 12769 */ | 14282 */ |
| 12770 Token _keyword; | 14283 Token _keyword; |
| 12771 | 14284 |
| 12772 /** | 14285 /** |
| 12773 * The type of the variables being declared, or `null` if no type was provided
. | 14286 * The type of the variables being declared, or `null` if no type was provided
. |
| 12774 */ | 14287 */ |
| 12775 TypeName _type; | 14288 TypeName _type; |
| 12776 | 14289 |
| 12777 /** | 14290 /** |
| 12778 * A list containing the individual variables being declared. | 14291 * A list containing the individual variables being declared. |
| 12779 */ | 14292 */ |
| 12780 NodeList<VariableDeclaration> _variables; | 14293 NodeList<VariableDeclaration> _variables; |
| 12781 | 14294 |
| 12782 /** | 14295 /** |
| 12783 * Initialize a newly created variable declaration list. | 14296 * Initialize a newly created variable declaration list. |
| 14297 * |
| 12784 * @param comment the documentation comment associated with this declaration l
ist | 14298 * @param comment the documentation comment associated with this declaration l
ist |
| 12785 * @param metadata the annotations associated with this declaration list | 14299 * @param metadata the annotations associated with this declaration list |
| 12786 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 14300 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
| 12787 * @param type the type of the variables being declared | 14301 * @param type the type of the variables being declared |
| 12788 * @param variables a list containing the individual variables being declared | 14302 * @param variables a list containing the individual variables being declared |
| 12789 */ | 14303 */ |
| 12790 VariableDeclarationList.full(Comment comment, List<Annotation> metadata, Token
keyword, TypeName type, List<VariableDeclaration> variables) : super.full(comme
nt, metadata) { | 14304 VariableDeclarationList.full(Comment comment, List<Annotation> metadata, Token
keyword, TypeName type, List<VariableDeclaration> variables) : super.full(comme
nt, metadata) { |
| 12791 this._variables = new NodeList<VariableDeclaration>(this); | 14305 this._variables = new NodeList<VariableDeclaration>(this); |
| 12792 this._keyword = keyword; | 14306 this._keyword = keyword; |
| 12793 this._type = becomeParentOf(type); | 14307 this._type = becomeParentOf(type); |
| 12794 this._variables.addAll(variables); | 14308 this._variables.addAll(variables); |
| 12795 } | 14309 } |
| 12796 | 14310 |
| 12797 /** | 14311 /** |
| 12798 * Initialize a newly created variable declaration list. | 14312 * Initialize a newly created variable declaration list. |
| 14313 * |
| 12799 * @param comment the documentation comment associated with this declaration l
ist | 14314 * @param comment the documentation comment associated with this declaration l
ist |
| 12800 * @param metadata the annotations associated with this declaration list | 14315 * @param metadata the annotations associated with this declaration list |
| 12801 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 14316 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
| 12802 * @param type the type of the variables being declared | 14317 * @param type the type of the variables being declared |
| 12803 * @param variables a list containing the individual variables being declared | 14318 * @param variables a list containing the individual variables being declared |
| 12804 */ | 14319 */ |
| 12805 VariableDeclarationList({Comment comment, List<Annotation> metadata, Token key
word, TypeName type, List<VariableDeclaration> variables}) : this.full(comment,
metadata, keyword, type, variables); | 14320 VariableDeclarationList({Comment comment, List<Annotation> metadata, Token key
word, TypeName type, List<VariableDeclaration> variables}) : this.full(comment,
metadata, keyword, type, variables); |
| 12806 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this); | 14321 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this); |
| 12807 Token get endToken => _variables.endToken; | 14322 Token get endToken => _variables.endToken; |
| 12808 | 14323 |
| 12809 /** | 14324 /** |
| 12810 * Return the token representing the 'final', 'const' or 'var' keyword, or `nu
ll` if no | 14325 * Return the token representing the 'final', 'const' or 'var' keyword, or `nu
ll` if no |
| 12811 * keyword was included. | 14326 * keyword was included. |
| 14327 * |
| 12812 * @return the token representing the 'final', 'const' or 'var' keyword | 14328 * @return the token representing the 'final', 'const' or 'var' keyword |
| 12813 */ | 14329 */ |
| 12814 Token get keyword => _keyword; | 14330 Token get keyword => _keyword; |
| 12815 | 14331 |
| 12816 /** | 14332 /** |
| 12817 * Return the type of the variables being declared, or `null` if no type was p
rovided. | 14333 * Return the type of the variables being declared, or `null` if no type was p
rovided. |
| 14334 * |
| 12818 * @return the type of the variables being declared | 14335 * @return the type of the variables being declared |
| 12819 */ | 14336 */ |
| 12820 TypeName get type => _type; | 14337 TypeName get type => _type; |
| 12821 | 14338 |
| 12822 /** | 14339 /** |
| 12823 * Return a list containing the individual variables being declared. | 14340 * Return a list containing the individual variables being declared. |
| 14341 * |
| 12824 * @return a list containing the individual variables being declared | 14342 * @return a list containing the individual variables being declared |
| 12825 */ | 14343 */ |
| 12826 NodeList<VariableDeclaration> get variables => _variables; | 14344 NodeList<VariableDeclaration> get variables => _variables; |
| 12827 | 14345 |
| 12828 /** | 14346 /** |
| 12829 * Return `true` if the variables in this list were declared with the 'const'
modifier. | 14347 * Return `true` if the variables in this list were declared with the 'const'
modifier. |
| 14348 * |
| 12830 * @return `true` if the variables in this list were declared with the 'const'
modifier | 14349 * @return `true` if the variables in this list were declared with the 'const'
modifier |
| 12831 */ | 14350 */ |
| 12832 bool get isConst => _keyword is KeywordToken && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 14351 bool get isConst => _keyword is KeywordToken && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
| 12833 | 14352 |
| 12834 /** | 14353 /** |
| 12835 * Return `true` if the variables in this list were declared with the 'final'
modifier. | 14354 * Return `true` if the variables in this list were declared with the 'final'
modifier. |
| 12836 * Variables that are declared with the 'const' modifier will return `false` e
ven though | 14355 * Variables that are declared with the 'const' modifier will return `false` e
ven though |
| 12837 * they are implicitly final. | 14356 * they are implicitly final. |
| 14357 * |
| 12838 * @return `true` if the variables in this list were declared with the 'final'
modifier | 14358 * @return `true` if the variables in this list were declared with the 'final'
modifier |
| 12839 */ | 14359 */ |
| 12840 bool get isFinal => _keyword is KeywordToken && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); | 14360 bool get isFinal => _keyword is KeywordToken && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); |
| 12841 | 14361 |
| 12842 /** | 14362 /** |
| 12843 * Set the token representing the 'final', 'const' or 'var' keyword to the giv
en token. | 14363 * Set the token representing the 'final', 'const' or 'var' keyword to the giv
en token. |
| 14364 * |
| 12844 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 14365 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
| 12845 */ | 14366 */ |
| 12846 void set keyword(Token keyword2) { | 14367 void set keyword(Token keyword2) { |
| 12847 this._keyword = keyword2; | 14368 this._keyword = keyword2; |
| 12848 } | 14369 } |
| 12849 | 14370 |
| 12850 /** | 14371 /** |
| 12851 * Set the type of the variables being declared to the given type name. | 14372 * Set the type of the variables being declared to the given type name. |
| 14373 * |
| 12852 * @param typeName the type of the variables being declared | 14374 * @param typeName the type of the variables being declared |
| 12853 */ | 14375 */ |
| 12854 void set type(TypeName typeName) { | 14376 void set type(TypeName typeName) { |
| 12855 _type = becomeParentOf(typeName); | 14377 _type = becomeParentOf(typeName); |
| 12856 } | 14378 } |
| 12857 void visitChildren(ASTVisitor<Object> visitor) { | 14379 void visitChildren(ASTVisitor<Object> visitor) { |
| 12858 safelyVisitChild(_type, visitor); | 14380 safelyVisitChild(_type, visitor); |
| 12859 _variables.accept(visitor); | 14381 _variables.accept(visitor); |
| 12860 } | 14382 } |
| 12861 Token get firstTokenAfterCommentAndMetadata { | 14383 Token get firstTokenAfterCommentAndMetadata { |
| 12862 if (_keyword != null) { | 14384 if (_keyword != null) { |
| 12863 return _keyword; | 14385 return _keyword; |
| 12864 } else if (_type != null) { | 14386 } else if (_type != null) { |
| 12865 return _type.beginToken; | 14387 return _type.beginToken; |
| 12866 } | 14388 } |
| 12867 return _variables.beginToken; | 14389 return _variables.beginToken; |
| 12868 } | 14390 } |
| 12869 } | 14391 } |
| 12870 /** | 14392 /** |
| 12871 * Instances of the class `VariableDeclarationStatement` represent a list of var
iables that | 14393 * Instances of the class `VariableDeclarationStatement` represent a list of var
iables that |
| 12872 * are being declared in a context where a statement is required. | 14394 * are being declared in a context where a statement is required. |
| 14395 * |
| 12873 * <pre> | 14396 * <pre> |
| 12874 * variableDeclarationStatement ::=[VariableDeclarationList variableList] ';' | 14397 * variableDeclarationStatement ::= |
| 14398 * [VariableDeclarationList] ';' |
| 12875 * </pre> | 14399 * </pre> |
| 14400 * |
| 12876 * @coverage dart.engine.ast | 14401 * @coverage dart.engine.ast |
| 12877 */ | 14402 */ |
| 12878 class VariableDeclarationStatement extends Statement { | 14403 class VariableDeclarationStatement extends Statement { |
| 12879 | 14404 |
| 12880 /** | 14405 /** |
| 12881 * The variables being declared. | 14406 * The variables being declared. |
| 12882 */ | 14407 */ |
| 12883 VariableDeclarationList _variableList; | 14408 VariableDeclarationList _variableList; |
| 12884 | 14409 |
| 12885 /** | 14410 /** |
| 12886 * The semicolon terminating the statement. | 14411 * The semicolon terminating the statement. |
| 12887 */ | 14412 */ |
| 12888 Token _semicolon; | 14413 Token _semicolon; |
| 12889 | 14414 |
| 12890 /** | 14415 /** |
| 12891 * Initialize a newly created variable declaration statement. | 14416 * Initialize a newly created variable declaration statement. |
| 14417 * |
| 12892 * @param variableList the fields being declared | 14418 * @param variableList the fields being declared |
| 12893 * @param semicolon the semicolon terminating the statement | 14419 * @param semicolon the semicolon terminating the statement |
| 12894 */ | 14420 */ |
| 12895 VariableDeclarationStatement.full(VariableDeclarationList variableList, Token
semicolon) { | 14421 VariableDeclarationStatement.full(VariableDeclarationList variableList, Token
semicolon) { |
| 12896 this._variableList = becomeParentOf(variableList); | 14422 this._variableList = becomeParentOf(variableList); |
| 12897 this._semicolon = semicolon; | 14423 this._semicolon = semicolon; |
| 12898 } | 14424 } |
| 12899 | 14425 |
| 12900 /** | 14426 /** |
| 12901 * Initialize a newly created variable declaration statement. | 14427 * Initialize a newly created variable declaration statement. |
| 14428 * |
| 12902 * @param variableList the fields being declared | 14429 * @param variableList the fields being declared |
| 12903 * @param semicolon the semicolon terminating the statement | 14430 * @param semicolon the semicolon terminating the statement |
| 12904 */ | 14431 */ |
| 12905 VariableDeclarationStatement({VariableDeclarationList variableList, Token semi
colon}) : this.full(variableList, semicolon); | 14432 VariableDeclarationStatement({VariableDeclarationList variableList, Token semi
colon}) : this.full(variableList, semicolon); |
| 12906 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this); | 14433 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this); |
| 12907 Token get beginToken => _variableList.beginToken; | 14434 Token get beginToken => _variableList.beginToken; |
| 12908 Token get endToken => _semicolon; | 14435 Token get endToken => _semicolon; |
| 12909 | 14436 |
| 12910 /** | 14437 /** |
| 12911 * Return the semicolon terminating the statement. | 14438 * Return the semicolon terminating the statement. |
| 14439 * |
| 12912 * @return the semicolon terminating the statement | 14440 * @return the semicolon terminating the statement |
| 12913 */ | 14441 */ |
| 12914 Token get semicolon => _semicolon; | 14442 Token get semicolon => _semicolon; |
| 12915 | 14443 |
| 12916 /** | 14444 /** |
| 12917 * Return the variables being declared. | 14445 * Return the variables being declared. |
| 14446 * |
| 12918 * @return the variables being declared | 14447 * @return the variables being declared |
| 12919 */ | 14448 */ |
| 12920 VariableDeclarationList get variables => _variableList; | 14449 VariableDeclarationList get variables => _variableList; |
| 12921 | 14450 |
| 12922 /** | 14451 /** |
| 12923 * Set the semicolon terminating the statement to the given token. | 14452 * Set the semicolon terminating the statement to the given token. |
| 14453 * |
| 12924 * @param semicolon the semicolon terminating the statement | 14454 * @param semicolon the semicolon terminating the statement |
| 12925 */ | 14455 */ |
| 12926 void set semicolon(Token semicolon2) { | 14456 void set semicolon(Token semicolon2) { |
| 12927 this._semicolon = semicolon2; | 14457 this._semicolon = semicolon2; |
| 12928 } | 14458 } |
| 12929 | 14459 |
| 12930 /** | 14460 /** |
| 12931 * Set the variables being declared to the given list of variables. | 14461 * Set the variables being declared to the given list of variables. |
| 14462 * |
| 12932 * @param variableList the variables being declared | 14463 * @param variableList the variables being declared |
| 12933 */ | 14464 */ |
| 12934 void set variables(VariableDeclarationList variableList2) { | 14465 void set variables(VariableDeclarationList variableList2) { |
| 12935 this._variableList = becomeParentOf(variableList2); | 14466 this._variableList = becomeParentOf(variableList2); |
| 12936 } | 14467 } |
| 12937 void visitChildren(ASTVisitor<Object> visitor) { | 14468 void visitChildren(ASTVisitor<Object> visitor) { |
| 12938 safelyVisitChild(_variableList, visitor); | 14469 safelyVisitChild(_variableList, visitor); |
| 12939 } | 14470 } |
| 12940 } | 14471 } |
| 12941 /** | 14472 /** |
| 12942 * Instances of the class `WhileStatement` represent a while statement. | 14473 * Instances of the class `WhileStatement` represent a while statement. |
| 14474 * |
| 12943 * <pre> | 14475 * <pre> |
| 12944 * whileStatement ::= | 14476 * whileStatement ::= |
| 12945 * 'while' '(' [Expression condition] ')' [Statement body]</pre> | 14477 * 'while' '(' [Expression] ')' [Statement] |
| 14478 * </pre> |
| 14479 * |
| 12946 * @coverage dart.engine.ast | 14480 * @coverage dart.engine.ast |
| 12947 */ | 14481 */ |
| 12948 class WhileStatement extends Statement { | 14482 class WhileStatement extends Statement { |
| 12949 | 14483 |
| 12950 /** | 14484 /** |
| 12951 * The token representing the 'while' keyword. | 14485 * The token representing the 'while' keyword. |
| 12952 */ | 14486 */ |
| 12953 Token _keyword; | 14487 Token _keyword; |
| 12954 | 14488 |
| 12955 /** | 14489 /** |
| (...skipping 11 matching lines...) Expand all Loading... |
| 12967 */ | 14501 */ |
| 12968 Token _rightParenthesis; | 14502 Token _rightParenthesis; |
| 12969 | 14503 |
| 12970 /** | 14504 /** |
| 12971 * The body of the loop. | 14505 * The body of the loop. |
| 12972 */ | 14506 */ |
| 12973 Statement _body; | 14507 Statement _body; |
| 12974 | 14508 |
| 12975 /** | 14509 /** |
| 12976 * Initialize a newly created while statement. | 14510 * Initialize a newly created while statement. |
| 14511 * |
| 12977 * @param keyword the token representing the 'while' keyword | 14512 * @param keyword the token representing the 'while' keyword |
| 12978 * @param leftParenthesis the left parenthesis | 14513 * @param leftParenthesis the left parenthesis |
| 12979 * @param condition the expression used to determine whether to execute the bo
dy of the loop | 14514 * @param condition the expression used to determine whether to execute the bo
dy of the loop |
| 12980 * @param rightParenthesis the right parenthesis | 14515 * @param rightParenthesis the right parenthesis |
| 12981 * @param body the body of the loop | 14516 * @param body the body of the loop |
| 12982 */ | 14517 */ |
| 12983 WhileStatement.full(Token keyword, Token leftParenthesis, Expression condition
, Token rightParenthesis, Statement body) { | 14518 WhileStatement.full(Token keyword, Token leftParenthesis, Expression condition
, Token rightParenthesis, Statement body) { |
| 12984 this._keyword = keyword; | 14519 this._keyword = keyword; |
| 12985 this._leftParenthesis = leftParenthesis; | 14520 this._leftParenthesis = leftParenthesis; |
| 12986 this._condition = becomeParentOf(condition); | 14521 this._condition = becomeParentOf(condition); |
| 12987 this._rightParenthesis = rightParenthesis; | 14522 this._rightParenthesis = rightParenthesis; |
| 12988 this._body = becomeParentOf(body); | 14523 this._body = becomeParentOf(body); |
| 12989 } | 14524 } |
| 12990 | 14525 |
| 12991 /** | 14526 /** |
| 12992 * Initialize a newly created while statement. | 14527 * Initialize a newly created while statement. |
| 14528 * |
| 12993 * @param keyword the token representing the 'while' keyword | 14529 * @param keyword the token representing the 'while' keyword |
| 12994 * @param leftParenthesis the left parenthesis | 14530 * @param leftParenthesis the left parenthesis |
| 12995 * @param condition the expression used to determine whether to execute the bo
dy of the loop | 14531 * @param condition the expression used to determine whether to execute the bo
dy of the loop |
| 12996 * @param rightParenthesis the right parenthesis | 14532 * @param rightParenthesis the right parenthesis |
| 12997 * @param body the body of the loop | 14533 * @param body the body of the loop |
| 12998 */ | 14534 */ |
| 12999 WhileStatement({Token keyword, Token leftParenthesis, Expression condition, To
ken rightParenthesis, Statement body}) : this.full(keyword, leftParenthesis, con
dition, rightParenthesis, body); | 14535 WhileStatement({Token keyword, Token leftParenthesis, Expression condition, To
ken rightParenthesis, Statement body}) : this.full(keyword, leftParenthesis, con
dition, rightParenthesis, body); |
| 13000 accept(ASTVisitor visitor) => visitor.visitWhileStatement(this); | 14536 accept(ASTVisitor visitor) => visitor.visitWhileStatement(this); |
| 13001 Token get beginToken => _keyword; | 14537 Token get beginToken => _keyword; |
| 13002 | 14538 |
| 13003 /** | 14539 /** |
| 13004 * Return the body of the loop. | 14540 * Return the body of the loop. |
| 14541 * |
| 13005 * @return the body of the loop | 14542 * @return the body of the loop |
| 13006 */ | 14543 */ |
| 13007 Statement get body => _body; | 14544 Statement get body => _body; |
| 13008 | 14545 |
| 13009 /** | 14546 /** |
| 13010 * Return the expression used to determine whether to execute the body of the
loop. | 14547 * Return the expression used to determine whether to execute the body of the
loop. |
| 14548 * |
| 13011 * @return the expression used to determine whether to execute the body of the
loop | 14549 * @return the expression used to determine whether to execute the body of the
loop |
| 13012 */ | 14550 */ |
| 13013 Expression get condition => _condition; | 14551 Expression get condition => _condition; |
| 13014 Token get endToken => _body.endToken; | 14552 Token get endToken => _body.endToken; |
| 13015 | 14553 |
| 13016 /** | 14554 /** |
| 13017 * Return the token representing the 'while' keyword. | 14555 * Return the token representing the 'while' keyword. |
| 14556 * |
| 13018 * @return the token representing the 'while' keyword | 14557 * @return the token representing the 'while' keyword |
| 13019 */ | 14558 */ |
| 13020 Token get keyword => _keyword; | 14559 Token get keyword => _keyword; |
| 13021 | 14560 |
| 13022 /** | 14561 /** |
| 13023 * Return the left parenthesis. | 14562 * Return the left parenthesis. |
| 14563 * |
| 13024 * @return the left parenthesis | 14564 * @return the left parenthesis |
| 13025 */ | 14565 */ |
| 13026 Token get leftParenthesis => _leftParenthesis; | 14566 Token get leftParenthesis => _leftParenthesis; |
| 13027 | 14567 |
| 13028 /** | 14568 /** |
| 13029 * Return the right parenthesis. | 14569 * Return the right parenthesis. |
| 14570 * |
| 13030 * @return the right parenthesis | 14571 * @return the right parenthesis |
| 13031 */ | 14572 */ |
| 13032 Token get rightParenthesis => _rightParenthesis; | 14573 Token get rightParenthesis => _rightParenthesis; |
| 13033 | 14574 |
| 13034 /** | 14575 /** |
| 13035 * Set the body of the loop to the given statement. | 14576 * Set the body of the loop to the given statement. |
| 14577 * |
| 13036 * @param statement the body of the loop | 14578 * @param statement the body of the loop |
| 13037 */ | 14579 */ |
| 13038 void set body(Statement statement) { | 14580 void set body(Statement statement) { |
| 13039 _body = becomeParentOf(statement); | 14581 _body = becomeParentOf(statement); |
| 13040 } | 14582 } |
| 13041 | 14583 |
| 13042 /** | 14584 /** |
| 13043 * Set the expression used to determine whether to execute the body of the loo
p to the given | 14585 * Set the expression used to determine whether to execute the body of the loo
p to the given |
| 13044 * expression. | 14586 * expression. |
| 14587 * |
| 13045 * @param expression the expression used to determine whether to execute the b
ody of the loop | 14588 * @param expression the expression used to determine whether to execute the b
ody of the loop |
| 13046 */ | 14589 */ |
| 13047 void set condition(Expression expression) { | 14590 void set condition(Expression expression) { |
| 13048 _condition = becomeParentOf(expression); | 14591 _condition = becomeParentOf(expression); |
| 13049 } | 14592 } |
| 13050 | 14593 |
| 13051 /** | 14594 /** |
| 13052 * Set the token representing the 'while' keyword to the given token. | 14595 * Set the token representing the 'while' keyword to the given token. |
| 14596 * |
| 13053 * @param keyword the token representing the 'while' keyword | 14597 * @param keyword the token representing the 'while' keyword |
| 13054 */ | 14598 */ |
| 13055 void set keyword(Token keyword2) { | 14599 void set keyword(Token keyword2) { |
| 13056 this._keyword = keyword2; | 14600 this._keyword = keyword2; |
| 13057 } | 14601 } |
| 13058 | 14602 |
| 13059 /** | 14603 /** |
| 13060 * Set the left parenthesis to the given token. | 14604 * Set the left parenthesis to the given token. |
| 14605 * |
| 13061 * @param leftParenthesis the left parenthesis | 14606 * @param leftParenthesis the left parenthesis |
| 13062 */ | 14607 */ |
| 13063 void set leftParenthesis(Token leftParenthesis2) { | 14608 void set leftParenthesis(Token leftParenthesis2) { |
| 13064 this._leftParenthesis = leftParenthesis2; | 14609 this._leftParenthesis = leftParenthesis2; |
| 13065 } | 14610 } |
| 13066 | 14611 |
| 13067 /** | 14612 /** |
| 13068 * Set the right parenthesis to the given token. | 14613 * Set the right parenthesis to the given token. |
| 14614 * |
| 13069 * @param rightParenthesis the right parenthesis | 14615 * @param rightParenthesis the right parenthesis |
| 13070 */ | 14616 */ |
| 13071 void set rightParenthesis(Token rightParenthesis2) { | 14617 void set rightParenthesis(Token rightParenthesis2) { |
| 13072 this._rightParenthesis = rightParenthesis2; | 14618 this._rightParenthesis = rightParenthesis2; |
| 13073 } | 14619 } |
| 13074 void visitChildren(ASTVisitor<Object> visitor) { | 14620 void visitChildren(ASTVisitor<Object> visitor) { |
| 13075 safelyVisitChild(_condition, visitor); | 14621 safelyVisitChild(_condition, visitor); |
| 13076 safelyVisitChild(_body, visitor); | 14622 safelyVisitChild(_body, visitor); |
| 13077 } | 14623 } |
| 13078 } | 14624 } |
| 13079 /** | 14625 /** |
| 13080 * Instances of the class `WithClause` represent the with clause in a class decl
aration. | 14626 * Instances of the class `WithClause` represent the with clause in a class decl
aration. |
| 14627 * |
| 13081 * <pre> | 14628 * <pre> |
| 13082 * withClause ::= | 14629 * withClause ::= |
| 13083 * 'with' [TypeName mixin] (',' [TypeName mixin]) | 14630 * 'with' [TypeName] (',' [TypeName])* |
| 13084 * </pre> | 14631 * </pre> |
| 14632 * |
| 13085 * @coverage dart.engine.ast | 14633 * @coverage dart.engine.ast |
| 13086 */ | 14634 */ |
| 13087 class WithClause extends ASTNode { | 14635 class WithClause extends ASTNode { |
| 13088 | 14636 |
| 13089 /** | 14637 /** |
| 13090 * The token representing the 'with' keyword. | 14638 * The token representing the 'with' keyword. |
| 13091 */ | 14639 */ |
| 13092 Token _withKeyword; | 14640 Token _withKeyword; |
| 13093 | 14641 |
| 13094 /** | 14642 /** |
| 13095 * The names of the mixins that were specified. | 14643 * The names of the mixins that were specified. |
| 13096 */ | 14644 */ |
| 13097 NodeList<TypeName> _mixinTypes; | 14645 NodeList<TypeName> _mixinTypes; |
| 13098 | 14646 |
| 13099 /** | 14647 /** |
| 13100 * Initialize a newly created with clause. | 14648 * Initialize a newly created with clause. |
| 14649 * |
| 13101 * @param withKeyword the token representing the 'with' keyword | 14650 * @param withKeyword the token representing the 'with' keyword |
| 13102 * @param mixinTypes the names of the mixins that were specified | 14651 * @param mixinTypes the names of the mixins that were specified |
| 13103 */ | 14652 */ |
| 13104 WithClause.full(Token withKeyword, List<TypeName> mixinTypes) { | 14653 WithClause.full(Token withKeyword, List<TypeName> mixinTypes) { |
| 13105 this._mixinTypes = new NodeList<TypeName>(this); | 14654 this._mixinTypes = new NodeList<TypeName>(this); |
| 13106 this._withKeyword = withKeyword; | 14655 this._withKeyword = withKeyword; |
| 13107 this._mixinTypes.addAll(mixinTypes); | 14656 this._mixinTypes.addAll(mixinTypes); |
| 13108 } | 14657 } |
| 13109 | 14658 |
| 13110 /** | 14659 /** |
| 13111 * Initialize a newly created with clause. | 14660 * Initialize a newly created with clause. |
| 14661 * |
| 13112 * @param withKeyword the token representing the 'with' keyword | 14662 * @param withKeyword the token representing the 'with' keyword |
| 13113 * @param mixinTypes the names of the mixins that were specified | 14663 * @param mixinTypes the names of the mixins that were specified |
| 13114 */ | 14664 */ |
| 13115 WithClause({Token withKeyword, List<TypeName> mixinTypes}) : this.full(withKey
word, mixinTypes); | 14665 WithClause({Token withKeyword, List<TypeName> mixinTypes}) : this.full(withKey
word, mixinTypes); |
| 13116 accept(ASTVisitor visitor) => visitor.visitWithClause(this); | 14666 accept(ASTVisitor visitor) => visitor.visitWithClause(this); |
| 13117 Token get beginToken => _withKeyword; | 14667 Token get beginToken => _withKeyword; |
| 13118 Token get endToken => _mixinTypes.endToken; | 14668 Token get endToken => _mixinTypes.endToken; |
| 13119 | 14669 |
| 13120 /** | 14670 /** |
| 13121 * Return the names of the mixins that were specified. | 14671 * Return the names of the mixins that were specified. |
| 14672 * |
| 13122 * @return the names of the mixins that were specified | 14673 * @return the names of the mixins that were specified |
| 13123 */ | 14674 */ |
| 13124 NodeList<TypeName> get mixinTypes => _mixinTypes; | 14675 NodeList<TypeName> get mixinTypes => _mixinTypes; |
| 13125 | 14676 |
| 13126 /** | 14677 /** |
| 13127 * Return the token representing the 'with' keyword. | 14678 * Return the token representing the 'with' keyword. |
| 14679 * |
| 13128 * @return the token representing the 'with' keyword | 14680 * @return the token representing the 'with' keyword |
| 13129 */ | 14681 */ |
| 13130 Token get withKeyword => _withKeyword; | 14682 Token get withKeyword => _withKeyword; |
| 13131 | 14683 |
| 13132 /** | 14684 /** |
| 13133 * Set the token representing the 'with' keyword to the given token. | 14685 * Set the token representing the 'with' keyword to the given token. |
| 14686 * |
| 13134 * @param withKeyword the token representing the 'with' keyword | 14687 * @param withKeyword the token representing the 'with' keyword |
| 13135 */ | 14688 */ |
| 13136 void set mixinKeyword(Token withKeyword2) { | 14689 void set mixinKeyword(Token withKeyword2) { |
| 13137 this._withKeyword = withKeyword2; | 14690 this._withKeyword = withKeyword2; |
| 13138 } | 14691 } |
| 13139 void visitChildren(ASTVisitor<Object> visitor) { | 14692 void visitChildren(ASTVisitor<Object> visitor) { |
| 13140 _mixinTypes.accept(visitor); | 14693 _mixinTypes.accept(visitor); |
| 13141 } | 14694 } |
| 13142 } | 14695 } |
| 13143 /** | 14696 /** |
| 13144 * Instances of the class `BreadthFirstVisitor` implement an AST visitor that wi
ll recursively | 14697 * Instances of the class `BreadthFirstVisitor` implement an AST visitor that wi
ll recursively |
| 13145 * visit all of the nodes in an AST structure, similar to [GeneralizingASTVisito
r]. This | 14698 * visit all of the nodes in an AST structure, similar to [GeneralizingASTVisito
r]. This |
| 13146 * visitor uses a breadth-first ordering rather than the depth-first ordering of
[GeneralizingASTVisitor]. | 14699 * visitor uses a breadth-first ordering rather than the depth-first ordering of |
| 14700 * [GeneralizingASTVisitor]. |
| 14701 * |
| 13147 * @coverage dart.engine.ast | 14702 * @coverage dart.engine.ast |
| 13148 */ | 14703 */ |
| 13149 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> { | 14704 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> { |
| 13150 Queue<ASTNode> _queue = new Queue<ASTNode>(); | 14705 Queue<ASTNode> _queue = new Queue<ASTNode>(); |
| 13151 GeneralizingASTVisitor<Object> _childVisitor; | 14706 GeneralizingASTVisitor<Object> _childVisitor; |
| 13152 | 14707 |
| 13153 /** | 14708 /** |
| 13154 * Visit all nodes in the tree starting at the given `root` node, in depth-fir
st order. | 14709 * Visit all nodes in the tree starting at the given `root` node, in depth-fir
st order. |
| 14710 * |
| 13155 * @param root the root of the ASTNode tree | 14711 * @param root the root of the ASTNode tree |
| 13156 */ | 14712 */ |
| 13157 void visitAllNodes(ASTNode root) { | 14713 void visitAllNodes(ASTNode root) { |
| 13158 _queue.add(root); | 14714 _queue.add(root); |
| 13159 while (!_queue.isEmpty) { | 14715 while (!_queue.isEmpty) { |
| 13160 ASTNode next = _queue.removeFirst(); | 14716 ASTNode next = _queue.removeFirst(); |
| 13161 next.accept(this); | 14717 next.accept(this); |
| 13162 } | 14718 } |
| 13163 } | 14719 } |
| 13164 R visitNode(ASTNode node) { | 14720 R visitNode(ASTNode node) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 13187 * * A literal string where any interpolated expression is a compile-time consta
nt that evaluates | 14743 * * A literal string where any interpolated expression is a compile-time consta
nt that evaluates |
| 13188 * to a numeric, string or boolean value or to `null`. | 14744 * to a numeric, string or boolean value or to `null`. |
| 13189 * * `null`. | 14745 * * `null`. |
| 13190 * * A reference to a static constant variable. | 14746 * * A reference to a static constant variable. |
| 13191 * * An identifier expression that denotes a constant variable, a class or a typ
e variable. | 14747 * * An identifier expression that denotes a constant variable, a class or a typ
e variable. |
| 13192 * * A constant constructor invocation. | 14748 * * A constant constructor invocation. |
| 13193 * * A constant list literal. | 14749 * * A constant list literal. |
| 13194 * * A constant map literal. | 14750 * * A constant map literal. |
| 13195 * * A simple or qualified identifier denoting a top-level function or a static
method. | 14751 * * A simple or qualified identifier denoting a top-level function or a static
method. |
| 13196 * * A parenthesized expression `(e)` where `e` is a constant expression. | 14752 * * A parenthesized expression `(e)` where `e` is a constant expression. |
| 13197 * * An expression of one of the forms `identical(e1, e2)`, `e1 == e2`,`e1 != e2
` where `e1` and `e2` are constant expressions that evaluate to a | 14753 * * An expression of one of the forms `identical(e1, e2)`, `e1 == e2`, |
| 14754 * `e1 != e2` where `e1` and `e2` are constant expressions that evaluate to a |
| 13198 * numeric, string or boolean value or to `null`. | 14755 * numeric, string or boolean value or to `null`. |
| 13199 * * An expression of one of the forms `!e`, `e1 && e2` or `e1 || e2`, where`e`,
`e1` and `e2` are constant expressions that evaluate to a boolean value or | 14756 * * An expression of one of the forms `!e`, `e1 && e2` or `e1 || e2`, where |
| 14757 * `e`, `e1` and `e2` are constant expressions that evaluate to a boolean value
or |
| 13200 * to `null`. | 14758 * to `null`. |
| 13201 * * An expression of one of the forms `~e`, `e1 ^ e2`, `e1 & e2`,`e1 | e2`, `e1
>> e2` or `e1 << e2`, where `e`, `e1` and `e2`are constant expressions that eva
luate to an integer value or to `null`. | 14759 * * An expression of one of the forms `~e`, `e1 ^ e2`, `e1 & e2`, |
| 13202 * * An expression of one of the forms `-e`, `e1 + e2`, `e1 - e2`,`e1 * e2`, `e1
/ e2`, `e1 ~/ e2`, `e1 > e2`, `e1 < e2`,`e1 >= e2`, `e1 <= e2` or `e1 % e2`, wh
ere `e`, `e1` and `e2`are constant expressions that evaluate to a numeric value
or to `null`. | 14760 * `e1 | e2`, `e1 >> e2` or `e1 << e2`, where `e`, `e1` and `e2` |
| 14761 * are constant expressions that evaluate to an integer value or to `null`. |
| 14762 * * An expression of one of the forms `-e`, `e1 + e2`, `e1 - e2`, |
| 14763 * `e1 * e2`, `e1 / e2`, `e1 ~/ e2`, `e1 > e2`, `e1 < e2`, |
| 14764 * `e1 >= e2`, `e1 <= e2` or `e1 % e2`, where `e`, `e1` and `e2` |
| 14765 * are constant expressions that evaluate to a numeric value or to `null`. |
| 13203 * | 14766 * |
| 13204 * </blockquote> The values returned by instances of this class are therefore `n
ull` and | 14767 * </blockquote> The values returned by instances of this class are therefore `n
ull` and |
| 13205 * instances of the classes `Boolean`, `BigInteger`, `Double`, `String`, and`Dar
tObject`. | 14768 * instances of the classes `Boolean`, `BigInteger`, `Double`, `String`, and |
| 14769 * `DartObject`. |
| 13206 * | 14770 * |
| 13207 * In addition, this class defines several values that can be returned to indica
te various | 14771 * In addition, this class defines several values that can be returned to indica
te various |
| 13208 * conditions encountered during evaluation. These are documented with the stati
c field that define | 14772 * conditions encountered during evaluation. These are documented with the stati
c field that define |
| 13209 * those values. | 14773 * those values. |
| 14774 * |
| 13210 * @coverage dart.engine.ast | 14775 * @coverage dart.engine.ast |
| 13211 */ | 14776 */ |
| 13212 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { | 14777 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { |
| 13213 | 14778 |
| 13214 /** | 14779 /** |
| 13215 * The value returned for expressions (or non-expression nodes) that are not c
ompile-time constant | 14780 * The value returned for expressions (or non-expression nodes) that are not c
ompile-time constant |
| 13216 * expressions. | 14781 * expressions. |
| 13217 */ | 14782 */ |
| 13218 static Object NOT_A_CONSTANT = new Object(); | 14783 static Object NOT_A_CONSTANT = new Object(); |
| 13219 Object visitAdjacentStrings(AdjacentStrings node) { | 14784 Object visitAdjacentStrings(AdjacentStrings node) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13436 if (identical(value, NOT_A_CONSTANT)) { | 15001 if (identical(value, NOT_A_CONSTANT)) { |
| 13437 return value; | 15002 return value; |
| 13438 } | 15003 } |
| 13439 builder.append(value); | 15004 builder.append(value); |
| 13440 } | 15005 } |
| 13441 return builder.toString(); | 15006 return builder.toString(); |
| 13442 } | 15007 } |
| 13443 | 15008 |
| 13444 /** | 15009 /** |
| 13445 * Return the constant value of the static constant represented by the given e
lement. | 15010 * Return the constant value of the static constant represented by the given e
lement. |
| 15011 * |
| 13446 * @param element the element whose value is to be returned | 15012 * @param element the element whose value is to be returned |
| 13447 * @return the constant value of the static constant | 15013 * @return the constant value of the static constant |
| 13448 */ | 15014 */ |
| 13449 Object getConstantValue(Element element) { | 15015 Object getConstantValue(Element element) { |
| 13450 if (element is FieldElement) { | 15016 if (element is FieldElement) { |
| 13451 FieldElement field = element as FieldElement; | 15017 FieldElement field = element as FieldElement; |
| 13452 if (field.isStatic && field.isConst) { | 15018 if (field.isStatic && field.isConst) { |
| 13453 } | 15019 } |
| 13454 } | 15020 } |
| 13455 return NOT_A_CONSTANT; | 15021 return NOT_A_CONSTANT; |
| 13456 } | 15022 } |
| 13457 } | 15023 } |
| 13458 /** | 15024 /** |
| 13459 * Instances of the class `ElementLocator` locate the [Element Dart model elemen
t]associated with a given [ASTNode AST node]. | 15025 * Instances of the class `ElementLocator` locate the [Element] |
| 15026 * associated with a given [ASTNode]. |
| 15027 * |
| 13460 * @coverage dart.engine.ast | 15028 * @coverage dart.engine.ast |
| 13461 */ | 15029 */ |
| 13462 class ElementLocator { | 15030 class ElementLocator { |
| 13463 | 15031 |
| 13464 /** | 15032 /** |
| 13465 * Locate the [Element Dart model element] associated with the given [ASTNode
AST | 15033 * Locate the [Element] associated with the given [ASTNode]. |
| 13466 * node]. | 15034 * |
| 13467 * @param node the node (not `null`) | 15035 * @param node the node (not `null`) |
| 13468 * @return the associated element, or `null` if none is found | 15036 * @return the associated element, or `null` if none is found |
| 13469 */ | 15037 */ |
| 13470 static Element locate(ASTNode node) { | 15038 static Element locate(ASTNode node) { |
| 13471 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); | 15039 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); |
| 13472 return node.accept(mapper); | 15040 return node.accept(mapper); |
| 13473 } | 15041 } |
| 13474 } | 15042 } |
| 13475 /** | 15043 /** |
| 13476 * Visitor that maps nodes to elements. | 15044 * Visitor that maps nodes to elements. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13521 ASTNode parent = node.parent; | 15089 ASTNode parent = node.parent; |
| 13522 if (parent is UriBasedDirective) { | 15090 if (parent is UriBasedDirective) { |
| 13523 return ((parent as UriBasedDirective)).uriElement; | 15091 return ((parent as UriBasedDirective)).uriElement; |
| 13524 } | 15092 } |
| 13525 return null; | 15093 return null; |
| 13526 } | 15094 } |
| 13527 Element visitVariableDeclaration(VariableDeclaration node) => node.element; | 15095 Element visitVariableDeclaration(VariableDeclaration node) => node.element; |
| 13528 } | 15096 } |
| 13529 /** | 15097 /** |
| 13530 * Instances of the class `GeneralizingASTVisitor` implement an AST visitor that
will | 15098 * Instances of the class `GeneralizingASTVisitor` implement an AST visitor that
will |
| 13531 * recursively visit all of the nodes in an AST structure (like instances of the
class[RecursiveASTVisitor]). In addition, when a node of a specific type is vis
ited not only | 15099 * recursively visit all of the nodes in an AST structure (like instances of the
class |
| 15100 * [RecursiveASTVisitor]). In addition, when a node of a specific type is visite
d not only |
| 13532 * will the visit method for that specific type of node be invoked, but addition
al methods for the | 15101 * will the visit method for that specific type of node be invoked, but addition
al methods for the |
| 13533 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to | 15102 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to |
| 13534 * visit a [Block] will cause the method [visitBlock] to be invoked but will | 15103 * visit a [Block] will cause the method [visitBlock] to be invoked but will |
| 13535 * also cause the methods [visitStatement] and [visitNode] to be | 15104 * also cause the methods [visitStatement] and [visitNode] to be |
| 13536 * subsequently invoked. This allows visitors to be written that visit all state
ments without | 15105 * subsequently invoked. This allows visitors to be written that visit all state
ments without |
| 13537 * needing to override the visit method for each of the specific subclasses of [
Statement]. | 15106 * needing to override the visit method for each of the specific subclasses of [
Statement]. |
| 13538 * | 15107 * |
| 13539 * Subclasses that override a visit method must either invoke the overridden vis
it method or | 15108 * Subclasses that override a visit method must either invoke the overridden vis
it method or |
| 13540 * explicitly invoke the more general visit method. Failure to do so will cause
the visit methods | 15109 * explicitly invoke the more general visit method. Failure to do so will cause
the visit methods |
| 13541 * for superclasses of the node to not be invoked and will cause the children of
the visited node to | 15110 * for superclasses of the node to not be invoked and will cause the children of
the visited node to |
| 13542 * not be visited. | 15111 * not be visited. |
| 15112 * |
| 13543 * @coverage dart.engine.ast | 15113 * @coverage dart.engine.ast |
| 13544 */ | 15114 */ |
| 13545 class GeneralizingASTVisitor<R> implements ASTVisitor<R> { | 15115 class GeneralizingASTVisitor<R> implements ASTVisitor<R> { |
| 13546 R visitAdjacentStrings(AdjacentStrings node) => visitStringLiteral(node); | 15116 R visitAdjacentStrings(AdjacentStrings node) => visitStringLiteral(node); |
| 13547 R visitAnnotatedNode(AnnotatedNode node) => visitNode(node); | 15117 R visitAnnotatedNode(AnnotatedNode node) => visitNode(node); |
| 13548 R visitAnnotation(Annotation node) => visitNode(node); | 15118 R visitAnnotation(Annotation node) => visitNode(node); |
| 13549 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => visitExpression(
node); | 15119 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => visitExpression(
node); |
| 13550 R visitArgumentList(ArgumentList node) => visitNode(node); | 15120 R visitArgumentList(ArgumentList node) => visitNode(node); |
| 13551 R visitAsExpression(AsExpression node) => visitExpression(node); | 15121 R visitAsExpression(AsExpression node) => visitExpression(node); |
| 13552 R visitAssertStatement(AssertStatement node) => visitStatement(node); | 15122 R visitAssertStatement(AssertStatement node) => visitStatement(node); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13664 R visitTypeParameter(TypeParameter node) => visitNode(node); | 15234 R visitTypeParameter(TypeParameter node) => visitNode(node); |
| 13665 R visitTypeParameterList(TypeParameterList node) => visitNode(node); | 15235 R visitTypeParameterList(TypeParameterList node) => visitNode(node); |
| 13666 R visitUriBasedDirective(UriBasedDirective node) => visitDirective(node); | 15236 R visitUriBasedDirective(UriBasedDirective node) => visitDirective(node); |
| 13667 R visitVariableDeclaration(VariableDeclaration node) => visitDeclaration(node)
; | 15237 R visitVariableDeclaration(VariableDeclaration node) => visitDeclaration(node)
; |
| 13668 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node
); | 15238 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node
); |
| 13669 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi
tStatement(node); | 15239 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi
tStatement(node); |
| 13670 R visitWhileStatement(WhileStatement node) => visitStatement(node); | 15240 R visitWhileStatement(WhileStatement node) => visitStatement(node); |
| 13671 R visitWithClause(WithClause node) => visitNode(node); | 15241 R visitWithClause(WithClause node) => visitNode(node); |
| 13672 } | 15242 } |
| 13673 /** | 15243 /** |
| 13674 * Instances of the class `NodeLocator` locate the [ASTNode AST node] associated
with a | 15244 * Instances of the class `NodeLocator` locate the [ASTNode] associated with a |
| 13675 * source range, given the AST structure built from the source. More specificall
y, they will return | 15245 * source range, given the AST structure built from the source. More specificall
y, they will return |
| 13676 * the [ASTNode AST node] with the shortest length whose source range completely
encompasses | 15246 * the [ASTNode] with the shortest length whose source range completely encompas
ses |
| 13677 * the specified range. | 15247 * the specified range. |
| 15248 * |
| 13678 * @coverage dart.engine.ast | 15249 * @coverage dart.engine.ast |
| 13679 */ | 15250 */ |
| 13680 class NodeLocator extends GeneralizingASTVisitor<Object> { | 15251 class NodeLocator extends GeneralizingASTVisitor<Object> { |
| 13681 | 15252 |
| 13682 /** | 15253 /** |
| 13683 * The start offset of the range used to identify the node. | 15254 * The start offset of the range used to identify the node. |
| 13684 */ | 15255 */ |
| 13685 int _startOffset = 0; | 15256 int _startOffset = 0; |
| 13686 | 15257 |
| 13687 /** | 15258 /** |
| 13688 * The end offset of the range used to identify the node. | 15259 * The end offset of the range used to identify the node. |
| 13689 */ | 15260 */ |
| 13690 int _endOffset = 0; | 15261 int _endOffset = 0; |
| 13691 | 15262 |
| 13692 /** | 15263 /** |
| 13693 * The element that was found that corresponds to the given source range, or `
null` if there | 15264 * The element that was found that corresponds to the given source range, or `
null` if there |
| 13694 * is no such element. | 15265 * is no such element. |
| 13695 */ | 15266 */ |
| 13696 ASTNode _foundNode; | 15267 ASTNode _foundNode; |
| 13697 | 15268 |
| 13698 /** | 15269 /** |
| 13699 * Initialize a newly created locator to locate one or more [ASTNode AST nodes
] by locating | 15270 * Initialize a newly created locator to locate one or more [ASTNode] by locat
ing |
| 13700 * the node within an AST structure that corresponds to the given offset in th
e source. | 15271 * the node within an AST structure that corresponds to the given offset in th
e source. |
| 15272 * |
| 13701 * @param offset the offset used to identify the node | 15273 * @param offset the offset used to identify the node |
| 13702 */ | 15274 */ |
| 13703 NodeLocator.con1(int offset) { | 15275 NodeLocator.con1(int offset) { |
| 13704 _jtd_constructor_120_impl(offset); | 15276 _jtd_constructor_120_impl(offset); |
| 13705 } | 15277 } |
| 13706 _jtd_constructor_120_impl(int offset) { | 15278 _jtd_constructor_120_impl(int offset) { |
| 13707 _jtd_constructor_121_impl(offset, offset); | 15279 _jtd_constructor_121_impl(offset, offset); |
| 13708 } | 15280 } |
| 13709 | 15281 |
| 13710 /** | 15282 /** |
| 13711 * Initialize a newly created locator to locate one or more [ASTNode AST nodes
] by locating | 15283 * Initialize a newly created locator to locate one or more [ASTNode] by locat
ing |
| 13712 * the node within an AST structure that corresponds to the given range of cha
racters in the | 15284 * the node within an AST structure that corresponds to the given range of cha
racters in the |
| 13713 * source. | 15285 * source. |
| 15286 * |
| 13714 * @param start the start offset of the range used to identify the node | 15287 * @param start the start offset of the range used to identify the node |
| 13715 * @param end the end offset of the range used to identify the node | 15288 * @param end the end offset of the range used to identify the node |
| 13716 */ | 15289 */ |
| 13717 NodeLocator.con2(int start, int end) { | 15290 NodeLocator.con2(int start, int end) { |
| 13718 _jtd_constructor_121_impl(start, end); | 15291 _jtd_constructor_121_impl(start, end); |
| 13719 } | 15292 } |
| 13720 _jtd_constructor_121_impl(int start, int end) { | 15293 _jtd_constructor_121_impl(int start, int end) { |
| 13721 this._startOffset = start; | 15294 this._startOffset = start; |
| 13722 this._endOffset = end; | 15295 this._endOffset = end; |
| 13723 } | 15296 } |
| 13724 | 15297 |
| 13725 /** | 15298 /** |
| 13726 * Return the node that was found that corresponds to the given source range,
or `null` if | 15299 * Return the node that was found that corresponds to the given source range,
or `null` if |
| 13727 * there is no such node. | 15300 * there is no such node. |
| 15301 * |
| 13728 * @return the node that was found | 15302 * @return the node that was found |
| 13729 */ | 15303 */ |
| 13730 ASTNode get foundNode => _foundNode; | 15304 ASTNode get foundNode => _foundNode; |
| 13731 | 15305 |
| 13732 /** | 15306 /** |
| 13733 * Search within the given AST node for an identifier representing a [DartElem
ent Dart | 15307 * Search within the given AST node for an identifier representing a [DartElem
ent] in the specified source range. Return the element that was found, or `null`
if |
| 13734 * element] in the specified source range. Return the element that was found,
or `null` if | |
| 13735 * no element was found. | 15308 * no element was found. |
| 15309 * |
| 13736 * @param node the AST node within which to search | 15310 * @param node the AST node within which to search |
| 13737 * @return the element that was found | 15311 * @return the element that was found |
| 13738 */ | 15312 */ |
| 13739 ASTNode searchWithin(ASTNode node) { | 15313 ASTNode searchWithin(ASTNode node) { |
| 13740 try { | 15314 try { |
| 13741 node.accept(this); | 15315 node.accept(this); |
| 13742 } on NodeLocator_NodeFoundException catch (exception) { | 15316 } on NodeLocator_NodeFoundException catch (exception) { |
| 13743 } catch (exception) { | 15317 } catch (exception) { |
| 13744 AnalysisEngine.instance.logger.logInformation2("Unable to locate element a
t offset (${_startOffset} - ${_endOffset})", exception); | 15318 AnalysisEngine.instance.logger.logInformation2("Unable to locate element a
t offset (${_startOffset} - ${_endOffset})", exception); |
| 13745 return null; | 15319 return null; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13777 static int _serialVersionUID = 1; | 15351 static int _serialVersionUID = 1; |
| 13778 } | 15352 } |
| 13779 /** | 15353 /** |
| 13780 * Instances of the class `RecursiveASTVisitor` implement an AST visitor that wi
ll recursively | 15354 * Instances of the class `RecursiveASTVisitor` implement an AST visitor that wi
ll recursively |
| 13781 * visit all of the nodes in an AST structure. For example, using an instance of
this class to visit | 15355 * visit all of the nodes in an AST structure. For example, using an instance of
this class to visit |
| 13782 * a [Block] will also cause all of the statements in the block to be visited. | 15356 * a [Block] will also cause all of the statements in the block to be visited. |
| 13783 * | 15357 * |
| 13784 * Subclasses that override a visit method must either invoke the overridden vis
it method or must | 15358 * Subclasses that override a visit method must either invoke the overridden vis
it method or must |
| 13785 * explicitly ask the visited node to visit its children. Failure to do so will
cause the children | 15359 * explicitly ask the visited node to visit its children. Failure to do so will
cause the children |
| 13786 * of the visited node to not be visited. | 15360 * of the visited node to not be visited. |
| 15361 * |
| 13787 * @coverage dart.engine.ast | 15362 * @coverage dart.engine.ast |
| 13788 */ | 15363 */ |
| 13789 class RecursiveASTVisitor<R> implements ASTVisitor<R> { | 15364 class RecursiveASTVisitor<R> implements ASTVisitor<R> { |
| 13790 R visitAdjacentStrings(AdjacentStrings node) { | 15365 R visitAdjacentStrings(AdjacentStrings node) { |
| 13791 node.visitChildren(this); | 15366 node.visitChildren(this); |
| 13792 return null; | 15367 return null; |
| 13793 } | 15368 } |
| 13794 R visitAnnotation(Annotation node) { | 15369 R visitAnnotation(Annotation node) { |
| 13795 node.visitChildren(this); | 15370 node.visitChildren(this); |
| 13796 return null; | 15371 return null; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14190 R visitWithClause(WithClause node) { | 15765 R visitWithClause(WithClause node) { |
| 14191 node.visitChildren(this); | 15766 node.visitChildren(this); |
| 14192 return null; | 15767 return null; |
| 14193 } | 15768 } |
| 14194 } | 15769 } |
| 14195 /** | 15770 /** |
| 14196 * Instances of the class `SimpleASTVisitor` implement an AST visitor that will
do nothing | 15771 * Instances of the class `SimpleASTVisitor` implement an AST visitor that will
do nothing |
| 14197 * when visiting an AST node. It is intended to be a superclass for classes that
use the visitor | 15772 * when visiting an AST node. It is intended to be a superclass for classes that
use the visitor |
| 14198 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel
y visit a whole | 15773 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel
y visit a whole |
| 14199 * structure) and that only need to visit a small number of node types. | 15774 * structure) and that only need to visit a small number of node types. |
| 15775 * |
| 14200 * @coverage dart.engine.ast | 15776 * @coverage dart.engine.ast |
| 14201 */ | 15777 */ |
| 14202 class SimpleASTVisitor<R> implements ASTVisitor<R> { | 15778 class SimpleASTVisitor<R> implements ASTVisitor<R> { |
| 14203 R visitAdjacentStrings(AdjacentStrings node) => null; | 15779 R visitAdjacentStrings(AdjacentStrings node) => null; |
| 14204 R visitAnnotation(Annotation node) => null; | 15780 R visitAnnotation(Annotation node) => null; |
| 14205 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => null; | 15781 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => null; |
| 14206 R visitArgumentList(ArgumentList node) => null; | 15782 R visitArgumentList(ArgumentList node) => null; |
| 14207 R visitAsExpression(AsExpression node) => null; | 15783 R visitAsExpression(AsExpression node) => null; |
| 14208 R visitAssertStatement(AssertStatement node) => null; | 15784 R visitAssertStatement(AssertStatement node) => null; |
| 14209 R visitAssignmentExpression(AssignmentExpression node) => null; | 15785 R visitAssignmentExpression(AssignmentExpression node) => null; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14298 R visitTypeParameterList(TypeParameterList node) => null; | 15874 R visitTypeParameterList(TypeParameterList node) => null; |
| 14299 R visitVariableDeclaration(VariableDeclaration node) => null; | 15875 R visitVariableDeclaration(VariableDeclaration node) => null; |
| 14300 R visitVariableDeclarationList(VariableDeclarationList node) => null; | 15876 R visitVariableDeclarationList(VariableDeclarationList node) => null; |
| 14301 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null
; | 15877 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null
; |
| 14302 R visitWhileStatement(WhileStatement node) => null; | 15878 R visitWhileStatement(WhileStatement node) => null; |
| 14303 R visitWithClause(WithClause node) => null; | 15879 R visitWithClause(WithClause node) => null; |
| 14304 } | 15880 } |
| 14305 /** | 15881 /** |
| 14306 * Instances of the class `ToSourceVisitor` write a source representation of a v
isited AST | 15882 * Instances of the class `ToSourceVisitor` write a source representation of a v
isited AST |
| 14307 * node (and all of it's children) to a writer. | 15883 * node (and all of it's children) to a writer. |
| 15884 * |
| 14308 * @coverage dart.engine.ast | 15885 * @coverage dart.engine.ast |
| 14309 */ | 15886 */ |
| 14310 class ToSourceVisitor implements ASTVisitor<Object> { | 15887 class ToSourceVisitor implements ASTVisitor<Object> { |
| 14311 | 15888 |
| 14312 /** | 15889 /** |
| 14313 * The writer to which the source is to be written. | 15890 * The writer to which the source is to be written. |
| 14314 */ | 15891 */ |
| 14315 PrintWriter _writer; | 15892 PrintWriter _writer; |
| 14316 | 15893 |
| 14317 /** | 15894 /** |
| 14318 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the | 15895 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the |
| 14319 * given writer. | 15896 * given writer. |
| 15897 * |
| 14320 * @param writer the writer to which the source is to be written | 15898 * @param writer the writer to which the source is to be written |
| 14321 */ | 15899 */ |
| 14322 ToSourceVisitor(PrintWriter writer) { | 15900 ToSourceVisitor(PrintWriter writer) { |
| 14323 this._writer = writer; | 15901 this._writer = writer; |
| 14324 } | 15902 } |
| 14325 Object visitAdjacentStrings(AdjacentStrings node) { | 15903 Object visitAdjacentStrings(AdjacentStrings node) { |
| 14326 visitList2(node.strings, " "); | 15904 visitList2(node.strings, " "); |
| 14327 return null; | 15905 return null; |
| 14328 } | 15906 } |
| 14329 Object visitAnnotation(Annotation node) { | 15907 Object visitAnnotation(Annotation node) { |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15001 return null; | 16579 return null; |
| 15002 } | 16580 } |
| 15003 Object visitWithClause(WithClause node) { | 16581 Object visitWithClause(WithClause node) { |
| 15004 _writer.print("with "); | 16582 _writer.print("with "); |
| 15005 visitList2(node.mixinTypes, ", "); | 16583 visitList2(node.mixinTypes, ", "); |
| 15006 return null; | 16584 return null; |
| 15007 } | 16585 } |
| 15008 | 16586 |
| 15009 /** | 16587 /** |
| 15010 * Safely visit the given node. | 16588 * Safely visit the given node. |
| 16589 * |
| 15011 * @param node the node to be visited | 16590 * @param node the node to be visited |
| 15012 */ | 16591 */ |
| 15013 void visit(ASTNode node) { | 16592 void visit(ASTNode node) { |
| 15014 if (node != null) { | 16593 if (node != null) { |
| 15015 node.accept(this); | 16594 node.accept(this); |
| 15016 } | 16595 } |
| 15017 } | 16596 } |
| 15018 | 16597 |
| 15019 /** | 16598 /** |
| 15020 * Safely visit the given node, printing the suffix after the node if it is no
n-`null`. | 16599 * Safely visit the given node, printing the suffix after the node if it is no
n-`null`. |
| 16600 * |
| 15021 * @param suffix the suffix to be printed if there is a node to visit | 16601 * @param suffix the suffix to be printed if there is a node to visit |
| 15022 * @param node the node to be visited | 16602 * @param node the node to be visited |
| 15023 */ | 16603 */ |
| 15024 void visit2(ASTNode node, String suffix) { | 16604 void visit2(ASTNode node, String suffix) { |
| 15025 if (node != null) { | 16605 if (node != null) { |
| 15026 node.accept(this); | 16606 node.accept(this); |
| 15027 _writer.print(suffix); | 16607 _writer.print(suffix); |
| 15028 } | 16608 } |
| 15029 } | 16609 } |
| 15030 | 16610 |
| 15031 /** | 16611 /** |
| 15032 * Safely visit the given node, printing the prefix before the node if it is n
on-`null`. | 16612 * Safely visit the given node, printing the prefix before the node if it is n
on-`null`. |
| 16613 * |
| 15033 * @param prefix the prefix to be printed if there is a node to visit | 16614 * @param prefix the prefix to be printed if there is a node to visit |
| 15034 * @param node the node to be visited | 16615 * @param node the node to be visited |
| 15035 */ | 16616 */ |
| 15036 void visit3(String prefix, ASTNode node) { | 16617 void visit3(String prefix, ASTNode node) { |
| 15037 if (node != null) { | 16618 if (node != null) { |
| 15038 _writer.print(prefix); | 16619 _writer.print(prefix); |
| 15039 node.accept(this); | 16620 node.accept(this); |
| 15040 } | 16621 } |
| 15041 } | 16622 } |
| 15042 | 16623 |
| 15043 /** | 16624 /** |
| 15044 * Visit the given function body, printing the prefix before if given body is
not empty. | 16625 * Visit the given function body, printing the prefix before if given body is
not empty. |
| 16626 * |
| 15045 * @param prefix the prefix to be printed if there is a node to visit | 16627 * @param prefix the prefix to be printed if there is a node to visit |
| 15046 * @param body the function body to be visited | 16628 * @param body the function body to be visited |
| 15047 */ | 16629 */ |
| 15048 void visit4(String prefix, FunctionBody body) { | 16630 void visit4(String prefix, FunctionBody body) { |
| 15049 if (body is! EmptyFunctionBody) { | 16631 if (body is! EmptyFunctionBody) { |
| 15050 _writer.print(prefix); | 16632 _writer.print(prefix); |
| 15051 } | 16633 } |
| 15052 visit(body); | 16634 visit(body); |
| 15053 } | 16635 } |
| 15054 | 16636 |
| 15055 /** | 16637 /** |
| 15056 * Safely visit the given node, printing the suffix after the node if it is no
n-`null`. | 16638 * Safely visit the given node, printing the suffix after the node if it is no
n-`null`. |
| 16639 * |
| 15057 * @param suffix the suffix to be printed if there is a node to visit | 16640 * @param suffix the suffix to be printed if there is a node to visit |
| 15058 * @param node the node to be visited | 16641 * @param node the node to be visited |
| 15059 */ | 16642 */ |
| 15060 void visit5(Token token, String suffix) { | 16643 void visit5(Token token, String suffix) { |
| 15061 if (token != null) { | 16644 if (token != null) { |
| 15062 _writer.print(token.lexeme); | 16645 _writer.print(token.lexeme); |
| 15063 _writer.print(suffix); | 16646 _writer.print(suffix); |
| 15064 } | 16647 } |
| 15065 } | 16648 } |
| 15066 | 16649 |
| 15067 /** | 16650 /** |
| 15068 * Print a list of nodes without any separation. | 16651 * Print a list of nodes without any separation. |
| 16652 * |
| 15069 * @param nodes the nodes to be printed | 16653 * @param nodes the nodes to be printed |
| 15070 * @param separator the separator to be printed between adjacent nodes | 16654 * @param separator the separator to be printed between adjacent nodes |
| 15071 */ | 16655 */ |
| 15072 void visitList(NodeList<ASTNode> nodes) { | 16656 void visitList(NodeList<ASTNode> nodes) { |
| 15073 visitList2(nodes, ""); | 16657 visitList2(nodes, ""); |
| 15074 } | 16658 } |
| 15075 | 16659 |
| 15076 /** | 16660 /** |
| 15077 * Print a list of nodes, separated by the given separator. | 16661 * Print a list of nodes, separated by the given separator. |
| 16662 * |
| 15078 * @param nodes the nodes to be printed | 16663 * @param nodes the nodes to be printed |
| 15079 * @param separator the separator to be printed between adjacent nodes | 16664 * @param separator the separator to be printed between adjacent nodes |
| 15080 */ | 16665 */ |
| 15081 void visitList2(NodeList<ASTNode> nodes, String separator) { | 16666 void visitList2(NodeList<ASTNode> nodes, String separator) { |
| 15082 if (nodes != null) { | 16667 if (nodes != null) { |
| 15083 int size = nodes.length; | 16668 int size = nodes.length; |
| 15084 for (int i = 0; i < size; i++) { | 16669 for (int i = 0; i < size; i++) { |
| 15085 if (i > 0) { | 16670 if (i > 0) { |
| 15086 _writer.print(separator); | 16671 _writer.print(separator); |
| 15087 } | 16672 } |
| 15088 nodes[i].accept(this); | 16673 nodes[i].accept(this); |
| 15089 } | 16674 } |
| 15090 } | 16675 } |
| 15091 } | 16676 } |
| 15092 | 16677 |
| 15093 /** | 16678 /** |
| 15094 * Print a list of nodes, separated by the given separator. | 16679 * Print a list of nodes, separated by the given separator. |
| 16680 * |
| 15095 * @param nodes the nodes to be printed | 16681 * @param nodes the nodes to be printed |
| 15096 * @param separator the separator to be printed between adjacent nodes | 16682 * @param separator the separator to be printed between adjacent nodes |
| 15097 * @param suffix the suffix to be printed if the list is not empty | 16683 * @param suffix the suffix to be printed if the list is not empty |
| 15098 */ | 16684 */ |
| 15099 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { | 16685 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { |
| 15100 if (nodes != null) { | 16686 if (nodes != null) { |
| 15101 int size = nodes.length; | 16687 int size = nodes.length; |
| 15102 if (size > 0) { | 16688 if (size > 0) { |
| 15103 for (int i = 0; i < size; i++) { | 16689 for (int i = 0; i < size; i++) { |
| 15104 if (i > 0) { | 16690 if (i > 0) { |
| 15105 _writer.print(separator); | 16691 _writer.print(separator); |
| 15106 } | 16692 } |
| 15107 nodes[i].accept(this); | 16693 nodes[i].accept(this); |
| 15108 } | 16694 } |
| 15109 _writer.print(suffix); | 16695 _writer.print(suffix); |
| 15110 } | 16696 } |
| 15111 } | 16697 } |
| 15112 } | 16698 } |
| 15113 | 16699 |
| 15114 /** | 16700 /** |
| 15115 * Print a list of nodes, separated by the given separator. | 16701 * Print a list of nodes, separated by the given separator. |
| 16702 * |
| 15116 * @param prefix the prefix to be printed if the list is not empty | 16703 * @param prefix the prefix to be printed if the list is not empty |
| 15117 * @param nodes the nodes to be printed | 16704 * @param nodes the nodes to be printed |
| 15118 * @param separator the separator to be printed between adjacent nodes | 16705 * @param separator the separator to be printed between adjacent nodes |
| 15119 */ | 16706 */ |
| 15120 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { | 16707 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { |
| 15121 if (nodes != null) { | 16708 if (nodes != null) { |
| 15122 int size = nodes.length; | 16709 int size = nodes.length; |
| 15123 if (size > 0) { | 16710 if (size > 0) { |
| 15124 _writer.print(prefix); | 16711 _writer.print(prefix); |
| 15125 for (int i = 0; i < size; i++) { | 16712 for (int i = 0; i < size; i++) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15273 return clonedNodes; | 16860 return clonedNodes; |
| 15274 } | 16861 } |
| 15275 } | 16862 } |
| 15276 /** | 16863 /** |
| 15277 * Traverse the AST from initial child node to successive parents, building a co
llection of local | 16864 * Traverse the AST from initial child node to successive parents, building a co
llection of local |
| 15278 * variable and parameter names visible to the initial child node. In case of na
me shadowing, the | 16865 * variable and parameter names visible to the initial child node. In case of na
me shadowing, the |
| 15279 * first name seen is the most specific one so names are not redefined. | 16866 * first name seen is the most specific one so names are not redefined. |
| 15280 * | 16867 * |
| 15281 * Completion test code coverage is 95%. The two basic blocks that are not execu
ted cannot be | 16868 * Completion test code coverage is 95%. The two basic blocks that are not execu
ted cannot be |
| 15282 * executed. They are included for future reference. | 16869 * executed. They are included for future reference. |
| 16870 * |
| 15283 * @coverage com.google.dart.engine.services.completion | 16871 * @coverage com.google.dart.engine.services.completion |
| 15284 */ | 16872 */ |
| 15285 class ScopedNameFinder extends GeneralizingASTVisitor<Object> { | 16873 class ScopedNameFinder extends GeneralizingASTVisitor<Object> { |
| 15286 Declaration _declarationNode; | 16874 Declaration _declarationNode; |
| 15287 ASTNode _immediateChild; | 16875 ASTNode _immediateChild; |
| 15288 Map<String, SimpleIdentifier> _locals = new Map<String, SimpleIdentifier>(); | 16876 Map<String, SimpleIdentifier> _locals = new Map<String, SimpleIdentifier>(); |
| 15289 int _position = 0; | 16877 int _position = 0; |
| 15290 bool _referenceIsWithinLocalFunction = false; | 16878 bool _referenceIsWithinLocalFunction = false; |
| 15291 ScopedNameFinder(int position) { | 16879 ScopedNameFinder(int position) { |
| 15292 this._position = position; | 16880 this._position = position; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15384 } | 16972 } |
| 15385 } | 16973 } |
| 15386 void addVariables(NodeList<VariableDeclaration> vars) { | 16974 void addVariables(NodeList<VariableDeclaration> vars) { |
| 15387 for (VariableDeclaration var2 in vars) { | 16975 for (VariableDeclaration var2 in vars) { |
| 15388 addToScope(var2.name); | 16976 addToScope(var2.name); |
| 15389 } | 16977 } |
| 15390 } | 16978 } |
| 15391 | 16979 |
| 15392 /** | 16980 /** |
| 15393 * Some statements define names that are visible downstream. There aren't many
of these. | 16981 * Some statements define names that are visible downstream. There aren't many
of these. |
| 16982 * |
| 15394 * @param statements the list of statements to check for name definitions | 16983 * @param statements the list of statements to check for name definitions |
| 15395 */ | 16984 */ |
| 15396 void checkStatements(List<Statement> statements) { | 16985 void checkStatements(List<Statement> statements) { |
| 15397 for (Statement stmt in statements) { | 16986 for (Statement stmt in statements) { |
| 15398 if (identical(stmt, _immediateChild)) { | 16987 if (identical(stmt, _immediateChild)) { |
| 15399 return; | 16988 return; |
| 15400 } | 16989 } |
| 15401 if (stmt is VariableDeclarationStatement) { | 16990 if (stmt is VariableDeclarationStatement) { |
| 15402 addVariables(((stmt as VariableDeclarationStatement)).variables.variable
s); | 16991 addVariables(((stmt as VariableDeclarationStatement)).variables.variable
s); |
| 15403 } else if (stmt is FunctionDeclarationStatement && !_referenceIsWithinLoca
lFunction) { | 16992 } else if (stmt is FunctionDeclarationStatement && !_referenceIsWithinLoca
lFunction) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15472 return elements[elements.length - 1].endToken; | 17061 return elements[elements.length - 1].endToken; |
| 15473 } | 17062 } |
| 15474 /** | 17063 /** |
| 15475 * Return the node that is the parent of each of the elements in the list. | 17064 * Return the node that is the parent of each of the elements in the list. |
| 15476 * @return the node that is the parent of each of the elements in the list | 17065 * @return the node that is the parent of each of the elements in the list |
| 15477 */ | 17066 */ |
| 15478 ASTNode getOwner() { | 17067 ASTNode getOwner() { |
| 15479 return owner; | 17068 return owner; |
| 15480 } | 17069 } |
| 15481 } | 17070 } |
| OLD | NEW |