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 | 3 |
4 library engine.ast; | 4 library engine.ast; |
5 | 5 |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
8 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
9 import 'error.dart'; | 9 import 'error.dart'; |
10 import 'source.dart' show LineInfo; | 10 import 'source.dart' show LineInfo; |
11 import 'scanner.dart'; | 11 import 'scanner.dart'; |
12 import 'engine.dart' show AnalysisEngine; | 12 import 'engine.dart' show AnalysisEngine; |
13 import 'utilities_dart.dart'; | 13 import 'utilities_dart.dart'; |
14 import 'element.dart' hide Annotation; | 14 import 'element.dart' hide Annotation; |
15 | 15 |
| 16 |
16 /** | 17 /** |
17 * The abstract class {@code ASTNode} defines the behavior common to all nodes i
n the AST structure | 18 * The abstract class {@code ASTNode} defines the behavior common to all nodes i
n the AST structure |
18 * for a Dart program. | 19 * for a Dart program. |
19 * @coverage dart.engine.ast | 20 * @coverage dart.engine.ast |
20 */ | 21 */ |
21 abstract class ASTNode { | 22 abstract class ASTNode { |
| 23 |
22 /** | 24 /** |
23 * The parent of the node, or {@code null} if the node is the root of an AST s
tructure. | 25 * The parent of the node, or {@code null} if the node is the root of an AST s
tructure. |
24 */ | 26 */ |
25 ASTNode _parent; | 27 ASTNode _parent; |
| 28 |
26 /** | 29 /** |
27 * A table mapping the names of properties to their values, or {@code null} if
this node does not | 30 * A table mapping the names of properties to their values, or {@code null} if
this node does not |
28 * have any properties associated with it. | 31 * have any properties associated with it. |
29 */ | 32 */ |
30 Map<String, Object> _propertyMap; | 33 Map<String, Object> _propertyMap; |
| 34 |
31 /** | 35 /** |
32 * A comparator that can be used to sort AST nodes in lexical order. In other
words,{@code compare} will return a negative value if the offset of the first no
de is less than the | 36 * A comparator that can be used to sort AST nodes in lexical order. In other
words,{@code compare} will return a negative value if the offset of the first no
de is less than the |
33 * offset of the second node, zero (0) if the nodes have the same offset, and
a positive value if | 37 * 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. | 38 * if the offset of the first node is greater than the offset of the second no
de. |
35 */ | 39 */ |
36 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) =>
second.offset - first.offset; | 40 static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) =>
second.offset - first.offset; |
| 41 |
37 /** | 42 /** |
38 * Use the given visitor to visit this node. | 43 * Use the given visitor to visit this node. |
39 * @param visitor the visitor that will visit this node | 44 * @param visitor the visitor that will visit this node |
40 * @return the value returned by the visitor as a result of visiting this node | 45 * @return the value returned by the visitor as a result of visiting this node |
41 */ | 46 */ |
42 accept(ASTVisitor visitor); | 47 accept(ASTVisitor visitor); |
| 48 |
43 /** | 49 /** |
44 * @return the {@link ASTNode} of given {@link Class} which is {@link ASTNode}
itself, or one of | 50 * @return the {@link ASTNode} of given {@link Class} which is {@link ASTNode}
itself, or one of |
45 * its parents. | 51 * its parents. |
46 */ | 52 */ |
47 ASTNode getAncestor(Type enclosingClass) { | 53 ASTNode getAncestor(Type enclosingClass) { |
48 ASTNode node = this; | 54 ASTNode node = this; |
49 while (node != null && !isInstanceOf(node, enclosingClass)) { | 55 while (node != null && !isInstanceOf(node, enclosingClass)) { |
50 node = node.parent; | 56 node = node.parent; |
51 } | 57 } |
52 ; | 58 ; |
53 return node as ASTNode; | 59 return node as ASTNode; |
54 } | 60 } |
| 61 |
55 /** | 62 /** |
56 * Return the first token included in this node's source range. | 63 * Return the first token included in this node's source range. |
57 * @return the first token included in this node's source range | 64 * @return the first token included in this node's source range |
58 */ | 65 */ |
59 Token get beginToken; | 66 Token get beginToken; |
| 67 |
60 /** | 68 /** |
61 * 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 |
62 * source range. This is equivalent to {@code node.getOffset() + node.getLengt
h()}. For a | 70 * source range. This is equivalent to {@code node.getOffset() + node.getLengt
h()}. For a |
63 * 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 |
64 * 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). |
65 * @return the offset of the character just past the node's source range | 73 * @return the offset of the character just past the node's source range |
66 */ | 74 */ |
67 int get end => offset + length; | 75 int get end => offset + length; |
| 76 |
68 /** | 77 /** |
69 * Return the last token included in this node's source range. | 78 * Return the last token included in this node's source range. |
70 * @return the last token included in this node's source range | 79 * @return the last token included in this node's source range |
71 */ | 80 */ |
72 Token get endToken; | 81 Token get endToken; |
| 82 |
73 /** | 83 /** |
74 * Return the number of characters in the node's source range. | 84 * Return the number of characters in the node's source range. |
75 * @return the number of characters in the node's source range | 85 * @return the number of characters in the node's source range |
76 */ | 86 */ |
77 int get length { | 87 int get length { |
78 Token beginToken2 = beginToken; | 88 Token beginToken2 = beginToken; |
79 Token endToken2 = endToken; | 89 Token endToken2 = endToken; |
80 if (beginToken2 == null || endToken2 == null) { | 90 if (beginToken2 == null || endToken2 == null) { |
81 return -1; | 91 return -1; |
82 } | 92 } |
83 return endToken2.offset + endToken2.length - beginToken2.offset; | 93 return endToken2.offset + endToken2.length - beginToken2.offset; |
84 } | 94 } |
| 95 |
85 /** | 96 /** |
86 * Return the offset from the beginning of the file to the first character in
the node's source | 97 * Return the offset from the beginning of the file to the first character in
the node's source |
87 * range. | 98 * range. |
88 * @return the offset from the beginning of the file to the first character in
the node's source | 99 * @return the offset from the beginning of the file to the first character in
the node's source |
89 * range | 100 * range |
90 */ | 101 */ |
91 int get offset { | 102 int get offset { |
92 Token beginToken2 = beginToken; | 103 Token beginToken2 = beginToken; |
93 if (beginToken2 == null) { | 104 if (beginToken2 == null) { |
94 return -1; | 105 return -1; |
95 } | 106 } |
96 return beginToken.offset; | 107 return beginToken.offset; |
97 } | 108 } |
| 109 |
98 /** | 110 /** |
99 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. | 111 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. |
100 * <p> | 112 * <p> |
101 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime | 113 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime |
102 * of a node. | 114 * of a node. |
103 * @return the parent of this node, or {@code null} if none | 115 * @return the parent of this node, or {@code null} if none |
104 */ | 116 */ |
105 ASTNode get parent => _parent; | 117 ASTNode get parent => _parent; |
| 118 |
106 /** | 119 /** |
107 * Return the value of the property with the given name, or {@code null} if th
is node does not | 120 * Return the value of the property with the given name, or {@code null} if th
is node does not |
108 * have a property with the given name. | 121 * have a property with the given name. |
109 * @return the value of the property with the given name | 122 * @return the value of the property with the given name |
110 */ | 123 */ |
111 Object getProperty(String propertyName) { | 124 Object getProperty(String propertyName) { |
112 if (_propertyMap == null) { | 125 if (_propertyMap == null) { |
113 return null; | 126 return null; |
114 } | 127 } |
115 return _propertyMap[propertyName]; | 128 return _propertyMap[propertyName]; |
116 } | 129 } |
| 130 |
117 /** | 131 /** |
118 * Return the node at the root of this node's AST structure. Note that this me
thod's performance | 132 * Return the node at the root of this node's AST structure. Note that this me
thod's performance |
119 * is linear with respect to the depth of the node in the AST structure (O(dep
th)). | 133 * is linear with respect to the depth of the node in the AST structure (O(dep
th)). |
120 * @return the node at the root of this node's AST structure | 134 * @return the node at the root of this node's AST structure |
121 */ | 135 */ |
122 ASTNode get root { | 136 ASTNode get root { |
123 ASTNode root = this; | 137 ASTNode root = this; |
124 ASTNode parent2 = parent; | 138 ASTNode parent2 = parent; |
125 while (parent2 != null) { | 139 while (parent2 != null) { |
126 root = parent2; | 140 root = parent2; |
127 parent2 = root.parent; | 141 parent2 = root.parent; |
128 } | 142 } |
129 return root; | 143 return root; |
130 } | 144 } |
| 145 |
131 /** | 146 /** |
132 * Return {@code true} if this node is a synthetic node. A synthetic node is a
node that was | 147 * Return {@code true} if this node is a synthetic node. A synthetic node is a
node that was |
133 * introduced by the parser in order to recover from an error in the code. Syn
thetic nodes always | 148 * introduced by the parser in order to recover from an error in the code. Syn
thetic nodes always |
134 * have a length of zero ({@code 0}). | 149 * have a length of zero ({@code 0}). |
135 * @return {@code true} if this node is a synthetic node | 150 * @return {@code true} if this node is a synthetic node |
136 */ | 151 */ |
137 bool isSynthetic() => false; | 152 bool isSynthetic() => false; |
| 153 |
138 /** | 154 /** |
139 * Set the value of the property with the given name to the given value. If th
e value is{@code null}, the property will effectively be removed. | 155 * Set the value of the property with the given name to the given value. If th
e value is{@code null}, the property will effectively be removed. |
140 * @param propertyName the name of the property whose value is to be set | 156 * @param propertyName the name of the property whose value is to be set |
141 * @param propertyValue the new value of the property | 157 * @param propertyValue the new value of the property |
142 */ | 158 */ |
143 void setProperty(String propertyName, Object propertyValue) { | 159 void setProperty(String propertyName, Object propertyValue) { |
144 if (propertyValue == null) { | 160 if (propertyValue == null) { |
145 if (_propertyMap != null) { | 161 if (_propertyMap != null) { |
146 _propertyMap.remove(propertyName); | 162 _propertyMap.remove(propertyName); |
147 if (_propertyMap.isEmpty) { | 163 if (_propertyMap.isEmpty) { |
148 _propertyMap = null; | 164 _propertyMap = null; |
149 } | 165 } |
150 } | 166 } |
151 } else { | 167 } else { |
152 if (_propertyMap == null) { | 168 if (_propertyMap == null) { |
153 _propertyMap = new Map<String, Object>(); | 169 _propertyMap = new Map<String, Object>(); |
154 } | 170 } |
155 _propertyMap[propertyName] = propertyValue; | 171 _propertyMap[propertyName] = propertyValue; |
156 } | 172 } |
157 } | 173 } |
| 174 |
158 /** | 175 /** |
159 * Return a textual description of this node in a form approximating valid sou
rce. The returned | 176 * Return a textual description of this node in a form approximating valid sou
rce. The returned |
160 * string will not be valid source primarily in the case where the node itself
is not well-formed. | 177 * string will not be valid source primarily in the case where the node itself
is not well-formed. |
161 * @return the source code equivalent of this node | 178 * @return the source code equivalent of this node |
162 */ | 179 */ |
163 String toSource() { | 180 String toSource() { |
164 PrintStringWriter writer = new PrintStringWriter(); | 181 PrintStringWriter writer = new PrintStringWriter(); |
165 accept(new ToSourceVisitor(writer)); | 182 accept(new ToSourceVisitor(writer)); |
166 return writer.toString(); | 183 return writer.toString(); |
167 } | 184 } |
168 String toString() => toSource(); | 185 String toString() => toSource(); |
| 186 |
169 /** | 187 /** |
170 * Use the given visitor to visit all of the children of this node. The childr
en will be visited | 188 * Use the given visitor to visit all of the children of this node. The childr
en will be visited |
171 * in source order. | 189 * in source order. |
172 * @param visitor the visitor that will be used to visit the children of this
node | 190 * @param visitor the visitor that will be used to visit the children of this
node |
173 */ | 191 */ |
174 void visitChildren(ASTVisitor<Object> visitor); | 192 void visitChildren(ASTVisitor<Object> visitor); |
| 193 |
175 /** | 194 /** |
176 * Make this node the parent of the given child node. | 195 * Make this node the parent of the given child node. |
177 * @param child the node that will become a child of this node | 196 * @param child the node that will become a child of this node |
178 * @return the node that was made a child of this node | 197 * @return the node that was made a child of this node |
179 */ | 198 */ |
180 ASTNode becomeParentOf(ASTNode child) { | 199 ASTNode becomeParentOf(ASTNode child) { |
181 if (child != null) { | 200 if (child != null) { |
182 ASTNode node = child; | 201 ASTNode node = child; |
183 node.parent = this; | 202 node.parent = this; |
184 } | 203 } |
185 return child; | 204 return child; |
186 } | 205 } |
| 206 |
187 /** | 207 /** |
188 * If the given child is not {@code null}, use the given visitor to visit it. | 208 * If the given child is not {@code null}, use the given visitor to visit it. |
189 * @param child the child to be visited | 209 * @param child the child to be visited |
190 * @param visitor the visitor that will be used to visit the child | 210 * @param visitor the visitor that will be used to visit the child |
191 */ | 211 */ |
192 void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) { | 212 void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) { |
193 if (child != null) { | 213 if (child != null) { |
194 child.accept(visitor); | 214 child.accept(visitor); |
195 } | 215 } |
196 } | 216 } |
| 217 |
197 /** | 218 /** |
198 * Set the parent of this node to the given node. | 219 * Set the parent of this node to the given node. |
199 * @param newParent the node that is to be made the parent of this node | 220 * @param newParent the node that is to be made the parent of this node |
200 */ | 221 */ |
201 void set parent(ASTNode newParent) { | 222 void set parent(ASTNode newParent) { |
202 _parent = newParent; | 223 _parent = newParent; |
203 } | 224 } |
204 static int _hashCodeGenerator = 0; | 225 static int _hashCodeGenerator = 0; |
205 final int hashCode = ++_hashCodeGenerator; | 226 final int hashCode = ++_hashCodeGenerator; |
206 } | 227 } |
| 228 |
207 /** | 229 /** |
208 * The interface {@code ASTVisitor} defines the behavior of objects that can be
used to visit an AST | 230 * The interface {@code ASTVisitor} defines the behavior of objects that can be
used to visit an AST |
209 * structure. | 231 * structure. |
210 * @coverage dart.engine.ast | 232 * @coverage dart.engine.ast |
211 */ | 233 */ |
212 abstract class ASTVisitor<R> { | 234 abstract class ASTVisitor<R> { |
213 R visitAdjacentStrings(AdjacentStrings node); | 235 R visitAdjacentStrings(AdjacentStrings node); |
214 R visitAnnotation(Annotation node); | 236 R visitAnnotation(Annotation node); |
215 R visitArgumentDefinitionTest(ArgumentDefinitionTest node); | 237 R visitArgumentDefinitionTest(ArgumentDefinitionTest node); |
216 R visitArgumentList(ArgumentList node); | 238 R visitArgumentList(ArgumentList node); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 R visitTypeArgumentList(TypeArgumentList node); | 327 R visitTypeArgumentList(TypeArgumentList node); |
306 R visitTypeName(TypeName node); | 328 R visitTypeName(TypeName node); |
307 R visitTypeParameter(TypeParameter node); | 329 R visitTypeParameter(TypeParameter node); |
308 R visitTypeParameterList(TypeParameterList node); | 330 R visitTypeParameterList(TypeParameterList node); |
309 R visitVariableDeclaration(VariableDeclaration node); | 331 R visitVariableDeclaration(VariableDeclaration node); |
310 R visitVariableDeclarationList(VariableDeclarationList node); | 332 R visitVariableDeclarationList(VariableDeclarationList node); |
311 R visitVariableDeclarationStatement(VariableDeclarationStatement node); | 333 R visitVariableDeclarationStatement(VariableDeclarationStatement node); |
312 R visitWhileStatement(WhileStatement node); | 334 R visitWhileStatement(WhileStatement node); |
313 R visitWithClause(WithClause node); | 335 R visitWithClause(WithClause node); |
314 } | 336 } |
| 337 |
315 /** | 338 /** |
316 * Instances of the class {@code AdjacentStrings} represents two or more string
literals that are | 339 * Instances of the class {@code AdjacentStrings} represents two or more string
literals that are |
317 * implicitly concatenated because of being adjacent (separated only by whitespa
ce). | 340 * implicitly concatenated because of being adjacent (separated only by whitespa
ce). |
318 * <p> | 341 * <p> |
319 * While the grammar only allows adjacent strings when all of the strings are of
the same kind | 342 * While the grammar only allows adjacent strings when all of the strings are of
the same kind |
320 * (single line or multi-line), this class doesn't enforce that restriction. | 343 * (single line or multi-line), this class doesn't enforce that restriction. |
321 * <pre> | 344 * <pre> |
322 * adjacentStrings ::={@link StringLiteral string} {@link StringLiteral string}+ | 345 * adjacentStrings ::={@link StringLiteral string} {@link StringLiteral string}+ |
323 * </pre> | 346 * </pre> |
324 * @coverage dart.engine.ast | 347 * @coverage dart.engine.ast |
325 */ | 348 */ |
326 class AdjacentStrings extends StringLiteral { | 349 class AdjacentStrings extends StringLiteral { |
| 350 |
327 /** | 351 /** |
328 * The strings that are implicitly concatenated. | 352 * The strings that are implicitly concatenated. |
329 */ | 353 */ |
330 NodeList<StringLiteral> _strings; | 354 NodeList<StringLiteral> _strings; |
| 355 |
331 /** | 356 /** |
332 * Initialize a newly created list of adjacent strings. | 357 * Initialize a newly created list of adjacent strings. |
333 * @param strings the strings that are implicitly concatenated | 358 * @param strings the strings that are implicitly concatenated |
334 */ | 359 */ |
335 AdjacentStrings.full(List<StringLiteral> strings) { | 360 AdjacentStrings.full(List<StringLiteral> strings) { |
336 this._strings = new NodeList<StringLiteral>(this); | 361 this._strings = new NodeList<StringLiteral>(this); |
337 this._strings.addAll(strings); | 362 this._strings.addAll(strings); |
338 } | 363 } |
| 364 |
339 /** | 365 /** |
340 * Initialize a newly created list of adjacent strings. | 366 * Initialize a newly created list of adjacent strings. |
341 * @param strings the strings that are implicitly concatenated | 367 * @param strings the strings that are implicitly concatenated |
342 */ | 368 */ |
343 AdjacentStrings({List<StringLiteral> strings}) : this.full(strings); | 369 AdjacentStrings({List<StringLiteral> strings}) : this.full(strings); |
344 accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this); | 370 accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this); |
345 Token get beginToken => _strings.beginToken; | 371 Token get beginToken => _strings.beginToken; |
346 Token get endToken => _strings.endToken; | 372 Token get endToken => _strings.endToken; |
| 373 |
347 /** | 374 /** |
348 * Return the strings that are implicitly concatenated. | 375 * Return the strings that are implicitly concatenated. |
349 * @return the strings that are implicitly concatenated | 376 * @return the strings that are implicitly concatenated |
350 */ | 377 */ |
351 NodeList<StringLiteral> get strings => _strings; | 378 NodeList<StringLiteral> get strings => _strings; |
352 void visitChildren(ASTVisitor<Object> visitor) { | 379 void visitChildren(ASTVisitor<Object> visitor) { |
353 _strings.accept(visitor); | 380 _strings.accept(visitor); |
354 } | 381 } |
| 382 void appendStringValue(JavaStringBuilder builder) { |
| 383 for (StringLiteral stringLiteral in strings) { |
| 384 stringLiteral.appendStringValue(builder); |
| 385 } |
| 386 } |
355 } | 387 } |
| 388 |
356 /** | 389 /** |
357 * The abstract class {@code AnnotatedNode} defines the behavior of nodes that c
an be annotated with | 390 * The abstract class {@code AnnotatedNode} defines the behavior of nodes that c
an be annotated with |
358 * both a comment and metadata. | 391 * both a comment and metadata. |
359 * @coverage dart.engine.ast | 392 * @coverage dart.engine.ast |
360 */ | 393 */ |
361 abstract class AnnotatedNode extends ASTNode { | 394 abstract class AnnotatedNode extends ASTNode { |
| 395 |
362 /** | 396 /** |
363 * The documentation comment associated with this node, or {@code null} if thi
s node does not have | 397 * The documentation comment associated with this node, or {@code null} if thi
s node does not have |
364 * a documentation comment associated with it. | 398 * a documentation comment associated with it. |
365 */ | 399 */ |
366 Comment _comment; | 400 Comment _comment; |
| 401 |
367 /** | 402 /** |
368 * The annotations associated with this node. | 403 * The annotations associated with this node. |
369 */ | 404 */ |
370 NodeList<Annotation> _metadata; | 405 NodeList<Annotation> _metadata; |
| 406 |
371 /** | 407 /** |
372 * Initialize a newly created node. | 408 * Initialize a newly created node. |
373 * @param comment the documentation comment associated with this node | 409 * @param comment the documentation comment associated with this node |
374 * @param metadata the annotations associated with this node | 410 * @param metadata the annotations associated with this node |
375 */ | 411 */ |
376 AnnotatedNode.full(Comment comment, List<Annotation> metadata) { | 412 AnnotatedNode.full(Comment comment, List<Annotation> metadata) { |
377 this._metadata = new NodeList<Annotation>(this); | 413 this._metadata = new NodeList<Annotation>(this); |
378 this._comment = becomeParentOf(comment); | 414 this._comment = becomeParentOf(comment); |
379 this._metadata.addAll(metadata); | 415 this._metadata.addAll(metadata); |
380 } | 416 } |
| 417 |
381 /** | 418 /** |
382 * Initialize a newly created node. | 419 * Initialize a newly created node. |
383 * @param comment the documentation comment associated with this node | 420 * @param comment the documentation comment associated with this node |
384 * @param metadata the annotations associated with this node | 421 * @param metadata the annotations associated with this node |
385 */ | 422 */ |
386 AnnotatedNode({Comment comment, List<Annotation> metadata}) : this.full(commen
t, metadata); | 423 AnnotatedNode({Comment comment, List<Annotation> metadata}) : this.full(commen
t, metadata); |
387 Token get beginToken { | 424 Token get beginToken { |
388 if (_comment == null) { | 425 if (_comment == null) { |
389 if (_metadata.isEmpty) { | 426 if (_metadata.isEmpty) { |
390 return firstTokenAfterCommentAndMetadata; | 427 return firstTokenAfterCommentAndMetadata; |
391 } else { | 428 } else { |
392 return _metadata.beginToken; | 429 return _metadata.beginToken; |
393 } | 430 } |
394 } else if (_metadata.isEmpty) { | 431 } else if (_metadata.isEmpty) { |
395 return _comment.beginToken; | 432 return _comment.beginToken; |
396 } | 433 } |
397 Token commentToken = _comment.beginToken; | 434 Token commentToken = _comment.beginToken; |
398 Token metadataToken = _metadata.beginToken; | 435 Token metadataToken = _metadata.beginToken; |
399 if (commentToken.offset < metadataToken.offset) { | 436 if (commentToken.offset < metadataToken.offset) { |
400 return commentToken; | 437 return commentToken; |
401 } | 438 } |
402 return metadataToken; | 439 return metadataToken; |
403 } | 440 } |
| 441 |
404 /** | 442 /** |
405 * Return the documentation comment associated with this node, or {@code null}
if this node does | 443 * Return the documentation comment associated with this node, or {@code null}
if this node does |
406 * not have a documentation comment associated with it. | 444 * not have a documentation comment associated with it. |
407 * @return the documentation comment associated with this node | 445 * @return the documentation comment associated with this node |
408 */ | 446 */ |
409 Comment get documentationComment => _comment; | 447 Comment get documentationComment => _comment; |
| 448 |
410 /** | 449 /** |
411 * Return the annotations associated with this node. | 450 * Return the annotations associated with this node. |
412 * @return the annotations associated with this node | 451 * @return the annotations associated with this node |
413 */ | 452 */ |
414 NodeList<Annotation> get metadata => _metadata; | 453 NodeList<Annotation> get metadata => _metadata; |
| 454 |
415 /** | 455 /** |
416 * Set the documentation comment associated with this node to the given commen
t. | 456 * Set the documentation comment associated with this node to the given commen
t. |
417 * @param comment the documentation comment to be associated with this node | 457 * @param comment the documentation comment to be associated with this node |
418 */ | 458 */ |
419 void set documentationComment(Comment comment2) { | 459 void set documentationComment(Comment comment2) { |
420 this._comment = becomeParentOf(comment2); | 460 this._comment = becomeParentOf(comment2); |
421 } | 461 } |
| 462 |
422 /** | 463 /** |
423 * Set the metadata associated with this node to the given metadata. | 464 * Set the metadata associated with this node to the given metadata. |
424 * @param metadata the metadata to be associated with this node | 465 * @param metadata the metadata to be associated with this node |
425 */ | 466 */ |
426 void set metadata(List<Annotation> metadata2) { | 467 void set metadata(List<Annotation> metadata2) { |
427 this._metadata.clear(); | 468 this._metadata.clear(); |
428 this._metadata.addAll(metadata2); | 469 this._metadata.addAll(metadata2); |
429 } | 470 } |
430 void visitChildren(ASTVisitor<Object> visitor) { | 471 void visitChildren(ASTVisitor<Object> visitor) { |
431 if (commentIsBeforeAnnotations()) { | 472 if (commentIsBeforeAnnotations()) { |
432 safelyVisitChild(_comment, visitor); | 473 safelyVisitChild(_comment, visitor); |
433 _metadata.accept(visitor); | 474 _metadata.accept(visitor); |
434 } else { | 475 } else { |
435 for (ASTNode child in sortedCommentAndAnnotations) { | 476 for (ASTNode child in sortedCommentAndAnnotations) { |
436 child.accept(visitor); | 477 child.accept(visitor); |
437 } | 478 } |
438 } | 479 } |
439 } | 480 } |
| 481 |
440 /** | 482 /** |
441 * Return the first token following the comment and metadata. | 483 * Return the first token following the comment and metadata. |
442 * @return the first token following the comment and metadata | 484 * @return the first token following the comment and metadata |
443 */ | 485 */ |
444 Token get firstTokenAfterCommentAndMetadata; | 486 Token get firstTokenAfterCommentAndMetadata; |
| 487 |
445 /** | 488 /** |
446 * Return {@code true} if the comment is lexically before any annotations. | 489 * Return {@code true} if the comment is lexically before any annotations. |
447 * @return {@code true} if the comment is lexically before any annotations | 490 * @return {@code true} if the comment is lexically before any annotations |
448 */ | 491 */ |
449 bool commentIsBeforeAnnotations() { | 492 bool commentIsBeforeAnnotations() { |
450 if (_comment == null || _metadata.isEmpty) { | 493 if (_comment == null || _metadata.isEmpty) { |
451 return true; | 494 return true; |
452 } | 495 } |
453 Annotation firstAnnotation = _metadata[0]; | 496 Annotation firstAnnotation = _metadata[0]; |
454 return _comment.offset < firstAnnotation.offset; | 497 return _comment.offset < firstAnnotation.offset; |
455 } | 498 } |
| 499 |
456 /** | 500 /** |
457 * Return an array containing the comment and annotations associated with this
node, sorted in | 501 * Return an array containing the comment and annotations associated with this
node, sorted in |
458 * lexical order. | 502 * lexical order. |
459 * @return the comment and annotations associated with this node in the order
in which they | 503 * @return the comment and annotations associated with this node in the order
in which they |
460 * appeared in the original source | 504 * appeared in the original source |
461 */ | 505 */ |
462 List<ASTNode> get sortedCommentAndAnnotations { | 506 List<ASTNode> get sortedCommentAndAnnotations { |
463 List<ASTNode> childList = new List<ASTNode>(); | 507 List<ASTNode> childList = new List<ASTNode>(); |
464 childList.add(_comment); | 508 childList.add(_comment); |
465 childList.addAll(_metadata); | 509 childList.addAll(_metadata); |
466 List<ASTNode> children = new List.from(childList); | 510 List<ASTNode> children = new List.from(childList); |
467 children.sort(); | 511 children.sort(); |
468 return children; | 512 return children; |
469 } | 513 } |
470 } | 514 } |
| 515 |
471 /** | 516 /** |
472 * Instances of the class {@code Annotation} represent an annotation that can be
associated with an | 517 * Instances of the class {@code Annotation} represent an annotation that can be
associated with an |
473 * AST node. | 518 * AST node. |
474 * <pre> | 519 * <pre> |
475 * metadata ::= | 520 * metadata ::= |
476 * annotation | 521 * annotation |
477 * annotation ::= | 522 * annotation ::= |
478 * '@' {@link Identifier qualified} ('.' {@link SimpleIdentifier identifier})? {
@link ArgumentList arguments}? | 523 * '@' {@link Identifier qualified} ('.' {@link SimpleIdentifier identifier})? {
@link ArgumentList arguments}? |
479 * </pre> | 524 * </pre> |
480 * @coverage dart.engine.ast | 525 * @coverage dart.engine.ast |
481 */ | 526 */ |
482 class Annotation extends ASTNode { | 527 class Annotation extends ASTNode { |
| 528 |
483 /** | 529 /** |
484 * The at sign that introduced the annotation. | 530 * The at sign that introduced the annotation. |
485 */ | 531 */ |
486 Token _atSign; | 532 Token _atSign; |
| 533 |
487 /** | 534 /** |
488 * The name of the class defining the constructor that is being invoked or the
name of the field | 535 * The name of the class defining the constructor that is being invoked or the
name of the field |
489 * that is being referenced. | 536 * that is being referenced. |
490 */ | 537 */ |
491 Identifier _name; | 538 Identifier _name; |
| 539 |
492 /** | 540 /** |
493 * The period before the constructor name, or {@code null} if this annotation
is not the | 541 * The period before the constructor name, or {@code null} if this annotation
is not the |
494 * invocation of a named constructor. | 542 * invocation of a named constructor. |
495 */ | 543 */ |
496 Token _period; | 544 Token _period; |
| 545 |
497 /** | 546 /** |
498 * The name of the constructor being invoked, or {@code null} if this annotati
on is not the | 547 * The name of the constructor being invoked, or {@code null} if this annotati
on is not the |
499 * invocation of a named constructor. | 548 * invocation of a named constructor. |
500 */ | 549 */ |
501 SimpleIdentifier _constructorName; | 550 SimpleIdentifier _constructorName; |
| 551 |
502 /** | 552 /** |
503 * The arguments to the constructor being invoked, or {@code null} if this ann
otation is not the | 553 * The arguments to the constructor being invoked, or {@code null} if this ann
otation is not the |
504 * invocation of a constructor. | 554 * invocation of a constructor. |
505 */ | 555 */ |
506 ArgumentList _arguments; | 556 ArgumentList _arguments; |
| 557 |
507 /** | 558 /** |
508 * Initialize a newly created annotation. | 559 * Initialize a newly created annotation. |
509 * @param atSign the at sign that introduced the annotation | 560 * @param atSign the at sign that introduced the annotation |
510 * @param name the name of the class defining the constructor that is being in
voked or the name of | 561 * @param name the name of the class defining the constructor that is being in
voked or the name of |
511 * the field that is being referenced | 562 * the field that is being referenced |
512 * @param period the period before the constructor name, or {@code null} if th
is annotation is not | 563 * @param period the period before the constructor name, or {@code null} if th
is annotation is not |
513 * the invocation of a named constructor | 564 * the invocation of a named constructor |
514 * @param constructorName the name of the constructor being invoked, or {@code
null} if this | 565 * @param constructorName the name of the constructor being invoked, or {@code
null} if this |
515 * annotation is not the invocation of a named constructor | 566 * annotation is not the invocation of a named constructor |
516 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this | 567 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this |
517 * annotation is not the invocation of a constructor | 568 * annotation is not the invocation of a constructor |
518 */ | 569 */ |
519 Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier
constructorName, ArgumentList arguments) { | 570 Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier
constructorName, ArgumentList arguments) { |
520 this._atSign = atSign; | 571 this._atSign = atSign; |
521 this._name = becomeParentOf(name); | 572 this._name = becomeParentOf(name); |
522 this._period = period; | 573 this._period = period; |
523 this._constructorName = becomeParentOf(constructorName); | 574 this._constructorName = becomeParentOf(constructorName); |
524 this._arguments = becomeParentOf(arguments); | 575 this._arguments = becomeParentOf(arguments); |
525 } | 576 } |
| 577 |
526 /** | 578 /** |
527 * Initialize a newly created annotation. | 579 * Initialize a newly created annotation. |
528 * @param atSign the at sign that introduced the annotation | 580 * @param atSign the at sign that introduced the annotation |
529 * @param name the name of the class defining the constructor that is being in
voked or the name of | 581 * @param name the name of the class defining the constructor that is being in
voked or the name of |
530 * the field that is being referenced | 582 * the field that is being referenced |
531 * @param period the period before the constructor name, or {@code null} if th
is annotation is not | 583 * @param period the period before the constructor name, or {@code null} if th
is annotation is not |
532 * the invocation of a named constructor | 584 * the invocation of a named constructor |
533 * @param constructorName the name of the constructor being invoked, or {@code
null} if this | 585 * @param constructorName the name of the constructor being invoked, or {@code
null} if this |
534 * annotation is not the invocation of a named constructor | 586 * annotation is not the invocation of a named constructor |
535 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this | 587 * @param arguments the arguments to the constructor being invoked, or {@code
null} if this |
536 * annotation is not the invocation of a constructor | 588 * annotation is not the invocation of a constructor |
537 */ | 589 */ |
538 Annotation({Token atSign, Identifier name, Token period, SimpleIdentifier cons
tructorName, ArgumentList arguments}) : this.full(atSign, name, period, construc
torName, arguments); | 590 Annotation({Token atSign, Identifier name, Token period, SimpleIdentifier cons
tructorName, ArgumentList arguments}) : this.full(atSign, name, period, construc
torName, arguments); |
539 accept(ASTVisitor visitor) => visitor.visitAnnotation(this); | 591 accept(ASTVisitor visitor) => visitor.visitAnnotation(this); |
| 592 |
540 /** | 593 /** |
541 * Return the arguments to the constructor being invoked, or {@code null} if t
his annotation is | 594 * Return the arguments to the constructor being invoked, or {@code null} if t
his annotation is |
542 * not the invocation of a constructor. | 595 * not the invocation of a constructor. |
543 * @return the arguments to the constructor being invoked | 596 * @return the arguments to the constructor being invoked |
544 */ | 597 */ |
545 ArgumentList get arguments => _arguments; | 598 ArgumentList get arguments => _arguments; |
| 599 |
546 /** | 600 /** |
547 * Return the at sign that introduced the annotation. | 601 * Return the at sign that introduced the annotation. |
548 * @return the at sign that introduced the annotation | 602 * @return the at sign that introduced the annotation |
549 */ | 603 */ |
550 Token get atSign => _atSign; | 604 Token get atSign => _atSign; |
551 Token get beginToken => _atSign; | 605 Token get beginToken => _atSign; |
| 606 |
552 /** | 607 /** |
553 * Return the name of the constructor being invoked, or {@code null} if this a
nnotation is not the | 608 * Return the name of the constructor being invoked, or {@code null} if this a
nnotation is not the |
554 * invocation of a named constructor. | 609 * invocation of a named constructor. |
555 * @return the name of the constructor being invoked | 610 * @return the name of the constructor being invoked |
556 */ | 611 */ |
557 SimpleIdentifier get constructorName => _constructorName; | 612 SimpleIdentifier get constructorName => _constructorName; |
| 613 |
| 614 /** |
| 615 * Return the element associated with this annotation, or {@code null} if the
AST structure has |
| 616 * not been resolved or if this annotation could not be resolved. |
| 617 * @return the element associated with this annotation |
| 618 */ |
| 619 Element get element { |
| 620 if (_constructorName != null) { |
| 621 return _constructorName.element; |
| 622 } else if (_name != null) { |
| 623 return _name.element; |
| 624 } |
| 625 return null; |
| 626 } |
558 Token get endToken { | 627 Token get endToken { |
559 if (_arguments != null) { | 628 if (_arguments != null) { |
560 return _arguments.endToken; | 629 return _arguments.endToken; |
561 } else if (_constructorName != null) { | 630 } else if (_constructorName != null) { |
562 return _constructorName.endToken; | 631 return _constructorName.endToken; |
563 } | 632 } |
564 return _name.endToken; | 633 return _name.endToken; |
565 } | 634 } |
| 635 |
566 /** | 636 /** |
567 * Return the name of the class defining the constructor that is being invoked
or the name of the | 637 * Return the name of the class defining the constructor that is being invoked
or the name of the |
568 * field that is being referenced. | 638 * field that is being referenced. |
569 * @return the name of the constructor being invoked or the name of the field
being referenced | 639 * @return the name of the constructor being invoked or the name of the field
being referenced |
570 */ | 640 */ |
571 Identifier get name => _name; | 641 Identifier get name => _name; |
| 642 |
572 /** | 643 /** |
573 * Return the period before the constructor name, or {@code null} if this anno
tation is not the | 644 * Return the period before the constructor name, or {@code null} if this anno
tation is not the |
574 * invocation of a named constructor. | 645 * invocation of a named constructor. |
575 * @return the period before the constructor name | 646 * @return the period before the constructor name |
576 */ | 647 */ |
577 Token get period => _period; | 648 Token get period => _period; |
| 649 |
578 /** | 650 /** |
579 * Set the arguments to the constructor being invoked to the given arguments. | 651 * Set the arguments to the constructor being invoked to the given arguments. |
580 * @param arguments the arguments to the constructor being invoked | 652 * @param arguments the arguments to the constructor being invoked |
581 */ | 653 */ |
582 void set arguments(ArgumentList arguments2) { | 654 void set arguments(ArgumentList arguments2) { |
583 this._arguments = becomeParentOf(arguments2); | 655 this._arguments = becomeParentOf(arguments2); |
584 } | 656 } |
| 657 |
585 /** | 658 /** |
586 * Set the at sign that introduced the annotation to the given token. | 659 * Set the at sign that introduced the annotation to the given token. |
587 * @param atSign the at sign that introduced the annotation | 660 * @param atSign the at sign that introduced the annotation |
588 */ | 661 */ |
589 void set atSign(Token atSign2) { | 662 void set atSign(Token atSign2) { |
590 this._atSign = atSign2; | 663 this._atSign = atSign2; |
591 } | 664 } |
| 665 |
592 /** | 666 /** |
593 * Set the name of the constructor being invoked to the given name. | 667 * Set the name of the constructor being invoked to the given name. |
594 * @param constructorName the name of the constructor being invoked | 668 * @param constructorName the name of the constructor being invoked |
595 */ | 669 */ |
596 void set constructorName(SimpleIdentifier constructorName2) { | 670 void set constructorName(SimpleIdentifier constructorName2) { |
597 this._constructorName = becomeParentOf(constructorName2); | 671 this._constructorName = becomeParentOf(constructorName2); |
598 } | 672 } |
| 673 |
599 /** | 674 /** |
600 * Set the name of the class defining the constructor that is being invoked or
the name of the | 675 * Set the name of the class defining the constructor that is being invoked or
the name of the |
601 * field that is being referenced to the given name. | 676 * field that is being referenced to the given name. |
602 * @param name the name of the constructor being invoked or the name of the fi
eld being referenced | 677 * @param name the name of the constructor being invoked or the name of the fi
eld being referenced |
603 */ | 678 */ |
604 void set name(Identifier name2) { | 679 void set name(Identifier name2) { |
605 this._name = becomeParentOf(name2); | 680 this._name = becomeParentOf(name2); |
606 } | 681 } |
| 682 |
607 /** | 683 /** |
608 * Set the period before the constructor name to the given token. | 684 * Set the period before the constructor name to the given token. |
609 * @param period the period before the constructor name | 685 * @param period the period before the constructor name |
610 */ | 686 */ |
611 void set period(Token period2) { | 687 void set period(Token period2) { |
612 this._period = period2; | 688 this._period = period2; |
613 } | 689 } |
614 void visitChildren(ASTVisitor<Object> visitor) { | 690 void visitChildren(ASTVisitor<Object> visitor) { |
615 safelyVisitChild(_name, visitor); | 691 safelyVisitChild(_name, visitor); |
616 safelyVisitChild(_constructorName, visitor); | 692 safelyVisitChild(_constructorName, visitor); |
617 safelyVisitChild(_arguments, visitor); | 693 safelyVisitChild(_arguments, visitor); |
618 } | 694 } |
619 } | 695 } |
| 696 |
620 /** | 697 /** |
621 * Instances of the class {@code ArgumentDefinitionTest} represent an argument d
efinition test. | 698 * Instances of the class {@code ArgumentDefinitionTest} represent an argument d
efinition test. |
622 * <pre> | 699 * <pre> |
623 * argumentDefinitionTest ::= | 700 * argumentDefinitionTest ::= |
624 * '?' {@link SimpleIdentifier identifier}</pre> | 701 * '?' {@link SimpleIdentifier identifier}</pre> |
625 * @coverage dart.engine.ast | 702 * @coverage dart.engine.ast |
626 */ | 703 */ |
627 class ArgumentDefinitionTest extends Expression { | 704 class ArgumentDefinitionTest extends Expression { |
| 705 |
628 /** | 706 /** |
629 * The token representing the question mark. | 707 * The token representing the question mark. |
630 */ | 708 */ |
631 Token _question; | 709 Token _question; |
| 710 |
632 /** | 711 /** |
633 * The identifier representing the argument being tested. | 712 * The identifier representing the argument being tested. |
634 */ | 713 */ |
635 SimpleIdentifier _identifier; | 714 SimpleIdentifier _identifier; |
| 715 |
636 /** | 716 /** |
637 * Initialize a newly created argument definition test. | 717 * Initialize a newly created argument definition test. |
638 * @param question the token representing the question mark | 718 * @param question the token representing the question mark |
639 * @param identifier the identifier representing the argument being tested | 719 * @param identifier the identifier representing the argument being tested |
640 */ | 720 */ |
641 ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) { | 721 ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) { |
642 this._question = question; | 722 this._question = question; |
643 this._identifier = becomeParentOf(identifier); | 723 this._identifier = becomeParentOf(identifier); |
644 } | 724 } |
| 725 |
645 /** | 726 /** |
646 * Initialize a newly created argument definition test. | 727 * Initialize a newly created argument definition test. |
647 * @param question the token representing the question mark | 728 * @param question the token representing the question mark |
648 * @param identifier the identifier representing the argument being tested | 729 * @param identifier the identifier representing the argument being tested |
649 */ | 730 */ |
650 ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.f
ull(question, identifier); | 731 ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.f
ull(question, identifier); |
651 accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this); | 732 accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this); |
652 Token get beginToken => _question; | 733 Token get beginToken => _question; |
653 Token get endToken => _identifier.endToken; | 734 Token get endToken => _identifier.endToken; |
| 735 |
654 /** | 736 /** |
655 * Return the identifier representing the argument being tested. | 737 * Return the identifier representing the argument being tested. |
656 * @return the identifier representing the argument being tested | 738 * @return the identifier representing the argument being tested |
657 */ | 739 */ |
658 SimpleIdentifier get identifier => _identifier; | 740 SimpleIdentifier get identifier => _identifier; |
| 741 |
659 /** | 742 /** |
660 * Return the token representing the question mark. | 743 * Return the token representing the question mark. |
661 * @return the token representing the question mark | 744 * @return the token representing the question mark |
662 */ | 745 */ |
663 Token get question => _question; | 746 Token get question => _question; |
| 747 |
664 /** | 748 /** |
665 * Set the identifier representing the argument being tested to the given iden
tifier. | 749 * Set the identifier representing the argument being tested to the given iden
tifier. |
666 * @param identifier the identifier representing the argument being tested | 750 * @param identifier the identifier representing the argument being tested |
667 */ | 751 */ |
668 void set identifier(SimpleIdentifier identifier2) { | 752 void set identifier(SimpleIdentifier identifier2) { |
669 this._identifier = becomeParentOf(identifier2); | 753 this._identifier = becomeParentOf(identifier2); |
670 } | 754 } |
| 755 |
671 /** | 756 /** |
672 * Set the token representing the question mark to the given token. | 757 * Set the token representing the question mark to the given token. |
673 * @param question the token representing the question mark | 758 * @param question the token representing the question mark |
674 */ | 759 */ |
675 void set question(Token question2) { | 760 void set question(Token question2) { |
676 this._question = question2; | 761 this._question = question2; |
677 } | 762 } |
678 void visitChildren(ASTVisitor<Object> visitor) { | 763 void visitChildren(ASTVisitor<Object> visitor) { |
679 safelyVisitChild(_identifier, visitor); | 764 safelyVisitChild(_identifier, visitor); |
680 } | 765 } |
681 } | 766 } |
| 767 |
682 /** | 768 /** |
683 * Instances of the class {@code ArgumentList} represent a list of arguments in
the invocation of a | 769 * Instances of the class {@code ArgumentList} represent a list of arguments in
the invocation of a |
684 * executable element: a function, method, or constructor. | 770 * executable element: a function, method, or constructor. |
685 * <pre> | 771 * <pre> |
686 * argumentList ::= | 772 * argumentList ::= |
687 * '(' arguments? ')' | 773 * '(' arguments? ')' |
688 * arguments ::={@link NamedExpression namedArgument} (',' {@link NamedExpressio
n namedArgument}) | 774 * arguments ::={@link NamedExpression namedArgument} (',' {@link NamedExpressio
n namedArgument}) |
689 * | {@link Expression expressionList} (',' {@link NamedExpression namedArgument
}) | 775 * | {@link Expression expressionList} (',' {@link NamedExpression namedArgument
}) |
690 * </pre> | 776 * </pre> |
691 * @coverage dart.engine.ast | 777 * @coverage dart.engine.ast |
692 */ | 778 */ |
693 class ArgumentList extends ASTNode { | 779 class ArgumentList extends ASTNode { |
| 780 |
694 /** | 781 /** |
695 * The left parenthesis. | 782 * The left parenthesis. |
696 */ | 783 */ |
697 Token _leftParenthesis; | 784 Token _leftParenthesis; |
| 785 |
698 /** | 786 /** |
699 * The expressions producing the values of the arguments. | 787 * The expressions producing the values of the arguments. |
700 */ | 788 */ |
701 NodeList<Expression> _arguments; | 789 NodeList<Expression> _arguments; |
| 790 |
702 /** | 791 /** |
703 * The right parenthesis. | 792 * The right parenthesis. |
704 */ | 793 */ |
705 Token _rightParenthesis; | 794 Token _rightParenthesis; |
| 795 |
706 /** | 796 /** |
707 * An array containing the elements representing the parameters corresponding
to each of the | 797 * An array containing the elements representing the parameters corresponding
to each of the |
708 * arguments in this list, or {@code null} if the AST has not been resolved or
if the function or | 798 * arguments in this list, or {@code null} if the AST has not been resolved or
if the function or |
709 * method being invoked could not be determined. The array must be the same le
ngth as the number | 799 * method being invoked could not be determined. The array must be the same le
ngth as the number |
710 * of arguments, but can contain {@code null} entries if a given argument does
not correspond to a | 800 * of arguments, but can contain {@code null} entries if a given argument does
not correspond to a |
711 * formal parameter. | 801 * formal parameter. |
712 */ | 802 */ |
713 List<ParameterElement> _correspondingParameters; | 803 List<ParameterElement> _correspondingParameters; |
| 804 |
714 /** | 805 /** |
715 * Initialize a newly created list of arguments. | 806 * Initialize a newly created list of arguments. |
716 * @param leftParenthesis the left parenthesis | 807 * @param leftParenthesis the left parenthesis |
717 * @param arguments the expressions producing the values of the arguments | 808 * @param arguments the expressions producing the values of the arguments |
718 * @param rightParenthesis the right parenthesis | 809 * @param rightParenthesis the right parenthesis |
719 */ | 810 */ |
720 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig
htParenthesis) { | 811 ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rig
htParenthesis) { |
721 this._arguments = new NodeList<Expression>(this); | 812 this._arguments = new NodeList<Expression>(this); |
722 this._leftParenthesis = leftParenthesis; | 813 this._leftParenthesis = leftParenthesis; |
723 this._arguments.addAll(arguments); | 814 this._arguments.addAll(arguments); |
724 this._rightParenthesis = rightParenthesis; | 815 this._rightParenthesis = rightParenthesis; |
725 } | 816 } |
| 817 |
726 /** | 818 /** |
727 * Initialize a newly created list of arguments. | 819 * Initialize a newly created list of arguments. |
728 * @param leftParenthesis the left parenthesis | 820 * @param leftParenthesis the left parenthesis |
729 * @param arguments the expressions producing the values of the arguments | 821 * @param arguments the expressions producing the values of the arguments |
730 * @param rightParenthesis the right parenthesis | 822 * @param rightParenthesis the right parenthesis |
731 */ | 823 */ |
732 ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightPa
renthesis}) : this.full(leftParenthesis, arguments, rightParenthesis); | 824 ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightPa
renthesis}) : this.full(leftParenthesis, arguments, rightParenthesis); |
733 accept(ASTVisitor visitor) => visitor.visitArgumentList(this); | 825 accept(ASTVisitor visitor) => visitor.visitArgumentList(this); |
| 826 |
734 /** | 827 /** |
735 * Return the expressions producing the values of the arguments. Although the
language requires | 828 * Return the expressions producing the values of the arguments. Although the
language requires |
736 * that positional arguments appear before named arguments, this class allows
them to be | 829 * that positional arguments appear before named arguments, this class allows
them to be |
737 * intermixed. | 830 * intermixed. |
738 * @return the expressions producing the values of the arguments | 831 * @return the expressions producing the values of the arguments |
739 */ | 832 */ |
740 NodeList<Expression> get arguments => _arguments; | 833 NodeList<Expression> get arguments => _arguments; |
741 Token get beginToken => _leftParenthesis; | 834 Token get beginToken => _leftParenthesis; |
742 Token get endToken => _rightParenthesis; | 835 Token get endToken => _rightParenthesis; |
| 836 |
743 /** | 837 /** |
744 * Return the left parenthesis. | 838 * Return the left parenthesis. |
745 * @return the left parenthesis | 839 * @return the left parenthesis |
746 */ | 840 */ |
747 Token get leftParenthesis => _leftParenthesis; | 841 Token get leftParenthesis => _leftParenthesis; |
| 842 |
748 /** | 843 /** |
749 * Return the right parenthesis. | 844 * Return the right parenthesis. |
750 * @return the right parenthesis | 845 * @return the right parenthesis |
751 */ | 846 */ |
752 Token get rightParenthesis => _rightParenthesis; | 847 Token get rightParenthesis => _rightParenthesis; |
| 848 |
753 /** | 849 /** |
754 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given | 850 * Set the parameter elements corresponding to each of the arguments in this l
ist to the given |
755 * array of parameters. The array of parameters must be the same length as the
number of | 851 * array of parameters. The array of parameters must be the same length as the
number of |
756 * arguments, but can contain {@code null} entries if a given argument does no
t correspond to a | 852 * arguments, but can contain {@code null} entries if a given argument does no
t correspond to a |
757 * formal parameter. | 853 * formal parameter. |
758 * @param parameters the parameter elements corresponding to the arguments | 854 * @param parameters the parameter elements corresponding to the arguments |
759 */ | 855 */ |
760 void set correspondingParameters(List<ParameterElement> parameters) { | 856 void set correspondingParameters(List<ParameterElement> parameters) { |
761 if (parameters.length != _arguments.length) { | 857 if (parameters.length != _arguments.length) { |
762 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); | 858 throw new IllegalArgumentException("Expected ${_arguments.length} paramete
rs, not ${parameters.length}"); |
763 } | 859 } |
764 _correspondingParameters = parameters; | 860 _correspondingParameters = parameters; |
765 } | 861 } |
| 862 |
766 /** | 863 /** |
767 * Set the left parenthesis to the given token. | 864 * Set the left parenthesis to the given token. |
768 * @param parenthesis the left parenthesis | 865 * @param parenthesis the left parenthesis |
769 */ | 866 */ |
770 void set leftParenthesis(Token parenthesis) { | 867 void set leftParenthesis(Token parenthesis) { |
771 _leftParenthesis = parenthesis; | 868 _leftParenthesis = parenthesis; |
772 } | 869 } |
| 870 |
773 /** | 871 /** |
774 * Set the right parenthesis to the given token. | 872 * Set the right parenthesis to the given token. |
775 * @param parenthesis the right parenthesis | 873 * @param parenthesis the right parenthesis |
776 */ | 874 */ |
777 void set rightParenthesis(Token parenthesis) { | 875 void set rightParenthesis(Token parenthesis) { |
778 _rightParenthesis = parenthesis; | 876 _rightParenthesis = parenthesis; |
779 } | 877 } |
780 void visitChildren(ASTVisitor<Object> visitor) { | 878 void visitChildren(ASTVisitor<Object> visitor) { |
781 _arguments.accept(visitor); | 879 _arguments.accept(visitor); |
782 } | 880 } |
| 881 |
783 /** | 882 /** |
784 * If the given expression is a child of this list, and the AST structure has
been resolved, and | 883 * If the given expression is a child of this list, and the AST structure has
been resolved, and |
785 * the function being invoked is known, and the expression corresponds to one
of the parameters of | 884 * the function being invoked is known, and the expression corresponds to one
of the parameters of |
786 * the function being invoked, then return the parameter element representing
the parameter to | 885 * the function being invoked, then return the parameter element representing
the parameter to |
787 * which the value of the given expression will be bound. Otherwise, return {@
code null}. | 886 * which the value of the given expression will be bound. Otherwise, return {@
code null}. |
788 * <p> | 887 * <p> |
789 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. | 888 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
790 * @param expression the expression corresponding to the parameter to be retur
ned | 889 * @param expression the expression corresponding to the parameter to be retur
ned |
791 * @return the parameter element representing the parameter to which the value
of the expression | 890 * @return the parameter element representing the parameter to which the value
of the expression |
792 * will be bound | 891 * will be bound |
793 */ | 892 */ |
794 ParameterElement getParameterElementFor(Expression expression) { | 893 ParameterElement getParameterElementFor(Expression expression) { |
795 if (_correspondingParameters == null) { | 894 if (_correspondingParameters == null) { |
796 return null; | 895 return null; |
797 } | 896 } |
798 int index = _arguments.indexOf(expression); | 897 int index = _arguments.indexOf(expression); |
799 if (index < 0) { | 898 if (index < 0) { |
800 return null; | 899 return null; |
801 } | 900 } |
802 return _correspondingParameters[index]; | 901 return _correspondingParameters[index]; |
803 } | 902 } |
804 } | 903 } |
| 904 |
805 /** | 905 /** |
806 * Instances of the class {@code AsExpression} represent an 'as' expression. | 906 * Instances of the class {@code AsExpression} represent an 'as' expression. |
807 * <pre> | 907 * <pre> |
808 * asExpression ::={@link Expression expression} 'as' {@link TypeName type}</pre
> | 908 * asExpression ::={@link Expression expression} 'as' {@link TypeName type}</pre
> |
809 * @coverage dart.engine.ast | 909 * @coverage dart.engine.ast |
810 */ | 910 */ |
811 class AsExpression extends Expression { | 911 class AsExpression extends Expression { |
| 912 |
812 /** | 913 /** |
813 * The expression used to compute the value being cast. | 914 * The expression used to compute the value being cast. |
814 */ | 915 */ |
815 Expression _expression; | 916 Expression _expression; |
| 917 |
816 /** | 918 /** |
817 * The as operator. | 919 * The as operator. |
818 */ | 920 */ |
819 Token _asOperator; | 921 Token _asOperator; |
| 922 |
820 /** | 923 /** |
821 * The name of the type being cast to. | 924 * The name of the type being cast to. |
822 */ | 925 */ |
823 TypeName _type; | 926 TypeName _type; |
| 927 |
824 /** | 928 /** |
825 * Initialize a newly created as expression. | 929 * Initialize a newly created as expression. |
826 * @param expression the expression used to compute the value being cast | 930 * @param expression the expression used to compute the value being cast |
827 * @param isOperator the is operator | 931 * @param isOperator the is operator |
828 * @param type the name of the type being cast to | 932 * @param type the name of the type being cast to |
829 */ | 933 */ |
830 AsExpression.full(Expression expression, Token isOperator, TypeName type) { | 934 AsExpression.full(Expression expression, Token isOperator, TypeName type) { |
831 this._expression = becomeParentOf(expression); | 935 this._expression = becomeParentOf(expression); |
832 this._asOperator = isOperator; | 936 this._asOperator = isOperator; |
833 this._type = becomeParentOf(type); | 937 this._type = becomeParentOf(type); |
834 } | 938 } |
| 939 |
835 /** | 940 /** |
836 * Initialize a newly created as expression. | 941 * Initialize a newly created as expression. |
837 * @param expression the expression used to compute the value being cast | 942 * @param expression the expression used to compute the value being cast |
838 * @param isOperator the is operator | 943 * @param isOperator the is operator |
839 * @param type the name of the type being cast to | 944 * @param type the name of the type being cast to |
840 */ | 945 */ |
841 AsExpression({Expression expression, Token isOperator, TypeName type}) : this.
full(expression, isOperator, type); | 946 AsExpression({Expression expression, Token isOperator, TypeName type}) : this.
full(expression, isOperator, type); |
842 accept(ASTVisitor visitor) => visitor.visitAsExpression(this); | 947 accept(ASTVisitor visitor) => visitor.visitAsExpression(this); |
| 948 |
843 /** | 949 /** |
844 * Return the is operator being applied. | 950 * Return the is operator being applied. |
845 * @return the is operator being applied | 951 * @return the is operator being applied |
846 */ | 952 */ |
847 Token get asOperator => _asOperator; | 953 Token get asOperator => _asOperator; |
848 Token get beginToken => _expression.beginToken; | 954 Token get beginToken => _expression.beginToken; |
849 Token get endToken => _type.endToken; | 955 Token get endToken => _type.endToken; |
| 956 |
850 /** | 957 /** |
851 * Return the expression used to compute the value being cast. | 958 * Return the expression used to compute the value being cast. |
852 * @return the expression used to compute the value being cast | 959 * @return the expression used to compute the value being cast |
853 */ | 960 */ |
854 Expression get expression => _expression; | 961 Expression get expression => _expression; |
| 962 |
855 /** | 963 /** |
856 * Return the name of the type being cast to. | 964 * Return the name of the type being cast to. |
857 * @return the name of the type being cast to | 965 * @return the name of the type being cast to |
858 */ | 966 */ |
859 TypeName get type => _type; | 967 TypeName get type => _type; |
| 968 |
860 /** | 969 /** |
861 * Set the is operator being applied to the given operator. | 970 * Set the is operator being applied to the given operator. |
862 * @param asOperator the is operator being applied | 971 * @param asOperator the is operator being applied |
863 */ | 972 */ |
864 void set asOperator(Token asOperator2) { | 973 void set asOperator(Token asOperator2) { |
865 this._asOperator = asOperator2; | 974 this._asOperator = asOperator2; |
866 } | 975 } |
| 976 |
867 /** | 977 /** |
868 * Set the expression used to compute the value being cast to the given expres
sion. | 978 * Set the expression used to compute the value being cast to the given expres
sion. |
869 * @param expression the expression used to compute the value being cast | 979 * @param expression the expression used to compute the value being cast |
870 */ | 980 */ |
871 void set expression(Expression expression2) { | 981 void set expression(Expression expression2) { |
872 this._expression = becomeParentOf(expression2); | 982 this._expression = becomeParentOf(expression2); |
873 } | 983 } |
| 984 |
874 /** | 985 /** |
875 * Set the name of the type being cast to to the given name. | 986 * Set the name of the type being cast to to the given name. |
876 * @param name the name of the type being cast to | 987 * @param name the name of the type being cast to |
877 */ | 988 */ |
878 void set type(TypeName name) { | 989 void set type(TypeName name) { |
879 this._type = becomeParentOf(name); | 990 this._type = becomeParentOf(name); |
880 } | 991 } |
881 void visitChildren(ASTVisitor<Object> visitor) { | 992 void visitChildren(ASTVisitor<Object> visitor) { |
882 safelyVisitChild(_expression, visitor); | 993 safelyVisitChild(_expression, visitor); |
883 safelyVisitChild(_type, visitor); | 994 safelyVisitChild(_type, visitor); |
884 } | 995 } |
885 } | 996 } |
| 997 |
886 /** | 998 /** |
887 * Instances of the class {@code AssertStatement} represent an assert statement. | 999 * Instances of the class {@code AssertStatement} represent an assert statement. |
888 * <pre> | 1000 * <pre> |
889 * assertStatement ::= | 1001 * assertStatement ::= |
890 * 'assert' '(' {@link Expression conditionalExpression} ')' ';' | 1002 * 'assert' '(' {@link Expression conditionalExpression} ')' ';' |
891 * </pre> | 1003 * </pre> |
892 * @coverage dart.engine.ast | 1004 * @coverage dart.engine.ast |
893 */ | 1005 */ |
894 class AssertStatement extends Statement { | 1006 class AssertStatement extends Statement { |
| 1007 |
895 /** | 1008 /** |
896 * The token representing the 'assert' keyword. | 1009 * The token representing the 'assert' keyword. |
897 */ | 1010 */ |
898 Token _keyword; | 1011 Token _keyword; |
| 1012 |
899 /** | 1013 /** |
900 * The left parenthesis. | 1014 * The left parenthesis. |
901 */ | 1015 */ |
902 Token _leftParenthesis; | 1016 Token _leftParenthesis; |
| 1017 |
903 /** | 1018 /** |
904 * The condition that is being asserted to be {@code true}. | 1019 * The condition that is being asserted to be {@code true}. |
905 */ | 1020 */ |
906 Expression _condition; | 1021 Expression _condition; |
| 1022 |
907 /** | 1023 /** |
908 * The right parenthesis. | 1024 * The right parenthesis. |
909 */ | 1025 */ |
910 Token _rightParenthesis; | 1026 Token _rightParenthesis; |
| 1027 |
911 /** | 1028 /** |
912 * The semicolon terminating the statement. | 1029 * The semicolon terminating the statement. |
913 */ | 1030 */ |
914 Token _semicolon; | 1031 Token _semicolon; |
| 1032 |
915 /** | 1033 /** |
916 * Initialize a newly created assert statement. | 1034 * Initialize a newly created assert statement. |
917 * @param keyword the token representing the 'assert' keyword | 1035 * @param keyword the token representing the 'assert' keyword |
918 * @param leftParenthesis the left parenthesis | 1036 * @param leftParenthesis the left parenthesis |
919 * @param condition the condition that is being asserted to be {@code true} | 1037 * @param condition the condition that is being asserted to be {@code true} |
920 * @param rightParenthesis the right parenthesis | 1038 * @param rightParenthesis the right parenthesis |
921 * @param semicolon the semicolon terminating the statement | 1039 * @param semicolon the semicolon terminating the statement |
922 */ | 1040 */ |
923 AssertStatement.full(Token keyword, Token leftParenthesis, Expression conditio
n, Token rightParenthesis, Token semicolon) { | 1041 AssertStatement.full(Token keyword, Token leftParenthesis, Expression conditio
n, Token rightParenthesis, Token semicolon) { |
924 this._keyword = keyword; | 1042 this._keyword = keyword; |
925 this._leftParenthesis = leftParenthesis; | 1043 this._leftParenthesis = leftParenthesis; |
926 this._condition = becomeParentOf(condition); | 1044 this._condition = becomeParentOf(condition); |
927 this._rightParenthesis = rightParenthesis; | 1045 this._rightParenthesis = rightParenthesis; |
928 this._semicolon = semicolon; | 1046 this._semicolon = semicolon; |
929 } | 1047 } |
| 1048 |
930 /** | 1049 /** |
931 * Initialize a newly created assert statement. | 1050 * Initialize a newly created assert statement. |
932 * @param keyword the token representing the 'assert' keyword | 1051 * @param keyword the token representing the 'assert' keyword |
933 * @param leftParenthesis the left parenthesis | 1052 * @param leftParenthesis the left parenthesis |
934 * @param condition the condition that is being asserted to be {@code true} | 1053 * @param condition the condition that is being asserted to be {@code true} |
935 * @param rightParenthesis the right parenthesis | 1054 * @param rightParenthesis the right parenthesis |
936 * @param semicolon the semicolon terminating the statement | 1055 * @param semicolon the semicolon terminating the statement |
937 */ | 1056 */ |
938 AssertStatement({Token keyword, Token leftParenthesis, Expression condition, T
oken rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, c
ondition, rightParenthesis, semicolon); | 1057 AssertStatement({Token keyword, Token leftParenthesis, Expression condition, T
oken rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, c
ondition, rightParenthesis, semicolon); |
939 accept(ASTVisitor visitor) => visitor.visitAssertStatement(this); | 1058 accept(ASTVisitor visitor) => visitor.visitAssertStatement(this); |
940 Token get beginToken => _keyword; | 1059 Token get beginToken => _keyword; |
| 1060 |
941 /** | 1061 /** |
942 * Return the condition that is being asserted to be {@code true}. | 1062 * Return the condition that is being asserted to be {@code true}. |
943 * @return the condition that is being asserted to be {@code true} | 1063 * @return the condition that is being asserted to be {@code true} |
944 */ | 1064 */ |
945 Expression get condition => _condition; | 1065 Expression get condition => _condition; |
946 Token get endToken => _semicolon; | 1066 Token get endToken => _semicolon; |
| 1067 |
947 /** | 1068 /** |
948 * Return the token representing the 'assert' keyword. | 1069 * Return the token representing the 'assert' keyword. |
949 * @return the token representing the 'assert' keyword | 1070 * @return the token representing the 'assert' keyword |
950 */ | 1071 */ |
951 Token get keyword => _keyword; | 1072 Token get keyword => _keyword; |
| 1073 |
952 /** | 1074 /** |
953 * Return the left parenthesis. | 1075 * Return the left parenthesis. |
954 * @return the left parenthesis | 1076 * @return the left parenthesis |
955 */ | 1077 */ |
956 Token get leftParenthesis => _leftParenthesis; | 1078 Token get leftParenthesis => _leftParenthesis; |
| 1079 |
957 /** | 1080 /** |
958 * Return the right parenthesis. | 1081 * Return the right parenthesis. |
959 * @return the right parenthesis | 1082 * @return the right parenthesis |
960 */ | 1083 */ |
961 Token get rightParenthesis => _rightParenthesis; | 1084 Token get rightParenthesis => _rightParenthesis; |
| 1085 |
962 /** | 1086 /** |
963 * Return the semicolon terminating the statement. | 1087 * Return the semicolon terminating the statement. |
964 * @return the semicolon terminating the statement | 1088 * @return the semicolon terminating the statement |
965 */ | 1089 */ |
966 Token get semicolon => _semicolon; | 1090 Token get semicolon => _semicolon; |
| 1091 |
967 /** | 1092 /** |
968 * Set the condition that is being asserted to be {@code true} to the given ex
pression. | 1093 * Set the condition that is being asserted to be {@code true} to the given ex
pression. |
969 * @param the condition that is being asserted to be {@code true} | 1094 * @param the condition that is being asserted to be {@code true} |
970 */ | 1095 */ |
971 void set condition(Expression condition2) { | 1096 void set condition(Expression condition2) { |
972 this._condition = becomeParentOf(condition2); | 1097 this._condition = becomeParentOf(condition2); |
973 } | 1098 } |
| 1099 |
974 /** | 1100 /** |
975 * Set the token representing the 'assert' keyword to the given token. | 1101 * Set the token representing the 'assert' keyword to the given token. |
976 * @param keyword the token representing the 'assert' keyword | 1102 * @param keyword the token representing the 'assert' keyword |
977 */ | 1103 */ |
978 void set keyword(Token keyword2) { | 1104 void set keyword(Token keyword2) { |
979 this._keyword = keyword2; | 1105 this._keyword = keyword2; |
980 } | 1106 } |
| 1107 |
981 /** | 1108 /** |
982 * Set the left parenthesis to the given token. | 1109 * Set the left parenthesis to the given token. |
983 * @param the left parenthesis | 1110 * @param the left parenthesis |
984 */ | 1111 */ |
985 void set leftParenthesis(Token leftParenthesis2) { | 1112 void set leftParenthesis(Token leftParenthesis2) { |
986 this._leftParenthesis = leftParenthesis2; | 1113 this._leftParenthesis = leftParenthesis2; |
987 } | 1114 } |
| 1115 |
988 /** | 1116 /** |
989 * Set the right parenthesis to the given token. | 1117 * Set the right parenthesis to the given token. |
990 * @param rightParenthesis the right parenthesis | 1118 * @param rightParenthesis the right parenthesis |
991 */ | 1119 */ |
992 void set rightParenthesis(Token rightParenthesis2) { | 1120 void set rightParenthesis(Token rightParenthesis2) { |
993 this._rightParenthesis = rightParenthesis2; | 1121 this._rightParenthesis = rightParenthesis2; |
994 } | 1122 } |
| 1123 |
995 /** | 1124 /** |
996 * Set the semicolon terminating the statement to the given token. | 1125 * Set the semicolon terminating the statement to the given token. |
997 * @param semicolon the semicolon terminating the statement | 1126 * @param semicolon the semicolon terminating the statement |
998 */ | 1127 */ |
999 void set semicolon(Token semicolon2) { | 1128 void set semicolon(Token semicolon2) { |
1000 this._semicolon = semicolon2; | 1129 this._semicolon = semicolon2; |
1001 } | 1130 } |
1002 void visitChildren(ASTVisitor<Object> visitor) { | 1131 void visitChildren(ASTVisitor<Object> visitor) { |
1003 safelyVisitChild(_condition, visitor); | 1132 safelyVisitChild(_condition, visitor); |
1004 } | 1133 } |
1005 } | 1134 } |
| 1135 |
1006 /** | 1136 /** |
1007 * Instances of the class {@code AssignmentExpression} represent an assignment e
xpression. | 1137 * Instances of the class {@code AssignmentExpression} represent an assignment e
xpression. |
1008 * <pre> | 1138 * <pre> |
1009 * assignmentExpression ::={@link Expression leftHandSide} {@link Token operator
} {@link Expression rightHandSide}</pre> | 1139 * assignmentExpression ::={@link Expression leftHandSide} {@link Token operator
} {@link Expression rightHandSide}</pre> |
1010 * @coverage dart.engine.ast | 1140 * @coverage dart.engine.ast |
1011 */ | 1141 */ |
1012 class AssignmentExpression extends Expression { | 1142 class AssignmentExpression extends Expression { |
| 1143 |
1013 /** | 1144 /** |
1014 * The expression used to compute the left hand side. | 1145 * The expression used to compute the left hand side. |
1015 */ | 1146 */ |
1016 Expression _leftHandSide; | 1147 Expression _leftHandSide; |
| 1148 |
1017 /** | 1149 /** |
1018 * The assignment operator being applied. | 1150 * The assignment operator being applied. |
1019 */ | 1151 */ |
1020 Token _operator; | 1152 Token _operator; |
| 1153 |
1021 /** | 1154 /** |
1022 * The expression used to compute the right hand side. | 1155 * The expression used to compute the right hand side. |
1023 */ | 1156 */ |
1024 Expression _rightHandSide; | 1157 Expression _rightHandSide; |
| 1158 |
1025 /** | 1159 /** |
1026 * The element associated with the operator, or {@code null} if the AST struct
ure has not been | 1160 * The element associated with the operator based on the static type of the le
ft-hand-side, or{@code null} if the AST structure has not been resolved, if the
operator is not a compound |
1027 * resolved, if the operator is not a compound operator, or if the operator co
uld not be resolved. | 1161 * operator, or if the operator could not be resolved. |
1028 */ | 1162 */ |
1029 MethodElement _element; | 1163 MethodElement _staticElement; |
| 1164 |
| 1165 /** |
| 1166 * The element associated with the operator based on the propagated type of th
e left-hand-side, or{@code null} if the AST structure has not been resolved, if
the operator is not a compound |
| 1167 * operator, or if the operator could not be resolved. |
| 1168 */ |
| 1169 MethodElement _propagatedElement; |
| 1170 |
1030 /** | 1171 /** |
1031 * Initialize a newly created assignment expression. | 1172 * Initialize a newly created assignment expression. |
1032 * @param leftHandSide the expression used to compute the left hand side | 1173 * @param leftHandSide the expression used to compute the left hand side |
1033 * @param operator the assignment operator being applied | 1174 * @param operator the assignment operator being applied |
1034 * @param rightHandSide the expression used to compute the right hand side | 1175 * @param rightHandSide the expression used to compute the right hand side |
1035 */ | 1176 */ |
1036 AssignmentExpression.full(Expression leftHandSide, Token operator, Expression
rightHandSide) { | 1177 AssignmentExpression.full(Expression leftHandSide, Token operator, Expression
rightHandSide) { |
1037 this._leftHandSide = becomeParentOf(leftHandSide); | 1178 this._leftHandSide = becomeParentOf(leftHandSide); |
1038 this._operator = operator; | 1179 this._operator = operator; |
1039 this._rightHandSide = becomeParentOf(rightHandSide); | 1180 this._rightHandSide = becomeParentOf(rightHandSide); |
1040 } | 1181 } |
| 1182 |
1041 /** | 1183 /** |
1042 * Initialize a newly created assignment expression. | 1184 * Initialize a newly created assignment expression. |
1043 * @param leftHandSide the expression used to compute the left hand side | 1185 * @param leftHandSide the expression used to compute the left hand side |
1044 * @param operator the assignment operator being applied | 1186 * @param operator the assignment operator being applied |
1045 * @param rightHandSide the expression used to compute the right hand side | 1187 * @param rightHandSide the expression used to compute the right hand side |
1046 */ | 1188 */ |
1047 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ
tHandSide}) : this.full(leftHandSide, operator, rightHandSide); | 1189 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ
tHandSide}) : this.full(leftHandSide, operator, rightHandSide); |
1048 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this); | 1190 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this); |
1049 Token get beginToken => _leftHandSide.beginToken; | 1191 Token get beginToken => _leftHandSide.beginToken; |
| 1192 |
1050 /** | 1193 /** |
1051 * Return the element associated with the operator, or {@code null} if the AST
structure has not | 1194 * Return the element associated with the operator based on the propagated typ
e of the |
1052 * been resolved, if the operator is not a compound operator, or if the operat
or could not be | 1195 * left-hand-side, or {@code null} if the AST structure has not been resolved,
if the operator is |
1053 * resolved. One example of the latter case is an operator that is not defined
for the type of the | 1196 * not a compound operator, or if the operator could not be resolved. One exam
ple of the latter |
1054 * left-hand operand. | 1197 * case is an operator that is not defined for the type of the left-hand opera
nd. |
1055 * @return the element associated with the operator | 1198 * @return the element associated with the operator |
1056 */ | 1199 */ |
1057 MethodElement get element => _element; | 1200 MethodElement get element => _propagatedElement; |
1058 Token get endToken => _rightHandSide.endToken; | 1201 Token get endToken => _rightHandSide.endToken; |
| 1202 |
1059 /** | 1203 /** |
1060 * Set the expression used to compute the left hand side to the given expressi
on. | 1204 * Set the expression used to compute the left hand side to the given expressi
on. |
1061 * @return the expression used to compute the left hand side | 1205 * @return the expression used to compute the left hand side |
1062 */ | 1206 */ |
1063 Expression get leftHandSide => _leftHandSide; | 1207 Expression get leftHandSide => _leftHandSide; |
| 1208 |
1064 /** | 1209 /** |
1065 * Return the assignment operator being applied. | 1210 * Return the assignment operator being applied. |
1066 * @return the assignment operator being applied | 1211 * @return the assignment operator being applied |
1067 */ | 1212 */ |
1068 Token get operator => _operator; | 1213 Token get operator => _operator; |
| 1214 |
1069 /** | 1215 /** |
1070 * Return the expression used to compute the right hand side. | 1216 * Return the expression used to compute the right hand side. |
1071 * @return the expression used to compute the right hand side | 1217 * @return the expression used to compute the right hand side |
1072 */ | 1218 */ |
1073 Expression get rightHandSide => _rightHandSide; | 1219 Expression get rightHandSide => _rightHandSide; |
| 1220 |
1074 /** | 1221 /** |
1075 * Set the element associated with the operator to the given element. | 1222 * Return the element associated with the operator based on the static type of
the left-hand-side, |
1076 * @param element the element associated with the operator | 1223 * or {@code null} if the AST structure has not been resolved, if the operator
is not a compound |
| 1224 * operator, or if the operator could not be resolved. One example of the latt
er case is an |
| 1225 * operator that is not defined for the type of the left-hand operand. |
| 1226 * @return the element associated with the operator |
| 1227 */ |
| 1228 MethodElement get staticElement => _staticElement; |
| 1229 |
| 1230 /** |
| 1231 * Set the element associated with the operator based on the propagated type o
f the left-hand-side |
| 1232 * to the given element. |
| 1233 * @param element the element to be associated with the operator |
1077 */ | 1234 */ |
1078 void set element(MethodElement element2) { | 1235 void set element(MethodElement element2) { |
1079 this._element = element2; | 1236 _propagatedElement = element2; |
1080 } | 1237 } |
| 1238 |
1081 /** | 1239 /** |
1082 * Return the expression used to compute the left hand side. | 1240 * Return the expression used to compute the left hand side. |
1083 * @param expression the expression used to compute the left hand side | 1241 * @param expression the expression used to compute the left hand side |
1084 */ | 1242 */ |
1085 void set leftHandSide(Expression expression) { | 1243 void set leftHandSide(Expression expression) { |
1086 _leftHandSide = becomeParentOf(expression); | 1244 _leftHandSide = becomeParentOf(expression); |
1087 } | 1245 } |
| 1246 |
1088 /** | 1247 /** |
1089 * Set the assignment operator being applied to the given operator. | 1248 * Set the assignment operator being applied to the given operator. |
1090 * @param operator the assignment operator being applied | 1249 * @param operator the assignment operator being applied |
1091 */ | 1250 */ |
1092 void set operator(Token operator2) { | 1251 void set operator(Token operator2) { |
1093 this._operator = operator2; | 1252 this._operator = operator2; |
1094 } | 1253 } |
| 1254 |
1095 /** | 1255 /** |
1096 * Set the expression used to compute the left hand side to the given expressi
on. | 1256 * Set the expression used to compute the left hand side to the given expressi
on. |
1097 * @param expression the expression used to compute the left hand side | 1257 * @param expression the expression used to compute the left hand side |
1098 */ | 1258 */ |
1099 void set rightHandSide(Expression expression) { | 1259 void set rightHandSide(Expression expression) { |
1100 _rightHandSide = becomeParentOf(expression); | 1260 _rightHandSide = becomeParentOf(expression); |
1101 } | 1261 } |
| 1262 |
| 1263 /** |
| 1264 * Set the element associated with the operator based on the static type of th
e left-hand-side to |
| 1265 * the given element. |
| 1266 * @param element the static element to be associated with the operator |
| 1267 */ |
| 1268 void set staticElement(MethodElement element) { |
| 1269 _staticElement = element; |
| 1270 } |
1102 void visitChildren(ASTVisitor<Object> visitor) { | 1271 void visitChildren(ASTVisitor<Object> visitor) { |
1103 safelyVisitChild(_leftHandSide, visitor); | 1272 safelyVisitChild(_leftHandSide, visitor); |
1104 safelyVisitChild(_rightHandSide, visitor); | 1273 safelyVisitChild(_rightHandSide, visitor); |
1105 } | 1274 } |
1106 } | 1275 } |
| 1276 |
1107 /** | 1277 /** |
1108 * Instances of the class {@code BinaryExpression} represent a binary (infix) ex
pression. | 1278 * Instances of the class {@code BinaryExpression} represent a binary (infix) ex
pression. |
1109 * <pre> | 1279 * <pre> |
1110 * binaryExpression ::={@link Expression leftOperand} {@link Token operator} {@l
ink Expression rightOperand}</pre> | 1280 * binaryExpression ::={@link Expression leftOperand} {@link Token operator} {@l
ink Expression rightOperand}</pre> |
1111 * @coverage dart.engine.ast | 1281 * @coverage dart.engine.ast |
1112 */ | 1282 */ |
1113 class BinaryExpression extends Expression { | 1283 class BinaryExpression extends Expression { |
| 1284 |
1114 /** | 1285 /** |
1115 * The expression used to compute the left operand. | 1286 * The expression used to compute the left operand. |
1116 */ | 1287 */ |
1117 Expression _leftOperand; | 1288 Expression _leftOperand; |
| 1289 |
1118 /** | 1290 /** |
1119 * The binary operator being applied. | 1291 * The binary operator being applied. |
1120 */ | 1292 */ |
1121 Token _operator; | 1293 Token _operator; |
| 1294 |
1122 /** | 1295 /** |
1123 * The expression used to compute the right operand. | 1296 * The expression used to compute the right operand. |
1124 */ | 1297 */ |
1125 Expression _rightOperand; | 1298 Expression _rightOperand; |
| 1299 |
1126 /** | 1300 /** |
1127 * The element associated with the operator, or {@code null} if the AST struct
ure has not been | 1301 * The element associated with the operator based on the static type of the le
ft operand, or{@code null} if the AST structure has not been resolved, if the op
erator is not user definable, |
1128 * resolved, if the operator is not user definable, or if the operator could n
ot be resolved. | 1302 * or if the operator could not be resolved. |
1129 */ | 1303 */ |
1130 MethodElement _element; | 1304 MethodElement _staticElement; |
| 1305 |
| 1306 /** |
| 1307 * The element associated with the operator based on the propagated type of th
e left operand, or{@code null} if the AST structure has not been resolved, if th
e operator is not user definable, |
| 1308 * or if the operator could not be resolved. |
| 1309 */ |
| 1310 MethodElement _propagatedElement; |
| 1311 |
1131 /** | 1312 /** |
1132 * Initialize a newly created binary expression. | 1313 * Initialize a newly created binary expression. |
1133 * @param leftOperand the expression used to compute the left operand | 1314 * @param leftOperand the expression used to compute the left operand |
1134 * @param operator the binary operator being applied | 1315 * @param operator the binary operator being applied |
1135 * @param rightOperand the expression used to compute the right operand | 1316 * @param rightOperand the expression used to compute the right operand |
1136 */ | 1317 */ |
1137 BinaryExpression.full(Expression leftOperand, Token operator, Expression right
Operand) { | 1318 BinaryExpression.full(Expression leftOperand, Token operator, Expression right
Operand) { |
1138 this._leftOperand = becomeParentOf(leftOperand); | 1319 this._leftOperand = becomeParentOf(leftOperand); |
1139 this._operator = operator; | 1320 this._operator = operator; |
1140 this._rightOperand = becomeParentOf(rightOperand); | 1321 this._rightOperand = becomeParentOf(rightOperand); |
1141 } | 1322 } |
| 1323 |
1142 /** | 1324 /** |
1143 * Initialize a newly created binary expression. | 1325 * Initialize a newly created binary expression. |
1144 * @param leftOperand the expression used to compute the left operand | 1326 * @param leftOperand the expression used to compute the left operand |
1145 * @param operator the binary operator being applied | 1327 * @param operator the binary operator being applied |
1146 * @param rightOperand the expression used to compute the right operand | 1328 * @param rightOperand the expression used to compute the right operand |
1147 */ | 1329 */ |
1148 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper
and}) : this.full(leftOperand, operator, rightOperand); | 1330 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper
and}) : this.full(leftOperand, operator, rightOperand); |
1149 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); | 1331 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); |
1150 Token get beginToken => _leftOperand.beginToken; | 1332 Token get beginToken => _leftOperand.beginToken; |
| 1333 |
1151 /** | 1334 /** |
1152 * Return the element associated with the operator, or {@code null} if the AST
structure has not | 1335 * Return the element associated with the operator based on the propagated typ
e of the left |
1153 * been resolved, if the operator is not user definable, or if the operator co
uld not be resolved. | 1336 * operand, or {@code null} if the AST structure has not been resolved, if the
operator is not |
1154 * One example of the latter case is an operator that is not defined for the t
ype of the left-hand | 1337 * user definable, or if the operator could not be resolved. One example of th
e latter case is an |
1155 * operand. | 1338 * operator that is not defined for the type of the left-hand operand. |
1156 * @return the element associated with the operator | 1339 * @return the element associated with the operator |
1157 */ | 1340 */ |
1158 MethodElement get element => _element; | 1341 MethodElement get element => _propagatedElement; |
1159 Token get endToken => _rightOperand.endToken; | 1342 Token get endToken => _rightOperand.endToken; |
| 1343 |
1160 /** | 1344 /** |
1161 * Return the expression used to compute the left operand. | 1345 * Return the expression used to compute the left operand. |
1162 * @return the expression used to compute the left operand | 1346 * @return the expression used to compute the left operand |
1163 */ | 1347 */ |
1164 Expression get leftOperand => _leftOperand; | 1348 Expression get leftOperand => _leftOperand; |
| 1349 |
1165 /** | 1350 /** |
1166 * Return the binary operator being applied. | 1351 * Return the binary operator being applied. |
1167 * @return the binary operator being applied | 1352 * @return the binary operator being applied |
1168 */ | 1353 */ |
1169 Token get operator => _operator; | 1354 Token get operator => _operator; |
| 1355 |
1170 /** | 1356 /** |
1171 * Return the expression used to compute the right operand. | 1357 * Return the expression used to compute the right operand. |
1172 * @return the expression used to compute the right operand | 1358 * @return the expression used to compute the right operand |
1173 */ | 1359 */ |
1174 Expression get rightOperand => _rightOperand; | 1360 Expression get rightOperand => _rightOperand; |
| 1361 |
1175 /** | 1362 /** |
1176 * Set the element associated with the operator to the given element. | 1363 * Return the element associated with the operator based on the static type of
the left operand, |
1177 * @param element the element associated with the operator | 1364 * or {@code null} if the AST structure has not been resolved, if the operator
is not user |
| 1365 * definable, or if the operator could not be resolved. One example of the lat
ter case is an |
| 1366 * operator that is not defined for the type of the left operand. |
| 1367 * @return the element associated with the operator |
| 1368 */ |
| 1369 MethodElement get staticElement => _staticElement; |
| 1370 |
| 1371 /** |
| 1372 * Set the element associated with the operator based on the propagated type o
f the left operand |
| 1373 * to the given element. |
| 1374 * @param element the element to be associated with the operator |
1178 */ | 1375 */ |
1179 void set element(MethodElement element2) { | 1376 void set element(MethodElement element2) { |
1180 this._element = element2; | 1377 _propagatedElement = element2; |
1181 } | 1378 } |
| 1379 |
1182 /** | 1380 /** |
1183 * Set the expression used to compute the left operand to the given expression
. | 1381 * Set the expression used to compute the left operand to the given expression
. |
1184 * @param expression the expression used to compute the left operand | 1382 * @param expression the expression used to compute the left operand |
1185 */ | 1383 */ |
1186 void set leftOperand(Expression expression) { | 1384 void set leftOperand(Expression expression) { |
1187 _leftOperand = becomeParentOf(expression); | 1385 _leftOperand = becomeParentOf(expression); |
1188 } | 1386 } |
| 1387 |
1189 /** | 1388 /** |
1190 * Set the binary operator being applied to the given operator. | 1389 * Set the binary operator being applied to the given operator. |
1191 * @return the binary operator being applied | 1390 * @return the binary operator being applied |
1192 */ | 1391 */ |
1193 void set operator(Token operator2) { | 1392 void set operator(Token operator2) { |
1194 this._operator = operator2; | 1393 this._operator = operator2; |
1195 } | 1394 } |
| 1395 |
1196 /** | 1396 /** |
1197 * Set the expression used to compute the right operand to the given expressio
n. | 1397 * Set the expression used to compute the right operand to the given expressio
n. |
1198 * @param expression the expression used to compute the right operand | 1398 * @param expression the expression used to compute the right operand |
1199 */ | 1399 */ |
1200 void set rightOperand(Expression expression) { | 1400 void set rightOperand(Expression expression) { |
1201 _rightOperand = becomeParentOf(expression); | 1401 _rightOperand = becomeParentOf(expression); |
1202 } | 1402 } |
| 1403 |
| 1404 /** |
| 1405 * Set the element associated with the operator based on the static type of th
e left operand to |
| 1406 * the given element. |
| 1407 * @param element the static element to be associated with the operator |
| 1408 */ |
| 1409 void set staticElement(MethodElement element) { |
| 1410 _staticElement = element; |
| 1411 } |
1203 void visitChildren(ASTVisitor<Object> visitor) { | 1412 void visitChildren(ASTVisitor<Object> visitor) { |
1204 safelyVisitChild(_leftOperand, visitor); | 1413 safelyVisitChild(_leftOperand, visitor); |
1205 safelyVisitChild(_rightOperand, visitor); | 1414 safelyVisitChild(_rightOperand, visitor); |
1206 } | 1415 } |
| 1416 |
| 1417 /** |
| 1418 * Return the parameter element representing the parameter to which the value
of the right operand |
| 1419 * will be bound. May be {@code null}. |
| 1420 * <p> |
| 1421 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
| 1422 * @return the parameter element representing the parameter to which the value
of the right |
| 1423 * operand will be bound |
| 1424 */ |
| 1425 ParameterElement get parameterElementForRightOperand { |
| 1426 if (_propagatedElement == null) { |
| 1427 return null; |
| 1428 } |
| 1429 List<ParameterElement> parameters2 = _propagatedElement.parameters; |
| 1430 if (parameters2.length < 1) { |
| 1431 return null; |
| 1432 } |
| 1433 return parameters2[0]; |
| 1434 } |
1207 } | 1435 } |
| 1436 |
1208 /** | 1437 /** |
1209 * Instances of the class {@code Block} represent a sequence of statements. | 1438 * Instances of the class {@code Block} represent a sequence of statements. |
1210 * <pre> | 1439 * <pre> |
1211 * block ::= | 1440 * block ::= |
1212 * '{' statement* '}' | 1441 * '{' statement* '}' |
1213 * </pre> | 1442 * </pre> |
1214 * @coverage dart.engine.ast | 1443 * @coverage dart.engine.ast |
1215 */ | 1444 */ |
1216 class Block extends Statement { | 1445 class Block extends Statement { |
| 1446 |
1217 /** | 1447 /** |
1218 * The left curly bracket. | 1448 * The left curly bracket. |
1219 */ | 1449 */ |
1220 Token _leftBracket; | 1450 Token _leftBracket; |
| 1451 |
1221 /** | 1452 /** |
1222 * The statements contained in the block. | 1453 * The statements contained in the block. |
1223 */ | 1454 */ |
1224 NodeList<Statement> _statements; | 1455 NodeList<Statement> _statements; |
| 1456 |
1225 /** | 1457 /** |
1226 * The right curly bracket. | 1458 * The right curly bracket. |
1227 */ | 1459 */ |
1228 Token _rightBracket; | 1460 Token _rightBracket; |
| 1461 |
1229 /** | 1462 /** |
1230 * Initialize a newly created block of code. | 1463 * Initialize a newly created block of code. |
1231 * @param leftBracket the left curly bracket | 1464 * @param leftBracket the left curly bracket |
1232 * @param statements the statements contained in the block | 1465 * @param statements the statements contained in the block |
1233 * @param rightBracket the right curly bracket | 1466 * @param rightBracket the right curly bracket |
1234 */ | 1467 */ |
1235 Block.full(Token leftBracket, List<Statement> statements, Token rightBracket)
{ | 1468 Block.full(Token leftBracket, List<Statement> statements, Token rightBracket)
{ |
1236 this._statements = new NodeList<Statement>(this); | 1469 this._statements = new NodeList<Statement>(this); |
1237 this._leftBracket = leftBracket; | 1470 this._leftBracket = leftBracket; |
1238 this._statements.addAll(statements); | 1471 this._statements.addAll(statements); |
1239 this._rightBracket = rightBracket; | 1472 this._rightBracket = rightBracket; |
1240 } | 1473 } |
| 1474 |
1241 /** | 1475 /** |
1242 * Initialize a newly created block of code. | 1476 * Initialize a newly created block of code. |
1243 * @param leftBracket the left curly bracket | 1477 * @param leftBracket the left curly bracket |
1244 * @param statements the statements contained in the block | 1478 * @param statements the statements contained in the block |
1245 * @param rightBracket the right curly bracket | 1479 * @param rightBracket the right curly bracket |
1246 */ | 1480 */ |
1247 Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : t
his.full(leftBracket, statements, rightBracket); | 1481 Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : t
his.full(leftBracket, statements, rightBracket); |
1248 accept(ASTVisitor visitor) => visitor.visitBlock(this); | 1482 accept(ASTVisitor visitor) => visitor.visitBlock(this); |
1249 Token get beginToken => _leftBracket; | 1483 Token get beginToken => _leftBracket; |
1250 Token get endToken => _rightBracket; | 1484 Token get endToken => _rightBracket; |
| 1485 |
1251 /** | 1486 /** |
1252 * Return the left curly bracket. | 1487 * Return the left curly bracket. |
1253 * @return the left curly bracket | 1488 * @return the left curly bracket |
1254 */ | 1489 */ |
1255 Token get leftBracket => _leftBracket; | 1490 Token get leftBracket => _leftBracket; |
| 1491 |
1256 /** | 1492 /** |
1257 * Return the right curly bracket. | 1493 * Return the right curly bracket. |
1258 * @return the right curly bracket | 1494 * @return the right curly bracket |
1259 */ | 1495 */ |
1260 Token get rightBracket => _rightBracket; | 1496 Token get rightBracket => _rightBracket; |
| 1497 |
1261 /** | 1498 /** |
1262 * Return the statements contained in the block. | 1499 * Return the statements contained in the block. |
1263 * @return the statements contained in the block | 1500 * @return the statements contained in the block |
1264 */ | 1501 */ |
1265 NodeList<Statement> get statements => _statements; | 1502 NodeList<Statement> get statements => _statements; |
| 1503 |
1266 /** | 1504 /** |
1267 * Set the left curly bracket to the given token. | 1505 * Set the left curly bracket to the given token. |
1268 * @param leftBracket the left curly bracket | 1506 * @param leftBracket the left curly bracket |
1269 */ | 1507 */ |
1270 void set leftBracket(Token leftBracket2) { | 1508 void set leftBracket(Token leftBracket2) { |
1271 this._leftBracket = leftBracket2; | 1509 this._leftBracket = leftBracket2; |
1272 } | 1510 } |
| 1511 |
1273 /** | 1512 /** |
1274 * Set the right curly bracket to the given token. | 1513 * Set the right curly bracket to the given token. |
1275 * @param rightBracket the right curly bracket | 1514 * @param rightBracket the right curly bracket |
1276 */ | 1515 */ |
1277 void set rightBracket(Token rightBracket2) { | 1516 void set rightBracket(Token rightBracket2) { |
1278 this._rightBracket = rightBracket2; | 1517 this._rightBracket = rightBracket2; |
1279 } | 1518 } |
1280 void visitChildren(ASTVisitor<Object> visitor) { | 1519 void visitChildren(ASTVisitor<Object> visitor) { |
1281 _statements.accept(visitor); | 1520 _statements.accept(visitor); |
1282 } | 1521 } |
1283 } | 1522 } |
| 1523 |
1284 /** | 1524 /** |
1285 * Instances of the class {@code BlockFunctionBody} represent a function body th
at consists of a | 1525 * Instances of the class {@code BlockFunctionBody} represent a function body th
at consists of a |
1286 * block of statements. | 1526 * block of statements. |
1287 * <pre> | 1527 * <pre> |
1288 * blockFunctionBody ::={@link Block block}</pre> | 1528 * blockFunctionBody ::={@link Block block}</pre> |
1289 * @coverage dart.engine.ast | 1529 * @coverage dart.engine.ast |
1290 */ | 1530 */ |
1291 class BlockFunctionBody extends FunctionBody { | 1531 class BlockFunctionBody extends FunctionBody { |
| 1532 |
1292 /** | 1533 /** |
1293 * The block representing the body of the function. | 1534 * The block representing the body of the function. |
1294 */ | 1535 */ |
1295 Block _block; | 1536 Block _block; |
| 1537 |
1296 /** | 1538 /** |
1297 * Initialize a newly created function body consisting of a block of statement
s. | 1539 * Initialize a newly created function body consisting of a block of statement
s. |
1298 * @param block the block representing the body of the function | 1540 * @param block the block representing the body of the function |
1299 */ | 1541 */ |
1300 BlockFunctionBody.full(Block block) { | 1542 BlockFunctionBody.full(Block block) { |
1301 this._block = becomeParentOf(block); | 1543 this._block = becomeParentOf(block); |
1302 } | 1544 } |
| 1545 |
1303 /** | 1546 /** |
1304 * Initialize a newly created function body consisting of a block of statement
s. | 1547 * Initialize a newly created function body consisting of a block of statement
s. |
1305 * @param block the block representing the body of the function | 1548 * @param block the block representing the body of the function |
1306 */ | 1549 */ |
1307 BlockFunctionBody({Block block}) : this.full(block); | 1550 BlockFunctionBody({Block block}) : this.full(block); |
1308 accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this); | 1551 accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this); |
1309 Token get beginToken => _block.beginToken; | 1552 Token get beginToken => _block.beginToken; |
| 1553 |
1310 /** | 1554 /** |
1311 * Return the block representing the body of the function. | 1555 * Return the block representing the body of the function. |
1312 * @return the block representing the body of the function | 1556 * @return the block representing the body of the function |
1313 */ | 1557 */ |
1314 Block get block => _block; | 1558 Block get block => _block; |
1315 Token get endToken => _block.endToken; | 1559 Token get endToken => _block.endToken; |
| 1560 |
1316 /** | 1561 /** |
1317 * Set the block representing the body of the function to the given block. | 1562 * Set the block representing the body of the function to the given block. |
1318 * @param block the block representing the body of the function | 1563 * @param block the block representing the body of the function |
1319 */ | 1564 */ |
1320 void set block(Block block2) { | 1565 void set block(Block block2) { |
1321 this._block = becomeParentOf(block2); | 1566 this._block = becomeParentOf(block2); |
1322 } | 1567 } |
1323 void visitChildren(ASTVisitor<Object> visitor) { | 1568 void visitChildren(ASTVisitor<Object> visitor) { |
1324 safelyVisitChild(_block, visitor); | 1569 safelyVisitChild(_block, visitor); |
1325 } | 1570 } |
1326 } | 1571 } |
| 1572 |
1327 /** | 1573 /** |
1328 * Instances of the class {@code BooleanLiteral} represent a boolean literal exp
ression. | 1574 * Instances of the class {@code BooleanLiteral} represent a boolean literal exp
ression. |
1329 * <pre> | 1575 * <pre> |
1330 * booleanLiteral ::= | 1576 * booleanLiteral ::= |
1331 * 'false' | 'true' | 1577 * 'false' | 'true' |
1332 * </pre> | 1578 * </pre> |
1333 * @coverage dart.engine.ast | 1579 * @coverage dart.engine.ast |
1334 */ | 1580 */ |
1335 class BooleanLiteral extends Literal { | 1581 class BooleanLiteral extends Literal { |
| 1582 |
1336 /** | 1583 /** |
1337 * The token representing the literal. | 1584 * The token representing the literal. |
1338 */ | 1585 */ |
1339 Token _literal; | 1586 Token _literal; |
| 1587 |
1340 /** | 1588 /** |
1341 * The value of the literal. | 1589 * The value of the literal. |
1342 */ | 1590 */ |
1343 bool _value = false; | 1591 bool _value = false; |
| 1592 |
1344 /** | 1593 /** |
1345 * Initialize a newly created boolean literal. | 1594 * Initialize a newly created boolean literal. |
1346 * @param literal the token representing the literal | 1595 * @param literal the token representing the literal |
1347 * @param value the value of the literal | 1596 * @param value the value of the literal |
1348 */ | 1597 */ |
1349 BooleanLiteral.full(Token literal, bool value) { | 1598 BooleanLiteral.full(Token literal, bool value) { |
1350 this._literal = literal; | 1599 this._literal = literal; |
1351 this._value = value; | 1600 this._value = value; |
1352 } | 1601 } |
| 1602 |
1353 /** | 1603 /** |
1354 * Initialize a newly created boolean literal. | 1604 * Initialize a newly created boolean literal. |
1355 * @param literal the token representing the literal | 1605 * @param literal the token representing the literal |
1356 * @param value the value of the literal | 1606 * @param value the value of the literal |
1357 */ | 1607 */ |
1358 BooleanLiteral({Token literal, bool value}) : this.full(literal, value); | 1608 BooleanLiteral({Token literal, bool value}) : this.full(literal, value); |
1359 accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this); | 1609 accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this); |
1360 Token get beginToken => _literal; | 1610 Token get beginToken => _literal; |
1361 Token get endToken => _literal; | 1611 Token get endToken => _literal; |
| 1612 |
1362 /** | 1613 /** |
1363 * Return the token representing the literal. | 1614 * Return the token representing the literal. |
1364 * @return the token representing the literal | 1615 * @return the token representing the literal |
1365 */ | 1616 */ |
1366 Token get literal => _literal; | 1617 Token get literal => _literal; |
| 1618 |
1367 /** | 1619 /** |
1368 * Return the value of the literal. | 1620 * Return the value of the literal. |
1369 * @return the value of the literal | 1621 * @return the value of the literal |
1370 */ | 1622 */ |
1371 bool get value => _value; | 1623 bool get value => _value; |
1372 bool isSynthetic() => _literal.isSynthetic(); | 1624 bool isSynthetic() => _literal.isSynthetic(); |
| 1625 |
1373 /** | 1626 /** |
1374 * Set the token representing the literal to the given token. | 1627 * Set the token representing the literal to the given token. |
1375 * @param literal the token representing the literal | 1628 * @param literal the token representing the literal |
1376 */ | 1629 */ |
1377 void set literal(Token literal2) { | 1630 void set literal(Token literal2) { |
1378 this._literal = literal2; | 1631 this._literal = literal2; |
1379 } | 1632 } |
| 1633 |
1380 /** | 1634 /** |
1381 * Set the value of the literal to the given value. | 1635 * Set the value of the literal to the given value. |
1382 * @param value the value of the literal | 1636 * @param value the value of the literal |
1383 */ | 1637 */ |
1384 void set value(bool value2) { | 1638 void set value(bool value2) { |
1385 this._value = value2; | 1639 this._value = value2; |
1386 } | 1640 } |
1387 void visitChildren(ASTVisitor<Object> visitor) { | 1641 void visitChildren(ASTVisitor<Object> visitor) { |
1388 } | 1642 } |
1389 } | 1643 } |
| 1644 |
1390 /** | 1645 /** |
1391 * Instances of the class {@code BreakStatement} represent a break statement. | 1646 * Instances of the class {@code BreakStatement} represent a break statement. |
1392 * <pre> | 1647 * <pre> |
1393 * breakStatement ::= | 1648 * breakStatement ::= |
1394 * 'break' {@link SimpleIdentifier label}? ';' | 1649 * 'break' {@link SimpleIdentifier label}? ';' |
1395 * </pre> | 1650 * </pre> |
1396 * @coverage dart.engine.ast | 1651 * @coverage dart.engine.ast |
1397 */ | 1652 */ |
1398 class BreakStatement extends Statement { | 1653 class BreakStatement extends Statement { |
| 1654 |
1399 /** | 1655 /** |
1400 * The token representing the 'break' keyword. | 1656 * The token representing the 'break' keyword. |
1401 */ | 1657 */ |
1402 Token _keyword; | 1658 Token _keyword; |
| 1659 |
1403 /** | 1660 /** |
1404 * The label associated with the statement, or {@code null} if there is no lab
el. | 1661 * The label associated with the statement, or {@code null} if there is no lab
el. |
1405 */ | 1662 */ |
1406 SimpleIdentifier _label; | 1663 SimpleIdentifier _label; |
| 1664 |
1407 /** | 1665 /** |
1408 * The semicolon terminating the statement. | 1666 * The semicolon terminating the statement. |
1409 */ | 1667 */ |
1410 Token _semicolon; | 1668 Token _semicolon; |
| 1669 |
1411 /** | 1670 /** |
1412 * Initialize a newly created break statement. | 1671 * Initialize a newly created break statement. |
1413 * @param keyword the token representing the 'break' keyword | 1672 * @param keyword the token representing the 'break' keyword |
1414 * @param label the label associated with the statement | 1673 * @param label the label associated with the statement |
1415 * @param semicolon the semicolon terminating the statement | 1674 * @param semicolon the semicolon terminating the statement |
1416 */ | 1675 */ |
1417 BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) { | 1676 BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) { |
1418 this._keyword = keyword; | 1677 this._keyword = keyword; |
1419 this._label = becomeParentOf(label); | 1678 this._label = becomeParentOf(label); |
1420 this._semicolon = semicolon; | 1679 this._semicolon = semicolon; |
1421 } | 1680 } |
| 1681 |
1422 /** | 1682 /** |
1423 * Initialize a newly created break statement. | 1683 * Initialize a newly created break statement. |
1424 * @param keyword the token representing the 'break' keyword | 1684 * @param keyword the token representing the 'break' keyword |
1425 * @param label the label associated with the statement | 1685 * @param label the label associated with the statement |
1426 * @param semicolon the semicolon terminating the statement | 1686 * @param semicolon the semicolon terminating the statement |
1427 */ | 1687 */ |
1428 BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : thi
s.full(keyword, label, semicolon); | 1688 BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : thi
s.full(keyword, label, semicolon); |
1429 accept(ASTVisitor visitor) => visitor.visitBreakStatement(this); | 1689 accept(ASTVisitor visitor) => visitor.visitBreakStatement(this); |
1430 Token get beginToken => _keyword; | 1690 Token get beginToken => _keyword; |
1431 Token get endToken => _semicolon; | 1691 Token get endToken => _semicolon; |
| 1692 |
1432 /** | 1693 /** |
1433 * Return the token representing the 'break' keyword. | 1694 * Return the token representing the 'break' keyword. |
1434 * @return the token representing the 'break' keyword | 1695 * @return the token representing the 'break' keyword |
1435 */ | 1696 */ |
1436 Token get keyword => _keyword; | 1697 Token get keyword => _keyword; |
| 1698 |
1437 /** | 1699 /** |
1438 * Return the label associated with the statement, or {@code null} if there is
no label. | 1700 * Return the label associated with the statement, or {@code null} if there is
no label. |
1439 * @return the label associated with the statement | 1701 * @return the label associated with the statement |
1440 */ | 1702 */ |
1441 SimpleIdentifier get label => _label; | 1703 SimpleIdentifier get label => _label; |
| 1704 |
1442 /** | 1705 /** |
1443 * Return the semicolon terminating the statement. | 1706 * Return the semicolon terminating the statement. |
1444 * @return the semicolon terminating the statement | 1707 * @return the semicolon terminating the statement |
1445 */ | 1708 */ |
1446 Token get semicolon => _semicolon; | 1709 Token get semicolon => _semicolon; |
| 1710 |
1447 /** | 1711 /** |
1448 * Set the token representing the 'break' keyword to the given token. | 1712 * Set the token representing the 'break' keyword to the given token. |
1449 * @param keyword the token representing the 'break' keyword | 1713 * @param keyword the token representing the 'break' keyword |
1450 */ | 1714 */ |
1451 void set keyword(Token keyword2) { | 1715 void set keyword(Token keyword2) { |
1452 this._keyword = keyword2; | 1716 this._keyword = keyword2; |
1453 } | 1717 } |
| 1718 |
1454 /** | 1719 /** |
1455 * Set the label associated with the statement to the given identifier. | 1720 * Set the label associated with the statement to the given identifier. |
1456 * @param identifier the label associated with the statement | 1721 * @param identifier the label associated with the statement |
1457 */ | 1722 */ |
1458 void set label(SimpleIdentifier identifier) { | 1723 void set label(SimpleIdentifier identifier) { |
1459 _label = becomeParentOf(identifier); | 1724 _label = becomeParentOf(identifier); |
1460 } | 1725 } |
| 1726 |
1461 /** | 1727 /** |
1462 * Set the semicolon terminating the statement to the given token. | 1728 * Set the semicolon terminating the statement to the given token. |
1463 * @param semicolon the semicolon terminating the statement | 1729 * @param semicolon the semicolon terminating the statement |
1464 */ | 1730 */ |
1465 void set semicolon(Token semicolon2) { | 1731 void set semicolon(Token semicolon2) { |
1466 this._semicolon = semicolon2; | 1732 this._semicolon = semicolon2; |
1467 } | 1733 } |
1468 void visitChildren(ASTVisitor<Object> visitor) { | 1734 void visitChildren(ASTVisitor<Object> visitor) { |
1469 safelyVisitChild(_label, visitor); | 1735 safelyVisitChild(_label, visitor); |
1470 } | 1736 } |
1471 } | 1737 } |
| 1738 |
1472 /** | 1739 /** |
1473 * Instances of the class {@code CascadeExpression} represent a sequence of casc
aded expressions: | 1740 * Instances of the class {@code CascadeExpression} represent a sequence of casc
aded expressions: |
1474 * expressions that share a common target. There are three kinds of expressions
that can be used in | 1741 * expressions that share a common target. There are three kinds of expressions
that can be used in |
1475 * a cascade expression: {@link IndexExpression}, {@link MethodInvocation} and{@
link PropertyAccess}. | 1742 * a cascade expression: {@link IndexExpression}, {@link MethodInvocation} and{@
link PropertyAccess}. |
1476 * <pre> | 1743 * <pre> |
1477 * cascadeExpression ::={@link Expression conditionalExpression} cascadeSection | 1744 * cascadeExpression ::={@link Expression conditionalExpression} cascadeSection |
1478 * cascadeSection ::= | 1745 * cascadeSection ::= |
1479 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assignme
ntOperator expressionWithoutCascade)? | 1746 * '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assignme
ntOperator expressionWithoutCascade)? |
1480 * cascadeSelector ::= | 1747 * cascadeSelector ::= |
1481 * '\[ ' expression '\] ' | 1748 * '\[ ' expression '\] ' |
1482 * | identifier | 1749 * | identifier |
1483 * </pre> | 1750 * </pre> |
1484 * @coverage dart.engine.ast | 1751 * @coverage dart.engine.ast |
1485 */ | 1752 */ |
1486 class CascadeExpression extends Expression { | 1753 class CascadeExpression extends Expression { |
| 1754 |
1487 /** | 1755 /** |
1488 * The target of the cascade sections. | 1756 * The target of the cascade sections. |
1489 */ | 1757 */ |
1490 Expression _target; | 1758 Expression _target; |
| 1759 |
1491 /** | 1760 /** |
1492 * The cascade sections sharing the common target. | 1761 * The cascade sections sharing the common target. |
1493 */ | 1762 */ |
1494 NodeList<Expression> _cascadeSections; | 1763 NodeList<Expression> _cascadeSections; |
| 1764 |
1495 /** | 1765 /** |
1496 * Initialize a newly created cascade expression. | 1766 * Initialize a newly created cascade expression. |
1497 * @param target the target of the cascade sections | 1767 * @param target the target of the cascade sections |
1498 * @param cascadeSections the cascade sections sharing the common target | 1768 * @param cascadeSections the cascade sections sharing the common target |
1499 */ | 1769 */ |
1500 CascadeExpression.full(Expression target, List<Expression> cascadeSections) { | 1770 CascadeExpression.full(Expression target, List<Expression> cascadeSections) { |
1501 this._cascadeSections = new NodeList<Expression>(this); | 1771 this._cascadeSections = new NodeList<Expression>(this); |
1502 this._target = becomeParentOf(target); | 1772 this._target = becomeParentOf(target); |
1503 this._cascadeSections.addAll(cascadeSections); | 1773 this._cascadeSections.addAll(cascadeSections); |
1504 } | 1774 } |
| 1775 |
1505 /** | 1776 /** |
1506 * Initialize a newly created cascade expression. | 1777 * Initialize a newly created cascade expression. |
1507 * @param target the target of the cascade sections | 1778 * @param target the target of the cascade sections |
1508 * @param cascadeSections the cascade sections sharing the common target | 1779 * @param cascadeSections the cascade sections sharing the common target |
1509 */ | 1780 */ |
1510 CascadeExpression({Expression target, List<Expression> cascadeSections}) : thi
s.full(target, cascadeSections); | 1781 CascadeExpression({Expression target, List<Expression> cascadeSections}) : thi
s.full(target, cascadeSections); |
1511 accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this); | 1782 accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this); |
1512 Token get beginToken => _target.beginToken; | 1783 Token get beginToken => _target.beginToken; |
| 1784 |
1513 /** | 1785 /** |
1514 * Return the cascade sections sharing the common target. | 1786 * Return the cascade sections sharing the common target. |
1515 * @return the cascade sections sharing the common target | 1787 * @return the cascade sections sharing the common target |
1516 */ | 1788 */ |
1517 NodeList<Expression> get cascadeSections => _cascadeSections; | 1789 NodeList<Expression> get cascadeSections => _cascadeSections; |
1518 Token get endToken => _cascadeSections.endToken; | 1790 Token get endToken => _cascadeSections.endToken; |
| 1791 |
1519 /** | 1792 /** |
1520 * Return the target of the cascade sections. | 1793 * Return the target of the cascade sections. |
1521 * @return the target of the cascade sections | 1794 * @return the target of the cascade sections |
1522 */ | 1795 */ |
1523 Expression get target => _target; | 1796 Expression get target => _target; |
| 1797 |
1524 /** | 1798 /** |
1525 * Set the target of the cascade sections to the given expression. | 1799 * Set the target of the cascade sections to the given expression. |
1526 * @param target the target of the cascade sections | 1800 * @param target the target of the cascade sections |
1527 */ | 1801 */ |
1528 void set target(Expression target2) { | 1802 void set target(Expression target2) { |
1529 this._target = becomeParentOf(target2); | 1803 this._target = becomeParentOf(target2); |
1530 } | 1804 } |
1531 void visitChildren(ASTVisitor<Object> visitor) { | 1805 void visitChildren(ASTVisitor<Object> visitor) { |
1532 safelyVisitChild(_target, visitor); | 1806 safelyVisitChild(_target, visitor); |
1533 _cascadeSections.accept(visitor); | 1807 _cascadeSections.accept(visitor); |
1534 } | 1808 } |
1535 } | 1809 } |
| 1810 |
1536 /** | 1811 /** |
1537 * Instances of the class {@code CatchClause} represent a catch clause within a
try statement. | 1812 * Instances of the class {@code CatchClause} represent a catch clause within a
try statement. |
1538 * <pre> | 1813 * <pre> |
1539 * onPart ::= | 1814 * onPart ::= |
1540 * catchPart {@link Block block}| 'on' type catchPart? {@link Block block}catchP
art ::= | 1815 * catchPart {@link Block block}| 'on' type catchPart? {@link Block block}catchP
art ::= |
1541 * 'catch' '(' {@link SimpleIdentifier exceptionParameter} (',' {@link SimpleIde
ntifier stackTraceParameter})? ')' | 1816 * 'catch' '(' {@link SimpleIdentifier exceptionParameter} (',' {@link SimpleIde
ntifier stackTraceParameter})? ')' |
1542 * </pre> | 1817 * </pre> |
1543 * @coverage dart.engine.ast | 1818 * @coverage dart.engine.ast |
1544 */ | 1819 */ |
1545 class CatchClause extends ASTNode { | 1820 class CatchClause extends ASTNode { |
| 1821 |
1546 /** | 1822 /** |
1547 * The token representing the 'on' keyword, or {@code null} if there is no 'on
' keyword. | 1823 * The token representing the 'on' keyword, or {@code null} if there is no 'on
' keyword. |
1548 */ | 1824 */ |
1549 Token _onKeyword; | 1825 Token _onKeyword; |
| 1826 |
1550 /** | 1827 /** |
1551 * The type of exceptions caught by this catch clause, or {@code null} if this
catch clause | 1828 * The type of exceptions caught by this catch clause, or {@code null} if this
catch clause |
1552 * catches every type of exception. | 1829 * catches every type of exception. |
1553 */ | 1830 */ |
1554 TypeName _exceptionType; | 1831 TypeName _exceptionType; |
| 1832 |
1555 /** | 1833 /** |
1556 * The token representing the 'catch' keyword, or {@code null} if there is no
'catch' keyword. | 1834 * The token representing the 'catch' keyword, or {@code null} if there is no
'catch' keyword. |
1557 */ | 1835 */ |
1558 Token _catchKeyword; | 1836 Token _catchKeyword; |
| 1837 |
1559 /** | 1838 /** |
1560 * The left parenthesis. | 1839 * The left parenthesis. |
1561 */ | 1840 */ |
1562 Token _leftParenthesis; | 1841 Token _leftParenthesis; |
| 1842 |
1563 /** | 1843 /** |
1564 * The parameter whose value will be the exception that was thrown. | 1844 * The parameter whose value will be the exception that was thrown. |
1565 */ | 1845 */ |
1566 SimpleIdentifier _exceptionParameter; | 1846 SimpleIdentifier _exceptionParameter; |
| 1847 |
1567 /** | 1848 /** |
1568 * The comma separating the exception parameter from the stack trace parameter
. | 1849 * The comma separating the exception parameter from the stack trace parameter
. |
1569 */ | 1850 */ |
1570 Token _comma; | 1851 Token _comma; |
| 1852 |
1571 /** | 1853 /** |
1572 * The parameter whose value will be the stack trace associated with the excep
tion. | 1854 * The parameter whose value will be the stack trace associated with the excep
tion. |
1573 */ | 1855 */ |
1574 SimpleIdentifier _stackTraceParameter; | 1856 SimpleIdentifier _stackTraceParameter; |
| 1857 |
1575 /** | 1858 /** |
1576 * The right parenthesis. | 1859 * The right parenthesis. |
1577 */ | 1860 */ |
1578 Token _rightParenthesis; | 1861 Token _rightParenthesis; |
| 1862 |
1579 /** | 1863 /** |
1580 * The body of the catch block. | 1864 * The body of the catch block. |
1581 */ | 1865 */ |
1582 Block _body; | 1866 Block _body; |
| 1867 |
1583 /** | 1868 /** |
1584 * Initialize a newly created catch clause. | 1869 * Initialize a newly created catch clause. |
1585 * @param onKeyword the token representing the 'on' keyword | 1870 * @param onKeyword the token representing the 'on' keyword |
1586 * @param exceptionType the type of exceptions caught by this catch clause | 1871 * @param exceptionType the type of exceptions caught by this catch clause |
1587 * @param leftParenthesis the left parenthesis | 1872 * @param leftParenthesis the left parenthesis |
1588 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown | 1873 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown |
1589 * @param comma the comma separating the exception parameter from the stack tr
ace parameter | 1874 * @param comma the comma separating the exception parameter from the stack tr
ace parameter |
1590 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with | 1875 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with |
1591 * the exception | 1876 * the exception |
1592 * @param rightParenthesis the right parenthesis | 1877 * @param rightParenthesis the right parenthesis |
1593 * @param body the body of the catch block | 1878 * @param body the body of the catch block |
1594 */ | 1879 */ |
1595 CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword,
Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleI
dentifier stackTraceParameter, Token rightParenthesis, Block body) { | 1880 CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword,
Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleI
dentifier stackTraceParameter, Token rightParenthesis, Block body) { |
1596 this._onKeyword = onKeyword; | 1881 this._onKeyword = onKeyword; |
1597 this._exceptionType = becomeParentOf(exceptionType); | 1882 this._exceptionType = becomeParentOf(exceptionType); |
1598 this._catchKeyword = catchKeyword; | 1883 this._catchKeyword = catchKeyword; |
1599 this._leftParenthesis = leftParenthesis; | 1884 this._leftParenthesis = leftParenthesis; |
1600 this._exceptionParameter = becomeParentOf(exceptionParameter); | 1885 this._exceptionParameter = becomeParentOf(exceptionParameter); |
1601 this._comma = comma; | 1886 this._comma = comma; |
1602 this._stackTraceParameter = becomeParentOf(stackTraceParameter); | 1887 this._stackTraceParameter = becomeParentOf(stackTraceParameter); |
1603 this._rightParenthesis = rightParenthesis; | 1888 this._rightParenthesis = rightParenthesis; |
1604 this._body = becomeParentOf(body); | 1889 this._body = becomeParentOf(body); |
1605 } | 1890 } |
| 1891 |
1606 /** | 1892 /** |
1607 * Initialize a newly created catch clause. | 1893 * Initialize a newly created catch clause. |
1608 * @param onKeyword the token representing the 'on' keyword | 1894 * @param onKeyword the token representing the 'on' keyword |
1609 * @param exceptionType the type of exceptions caught by this catch clause | 1895 * @param exceptionType the type of exceptions caught by this catch clause |
1610 * @param leftParenthesis the left parenthesis | 1896 * @param leftParenthesis the left parenthesis |
1611 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown | 1897 * @param exceptionParameter the parameter whose value will be the exception t
hat was thrown |
1612 * @param comma the comma separating the exception parameter from the stack tr
ace parameter | 1898 * @param comma the comma separating the exception parameter from the stack tr
ace parameter |
1613 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with | 1899 * @param stackTraceParameter the parameter whose value will be the stack trac
e associated with |
1614 * the exception | 1900 * the exception |
1615 * @param rightParenthesis the right parenthesis | 1901 * @param rightParenthesis the right parenthesis |
1616 * @param body the body of the catch block | 1902 * @param body the body of the catch block |
1617 */ | 1903 */ |
1618 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); | 1904 CatchClause({Token onKeyword, TypeName exceptionType, Token catchKeyword, Toke
n leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleIdent
ifier stackTraceParameter, Token rightParenthesis, Block body}) : this.full(onKe
yword, exceptionType, catchKeyword, leftParenthesis, exceptionParameter, comma,
stackTraceParameter, rightParenthesis, body); |
1619 accept(ASTVisitor visitor) => visitor.visitCatchClause(this); | 1905 accept(ASTVisitor visitor) => visitor.visitCatchClause(this); |
1620 Token get beginToken { | 1906 Token get beginToken { |
1621 if (_onKeyword != null) { | 1907 if (_onKeyword != null) { |
1622 return _onKeyword; | 1908 return _onKeyword; |
1623 } | 1909 } |
1624 return _catchKeyword; | 1910 return _catchKeyword; |
1625 } | 1911 } |
| 1912 |
1626 /** | 1913 /** |
1627 * Return the body of the catch block. | 1914 * Return the body of the catch block. |
1628 * @return the body of the catch block | 1915 * @return the body of the catch block |
1629 */ | 1916 */ |
1630 Block get body => _body; | 1917 Block get body => _body; |
| 1918 |
1631 /** | 1919 /** |
1632 * Return the token representing the 'catch' keyword, or {@code null} if there
is no 'catch' | 1920 * Return the token representing the 'catch' keyword, or {@code null} if there
is no 'catch' |
1633 * keyword. | 1921 * keyword. |
1634 * @return the token representing the 'catch' keyword | 1922 * @return the token representing the 'catch' keyword |
1635 */ | 1923 */ |
1636 Token get catchKeyword => _catchKeyword; | 1924 Token get catchKeyword => _catchKeyword; |
| 1925 |
1637 /** | 1926 /** |
1638 * Return the comma. | 1927 * Return the comma. |
1639 * @return the comma | 1928 * @return the comma |
1640 */ | 1929 */ |
1641 Token get comma => _comma; | 1930 Token get comma => _comma; |
1642 Token get endToken => _body.endToken; | 1931 Token get endToken => _body.endToken; |
| 1932 |
1643 /** | 1933 /** |
1644 * Return the parameter whose value will be the exception that was thrown. | 1934 * Return the parameter whose value will be the exception that was thrown. |
1645 * @return the parameter whose value will be the exception that was thrown | 1935 * @return the parameter whose value will be the exception that was thrown |
1646 */ | 1936 */ |
1647 SimpleIdentifier get exceptionParameter => _exceptionParameter; | 1937 SimpleIdentifier get exceptionParameter => _exceptionParameter; |
| 1938 |
1648 /** | 1939 /** |
1649 * Return the type of exceptions caught by this catch clause, or {@code null}
if this catch clause | 1940 * Return the type of exceptions caught by this catch clause, or {@code null}
if this catch clause |
1650 * catches every type of exception. | 1941 * catches every type of exception. |
1651 * @return the type of exceptions caught by this catch clause | 1942 * @return the type of exceptions caught by this catch clause |
1652 */ | 1943 */ |
1653 TypeName get exceptionType => _exceptionType; | 1944 TypeName get exceptionType => _exceptionType; |
| 1945 |
1654 /** | 1946 /** |
1655 * Return the left parenthesis. | 1947 * Return the left parenthesis. |
1656 * @return the left parenthesis | 1948 * @return the left parenthesis |
1657 */ | 1949 */ |
1658 Token get leftParenthesis => _leftParenthesis; | 1950 Token get leftParenthesis => _leftParenthesis; |
| 1951 |
1659 /** | 1952 /** |
1660 * Return the token representing the 'on' keyword, or {@code null} if there is
no 'on' keyword. | 1953 * Return the token representing the 'on' keyword, or {@code null} if there is
no 'on' keyword. |
1661 * @return the token representing the 'on' keyword | 1954 * @return the token representing the 'on' keyword |
1662 */ | 1955 */ |
1663 Token get onKeyword => _onKeyword; | 1956 Token get onKeyword => _onKeyword; |
| 1957 |
1664 /** | 1958 /** |
1665 * Return the right parenthesis. | 1959 * Return the right parenthesis. |
1666 * @return the right parenthesis | 1960 * @return the right parenthesis |
1667 */ | 1961 */ |
1668 Token get rightParenthesis => _rightParenthesis; | 1962 Token get rightParenthesis => _rightParenthesis; |
| 1963 |
1669 /** | 1964 /** |
1670 * Return the parameter whose value will be the stack trace associated with th
e exception. | 1965 * Return the parameter whose value will be the stack trace associated with th
e exception. |
1671 * @return the parameter whose value will be the stack trace associated with t
he exception | 1966 * @return the parameter whose value will be the stack trace associated with t
he exception |
1672 */ | 1967 */ |
1673 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; | 1968 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; |
| 1969 |
1674 /** | 1970 /** |
1675 * Set the body of the catch block to the given block. | 1971 * Set the body of the catch block to the given block. |
1676 * @param block the body of the catch block | 1972 * @param block the body of the catch block |
1677 */ | 1973 */ |
1678 void set body(Block block) { | 1974 void set body(Block block) { |
1679 _body = becomeParentOf(block); | 1975 _body = becomeParentOf(block); |
1680 } | 1976 } |
| 1977 |
1681 /** | 1978 /** |
1682 * Set the token representing the 'catch' keyword to the given token. | 1979 * Set the token representing the 'catch' keyword to the given token. |
1683 * @param catchKeyword the token representing the 'catch' keyword | 1980 * @param catchKeyword the token representing the 'catch' keyword |
1684 */ | 1981 */ |
1685 void set catchKeyword(Token catchKeyword2) { | 1982 void set catchKeyword(Token catchKeyword2) { |
1686 this._catchKeyword = catchKeyword2; | 1983 this._catchKeyword = catchKeyword2; |
1687 } | 1984 } |
| 1985 |
1688 /** | 1986 /** |
1689 * Set the comma to the given token. | 1987 * Set the comma to the given token. |
1690 * @param comma the comma | 1988 * @param comma the comma |
1691 */ | 1989 */ |
1692 void set comma(Token comma2) { | 1990 void set comma(Token comma2) { |
1693 this._comma = comma2; | 1991 this._comma = comma2; |
1694 } | 1992 } |
| 1993 |
1695 /** | 1994 /** |
1696 * Set the parameter whose value will be the exception that was thrown to the
given parameter. | 1995 * Set the parameter whose value will be the exception that was thrown to the
given parameter. |
1697 * @param parameter the parameter whose value will be the exception that was t
hrown | 1996 * @param parameter the parameter whose value will be the exception that was t
hrown |
1698 */ | 1997 */ |
1699 void set exceptionParameter(SimpleIdentifier parameter) { | 1998 void set exceptionParameter(SimpleIdentifier parameter) { |
1700 _exceptionParameter = becomeParentOf(parameter); | 1999 _exceptionParameter = becomeParentOf(parameter); |
1701 } | 2000 } |
| 2001 |
1702 /** | 2002 /** |
1703 * Set the type of exceptions caught by this catch clause to the given type. | 2003 * Set the type of exceptions caught by this catch clause to the given type. |
1704 * @param exceptionType the type of exceptions caught by this catch clause | 2004 * @param exceptionType the type of exceptions caught by this catch clause |
1705 */ | 2005 */ |
1706 void set exceptionType(TypeName exceptionType2) { | 2006 void set exceptionType(TypeName exceptionType2) { |
1707 this._exceptionType = exceptionType2; | 2007 this._exceptionType = exceptionType2; |
1708 } | 2008 } |
| 2009 |
1709 /** | 2010 /** |
1710 * Set the left parenthesis to the given token. | 2011 * Set the left parenthesis to the given token. |
1711 * @param parenthesis the left parenthesis | 2012 * @param parenthesis the left parenthesis |
1712 */ | 2013 */ |
1713 void set leftParenthesis(Token parenthesis) { | 2014 void set leftParenthesis(Token parenthesis) { |
1714 _leftParenthesis = parenthesis; | 2015 _leftParenthesis = parenthesis; |
1715 } | 2016 } |
| 2017 |
1716 /** | 2018 /** |
1717 * Set the token representing the 'on' keyword to the given keyword. | 2019 * Set the token representing the 'on' keyword to the given keyword. |
1718 * @param onKeyword the token representing the 'on' keyword | 2020 * @param onKeyword the token representing the 'on' keyword |
1719 */ | 2021 */ |
1720 void set onKeyword(Token onKeyword2) { | 2022 void set onKeyword(Token onKeyword2) { |
1721 this._onKeyword = onKeyword2; | 2023 this._onKeyword = onKeyword2; |
1722 } | 2024 } |
| 2025 |
1723 /** | 2026 /** |
1724 * Set the right parenthesis to the given token. | 2027 * Set the right parenthesis to the given token. |
1725 * @param parenthesis the right parenthesis | 2028 * @param parenthesis the right parenthesis |
1726 */ | 2029 */ |
1727 void set rightParenthesis(Token parenthesis) { | 2030 void set rightParenthesis(Token parenthesis) { |
1728 _rightParenthesis = parenthesis; | 2031 _rightParenthesis = parenthesis; |
1729 } | 2032 } |
| 2033 |
1730 /** | 2034 /** |
1731 * Set the parameter whose value will be the stack trace associated with the e
xception to the | 2035 * Set the parameter whose value will be the stack trace associated with the e
xception to the |
1732 * given parameter. | 2036 * given parameter. |
1733 * @param parameter the parameter whose value will be the stack trace associat
ed with the | 2037 * @param parameter the parameter whose value will be the stack trace associat
ed with the |
1734 * exception | 2038 * exception |
1735 */ | 2039 */ |
1736 void set stackTraceParameter(SimpleIdentifier parameter) { | 2040 void set stackTraceParameter(SimpleIdentifier parameter) { |
1737 _stackTraceParameter = becomeParentOf(parameter); | 2041 _stackTraceParameter = becomeParentOf(parameter); |
1738 } | 2042 } |
1739 void visitChildren(ASTVisitor<Object> visitor) { | 2043 void visitChildren(ASTVisitor<Object> visitor) { |
1740 safelyVisitChild(_exceptionType, visitor); | 2044 safelyVisitChild(_exceptionType, visitor); |
1741 safelyVisitChild(_exceptionParameter, visitor); | 2045 safelyVisitChild(_exceptionParameter, visitor); |
1742 safelyVisitChild(_stackTraceParameter, visitor); | 2046 safelyVisitChild(_stackTraceParameter, visitor); |
1743 safelyVisitChild(_body, visitor); | 2047 safelyVisitChild(_body, visitor); |
1744 } | 2048 } |
1745 } | 2049 } |
| 2050 |
1746 /** | 2051 /** |
1747 * Instances of the class {@code ClassDeclaration} represent the declaration of
a class. | 2052 * Instances of the class {@code ClassDeclaration} represent the declaration of
a class. |
1748 * <pre> | 2053 * <pre> |
1749 * classDeclaration ::= | 2054 * classDeclaration ::= |
1750 * 'abstract'? 'class' {@link SimpleIdentifier name} {@link TypeParameterList ty
peParameterList}? | 2055 * 'abstract'? 'class' {@link SimpleIdentifier name} {@link TypeParameterList ty
peParameterList}? |
1751 * ({@link ExtendsClause extendsClause} {@link WithClause withClause}?)?{@link I
mplementsClause implementsClause}? | 2056 * ({@link ExtendsClause extendsClause} {@link WithClause withClause}?)?{@link I
mplementsClause implementsClause}? |
1752 * '{' {@link ClassMember classMember}* '}' | 2057 * '{' {@link ClassMember classMember}* '}' |
1753 * </pre> | 2058 * </pre> |
1754 * @coverage dart.engine.ast | 2059 * @coverage dart.engine.ast |
1755 */ | 2060 */ |
1756 class ClassDeclaration extends CompilationUnitMember { | 2061 class ClassDeclaration extends CompilationUnitMember { |
| 2062 |
1757 /** | 2063 /** |
1758 * The 'abstract' keyword, or {@code null} if the keyword was absent. | 2064 * The 'abstract' keyword, or {@code null} if the keyword was absent. |
1759 */ | 2065 */ |
1760 Token _abstractKeyword; | 2066 Token _abstractKeyword; |
| 2067 |
1761 /** | 2068 /** |
1762 * The token representing the 'class' keyword. | 2069 * The token representing the 'class' keyword. |
1763 */ | 2070 */ |
1764 Token _classKeyword; | 2071 Token _classKeyword; |
| 2072 |
1765 /** | 2073 /** |
1766 * The name of the class being declared. | 2074 * The name of the class being declared. |
1767 */ | 2075 */ |
1768 SimpleIdentifier _name; | 2076 SimpleIdentifier _name; |
| 2077 |
1769 /** | 2078 /** |
1770 * The type parameters for the class, or {@code null} if the class does not ha
ve any type | 2079 * The type parameters for the class, or {@code null} if the class does not ha
ve any type |
1771 * parameters. | 2080 * parameters. |
1772 */ | 2081 */ |
1773 TypeParameterList _typeParameters; | 2082 TypeParameterList _typeParameters; |
| 2083 |
1774 /** | 2084 /** |
1775 * The extends clause for the class, or {@code null} if the class does not ext
end any other class. | 2085 * The extends clause for the class, or {@code null} if the class does not ext
end any other class. |
1776 */ | 2086 */ |
1777 ExtendsClause _extendsClause; | 2087 ExtendsClause _extendsClause; |
| 2088 |
1778 /** | 2089 /** |
1779 * The with clause for the class, or {@code null} if the class does not have a
with clause. | 2090 * The with clause for the class, or {@code null} if the class does not have a
with clause. |
1780 */ | 2091 */ |
1781 WithClause _withClause; | 2092 WithClause _withClause; |
| 2093 |
1782 /** | 2094 /** |
1783 * The implements clause for the class, or {@code null} if the class does not
implement any | 2095 * The implements clause for the class, or {@code null} if the class does not
implement any |
1784 * interfaces. | 2096 * interfaces. |
1785 */ | 2097 */ |
1786 ImplementsClause _implementsClause; | 2098 ImplementsClause _implementsClause; |
| 2099 |
1787 /** | 2100 /** |
1788 * The left curly bracket. | 2101 * The left curly bracket. |
1789 */ | 2102 */ |
1790 Token _leftBracket; | 2103 Token _leftBracket; |
| 2104 |
1791 /** | 2105 /** |
1792 * The members defined by the class. | 2106 * The members defined by the class. |
1793 */ | 2107 */ |
1794 NodeList<ClassMember> _members; | 2108 NodeList<ClassMember> _members; |
| 2109 |
1795 /** | 2110 /** |
1796 * The right curly bracket. | 2111 * The right curly bracket. |
1797 */ | 2112 */ |
1798 Token _rightBracket; | 2113 Token _rightBracket; |
| 2114 |
1799 /** | 2115 /** |
1800 * Initialize a newly created class declaration. | 2116 * Initialize a newly created class declaration. |
1801 * @param comment the documentation comment associated with this class | 2117 * @param comment the documentation comment associated with this class |
1802 * @param metadata the annotations associated with this class | 2118 * @param metadata the annotations associated with this class |
1803 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent | 2119 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent |
1804 * @param classKeyword the token representing the 'class' keyword | 2120 * @param classKeyword the token representing the 'class' keyword |
1805 * @param name the name of the class being declared | 2121 * @param name the name of the class being declared |
1806 * @param typeParameters the type parameters for the class | 2122 * @param typeParameters the type parameters for the class |
1807 * @param extendsClause the extends clause for the class | 2123 * @param extendsClause the extends clause for the class |
1808 * @param withClause the with clause for the class | 2124 * @param withClause the with clause for the class |
1809 * @param implementsClause the implements clause for the class | 2125 * @param implementsClause the implements clause for the class |
1810 * @param leftBracket the left curly bracket | 2126 * @param leftBracket the left curly bracket |
1811 * @param members the members defined by the class | 2127 * @param members the members defined by the class |
1812 * @param rightBracket the right curly bracket | 2128 * @param rightBracket the right curly bracket |
1813 */ | 2129 */ |
1814 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) { | 2130 ClassDeclaration.full(Comment comment, List<Annotation> metadata, Token abstra
ctKeyword, Token classKeyword, SimpleIdentifier name, TypeParameterList typePara
meters, ExtendsClause extendsClause, WithClause withClause, ImplementsClause imp
lementsClause, Token leftBracket, List<ClassMember> members, Token rightBracket)
: super.full(comment, metadata) { |
1815 this._members = new NodeList<ClassMember>(this); | 2131 this._members = new NodeList<ClassMember>(this); |
1816 this._abstractKeyword = abstractKeyword; | 2132 this._abstractKeyword = abstractKeyword; |
1817 this._classKeyword = classKeyword; | 2133 this._classKeyword = classKeyword; |
1818 this._name = becomeParentOf(name); | 2134 this._name = becomeParentOf(name); |
1819 this._typeParameters = becomeParentOf(typeParameters); | 2135 this._typeParameters = becomeParentOf(typeParameters); |
1820 this._extendsClause = becomeParentOf(extendsClause); | 2136 this._extendsClause = becomeParentOf(extendsClause); |
1821 this._withClause = becomeParentOf(withClause); | 2137 this._withClause = becomeParentOf(withClause); |
1822 this._implementsClause = becomeParentOf(implementsClause); | 2138 this._implementsClause = becomeParentOf(implementsClause); |
1823 this._leftBracket = leftBracket; | 2139 this._leftBracket = leftBracket; |
1824 this._members.addAll(members); | 2140 this._members.addAll(members); |
1825 this._rightBracket = rightBracket; | 2141 this._rightBracket = rightBracket; |
1826 } | 2142 } |
| 2143 |
1827 /** | 2144 /** |
1828 * Initialize a newly created class declaration. | 2145 * Initialize a newly created class declaration. |
1829 * @param comment the documentation comment associated with this class | 2146 * @param comment the documentation comment associated with this class |
1830 * @param metadata the annotations associated with this class | 2147 * @param metadata the annotations associated with this class |
1831 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent | 2148 * @param abstractKeyword the 'abstract' keyword, or {@code null} if the keywo
rd was absent |
1832 * @param classKeyword the token representing the 'class' keyword | 2149 * @param classKeyword the token representing the 'class' keyword |
1833 * @param name the name of the class being declared | 2150 * @param name the name of the class being declared |
1834 * @param typeParameters the type parameters for the class | 2151 * @param typeParameters the type parameters for the class |
1835 * @param extendsClause the extends clause for the class | 2152 * @param extendsClause the extends clause for the class |
1836 * @param withClause the with clause for the class | 2153 * @param withClause the with clause for the class |
1837 * @param implementsClause the implements clause for the class | 2154 * @param implementsClause the implements clause for the class |
1838 * @param leftBracket the left curly bracket | 2155 * @param leftBracket the left curly bracket |
1839 * @param members the members defined by the class | 2156 * @param members the members defined by the class |
1840 * @param rightBracket the right curly bracket | 2157 * @param rightBracket the right curly bracket |
1841 */ | 2158 */ |
1842 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); | 2159 ClassDeclaration({Comment comment, List<Annotation> metadata, Token abstractKe
yword, Token classKeyword, SimpleIdentifier name, TypeParameterList typeParamete
rs, ExtendsClause extendsClause, WithClause withClause, ImplementsClause impleme
ntsClause, Token leftBracket, List<ClassMember> members, Token rightBracket}) :
this.full(comment, metadata, abstractKeyword, classKeyword, name, typeParameters
, extendsClause, withClause, implementsClause, leftBracket, members, rightBracke
t); |
1843 accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); | 2160 accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); |
| 2161 |
1844 /** | 2162 /** |
1845 * Return the 'abstract' keyword, or {@code null} if the keyword was absent. | 2163 * Return the 'abstract' keyword, or {@code null} if the keyword was absent. |
1846 * @return the 'abstract' keyword | 2164 * @return the 'abstract' keyword |
1847 */ | 2165 */ |
1848 Token get abstractKeyword => _abstractKeyword; | 2166 Token get abstractKeyword => _abstractKeyword; |
| 2167 |
1849 /** | 2168 /** |
1850 * Return the token representing the 'class' keyword. | 2169 * Return the token representing the 'class' keyword. |
1851 * @return the token representing the 'class' keyword | 2170 * @return the token representing the 'class' keyword |
1852 */ | 2171 */ |
1853 Token get classKeyword => _classKeyword; | 2172 Token get classKeyword => _classKeyword; |
1854 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; | 2173 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; |
1855 Token get endToken => _rightBracket; | 2174 Token get endToken => _rightBracket; |
| 2175 |
1856 /** | 2176 /** |
1857 * Return the extends clause for this class, or {@code null} if the class does
not extend any | 2177 * Return the extends clause for this class, or {@code null} if the class does
not extend any |
1858 * other class. | 2178 * other class. |
1859 * @return the extends clause for this class | 2179 * @return the extends clause for this class |
1860 */ | 2180 */ |
1861 ExtendsClause get extendsClause => _extendsClause; | 2181 ExtendsClause get extendsClause => _extendsClause; |
| 2182 |
1862 /** | 2183 /** |
1863 * Return the implements clause for the class, or {@code null} if the class do
es not implement any | 2184 * Return the implements clause for the class, or {@code null} if the class do
es not implement any |
1864 * interfaces. | 2185 * interfaces. |
1865 * @return the implements clause for the class | 2186 * @return the implements clause for the class |
1866 */ | 2187 */ |
1867 ImplementsClause get implementsClause => _implementsClause; | 2188 ImplementsClause get implementsClause => _implementsClause; |
| 2189 |
1868 /** | 2190 /** |
1869 * Return the left curly bracket. | 2191 * Return the left curly bracket. |
1870 * @return the left curly bracket | 2192 * @return the left curly bracket |
1871 */ | 2193 */ |
1872 Token get leftBracket => _leftBracket; | 2194 Token get leftBracket => _leftBracket; |
| 2195 |
1873 /** | 2196 /** |
1874 * Return the members defined by the class. | 2197 * Return the members defined by the class. |
1875 * @return the members defined by the class | 2198 * @return the members defined by the class |
1876 */ | 2199 */ |
1877 NodeList<ClassMember> get members => _members; | 2200 NodeList<ClassMember> get members => _members; |
| 2201 |
1878 /** | 2202 /** |
1879 * Return the name of the class being declared. | 2203 * Return the name of the class being declared. |
1880 * @return the name of the class being declared | 2204 * @return the name of the class being declared |
1881 */ | 2205 */ |
1882 SimpleIdentifier get name => _name; | 2206 SimpleIdentifier get name => _name; |
| 2207 |
1883 /** | 2208 /** |
1884 * Return the right curly bracket. | 2209 * Return the right curly bracket. |
1885 * @return the right curly bracket | 2210 * @return the right curly bracket |
1886 */ | 2211 */ |
1887 Token get rightBracket => _rightBracket; | 2212 Token get rightBracket => _rightBracket; |
| 2213 |
1888 /** | 2214 /** |
1889 * Return the type parameters for the class, or {@code null} if the class does
not have any type | 2215 * Return the type parameters for the class, or {@code null} if the class does
not have any type |
1890 * parameters. | 2216 * parameters. |
1891 * @return the type parameters for the class | 2217 * @return the type parameters for the class |
1892 */ | 2218 */ |
1893 TypeParameterList get typeParameters => _typeParameters; | 2219 TypeParameterList get typeParameters => _typeParameters; |
| 2220 |
1894 /** | 2221 /** |
1895 * Return the with clause for the class, or {@code null} if the class does not
have a with clause. | 2222 * Return the with clause for the class, or {@code null} if the class does not
have a with clause. |
1896 * @return the with clause for the class | 2223 * @return the with clause for the class |
1897 */ | 2224 */ |
1898 WithClause get withClause => _withClause; | 2225 WithClause get withClause => _withClause; |
| 2226 |
1899 /** | 2227 /** |
1900 * Set the 'abstract' keyword to the given keyword. | 2228 * Set the 'abstract' keyword to the given keyword. |
1901 * @param abstractKeyword the 'abstract' keyword | 2229 * @param abstractKeyword the 'abstract' keyword |
1902 */ | 2230 */ |
1903 void set abstractKeyword(Token abstractKeyword2) { | 2231 void set abstractKeyword(Token abstractKeyword2) { |
1904 this._abstractKeyword = abstractKeyword2; | 2232 this._abstractKeyword = abstractKeyword2; |
1905 } | 2233 } |
| 2234 |
1906 /** | 2235 /** |
1907 * Set the token representing the 'class' keyword to the given token. | 2236 * Set the token representing the 'class' keyword to the given token. |
1908 * @param classKeyword the token representing the 'class' keyword | 2237 * @param classKeyword the token representing the 'class' keyword |
1909 */ | 2238 */ |
1910 void set classKeyword(Token classKeyword2) { | 2239 void set classKeyword(Token classKeyword2) { |
1911 this._classKeyword = classKeyword2; | 2240 this._classKeyword = classKeyword2; |
1912 } | 2241 } |
| 2242 |
1913 /** | 2243 /** |
1914 * Set the extends clause for this class to the given clause. | 2244 * Set the extends clause for this class to the given clause. |
1915 * @param extendsClause the extends clause for this class | 2245 * @param extendsClause the extends clause for this class |
1916 */ | 2246 */ |
1917 void set extendsClause(ExtendsClause extendsClause2) { | 2247 void set extendsClause(ExtendsClause extendsClause2) { |
1918 this._extendsClause = becomeParentOf(extendsClause2); | 2248 this._extendsClause = becomeParentOf(extendsClause2); |
1919 } | 2249 } |
| 2250 |
1920 /** | 2251 /** |
1921 * Set the implements clause for the class to the given clause. | 2252 * Set the implements clause for the class to the given clause. |
1922 * @param implementsClause the implements clause for the class | 2253 * @param implementsClause the implements clause for the class |
1923 */ | 2254 */ |
1924 void set implementsClause(ImplementsClause implementsClause2) { | 2255 void set implementsClause(ImplementsClause implementsClause2) { |
1925 this._implementsClause = becomeParentOf(implementsClause2); | 2256 this._implementsClause = becomeParentOf(implementsClause2); |
1926 } | 2257 } |
| 2258 |
1927 /** | 2259 /** |
1928 * Set the left curly bracket to the given token. | 2260 * Set the left curly bracket to the given token. |
1929 * @param leftBracket the left curly bracket | 2261 * @param leftBracket the left curly bracket |
1930 */ | 2262 */ |
1931 void set leftBracket(Token leftBracket2) { | 2263 void set leftBracket(Token leftBracket2) { |
1932 this._leftBracket = leftBracket2; | 2264 this._leftBracket = leftBracket2; |
1933 } | 2265 } |
| 2266 |
1934 /** | 2267 /** |
1935 * Set the name of the class being declared to the given identifier. | 2268 * Set the name of the class being declared to the given identifier. |
1936 * @param identifier the name of the class being declared | 2269 * @param identifier the name of the class being declared |
1937 */ | 2270 */ |
1938 void set name(SimpleIdentifier identifier) { | 2271 void set name(SimpleIdentifier identifier) { |
1939 _name = becomeParentOf(identifier); | 2272 _name = becomeParentOf(identifier); |
1940 } | 2273 } |
| 2274 |
1941 /** | 2275 /** |
1942 * Set the right curly bracket to the given token. | 2276 * Set the right curly bracket to the given token. |
1943 * @param rightBracket the right curly bracket | 2277 * @param rightBracket the right curly bracket |
1944 */ | 2278 */ |
1945 void set rightBracket(Token rightBracket2) { | 2279 void set rightBracket(Token rightBracket2) { |
1946 this._rightBracket = rightBracket2; | 2280 this._rightBracket = rightBracket2; |
1947 } | 2281 } |
| 2282 |
1948 /** | 2283 /** |
1949 * Set the type parameters for the class to the given list of type parameters. | 2284 * Set the type parameters for the class to the given list of type parameters. |
1950 * @param typeParameters the type parameters for the class | 2285 * @param typeParameters the type parameters for the class |
1951 */ | 2286 */ |
1952 void set typeParameters(TypeParameterList typeParameters2) { | 2287 void set typeParameters(TypeParameterList typeParameters2) { |
1953 this._typeParameters = typeParameters2; | 2288 this._typeParameters = typeParameters2; |
1954 } | 2289 } |
| 2290 |
1955 /** | 2291 /** |
1956 * Set the with clause for the class to the given clause. | 2292 * Set the with clause for the class to the given clause. |
1957 * @param withClause the with clause for the class | 2293 * @param withClause the with clause for the class |
1958 */ | 2294 */ |
1959 void set withClause(WithClause withClause2) { | 2295 void set withClause(WithClause withClause2) { |
1960 this._withClause = becomeParentOf(withClause2); | 2296 this._withClause = becomeParentOf(withClause2); |
1961 } | 2297 } |
1962 void visitChildren(ASTVisitor<Object> visitor) { | 2298 void visitChildren(ASTVisitor<Object> visitor) { |
1963 super.visitChildren(visitor); | 2299 super.visitChildren(visitor); |
1964 safelyVisitChild(_name, visitor); | 2300 safelyVisitChild(_name, visitor); |
1965 safelyVisitChild(_typeParameters, visitor); | 2301 safelyVisitChild(_typeParameters, visitor); |
1966 safelyVisitChild(_extendsClause, visitor); | 2302 safelyVisitChild(_extendsClause, visitor); |
1967 safelyVisitChild(_withClause, visitor); | 2303 safelyVisitChild(_withClause, visitor); |
1968 safelyVisitChild(_implementsClause, visitor); | 2304 safelyVisitChild(_implementsClause, visitor); |
1969 members.accept(visitor); | 2305 members.accept(visitor); |
1970 } | 2306 } |
1971 Token get firstTokenAfterCommentAndMetadata { | 2307 Token get firstTokenAfterCommentAndMetadata { |
1972 if (_abstractKeyword != null) { | 2308 if (_abstractKeyword != null) { |
1973 return _abstractKeyword; | 2309 return _abstractKeyword; |
1974 } | 2310 } |
1975 return _classKeyword; | 2311 return _classKeyword; |
1976 } | 2312 } |
1977 } | 2313 } |
| 2314 |
1978 /** | 2315 /** |
1979 * The abstract class {@code ClassMember} defines the behavior common to nodes t
hat declare a name | 2316 * The abstract class {@code ClassMember} defines the behavior common to nodes t
hat declare a name |
1980 * within the scope of a class. | 2317 * within the scope of a class. |
1981 * @coverage dart.engine.ast | 2318 * @coverage dart.engine.ast |
1982 */ | 2319 */ |
1983 abstract class ClassMember extends Declaration { | 2320 abstract class ClassMember extends Declaration { |
| 2321 |
1984 /** | 2322 /** |
1985 * Initialize a newly created member of a class. | 2323 * Initialize a newly created member of a class. |
1986 * @param comment the documentation comment associated with this member | 2324 * @param comment the documentation comment associated with this member |
1987 * @param metadata the annotations associated with this member | 2325 * @param metadata the annotations associated with this member |
1988 */ | 2326 */ |
1989 ClassMember.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { | 2327 ClassMember.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { |
1990 } | 2328 } |
| 2329 |
1991 /** | 2330 /** |
1992 * Initialize a newly created member of a class. | 2331 * Initialize a newly created member of a class. |
1993 * @param comment the documentation comment associated with this member | 2332 * @param comment the documentation comment associated with this member |
1994 * @param metadata the annotations associated with this member | 2333 * @param metadata the annotations associated with this member |
1995 */ | 2334 */ |
1996 ClassMember({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); | 2335 ClassMember({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); |
1997 } | 2336 } |
| 2337 |
1998 /** | 2338 /** |
1999 * Instances of the class {@code ClassTypeAlias} represent a class type alias. | 2339 * Instances of the class {@code ClassTypeAlias} represent a class type alias. |
2000 * <pre> | 2340 * <pre> |
2001 * classTypeAlias ::={@link SimpleIdentifier identifier} {@link TypeParameterLis
t typeParameters}? '=' 'abstract'? mixinApplication | 2341 * classTypeAlias ::={@link SimpleIdentifier identifier} {@link TypeParameterLis
t typeParameters}? '=' 'abstract'? mixinApplication |
2002 * mixinApplication ::={@link TypeName superclass} {@link WithClause withClause}
{@link ImplementsClause implementsClause}? ';' | 2342 * mixinApplication ::={@link TypeName superclass} {@link WithClause withClause}
{@link ImplementsClause implementsClause}? ';' |
2003 * </pre> | 2343 * </pre> |
2004 * @coverage dart.engine.ast | 2344 * @coverage dart.engine.ast |
2005 */ | 2345 */ |
2006 class ClassTypeAlias extends TypeAlias { | 2346 class ClassTypeAlias extends TypeAlias { |
| 2347 |
2007 /** | 2348 /** |
2008 * The name of the class being declared. | 2349 * The name of the class being declared. |
2009 */ | 2350 */ |
2010 SimpleIdentifier _name; | 2351 SimpleIdentifier _name; |
| 2352 |
2011 /** | 2353 /** |
2012 * The type parameters for the class, or {@code null} if the class does not ha
ve any type | 2354 * The type parameters for the class, or {@code null} if the class does not ha
ve any type |
2013 * parameters. | 2355 * parameters. |
2014 */ | 2356 */ |
2015 TypeParameterList _typeParameters; | 2357 TypeParameterList _typeParameters; |
| 2358 |
2016 /** | 2359 /** |
2017 * The token for the '=' separating the name from the definition. | 2360 * The token for the '=' separating the name from the definition. |
2018 */ | 2361 */ |
2019 Token _equals; | 2362 Token _equals; |
| 2363 |
2020 /** | 2364 /** |
2021 * The token for the 'abstract' keyword, or {@code null} if this is not defini
ng an abstract | 2365 * The token for the 'abstract' keyword, or {@code null} if this is not defini
ng an abstract |
2022 * class. | 2366 * class. |
2023 */ | 2367 */ |
2024 Token _abstractKeyword; | 2368 Token _abstractKeyword; |
| 2369 |
2025 /** | 2370 /** |
2026 * The name of the superclass of the class being declared. | 2371 * The name of the superclass of the class being declared. |
2027 */ | 2372 */ |
2028 TypeName _superclass; | 2373 TypeName _superclass; |
| 2374 |
2029 /** | 2375 /** |
2030 * The with clause for this class. | 2376 * The with clause for this class. |
2031 */ | 2377 */ |
2032 WithClause _withClause; | 2378 WithClause _withClause; |
| 2379 |
2033 /** | 2380 /** |
2034 * The implements clause for this class, or {@code null} if there is no implem
ents clause. | 2381 * The implements clause for this class, or {@code null} if there is no implem
ents clause. |
2035 */ | 2382 */ |
2036 ImplementsClause _implementsClause; | 2383 ImplementsClause _implementsClause; |
| 2384 |
2037 /** | 2385 /** |
2038 * Initialize a newly created class type alias. | 2386 * Initialize a newly created class type alias. |
2039 * @param comment the documentation comment associated with this type alias | 2387 * @param comment the documentation comment associated with this type alias |
2040 * @param metadata the annotations associated with this type alias | 2388 * @param metadata the annotations associated with this type alias |
2041 * @param keyword the token representing the 'typedef' keyword | 2389 * @param keyword the token representing the 'typedef' keyword |
2042 * @param name the name of the class being declared | 2390 * @param name the name of the class being declared |
2043 * @param typeParameters the type parameters for the class | 2391 * @param typeParameters the type parameters for the class |
2044 * @param equals the token for the '=' separating the name from the definition | 2392 * @param equals the token for the '=' separating the name from the definition |
2045 * @param abstractKeyword the token for the 'abstract' keyword | 2393 * @param abstractKeyword the token for the 'abstract' keyword |
2046 * @param superclass the name of the superclass of the class being declared | 2394 * @param superclass the name of the superclass of the class being declared |
2047 * @param withClause the with clause for this class | 2395 * @param withClause the with clause for this class |
2048 * @param implementsClause the implements clause for this class | 2396 * @param implementsClause the implements clause for this class |
2049 * @param semicolon the semicolon terminating the declaration | 2397 * @param semicolon the semicolon terminating the declaration |
2050 */ | 2398 */ |
2051 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) { | 2399 ClassTypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword,
SimpleIdentifier name, TypeParameterList typeParameters, Token equals, Token ab
stractKeyword, TypeName superclass, WithClause withClause, ImplementsClause impl
ementsClause, Token semicolon) : super.full(comment, metadata, keyword, semicolo
n) { |
2052 this._name = becomeParentOf(name); | 2400 this._name = becomeParentOf(name); |
2053 this._typeParameters = becomeParentOf(typeParameters); | 2401 this._typeParameters = becomeParentOf(typeParameters); |
2054 this._equals = equals; | 2402 this._equals = equals; |
2055 this._abstractKeyword = abstractKeyword; | 2403 this._abstractKeyword = abstractKeyword; |
2056 this._superclass = becomeParentOf(superclass); | 2404 this._superclass = becomeParentOf(superclass); |
2057 this._withClause = becomeParentOf(withClause); | 2405 this._withClause = becomeParentOf(withClause); |
2058 this._implementsClause = becomeParentOf(implementsClause); | 2406 this._implementsClause = becomeParentOf(implementsClause); |
2059 } | 2407 } |
| 2408 |
2060 /** | 2409 /** |
2061 * Initialize a newly created class type alias. | 2410 * Initialize a newly created class type alias. |
2062 * @param comment the documentation comment associated with this type alias | 2411 * @param comment the documentation comment associated with this type alias |
2063 * @param metadata the annotations associated with this type alias | 2412 * @param metadata the annotations associated with this type alias |
2064 * @param keyword the token representing the 'typedef' keyword | 2413 * @param keyword the token representing the 'typedef' keyword |
2065 * @param name the name of the class being declared | 2414 * @param name the name of the class being declared |
2066 * @param typeParameters the type parameters for the class | 2415 * @param typeParameters the type parameters for the class |
2067 * @param equals the token for the '=' separating the name from the definition | 2416 * @param equals the token for the '=' separating the name from the definition |
2068 * @param abstractKeyword the token for the 'abstract' keyword | 2417 * @param abstractKeyword the token for the 'abstract' keyword |
2069 * @param superclass the name of the superclass of the class being declared | 2418 * @param superclass the name of the superclass of the class being declared |
2070 * @param withClause the with clause for this class | 2419 * @param withClause the with clause for this class |
2071 * @param implementsClause the implements clause for this class | 2420 * @param implementsClause the implements clause for this class |
2072 * @param semicolon the semicolon terminating the declaration | 2421 * @param semicolon the semicolon terminating the declaration |
2073 */ | 2422 */ |
2074 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); | 2423 ClassTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Sim
pleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstra
ctKeyword, TypeName superclass, WithClause withClause, ImplementsClause implemen
tsClause, Token semicolon}) : this.full(comment, metadata, keyword, name, typePa
rameters, equals, abstractKeyword, superclass, withClause, implementsClause, sem
icolon); |
2075 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); | 2424 accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this); |
| 2425 |
2076 /** | 2426 /** |
2077 * Return the token for the 'abstract' keyword, or {@code null} if this is not
defining an | 2427 * Return the token for the 'abstract' keyword, or {@code null} if this is not
defining an |
2078 * abstract class. | 2428 * abstract class. |
2079 * @return the token for the 'abstract' keyword | 2429 * @return the token for the 'abstract' keyword |
2080 */ | 2430 */ |
2081 Token get abstractKeyword => _abstractKeyword; | 2431 Token get abstractKeyword => _abstractKeyword; |
2082 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; | 2432 ClassElement get element => _name != null ? (_name.element as ClassElement) :
null; |
| 2433 |
2083 /** | 2434 /** |
2084 * Return the token for the '=' separating the name from the definition. | 2435 * Return the token for the '=' separating the name from the definition. |
2085 * @return the token for the '=' separating the name from the definition | 2436 * @return the token for the '=' separating the name from the definition |
2086 */ | 2437 */ |
2087 Token get equals => _equals; | 2438 Token get equals => _equals; |
| 2439 |
2088 /** | 2440 /** |
2089 * Return the implements clause for this class, or {@code null} if there is no
implements clause. | 2441 * Return the implements clause for this class, or {@code null} if there is no
implements clause. |
2090 * @return the implements clause for this class | 2442 * @return the implements clause for this class |
2091 */ | 2443 */ |
2092 ImplementsClause get implementsClause => _implementsClause; | 2444 ImplementsClause get implementsClause => _implementsClause; |
| 2445 |
2093 /** | 2446 /** |
2094 * Return the name of the class being declared. | 2447 * Return the name of the class being declared. |
2095 * @return the name of the class being declared | 2448 * @return the name of the class being declared |
2096 */ | 2449 */ |
2097 SimpleIdentifier get name => _name; | 2450 SimpleIdentifier get name => _name; |
| 2451 |
2098 /** | 2452 /** |
2099 * Return the name of the superclass of the class being declared. | 2453 * Return the name of the superclass of the class being declared. |
2100 * @return the name of the superclass of the class being declared | 2454 * @return the name of the superclass of the class being declared |
2101 */ | 2455 */ |
2102 TypeName get superclass => _superclass; | 2456 TypeName get superclass => _superclass; |
| 2457 |
2103 /** | 2458 /** |
2104 * Return the type parameters for the class, or {@code null} if the class does
not have any type | 2459 * Return the type parameters for the class, or {@code null} if the class does
not have any type |
2105 * parameters. | 2460 * parameters. |
2106 * @return the type parameters for the class | 2461 * @return the type parameters for the class |
2107 */ | 2462 */ |
2108 TypeParameterList get typeParameters => _typeParameters; | 2463 TypeParameterList get typeParameters => _typeParameters; |
| 2464 |
2109 /** | 2465 /** |
2110 * Return the with clause for this class. | 2466 * Return the with clause for this class. |
2111 * @return the with clause for this class | 2467 * @return the with clause for this class |
2112 */ | 2468 */ |
2113 WithClause get withClause => _withClause; | 2469 WithClause get withClause => _withClause; |
| 2470 |
2114 /** | 2471 /** |
2115 * Set the token for the 'abstract' keyword to the given token. | 2472 * Set the token for the 'abstract' keyword to the given token. |
2116 * @param abstractKeyword the token for the 'abstract' keyword | 2473 * @param abstractKeyword the token for the 'abstract' keyword |
2117 */ | 2474 */ |
2118 void set abstractKeyword(Token abstractKeyword2) { | 2475 void set abstractKeyword(Token abstractKeyword2) { |
2119 this._abstractKeyword = abstractKeyword2; | 2476 this._abstractKeyword = abstractKeyword2; |
2120 } | 2477 } |
| 2478 |
2121 /** | 2479 /** |
2122 * Set the token for the '=' separating the name from the definition to the gi
ven token. | 2480 * Set the token for the '=' separating the name from the definition to the gi
ven token. |
2123 * @param equals the token for the '=' separating the name from the definition | 2481 * @param equals the token for the '=' separating the name from the definition |
2124 */ | 2482 */ |
2125 void set equals(Token equals2) { | 2483 void set equals(Token equals2) { |
2126 this._equals = equals2; | 2484 this._equals = equals2; |
2127 } | 2485 } |
| 2486 |
2128 /** | 2487 /** |
2129 * Set the implements clause for this class to the given implements clause. | 2488 * Set the implements clause for this class to the given implements clause. |
2130 * @param implementsClause the implements clause for this class | 2489 * @param implementsClause the implements clause for this class |
2131 */ | 2490 */ |
2132 void set implementsClause(ImplementsClause implementsClause2) { | 2491 void set implementsClause(ImplementsClause implementsClause2) { |
2133 this._implementsClause = becomeParentOf(implementsClause2); | 2492 this._implementsClause = becomeParentOf(implementsClause2); |
2134 } | 2493 } |
| 2494 |
2135 /** | 2495 /** |
2136 * Set the name of the class being declared to the given identifier. | 2496 * Set the name of the class being declared to the given identifier. |
2137 * @param name the name of the class being declared | 2497 * @param name the name of the class being declared |
2138 */ | 2498 */ |
2139 void set name(SimpleIdentifier name2) { | 2499 void set name(SimpleIdentifier name2) { |
2140 this._name = becomeParentOf(name2); | 2500 this._name = becomeParentOf(name2); |
2141 } | 2501 } |
| 2502 |
2142 /** | 2503 /** |
2143 * Set the name of the superclass of the class being declared to the given nam
e. | 2504 * Set the name of the superclass of the class being declared to the given nam
e. |
2144 * @param superclass the name of the superclass of the class being declared | 2505 * @param superclass the name of the superclass of the class being declared |
2145 */ | 2506 */ |
2146 void set superclass(TypeName superclass2) { | 2507 void set superclass(TypeName superclass2) { |
2147 this._superclass = becomeParentOf(superclass2); | 2508 this._superclass = becomeParentOf(superclass2); |
2148 } | 2509 } |
| 2510 |
2149 /** | 2511 /** |
2150 * Set the type parameters for the class to the given list of parameters. | 2512 * Set the type parameters for the class to the given list of parameters. |
2151 * @param typeParameters the type parameters for the class | 2513 * @param typeParameters the type parameters for the class |
2152 */ | 2514 */ |
2153 void set typeParameters(TypeParameterList typeParameters2) { | 2515 void set typeParameters(TypeParameterList typeParameters2) { |
2154 this._typeParameters = becomeParentOf(typeParameters2); | 2516 this._typeParameters = becomeParentOf(typeParameters2); |
2155 } | 2517 } |
| 2518 |
2156 /** | 2519 /** |
2157 * Set the with clause for this class to the given with clause. | 2520 * Set the with clause for this class to the given with clause. |
2158 * @param withClause the with clause for this class | 2521 * @param withClause the with clause for this class |
2159 */ | 2522 */ |
2160 void set withClause(WithClause withClause2) { | 2523 void set withClause(WithClause withClause2) { |
2161 this._withClause = becomeParentOf(withClause2); | 2524 this._withClause = becomeParentOf(withClause2); |
2162 } | 2525 } |
2163 void visitChildren(ASTVisitor<Object> visitor) { | 2526 void visitChildren(ASTVisitor<Object> visitor) { |
2164 super.visitChildren(visitor); | 2527 super.visitChildren(visitor); |
2165 safelyVisitChild(_name, visitor); | 2528 safelyVisitChild(_name, visitor); |
2166 safelyVisitChild(_typeParameters, visitor); | 2529 safelyVisitChild(_typeParameters, visitor); |
2167 safelyVisitChild(_superclass, visitor); | 2530 safelyVisitChild(_superclass, visitor); |
2168 safelyVisitChild(_withClause, visitor); | 2531 safelyVisitChild(_withClause, visitor); |
2169 safelyVisitChild(_implementsClause, visitor); | 2532 safelyVisitChild(_implementsClause, visitor); |
2170 } | 2533 } |
2171 } | 2534 } |
| 2535 |
2172 /** | 2536 /** |
2173 * Instances of the class {@code Combinator} represent the combinator associated
with an import | 2537 * Instances of the class {@code Combinator} represent the combinator associated
with an import |
2174 * directive. | 2538 * directive. |
2175 * <pre> | 2539 * <pre> |
2176 * combinator ::={@link HideCombinator hideCombinator}| {@link ShowCombinator sh
owCombinator}</pre> | 2540 * combinator ::={@link HideCombinator hideCombinator}| {@link ShowCombinator sh
owCombinator}</pre> |
2177 * @coverage dart.engine.ast | 2541 * @coverage dart.engine.ast |
2178 */ | 2542 */ |
2179 abstract class Combinator extends ASTNode { | 2543 abstract class Combinator extends ASTNode { |
| 2544 |
2180 /** | 2545 /** |
2181 * The keyword specifying what kind of processing is to be done on the importe
d names. | 2546 * The keyword specifying what kind of processing is to be done on the importe
d names. |
2182 */ | 2547 */ |
2183 Token _keyword; | 2548 Token _keyword; |
| 2549 |
2184 /** | 2550 /** |
2185 * Initialize a newly created import combinator. | 2551 * Initialize a newly created import combinator. |
2186 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2552 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
2187 * names | 2553 * names |
2188 */ | 2554 */ |
2189 Combinator.full(Token keyword) { | 2555 Combinator.full(Token keyword) { |
2190 this._keyword = keyword; | 2556 this._keyword = keyword; |
2191 } | 2557 } |
| 2558 |
2192 /** | 2559 /** |
2193 * Initialize a newly created import combinator. | 2560 * Initialize a newly created import combinator. |
2194 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2561 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
2195 * names | 2562 * names |
2196 */ | 2563 */ |
2197 Combinator({Token keyword}) : this.full(keyword); | 2564 Combinator({Token keyword}) : this.full(keyword); |
2198 Token get beginToken => _keyword; | 2565 Token get beginToken => _keyword; |
| 2566 |
2199 /** | 2567 /** |
2200 * Return the keyword specifying what kind of processing is to be done on the
imported names. | 2568 * Return the keyword specifying what kind of processing is to be done on the
imported names. |
2201 * @return the keyword specifying what kind of processing is to be done on the
imported names | 2569 * @return the keyword specifying what kind of processing is to be done on the
imported names |
2202 */ | 2570 */ |
2203 Token get keyword => _keyword; | 2571 Token get keyword => _keyword; |
| 2572 |
2204 /** | 2573 /** |
2205 * Set the keyword specifying what kind of processing is to be done on the imp
orted names to the | 2574 * Set the keyword specifying what kind of processing is to be done on the imp
orted names to the |
2206 * given token. | 2575 * given token. |
2207 * @param keyword the keyword specifying what kind of processing is to be done
on the imported | 2576 * @param keyword the keyword specifying what kind of processing is to be done
on the imported |
2208 * names | 2577 * names |
2209 */ | 2578 */ |
2210 void set keyword(Token keyword2) { | 2579 void set keyword(Token keyword2) { |
2211 this._keyword = keyword2; | 2580 this._keyword = keyword2; |
2212 } | 2581 } |
2213 } | 2582 } |
| 2583 |
2214 /** | 2584 /** |
2215 * Instances of the class {@code Comment} represent a comment within the source
code. | 2585 * Instances of the class {@code Comment} represent a comment within the source
code. |
2216 * <pre> | 2586 * <pre> |
2217 * comment ::= | 2587 * comment ::= |
2218 * endOfLineComment | 2588 * endOfLineComment |
2219 * | blockComment | 2589 * | blockComment |
2220 * | documentationComment | 2590 * | documentationComment |
2221 * endOfLineComment ::= | 2591 * endOfLineComment ::= |
2222 * '//' (CHARACTER - EOL)* EOL | 2592 * '//' (CHARACTER - EOL)* EOL |
2223 * blockComment ::= | 2593 * blockComment ::= |
2224 * '/ *' CHARACTER* '*/' | 2594 * '/ *' CHARACTER* '*/' |
2225 * documentationComment ::= | 2595 * documentationComment ::= |
2226 * '/ **' (CHARACTER | {@link CommentReference commentReference})* '*/' | 2596 * '/ **' (CHARACTER | {@link CommentReference commentReference})* '*/' |
2227 * | ('///' (CHARACTER - EOL)* EOL)+ | 2597 * | ('///' (CHARACTER - EOL)* EOL)+ |
2228 * </pre> | 2598 * </pre> |
2229 * @coverage dart.engine.ast | 2599 * @coverage dart.engine.ast |
2230 */ | 2600 */ |
2231 class Comment extends ASTNode { | 2601 class Comment extends ASTNode { |
| 2602 |
2232 /** | 2603 /** |
2233 * Create a block comment. | 2604 * Create a block comment. |
2234 * @param tokens the tokens representing the comment | 2605 * @param tokens the tokens representing the comment |
2235 * @return the block comment that was created | 2606 * @return the block comment that was created |
2236 */ | 2607 */ |
2237 static Comment createBlockComment(List<Token> tokens) => new Comment.full(toke
ns, CommentType.BLOCK, null); | 2608 static Comment createBlockComment(List<Token> tokens) => new Comment.full(toke
ns, CommentType.BLOCK, null); |
| 2609 |
2238 /** | 2610 /** |
2239 * Create a documentation comment. | 2611 * Create a documentation comment. |
2240 * @param tokens the tokens representing the comment | 2612 * @param tokens the tokens representing the comment |
2241 * @return the documentation comment that was created | 2613 * @return the documentation comment that was created |
2242 */ | 2614 */ |
2243 static Comment createDocumentationComment(List<Token> tokens) => new Comment.f
ull(tokens, CommentType.DOCUMENTATION, new List<CommentReference>()); | 2615 static Comment createDocumentationComment(List<Token> tokens) => new Comment.f
ull(tokens, CommentType.DOCUMENTATION, new List<CommentReference>()); |
| 2616 |
2244 /** | 2617 /** |
2245 * Create a documentation comment. | 2618 * Create a documentation comment. |
2246 * @param tokens the tokens representing the comment | 2619 * @param tokens the tokens representing the comment |
2247 * @param references the references embedded within the documentation comment | 2620 * @param references the references embedded within the documentation comment |
2248 * @return the documentation comment that was created | 2621 * @return the documentation comment that was created |
2249 */ | 2622 */ |
2250 static Comment createDocumentationComment2(List<Token> tokens, List<CommentRef
erence> references) => new Comment.full(tokens, CommentType.DOCUMENTATION, refer
ences); | 2623 static Comment createDocumentationComment2(List<Token> tokens, List<CommentRef
erence> references) => new Comment.full(tokens, CommentType.DOCUMENTATION, refer
ences); |
| 2624 |
2251 /** | 2625 /** |
2252 * Create an end-of-line comment. | 2626 * Create an end-of-line comment. |
2253 * @param tokens the tokens representing the comment | 2627 * @param tokens the tokens representing the comment |
2254 * @return the end-of-line comment that was created | 2628 * @return the end-of-line comment that was created |
2255 */ | 2629 */ |
2256 static Comment createEndOfLineComment(List<Token> tokens) => new Comment.full(
tokens, CommentType.END_OF_LINE, null); | 2630 static Comment createEndOfLineComment(List<Token> tokens) => new Comment.full(
tokens, CommentType.END_OF_LINE, null); |
| 2631 |
2257 /** | 2632 /** |
2258 * The tokens representing the comment. | 2633 * The tokens representing the comment. |
2259 */ | 2634 */ |
2260 List<Token> _tokens; | 2635 List<Token> _tokens; |
| 2636 |
2261 /** | 2637 /** |
2262 * The type of the comment. | 2638 * The type of the comment. |
2263 */ | 2639 */ |
2264 CommentType _type; | 2640 CommentType _type; |
| 2641 |
2265 /** | 2642 /** |
2266 * The references embedded within the documentation comment. This list will be
empty unless this | 2643 * The references embedded within the documentation comment. This list will be
empty unless this |
2267 * is a documentation comment that has references embedded within it. | 2644 * is a documentation comment that has references embedded within it. |
2268 */ | 2645 */ |
2269 NodeList<CommentReference> _references; | 2646 NodeList<CommentReference> _references; |
| 2647 |
2270 /** | 2648 /** |
2271 * Initialize a newly created comment. | 2649 * Initialize a newly created comment. |
2272 * @param tokens the tokens representing the comment | 2650 * @param tokens the tokens representing the comment |
2273 * @param type the type of the comment | 2651 * @param type the type of the comment |
2274 * @param references the references embedded within the documentation comment | 2652 * @param references the references embedded within the documentation comment |
2275 */ | 2653 */ |
2276 Comment.full(List<Token> tokens, CommentType type, List<CommentReference> refe
rences) { | 2654 Comment.full(List<Token> tokens, CommentType type, List<CommentReference> refe
rences) { |
2277 this._references = new NodeList<CommentReference>(this); | 2655 this._references = new NodeList<CommentReference>(this); |
2278 this._tokens = tokens; | 2656 this._tokens = tokens; |
2279 this._type = type; | 2657 this._type = type; |
2280 this._references.addAll(references); | 2658 this._references.addAll(references); |
2281 } | 2659 } |
| 2660 |
2282 /** | 2661 /** |
2283 * Initialize a newly created comment. | 2662 * Initialize a newly created comment. |
2284 * @param tokens the tokens representing the comment | 2663 * @param tokens the tokens representing the comment |
2285 * @param type the type of the comment | 2664 * @param type the type of the comment |
2286 * @param references the references embedded within the documentation comment | 2665 * @param references the references embedded within the documentation comment |
2287 */ | 2666 */ |
2288 Comment({List<Token> tokens, CommentType type, List<CommentReference> referenc
es}) : this.full(tokens, type, references); | 2667 Comment({List<Token> tokens, CommentType type, List<CommentReference> referenc
es}) : this.full(tokens, type, references); |
2289 accept(ASTVisitor visitor) => visitor.visitComment(this); | 2668 accept(ASTVisitor visitor) => visitor.visitComment(this); |
2290 Token get beginToken => _tokens[0]; | 2669 Token get beginToken => _tokens[0]; |
2291 Token get endToken => _tokens[_tokens.length - 1]; | 2670 Token get endToken => _tokens[_tokens.length - 1]; |
| 2671 |
2292 /** | 2672 /** |
2293 * Return the references embedded within the documentation comment. | 2673 * Return the references embedded within the documentation comment. |
2294 * @return the references embedded within the documentation comment | 2674 * @return the references embedded within the documentation comment |
2295 */ | 2675 */ |
2296 NodeList<CommentReference> get references => _references; | 2676 NodeList<CommentReference> get references => _references; |
| 2677 |
2297 /** | 2678 /** |
2298 * Return the tokens representing the comment. | 2679 * Return the tokens representing the comment. |
2299 * @return the tokens representing the comment | 2680 * @return the tokens representing the comment |
2300 */ | 2681 */ |
2301 List<Token> get tokens => _tokens; | 2682 List<Token> get tokens => _tokens; |
| 2683 |
2302 /** | 2684 /** |
2303 * Return {@code true} if this is a block comment. | 2685 * Return {@code true} if this is a block comment. |
2304 * @return {@code true} if this is a block comment | 2686 * @return {@code true} if this is a block comment |
2305 */ | 2687 */ |
2306 bool isBlock() => identical(_type, CommentType.BLOCK); | 2688 bool isBlock() => identical(_type, CommentType.BLOCK); |
| 2689 |
2307 /** | 2690 /** |
2308 * Return {@code true} if this is a documentation comment. | 2691 * Return {@code true} if this is a documentation comment. |
2309 * @return {@code true} if this is a documentation comment | 2692 * @return {@code true} if this is a documentation comment |
2310 */ | 2693 */ |
2311 bool isDocumentation() => identical(_type, CommentType.DOCUMENTATION); | 2694 bool isDocumentation() => identical(_type, CommentType.DOCUMENTATION); |
| 2695 |
2312 /** | 2696 /** |
2313 * Return {@code true} if this is an end-of-line comment. | 2697 * Return {@code true} if this is an end-of-line comment. |
2314 * @return {@code true} if this is an end-of-line comment | 2698 * @return {@code true} if this is an end-of-line comment |
2315 */ | 2699 */ |
2316 bool isEndOfLine() => identical(_type, CommentType.END_OF_LINE); | 2700 bool isEndOfLine() => identical(_type, CommentType.END_OF_LINE); |
2317 void visitChildren(ASTVisitor<Object> visitor) { | 2701 void visitChildren(ASTVisitor<Object> visitor) { |
2318 _references.accept(visitor); | 2702 _references.accept(visitor); |
2319 } | 2703 } |
2320 } | 2704 } |
| 2705 |
2321 /** | 2706 /** |
2322 * The enumeration {@code CommentType} encodes all the different types of commen
ts that are | 2707 * The enumeration {@code CommentType} encodes all the different types of commen
ts that are |
2323 * recognized by the parser. | 2708 * recognized by the parser. |
2324 */ | 2709 */ |
2325 class CommentType implements Comparable<CommentType> { | 2710 class CommentType implements Comparable<CommentType> { |
| 2711 |
2326 /** | 2712 /** |
2327 * An end-of-line comment. | 2713 * An end-of-line comment. |
2328 */ | 2714 */ |
2329 static final CommentType END_OF_LINE = new CommentType('END_OF_LINE', 0); | 2715 static final CommentType END_OF_LINE = new CommentType('END_OF_LINE', 0); |
| 2716 |
2330 /** | 2717 /** |
2331 * A block comment. | 2718 * A block comment. |
2332 */ | 2719 */ |
2333 static final CommentType BLOCK = new CommentType('BLOCK', 1); | 2720 static final CommentType BLOCK = new CommentType('BLOCK', 1); |
| 2721 |
2334 /** | 2722 /** |
2335 * A documentation comment. | 2723 * A documentation comment. |
2336 */ | 2724 */ |
2337 static final CommentType DOCUMENTATION = new CommentType('DOCUMENTATION', 2); | 2725 static final CommentType DOCUMENTATION = new CommentType('DOCUMENTATION', 2); |
2338 static final List<CommentType> values = [END_OF_LINE, BLOCK, DOCUMENTATION]; | 2726 static final List<CommentType> values = [END_OF_LINE, BLOCK, DOCUMENTATION]; |
2339 final String __name; | 2727 |
2340 final int __ordinal; | 2728 /// The name of this enum constant, as declared in the enum declaration. |
2341 int get ordinal => __ordinal; | 2729 final String name; |
2342 CommentType(this.__name, this.__ordinal) { | 2730 |
| 2731 /// The position in the enum declaration. |
| 2732 final int ordinal; |
| 2733 CommentType(this.name, this.ordinal) { |
2343 } | 2734 } |
2344 int compareTo(CommentType other) => __ordinal - other.__ordinal; | 2735 int compareTo(CommentType other) => ordinal - other.ordinal; |
2345 String toString() => __name; | 2736 String toString() => name; |
2346 } | 2737 } |
| 2738 |
2347 /** | 2739 /** |
2348 * Instances of the class {@code CommentReference} represent a reference to a Da
rt element that is | 2740 * Instances of the class {@code CommentReference} represent a reference to a Da
rt element that is |
2349 * found within a documentation comment. | 2741 * found within a documentation comment. |
2350 * <pre> | 2742 * <pre> |
2351 * commentReference ::= | 2743 * commentReference ::= |
2352 * '\[' 'new'? {@link Identifier identifier} '\]' | 2744 * '\[' 'new'? {@link Identifier identifier} '\]' |
2353 * </pre> | 2745 * </pre> |
2354 * @coverage dart.engine.ast | 2746 * @coverage dart.engine.ast |
2355 */ | 2747 */ |
2356 class CommentReference extends ASTNode { | 2748 class CommentReference extends ASTNode { |
| 2749 |
2357 /** | 2750 /** |
2358 * The token representing the 'new' keyword, or {@code null} if there was no '
new' keyword. | 2751 * The token representing the 'new' keyword, or {@code null} if there was no '
new' keyword. |
2359 */ | 2752 */ |
2360 Token _newKeyword; | 2753 Token _newKeyword; |
| 2754 |
2361 /** | 2755 /** |
2362 * The identifier being referenced. | 2756 * The identifier being referenced. |
2363 */ | 2757 */ |
2364 Identifier _identifier; | 2758 Identifier _identifier; |
| 2759 |
2365 /** | 2760 /** |
2366 * Initialize a newly created reference to a Dart element. | 2761 * Initialize a newly created reference to a Dart element. |
2367 * @param newKeyword the token representing the 'new' keyword | 2762 * @param newKeyword the token representing the 'new' keyword |
2368 * @param identifier the identifier being referenced | 2763 * @param identifier the identifier being referenced |
2369 */ | 2764 */ |
2370 CommentReference.full(Token newKeyword, Identifier identifier) { | 2765 CommentReference.full(Token newKeyword, Identifier identifier) { |
2371 this._newKeyword = newKeyword; | 2766 this._newKeyword = newKeyword; |
2372 this._identifier = becomeParentOf(identifier); | 2767 this._identifier = becomeParentOf(identifier); |
2373 } | 2768 } |
| 2769 |
2374 /** | 2770 /** |
2375 * Initialize a newly created reference to a Dart element. | 2771 * Initialize a newly created reference to a Dart element. |
2376 * @param newKeyword the token representing the 'new' keyword | 2772 * @param newKeyword the token representing the 'new' keyword |
2377 * @param identifier the identifier being referenced | 2773 * @param identifier the identifier being referenced |
2378 */ | 2774 */ |
2379 CommentReference({Token newKeyword, Identifier identifier}) : this.full(newKey
word, identifier); | 2775 CommentReference({Token newKeyword, Identifier identifier}) : this.full(newKey
word, identifier); |
2380 accept(ASTVisitor visitor) => visitor.visitCommentReference(this); | 2776 accept(ASTVisitor visitor) => visitor.visitCommentReference(this); |
2381 Token get beginToken => _identifier.beginToken; | 2777 Token get beginToken => _identifier.beginToken; |
2382 Token get endToken => _identifier.endToken; | 2778 Token get endToken => _identifier.endToken; |
| 2779 |
2383 /** | 2780 /** |
2384 * Return the identifier being referenced. | 2781 * Return the identifier being referenced. |
2385 * @return the identifier being referenced | 2782 * @return the identifier being referenced |
2386 */ | 2783 */ |
2387 Identifier get identifier => _identifier; | 2784 Identifier get identifier => _identifier; |
| 2785 |
2388 /** | 2786 /** |
2389 * Return the token representing the 'new' keyword, or {@code null} if there w
as no 'new' keyword. | 2787 * Return the token representing the 'new' keyword, or {@code null} if there w
as no 'new' keyword. |
2390 * @return the token representing the 'new' keyword | 2788 * @return the token representing the 'new' keyword |
2391 */ | 2789 */ |
2392 Token get newKeyword => _newKeyword; | 2790 Token get newKeyword => _newKeyword; |
| 2791 |
2393 /** | 2792 /** |
2394 * Set the identifier being referenced to the given identifier. | 2793 * Set the identifier being referenced to the given identifier. |
2395 * @param identifier the identifier being referenced | 2794 * @param identifier the identifier being referenced |
2396 */ | 2795 */ |
2397 void set identifier(Identifier identifier2) { | 2796 void set identifier(Identifier identifier2) { |
2398 identifier2 = becomeParentOf(identifier2); | 2797 identifier2 = becomeParentOf(identifier2); |
2399 } | 2798 } |
| 2799 |
2400 /** | 2800 /** |
2401 * Set the token representing the 'new' keyword to the given token. | 2801 * Set the token representing the 'new' keyword to the given token. |
2402 * @param newKeyword the token representing the 'new' keyword | 2802 * @param newKeyword the token representing the 'new' keyword |
2403 */ | 2803 */ |
2404 void set newKeyword(Token newKeyword2) { | 2804 void set newKeyword(Token newKeyword2) { |
2405 this._newKeyword = newKeyword2; | 2805 this._newKeyword = newKeyword2; |
2406 } | 2806 } |
2407 void visitChildren(ASTVisitor<Object> visitor) { | 2807 void visitChildren(ASTVisitor<Object> visitor) { |
2408 safelyVisitChild(_identifier, visitor); | 2808 safelyVisitChild(_identifier, visitor); |
2409 } | 2809 } |
2410 } | 2810 } |
| 2811 |
2411 /** | 2812 /** |
2412 * Instances of the class {@code CompilationUnit} represent a compilation unit. | 2813 * Instances of the class {@code CompilationUnit} represent a compilation unit. |
2413 * <p> | 2814 * <p> |
2414 * While the grammar restricts the order of the directives and declarations with
in a compilation | 2815 * While the grammar restricts the order of the directives and declarations with
in a compilation |
2415 * unit, this class does not enforce those restrictions. In particular, the chil
dren of a | 2816 * unit, this class does not enforce those restrictions. In particular, the chil
dren of a |
2416 * compilation unit will be visited in lexical order even if lexical order does
not conform to the | 2817 * compilation unit will be visited in lexical order even if lexical order does
not conform to the |
2417 * restrictions of the grammar. | 2818 * restrictions of the grammar. |
2418 * <pre> | 2819 * <pre> |
2419 * compilationUnit ::= | 2820 * compilationUnit ::= |
2420 * directives declarations | 2821 * directives declarations |
2421 * directives ::={@link ScriptTag scriptTag}? {@link LibraryDirective libraryDir
ective}? namespaceDirective* {@link PartDirective partDirective}| {@link PartOfD
irective partOfDirective}namespaceDirective ::={@link ImportDirective importDire
ctive}| {@link ExportDirective exportDirective}declarations ::={@link Compilatio
nUnitMember compilationUnitMember}</pre> | 2822 * directives ::={@link ScriptTag scriptTag}? {@link LibraryDirective libraryDir
ective}? namespaceDirective* {@link PartDirective partDirective}| {@link PartOfD
irective partOfDirective}namespaceDirective ::={@link ImportDirective importDire
ctive}| {@link ExportDirective exportDirective}declarations ::={@link Compilatio
nUnitMember compilationUnitMember}</pre> |
2422 * @coverage dart.engine.ast | 2823 * @coverage dart.engine.ast |
2423 */ | 2824 */ |
2424 class CompilationUnit extends ASTNode { | 2825 class CompilationUnit extends ASTNode { |
| 2826 |
2425 /** | 2827 /** |
2426 * The first token in the token stream that was parsed to form this compilatio
n unit. | 2828 * The first token in the token stream that was parsed to form this compilatio
n unit. |
2427 */ | 2829 */ |
2428 Token _beginToken; | 2830 Token _beginToken; |
| 2831 |
2429 /** | 2832 /** |
2430 * The script tag at the beginning of the compilation unit, or {@code null} if
there is no script | 2833 * The script tag at the beginning of the compilation unit, or {@code null} if
there is no script |
2431 * tag in this compilation unit. | 2834 * tag in this compilation unit. |
2432 */ | 2835 */ |
2433 ScriptTag _scriptTag; | 2836 ScriptTag _scriptTag; |
| 2837 |
2434 /** | 2838 /** |
2435 * The directives contained in this compilation unit. | 2839 * The directives contained in this compilation unit. |
2436 */ | 2840 */ |
2437 NodeList<Directive> _directives; | 2841 NodeList<Directive> _directives; |
| 2842 |
2438 /** | 2843 /** |
2439 * The declarations contained in this compilation unit. | 2844 * The declarations contained in this compilation unit. |
2440 */ | 2845 */ |
2441 NodeList<CompilationUnitMember> _declarations; | 2846 NodeList<CompilationUnitMember> _declarations; |
| 2847 |
2442 /** | 2848 /** |
2443 * The last token in the token stream that was parsed to form this compilation
unit. This token | 2849 * The last token in the token stream that was parsed to form this compilation
unit. This token |
2444 * should always have a type of {@link TokenType.EOF}. | 2850 * should always have a type of {@link TokenType.EOF}. |
2445 */ | 2851 */ |
2446 Token _endToken; | 2852 Token _endToken; |
| 2853 |
2447 /** | 2854 /** |
2448 * The element associated with this compilation unit, or {@code null} if the A
ST structure has not | 2855 * The element associated with this compilation unit, or {@code null} if the A
ST structure has not |
2449 * been resolved. | 2856 * been resolved. |
2450 */ | 2857 */ |
2451 CompilationUnitElement _element; | 2858 CompilationUnitElement _element; |
| 2859 |
2452 /** | 2860 /** |
2453 * The {@link LineInfo} for this {@link CompilationUnit}. | 2861 * The {@link LineInfo} for this {@link CompilationUnit}. |
2454 */ | 2862 */ |
2455 LineInfo _lineInfo; | 2863 LineInfo _lineInfo; |
| 2864 |
2456 /** | 2865 /** |
2457 * The parsing errors encountered when the receiver was parsed. | 2866 * The parsing errors encountered when the receiver was parsed. |
2458 */ | 2867 */ |
2459 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; | 2868 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; |
| 2869 |
2460 /** | 2870 /** |
2461 * The resolution errors encountered when the receiver was resolved. | 2871 * The resolution errors encountered when the receiver was resolved. |
2462 */ | 2872 */ |
2463 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 2873 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2874 |
2464 /** | 2875 /** |
2465 * Initialize a newly created compilation unit to have the given directives an
d declarations. | 2876 * Initialize a newly created compilation unit to have the given directives an
d declarations. |
2466 * @param beginToken the first token in the token stream | 2877 * @param beginToken the first token in the token stream |
2467 * @param scriptTag the script tag at the beginning of the compilation unit | 2878 * @param scriptTag the script tag at the beginning of the compilation unit |
2468 * @param directives the directives contained in this compilation unit | 2879 * @param directives the directives contained in this compilation unit |
2469 * @param declarations the declarations contained in this compilation unit | 2880 * @param declarations the declarations contained in this compilation unit |
2470 * @param endToken the last token in the token stream | 2881 * @param endToken the last token in the token stream |
2471 */ | 2882 */ |
2472 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di
rectives, List<CompilationUnitMember> declarations, Token endToken) { | 2883 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di
rectives, List<CompilationUnitMember> declarations, Token endToken) { |
2473 this._directives = new NodeList<Directive>(this); | 2884 this._directives = new NodeList<Directive>(this); |
2474 this._declarations = new NodeList<CompilationUnitMember>(this); | 2885 this._declarations = new NodeList<CompilationUnitMember>(this); |
2475 this._beginToken = beginToken; | 2886 this._beginToken = beginToken; |
2476 this._scriptTag = becomeParentOf(scriptTag); | 2887 this._scriptTag = becomeParentOf(scriptTag); |
2477 this._directives.addAll(directives); | 2888 this._directives.addAll(directives); |
2478 this._declarations.addAll(declarations); | 2889 this._declarations.addAll(declarations); |
2479 this._endToken = endToken; | 2890 this._endToken = endToken; |
2480 } | 2891 } |
| 2892 |
2481 /** | 2893 /** |
2482 * Initialize a newly created compilation unit to have the given directives an
d declarations. | 2894 * Initialize a newly created compilation unit to have the given directives an
d declarations. |
2483 * @param beginToken the first token in the token stream | 2895 * @param beginToken the first token in the token stream |
2484 * @param scriptTag the script tag at the beginning of the compilation unit | 2896 * @param scriptTag the script tag at the beginning of the compilation unit |
2485 * @param directives the directives contained in this compilation unit | 2897 * @param directives the directives contained in this compilation unit |
2486 * @param declarations the declarations contained in this compilation unit | 2898 * @param declarations the declarations contained in this compilation unit |
2487 * @param endToken the last token in the token stream | 2899 * @param endToken the last token in the token stream |
2488 */ | 2900 */ |
2489 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct
ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg
inToken, scriptTag, directives, declarations, endToken); | 2901 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct
ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg
inToken, scriptTag, directives, declarations, endToken); |
2490 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); | 2902 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); |
2491 Token get beginToken => _beginToken; | 2903 Token get beginToken => _beginToken; |
| 2904 |
2492 /** | 2905 /** |
2493 * Return the declarations contained in this compilation unit. | 2906 * Return the declarations contained in this compilation unit. |
2494 * @return the declarations contained in this compilation unit | 2907 * @return the declarations contained in this compilation unit |
2495 */ | 2908 */ |
2496 NodeList<CompilationUnitMember> get declarations => _declarations; | 2909 NodeList<CompilationUnitMember> get declarations => _declarations; |
| 2910 |
2497 /** | 2911 /** |
2498 * Return the directives contained in this compilation unit. | 2912 * Return the directives contained in this compilation unit. |
2499 * @return the directives contained in this compilation unit | 2913 * @return the directives contained in this compilation unit |
2500 */ | 2914 */ |
2501 NodeList<Directive> get directives => _directives; | 2915 NodeList<Directive> get directives => _directives; |
| 2916 |
2502 /** | 2917 /** |
2503 * Return the element associated with this compilation unit, or {@code null} i
f the AST structure | 2918 * Return the element associated with this compilation unit, or {@code null} i
f the AST structure |
2504 * has not been resolved. | 2919 * has not been resolved. |
2505 * @return the element associated with this compilation unit | 2920 * @return the element associated with this compilation unit |
2506 */ | 2921 */ |
2507 CompilationUnitElement get element => _element; | 2922 CompilationUnitElement get element => _element; |
2508 Token get endToken => _endToken; | 2923 Token get endToken => _endToken; |
| 2924 |
2509 /** | 2925 /** |
2510 * Return an array containing all of the errors associated with the receiver.
If the receiver has | 2926 * Return an array containing all of the errors associated with the receiver.
If the receiver has |
2511 * not been resolved, then return {@code null}. | 2927 * not been resolved, then return {@code null}. |
2512 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not | 2928 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not |
2513 * been resolved | 2929 * been resolved |
2514 */ | 2930 */ |
2515 List<AnalysisError> get errors { | 2931 List<AnalysisError> get errors { |
2516 List<AnalysisError> parserErrors = parsingErrors; | 2932 List<AnalysisError> parserErrors = parsingErrors; |
2517 List<AnalysisError> resolverErrors = resolutionErrors; | 2933 List<AnalysisError> resolverErrors = resolutionErrors; |
2518 if (resolverErrors.length == 0) { | 2934 if (resolverErrors.length == 0) { |
2519 return parserErrors; | 2935 return parserErrors; |
2520 } else if (parserErrors.length == 0) { | 2936 } else if (parserErrors.length == 0) { |
2521 return resolverErrors; | 2937 return resolverErrors; |
2522 } else { | 2938 } else { |
2523 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); | 2939 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt
h + resolverErrors.length); |
2524 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); | 2940 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); |
2525 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); | 2941 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re
solverErrors.length); |
2526 return allErrors; | 2942 return allErrors; |
2527 } | 2943 } |
2528 } | 2944 } |
2529 int get length { | 2945 int get length { |
2530 Token endToken2 = endToken; | 2946 Token endToken2 = endToken; |
2531 if (endToken2 == null) { | 2947 if (endToken2 == null) { |
2532 return 0; | 2948 return 0; |
2533 } | 2949 } |
2534 return endToken2.offset + endToken2.length; | 2950 return endToken2.offset + endToken2.length; |
2535 } | 2951 } |
| 2952 |
2536 /** | 2953 /** |
2537 * Get the {@link LineInfo} object for this compilation unit. | 2954 * Get the {@link LineInfo} object for this compilation unit. |
2538 * @return the associated {@link LineInfo} | 2955 * @return the associated {@link LineInfo} |
2539 */ | 2956 */ |
2540 LineInfo get lineInfo => _lineInfo; | 2957 LineInfo get lineInfo => _lineInfo; |
2541 int get offset => 0; | 2958 int get offset => 0; |
| 2959 |
2542 /** | 2960 /** |
2543 * Return an array containing all of the parsing errors associated with the re
ceiver. | 2961 * Return an array containing all of the parsing errors associated with the re
ceiver. |
2544 * @return an array of errors (not {@code null}, contains no {@code null}s). | 2962 * @return an array of errors (not {@code null}, contains no {@code null}s). |
2545 */ | 2963 */ |
2546 List<AnalysisError> get parsingErrors => _parsingErrors; | 2964 List<AnalysisError> get parsingErrors => _parsingErrors; |
| 2965 |
2547 /** | 2966 /** |
2548 * Return an array containing all of the resolution errors associated with the
receiver. If the | 2967 * Return an array containing all of the resolution errors associated with the
receiver. If the |
2549 * receiver has not been resolved, then return {@code null}. | 2968 * receiver has not been resolved, then return {@code null}. |
2550 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not | 2969 * @return an array of errors (contains no {@code null}s) or {@code null} if t
he receiver has not |
2551 * been resolved | 2970 * been resolved |
2552 */ | 2971 */ |
2553 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 2972 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 2973 |
2554 /** | 2974 /** |
2555 * Return the script tag at the beginning of the compilation unit, or {@code n
ull} if there is no | 2975 * Return the script tag at the beginning of the compilation unit, or {@code n
ull} if there is no |
2556 * script tag in this compilation unit. | 2976 * script tag in this compilation unit. |
2557 * @return the script tag at the beginning of the compilation unit | 2977 * @return the script tag at the beginning of the compilation unit |
2558 */ | 2978 */ |
2559 ScriptTag get scriptTag => _scriptTag; | 2979 ScriptTag get scriptTag => _scriptTag; |
| 2980 |
2560 /** | 2981 /** |
2561 * Set the element associated with this compilation unit to the given element. | 2982 * Set the element associated with this compilation unit to the given element. |
2562 * @param element the element associated with this compilation unit | 2983 * @param element the element associated with this compilation unit |
2563 */ | 2984 */ |
2564 void set element(CompilationUnitElement element2) { | 2985 void set element(CompilationUnitElement element2) { |
2565 this._element = element2; | 2986 this._element = element2; |
2566 } | 2987 } |
| 2988 |
2567 /** | 2989 /** |
2568 * Set the {@link LineInfo} object for this compilation unit. | 2990 * Set the {@link LineInfo} object for this compilation unit. |
2569 * @param errors LineInfo to associate with this compilation unit | 2991 * @param errors LineInfo to associate with this compilation unit |
2570 */ | 2992 */ |
2571 void set lineInfo(LineInfo lineInfo2) { | 2993 void set lineInfo(LineInfo lineInfo2) { |
2572 this._lineInfo = lineInfo2; | 2994 this._lineInfo = lineInfo2; |
2573 } | 2995 } |
| 2996 |
2574 /** | 2997 /** |
2575 * Called to cache the parsing errors when the unit is parsed. | 2998 * Called to cache the parsing errors when the unit is parsed. |
2576 * @param errors an array of parsing errors, if {@code null} is passed, the er
ror array is set to | 2999 * @param errors an array of parsing errors, if {@code null} is passed, the er
ror array is set to |
2577 * an empty array, {@link AnalysisError#NO_ERRORS} | 3000 * an empty array, {@link AnalysisError#NO_ERRORS} |
2578 */ | 3001 */ |
2579 void set parsingErrors(List<AnalysisError> errors) { | 3002 void set parsingErrors(List<AnalysisError> errors) { |
2580 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; | 3003 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; |
2581 } | 3004 } |
| 3005 |
2582 /** | 3006 /** |
2583 * Called to cache the resolution errors when the unit is resolved. | 3007 * Called to cache the resolution errors when the unit is resolved. |
2584 * @param errors an array of resolution errors, if {@code null} is passed, the
error array is set | 3008 * @param errors an array of resolution errors, if {@code null} is passed, the
error array is set |
2585 * to an empty array, {@link AnalysisError#NO_ERRORS} | 3009 * to an empty array, {@link AnalysisError#NO_ERRORS} |
2586 */ | 3010 */ |
2587 void set resolutionErrors(List<AnalysisError> errors) { | 3011 void set resolutionErrors(List<AnalysisError> errors) { |
2588 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors; | 3012 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors; |
2589 } | 3013 } |
| 3014 |
2590 /** | 3015 /** |
2591 * Set the script tag at the beginning of the compilation unit to the given sc
ript tag. | 3016 * Set the script tag at the beginning of the compilation unit to the given sc
ript tag. |
2592 * @param scriptTag the script tag at the beginning of the compilation unit | 3017 * @param scriptTag the script tag at the beginning of the compilation unit |
2593 */ | 3018 */ |
2594 void set scriptTag(ScriptTag scriptTag2) { | 3019 void set scriptTag(ScriptTag scriptTag2) { |
2595 this._scriptTag = becomeParentOf(scriptTag2); | 3020 this._scriptTag = becomeParentOf(scriptTag2); |
2596 } | 3021 } |
2597 void visitChildren(ASTVisitor<Object> visitor) { | 3022 void visitChildren(ASTVisitor<Object> visitor) { |
2598 safelyVisitChild(_scriptTag, visitor); | 3023 safelyVisitChild(_scriptTag, visitor); |
2599 if (directivesAreBeforeDeclarations()) { | 3024 if (directivesAreBeforeDeclarations()) { |
2600 _directives.accept(visitor); | 3025 _directives.accept(visitor); |
2601 _declarations.accept(visitor); | 3026 _declarations.accept(visitor); |
2602 } else { | 3027 } else { |
2603 for (ASTNode child in sortedDirectivesAndDeclarations) { | 3028 for (ASTNode child in sortedDirectivesAndDeclarations) { |
2604 child.accept(visitor); | 3029 child.accept(visitor); |
2605 } | 3030 } |
2606 } | 3031 } |
2607 } | 3032 } |
| 3033 |
2608 /** | 3034 /** |
2609 * Return {@code true} if all of the directives are lexically before any decla
rations. | 3035 * Return {@code true} if all of the directives are lexically before any decla
rations. |
2610 * @return {@code true} if all of the directives are lexically before any decl
arations | 3036 * @return {@code true} if all of the directives are lexically before any decl
arations |
2611 */ | 3037 */ |
2612 bool directivesAreBeforeDeclarations() { | 3038 bool directivesAreBeforeDeclarations() { |
2613 if (_directives.isEmpty || _declarations.isEmpty) { | 3039 if (_directives.isEmpty || _declarations.isEmpty) { |
2614 return true; | 3040 return true; |
2615 } | 3041 } |
2616 Directive lastDirective = _directives[_directives.length - 1]; | 3042 Directive lastDirective = _directives[_directives.length - 1]; |
2617 CompilationUnitMember firstDeclaration = _declarations[0]; | 3043 CompilationUnitMember firstDeclaration = _declarations[0]; |
2618 return lastDirective.offset < firstDeclaration.offset; | 3044 return lastDirective.offset < firstDeclaration.offset; |
2619 } | 3045 } |
| 3046 |
2620 /** | 3047 /** |
2621 * Return an array containing all of the directives and declarations in this c
ompilation unit, | 3048 * Return an array containing all of the directives and declarations in this c
ompilation unit, |
2622 * sorted in lexical order. | 3049 * sorted in lexical order. |
2623 * @return the directives and declarations in this compilation unit in the ord
er in which they | 3050 * @return the directives and declarations in this compilation unit in the ord
er in which they |
2624 * appeared in the original source | 3051 * appeared in the original source |
2625 */ | 3052 */ |
2626 List<ASTNode> get sortedDirectivesAndDeclarations { | 3053 List<ASTNode> get sortedDirectivesAndDeclarations { |
2627 List<ASTNode> childList = new List<ASTNode>(); | 3054 List<ASTNode> childList = new List<ASTNode>(); |
2628 childList.addAll(_directives); | 3055 childList.addAll(_directives); |
2629 childList.addAll(_declarations); | 3056 childList.addAll(_declarations); |
2630 List<ASTNode> children = new List.from(childList); | 3057 List<ASTNode> children = new List.from(childList); |
2631 children.sort(); | 3058 children.sort(); |
2632 return children; | 3059 return children; |
2633 } | 3060 } |
2634 } | 3061 } |
| 3062 |
2635 /** | 3063 /** |
2636 * Instances of the class {@code CompilationUnitMember} defines the behavior com
mon to nodes that | 3064 * Instances of the class {@code CompilationUnitMember} defines the behavior com
mon to nodes that |
2637 * declare a name within the scope of a compilation unit. | 3065 * declare a name within the scope of a compilation unit. |
2638 * <pre> | 3066 * <pre> |
2639 * compilationUnitMember ::={@link ClassDeclaration classDeclaration}| {@link Ty
peAlias typeAlias}| {@link FunctionDeclaration functionDeclaration}| {@link Meth
odDeclaration getOrSetDeclaration}| {@link VariableDeclaration constantsDeclarat
ion}| {@link VariableDeclaration variablesDeclaration}</pre> | 3067 * compilationUnitMember ::={@link ClassDeclaration classDeclaration}| {@link Ty
peAlias typeAlias}| {@link FunctionDeclaration functionDeclaration}| {@link Meth
odDeclaration getOrSetDeclaration}| {@link VariableDeclaration constantsDeclarat
ion}| {@link VariableDeclaration variablesDeclaration}</pre> |
2640 * @coverage dart.engine.ast | 3068 * @coverage dart.engine.ast |
2641 */ | 3069 */ |
2642 abstract class CompilationUnitMember extends Declaration { | 3070 abstract class CompilationUnitMember extends Declaration { |
| 3071 |
2643 /** | 3072 /** |
2644 * Initialize a newly created generic compilation unit member. | 3073 * Initialize a newly created generic compilation unit member. |
2645 * @param comment the documentation comment associated with this member | 3074 * @param comment the documentation comment associated with this member |
2646 * @param metadata the annotations associated with this member | 3075 * @param metadata the annotations associated with this member |
2647 */ | 3076 */ |
2648 CompilationUnitMember.full(Comment comment, List<Annotation> metadata) : super
.full(comment, metadata) { | 3077 CompilationUnitMember.full(Comment comment, List<Annotation> metadata) : super
.full(comment, metadata) { |
2649 } | 3078 } |
| 3079 |
2650 /** | 3080 /** |
2651 * Initialize a newly created generic compilation unit member. | 3081 * Initialize a newly created generic compilation unit member. |
2652 * @param comment the documentation comment associated with this member | 3082 * @param comment the documentation comment associated with this member |
2653 * @param metadata the annotations associated with this member | 3083 * @param metadata the annotations associated with this member |
2654 */ | 3084 */ |
2655 CompilationUnitMember({Comment comment, List<Annotation> metadata}) : this.ful
l(comment, metadata); | 3085 CompilationUnitMember({Comment comment, List<Annotation> metadata}) : this.ful
l(comment, metadata); |
2656 } | 3086 } |
| 3087 |
2657 /** | 3088 /** |
2658 * Instances of the class {@code ConditionalExpression} represent a conditional
expression. | 3089 * Instances of the class {@code ConditionalExpression} represent a conditional
expression. |
2659 * <pre> | 3090 * <pre> |
2660 * conditionalExpression ::={@link Expression condition} '?' {@link Expression t
henExpression} ':' {@link Expression elseExpression}</pre> | 3091 * conditionalExpression ::={@link Expression condition} '?' {@link Expression t
henExpression} ':' {@link Expression elseExpression}</pre> |
2661 * @coverage dart.engine.ast | 3092 * @coverage dart.engine.ast |
2662 */ | 3093 */ |
2663 class ConditionalExpression extends Expression { | 3094 class ConditionalExpression extends Expression { |
| 3095 |
2664 /** | 3096 /** |
2665 * The condition used to determine which of the expressions is executed next. | 3097 * The condition used to determine which of the expressions is executed next. |
2666 */ | 3098 */ |
2667 Expression _condition; | 3099 Expression _condition; |
| 3100 |
2668 /** | 3101 /** |
2669 * The token used to separate the condition from the then expression. | 3102 * The token used to separate the condition from the then expression. |
2670 */ | 3103 */ |
2671 Token _question; | 3104 Token _question; |
| 3105 |
2672 /** | 3106 /** |
2673 * The expression that is executed if the condition evaluates to {@code true}. | 3107 * The expression that is executed if the condition evaluates to {@code true}. |
2674 */ | 3108 */ |
2675 Expression _thenExpression; | 3109 Expression _thenExpression; |
| 3110 |
2676 /** | 3111 /** |
2677 * The token used to separate the then expression from the else expression. | 3112 * The token used to separate the then expression from the else expression. |
2678 */ | 3113 */ |
2679 Token _colon; | 3114 Token _colon; |
| 3115 |
2680 /** | 3116 /** |
2681 * The expression that is executed if the condition evaluates to {@code false}
. | 3117 * The expression that is executed if the condition evaluates to {@code false}
. |
2682 */ | 3118 */ |
2683 Expression _elseExpression; | 3119 Expression _elseExpression; |
| 3120 |
2684 /** | 3121 /** |
2685 * Initialize a newly created conditional expression. | 3122 * Initialize a newly created conditional expression. |
2686 * @param condition the condition used to determine which expression is execut
ed next | 3123 * @param condition the condition used to determine which expression is execut
ed next |
2687 * @param question the token used to separate the condition from the then expr
ession | 3124 * @param question the token used to separate the condition from the then expr
ession |
2688 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} | 3125 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} |
2689 * @param colon the token used to separate the then expression from the else e
xpression | 3126 * @param colon the token used to separate the then expression from the else e
xpression |
2690 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} | 3127 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} |
2691 */ | 3128 */ |
2692 ConditionalExpression.full(Expression condition, Token question, Expression th
enExpression, Token colon, Expression elseExpression) { | 3129 ConditionalExpression.full(Expression condition, Token question, Expression th
enExpression, Token colon, Expression elseExpression) { |
2693 this._condition = becomeParentOf(condition); | 3130 this._condition = becomeParentOf(condition); |
2694 this._question = question; | 3131 this._question = question; |
2695 this._thenExpression = becomeParentOf(thenExpression); | 3132 this._thenExpression = becomeParentOf(thenExpression); |
2696 this._colon = colon; | 3133 this._colon = colon; |
2697 this._elseExpression = becomeParentOf(elseExpression); | 3134 this._elseExpression = becomeParentOf(elseExpression); |
2698 } | 3135 } |
| 3136 |
2699 /** | 3137 /** |
2700 * Initialize a newly created conditional expression. | 3138 * Initialize a newly created conditional expression. |
2701 * @param condition the condition used to determine which expression is execut
ed next | 3139 * @param condition the condition used to determine which expression is execut
ed next |
2702 * @param question the token used to separate the condition from the then expr
ession | 3140 * @param question the token used to separate the condition from the then expr
ession |
2703 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} | 3141 * @param thenExpression the expression that is executed if the condition eval
uates to{@code true} |
2704 * @param colon the token used to separate the then expression from the else e
xpression | 3142 * @param colon the token used to separate the then expression from the else e
xpression |
2705 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} | 3143 * @param elseExpression the expression that is executed if the condition eval
uates to{@code false} |
2706 */ | 3144 */ |
2707 ConditionalExpression({Expression condition, Token question, Expression thenEx
pression, Token colon, Expression elseExpression}) : this.full(condition, questi
on, thenExpression, colon, elseExpression); | 3145 ConditionalExpression({Expression condition, Token question, Expression thenEx
pression, Token colon, Expression elseExpression}) : this.full(condition, questi
on, thenExpression, colon, elseExpression); |
2708 accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this); | 3146 accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this); |
2709 Token get beginToken => _condition.beginToken; | 3147 Token get beginToken => _condition.beginToken; |
| 3148 |
2710 /** | 3149 /** |
2711 * Return the token used to separate the then expression from the else express
ion. | 3150 * Return the token used to separate the then expression from the else express
ion. |
2712 * @return the token used to separate the then expression from the else expres
sion | 3151 * @return the token used to separate the then expression from the else expres
sion |
2713 */ | 3152 */ |
2714 Token get colon => _colon; | 3153 Token get colon => _colon; |
| 3154 |
2715 /** | 3155 /** |
2716 * Return the condition used to determine which of the expressions is executed
next. | 3156 * Return the condition used to determine which of the expressions is executed
next. |
2717 * @return the condition used to determine which expression is executed next | 3157 * @return the condition used to determine which expression is executed next |
2718 */ | 3158 */ |
2719 Expression get condition => _condition; | 3159 Expression get condition => _condition; |
| 3160 |
2720 /** | 3161 /** |
2721 * Return the expression that is executed if the condition evaluates to {@code
false}. | 3162 * Return the expression that is executed if the condition evaluates to {@code
false}. |
2722 * @return the expression that is executed if the condition evaluates to {@cod
e false} | 3163 * @return the expression that is executed if the condition evaluates to {@cod
e false} |
2723 */ | 3164 */ |
2724 Expression get elseExpression => _elseExpression; | 3165 Expression get elseExpression => _elseExpression; |
2725 Token get endToken => _elseExpression.endToken; | 3166 Token get endToken => _elseExpression.endToken; |
| 3167 |
2726 /** | 3168 /** |
2727 * Return the token used to separate the condition from the then expression. | 3169 * Return the token used to separate the condition from the then expression. |
2728 * @return the token used to separate the condition from the then expression | 3170 * @return the token used to separate the condition from the then expression |
2729 */ | 3171 */ |
2730 Token get question => _question; | 3172 Token get question => _question; |
| 3173 |
2731 /** | 3174 /** |
2732 * Return the expression that is executed if the condition evaluates to {@code
true}. | 3175 * Return the expression that is executed if the condition evaluates to {@code
true}. |
2733 * @return the expression that is executed if the condition evaluates to {@cod
e true} | 3176 * @return the expression that is executed if the condition evaluates to {@cod
e true} |
2734 */ | 3177 */ |
2735 Expression get thenExpression => _thenExpression; | 3178 Expression get thenExpression => _thenExpression; |
| 3179 |
2736 /** | 3180 /** |
2737 * Set the token used to separate the then expression from the else expression
to the given token. | 3181 * Set the token used to separate the then expression from the else expression
to the given token. |
2738 * @param colon the token used to separate the then expression from the else e
xpression | 3182 * @param colon the token used to separate the then expression from the else e
xpression |
2739 */ | 3183 */ |
2740 void set colon(Token colon2) { | 3184 void set colon(Token colon2) { |
2741 this._colon = colon2; | 3185 this._colon = colon2; |
2742 } | 3186 } |
| 3187 |
2743 /** | 3188 /** |
2744 * Set the condition used to determine which of the expressions is executed ne
xt to the given | 3189 * Set the condition used to determine which of the expressions is executed ne
xt to the given |
2745 * expression. | 3190 * expression. |
2746 * @param expression the condition used to determine which expression is execu
ted next | 3191 * @param expression the condition used to determine which expression is execu
ted next |
2747 */ | 3192 */ |
2748 void set condition(Expression expression) { | 3193 void set condition(Expression expression) { |
2749 _condition = becomeParentOf(expression); | 3194 _condition = becomeParentOf(expression); |
2750 } | 3195 } |
| 3196 |
2751 /** | 3197 /** |
2752 * Set the expression that is executed if the condition evaluates to {@code fa
lse} to the given | 3198 * Set the expression that is executed if the condition evaluates to {@code fa
lse} to the given |
2753 * expression. | 3199 * expression. |
2754 * @param expression the expression that is executed if the condition evaluate
s to {@code false} | 3200 * @param expression the expression that is executed if the condition evaluate
s to {@code false} |
2755 */ | 3201 */ |
2756 void set elseExpression(Expression expression) { | 3202 void set elseExpression(Expression expression) { |
2757 _elseExpression = becomeParentOf(expression); | 3203 _elseExpression = becomeParentOf(expression); |
2758 } | 3204 } |
| 3205 |
2759 /** | 3206 /** |
2760 * Set the token used to separate the condition from the then expression to th
e given token. | 3207 * Set the token used to separate the condition from the then expression to th
e given token. |
2761 * @param question the token used to separate the condition from the then expr
ession | 3208 * @param question the token used to separate the condition from the then expr
ession |
2762 */ | 3209 */ |
2763 void set question(Token question2) { | 3210 void set question(Token question2) { |
2764 this._question = question2; | 3211 this._question = question2; |
2765 } | 3212 } |
| 3213 |
2766 /** | 3214 /** |
2767 * Set the expression that is executed if the condition evaluates to {@code tr
ue} to the given | 3215 * Set the expression that is executed if the condition evaluates to {@code tr
ue} to the given |
2768 * expression. | 3216 * expression. |
2769 * @param expression the expression that is executed if the condition evaluate
s to {@code true} | 3217 * @param expression the expression that is executed if the condition evaluate
s to {@code true} |
2770 */ | 3218 */ |
2771 void set thenExpression(Expression expression) { | 3219 void set thenExpression(Expression expression) { |
2772 _thenExpression = becomeParentOf(expression); | 3220 _thenExpression = becomeParentOf(expression); |
2773 } | 3221 } |
2774 void visitChildren(ASTVisitor<Object> visitor) { | 3222 void visitChildren(ASTVisitor<Object> visitor) { |
2775 safelyVisitChild(_condition, visitor); | 3223 safelyVisitChild(_condition, visitor); |
2776 safelyVisitChild(_thenExpression, visitor); | 3224 safelyVisitChild(_thenExpression, visitor); |
2777 safelyVisitChild(_elseExpression, visitor); | 3225 safelyVisitChild(_elseExpression, visitor); |
2778 } | 3226 } |
2779 } | 3227 } |
| 3228 |
2780 /** | 3229 /** |
2781 * Instances of the class {@code ConstructorDeclaration} represent a constructor
declaration. | 3230 * Instances of the class {@code ConstructorDeclaration} represent a constructor
declaration. |
2782 * <pre> | 3231 * <pre> |
2783 * constructorDeclaration ::= | 3232 * constructorDeclaration ::= |
2784 * constructorSignature {@link FunctionBody body}? | 3233 * constructorSignature {@link FunctionBody body}? |
2785 * | constructorName formalParameterList ':' 'this' ('.' {@link SimpleIdentifier
name})? arguments | 3234 * | constructorName formalParameterList ':' 'this' ('.' {@link SimpleIdentifier
name})? arguments |
2786 * constructorSignature ::= | 3235 * constructorSignature ::= |
2787 * 'external'? constructorName formalParameterList initializerList? | 3236 * 'external'? constructorName formalParameterList initializerList? |
2788 * | 'external'? 'factory' factoryName formalParameterList initializerList? | 3237 * | 'external'? 'factory' factoryName formalParameterList initializerList? |
2789 * | 'external'? 'const' constructorName formalParameterList initializerList? | 3238 * | 'external'? 'const' constructorName formalParameterList initializerList? |
2790 * constructorName ::={@link SimpleIdentifier returnType} ('.' {@link SimpleIden
tifier name})? | 3239 * constructorName ::={@link SimpleIdentifier returnType} ('.' {@link SimpleIden
tifier name})? |
2791 * factoryName ::={@link Identifier returnType} ('.' {@link SimpleIdentifier nam
e})? | 3240 * factoryName ::={@link Identifier returnType} ('.' {@link SimpleIdentifier nam
e})? |
2792 * initializerList ::= | 3241 * initializerList ::= |
2793 * ':' {@link ConstructorInitializer initializer} (',' {@link ConstructorInitial
izer initializer}) | 3242 * ':' {@link ConstructorInitializer initializer} (',' {@link ConstructorInitial
izer initializer}) |
2794 * </pre> | 3243 * </pre> |
2795 * @coverage dart.engine.ast | 3244 * @coverage dart.engine.ast |
2796 */ | 3245 */ |
2797 class ConstructorDeclaration extends ClassMember { | 3246 class ConstructorDeclaration extends ClassMember { |
| 3247 |
2798 /** | 3248 /** |
2799 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. | 3249 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. |
2800 */ | 3250 */ |
2801 Token _externalKeyword; | 3251 Token _externalKeyword; |
| 3252 |
2802 /** | 3253 /** |
2803 * The token for the 'const' keyword, or {@code null} if the constructor is no
t a const | 3254 * The token for the 'const' keyword, or {@code null} if the constructor is no
t a const |
2804 * constructor. | 3255 * constructor. |
2805 */ | 3256 */ |
2806 Token _constKeyword; | 3257 Token _constKeyword; |
| 3258 |
2807 /** | 3259 /** |
2808 * The token for the 'factory' keyword, or {@code null} if the constructor is
not a factory | 3260 * The token for the 'factory' keyword, or {@code null} if the constructor is
not a factory |
2809 * constructor. | 3261 * constructor. |
2810 */ | 3262 */ |
2811 Token _factoryKeyword; | 3263 Token _factoryKeyword; |
| 3264 |
2812 /** | 3265 /** |
2813 * The type of object being created. This can be different than the type in wh
ich the constructor | 3266 * The type of object being created. This can be different than the type in wh
ich the constructor |
2814 * is being declared if the constructor is the implementation of a factory con
structor. | 3267 * is being declared if the constructor is the implementation of a factory con
structor. |
2815 */ | 3268 */ |
2816 Identifier _returnType; | 3269 Identifier _returnType; |
| 3270 |
2817 /** | 3271 /** |
2818 * The token for the period before the constructor name, or {@code null} if th
e constructor being | 3272 * The token for the period before the constructor name, or {@code null} if th
e constructor being |
2819 * declared is unnamed. | 3273 * declared is unnamed. |
2820 */ | 3274 */ |
2821 Token _period; | 3275 Token _period; |
| 3276 |
2822 /** | 3277 /** |
2823 * The name of the constructor, or {@code null} if the constructor being decla
red is unnamed. | 3278 * The name of the constructor, or {@code null} if the constructor being decla
red is unnamed. |
2824 */ | 3279 */ |
2825 SimpleIdentifier _name; | 3280 SimpleIdentifier _name; |
| 3281 |
2826 /** | 3282 /** |
2827 * The element associated with this constructor, or {@code null} if the AST st
ructure has not been | 3283 * The element associated with this constructor, or {@code null} if the AST st
ructure has not been |
2828 * resolved or if this constructor could not be resolved. | 3284 * resolved or if this constructor could not be resolved. |
2829 */ | 3285 */ |
2830 ConstructorElement _element; | 3286 ConstructorElement _element; |
| 3287 |
2831 /** | 3288 /** |
2832 * The parameters associated with the constructor. | 3289 * The parameters associated with the constructor. |
2833 */ | 3290 */ |
2834 FormalParameterList _parameters; | 3291 FormalParameterList _parameters; |
| 3292 |
2835 /** | 3293 /** |
2836 * The token for the separator (colon or equals) before the initializers, or {
@code null} if there | 3294 * The token for the separator (colon or equals) before the initializers, or {
@code null} if there |
2837 * are no initializers. | 3295 * are no initializers. |
2838 */ | 3296 */ |
2839 Token _separator; | 3297 Token _separator; |
| 3298 |
2840 /** | 3299 /** |
2841 * The initializers associated with the constructor. | 3300 * The initializers associated with the constructor. |
2842 */ | 3301 */ |
2843 NodeList<ConstructorInitializer> _initializers; | 3302 NodeList<ConstructorInitializer> _initializers; |
| 3303 |
2844 /** | 3304 /** |
2845 * The name of the constructor to which this constructor will be redirected, o
r {@code null} if | 3305 * The name of the constructor to which this constructor will be redirected, o
r {@code null} if |
2846 * this is not a redirecting factory constructor. | 3306 * this is not a redirecting factory constructor. |
2847 */ | 3307 */ |
2848 ConstructorName _redirectedConstructor; | 3308 ConstructorName _redirectedConstructor; |
| 3309 |
2849 /** | 3310 /** |
2850 * The body of the constructor, or {@code null} if the constructor does not ha
ve a body. | 3311 * The body of the constructor, or {@code null} if the constructor does not ha
ve a body. |
2851 */ | 3312 */ |
2852 FunctionBody _body; | 3313 FunctionBody _body; |
| 3314 |
2853 /** | 3315 /** |
2854 * Initialize a newly created constructor declaration. | 3316 * Initialize a newly created constructor declaration. |
2855 * @param externalKeyword the token for the 'external' keyword | 3317 * @param externalKeyword the token for the 'external' keyword |
2856 * @param comment the documentation comment associated with this constructor | 3318 * @param comment the documentation comment associated with this constructor |
2857 * @param metadata the annotations associated with this constructor | 3319 * @param metadata the annotations associated with this constructor |
2858 * @param constKeyword the token for the 'const' keyword | 3320 * @param constKeyword the token for the 'const' keyword |
2859 * @param factoryKeyword the token for the 'factory' keyword | 3321 * @param factoryKeyword the token for the 'factory' keyword |
2860 * @param returnType the return type of the constructor | 3322 * @param returnType the return type of the constructor |
2861 * @param period the token for the period before the constructor name | 3323 * @param period the token for the period before the constructor name |
2862 * @param name the name of the constructor | 3324 * @param name the name of the constructor |
(...skipping 11 matching lines...) Expand all Loading... |
2874 this._factoryKeyword = factoryKeyword; | 3336 this._factoryKeyword = factoryKeyword; |
2875 this._returnType = becomeParentOf(returnType); | 3337 this._returnType = becomeParentOf(returnType); |
2876 this._period = period; | 3338 this._period = period; |
2877 this._name = becomeParentOf(name); | 3339 this._name = becomeParentOf(name); |
2878 this._parameters = becomeParentOf(parameters); | 3340 this._parameters = becomeParentOf(parameters); |
2879 this._separator = separator; | 3341 this._separator = separator; |
2880 this._initializers.addAll(initializers); | 3342 this._initializers.addAll(initializers); |
2881 this._redirectedConstructor = becomeParentOf(redirectedConstructor); | 3343 this._redirectedConstructor = becomeParentOf(redirectedConstructor); |
2882 this._body = becomeParentOf(body); | 3344 this._body = becomeParentOf(body); |
2883 } | 3345 } |
| 3346 |
2884 /** | 3347 /** |
2885 * Initialize a newly created constructor declaration. | 3348 * Initialize a newly created constructor declaration. |
2886 * @param externalKeyword the token for the 'external' keyword | 3349 * @param externalKeyword the token for the 'external' keyword |
2887 * @param comment the documentation comment associated with this constructor | 3350 * @param comment the documentation comment associated with this constructor |
2888 * @param metadata the annotations associated with this constructor | 3351 * @param metadata the annotations associated with this constructor |
2889 * @param constKeyword the token for the 'const' keyword | 3352 * @param constKeyword the token for the 'const' keyword |
2890 * @param factoryKeyword the token for the 'factory' keyword | 3353 * @param factoryKeyword the token for the 'factory' keyword |
2891 * @param returnType the return type of the constructor | 3354 * @param returnType the return type of the constructor |
2892 * @param period the token for the period before the constructor name | 3355 * @param period the token for the period before the constructor name |
2893 * @param name the name of the constructor | 3356 * @param name the name of the constructor |
2894 * @param parameters the parameters associated with the constructor | 3357 * @param parameters the parameters associated with the constructor |
2895 * @param separator the token for the colon or equals before the initializers | 3358 * @param separator the token for the colon or equals before the initializers |
2896 * @param initializers the initializers associated with the constructor | 3359 * @param initializers the initializers associated with the constructor |
2897 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be | 3360 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be |
2898 * redirected | 3361 * redirected |
2899 * @param body the body of the constructor | 3362 * @param body the body of the constructor |
2900 */ | 3363 */ |
2901 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); | 3364 ConstructorDeclaration({Comment comment, List<Annotation> metadata, Token exte
rnalKeyword, Token constKeyword, Token factoryKeyword, Identifier returnType, To
ken period, SimpleIdentifier name, FormalParameterList parameters, Token separat
or, List<ConstructorInitializer> initializers, ConstructorName redirectedConstru
ctor, FunctionBody body}) : this.full(comment, metadata, externalKeyword, constK
eyword, factoryKeyword, returnType, period, name, parameters, separator, initial
izers, redirectedConstructor, body); |
2902 accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this); | 3365 accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this); |
| 3366 |
2903 /** | 3367 /** |
2904 * Return the body of the constructor, or {@code null} if the constructor does
not have a body. | 3368 * Return the body of the constructor, or {@code null} if the constructor does
not have a body. |
2905 * @return the body of the constructor | 3369 * @return the body of the constructor |
2906 */ | 3370 */ |
2907 FunctionBody get body => _body; | 3371 FunctionBody get body => _body; |
| 3372 |
2908 /** | 3373 /** |
2909 * Return the token for the 'const' keyword. | 3374 * Return the token for the 'const' keyword. |
2910 * @return the token for the 'const' keyword | 3375 * @return the token for the 'const' keyword |
2911 */ | 3376 */ |
2912 Token get constKeyword => _constKeyword; | 3377 Token get constKeyword => _constKeyword; |
2913 ConstructorElement get element => _element; | 3378 ConstructorElement get element => _element; |
2914 Token get endToken { | 3379 Token get endToken { |
2915 if (_body != null) { | 3380 if (_body != null) { |
2916 return _body.endToken; | 3381 return _body.endToken; |
2917 } else if (!_initializers.isEmpty) { | 3382 } else if (!_initializers.isEmpty) { |
2918 return _initializers.endToken; | 3383 return _initializers.endToken; |
2919 } | 3384 } |
2920 return _parameters.endToken; | 3385 return _parameters.endToken; |
2921 } | 3386 } |
| 3387 |
2922 /** | 3388 /** |
2923 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not | 3389 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not |
2924 * external. | 3390 * external. |
2925 * @return the token for the 'external' keyword | 3391 * @return the token for the 'external' keyword |
2926 */ | 3392 */ |
2927 Token get externalKeyword => _externalKeyword; | 3393 Token get externalKeyword => _externalKeyword; |
| 3394 |
2928 /** | 3395 /** |
2929 * Return the token for the 'factory' keyword. | 3396 * Return the token for the 'factory' keyword. |
2930 * @return the token for the 'factory' keyword | 3397 * @return the token for the 'factory' keyword |
2931 */ | 3398 */ |
2932 Token get factoryKeyword => _factoryKeyword; | 3399 Token get factoryKeyword => _factoryKeyword; |
| 3400 |
2933 /** | 3401 /** |
2934 * Return the initializers associated with the constructor. | 3402 * Return the initializers associated with the constructor. |
2935 * @return the initializers associated with the constructor | 3403 * @return the initializers associated with the constructor |
2936 */ | 3404 */ |
2937 NodeList<ConstructorInitializer> get initializers => _initializers; | 3405 NodeList<ConstructorInitializer> get initializers => _initializers; |
| 3406 |
2938 /** | 3407 /** |
2939 * Return the name of the constructor, or {@code null} if the constructor bein
g declared is | 3408 * Return the name of the constructor, or {@code null} if the constructor bein
g declared is |
2940 * unnamed. | 3409 * unnamed. |
2941 * @return the name of the constructor | 3410 * @return the name of the constructor |
2942 */ | 3411 */ |
2943 SimpleIdentifier get name => _name; | 3412 SimpleIdentifier get name => _name; |
| 3413 |
2944 /** | 3414 /** |
2945 * Return the parameters associated with the constructor. | 3415 * Return the parameters associated with the constructor. |
2946 * @return the parameters associated with the constructor | 3416 * @return the parameters associated with the constructor |
2947 */ | 3417 */ |
2948 FormalParameterList get parameters => _parameters; | 3418 FormalParameterList get parameters => _parameters; |
| 3419 |
2949 /** | 3420 /** |
2950 * Return the token for the period before the constructor name, or {@code null
} if the constructor | 3421 * Return the token for the period before the constructor name, or {@code null
} if the constructor |
2951 * being declared is unnamed. | 3422 * being declared is unnamed. |
2952 * @return the token for the period before the constructor name | 3423 * @return the token for the period before the constructor name |
2953 */ | 3424 */ |
2954 Token get period => _period; | 3425 Token get period => _period; |
| 3426 |
2955 /** | 3427 /** |
2956 * Return the name of the constructor to which this constructor will be redire
cted, or{@code null} if this is not a redirecting factory constructor. | 3428 * Return the name of the constructor to which this constructor will be redire
cted, or{@code null} if this is not a redirecting factory constructor. |
2957 * @return the name of the constructor to which this constructor will be redir
ected | 3429 * @return the name of the constructor to which this constructor will be redir
ected |
2958 */ | 3430 */ |
2959 ConstructorName get redirectedConstructor => _redirectedConstructor; | 3431 ConstructorName get redirectedConstructor => _redirectedConstructor; |
| 3432 |
2960 /** | 3433 /** |
2961 * Return the type of object being created. This can be different than the typ
e in which the | 3434 * Return the type of object being created. This can be different than the typ
e in which the |
2962 * constructor is being declared if the constructor is the implementation of a
factory | 3435 * constructor is being declared if the constructor is the implementation of a
factory |
2963 * constructor. | 3436 * constructor. |
2964 * @return the type of object being created | 3437 * @return the type of object being created |
2965 */ | 3438 */ |
2966 Identifier get returnType => _returnType; | 3439 Identifier get returnType => _returnType; |
| 3440 |
2967 /** | 3441 /** |
2968 * Return the token for the separator (colon or equals) before the initializer
s, or {@code null}if there are no initializers. | 3442 * Return the token for the separator (colon or equals) before the initializer
s, or {@code null}if there are no initializers. |
2969 * @return the token for the separator (colon or equals) before the initialize
rs | 3443 * @return the token for the separator (colon or equals) before the initialize
rs |
2970 */ | 3444 */ |
2971 Token get separator => _separator; | 3445 Token get separator => _separator; |
| 3446 |
2972 /** | 3447 /** |
2973 * Set the body of the constructor to the given function body. | 3448 * Set the body of the constructor to the given function body. |
2974 * @param functionBody the body of the constructor | 3449 * @param functionBody the body of the constructor |
2975 */ | 3450 */ |
2976 void set body(FunctionBody functionBody) { | 3451 void set body(FunctionBody functionBody) { |
2977 _body = becomeParentOf(functionBody); | 3452 _body = becomeParentOf(functionBody); |
2978 } | 3453 } |
| 3454 |
2979 /** | 3455 /** |
2980 * Set the token for the 'const' keyword to the given token. | 3456 * Set the token for the 'const' keyword to the given token. |
2981 * @param constKeyword the token for the 'const' keyword | 3457 * @param constKeyword the token for the 'const' keyword |
2982 */ | 3458 */ |
2983 void set constKeyword(Token constKeyword2) { | 3459 void set constKeyword(Token constKeyword2) { |
2984 this._constKeyword = constKeyword2; | 3460 this._constKeyword = constKeyword2; |
2985 } | 3461 } |
| 3462 |
2986 /** | 3463 /** |
2987 * Set the element associated with this constructor to the given element. | 3464 * Set the element associated with this constructor to the given element. |
2988 * @param element the element associated with this constructor | 3465 * @param element the element associated with this constructor |
2989 */ | 3466 */ |
2990 void set element(ConstructorElement element2) { | 3467 void set element(ConstructorElement element2) { |
2991 this._element = element2; | 3468 this._element = element2; |
2992 } | 3469 } |
| 3470 |
2993 /** | 3471 /** |
2994 * Set the token for the 'external' keyword to the given token. | 3472 * Set the token for the 'external' keyword to the given token. |
2995 * @param externalKeyword the token for the 'external' keyword | 3473 * @param externalKeyword the token for the 'external' keyword |
2996 */ | 3474 */ |
2997 void set externalKeyword(Token externalKeyword2) { | 3475 void set externalKeyword(Token externalKeyword2) { |
2998 this._externalKeyword = externalKeyword2; | 3476 this._externalKeyword = externalKeyword2; |
2999 } | 3477 } |
| 3478 |
3000 /** | 3479 /** |
3001 * Set the token for the 'factory' keyword to the given token. | 3480 * Set the token for the 'factory' keyword to the given token. |
3002 * @param factoryKeyword the token for the 'factory' keyword | 3481 * @param factoryKeyword the token for the 'factory' keyword |
3003 */ | 3482 */ |
3004 void set factoryKeyword(Token factoryKeyword2) { | 3483 void set factoryKeyword(Token factoryKeyword2) { |
3005 this._factoryKeyword = factoryKeyword2; | 3484 this._factoryKeyword = factoryKeyword2; |
3006 } | 3485 } |
| 3486 |
3007 /** | 3487 /** |
3008 * Set the name of the constructor to the given identifier. | 3488 * Set the name of the constructor to the given identifier. |
3009 * @param identifier the name of the constructor | 3489 * @param identifier the name of the constructor |
3010 */ | 3490 */ |
3011 void set name(SimpleIdentifier identifier) { | 3491 void set name(SimpleIdentifier identifier) { |
3012 _name = becomeParentOf(identifier); | 3492 _name = becomeParentOf(identifier); |
3013 } | 3493 } |
| 3494 |
3014 /** | 3495 /** |
3015 * Set the parameters associated with the constructor to the given list of par
ameters. | 3496 * Set the parameters associated with the constructor to the given list of par
ameters. |
3016 * @param parameters the parameters associated with the constructor | 3497 * @param parameters the parameters associated with the constructor |
3017 */ | 3498 */ |
3018 void set parameters(FormalParameterList parameters2) { | 3499 void set parameters(FormalParameterList parameters2) { |
3019 this._parameters = becomeParentOf(parameters2); | 3500 this._parameters = becomeParentOf(parameters2); |
3020 } | 3501 } |
| 3502 |
3021 /** | 3503 /** |
3022 * Set the token for the period before the constructor name to the given token
. | 3504 * Set the token for the period before the constructor name to the given token
. |
3023 * @param period the token for the period before the constructor name | 3505 * @param period the token for the period before the constructor name |
3024 */ | 3506 */ |
3025 void set period(Token period2) { | 3507 void set period(Token period2) { |
3026 this._period = period2; | 3508 this._period = period2; |
3027 } | 3509 } |
| 3510 |
3028 /** | 3511 /** |
3029 * Set the name of the constructor to which this constructor will be redirecte
d to the given | 3512 * Set the name of the constructor to which this constructor will be redirecte
d to the given |
3030 * constructor name. | 3513 * constructor name. |
3031 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be | 3514 * @param redirectedConstructor the name of the constructor to which this cons
tructor will be |
3032 * redirected | 3515 * redirected |
3033 */ | 3516 */ |
3034 void set redirectedConstructor(ConstructorName redirectedConstructor2) { | 3517 void set redirectedConstructor(ConstructorName redirectedConstructor2) { |
3035 this._redirectedConstructor = becomeParentOf(redirectedConstructor2); | 3518 this._redirectedConstructor = becomeParentOf(redirectedConstructor2); |
3036 } | 3519 } |
| 3520 |
3037 /** | 3521 /** |
3038 * Set the type of object being created to the given type name. | 3522 * Set the type of object being created to the given type name. |
3039 * @param typeName the type of object being created | 3523 * @param typeName the type of object being created |
3040 */ | 3524 */ |
3041 void set returnType(Identifier typeName) { | 3525 void set returnType(Identifier typeName) { |
3042 _returnType = becomeParentOf(typeName); | 3526 _returnType = becomeParentOf(typeName); |
3043 } | 3527 } |
| 3528 |
3044 /** | 3529 /** |
3045 * Set the token for the separator (colon or equals) before the initializers t
o the given token. | 3530 * Set the token for the separator (colon or equals) before the initializers t
o the given token. |
3046 * @param separator the token for the separator (colon or equals) before the i
nitializers | 3531 * @param separator the token for the separator (colon or equals) before the i
nitializers |
3047 */ | 3532 */ |
3048 void set separator(Token separator2) { | 3533 void set separator(Token separator2) { |
3049 this._separator = separator2; | 3534 this._separator = separator2; |
3050 } | 3535 } |
3051 void visitChildren(ASTVisitor<Object> visitor) { | 3536 void visitChildren(ASTVisitor<Object> visitor) { |
3052 super.visitChildren(visitor); | 3537 super.visitChildren(visitor); |
3053 safelyVisitChild(_returnType, visitor); | 3538 safelyVisitChild(_returnType, visitor); |
3054 safelyVisitChild(_name, visitor); | 3539 safelyVisitChild(_name, visitor); |
3055 safelyVisitChild(_parameters, visitor); | 3540 safelyVisitChild(_parameters, visitor); |
3056 _initializers.accept(visitor); | 3541 _initializers.accept(visitor); |
3057 safelyVisitChild(_redirectedConstructor, visitor); | 3542 safelyVisitChild(_redirectedConstructor, visitor); |
3058 safelyVisitChild(_body, visitor); | 3543 safelyVisitChild(_body, visitor); |
3059 } | 3544 } |
3060 Token get firstTokenAfterCommentAndMetadata { | 3545 Token get firstTokenAfterCommentAndMetadata { |
3061 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword
]); | 3546 Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword
]); |
3062 if (leftMost2 != null) { | 3547 if (leftMost2 != null) { |
3063 return leftMost2; | 3548 return leftMost2; |
3064 } | 3549 } |
3065 return _returnType.beginToken; | 3550 return _returnType.beginToken; |
3066 } | 3551 } |
| 3552 |
3067 /** | 3553 /** |
3068 * Return the left-most of the given tokens, or {@code null} if there are no t
okens given or if | 3554 * Return the left-most of the given tokens, or {@code null} if there are no t
okens given or if |
3069 * all of the given tokens are {@code null}. | 3555 * all of the given tokens are {@code null}. |
3070 * @param tokens the tokens being compared to find the left-most token | 3556 * @param tokens the tokens being compared to find the left-most token |
3071 * @return the left-most of the given tokens | 3557 * @return the left-most of the given tokens |
3072 */ | 3558 */ |
3073 Token leftMost(List<Token> tokens) { | 3559 Token leftMost(List<Token> tokens) { |
3074 Token leftMost = null; | 3560 Token leftMost = null; |
3075 int offset = 2147483647; | 3561 int offset = 2147483647; |
3076 for (Token token in tokens) { | 3562 for (Token token in tokens) { |
3077 if (token != null && token.offset < offset) { | 3563 if (token != null && token.offset < offset) { |
3078 leftMost = token; | 3564 leftMost = token; |
3079 } | 3565 } |
3080 } | 3566 } |
3081 return leftMost; | 3567 return leftMost; |
3082 } | 3568 } |
3083 } | 3569 } |
| 3570 |
3084 /** | 3571 /** |
3085 * Instances of the class {@code ConstructorFieldInitializer} represent the init
ialization of a | 3572 * Instances of the class {@code ConstructorFieldInitializer} represent the init
ialization of a |
3086 * field within a constructor's initialization list. | 3573 * field within a constructor's initialization list. |
3087 * <pre> | 3574 * <pre> |
3088 * fieldInitializer ::= | 3575 * fieldInitializer ::= |
3089 * ('this' '.')? {@link SimpleIdentifier fieldName} '=' {@link Expression condit
ionalExpression cascadeSection*}</pre> | 3576 * ('this' '.')? {@link SimpleIdentifier fieldName} '=' {@link Expression condit
ionalExpression cascadeSection*}</pre> |
3090 * @coverage dart.engine.ast | 3577 * @coverage dart.engine.ast |
3091 */ | 3578 */ |
3092 class ConstructorFieldInitializer extends ConstructorInitializer { | 3579 class ConstructorFieldInitializer extends ConstructorInitializer { |
| 3580 |
3093 /** | 3581 /** |
3094 * The token for the 'this' keyword, or {@code null} if there is no 'this' key
word. | 3582 * The token for the 'this' keyword, or {@code null} if there is no 'this' key
word. |
3095 */ | 3583 */ |
3096 Token _keyword; | 3584 Token _keyword; |
| 3585 |
3097 /** | 3586 /** |
3098 * The token for the period after the 'this' keyword, or {@code null} if there
is no 'this' | 3587 * The token for the period after the 'this' keyword, or {@code null} if there
is no 'this' |
3099 * keyword. | 3588 * keyword. |
3100 */ | 3589 */ |
3101 Token _period; | 3590 Token _period; |
| 3591 |
3102 /** | 3592 /** |
3103 * The name of the field being initialized. | 3593 * The name of the field being initialized. |
3104 */ | 3594 */ |
3105 SimpleIdentifier _fieldName; | 3595 SimpleIdentifier _fieldName; |
| 3596 |
3106 /** | 3597 /** |
3107 * The token for the equal sign between the field name and the expression. | 3598 * The token for the equal sign between the field name and the expression. |
3108 */ | 3599 */ |
3109 Token _equals; | 3600 Token _equals; |
| 3601 |
3110 /** | 3602 /** |
3111 * The expression computing the value to which the field will be initialized. | 3603 * The expression computing the value to which the field will be initialized. |
3112 */ | 3604 */ |
3113 Expression _expression; | 3605 Expression _expression; |
| 3606 |
3114 /** | 3607 /** |
3115 * Initialize a newly created field initializer to initialize the field with t
he given name to the | 3608 * Initialize a newly created field initializer to initialize the field with t
he given name to the |
3116 * value of the given expression. | 3609 * value of the given expression. |
3117 * @param keyword the token for the 'this' keyword | 3610 * @param keyword the token for the 'this' keyword |
3118 * @param period the token for the period after the 'this' keyword | 3611 * @param period the token for the period after the 'this' keyword |
3119 * @param fieldName the name of the field being initialized | 3612 * @param fieldName the name of the field being initialized |
3120 * @param equals the token for the equal sign between the field name and the e
xpression | 3613 * @param equals the token for the equal sign between the field name and the e
xpression |
3121 * @param expression the expression computing the value to which the field wil
l be initialized | 3614 * @param expression the expression computing the value to which the field wil
l be initialized |
3122 */ | 3615 */ |
3123 ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier
fieldName, Token equals, Expression expression) { | 3616 ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier
fieldName, Token equals, Expression expression) { |
3124 this._keyword = keyword; | 3617 this._keyword = keyword; |
3125 this._period = period; | 3618 this._period = period; |
3126 this._fieldName = becomeParentOf(fieldName); | 3619 this._fieldName = becomeParentOf(fieldName); |
3127 this._equals = equals; | 3620 this._equals = equals; |
3128 this._expression = becomeParentOf(expression); | 3621 this._expression = becomeParentOf(expression); |
3129 } | 3622 } |
| 3623 |
3130 /** | 3624 /** |
3131 * Initialize a newly created field initializer to initialize the field with t
he given name to the | 3625 * Initialize a newly created field initializer to initialize the field with t
he given name to the |
3132 * value of the given expression. | 3626 * value of the given expression. |
3133 * @param keyword the token for the 'this' keyword | 3627 * @param keyword the token for the 'this' keyword |
3134 * @param period the token for the period after the 'this' keyword | 3628 * @param period the token for the period after the 'this' keyword |
3135 * @param fieldName the name of the field being initialized | 3629 * @param fieldName the name of the field being initialized |
3136 * @param equals the token for the equal sign between the field name and the e
xpression | 3630 * @param equals the token for the equal sign between the field name and the e
xpression |
3137 * @param expression the expression computing the value to which the field wil
l be initialized | 3631 * @param expression the expression computing the value to which the field wil
l be initialized |
3138 */ | 3632 */ |
3139 ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fie
ldName, Token equals, Expression expression}) : this.full(keyword, period, field
Name, equals, expression); | 3633 ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fie
ldName, Token equals, Expression expression}) : this.full(keyword, period, field
Name, equals, expression); |
3140 accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this); | 3634 accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this); |
3141 Token get beginToken { | 3635 Token get beginToken { |
3142 if (_keyword != null) { | 3636 if (_keyword != null) { |
3143 return _keyword; | 3637 return _keyword; |
3144 } | 3638 } |
3145 return _fieldName.beginToken; | 3639 return _fieldName.beginToken; |
3146 } | 3640 } |
3147 Token get endToken => _expression.endToken; | 3641 Token get endToken => _expression.endToken; |
| 3642 |
3148 /** | 3643 /** |
3149 * Return the token for the equal sign between the field name and the expressi
on. | 3644 * Return the token for the equal sign between the field name and the expressi
on. |
3150 * @return the token for the equal sign between the field name and the express
ion | 3645 * @return the token for the equal sign between the field name and the express
ion |
3151 */ | 3646 */ |
3152 Token get equals => _equals; | 3647 Token get equals => _equals; |
| 3648 |
3153 /** | 3649 /** |
3154 * Return the expression computing the value to which the field will be initia
lized. | 3650 * Return the expression computing the value to which the field will be initia
lized. |
3155 * @return the expression computing the value to which the field will be initi
alized | 3651 * @return the expression computing the value to which the field will be initi
alized |
3156 */ | 3652 */ |
3157 Expression get expression => _expression; | 3653 Expression get expression => _expression; |
| 3654 |
3158 /** | 3655 /** |
3159 * Return the name of the field being initialized. | 3656 * Return the name of the field being initialized. |
3160 * @return the name of the field being initialized | 3657 * @return the name of the field being initialized |
3161 */ | 3658 */ |
3162 SimpleIdentifier get fieldName => _fieldName; | 3659 SimpleIdentifier get fieldName => _fieldName; |
| 3660 |
3163 /** | 3661 /** |
3164 * Return the token for the 'this' keyword, or {@code null} if there is no 'th
is' keyword. | 3662 * Return the token for the 'this' keyword, or {@code null} if there is no 'th
is' keyword. |
3165 * @return the token for the 'this' keyword | 3663 * @return the token for the 'this' keyword |
3166 */ | 3664 */ |
3167 Token get keyword => _keyword; | 3665 Token get keyword => _keyword; |
| 3666 |
3168 /** | 3667 /** |
3169 * Return the token for the period after the 'this' keyword, or {@code null} i
f there is no 'this' | 3668 * Return the token for the period after the 'this' keyword, or {@code null} i
f there is no 'this' |
3170 * keyword. | 3669 * keyword. |
3171 * @return the token for the period after the 'this' keyword | 3670 * @return the token for the period after the 'this' keyword |
3172 */ | 3671 */ |
3173 Token get period => _period; | 3672 Token get period => _period; |
| 3673 |
3174 /** | 3674 /** |
3175 * Set the token for the equal sign between the field name and the expression
to the given token. | 3675 * Set the token for the equal sign between the field name and the expression
to the given token. |
3176 * @param equals the token for the equal sign between the field name and the e
xpression | 3676 * @param equals the token for the equal sign between the field name and the e
xpression |
3177 */ | 3677 */ |
3178 void set equals(Token equals2) { | 3678 void set equals(Token equals2) { |
3179 this._equals = equals2; | 3679 this._equals = equals2; |
3180 } | 3680 } |
| 3681 |
3181 /** | 3682 /** |
3182 * Set the expression computing the value to which the field will be initializ
ed to the given | 3683 * Set the expression computing the value to which the field will be initializ
ed to the given |
3183 * expression. | 3684 * expression. |
3184 * @param expression the expression computing the value to which the field wil
l be initialized | 3685 * @param expression the expression computing the value to which the field wil
l be initialized |
3185 */ | 3686 */ |
3186 void set expression(Expression expression2) { | 3687 void set expression(Expression expression2) { |
3187 this._expression = becomeParentOf(expression2); | 3688 this._expression = becomeParentOf(expression2); |
3188 } | 3689 } |
| 3690 |
3189 /** | 3691 /** |
3190 * Set the name of the field being initialized to the given identifier. | 3692 * Set the name of the field being initialized to the given identifier. |
3191 * @param identifier the name of the field being initialized | 3693 * @param identifier the name of the field being initialized |
3192 */ | 3694 */ |
3193 void set fieldName(SimpleIdentifier identifier) { | 3695 void set fieldName(SimpleIdentifier identifier) { |
3194 _fieldName = becomeParentOf(identifier); | 3696 _fieldName = becomeParentOf(identifier); |
3195 } | 3697 } |
| 3698 |
3196 /** | 3699 /** |
3197 * Set the token for the 'this' keyword to the given token. | 3700 * Set the token for the 'this' keyword to the given token. |
3198 * @param keyword the token for the 'this' keyword | 3701 * @param keyword the token for the 'this' keyword |
3199 */ | 3702 */ |
3200 void set keyword(Token keyword2) { | 3703 void set keyword(Token keyword2) { |
3201 this._keyword = keyword2; | 3704 this._keyword = keyword2; |
3202 } | 3705 } |
| 3706 |
3203 /** | 3707 /** |
3204 * Set the token for the period after the 'this' keyword to the given token. | 3708 * Set the token for the period after the 'this' keyword to the given token. |
3205 * @param period the token for the period after the 'this' keyword | 3709 * @param period the token for the period after the 'this' keyword |
3206 */ | 3710 */ |
3207 void set period(Token period2) { | 3711 void set period(Token period2) { |
3208 this._period = period2; | 3712 this._period = period2; |
3209 } | 3713 } |
3210 void visitChildren(ASTVisitor<Object> visitor) { | 3714 void visitChildren(ASTVisitor<Object> visitor) { |
3211 safelyVisitChild(_fieldName, visitor); | 3715 safelyVisitChild(_fieldName, visitor); |
3212 safelyVisitChild(_expression, visitor); | 3716 safelyVisitChild(_expression, visitor); |
3213 } | 3717 } |
3214 } | 3718 } |
| 3719 |
3215 /** | 3720 /** |
3216 * Instances of the class {@code ConstructorInitializer} defines the behavior of
nodes that can | 3721 * Instances of the class {@code ConstructorInitializer} defines the behavior of
nodes that can |
3217 * occur in the initializer list of a constructor declaration. | 3722 * occur in the initializer list of a constructor declaration. |
3218 * <pre> | 3723 * <pre> |
3219 * constructorInitializer ::={@link SuperConstructorInvocation superInvocation}|
{@link ConstructorFieldInitializer fieldInitializer}</pre> | 3724 * constructorInitializer ::={@link SuperConstructorInvocation superInvocation}|
{@link ConstructorFieldInitializer fieldInitializer}</pre> |
3220 * @coverage dart.engine.ast | 3725 * @coverage dart.engine.ast |
3221 */ | 3726 */ |
3222 abstract class ConstructorInitializer extends ASTNode { | 3727 abstract class ConstructorInitializer extends ASTNode { |
3223 } | 3728 } |
| 3729 |
3224 /** | 3730 /** |
3225 * Instances of the class {@code ConstructorName} represent the name of the cons
tructor. | 3731 * Instances of the class {@code ConstructorName} represent the name of the cons
tructor. |
3226 * <pre> | 3732 * <pre> |
3227 * constructorName: | 3733 * constructorName: |
3228 * type ('.' identifier)? | 3734 * type ('.' identifier)? |
3229 * </pre> | 3735 * </pre> |
3230 * @coverage dart.engine.ast | 3736 * @coverage dart.engine.ast |
3231 */ | 3737 */ |
3232 class ConstructorName extends ASTNode { | 3738 class ConstructorName extends ASTNode { |
| 3739 |
3233 /** | 3740 /** |
3234 * The name of the type defining the constructor. | 3741 * The name of the type defining the constructor. |
3235 */ | 3742 */ |
3236 TypeName _type; | 3743 TypeName _type; |
| 3744 |
3237 /** | 3745 /** |
3238 * The token for the period before the constructor name, or {@code null} if th
e specified | 3746 * The token for the period before the constructor name, or {@code null} if th
e specified |
3239 * constructor is the unnamed constructor. | 3747 * constructor is the unnamed constructor. |
3240 */ | 3748 */ |
3241 Token _period; | 3749 Token _period; |
| 3750 |
3242 /** | 3751 /** |
3243 * The name of the constructor, or {@code null} if the specified constructor i
s the unnamed | 3752 * The name of the constructor, or {@code null} if the specified constructor i
s the unnamed |
3244 * constructor. | 3753 * constructor. |
3245 */ | 3754 */ |
3246 SimpleIdentifier _name; | 3755 SimpleIdentifier _name; |
| 3756 |
3247 /** | 3757 /** |
3248 * The element associated with this constructor name, or {@code null} if the A
ST structure has not | 3758 * The element associated with this constructor name based on static type info
rmation, or{@code null} if the AST structure has not been resolved or if this co
nstructor name could not |
3249 * been resolved or if this constructor name could not be resolved. | 3759 * be resolved. |
3250 */ | 3760 */ |
3251 ConstructorElement _element; | 3761 ConstructorElement _staticElement; |
| 3762 |
| 3763 /** |
| 3764 * The element associated with this constructor name based on propagated type
information, or{@code null} if the AST structure has not been resolved or if thi
s constructor name could not |
| 3765 * be resolved. |
| 3766 */ |
| 3767 ConstructorElement _propagatedElement; |
| 3768 |
3252 /** | 3769 /** |
3253 * Initialize a newly created constructor name. | 3770 * Initialize a newly created constructor name. |
3254 * @param type the name of the type defining the constructor | 3771 * @param type the name of the type defining the constructor |
3255 * @param period the token for the period before the constructor name | 3772 * @param period the token for the period before the constructor name |
3256 * @param name the name of the constructor | 3773 * @param name the name of the constructor |
3257 */ | 3774 */ |
3258 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) { | 3775 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) { |
3259 this._type = becomeParentOf(type); | 3776 this._type = becomeParentOf(type); |
3260 this._period = period; | 3777 this._period = period; |
3261 this._name = becomeParentOf(name); | 3778 this._name = becomeParentOf(name); |
3262 } | 3779 } |
| 3780 |
3263 /** | 3781 /** |
3264 * Initialize a newly created constructor name. | 3782 * Initialize a newly created constructor name. |
3265 * @param type the name of the type defining the constructor | 3783 * @param type the name of the type defining the constructor |
3266 * @param period the token for the period before the constructor name | 3784 * @param period the token for the period before the constructor name |
3267 * @param name the name of the constructor | 3785 * @param name the name of the constructor |
3268 */ | 3786 */ |
3269 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f
ull(type, period, name); | 3787 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f
ull(type, period, name); |
3270 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); | 3788 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); |
3271 Token get beginToken => _type.beginToken; | 3789 Token get beginToken => _type.beginToken; |
| 3790 |
3272 /** | 3791 /** |
3273 * Return the element associated with this constructor name, or {@code null} i
f the AST structure | 3792 * Return the element associated with this constructor name based on propagate
d type information, |
3274 * has not been resolved or if this constructor name could not be resolved. | 3793 * or {@code null} if the AST structure has not been resolved or if this const
ructor name could |
| 3794 * not be resolved. |
3275 * @return the element associated with this constructor name | 3795 * @return the element associated with this constructor name |
3276 */ | 3796 */ |
3277 ConstructorElement get element => _element; | 3797 ConstructorElement get element => _propagatedElement; |
3278 Token get endToken { | 3798 Token get endToken { |
3279 if (_name != null) { | 3799 if (_name != null) { |
3280 return _name.endToken; | 3800 return _name.endToken; |
3281 } | 3801 } |
3282 return _type.endToken; | 3802 return _type.endToken; |
3283 } | 3803 } |
| 3804 |
3284 /** | 3805 /** |
3285 * Return the name of the constructor, or {@code null} if the specified constr
uctor is the unnamed | 3806 * Return the name of the constructor, or {@code null} if the specified constr
uctor is the unnamed |
3286 * constructor. | 3807 * constructor. |
3287 * @return the name of the constructor | 3808 * @return the name of the constructor |
3288 */ | 3809 */ |
3289 SimpleIdentifier get name => _name; | 3810 SimpleIdentifier get name => _name; |
| 3811 |
3290 /** | 3812 /** |
3291 * Return the token for the period before the constructor name, or {@code null
} if the specified | 3813 * Return the token for the period before the constructor name, or {@code null
} if the specified |
3292 * constructor is the unnamed constructor. | 3814 * constructor is the unnamed constructor. |
3293 * @return the token for the period before the constructor name | 3815 * @return the token for the period before the constructor name |
3294 */ | 3816 */ |
3295 Token get period => _period; | 3817 Token get period => _period; |
| 3818 |
| 3819 /** |
| 3820 * Return the element associated with this constructor name based on static ty
pe information, or{@code null} if the AST structure has not been resolved or if
this constructor name could not |
| 3821 * be resolved. |
| 3822 * @return the element associated with this constructor name |
| 3823 */ |
| 3824 ConstructorElement get staticElement => _staticElement; |
| 3825 |
3296 /** | 3826 /** |
3297 * Return the name of the type defining the constructor. | 3827 * Return the name of the type defining the constructor. |
3298 * @return the name of the type defining the constructor | 3828 * @return the name of the type defining the constructor |
3299 */ | 3829 */ |
3300 TypeName get type => _type; | 3830 TypeName get type => _type; |
| 3831 |
3301 /** | 3832 /** |
3302 * Set the element associated with this constructor name to the given element. | 3833 * Set the element associated with this constructor name based on propagated t
ype information to |
3303 * @param element the element associated with this constructor name | 3834 * the given element. |
| 3835 * @param element the element to be associated with this constructor name |
3304 */ | 3836 */ |
3305 void set element(ConstructorElement element2) { | 3837 void set element(ConstructorElement element2) { |
3306 this._element = element2; | 3838 _propagatedElement = element2; |
3307 } | 3839 } |
| 3840 |
3308 /** | 3841 /** |
3309 * Set the name of the constructor to the given name. | 3842 * Set the name of the constructor to the given name. |
3310 * @param name the name of the constructor | 3843 * @param name the name of the constructor |
3311 */ | 3844 */ |
3312 void set name(SimpleIdentifier name2) { | 3845 void set name(SimpleIdentifier name2) { |
3313 this._name = becomeParentOf(name2); | 3846 this._name = becomeParentOf(name2); |
3314 } | 3847 } |
| 3848 |
3315 /** | 3849 /** |
3316 * Return the token for the period before the constructor name to the given to
ken. | 3850 * Return the token for the period before the constructor name to the given to
ken. |
3317 * @param period the token for the period before the constructor name | 3851 * @param period the token for the period before the constructor name |
3318 */ | 3852 */ |
3319 void set period(Token period2) { | 3853 void set period(Token period2) { |
3320 this._period = period2; | 3854 this._period = period2; |
3321 } | 3855 } |
| 3856 |
| 3857 /** |
| 3858 * Set the element associated with this constructor name based on static type
information to the |
| 3859 * given element. |
| 3860 * @param element the element to be associated with this constructor name |
| 3861 */ |
| 3862 void set staticElement(ConstructorElement element) { |
| 3863 _staticElement = element; |
| 3864 } |
| 3865 |
3322 /** | 3866 /** |
3323 * Set the name of the type defining the constructor to the given type name. | 3867 * Set the name of the type defining the constructor to the given type name. |
3324 * @param type the name of the type defining the constructor | 3868 * @param type the name of the type defining the constructor |
3325 */ | 3869 */ |
3326 void set type(TypeName type2) { | 3870 void set type(TypeName type2) { |
3327 this._type = becomeParentOf(type2); | 3871 this._type = becomeParentOf(type2); |
3328 } | 3872 } |
3329 void visitChildren(ASTVisitor<Object> visitor) { | 3873 void visitChildren(ASTVisitor<Object> visitor) { |
3330 safelyVisitChild(_type, visitor); | 3874 safelyVisitChild(_type, visitor); |
3331 safelyVisitChild(_name, visitor); | 3875 safelyVisitChild(_name, visitor); |
3332 } | 3876 } |
3333 } | 3877 } |
| 3878 |
3334 /** | 3879 /** |
3335 * Instances of the class {@code ContinueStatement} represent a continue stateme
nt. | 3880 * Instances of the class {@code ContinueStatement} represent a continue stateme
nt. |
3336 * <pre> | 3881 * <pre> |
3337 * continueStatement ::= | 3882 * continueStatement ::= |
3338 * 'continue' {@link SimpleIdentifier label}? ';' | 3883 * 'continue' {@link SimpleIdentifier label}? ';' |
3339 * </pre> | 3884 * </pre> |
3340 * @coverage dart.engine.ast | 3885 * @coverage dart.engine.ast |
3341 */ | 3886 */ |
3342 class ContinueStatement extends Statement { | 3887 class ContinueStatement extends Statement { |
| 3888 |
3343 /** | 3889 /** |
3344 * The token representing the 'continue' keyword. | 3890 * The token representing the 'continue' keyword. |
3345 */ | 3891 */ |
3346 Token _keyword; | 3892 Token _keyword; |
| 3893 |
3347 /** | 3894 /** |
3348 * The label associated with the statement, or {@code null} if there is no lab
el. | 3895 * The label associated with the statement, or {@code null} if there is no lab
el. |
3349 */ | 3896 */ |
3350 SimpleIdentifier _label; | 3897 SimpleIdentifier _label; |
| 3898 |
3351 /** | 3899 /** |
3352 * The semicolon terminating the statement. | 3900 * The semicolon terminating the statement. |
3353 */ | 3901 */ |
3354 Token _semicolon; | 3902 Token _semicolon; |
| 3903 |
3355 /** | 3904 /** |
3356 * Initialize a newly created continue statement. | 3905 * Initialize a newly created continue statement. |
3357 * @param keyword the token representing the 'continue' keyword | 3906 * @param keyword the token representing the 'continue' keyword |
3358 * @param label the label associated with the statement | 3907 * @param label the label associated with the statement |
3359 * @param semicolon the semicolon terminating the statement | 3908 * @param semicolon the semicolon terminating the statement |
3360 */ | 3909 */ |
3361 ContinueStatement.full(Token keyword, SimpleIdentifier label, Token semicolon)
{ | 3910 ContinueStatement.full(Token keyword, SimpleIdentifier label, Token semicolon)
{ |
3362 this._keyword = keyword; | 3911 this._keyword = keyword; |
3363 this._label = becomeParentOf(label); | 3912 this._label = becomeParentOf(label); |
3364 this._semicolon = semicolon; | 3913 this._semicolon = semicolon; |
3365 } | 3914 } |
| 3915 |
3366 /** | 3916 /** |
3367 * Initialize a newly created continue statement. | 3917 * Initialize a newly created continue statement. |
3368 * @param keyword the token representing the 'continue' keyword | 3918 * @param keyword the token representing the 'continue' keyword |
3369 * @param label the label associated with the statement | 3919 * @param label the label associated with the statement |
3370 * @param semicolon the semicolon terminating the statement | 3920 * @param semicolon the semicolon terminating the statement |
3371 */ | 3921 */ |
3372 ContinueStatement({Token keyword, SimpleIdentifier label, Token semicolon}) :
this.full(keyword, label, semicolon); | 3922 ContinueStatement({Token keyword, SimpleIdentifier label, Token semicolon}) :
this.full(keyword, label, semicolon); |
3373 accept(ASTVisitor visitor) => visitor.visitContinueStatement(this); | 3923 accept(ASTVisitor visitor) => visitor.visitContinueStatement(this); |
3374 Token get beginToken => _keyword; | 3924 Token get beginToken => _keyword; |
3375 Token get endToken => _semicolon; | 3925 Token get endToken => _semicolon; |
| 3926 |
3376 /** | 3927 /** |
3377 * Return the token representing the 'continue' keyword. | 3928 * Return the token representing the 'continue' keyword. |
3378 * @return the token representing the 'continue' keyword | 3929 * @return the token representing the 'continue' keyword |
3379 */ | 3930 */ |
3380 Token get keyword => _keyword; | 3931 Token get keyword => _keyword; |
| 3932 |
3381 /** | 3933 /** |
3382 * Return the label associated with the statement, or {@code null} if there is
no label. | 3934 * Return the label associated with the statement, or {@code null} if there is
no label. |
3383 * @return the label associated with the statement | 3935 * @return the label associated with the statement |
3384 */ | 3936 */ |
3385 SimpleIdentifier get label => _label; | 3937 SimpleIdentifier get label => _label; |
| 3938 |
3386 /** | 3939 /** |
3387 * Return the semicolon terminating the statement. | 3940 * Return the semicolon terminating the statement. |
3388 * @return the semicolon terminating the statement | 3941 * @return the semicolon terminating the statement |
3389 */ | 3942 */ |
3390 Token get semicolon => _semicolon; | 3943 Token get semicolon => _semicolon; |
| 3944 |
3391 /** | 3945 /** |
3392 * Set the token representing the 'continue' keyword to the given token. | 3946 * Set the token representing the 'continue' keyword to the given token. |
3393 * @param keyword the token representing the 'continue' keyword | 3947 * @param keyword the token representing the 'continue' keyword |
3394 */ | 3948 */ |
3395 void set keyword(Token keyword2) { | 3949 void set keyword(Token keyword2) { |
3396 this._keyword = keyword2; | 3950 this._keyword = keyword2; |
3397 } | 3951 } |
| 3952 |
3398 /** | 3953 /** |
3399 * Set the label associated with the statement to the given label. | 3954 * Set the label associated with the statement to the given label. |
3400 * @param identifier the label associated with the statement | 3955 * @param identifier the label associated with the statement |
3401 */ | 3956 */ |
3402 void set label(SimpleIdentifier identifier) { | 3957 void set label(SimpleIdentifier identifier) { |
3403 _label = becomeParentOf(identifier); | 3958 _label = becomeParentOf(identifier); |
3404 } | 3959 } |
| 3960 |
3405 /** | 3961 /** |
3406 * Set the semicolon terminating the statement to the given token. | 3962 * Set the semicolon terminating the statement to the given token. |
3407 * @param semicolon the semicolon terminating the statement | 3963 * @param semicolon the semicolon terminating the statement |
3408 */ | 3964 */ |
3409 void set semicolon(Token semicolon2) { | 3965 void set semicolon(Token semicolon2) { |
3410 this._semicolon = semicolon2; | 3966 this._semicolon = semicolon2; |
3411 } | 3967 } |
3412 void visitChildren(ASTVisitor<Object> visitor) { | 3968 void visitChildren(ASTVisitor<Object> visitor) { |
3413 safelyVisitChild(_label, visitor); | 3969 safelyVisitChild(_label, visitor); |
3414 } | 3970 } |
3415 } | 3971 } |
| 3972 |
3416 /** | 3973 /** |
3417 * The abstract class {@code Declaration} defines the behavior common to nodes t
hat represent the | 3974 * The abstract class {@code Declaration} defines the behavior common to nodes t
hat represent the |
3418 * declaration of a name. Each declared name is visible within a name scope. | 3975 * declaration of a name. Each declared name is visible within a name scope. |
3419 * @coverage dart.engine.ast | 3976 * @coverage dart.engine.ast |
3420 */ | 3977 */ |
3421 abstract class Declaration extends AnnotatedNode { | 3978 abstract class Declaration extends AnnotatedNode { |
| 3979 |
3422 /** | 3980 /** |
3423 * Initialize a newly created declaration. | 3981 * Initialize a newly created declaration. |
3424 * @param comment the documentation comment associated with this declaration | 3982 * @param comment the documentation comment associated with this declaration |
3425 * @param metadata the annotations associated with this declaration | 3983 * @param metadata the annotations associated with this declaration |
3426 */ | 3984 */ |
3427 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { | 3985 Declaration.full(Comment comment, List<Annotation> metadata) : super.full(comm
ent, metadata) { |
3428 } | 3986 } |
| 3987 |
3429 /** | 3988 /** |
3430 * Initialize a newly created declaration. | 3989 * Initialize a newly created declaration. |
3431 * @param comment the documentation comment associated with this declaration | 3990 * @param comment the documentation comment associated with this declaration |
3432 * @param metadata the annotations associated with this declaration | 3991 * @param metadata the annotations associated with this declaration |
3433 */ | 3992 */ |
3434 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); | 3993 Declaration({Comment comment, List<Annotation> metadata}) : this.full(comment,
metadata); |
| 3994 |
3435 /** | 3995 /** |
3436 * Return the element associated with this declaration, or {@code null} if eit
her this node | 3996 * Return the element associated with this declaration, or {@code null} if eit
her this node |
3437 * corresponds to a list of declarations or if the AST structure has not been
resolved. | 3997 * corresponds to a list of declarations or if the AST structure has not been
resolved. |
3438 * @return the element associated with this declaration | 3998 * @return the element associated with this declaration |
3439 */ | 3999 */ |
3440 Element get element; | 4000 Element get element; |
3441 } | 4001 } |
| 4002 |
3442 /** | 4003 /** |
3443 * Instances of the class {@code DeclaredIdentifier} represent the declaration o
f a single | 4004 * Instances of the class {@code DeclaredIdentifier} represent the declaration o
f a single |
3444 * identifier. | 4005 * identifier. |
3445 * <pre> | 4006 * <pre> |
3446 * declaredIdentifier ::= | 4007 * declaredIdentifier ::= |
3447 * ({@link Annotation metadata} finalConstVarOrType {@link SimpleIdentifier iden
tifier}</pre> | 4008 * ({@link Annotation metadata} finalConstVarOrType {@link SimpleIdentifier iden
tifier}</pre> |
3448 * @coverage dart.engine.ast | 4009 * @coverage dart.engine.ast |
3449 */ | 4010 */ |
3450 class DeclaredIdentifier extends Declaration { | 4011 class DeclaredIdentifier extends Declaration { |
| 4012 |
3451 /** | 4013 /** |
3452 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 4014 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
3453 * keyword was used. | 4015 * keyword was used. |
3454 */ | 4016 */ |
3455 Token _keyword; | 4017 Token _keyword; |
| 4018 |
3456 /** | 4019 /** |
3457 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have | 4020 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have |
3458 * a declared type. | 4021 * a declared type. |
3459 */ | 4022 */ |
3460 TypeName _type; | 4023 TypeName _type; |
| 4024 |
3461 /** | 4025 /** |
3462 * The name of the variable being declared. | 4026 * The name of the variable being declared. |
3463 */ | 4027 */ |
3464 SimpleIdentifier _identifier; | 4028 SimpleIdentifier _identifier; |
| 4029 |
3465 /** | 4030 /** |
3466 * Initialize a newly created formal parameter. | 4031 * Initialize a newly created formal parameter. |
3467 * @param comment the documentation comment associated with this parameter | 4032 * @param comment the documentation comment associated with this parameter |
3468 * @param metadata the annotations associated with this parameter | 4033 * @param metadata the annotations associated with this parameter |
3469 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4034 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
3470 * @param type the name of the declared type of the parameter | 4035 * @param type the name of the declared type of the parameter |
3471 * @param identifier the name of the parameter being declared | 4036 * @param identifier the name of the parameter being declared |
3472 */ | 4037 */ |
3473 DeclaredIdentifier.full(Comment comment, List<Annotation> metadata, Token keyw
ord, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata)
{ | 4038 DeclaredIdentifier.full(Comment comment, List<Annotation> metadata, Token keyw
ord, TypeName type, SimpleIdentifier identifier) : super.full(comment, metadata)
{ |
3474 this._keyword = keyword; | 4039 this._keyword = keyword; |
3475 this._type = becomeParentOf(type); | 4040 this._type = becomeParentOf(type); |
3476 this._identifier = becomeParentOf(identifier); | 4041 this._identifier = becomeParentOf(identifier); |
3477 } | 4042 } |
| 4043 |
3478 /** | 4044 /** |
3479 * Initialize a newly created formal parameter. | 4045 * Initialize a newly created formal parameter. |
3480 * @param comment the documentation comment associated with this parameter | 4046 * @param comment the documentation comment associated with this parameter |
3481 * @param metadata the annotations associated with this parameter | 4047 * @param metadata the annotations associated with this parameter |
3482 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4048 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
3483 * @param type the name of the declared type of the parameter | 4049 * @param type the name of the declared type of the parameter |
3484 * @param identifier the name of the parameter being declared | 4050 * @param identifier the name of the parameter being declared |
3485 */ | 4051 */ |
3486 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); | 4052 DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword,
TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, key
word, type, identifier); |
3487 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); | 4053 accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this); |
3488 LocalVariableElement get element { | 4054 LocalVariableElement get element { |
3489 SimpleIdentifier identifier2 = identifier; | 4055 SimpleIdentifier identifier2 = identifier; |
3490 if (identifier2 == null) { | 4056 if (identifier2 == null) { |
3491 return null; | 4057 return null; |
3492 } | 4058 } |
3493 return identifier2.element as LocalVariableElement; | 4059 return identifier2.element as LocalVariableElement; |
3494 } | 4060 } |
3495 Token get endToken => _identifier.endToken; | 4061 Token get endToken => _identifier.endToken; |
| 4062 |
3496 /** | 4063 /** |
3497 * Return the name of the variable being declared. | 4064 * Return the name of the variable being declared. |
3498 * @return the name of the variable being declared | 4065 * @return the name of the variable being declared |
3499 */ | 4066 */ |
3500 SimpleIdentifier get identifier => _identifier; | 4067 SimpleIdentifier get identifier => _identifier; |
| 4068 |
3501 /** | 4069 /** |
3502 * Return the token representing either the 'final', 'const' or 'var' keyword. | 4070 * Return the token representing either the 'final', 'const' or 'var' keyword. |
3503 * @return the token representing either the 'final', 'const' or 'var' keyword | 4071 * @return the token representing either the 'final', 'const' or 'var' keyword |
3504 */ | 4072 */ |
3505 Token get keyword => _keyword; | 4073 Token get keyword => _keyword; |
| 4074 |
3506 /** | 4075 /** |
3507 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does | 4076 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does |
3508 * not have a declared type. | 4077 * not have a declared type. |
3509 * @return the name of the declared type of the parameter | 4078 * @return the name of the declared type of the parameter |
3510 */ | 4079 */ |
3511 TypeName get type => _type; | 4080 TypeName get type => _type; |
| 4081 |
3512 /** | 4082 /** |
3513 * Return {@code true} if this variable was declared with the 'const' modifier
. | 4083 * Return {@code true} if this variable was declared with the 'const' modifier
. |
3514 * @return {@code true} if this variable was declared with the 'const' modifie
r | 4084 * @return {@code true} if this variable was declared with the 'const' modifie
r |
3515 */ | 4085 */ |
3516 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 4086 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
| 4087 |
3517 /** | 4088 /** |
3518 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are | 4089 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are |
3519 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly | 4090 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly |
3520 * final. | 4091 * final. |
3521 * @return {@code true} if this variable was declared with the 'final' modifie
r | 4092 * @return {@code true} if this variable was declared with the 'final' modifie
r |
3522 */ | 4093 */ |
3523 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); | 4094 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); |
| 4095 |
3524 /** | 4096 /** |
3525 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 4097 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
3526 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 4098 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
3527 */ | 4099 */ |
3528 void set keyword(Token keyword2) { | 4100 void set keyword(Token keyword2) { |
3529 this._keyword = keyword2; | 4101 this._keyword = keyword2; |
3530 } | 4102 } |
| 4103 |
3531 /** | 4104 /** |
3532 * Set the name of the declared type of the parameter to the given type name. | 4105 * Set the name of the declared type of the parameter to the given type name. |
3533 * @param typeName the name of the declared type of the parameter | 4106 * @param typeName the name of the declared type of the parameter |
3534 */ | 4107 */ |
3535 void set type(TypeName typeName) { | 4108 void set type(TypeName typeName) { |
3536 _type = becomeParentOf(typeName); | 4109 _type = becomeParentOf(typeName); |
3537 } | 4110 } |
3538 void visitChildren(ASTVisitor<Object> visitor) { | 4111 void visitChildren(ASTVisitor<Object> visitor) { |
3539 super.visitChildren(visitor); | 4112 super.visitChildren(visitor); |
3540 safelyVisitChild(_type, visitor); | 4113 safelyVisitChild(_type, visitor); |
3541 safelyVisitChild(_identifier, visitor); | 4114 safelyVisitChild(_identifier, visitor); |
3542 } | 4115 } |
3543 Token get firstTokenAfterCommentAndMetadata { | 4116 Token get firstTokenAfterCommentAndMetadata { |
3544 if (_keyword != null) { | 4117 if (_keyword != null) { |
3545 return _keyword; | 4118 return _keyword; |
3546 } else if (_type != null) { | 4119 } else if (_type != null) { |
3547 return _type.beginToken; | 4120 return _type.beginToken; |
3548 } | 4121 } |
3549 return _identifier.beginToken; | 4122 return _identifier.beginToken; |
3550 } | 4123 } |
3551 } | 4124 } |
| 4125 |
3552 /** | 4126 /** |
3553 * Instances of the class {@code DefaultFormalParameter} represent a formal para
meter with a default | 4127 * Instances of the class {@code DefaultFormalParameter} represent a formal para
meter with a default |
3554 * value. There are two kinds of parameters that are both represented by this cl
ass: named formal | 4128 * value. There are two kinds of parameters that are both represented by this cl
ass: named formal |
3555 * parameters and positional formal parameters. | 4129 * parameters and positional formal parameters. |
3556 * <pre> | 4130 * <pre> |
3557 * defaultFormalParameter ::={@link NormalFormalParameter normalFormalParameter}
('=' {@link Expression defaultValue})? | 4131 * defaultFormalParameter ::={@link NormalFormalParameter normalFormalParameter}
('=' {@link Expression defaultValue})? |
3558 * defaultNamedParameter ::={@link NormalFormalParameter normalFormalParameter}
(':' {@link Expression defaultValue})? | 4132 * defaultNamedParameter ::={@link NormalFormalParameter normalFormalParameter}
(':' {@link Expression defaultValue})? |
3559 * </pre> | 4133 * </pre> |
3560 * @coverage dart.engine.ast | 4134 * @coverage dart.engine.ast |
3561 */ | 4135 */ |
3562 class DefaultFormalParameter extends FormalParameter { | 4136 class DefaultFormalParameter extends FormalParameter { |
| 4137 |
3563 /** | 4138 /** |
3564 * The formal parameter with which the default value is associated. | 4139 * The formal parameter with which the default value is associated. |
3565 */ | 4140 */ |
3566 NormalFormalParameter _parameter; | 4141 NormalFormalParameter _parameter; |
| 4142 |
3567 /** | 4143 /** |
3568 * The kind of this parameter. | 4144 * The kind of this parameter. |
3569 */ | 4145 */ |
3570 ParameterKind _kind; | 4146 ParameterKind _kind; |
| 4147 |
3571 /** | 4148 /** |
3572 * The token separating the parameter from the default value, or {@code null}
if there is no | 4149 * The token separating the parameter from the default value, or {@code null}
if there is no |
3573 * default value. | 4150 * default value. |
3574 */ | 4151 */ |
3575 Token _separator; | 4152 Token _separator; |
| 4153 |
3576 /** | 4154 /** |
3577 * The expression computing the default value for the parameter, or {@code nul
l} if there is no | 4155 * The expression computing the default value for the parameter, or {@code nul
l} if there is no |
3578 * default value. | 4156 * default value. |
3579 */ | 4157 */ |
3580 Expression _defaultValue; | 4158 Expression _defaultValue; |
| 4159 |
3581 /** | 4160 /** |
3582 * Initialize a newly created default formal parameter. | 4161 * Initialize a newly created default formal parameter. |
3583 * @param parameter the formal parameter with which the default value is assoc
iated | 4162 * @param parameter the formal parameter with which the default value is assoc
iated |
3584 * @param kind the kind of this parameter | 4163 * @param kind the kind of this parameter |
3585 * @param separator the token separating the parameter from the default value | 4164 * @param separator the token separating the parameter from the default value |
3586 * @param defaultValue the expression computing the default value for the para
meter | 4165 * @param defaultValue the expression computing the default value for the para
meter |
3587 */ | 4166 */ |
3588 DefaultFormalParameter.full(NormalFormalParameter parameter, ParameterKind kin
d, Token separator, Expression defaultValue) { | 4167 DefaultFormalParameter.full(NormalFormalParameter parameter, ParameterKind kin
d, Token separator, Expression defaultValue) { |
3589 this._parameter = becomeParentOf(parameter); | 4168 this._parameter = becomeParentOf(parameter); |
3590 this._kind = kind; | 4169 this._kind = kind; |
3591 this._separator = separator; | 4170 this._separator = separator; |
3592 this._defaultValue = becomeParentOf(defaultValue); | 4171 this._defaultValue = becomeParentOf(defaultValue); |
3593 } | 4172 } |
| 4173 |
3594 /** | 4174 /** |
3595 * Initialize a newly created default formal parameter. | 4175 * Initialize a newly created default formal parameter. |
3596 * @param parameter the formal parameter with which the default value is assoc
iated | 4176 * @param parameter the formal parameter with which the default value is assoc
iated |
3597 * @param kind the kind of this parameter | 4177 * @param kind the kind of this parameter |
3598 * @param separator the token separating the parameter from the default value | 4178 * @param separator the token separating the parameter from the default value |
3599 * @param defaultValue the expression computing the default value for the para
meter | 4179 * @param defaultValue the expression computing the default value for the para
meter |
3600 */ | 4180 */ |
3601 DefaultFormalParameter({NormalFormalParameter parameter, ParameterKind kind, T
oken separator, Expression defaultValue}) : this.full(parameter, kind, separator
, defaultValue); | 4181 DefaultFormalParameter({NormalFormalParameter parameter, ParameterKind kind, T
oken separator, Expression defaultValue}) : this.full(parameter, kind, separator
, defaultValue); |
3602 accept(ASTVisitor visitor) => visitor.visitDefaultFormalParameter(this); | 4182 accept(ASTVisitor visitor) => visitor.visitDefaultFormalParameter(this); |
3603 Token get beginToken => _parameter.beginToken; | 4183 Token get beginToken => _parameter.beginToken; |
| 4184 |
3604 /** | 4185 /** |
3605 * Return the expression computing the default value for the parameter, or {@c
ode null} if there | 4186 * Return the expression computing the default value for the parameter, or {@c
ode null} if there |
3606 * is no default value. | 4187 * is no default value. |
3607 * @return the expression computing the default value for the parameter | 4188 * @return the expression computing the default value for the parameter |
3608 */ | 4189 */ |
3609 Expression get defaultValue => _defaultValue; | 4190 Expression get defaultValue => _defaultValue; |
3610 Token get endToken { | 4191 Token get endToken { |
3611 if (_defaultValue != null) { | 4192 if (_defaultValue != null) { |
3612 return _defaultValue.endToken; | 4193 return _defaultValue.endToken; |
3613 } | 4194 } |
3614 return _parameter.endToken; | 4195 return _parameter.endToken; |
3615 } | 4196 } |
3616 SimpleIdentifier get identifier => _parameter.identifier; | 4197 SimpleIdentifier get identifier => _parameter.identifier; |
3617 ParameterKind get kind => _kind; | 4198 ParameterKind get kind => _kind; |
| 4199 |
3618 /** | 4200 /** |
3619 * Return the formal parameter with which the default value is associated. | 4201 * Return the formal parameter with which the default value is associated. |
3620 * @return the formal parameter with which the default value is associated | 4202 * @return the formal parameter with which the default value is associated |
3621 */ | 4203 */ |
3622 NormalFormalParameter get parameter => _parameter; | 4204 NormalFormalParameter get parameter => _parameter; |
| 4205 |
3623 /** | 4206 /** |
3624 * Return the token separating the parameter from the default value, or {@code
null} if there is | 4207 * Return the token separating the parameter from the default value, or {@code
null} if there is |
3625 * no default value. | 4208 * no default value. |
3626 * @return the token separating the parameter from the default value | 4209 * @return the token separating the parameter from the default value |
3627 */ | 4210 */ |
3628 Token get separator => _separator; | 4211 Token get separator => _separator; |
| 4212 |
3629 /** | 4213 /** |
3630 * Return {@code true} if this parameter was declared with the 'const' modifie
r. | 4214 * Return {@code true} if this parameter was declared with the 'const' modifie
r. |
3631 * @return {@code true} if this parameter was declared with the 'const' modifi
er | 4215 * @return {@code true} if this parameter was declared with the 'const' modifi
er |
3632 */ | 4216 */ |
3633 bool isConst() => _parameter != null && _parameter.isConst(); | 4217 bool isConst() => _parameter != null && _parameter.isConst(); |
| 4218 |
3634 /** | 4219 /** |
3635 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that | 4220 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that |
3636 * are declared with the 'const' modifier will return {@code false} even thoug
h they are | 4221 * are declared with the 'const' modifier will return {@code false} even thoug
h they are |
3637 * implicitly final. | 4222 * implicitly final. |
3638 * @return {@code true} if this parameter was declared with the 'final' modifi
er | 4223 * @return {@code true} if this parameter was declared with the 'final' modifi
er |
3639 */ | 4224 */ |
3640 bool isFinal() => _parameter != null && _parameter.isFinal(); | 4225 bool isFinal() => _parameter != null && _parameter.isFinal(); |
| 4226 |
3641 /** | 4227 /** |
3642 * Set the expression computing the default value for the parameter to the giv
en expression. | 4228 * Set the expression computing the default value for the parameter to the giv
en expression. |
3643 * @param expression the expression computing the default value for the parame
ter | 4229 * @param expression the expression computing the default value for the parame
ter |
3644 */ | 4230 */ |
3645 void set defaultValue(Expression expression) { | 4231 void set defaultValue(Expression expression) { |
3646 _defaultValue = becomeParentOf(expression); | 4232 _defaultValue = becomeParentOf(expression); |
3647 } | 4233 } |
| 4234 |
3648 /** | 4235 /** |
3649 * Set the kind of this parameter to the given kind. | 4236 * Set the kind of this parameter to the given kind. |
3650 * @param kind the kind of this parameter | 4237 * @param kind the kind of this parameter |
3651 */ | 4238 */ |
3652 void set kind(ParameterKind kind2) { | 4239 void set kind(ParameterKind kind2) { |
3653 this._kind = kind2; | 4240 this._kind = kind2; |
3654 } | 4241 } |
| 4242 |
3655 /** | 4243 /** |
3656 * Set the formal parameter with which the default value is associated to the
given parameter. | 4244 * Set the formal parameter with which the default value is associated to the
given parameter. |
3657 * @param formalParameter the formal parameter with which the default value is
associated | 4245 * @param formalParameter the formal parameter with which the default value is
associated |
3658 */ | 4246 */ |
3659 void set parameter(NormalFormalParameter formalParameter) { | 4247 void set parameter(NormalFormalParameter formalParameter) { |
3660 _parameter = becomeParentOf(formalParameter); | 4248 _parameter = becomeParentOf(formalParameter); |
3661 } | 4249 } |
| 4250 |
3662 /** | 4251 /** |
3663 * Set the token separating the parameter from the default value to the given
token. | 4252 * Set the token separating the parameter from the default value to the given
token. |
3664 * @param separator the token separating the parameter from the default value | 4253 * @param separator the token separating the parameter from the default value |
3665 */ | 4254 */ |
3666 void set separator(Token separator2) { | 4255 void set separator(Token separator2) { |
3667 this._separator = separator2; | 4256 this._separator = separator2; |
3668 } | 4257 } |
3669 void visitChildren(ASTVisitor<Object> visitor) { | 4258 void visitChildren(ASTVisitor<Object> visitor) { |
3670 safelyVisitChild(_parameter, visitor); | 4259 safelyVisitChild(_parameter, visitor); |
3671 safelyVisitChild(_defaultValue, visitor); | 4260 safelyVisitChild(_defaultValue, visitor); |
3672 } | 4261 } |
3673 } | 4262 } |
| 4263 |
3674 /** | 4264 /** |
3675 * The abstract class {@code Directive} defines the behavior common to nodes tha
t represent a | 4265 * The abstract class {@code Directive} defines the behavior common to nodes tha
t represent a |
3676 * directive. | 4266 * directive. |
3677 * <pre> | 4267 * <pre> |
3678 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}| {@link LibraryDirective libraryDirective}| {@link PartDirectiv
e partDirective}| {@link PartOfDirective partOfDirective}</pre> | 4268 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}| {@link LibraryDirective libraryDirective}| {@link PartDirectiv
e partDirective}| {@link PartOfDirective partOfDirective}</pre> |
3679 * @coverage dart.engine.ast | 4269 * @coverage dart.engine.ast |
3680 */ | 4270 */ |
3681 abstract class Directive extends AnnotatedNode { | 4271 abstract class Directive extends AnnotatedNode { |
| 4272 |
3682 /** | 4273 /** |
3683 * The element associated with this directive, or {@code null} if the AST stru
cture has not been | 4274 * The element associated with this directive, or {@code null} if the AST stru
cture has not been |
3684 * resolved or if this directive could not be resolved. | 4275 * resolved or if this directive could not be resolved. |
3685 */ | 4276 */ |
3686 Element _element; | 4277 Element _element; |
| 4278 |
3687 /** | 4279 /** |
3688 * Initialize a newly create directive. | 4280 * Initialize a newly create directive. |
3689 * @param comment the documentation comment associated with this directive | 4281 * @param comment the documentation comment associated with this directive |
3690 * @param metadata the annotations associated with the directive | 4282 * @param metadata the annotations associated with the directive |
3691 */ | 4283 */ |
3692 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen
t, metadata) { | 4284 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen
t, metadata) { |
3693 } | 4285 } |
| 4286 |
3694 /** | 4287 /** |
3695 * Initialize a newly create directive. | 4288 * Initialize a newly create directive. |
3696 * @param comment the documentation comment associated with this directive | 4289 * @param comment the documentation comment associated with this directive |
3697 * @param metadata the annotations associated with the directive | 4290 * @param metadata the annotations associated with the directive |
3698 */ | 4291 */ |
3699 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m
etadata); | 4292 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m
etadata); |
| 4293 |
3700 /** | 4294 /** |
3701 * Return the element associated with this directive, or {@code null} if the A
ST structure has not | 4295 * Return the element associated with this directive, or {@code null} if the A
ST structure has not |
3702 * been resolved or if this directive could not be resolved. Examples of the l
atter case include a | 4296 * been resolved or if this directive could not be resolved. Examples of the l
atter case include a |
3703 * directive that contains an invalid URL or a URL that does not exist. | 4297 * directive that contains an invalid URL or a URL that does not exist. |
3704 * @return the element associated with this directive | 4298 * @return the element associated with this directive |
3705 */ | 4299 */ |
3706 Element get element => _element; | 4300 Element get element => _element; |
| 4301 |
3707 /** | 4302 /** |
3708 * Return the token representing the keyword that introduces this directive ('
import', 'export', | 4303 * Return the token representing the keyword that introduces this directive ('
import', 'export', |
3709 * 'library' or 'part'). | 4304 * 'library' or 'part'). |
3710 * @return the token representing the keyword that introduces this directive | 4305 * @return the token representing the keyword that introduces this directive |
3711 */ | 4306 */ |
3712 Token get keyword; | 4307 Token get keyword; |
| 4308 |
3713 /** | 4309 /** |
3714 * Set the element associated with this directive to the given element. | 4310 * Set the element associated with this directive to the given element. |
3715 * @param element the element associated with this directive | 4311 * @param element the element associated with this directive |
3716 */ | 4312 */ |
3717 void set element(Element element2) { | 4313 void set element(Element element2) { |
3718 this._element = element2; | 4314 this._element = element2; |
3719 } | 4315 } |
3720 } | 4316 } |
| 4317 |
3721 /** | 4318 /** |
3722 * Instances of the class {@code DoStatement} represent a do statement. | 4319 * Instances of the class {@code DoStatement} represent a do statement. |
3723 * <pre> | 4320 * <pre> |
3724 * doStatement ::= | 4321 * doStatement ::= |
3725 * 'do' {@link Statement body} 'while' '(' {@link Expression condition} ')' ';' | 4322 * 'do' {@link Statement body} 'while' '(' {@link Expression condition} ')' ';' |
3726 * </pre> | 4323 * </pre> |
3727 * @coverage dart.engine.ast | 4324 * @coverage dart.engine.ast |
3728 */ | 4325 */ |
3729 class DoStatement extends Statement { | 4326 class DoStatement extends Statement { |
| 4327 |
3730 /** | 4328 /** |
3731 * The token representing the 'do' keyword. | 4329 * The token representing the 'do' keyword. |
3732 */ | 4330 */ |
3733 Token _doKeyword; | 4331 Token _doKeyword; |
| 4332 |
3734 /** | 4333 /** |
3735 * The body of the loop. | 4334 * The body of the loop. |
3736 */ | 4335 */ |
3737 Statement _body; | 4336 Statement _body; |
| 4337 |
3738 /** | 4338 /** |
3739 * The token representing the 'while' keyword. | 4339 * The token representing the 'while' keyword. |
3740 */ | 4340 */ |
3741 Token _whileKeyword; | 4341 Token _whileKeyword; |
| 4342 |
3742 /** | 4343 /** |
3743 * The left parenthesis. | 4344 * The left parenthesis. |
3744 */ | 4345 */ |
3745 Token _leftParenthesis; | 4346 Token _leftParenthesis; |
| 4347 |
3746 /** | 4348 /** |
3747 * The condition that determines when the loop will terminate. | 4349 * The condition that determines when the loop will terminate. |
3748 */ | 4350 */ |
3749 Expression _condition; | 4351 Expression _condition; |
| 4352 |
3750 /** | 4353 /** |
3751 * The right parenthesis. | 4354 * The right parenthesis. |
3752 */ | 4355 */ |
3753 Token _rightParenthesis; | 4356 Token _rightParenthesis; |
| 4357 |
3754 /** | 4358 /** |
3755 * The semicolon terminating the statement. | 4359 * The semicolon terminating the statement. |
3756 */ | 4360 */ |
3757 Token _semicolon; | 4361 Token _semicolon; |
| 4362 |
3758 /** | 4363 /** |
3759 * Initialize a newly created do loop. | 4364 * Initialize a newly created do loop. |
3760 * @param doKeyword the token representing the 'do' keyword | 4365 * @param doKeyword the token representing the 'do' keyword |
3761 * @param body the body of the loop | 4366 * @param body the body of the loop |
3762 * @param whileKeyword the token representing the 'while' keyword | 4367 * @param whileKeyword the token representing the 'while' keyword |
3763 * @param leftParenthesis the left parenthesis | 4368 * @param leftParenthesis the left parenthesis |
3764 * @param condition the condition that determines when the loop will terminate | 4369 * @param condition the condition that determines when the loop will terminate |
3765 * @param rightParenthesis the right parenthesis | 4370 * @param rightParenthesis the right parenthesis |
3766 * @param semicolon the semicolon terminating the statement | 4371 * @param semicolon the semicolon terminating the statement |
3767 */ | 4372 */ |
3768 DoStatement.full(Token doKeyword, Statement body, Token whileKeyword, Token le
ftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) { | 4373 DoStatement.full(Token doKeyword, Statement body, Token whileKeyword, Token le
ftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) { |
3769 this._doKeyword = doKeyword; | 4374 this._doKeyword = doKeyword; |
3770 this._body = becomeParentOf(body); | 4375 this._body = becomeParentOf(body); |
3771 this._whileKeyword = whileKeyword; | 4376 this._whileKeyword = whileKeyword; |
3772 this._leftParenthesis = leftParenthesis; | 4377 this._leftParenthesis = leftParenthesis; |
3773 this._condition = becomeParentOf(condition); | 4378 this._condition = becomeParentOf(condition); |
3774 this._rightParenthesis = rightParenthesis; | 4379 this._rightParenthesis = rightParenthesis; |
3775 this._semicolon = semicolon; | 4380 this._semicolon = semicolon; |
3776 } | 4381 } |
| 4382 |
3777 /** | 4383 /** |
3778 * Initialize a newly created do loop. | 4384 * Initialize a newly created do loop. |
3779 * @param doKeyword the token representing the 'do' keyword | 4385 * @param doKeyword the token representing the 'do' keyword |
3780 * @param body the body of the loop | 4386 * @param body the body of the loop |
3781 * @param whileKeyword the token representing the 'while' keyword | 4387 * @param whileKeyword the token representing the 'while' keyword |
3782 * @param leftParenthesis the left parenthesis | 4388 * @param leftParenthesis the left parenthesis |
3783 * @param condition the condition that determines when the loop will terminate | 4389 * @param condition the condition that determines when the loop will terminate |
3784 * @param rightParenthesis the right parenthesis | 4390 * @param rightParenthesis the right parenthesis |
3785 * @param semicolon the semicolon terminating the statement | 4391 * @param semicolon the semicolon terminating the statement |
3786 */ | 4392 */ |
3787 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); | 4393 DoStatement({Token doKeyword, Statement body, Token whileKeyword, Token leftPa
renthesis, Expression condition, Token rightParenthesis, Token semicolon}) : thi
s.full(doKeyword, body, whileKeyword, leftParenthesis, condition, rightParenthes
is, semicolon); |
3788 accept(ASTVisitor visitor) => visitor.visitDoStatement(this); | 4394 accept(ASTVisitor visitor) => visitor.visitDoStatement(this); |
3789 Token get beginToken => _doKeyword; | 4395 Token get beginToken => _doKeyword; |
| 4396 |
3790 /** | 4397 /** |
3791 * Return the body of the loop. | 4398 * Return the body of the loop. |
3792 * @return the body of the loop | 4399 * @return the body of the loop |
3793 */ | 4400 */ |
3794 Statement get body => _body; | 4401 Statement get body => _body; |
| 4402 |
3795 /** | 4403 /** |
3796 * Return the condition that determines when the loop will terminate. | 4404 * Return the condition that determines when the loop will terminate. |
3797 * @return the condition that determines when the loop will terminate | 4405 * @return the condition that determines when the loop will terminate |
3798 */ | 4406 */ |
3799 Expression get condition => _condition; | 4407 Expression get condition => _condition; |
| 4408 |
3800 /** | 4409 /** |
3801 * Return the token representing the 'do' keyword. | 4410 * Return the token representing the 'do' keyword. |
3802 * @return the token representing the 'do' keyword | 4411 * @return the token representing the 'do' keyword |
3803 */ | 4412 */ |
3804 Token get doKeyword => _doKeyword; | 4413 Token get doKeyword => _doKeyword; |
3805 Token get endToken => _semicolon; | 4414 Token get endToken => _semicolon; |
| 4415 |
3806 /** | 4416 /** |
3807 * Return the left parenthesis. | 4417 * Return the left parenthesis. |
3808 * @return the left parenthesis | 4418 * @return the left parenthesis |
3809 */ | 4419 */ |
3810 Token get leftParenthesis => _leftParenthesis; | 4420 Token get leftParenthesis => _leftParenthesis; |
| 4421 |
3811 /** | 4422 /** |
3812 * Return the right parenthesis. | 4423 * Return the right parenthesis. |
3813 * @return the right parenthesis | 4424 * @return the right parenthesis |
3814 */ | 4425 */ |
3815 Token get rightParenthesis => _rightParenthesis; | 4426 Token get rightParenthesis => _rightParenthesis; |
| 4427 |
3816 /** | 4428 /** |
3817 * Return the semicolon terminating the statement. | 4429 * Return the semicolon terminating the statement. |
3818 * @return the semicolon terminating the statement | 4430 * @return the semicolon terminating the statement |
3819 */ | 4431 */ |
3820 Token get semicolon => _semicolon; | 4432 Token get semicolon => _semicolon; |
| 4433 |
3821 /** | 4434 /** |
3822 * Return the token representing the 'while' keyword. | 4435 * Return the token representing the 'while' keyword. |
3823 * @return the token representing the 'while' keyword | 4436 * @return the token representing the 'while' keyword |
3824 */ | 4437 */ |
3825 Token get whileKeyword => _whileKeyword; | 4438 Token get whileKeyword => _whileKeyword; |
| 4439 |
3826 /** | 4440 /** |
3827 * Set the body of the loop to the given statement. | 4441 * Set the body of the loop to the given statement. |
3828 * @param statement the body of the loop | 4442 * @param statement the body of the loop |
3829 */ | 4443 */ |
3830 void set body(Statement statement) { | 4444 void set body(Statement statement) { |
3831 _body = becomeParentOf(statement); | 4445 _body = becomeParentOf(statement); |
3832 } | 4446 } |
| 4447 |
3833 /** | 4448 /** |
3834 * Set the condition that determines when the loop will terminate to the given
expression. | 4449 * Set the condition that determines when the loop will terminate to the given
expression. |
3835 * @param expression the condition that determines when the loop will terminat
e | 4450 * @param expression the condition that determines when the loop will terminat
e |
3836 */ | 4451 */ |
3837 void set condition(Expression expression) { | 4452 void set condition(Expression expression) { |
3838 _condition = becomeParentOf(expression); | 4453 _condition = becomeParentOf(expression); |
3839 } | 4454 } |
| 4455 |
3840 /** | 4456 /** |
3841 * Set the token representing the 'do' keyword to the given token. | 4457 * Set the token representing the 'do' keyword to the given token. |
3842 * @param doKeyword the token representing the 'do' keyword | 4458 * @param doKeyword the token representing the 'do' keyword |
3843 */ | 4459 */ |
3844 void set doKeyword(Token doKeyword2) { | 4460 void set doKeyword(Token doKeyword2) { |
3845 this._doKeyword = doKeyword2; | 4461 this._doKeyword = doKeyword2; |
3846 } | 4462 } |
| 4463 |
3847 /** | 4464 /** |
3848 * Set the left parenthesis to the given token. | 4465 * Set the left parenthesis to the given token. |
3849 * @param parenthesis the left parenthesis | 4466 * @param parenthesis the left parenthesis |
3850 */ | 4467 */ |
3851 void set leftParenthesis(Token parenthesis) { | 4468 void set leftParenthesis(Token parenthesis) { |
3852 _leftParenthesis = parenthesis; | 4469 _leftParenthesis = parenthesis; |
3853 } | 4470 } |
| 4471 |
3854 /** | 4472 /** |
3855 * Set the right parenthesis to the given token. | 4473 * Set the right parenthesis to the given token. |
3856 * @param parenthesis the right parenthesis | 4474 * @param parenthesis the right parenthesis |
3857 */ | 4475 */ |
3858 void set rightParenthesis(Token parenthesis) { | 4476 void set rightParenthesis(Token parenthesis) { |
3859 _rightParenthesis = parenthesis; | 4477 _rightParenthesis = parenthesis; |
3860 } | 4478 } |
| 4479 |
3861 /** | 4480 /** |
3862 * Set the semicolon terminating the statement to the given token. | 4481 * Set the semicolon terminating the statement to the given token. |
3863 * @param semicolon the semicolon terminating the statement | 4482 * @param semicolon the semicolon terminating the statement |
3864 */ | 4483 */ |
3865 void set semicolon(Token semicolon2) { | 4484 void set semicolon(Token semicolon2) { |
3866 this._semicolon = semicolon2; | 4485 this._semicolon = semicolon2; |
3867 } | 4486 } |
| 4487 |
3868 /** | 4488 /** |
3869 * Set the token representing the 'while' keyword to the given token. | 4489 * Set the token representing the 'while' keyword to the given token. |
3870 * @param whileKeyword the token representing the 'while' keyword | 4490 * @param whileKeyword the token representing the 'while' keyword |
3871 */ | 4491 */ |
3872 void set whileKeyword(Token whileKeyword2) { | 4492 void set whileKeyword(Token whileKeyword2) { |
3873 this._whileKeyword = whileKeyword2; | 4493 this._whileKeyword = whileKeyword2; |
3874 } | 4494 } |
3875 void visitChildren(ASTVisitor<Object> visitor) { | 4495 void visitChildren(ASTVisitor<Object> visitor) { |
3876 safelyVisitChild(_body, visitor); | 4496 safelyVisitChild(_body, visitor); |
3877 safelyVisitChild(_condition, visitor); | 4497 safelyVisitChild(_condition, visitor); |
3878 } | 4498 } |
3879 } | 4499 } |
| 4500 |
3880 /** | 4501 /** |
3881 * Instances of the class {@code DoubleLiteral} represent a floating point liter
al expression. | 4502 * Instances of the class {@code DoubleLiteral} represent a floating point liter
al expression. |
3882 * <pre> | 4503 * <pre> |
3883 * doubleLiteral ::= | 4504 * doubleLiteral ::= |
3884 * decimalDigit+ ('.' decimalDigit*)? exponent? | 4505 * decimalDigit+ ('.' decimalDigit*)? exponent? |
3885 * | '.' decimalDigit+ exponent? | 4506 * | '.' decimalDigit+ exponent? |
3886 * exponent ::= | 4507 * exponent ::= |
3887 * ('e' | 'E') ('+' | '-')? decimalDigit+ | 4508 * ('e' | 'E') ('+' | '-')? decimalDigit+ |
3888 * </pre> | 4509 * </pre> |
3889 * @coverage dart.engine.ast | 4510 * @coverage dart.engine.ast |
3890 */ | 4511 */ |
3891 class DoubleLiteral extends Literal { | 4512 class DoubleLiteral extends Literal { |
| 4513 |
3892 /** | 4514 /** |
3893 * The token representing the literal. | 4515 * The token representing the literal. |
3894 */ | 4516 */ |
3895 Token _literal; | 4517 Token _literal; |
| 4518 |
3896 /** | 4519 /** |
3897 * The value of the literal. | 4520 * The value of the literal. |
3898 */ | 4521 */ |
3899 double _value = 0.0; | 4522 double _value = 0.0; |
| 4523 |
3900 /** | 4524 /** |
3901 * Initialize a newly created floating point literal. | 4525 * Initialize a newly created floating point literal. |
3902 * @param literal the token representing the literal | 4526 * @param literal the token representing the literal |
3903 * @param value the value of the literal | 4527 * @param value the value of the literal |
3904 */ | 4528 */ |
3905 DoubleLiteral.full(Token literal, double value) { | 4529 DoubleLiteral.full(Token literal, double value) { |
3906 this._literal = literal; | 4530 this._literal = literal; |
3907 this._value = value; | 4531 this._value = value; |
3908 } | 4532 } |
| 4533 |
3909 /** | 4534 /** |
3910 * Initialize a newly created floating point literal. | 4535 * Initialize a newly created floating point literal. |
3911 * @param literal the token representing the literal | 4536 * @param literal the token representing the literal |
3912 * @param value the value of the literal | 4537 * @param value the value of the literal |
3913 */ | 4538 */ |
3914 DoubleLiteral({Token literal, double value}) : this.full(literal, value); | 4539 DoubleLiteral({Token literal, double value}) : this.full(literal, value); |
3915 accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this); | 4540 accept(ASTVisitor visitor) => visitor.visitDoubleLiteral(this); |
3916 Token get beginToken => _literal; | 4541 Token get beginToken => _literal; |
3917 Token get endToken => _literal; | 4542 Token get endToken => _literal; |
| 4543 |
3918 /** | 4544 /** |
3919 * Return the token representing the literal. | 4545 * Return the token representing the literal. |
3920 * @return the token representing the literal | 4546 * @return the token representing the literal |
3921 */ | 4547 */ |
3922 Token get literal => _literal; | 4548 Token get literal => _literal; |
| 4549 |
3923 /** | 4550 /** |
3924 * Return the value of the literal. | 4551 * Return the value of the literal. |
3925 * @return the value of the literal | 4552 * @return the value of the literal |
3926 */ | 4553 */ |
3927 double get value => _value; | 4554 double get value => _value; |
| 4555 |
3928 /** | 4556 /** |
3929 * Set the token representing the literal to the given token. | 4557 * Set the token representing the literal to the given token. |
3930 * @param literal the token representing the literal | 4558 * @param literal the token representing the literal |
3931 */ | 4559 */ |
3932 void set literal(Token literal2) { | 4560 void set literal(Token literal2) { |
3933 this._literal = literal2; | 4561 this._literal = literal2; |
3934 } | 4562 } |
| 4563 |
3935 /** | 4564 /** |
3936 * Set the value of the literal to the given value. | 4565 * Set the value of the literal to the given value. |
3937 * @param value the value of the literal | 4566 * @param value the value of the literal |
3938 */ | 4567 */ |
3939 void set value(double value2) { | 4568 void set value(double value2) { |
3940 this._value = value2; | 4569 this._value = value2; |
3941 } | 4570 } |
3942 void visitChildren(ASTVisitor<Object> visitor) { | 4571 void visitChildren(ASTVisitor<Object> visitor) { |
3943 } | 4572 } |
3944 } | 4573 } |
| 4574 |
3945 /** | 4575 /** |
3946 * Instances of the class {@code EmptyFunctionBody} represent an empty function
body, which can only | 4576 * Instances of the class {@code EmptyFunctionBody} represent an empty function
body, which can only |
3947 * appear in constructors or abstract methods. | 4577 * appear in constructors or abstract methods. |
3948 * <pre> | 4578 * <pre> |
3949 * emptyFunctionBody ::= | 4579 * emptyFunctionBody ::= |
3950 * ';' | 4580 * ';' |
3951 * </pre> | 4581 * </pre> |
3952 * @coverage dart.engine.ast | 4582 * @coverage dart.engine.ast |
3953 */ | 4583 */ |
3954 class EmptyFunctionBody extends FunctionBody { | 4584 class EmptyFunctionBody extends FunctionBody { |
| 4585 |
3955 /** | 4586 /** |
3956 * The token representing the semicolon that marks the end of the function bod
y. | 4587 * The token representing the semicolon that marks the end of the function bod
y. |
3957 */ | 4588 */ |
3958 Token _semicolon; | 4589 Token _semicolon; |
| 4590 |
3959 /** | 4591 /** |
3960 * Initialize a newly created function body. | 4592 * Initialize a newly created function body. |
3961 * @param semicolon the token representing the semicolon that marks the end of
the function body | 4593 * @param semicolon the token representing the semicolon that marks the end of
the function body |
3962 */ | 4594 */ |
3963 EmptyFunctionBody.full(Token semicolon) { | 4595 EmptyFunctionBody.full(Token semicolon) { |
3964 this._semicolon = semicolon; | 4596 this._semicolon = semicolon; |
3965 } | 4597 } |
| 4598 |
3966 /** | 4599 /** |
3967 * Initialize a newly created function body. | 4600 * Initialize a newly created function body. |
3968 * @param semicolon the token representing the semicolon that marks the end of
the function body | 4601 * @param semicolon the token representing the semicolon that marks the end of
the function body |
3969 */ | 4602 */ |
3970 EmptyFunctionBody({Token semicolon}) : this.full(semicolon); | 4603 EmptyFunctionBody({Token semicolon}) : this.full(semicolon); |
3971 accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this); | 4604 accept(ASTVisitor visitor) => visitor.visitEmptyFunctionBody(this); |
3972 Token get beginToken => _semicolon; | 4605 Token get beginToken => _semicolon; |
3973 Token get endToken => _semicolon; | 4606 Token get endToken => _semicolon; |
| 4607 |
3974 /** | 4608 /** |
3975 * Return the token representing the semicolon that marks the end of the funct
ion body. | 4609 * Return the token representing the semicolon that marks the end of the funct
ion body. |
3976 * @return the token representing the semicolon that marks the end of the func
tion body | 4610 * @return the token representing the semicolon that marks the end of the func
tion body |
3977 */ | 4611 */ |
3978 Token get semicolon => _semicolon; | 4612 Token get semicolon => _semicolon; |
| 4613 |
3979 /** | 4614 /** |
3980 * Set the token representing the semicolon that marks the end of the function
body to the given | 4615 * Set the token representing the semicolon that marks the end of the function
body to the given |
3981 * token. | 4616 * token. |
3982 * @param semicolon the token representing the semicolon that marks the end of
the function body | 4617 * @param semicolon the token representing the semicolon that marks the end of
the function body |
3983 */ | 4618 */ |
3984 void set semicolon(Token semicolon2) { | 4619 void set semicolon(Token semicolon2) { |
3985 this._semicolon = semicolon2; | 4620 this._semicolon = semicolon2; |
3986 } | 4621 } |
3987 void visitChildren(ASTVisitor<Object> visitor) { | 4622 void visitChildren(ASTVisitor<Object> visitor) { |
3988 } | 4623 } |
3989 } | 4624 } |
| 4625 |
3990 /** | 4626 /** |
3991 * Instances of the class {@code EmptyStatement} represent an empty statement. | 4627 * Instances of the class {@code EmptyStatement} represent an empty statement. |
3992 * <pre> | 4628 * <pre> |
3993 * emptyStatement ::= | 4629 * emptyStatement ::= |
3994 * ';' | 4630 * ';' |
3995 * </pre> | 4631 * </pre> |
3996 * @coverage dart.engine.ast | 4632 * @coverage dart.engine.ast |
3997 */ | 4633 */ |
3998 class EmptyStatement extends Statement { | 4634 class EmptyStatement extends Statement { |
| 4635 |
3999 /** | 4636 /** |
4000 * The semicolon terminating the statement. | 4637 * The semicolon terminating the statement. |
4001 */ | 4638 */ |
4002 Token _semicolon; | 4639 Token _semicolon; |
| 4640 |
4003 /** | 4641 /** |
4004 * Initialize a newly created empty statement. | 4642 * Initialize a newly created empty statement. |
4005 * @param semicolon the semicolon terminating the statement | 4643 * @param semicolon the semicolon terminating the statement |
4006 */ | 4644 */ |
4007 EmptyStatement.full(Token semicolon) { | 4645 EmptyStatement.full(Token semicolon) { |
4008 this._semicolon = semicolon; | 4646 this._semicolon = semicolon; |
4009 } | 4647 } |
| 4648 |
4010 /** | 4649 /** |
4011 * Initialize a newly created empty statement. | 4650 * Initialize a newly created empty statement. |
4012 * @param semicolon the semicolon terminating the statement | 4651 * @param semicolon the semicolon terminating the statement |
4013 */ | 4652 */ |
4014 EmptyStatement({Token semicolon}) : this.full(semicolon); | 4653 EmptyStatement({Token semicolon}) : this.full(semicolon); |
4015 accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this); | 4654 accept(ASTVisitor visitor) => visitor.visitEmptyStatement(this); |
4016 Token get beginToken => _semicolon; | 4655 Token get beginToken => _semicolon; |
4017 Token get endToken => _semicolon; | 4656 Token get endToken => _semicolon; |
| 4657 |
4018 /** | 4658 /** |
4019 * Return the semicolon terminating the statement. | 4659 * Return the semicolon terminating the statement. |
4020 * @return the semicolon terminating the statement | 4660 * @return the semicolon terminating the statement |
4021 */ | 4661 */ |
4022 Token get semicolon => _semicolon; | 4662 Token get semicolon => _semicolon; |
| 4663 |
4023 /** | 4664 /** |
4024 * Set the semicolon terminating the statement to the given token. | 4665 * Set the semicolon terminating the statement to the given token. |
4025 * @param semicolon the semicolon terminating the statement | 4666 * @param semicolon the semicolon terminating the statement |
4026 */ | 4667 */ |
4027 void set semicolon(Token semicolon2) { | 4668 void set semicolon(Token semicolon2) { |
4028 this._semicolon = semicolon2; | 4669 this._semicolon = semicolon2; |
4029 } | 4670 } |
4030 void visitChildren(ASTVisitor<Object> visitor) { | 4671 void visitChildren(ASTVisitor<Object> visitor) { |
4031 } | 4672 } |
4032 } | 4673 } |
| 4674 |
4033 /** | 4675 /** |
4034 * Ephemeral identifiers are created as needed to mimic the presence of an empty
identifier. | 4676 * Ephemeral identifiers are created as needed to mimic the presence of an empty
identifier. |
4035 * @coverage dart.engine.ast | 4677 * @coverage dart.engine.ast |
4036 */ | 4678 */ |
4037 class EphemeralIdentifier extends SimpleIdentifier { | 4679 class EphemeralIdentifier extends SimpleIdentifier { |
4038 EphemeralIdentifier.full(ASTNode parent, int location) : super.full(new Token(
TokenType.IDENTIFIER, location)) { | 4680 EphemeralIdentifier.full(ASTNode parent, int location) : super.full(new Token(
TokenType.IDENTIFIER, location)) { |
4039 parent.becomeParentOf(this); | 4681 parent.becomeParentOf(this); |
4040 } | 4682 } |
4041 EphemeralIdentifier({ASTNode parent, int location}) : this.full(parent, locati
on); | 4683 EphemeralIdentifier({ASTNode parent, int location}) : this.full(parent, locati
on); |
4042 } | 4684 } |
| 4685 |
4043 /** | 4686 /** |
4044 * Instances of the class {@code ExportDirective} represent an export directive. | 4687 * Instances of the class {@code ExportDirective} represent an export directive. |
4045 * <pre> | 4688 * <pre> |
4046 * exportDirective ::={@link Annotation metadata} 'export' {@link StringLiteral
libraryUri} {@link Combinator combinator}* ';' | 4689 * exportDirective ::={@link Annotation metadata} 'export' {@link StringLiteral
libraryUri} {@link Combinator combinator}* ';' |
4047 * </pre> | 4690 * </pre> |
4048 * @coverage dart.engine.ast | 4691 * @coverage dart.engine.ast |
4049 */ | 4692 */ |
4050 class ExportDirective extends NamespaceDirective { | 4693 class ExportDirective extends NamespaceDirective { |
| 4694 |
4051 /** | 4695 /** |
4052 * Initialize a newly created export directive. | 4696 * Initialize a newly created export directive. |
4053 * @param comment the documentation comment associated with this directive | 4697 * @param comment the documentation comment associated with this directive |
4054 * @param metadata the annotations associated with the directive | 4698 * @param metadata the annotations associated with the directive |
4055 * @param keyword the token representing the 'export' keyword | 4699 * @param keyword the token representing the 'export' keyword |
4056 * @param libraryUri the URI of the library being exported | 4700 * @param libraryUri the URI of the library being exported |
4057 * @param combinators the combinators used to control which names are exported | 4701 * @param combinators the combinators used to control which names are exported |
4058 * @param semicolon the semicolon terminating the directive | 4702 * @param semicolon the semicolon terminating the directive |
4059 */ | 4703 */ |
4060 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) { | 4704 ExportDirective.full(Comment comment, List<Annotation> metadata, Token keyword
, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) : sup
er.full(comment, metadata, keyword, libraryUri, combinators, semicolon) { |
4061 } | 4705 } |
| 4706 |
4062 /** | 4707 /** |
4063 * Initialize a newly created export directive. | 4708 * Initialize a newly created export directive. |
4064 * @param comment the documentation comment associated with this directive | 4709 * @param comment the documentation comment associated with this directive |
4065 * @param metadata the annotations associated with the directive | 4710 * @param metadata the annotations associated with the directive |
4066 * @param keyword the token representing the 'export' keyword | 4711 * @param keyword the token representing the 'export' keyword |
4067 * @param libraryUri the URI of the library being exported | 4712 * @param libraryUri the URI of the library being exported |
4068 * @param combinators the combinators used to control which names are exported | 4713 * @param combinators the combinators used to control which names are exported |
4069 * @param semicolon the semicolon terminating the directive | 4714 * @param semicolon the semicolon terminating the directive |
4070 */ | 4715 */ |
4071 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); | 4716 ExportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : this.f
ull(comment, metadata, keyword, libraryUri, combinators, semicolon); |
4072 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); | 4717 accept(ASTVisitor visitor) => visitor.visitExportDirective(this); |
| 4718 LibraryElement get uriElement { |
| 4719 Element element2 = element; |
| 4720 if (element2 is ExportElement) { |
| 4721 return ((element2 as ExportElement)).exportedLibrary; |
| 4722 } |
| 4723 return null; |
| 4724 } |
4073 void visitChildren(ASTVisitor<Object> visitor) { | 4725 void visitChildren(ASTVisitor<Object> visitor) { |
4074 super.visitChildren(visitor); | 4726 super.visitChildren(visitor); |
4075 combinators.accept(visitor); | 4727 combinators.accept(visitor); |
4076 } | 4728 } |
4077 } | 4729 } |
| 4730 |
4078 /** | 4731 /** |
4079 * Instances of the class {@code Expression} defines the behavior common to node
s that represent an | 4732 * Instances of the class {@code Expression} defines the behavior common to node
s that represent an |
4080 * expression. | 4733 * expression. |
4081 * <pre> | 4734 * <pre> |
4082 * expression ::={@link AssignmentExpression assignmentExpression}| {@link Condi
tionalExpression conditionalExpression} cascadeSection | 4735 * expression ::={@link AssignmentExpression assignmentExpression}| {@link Condi
tionalExpression conditionalExpression} cascadeSection |
4083 * | {@link ThrowExpression throwExpression}</pre> | 4736 * | {@link ThrowExpression throwExpression}</pre> |
4084 * @coverage dart.engine.ast | 4737 * @coverage dart.engine.ast |
4085 */ | 4738 */ |
4086 abstract class Expression extends ASTNode { | 4739 abstract class Expression extends ASTNode { |
| 4740 |
4087 /** | 4741 /** |
4088 * The static type of this expression, or {@code null} if the AST structure ha
s not been resolved. | 4742 * The static type of this expression, or {@code null} if the AST structure ha
s not been resolved. |
4089 */ | 4743 */ |
4090 Type2 _staticType; | 4744 Type2 _staticType; |
| 4745 |
4091 /** | 4746 /** |
4092 * The propagated type of this expression, or {@code null} if type propagation
has not been | 4747 * The propagated type of this expression, or {@code null} if type propagation
has not been |
4093 * performed on the AST structure. | 4748 * performed on the AST structure. |
4094 */ | 4749 */ |
4095 Type2 _propagatedType; | 4750 Type2 _propagatedType; |
| 4751 |
4096 /** | 4752 /** |
4097 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, | 4753 * If this expression is an argument to an invocation, and the AST structure h
as been resolved, |
4098 * and the function being invoked is known, and this expression corresponds to
one of the | 4754 * and the function being invoked is known, and this expression corresponds to
one of the |
4099 * parameters of the function being invoked, then return the parameter element
representing the | 4755 * parameters of the function being invoked, then return the parameter element
representing the |
4100 * parameter to which the value of this expression will be bound. Otherwise, r
eturn {@code null}. | 4756 * parameter to which the value of this expression will be bound. Otherwise, r
eturn {@code null}. |
4101 * @return the parameter element representing the parameter to which the value
of this expression | 4757 * @return the parameter element representing the parameter to which the value
of this expression |
4102 * will be bound | 4758 * will be bound |
4103 */ | 4759 */ |
4104 ParameterElement get parameterElement { | 4760 ParameterElement get parameterElement { |
4105 ASTNode parent2 = parent; | 4761 ASTNode parent2 = parent; |
4106 if (parent2 is ArgumentList) { | 4762 if (parent2 is ArgumentList) { |
4107 return ((parent2 as ArgumentList)).getParameterElementFor(this); | 4763 return ((parent2 as ArgumentList)).getParameterElementFor(this); |
4108 } | 4764 } |
| 4765 if (parent2 is IndexExpression) { |
| 4766 IndexExpression indexExpression = parent2 as IndexExpression; |
| 4767 if (identical(indexExpression.index, this)) { |
| 4768 return indexExpression.parameterElementForIndex; |
| 4769 } |
| 4770 } |
| 4771 if (parent2 is BinaryExpression) { |
| 4772 BinaryExpression binaryExpression = parent2 as BinaryExpression; |
| 4773 if (identical(binaryExpression.rightOperand, this)) { |
| 4774 return binaryExpression.parameterElementForRightOperand; |
| 4775 } |
| 4776 } |
4109 return null; | 4777 return null; |
4110 } | 4778 } |
| 4779 |
4111 /** | 4780 /** |
4112 * Return the propagated type of this expression, or {@code null} if type prop
agation has not been | 4781 * Return the propagated type of this expression, or {@code null} if type prop
agation has not been |
4113 * performed on the AST structure. | 4782 * performed on the AST structure. |
4114 * @return the propagated type of this expression | 4783 * @return the propagated type of this expression |
4115 */ | 4784 */ |
4116 Type2 get propagatedType => _propagatedType; | 4785 Type2 get propagatedType => _propagatedType; |
| 4786 |
4117 /** | 4787 /** |
4118 * Return the static type of this expression, or {@code null} if the AST struc
ture has not been | 4788 * Return the static type of this expression, or {@code null} if the AST struc
ture has not been |
4119 * resolved. | 4789 * resolved. |
4120 * @return the static type of this expression | 4790 * @return the static type of this expression |
4121 */ | 4791 */ |
4122 Type2 get staticType => _staticType; | 4792 Type2 get staticType => _staticType; |
| 4793 |
4123 /** | 4794 /** |
4124 * Return {@code true} if this expression is syntactically valid for the LHS o
f an{@link AssignmentExpression assignment expression}. | 4795 * Return {@code true} if this expression is syntactically valid for the LHS o
f an{@link AssignmentExpression assignment expression}. |
4125 * @return {@code true} if this expression matches the {@code assignableExpres
sion} production | 4796 * @return {@code true} if this expression matches the {@code assignableExpres
sion} production |
4126 */ | 4797 */ |
4127 bool isAssignable() => false; | 4798 bool isAssignable() => false; |
| 4799 |
4128 /** | 4800 /** |
4129 * Set the propagated type of this expression to the given type. | 4801 * Set the propagated type of this expression to the given type. |
4130 * @param propagatedType the propagated type of this expression | 4802 * @param propagatedType the propagated type of this expression |
4131 */ | 4803 */ |
4132 void set propagatedType(Type2 propagatedType2) { | 4804 void set propagatedType(Type2 propagatedType2) { |
4133 this._propagatedType = propagatedType2; | 4805 this._propagatedType = propagatedType2; |
4134 } | 4806 } |
| 4807 |
4135 /** | 4808 /** |
4136 * Set the static type of this expression to the given type. | 4809 * Set the static type of this expression to the given type. |
4137 * @param staticType the static type of this expression | 4810 * @param staticType the static type of this expression |
4138 */ | 4811 */ |
4139 void set staticType(Type2 staticType2) { | 4812 void set staticType(Type2 staticType2) { |
4140 this._staticType = staticType2; | 4813 this._staticType = staticType2; |
4141 } | 4814 } |
4142 } | 4815 } |
| 4816 |
4143 /** | 4817 /** |
4144 * Instances of the class {@code ExpressionFunctionBody} represent a function bo
dy consisting of a | 4818 * Instances of the class {@code ExpressionFunctionBody} represent a function bo
dy consisting of a |
4145 * single expression. | 4819 * single expression. |
4146 * <pre> | 4820 * <pre> |
4147 * expressionFunctionBody ::= | 4821 * expressionFunctionBody ::= |
4148 * '=>' {@link Expression expression} ';' | 4822 * '=>' {@link Expression expression} ';' |
4149 * </pre> | 4823 * </pre> |
4150 * @coverage dart.engine.ast | 4824 * @coverage dart.engine.ast |
4151 */ | 4825 */ |
4152 class ExpressionFunctionBody extends FunctionBody { | 4826 class ExpressionFunctionBody extends FunctionBody { |
| 4827 |
4153 /** | 4828 /** |
4154 * The token introducing the expression that represents the body of the functi
on. | 4829 * The token introducing the expression that represents the body of the functi
on. |
4155 */ | 4830 */ |
4156 Token _functionDefinition; | 4831 Token _functionDefinition; |
| 4832 |
4157 /** | 4833 /** |
4158 * The expression representing the body of the function. | 4834 * The expression representing the body of the function. |
4159 */ | 4835 */ |
4160 Expression _expression; | 4836 Expression _expression; |
| 4837 |
4161 /** | 4838 /** |
4162 * The semicolon terminating the statement. | 4839 * The semicolon terminating the statement. |
4163 */ | 4840 */ |
4164 Token _semicolon; | 4841 Token _semicolon; |
| 4842 |
4165 /** | 4843 /** |
4166 * Initialize a newly created function body consisting of a block of statement
s. | 4844 * Initialize a newly created function body consisting of a block of statement
s. |
4167 * @param functionDefinition the token introducing the expression that represe
nts the body of the | 4845 * @param functionDefinition the token introducing the expression that represe
nts the body of the |
4168 * function | 4846 * function |
4169 * @param expression the expression representing the body of the function | 4847 * @param expression the expression representing the body of the function |
4170 * @param semicolon the semicolon terminating the statement | 4848 * @param semicolon the semicolon terminating the statement |
4171 */ | 4849 */ |
4172 ExpressionFunctionBody.full(Token functionDefinition, Expression expression, T
oken semicolon) { | 4850 ExpressionFunctionBody.full(Token functionDefinition, Expression expression, T
oken semicolon) { |
4173 this._functionDefinition = functionDefinition; | 4851 this._functionDefinition = functionDefinition; |
4174 this._expression = becomeParentOf(expression); | 4852 this._expression = becomeParentOf(expression); |
4175 this._semicolon = semicolon; | 4853 this._semicolon = semicolon; |
4176 } | 4854 } |
| 4855 |
4177 /** | 4856 /** |
4178 * Initialize a newly created function body consisting of a block of statement
s. | 4857 * Initialize a newly created function body consisting of a block of statement
s. |
4179 * @param functionDefinition the token introducing the expression that represe
nts the body of the | 4858 * @param functionDefinition the token introducing the expression that represe
nts the body of the |
4180 * function | 4859 * function |
4181 * @param expression the expression representing the body of the function | 4860 * @param expression the expression representing the body of the function |
4182 * @param semicolon the semicolon terminating the statement | 4861 * @param semicolon the semicolon terminating the statement |
4183 */ | 4862 */ |
4184 ExpressionFunctionBody({Token functionDefinition, Expression expression, Token
semicolon}) : this.full(functionDefinition, expression, semicolon); | 4863 ExpressionFunctionBody({Token functionDefinition, Expression expression, Token
semicolon}) : this.full(functionDefinition, expression, semicolon); |
4185 accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this); | 4864 accept(ASTVisitor visitor) => visitor.visitExpressionFunctionBody(this); |
4186 Token get beginToken => _functionDefinition; | 4865 Token get beginToken => _functionDefinition; |
4187 Token get endToken { | 4866 Token get endToken { |
4188 if (_semicolon != null) { | 4867 if (_semicolon != null) { |
4189 return _semicolon; | 4868 return _semicolon; |
4190 } | 4869 } |
4191 return _expression.endToken; | 4870 return _expression.endToken; |
4192 } | 4871 } |
| 4872 |
4193 /** | 4873 /** |
4194 * Return the expression representing the body of the function. | 4874 * Return the expression representing the body of the function. |
4195 * @return the expression representing the body of the function | 4875 * @return the expression representing the body of the function |
4196 */ | 4876 */ |
4197 Expression get expression => _expression; | 4877 Expression get expression => _expression; |
| 4878 |
4198 /** | 4879 /** |
4199 * Return the token introducing the expression that represents the body of the
function. | 4880 * Return the token introducing the expression that represents the body of the
function. |
4200 * @return the function definition token | 4881 * @return the function definition token |
4201 */ | 4882 */ |
4202 Token get functionDefinition => _functionDefinition; | 4883 Token get functionDefinition => _functionDefinition; |
| 4884 |
4203 /** | 4885 /** |
4204 * Return the semicolon terminating the statement. | 4886 * Return the semicolon terminating the statement. |
4205 * @return the semicolon terminating the statement | 4887 * @return the semicolon terminating the statement |
4206 */ | 4888 */ |
4207 Token get semicolon => _semicolon; | 4889 Token get semicolon => _semicolon; |
| 4890 |
4208 /** | 4891 /** |
4209 * Set the expression representing the body of the function to the given expre
ssion. | 4892 * Set the expression representing the body of the function to the given expre
ssion. |
4210 * @param expression the expression representing the body of the function | 4893 * @param expression the expression representing the body of the function |
4211 */ | 4894 */ |
4212 void set expression(Expression expression2) { | 4895 void set expression(Expression expression2) { |
4213 this._expression = becomeParentOf(expression2); | 4896 this._expression = becomeParentOf(expression2); |
4214 } | 4897 } |
| 4898 |
4215 /** | 4899 /** |
4216 * Set the token introducing the expression that represents the body of the fu
nction to the given | 4900 * Set the token introducing the expression that represents the body of the fu
nction to the given |
4217 * token. | 4901 * token. |
4218 * @param functionDefinition the function definition token | 4902 * @param functionDefinition the function definition token |
4219 */ | 4903 */ |
4220 void set functionDefinition(Token functionDefinition2) { | 4904 void set functionDefinition(Token functionDefinition2) { |
4221 this._functionDefinition = functionDefinition2; | 4905 this._functionDefinition = functionDefinition2; |
4222 } | 4906 } |
| 4907 |
4223 /** | 4908 /** |
4224 * Set the semicolon terminating the statement to the given token. | 4909 * Set the semicolon terminating the statement to the given token. |
4225 * @param semicolon the semicolon terminating the statement | 4910 * @param semicolon the semicolon terminating the statement |
4226 */ | 4911 */ |
4227 void set semicolon(Token semicolon2) { | 4912 void set semicolon(Token semicolon2) { |
4228 this._semicolon = semicolon2; | 4913 this._semicolon = semicolon2; |
4229 } | 4914 } |
4230 void visitChildren(ASTVisitor<Object> visitor) { | 4915 void visitChildren(ASTVisitor<Object> visitor) { |
4231 safelyVisitChild(_expression, visitor); | 4916 safelyVisitChild(_expression, visitor); |
4232 } | 4917 } |
4233 } | 4918 } |
| 4919 |
4234 /** | 4920 /** |
4235 * Instances of the class {@code ExpressionStatement} wrap an expression as a st
atement. | 4921 * Instances of the class {@code ExpressionStatement} wrap an expression as a st
atement. |
4236 * <pre> | 4922 * <pre> |
4237 * expressionStatement ::={@link Expression expression}? ';' | 4923 * expressionStatement ::={@link Expression expression}? ';' |
4238 * </pre> | 4924 * </pre> |
4239 * @coverage dart.engine.ast | 4925 * @coverage dart.engine.ast |
4240 */ | 4926 */ |
4241 class ExpressionStatement extends Statement { | 4927 class ExpressionStatement extends Statement { |
| 4928 |
4242 /** | 4929 /** |
4243 * The expression that comprises the statement. | 4930 * The expression that comprises the statement. |
4244 */ | 4931 */ |
4245 Expression _expression; | 4932 Expression _expression; |
| 4933 |
4246 /** | 4934 /** |
4247 * The semicolon terminating the statement, or {@code null} if the expression
is a function | 4935 * The semicolon terminating the statement, or {@code null} if the expression
is a function |
4248 * expression and isn't followed by a semicolon. | 4936 * expression and isn't followed by a semicolon. |
4249 */ | 4937 */ |
4250 Token _semicolon; | 4938 Token _semicolon; |
| 4939 |
4251 /** | 4940 /** |
4252 * Initialize a newly created expression statement. | 4941 * Initialize a newly created expression statement. |
4253 * @param expression the expression that comprises the statement | 4942 * @param expression the expression that comprises the statement |
4254 * @param semicolon the semicolon terminating the statement | 4943 * @param semicolon the semicolon terminating the statement |
4255 */ | 4944 */ |
4256 ExpressionStatement.full(Expression expression, Token semicolon) { | 4945 ExpressionStatement.full(Expression expression, Token semicolon) { |
4257 this._expression = becomeParentOf(expression); | 4946 this._expression = becomeParentOf(expression); |
4258 this._semicolon = semicolon; | 4947 this._semicolon = semicolon; |
4259 } | 4948 } |
| 4949 |
4260 /** | 4950 /** |
4261 * Initialize a newly created expression statement. | 4951 * Initialize a newly created expression statement. |
4262 * @param expression the expression that comprises the statement | 4952 * @param expression the expression that comprises the statement |
4263 * @param semicolon the semicolon terminating the statement | 4953 * @param semicolon the semicolon terminating the statement |
4264 */ | 4954 */ |
4265 ExpressionStatement({Expression expression, Token semicolon}) : this.full(expr
ession, semicolon); | 4955 ExpressionStatement({Expression expression, Token semicolon}) : this.full(expr
ession, semicolon); |
4266 accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this); | 4956 accept(ASTVisitor visitor) => visitor.visitExpressionStatement(this); |
4267 Token get beginToken => _expression.beginToken; | 4957 Token get beginToken => _expression.beginToken; |
4268 Token get endToken { | 4958 Token get endToken { |
4269 if (_semicolon != null) { | 4959 if (_semicolon != null) { |
4270 return _semicolon; | 4960 return _semicolon; |
4271 } | 4961 } |
4272 return _expression.endToken; | 4962 return _expression.endToken; |
4273 } | 4963 } |
| 4964 |
4274 /** | 4965 /** |
4275 * Return the expression that comprises the statement. | 4966 * Return the expression that comprises the statement. |
4276 * @return the expression that comprises the statement | 4967 * @return the expression that comprises the statement |
4277 */ | 4968 */ |
4278 Expression get expression => _expression; | 4969 Expression get expression => _expression; |
| 4970 |
4279 /** | 4971 /** |
4280 * Return the semicolon terminating the statement. | 4972 * Return the semicolon terminating the statement. |
4281 * @return the semicolon terminating the statement | 4973 * @return the semicolon terminating the statement |
4282 */ | 4974 */ |
4283 Token get semicolon => _semicolon; | 4975 Token get semicolon => _semicolon; |
4284 bool isSynthetic() => _expression.isSynthetic() && _semicolon.isSynthetic(); | 4976 bool isSynthetic() => _expression.isSynthetic() && _semicolon.isSynthetic(); |
| 4977 |
4285 /** | 4978 /** |
4286 * Set the expression that comprises the statement to the given expression. | 4979 * Set the expression that comprises the statement to the given expression. |
4287 * @param expression the expression that comprises the statement | 4980 * @param expression the expression that comprises the statement |
4288 */ | 4981 */ |
4289 void set expression(Expression expression2) { | 4982 void set expression(Expression expression2) { |
4290 this._expression = becomeParentOf(expression2); | 4983 this._expression = becomeParentOf(expression2); |
4291 } | 4984 } |
| 4985 |
4292 /** | 4986 /** |
4293 * Set the semicolon terminating the statement to the given token. | 4987 * Set the semicolon terminating the statement to the given token. |
4294 * @param semicolon the semicolon terminating the statement | 4988 * @param semicolon the semicolon terminating the statement |
4295 */ | 4989 */ |
4296 void set semicolon(Token semicolon2) { | 4990 void set semicolon(Token semicolon2) { |
4297 this._semicolon = semicolon2; | 4991 this._semicolon = semicolon2; |
4298 } | 4992 } |
4299 void visitChildren(ASTVisitor<Object> visitor) { | 4993 void visitChildren(ASTVisitor<Object> visitor) { |
4300 safelyVisitChild(_expression, visitor); | 4994 safelyVisitChild(_expression, visitor); |
4301 } | 4995 } |
4302 } | 4996 } |
| 4997 |
4303 /** | 4998 /** |
4304 * Instances of the class {@code ExtendsClause} represent the "extends" clause i
n a class | 4999 * Instances of the class {@code ExtendsClause} represent the "extends" clause i
n a class |
4305 * declaration. | 5000 * declaration. |
4306 * <pre> | 5001 * <pre> |
4307 * extendsClause ::= | 5002 * extendsClause ::= |
4308 * 'extends' {@link TypeName superclass}</pre> | 5003 * 'extends' {@link TypeName superclass}</pre> |
4309 * @coverage dart.engine.ast | 5004 * @coverage dart.engine.ast |
4310 */ | 5005 */ |
4311 class ExtendsClause extends ASTNode { | 5006 class ExtendsClause extends ASTNode { |
| 5007 |
4312 /** | 5008 /** |
4313 * The token representing the 'extends' keyword. | 5009 * The token representing the 'extends' keyword. |
4314 */ | 5010 */ |
4315 Token _keyword; | 5011 Token _keyword; |
| 5012 |
4316 /** | 5013 /** |
4317 * The name of the class that is being extended. | 5014 * The name of the class that is being extended. |
4318 */ | 5015 */ |
4319 TypeName _superclass; | 5016 TypeName _superclass; |
| 5017 |
4320 /** | 5018 /** |
4321 * Initialize a newly created extends clause. | 5019 * Initialize a newly created extends clause. |
4322 * @param keyword the token representing the 'extends' keyword | 5020 * @param keyword the token representing the 'extends' keyword |
4323 * @param superclass the name of the class that is being extended | 5021 * @param superclass the name of the class that is being extended |
4324 */ | 5022 */ |
4325 ExtendsClause.full(Token keyword, TypeName superclass) { | 5023 ExtendsClause.full(Token keyword, TypeName superclass) { |
4326 this._keyword = keyword; | 5024 this._keyword = keyword; |
4327 this._superclass = becomeParentOf(superclass); | 5025 this._superclass = becomeParentOf(superclass); |
4328 } | 5026 } |
| 5027 |
4329 /** | 5028 /** |
4330 * Initialize a newly created extends clause. | 5029 * Initialize a newly created extends clause. |
4331 * @param keyword the token representing the 'extends' keyword | 5030 * @param keyword the token representing the 'extends' keyword |
4332 * @param superclass the name of the class that is being extended | 5031 * @param superclass the name of the class that is being extended |
4333 */ | 5032 */ |
4334 ExtendsClause({Token keyword, TypeName superclass}) : this.full(keyword, super
class); | 5033 ExtendsClause({Token keyword, TypeName superclass}) : this.full(keyword, super
class); |
4335 accept(ASTVisitor visitor) => visitor.visitExtendsClause(this); | 5034 accept(ASTVisitor visitor) => visitor.visitExtendsClause(this); |
4336 Token get beginToken => _keyword; | 5035 Token get beginToken => _keyword; |
4337 Token get endToken => _superclass.endToken; | 5036 Token get endToken => _superclass.endToken; |
| 5037 |
4338 /** | 5038 /** |
4339 * Return the token representing the 'extends' keyword. | 5039 * Return the token representing the 'extends' keyword. |
4340 * @return the token representing the 'extends' keyword | 5040 * @return the token representing the 'extends' keyword |
4341 */ | 5041 */ |
4342 Token get keyword => _keyword; | 5042 Token get keyword => _keyword; |
| 5043 |
4343 /** | 5044 /** |
4344 * Return the name of the class that is being extended. | 5045 * Return the name of the class that is being extended. |
4345 * @return the name of the class that is being extended | 5046 * @return the name of the class that is being extended |
4346 */ | 5047 */ |
4347 TypeName get superclass => _superclass; | 5048 TypeName get superclass => _superclass; |
| 5049 |
4348 /** | 5050 /** |
4349 * Set the token representing the 'extends' keyword to the given token. | 5051 * Set the token representing the 'extends' keyword to the given token. |
4350 * @param keyword the token representing the 'extends' keyword | 5052 * @param keyword the token representing the 'extends' keyword |
4351 */ | 5053 */ |
4352 void set keyword(Token keyword2) { | 5054 void set keyword(Token keyword2) { |
4353 this._keyword = keyword2; | 5055 this._keyword = keyword2; |
4354 } | 5056 } |
| 5057 |
4355 /** | 5058 /** |
4356 * Set the name of the class that is being extended to the given name. | 5059 * Set the name of the class that is being extended to the given name. |
4357 * @param name the name of the class that is being extended | 5060 * @param name the name of the class that is being extended |
4358 */ | 5061 */ |
4359 void set superclass(TypeName name) { | 5062 void set superclass(TypeName name) { |
4360 _superclass = becomeParentOf(name); | 5063 _superclass = becomeParentOf(name); |
4361 } | 5064 } |
4362 void visitChildren(ASTVisitor<Object> visitor) { | 5065 void visitChildren(ASTVisitor<Object> visitor) { |
4363 safelyVisitChild(_superclass, visitor); | 5066 safelyVisitChild(_superclass, visitor); |
4364 } | 5067 } |
4365 } | 5068 } |
| 5069 |
4366 /** | 5070 /** |
4367 * Instances of the class {@code FieldDeclaration} represent the declaration of
one or more fields | 5071 * Instances of the class {@code FieldDeclaration} represent the declaration of
one or more fields |
4368 * of the same type. | 5072 * of the same type. |
4369 * <pre> | 5073 * <pre> |
4370 * fieldDeclaration ::= | 5074 * fieldDeclaration ::= |
4371 * 'static'? {@link VariableDeclarationList fieldList} ';' | 5075 * 'static'? {@link VariableDeclarationList fieldList} ';' |
4372 * </pre> | 5076 * </pre> |
4373 * @coverage dart.engine.ast | 5077 * @coverage dart.engine.ast |
4374 */ | 5078 */ |
4375 class FieldDeclaration extends ClassMember { | 5079 class FieldDeclaration extends ClassMember { |
| 5080 |
4376 /** | 5081 /** |
4377 * The token representing the 'static' keyword, or {@code null} if the fields
are not static. | 5082 * The token representing the 'static' keyword, or {@code null} if the fields
are not static. |
4378 */ | 5083 */ |
4379 Token _keyword; | 5084 Token _keyword; |
| 5085 |
4380 /** | 5086 /** |
4381 * The fields being declared. | 5087 * The fields being declared. |
4382 */ | 5088 */ |
4383 VariableDeclarationList _fieldList; | 5089 VariableDeclarationList _fieldList; |
| 5090 |
4384 /** | 5091 /** |
4385 * The semicolon terminating the declaration. | 5092 * The semicolon terminating the declaration. |
4386 */ | 5093 */ |
4387 Token _semicolon; | 5094 Token _semicolon; |
| 5095 |
4388 /** | 5096 /** |
4389 * Initialize a newly created field declaration. | 5097 * Initialize a newly created field declaration. |
4390 * @param comment the documentation comment associated with this field | 5098 * @param comment the documentation comment associated with this field |
4391 * @param metadata the annotations associated with this field | 5099 * @param metadata the annotations associated with this field |
4392 * @param keyword the token representing the 'static' keyword | 5100 * @param keyword the token representing the 'static' keyword |
4393 * @param fieldList the fields being declared | 5101 * @param fieldList the fields being declared |
4394 * @param semicolon the semicolon terminating the declaration | 5102 * @param semicolon the semicolon terminating the declaration |
4395 */ | 5103 */ |
4396 FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token keywor
d, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, met
adata) { | 5104 FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token keywor
d, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, met
adata) { |
4397 this._keyword = keyword; | 5105 this._keyword = keyword; |
4398 this._fieldList = becomeParentOf(fieldList); | 5106 this._fieldList = becomeParentOf(fieldList); |
4399 this._semicolon = semicolon; | 5107 this._semicolon = semicolon; |
4400 } | 5108 } |
| 5109 |
4401 /** | 5110 /** |
4402 * Initialize a newly created field declaration. | 5111 * Initialize a newly created field declaration. |
4403 * @param comment the documentation comment associated with this field | 5112 * @param comment the documentation comment associated with this field |
4404 * @param metadata the annotations associated with this field | 5113 * @param metadata the annotations associated with this field |
4405 * @param keyword the token representing the 'static' keyword | 5114 * @param keyword the token representing the 'static' keyword |
4406 * @param fieldList the fields being declared | 5115 * @param fieldList the fields being declared |
4407 * @param semicolon the semicolon terminating the declaration | 5116 * @param semicolon the semicolon terminating the declaration |
4408 */ | 5117 */ |
4409 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V
ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat
a, keyword, fieldList, semicolon); | 5118 FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, V
ariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadat
a, keyword, fieldList, semicolon); |
4410 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); | 5119 accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this); |
4411 Element get element => null; | 5120 Element get element => null; |
4412 Token get endToken => _semicolon; | 5121 Token get endToken => _semicolon; |
| 5122 |
4413 /** | 5123 /** |
4414 * Return the fields being declared. | 5124 * Return the fields being declared. |
4415 * @return the fields being declared | 5125 * @return the fields being declared |
4416 */ | 5126 */ |
4417 VariableDeclarationList get fields => _fieldList; | 5127 VariableDeclarationList get fields => _fieldList; |
| 5128 |
4418 /** | 5129 /** |
4419 * Return the token representing the 'static' keyword, or {@code null} if the
fields are not | 5130 * Return the token representing the 'static' keyword, or {@code null} if the
fields are not |
4420 * static. | 5131 * static. |
4421 * @return the token representing the 'static' keyword | 5132 * @return the token representing the 'static' keyword |
4422 */ | 5133 */ |
4423 Token get keyword => _keyword; | 5134 Token get keyword => _keyword; |
| 5135 |
4424 /** | 5136 /** |
4425 * Return the semicolon terminating the declaration. | 5137 * Return the semicolon terminating the declaration. |
4426 * @return the semicolon terminating the declaration | 5138 * @return the semicolon terminating the declaration |
4427 */ | 5139 */ |
4428 Token get semicolon => _semicolon; | 5140 Token get semicolon => _semicolon; |
| 5141 |
| 5142 /** |
| 5143 * Return {@code true} if the fields are static. |
| 5144 * @return {@code true} if the fields are declared to be static |
| 5145 */ |
| 5146 bool isStatic() => _keyword != null; |
| 5147 |
4429 /** | 5148 /** |
4430 * Set the fields being declared to the given list of variables. | 5149 * Set the fields being declared to the given list of variables. |
4431 * @param fieldList the fields being declared | 5150 * @param fieldList the fields being declared |
4432 */ | 5151 */ |
4433 void set fields(VariableDeclarationList fieldList) { | 5152 void set fields(VariableDeclarationList fieldList) { |
4434 fieldList = becomeParentOf(fieldList); | 5153 fieldList = becomeParentOf(fieldList); |
4435 } | 5154 } |
| 5155 |
4436 /** | 5156 /** |
4437 * Set the token representing the 'static' keyword to the given token. | 5157 * Set the token representing the 'static' keyword to the given token. |
4438 * @param keyword the token representing the 'static' keyword | 5158 * @param keyword the token representing the 'static' keyword |
4439 */ | 5159 */ |
4440 void set keyword(Token keyword2) { | 5160 void set keyword(Token keyword2) { |
4441 this._keyword = keyword2; | 5161 this._keyword = keyword2; |
4442 } | 5162 } |
| 5163 |
4443 /** | 5164 /** |
4444 * Set the semicolon terminating the declaration to the given token. | 5165 * Set the semicolon terminating the declaration to the given token. |
4445 * @param semicolon the semicolon terminating the declaration | 5166 * @param semicolon the semicolon terminating the declaration |
4446 */ | 5167 */ |
4447 void set semicolon(Token semicolon2) { | 5168 void set semicolon(Token semicolon2) { |
4448 this._semicolon = semicolon2; | 5169 this._semicolon = semicolon2; |
4449 } | 5170 } |
4450 void visitChildren(ASTVisitor<Object> visitor) { | 5171 void visitChildren(ASTVisitor<Object> visitor) { |
4451 super.visitChildren(visitor); | 5172 super.visitChildren(visitor); |
4452 safelyVisitChild(_fieldList, visitor); | 5173 safelyVisitChild(_fieldList, visitor); |
4453 } | 5174 } |
4454 Token get firstTokenAfterCommentAndMetadata { | 5175 Token get firstTokenAfterCommentAndMetadata { |
4455 if (_keyword != null) { | 5176 if (_keyword != null) { |
4456 return _keyword; | 5177 return _keyword; |
4457 } | 5178 } |
4458 return _fieldList.beginToken; | 5179 return _fieldList.beginToken; |
4459 } | 5180 } |
4460 } | 5181 } |
| 5182 |
4461 /** | 5183 /** |
4462 * Instances of the class {@code FieldFormalParameter} represent a field formal
parameter. | 5184 * Instances of the class {@code FieldFormalParameter} represent a field formal
parameter. |
4463 * <pre> | 5185 * <pre> |
4464 * fieldFormalParameter ::= | 5186 * fieldFormalParameter ::= |
4465 * ('final' {@link TypeName type} | 'const' {@link TypeName type} | 'var' | {@li
nk TypeName type})? 'this' '.' {@link SimpleIdentifier identifier}</pre> | 5187 * ('final' {@link TypeName type} | 'const' {@link TypeName type} | 'var' | {@li
nk TypeName type})? 'this' '.' {@link SimpleIdentifier identifier}</pre> |
4466 * @coverage dart.engine.ast | 5188 * @coverage dart.engine.ast |
4467 */ | 5189 */ |
4468 class FieldFormalParameter extends NormalFormalParameter { | 5190 class FieldFormalParameter extends NormalFormalParameter { |
| 5191 |
4469 /** | 5192 /** |
4470 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 5193 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
4471 * keyword was used. | 5194 * keyword was used. |
4472 */ | 5195 */ |
4473 Token _keyword; | 5196 Token _keyword; |
| 5197 |
4474 /** | 5198 /** |
4475 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have | 5199 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have |
4476 * a declared type. | 5200 * a declared type. |
4477 */ | 5201 */ |
4478 TypeName _type; | 5202 TypeName _type; |
| 5203 |
4479 /** | 5204 /** |
4480 * The token representing the 'this' keyword. | 5205 * The token representing the 'this' keyword. |
4481 */ | 5206 */ |
4482 Token _thisToken; | 5207 Token _thisToken; |
| 5208 |
4483 /** | 5209 /** |
4484 * The token representing the period. | 5210 * The token representing the period. |
4485 */ | 5211 */ |
4486 Token _period; | 5212 Token _period; |
| 5213 |
4487 /** | 5214 /** |
4488 * Initialize a newly created formal parameter. | 5215 * Initialize a newly created formal parameter. |
4489 * @param comment the documentation comment associated with this parameter | 5216 * @param comment the documentation comment associated with this parameter |
4490 * @param metadata the annotations associated with this parameter | 5217 * @param metadata the annotations associated with this parameter |
4491 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5218 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
4492 * @param type the name of the declared type of the parameter | 5219 * @param type the name of the declared type of the parameter |
4493 * @param thisToken the token representing the 'this' keyword | 5220 * @param thisToken the token representing the 'this' keyword |
4494 * @param period the token representing the period | 5221 * @param period the token representing the period |
4495 * @param identifier the name of the parameter being declared | 5222 * @param identifier the name of the parameter being declared |
4496 */ | 5223 */ |
4497 FieldFormalParameter.full(Comment comment, List<Annotation> metadata, Token ke
yword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier
) : super.full(comment, metadata, identifier) { | 5224 FieldFormalParameter.full(Comment comment, List<Annotation> metadata, Token ke
yword, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier
) : super.full(comment, metadata, identifier) { |
4498 this._keyword = keyword; | 5225 this._keyword = keyword; |
4499 this._type = becomeParentOf(type); | 5226 this._type = becomeParentOf(type); |
4500 this._thisToken = thisToken; | 5227 this._thisToken = thisToken; |
4501 this._period = period; | 5228 this._period = period; |
4502 } | 5229 } |
| 5230 |
4503 /** | 5231 /** |
4504 * Initialize a newly created formal parameter. | 5232 * Initialize a newly created formal parameter. |
4505 * @param comment the documentation comment associated with this parameter | 5233 * @param comment the documentation comment associated with this parameter |
4506 * @param metadata the annotations associated with this parameter | 5234 * @param metadata the annotations associated with this parameter |
4507 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5235 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
4508 * @param type the name of the declared type of the parameter | 5236 * @param type the name of the declared type of the parameter |
4509 * @param thisToken the token representing the 'this' keyword | 5237 * @param thisToken the token representing the 'this' keyword |
4510 * @param period the token representing the period | 5238 * @param period the token representing the period |
4511 * @param identifier the name of the parameter being declared | 5239 * @param identifier the name of the parameter being declared |
4512 */ | 5240 */ |
4513 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); | 5241 FieldFormalParameter({Comment comment, List<Annotation> metadata, Token keywor
d, TypeName type, Token thisToken, Token period, SimpleIdentifier identifier}) :
this.full(comment, metadata, keyword, type, thisToken, period, identifier); |
4514 accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this); | 5242 accept(ASTVisitor visitor) => visitor.visitFieldFormalParameter(this); |
4515 Token get beginToken { | 5243 Token get beginToken { |
4516 if (_keyword != null) { | 5244 if (_keyword != null) { |
4517 return _keyword; | 5245 return _keyword; |
4518 } else if (_type != null) { | 5246 } else if (_type != null) { |
4519 return _type.beginToken; | 5247 return _type.beginToken; |
4520 } | 5248 } |
4521 return _thisToken; | 5249 return _thisToken; |
4522 } | 5250 } |
4523 Token get endToken => identifier.endToken; | 5251 Token get endToken => identifier.endToken; |
| 5252 |
4524 /** | 5253 /** |
4525 * Return the token representing either the 'final', 'const' or 'var' keyword. | 5254 * Return the token representing either the 'final', 'const' or 'var' keyword. |
4526 * @return the token representing either the 'final', 'const' or 'var' keyword | 5255 * @return the token representing either the 'final', 'const' or 'var' keyword |
4527 */ | 5256 */ |
4528 Token get keyword => _keyword; | 5257 Token get keyword => _keyword; |
| 5258 |
4529 /** | 5259 /** |
4530 * Return the token representing the period. | 5260 * Return the token representing the period. |
4531 * @return the token representing the period | 5261 * @return the token representing the period |
4532 */ | 5262 */ |
4533 Token get period => _period; | 5263 Token get period => _period; |
| 5264 |
4534 /** | 5265 /** |
4535 * Return the token representing the 'this' keyword. | 5266 * Return the token representing the 'this' keyword. |
4536 * @return the token representing the 'this' keyword | 5267 * @return the token representing the 'this' keyword |
4537 */ | 5268 */ |
4538 Token get thisToken => _thisToken; | 5269 Token get thisToken => _thisToken; |
| 5270 |
4539 /** | 5271 /** |
4540 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does | 5272 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does |
4541 * not have a declared type. | 5273 * not have a declared type. |
4542 * @return the name of the declared type of the parameter | 5274 * @return the name of the declared type of the parameter |
4543 */ | 5275 */ |
4544 TypeName get type => _type; | 5276 TypeName get type => _type; |
4545 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 5277 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
4546 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); | 5278 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); |
| 5279 |
4547 /** | 5280 /** |
4548 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 5281 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
4549 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 5282 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
4550 */ | 5283 */ |
4551 void set keyword(Token keyword2) { | 5284 void set keyword(Token keyword2) { |
4552 this._keyword = keyword2; | 5285 this._keyword = keyword2; |
4553 } | 5286 } |
| 5287 |
4554 /** | 5288 /** |
4555 * Set the token representing the period to the given token. | 5289 * Set the token representing the period to the given token. |
4556 * @param period the token representing the period | 5290 * @param period the token representing the period |
4557 */ | 5291 */ |
4558 void set period(Token period2) { | 5292 void set period(Token period2) { |
4559 this._period = period2; | 5293 this._period = period2; |
4560 } | 5294 } |
| 5295 |
4561 /** | 5296 /** |
4562 * Set the token representing the 'this' keyword to the given token. | 5297 * Set the token representing the 'this' keyword to the given token. |
4563 * @param thisToken the token representing the 'this' keyword | 5298 * @param thisToken the token representing the 'this' keyword |
4564 */ | 5299 */ |
4565 void set thisToken(Token thisToken2) { | 5300 void set thisToken(Token thisToken2) { |
4566 this._thisToken = thisToken2; | 5301 this._thisToken = thisToken2; |
4567 } | 5302 } |
| 5303 |
4568 /** | 5304 /** |
4569 * Set the name of the declared type of the parameter to the given type name. | 5305 * Set the name of the declared type of the parameter to the given type name. |
4570 * @param typeName the name of the declared type of the parameter | 5306 * @param typeName the name of the declared type of the parameter |
4571 */ | 5307 */ |
4572 void set type(TypeName typeName) { | 5308 void set type(TypeName typeName) { |
4573 _type = becomeParentOf(typeName); | 5309 _type = becomeParentOf(typeName); |
4574 } | 5310 } |
4575 void visitChildren(ASTVisitor<Object> visitor) { | 5311 void visitChildren(ASTVisitor<Object> visitor) { |
4576 super.visitChildren(visitor); | 5312 super.visitChildren(visitor); |
4577 safelyVisitChild(_type, visitor); | 5313 safelyVisitChild(_type, visitor); |
4578 safelyVisitChild(identifier, visitor); | 5314 safelyVisitChild(identifier, visitor); |
4579 } | 5315 } |
4580 } | 5316 } |
| 5317 |
4581 /** | 5318 /** |
4582 * Instances of the class {@code ForEachStatement} represent a for-each statemen
t. | 5319 * Instances of the class {@code ForEachStatement} represent a for-each statemen
t. |
4583 * <pre> | 5320 * <pre> |
4584 * forEachStatement ::= | 5321 * forEachStatement ::= |
4585 * 'for' '(' {@link SimpleFormalParameter loopParameter} 'in' {@link Expression
iterator} ')' {@link Block body}</pre> | 5322 * 'for' '(' {@link SimpleFormalParameter loopParameter} 'in' {@link Expression
iterator} ')' {@link Block body}</pre> |
4586 * @coverage dart.engine.ast | 5323 * @coverage dart.engine.ast |
4587 */ | 5324 */ |
4588 class ForEachStatement extends Statement { | 5325 class ForEachStatement extends Statement { |
| 5326 |
4589 /** | 5327 /** |
4590 * The token representing the 'for' keyword. | 5328 * The token representing the 'for' keyword. |
4591 */ | 5329 */ |
4592 Token _forKeyword; | 5330 Token _forKeyword; |
| 5331 |
4593 /** | 5332 /** |
4594 * The left parenthesis. | 5333 * The left parenthesis. |
4595 */ | 5334 */ |
4596 Token _leftParenthesis; | 5335 Token _leftParenthesis; |
| 5336 |
4597 /** | 5337 /** |
4598 * The declaration of the loop variable. | 5338 * The declaration of the loop variable. |
4599 */ | 5339 */ |
4600 DeclaredIdentifier _loopVariable; | 5340 DeclaredIdentifier _loopVariable; |
| 5341 |
4601 /** | 5342 /** |
4602 * The token representing the 'in' keyword. | 5343 * The token representing the 'in' keyword. |
4603 */ | 5344 */ |
4604 Token _inKeyword; | 5345 Token _inKeyword; |
| 5346 |
4605 /** | 5347 /** |
4606 * The expression evaluated to produce the iterator. | 5348 * The expression evaluated to produce the iterator. |
4607 */ | 5349 */ |
4608 Expression _iterator; | 5350 Expression _iterator; |
| 5351 |
4609 /** | 5352 /** |
4610 * The right parenthesis. | 5353 * The right parenthesis. |
4611 */ | 5354 */ |
4612 Token _rightParenthesis; | 5355 Token _rightParenthesis; |
| 5356 |
4613 /** | 5357 /** |
4614 * The body of the loop. | 5358 * The body of the loop. |
4615 */ | 5359 */ |
4616 Statement _body; | 5360 Statement _body; |
| 5361 |
4617 /** | 5362 /** |
4618 * Initialize a newly created for-each statement. | 5363 * Initialize a newly created for-each statement. |
4619 * @param forKeyword the token representing the 'for' keyword | 5364 * @param forKeyword the token representing the 'for' keyword |
4620 * @param leftParenthesis the left parenthesis | 5365 * @param leftParenthesis the left parenthesis |
4621 * @param loopVariable the declaration of the loop variable | 5366 * @param loopVariable the declaration of the loop variable |
4622 * @param iterator the expression evaluated to produce the iterator | 5367 * @param iterator the expression evaluated to produce the iterator |
4623 * @param rightParenthesis the right parenthesis | 5368 * @param rightParenthesis the right parenthesis |
4624 * @param body the body of the loop | 5369 * @param body the body of the loop |
4625 */ | 5370 */ |
4626 ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentif
ier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis,
Statement body) { | 5371 ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentif
ier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis,
Statement body) { |
4627 this._forKeyword = forKeyword; | 5372 this._forKeyword = forKeyword; |
4628 this._leftParenthesis = leftParenthesis; | 5373 this._leftParenthesis = leftParenthesis; |
4629 this._loopVariable = becomeParentOf(loopVariable); | 5374 this._loopVariable = becomeParentOf(loopVariable); |
4630 this._inKeyword = inKeyword; | 5375 this._inKeyword = inKeyword; |
4631 this._iterator = becomeParentOf(iterator); | 5376 this._iterator = becomeParentOf(iterator); |
4632 this._rightParenthesis = rightParenthesis; | 5377 this._rightParenthesis = rightParenthesis; |
4633 this._body = becomeParentOf(body); | 5378 this._body = becomeParentOf(body); |
4634 } | 5379 } |
| 5380 |
4635 /** | 5381 /** |
4636 * Initialize a newly created for-each statement. | 5382 * Initialize a newly created for-each statement. |
4637 * @param forKeyword the token representing the 'for' keyword | 5383 * @param forKeyword the token representing the 'for' keyword |
4638 * @param leftParenthesis the left parenthesis | 5384 * @param leftParenthesis the left parenthesis |
4639 * @param loopVariable the declaration of the loop variable | 5385 * @param loopVariable the declaration of the loop variable |
4640 * @param iterator the expression evaluated to produce the iterator | 5386 * @param iterator the expression evaluated to produce the iterator |
4641 * @param rightParenthesis the right parenthesis | 5387 * @param rightParenthesis the right parenthesis |
4642 * @param body the body of the loop | 5388 * @param body the body of the loop |
4643 */ | 5389 */ |
4644 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); | 5390 ForEachStatement({Token forKeyword, Token leftParenthesis, DeclaredIdentifier
loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Stat
ement body}) : this.full(forKeyword, leftParenthesis, loopVariable, inKeyword, i
terator, rightParenthesis, body); |
4645 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); | 5391 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); |
4646 Token get beginToken => _forKeyword; | 5392 Token get beginToken => _forKeyword; |
| 5393 |
4647 /** | 5394 /** |
4648 * Return the body of the loop. | 5395 * Return the body of the loop. |
4649 * @return the body of the loop | 5396 * @return the body of the loop |
4650 */ | 5397 */ |
4651 Statement get body => _body; | 5398 Statement get body => _body; |
4652 Token get endToken => _body.endToken; | 5399 Token get endToken => _body.endToken; |
| 5400 |
4653 /** | 5401 /** |
4654 * Return the token representing the 'for' keyword. | 5402 * Return the token representing the 'for' keyword. |
4655 * @return the token representing the 'for' keyword | 5403 * @return the token representing the 'for' keyword |
4656 */ | 5404 */ |
4657 Token get forKeyword => _forKeyword; | 5405 Token get forKeyword => _forKeyword; |
| 5406 |
4658 /** | 5407 /** |
4659 * Return the token representing the 'in' keyword. | 5408 * Return the token representing the 'in' keyword. |
4660 * @return the token representing the 'in' keyword | 5409 * @return the token representing the 'in' keyword |
4661 */ | 5410 */ |
4662 Token get inKeyword => _inKeyword; | 5411 Token get inKeyword => _inKeyword; |
| 5412 |
4663 /** | 5413 /** |
4664 * Return the expression evaluated to produce the iterator. | 5414 * Return the expression evaluated to produce the iterator. |
4665 * @return the expression evaluated to produce the iterator | 5415 * @return the expression evaluated to produce the iterator |
4666 */ | 5416 */ |
4667 Expression get iterator => _iterator; | 5417 Expression get iterator => _iterator; |
| 5418 |
4668 /** | 5419 /** |
4669 * Return the left parenthesis. | 5420 * Return the left parenthesis. |
4670 * @return the left parenthesis | 5421 * @return the left parenthesis |
4671 */ | 5422 */ |
4672 Token get leftParenthesis => _leftParenthesis; | 5423 Token get leftParenthesis => _leftParenthesis; |
| 5424 |
4673 /** | 5425 /** |
4674 * Return the declaration of the loop variable. | 5426 * Return the declaration of the loop variable. |
4675 * @return the declaration of the loop variable | 5427 * @return the declaration of the loop variable |
4676 */ | 5428 */ |
4677 DeclaredIdentifier get loopVariable => _loopVariable; | 5429 DeclaredIdentifier get loopVariable => _loopVariable; |
| 5430 |
4678 /** | 5431 /** |
4679 * Return the right parenthesis. | 5432 * Return the right parenthesis. |
4680 * @return the right parenthesis | 5433 * @return the right parenthesis |
4681 */ | 5434 */ |
4682 Token get rightParenthesis => _rightParenthesis; | 5435 Token get rightParenthesis => _rightParenthesis; |
| 5436 |
4683 /** | 5437 /** |
4684 * Set the body of the loop to the given block. | 5438 * Set the body of the loop to the given block. |
4685 * @param body the body of the loop | 5439 * @param body the body of the loop |
4686 */ | 5440 */ |
4687 void set body(Statement body2) { | 5441 void set body(Statement body2) { |
4688 this._body = becomeParentOf(body2); | 5442 this._body = becomeParentOf(body2); |
4689 } | 5443 } |
| 5444 |
4690 /** | 5445 /** |
4691 * Set the token representing the 'for' keyword to the given token. | 5446 * Set the token representing the 'for' keyword to the given token. |
4692 * @param forKeyword the token representing the 'for' keyword | 5447 * @param forKeyword the token representing the 'for' keyword |
4693 */ | 5448 */ |
4694 void set forKeyword(Token forKeyword2) { | 5449 void set forKeyword(Token forKeyword2) { |
4695 this._forKeyword = forKeyword2; | 5450 this._forKeyword = forKeyword2; |
4696 } | 5451 } |
| 5452 |
4697 /** | 5453 /** |
4698 * Set the token representing the 'in' keyword to the given token. | 5454 * Set the token representing the 'in' keyword to the given token. |
4699 * @param inKeyword the token representing the 'in' keyword | 5455 * @param inKeyword the token representing the 'in' keyword |
4700 */ | 5456 */ |
4701 void set inKeyword(Token inKeyword2) { | 5457 void set inKeyword(Token inKeyword2) { |
4702 this._inKeyword = inKeyword2; | 5458 this._inKeyword = inKeyword2; |
4703 } | 5459 } |
| 5460 |
4704 /** | 5461 /** |
4705 * Set the expression evaluated to produce the iterator to the given expressio
n. | 5462 * Set the expression evaluated to produce the iterator to the given expressio
n. |
4706 * @param expression the expression evaluated to produce the iterator | 5463 * @param expression the expression evaluated to produce the iterator |
4707 */ | 5464 */ |
4708 void set iterator(Expression expression) { | 5465 void set iterator(Expression expression) { |
4709 _iterator = becomeParentOf(expression); | 5466 _iterator = becomeParentOf(expression); |
4710 } | 5467 } |
| 5468 |
4711 /** | 5469 /** |
4712 * Set the left parenthesis to the given token. | 5470 * Set the left parenthesis to the given token. |
4713 * @param leftParenthesis the left parenthesis | 5471 * @param leftParenthesis the left parenthesis |
4714 */ | 5472 */ |
4715 void set leftParenthesis(Token leftParenthesis2) { | 5473 void set leftParenthesis(Token leftParenthesis2) { |
4716 this._leftParenthesis = leftParenthesis2; | 5474 this._leftParenthesis = leftParenthesis2; |
4717 } | 5475 } |
| 5476 |
4718 /** | 5477 /** |
4719 * Set the declaration of the loop variable to the given variable. | 5478 * Set the declaration of the loop variable to the given variable. |
4720 * @param variable the declaration of the loop variable | 5479 * @param variable the declaration of the loop variable |
4721 */ | 5480 */ |
4722 void set loopVariable(DeclaredIdentifier variable) { | 5481 void set loopVariable(DeclaredIdentifier variable) { |
4723 _loopVariable = becomeParentOf(variable); | 5482 _loopVariable = becomeParentOf(variable); |
4724 } | 5483 } |
| 5484 |
4725 /** | 5485 /** |
4726 * Set the right parenthesis to the given token. | 5486 * Set the right parenthesis to the given token. |
4727 * @param rightParenthesis the right parenthesis | 5487 * @param rightParenthesis the right parenthesis |
4728 */ | 5488 */ |
4729 void set rightParenthesis(Token rightParenthesis2) { | 5489 void set rightParenthesis(Token rightParenthesis2) { |
4730 this._rightParenthesis = rightParenthesis2; | 5490 this._rightParenthesis = rightParenthesis2; |
4731 } | 5491 } |
4732 void visitChildren(ASTVisitor<Object> visitor) { | 5492 void visitChildren(ASTVisitor<Object> visitor) { |
4733 safelyVisitChild(_loopVariable, visitor); | 5493 safelyVisitChild(_loopVariable, visitor); |
4734 safelyVisitChild(_iterator, visitor); | 5494 safelyVisitChild(_iterator, visitor); |
4735 safelyVisitChild(_body, visitor); | 5495 safelyVisitChild(_body, visitor); |
4736 } | 5496 } |
4737 } | 5497 } |
| 5498 |
4738 /** | 5499 /** |
4739 * Instances of the class {@code ForStatement} represent a for statement. | 5500 * Instances of the class {@code ForStatement} represent a for statement. |
4740 * <pre> | 5501 * <pre> |
4741 * forStatement ::= | 5502 * forStatement ::= |
4742 * 'for' '(' forLoopParts ')' {@link Statement statement}forLoopParts ::= | 5503 * 'for' '(' forLoopParts ')' {@link Statement statement}forLoopParts ::= |
4743 * forInitializerStatement ';' {@link Expression expression}? ';' {@link Express
ion expressionList}? | 5504 * forInitializerStatement ';' {@link Expression expression}? ';' {@link Express
ion expressionList}? |
4744 * forInitializerStatement ::={@link DefaultFormalParameter initializedVariableD
eclaration}| {@link Expression expression}? | 5505 * forInitializerStatement ::={@link DefaultFormalParameter initializedVariableD
eclaration}| {@link Expression expression}? |
4745 * </pre> | 5506 * </pre> |
4746 * @coverage dart.engine.ast | 5507 * @coverage dart.engine.ast |
4747 */ | 5508 */ |
4748 class ForStatement extends Statement { | 5509 class ForStatement extends Statement { |
| 5510 |
4749 /** | 5511 /** |
4750 * The token representing the 'for' keyword. | 5512 * The token representing the 'for' keyword. |
4751 */ | 5513 */ |
4752 Token _forKeyword; | 5514 Token _forKeyword; |
| 5515 |
4753 /** | 5516 /** |
4754 * The left parenthesis. | 5517 * The left parenthesis. |
4755 */ | 5518 */ |
4756 Token _leftParenthesis; | 5519 Token _leftParenthesis; |
| 5520 |
4757 /** | 5521 /** |
4758 * The declaration of the loop variables, or {@code null} if there are no vari
ables. Note that a | 5522 * The declaration of the loop variables, or {@code null} if there are no vari
ables. Note that a |
4759 * for statement cannot have both a variable list and an initialization expres
sion, but can | 5523 * for statement cannot have both a variable list and an initialization expres
sion, but can |
4760 * validly have neither. | 5524 * validly have neither. |
4761 */ | 5525 */ |
4762 VariableDeclarationList _variableList; | 5526 VariableDeclarationList _variableList; |
| 5527 |
4763 /** | 5528 /** |
4764 * The initialization expression, or {@code null} if there is no initializatio
n expression. Note | 5529 * The initialization expression, or {@code null} if there is no initializatio
n expression. Note |
4765 * that a for statement cannot have both a variable list and an initialization
expression, but can | 5530 * that a for statement cannot have both a variable list and an initialization
expression, but can |
4766 * validly have neither. | 5531 * validly have neither. |
4767 */ | 5532 */ |
4768 Expression _initialization; | 5533 Expression _initialization; |
| 5534 |
4769 /** | 5535 /** |
4770 * The semicolon separating the initializer and the condition. | 5536 * The semicolon separating the initializer and the condition. |
4771 */ | 5537 */ |
4772 Token _leftSeparator; | 5538 Token _leftSeparator; |
| 5539 |
4773 /** | 5540 /** |
4774 * The condition used to determine when to terminate the loop. | 5541 * The condition used to determine when to terminate the loop. |
4775 */ | 5542 */ |
4776 Expression _condition; | 5543 Expression _condition; |
| 5544 |
4777 /** | 5545 /** |
4778 * The semicolon separating the condition and the updater. | 5546 * The semicolon separating the condition and the updater. |
4779 */ | 5547 */ |
4780 Token _rightSeparator; | 5548 Token _rightSeparator; |
| 5549 |
4781 /** | 5550 /** |
4782 * The list of expressions run after each execution of the loop body. | 5551 * The list of expressions run after each execution of the loop body. |
4783 */ | 5552 */ |
4784 NodeList<Expression> _updaters; | 5553 NodeList<Expression> _updaters; |
| 5554 |
4785 /** | 5555 /** |
4786 * The right parenthesis. | 5556 * The right parenthesis. |
4787 */ | 5557 */ |
4788 Token _rightParenthesis; | 5558 Token _rightParenthesis; |
| 5559 |
4789 /** | 5560 /** |
4790 * The body of the loop. | 5561 * The body of the loop. |
4791 */ | 5562 */ |
4792 Statement _body; | 5563 Statement _body; |
| 5564 |
4793 /** | 5565 /** |
4794 * Initialize a newly created for statement. | 5566 * Initialize a newly created for statement. |
4795 * @param forKeyword the token representing the 'for' keyword | 5567 * @param forKeyword the token representing the 'for' keyword |
4796 * @param leftParenthesis the left parenthesis | 5568 * @param leftParenthesis the left parenthesis |
4797 * @param variableList the declaration of the loop variables | 5569 * @param variableList the declaration of the loop variables |
4798 * @param initialization the initialization expression | 5570 * @param initialization the initialization expression |
4799 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 5571 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
4800 * @param condition the condition used to determine when to terminate the loop | 5572 * @param condition the condition used to determine when to terminate the loop |
4801 * @param rightSeparator the semicolon separating the condition and the update
r | 5573 * @param rightSeparator the semicolon separating the condition and the update
r |
4802 * @param updaters the list of expressions run after each execution of the loo
p body | 5574 * @param updaters the list of expressions run after each execution of the loo
p body |
4803 * @param rightParenthesis the right parenthesis | 5575 * @param rightParenthesis the right parenthesis |
4804 * @param body the body of the loop | 5576 * @param body the body of the loop |
4805 */ | 5577 */ |
4806 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) { | 5578 ForStatement.full(Token forKeyword, Token leftParenthesis, VariableDeclaration
List variableList, Expression initialization, Token leftSeparator, Expression co
ndition, Token rightSeparator, List<Expression> updaters, Token rightParenthesis
, Statement body) { |
4807 this._updaters = new NodeList<Expression>(this); | 5579 this._updaters = new NodeList<Expression>(this); |
4808 this._forKeyword = forKeyword; | 5580 this._forKeyword = forKeyword; |
4809 this._leftParenthesis = leftParenthesis; | 5581 this._leftParenthesis = leftParenthesis; |
4810 this._variableList = becomeParentOf(variableList); | 5582 this._variableList = becomeParentOf(variableList); |
4811 this._initialization = becomeParentOf(initialization); | 5583 this._initialization = becomeParentOf(initialization); |
4812 this._leftSeparator = leftSeparator; | 5584 this._leftSeparator = leftSeparator; |
4813 this._condition = becomeParentOf(condition); | 5585 this._condition = becomeParentOf(condition); |
4814 this._rightSeparator = rightSeparator; | 5586 this._rightSeparator = rightSeparator; |
4815 this._updaters.addAll(updaters); | 5587 this._updaters.addAll(updaters); |
4816 this._rightParenthesis = rightParenthesis; | 5588 this._rightParenthesis = rightParenthesis; |
4817 this._body = becomeParentOf(body); | 5589 this._body = becomeParentOf(body); |
4818 } | 5590 } |
| 5591 |
4819 /** | 5592 /** |
4820 * Initialize a newly created for statement. | 5593 * Initialize a newly created for statement. |
4821 * @param forKeyword the token representing the 'for' keyword | 5594 * @param forKeyword the token representing the 'for' keyword |
4822 * @param leftParenthesis the left parenthesis | 5595 * @param leftParenthesis the left parenthesis |
4823 * @param variableList the declaration of the loop variables | 5596 * @param variableList the declaration of the loop variables |
4824 * @param initialization the initialization expression | 5597 * @param initialization the initialization expression |
4825 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 5598 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
4826 * @param condition the condition used to determine when to terminate the loop | 5599 * @param condition the condition used to determine when to terminate the loop |
4827 * @param rightSeparator the semicolon separating the condition and the update
r | 5600 * @param rightSeparator the semicolon separating the condition and the update
r |
4828 * @param updaters the list of expressions run after each execution of the loo
p body | 5601 * @param updaters the list of expressions run after each execution of the loo
p body |
4829 * @param rightParenthesis the right parenthesis | 5602 * @param rightParenthesis the right parenthesis |
4830 * @param body the body of the loop | 5603 * @param body the body of the loop |
4831 */ | 5604 */ |
4832 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
); | 5605 ForStatement({Token forKeyword, Token leftParenthesis, VariableDeclarationList
variableList, Expression initialization, Token leftSeparator, Expression condit
ion, Token rightSeparator, List<Expression> updaters, Token rightParenthesis, St
atement body}) : this.full(forKeyword, leftParenthesis, variableList, initializa
tion, leftSeparator, condition, rightSeparator, updaters, rightParenthesis, body
); |
4833 accept(ASTVisitor visitor) => visitor.visitForStatement(this); | 5606 accept(ASTVisitor visitor) => visitor.visitForStatement(this); |
4834 Token get beginToken => _forKeyword; | 5607 Token get beginToken => _forKeyword; |
| 5608 |
4835 /** | 5609 /** |
4836 * Return the body of the loop. | 5610 * Return the body of the loop. |
4837 * @return the body of the loop | 5611 * @return the body of the loop |
4838 */ | 5612 */ |
4839 Statement get body => _body; | 5613 Statement get body => _body; |
| 5614 |
4840 /** | 5615 /** |
4841 * Return the condition used to determine when to terminate the loop. | 5616 * Return the condition used to determine when to terminate the loop. |
4842 * @return the condition used to determine when to terminate the loop | 5617 * @return the condition used to determine when to terminate the loop |
4843 */ | 5618 */ |
4844 Expression get condition => _condition; | 5619 Expression get condition => _condition; |
4845 Token get endToken => _body.endToken; | 5620 Token get endToken => _body.endToken; |
| 5621 |
4846 /** | 5622 /** |
4847 * Return the token representing the 'for' keyword. | 5623 * Return the token representing the 'for' keyword. |
4848 * @return the token representing the 'for' keyword | 5624 * @return the token representing the 'for' keyword |
4849 */ | 5625 */ |
4850 Token get forKeyword => _forKeyword; | 5626 Token get forKeyword => _forKeyword; |
| 5627 |
4851 /** | 5628 /** |
4852 * Return the initialization expression, or {@code null} if there is no initia
lization expression. | 5629 * Return the initialization expression, or {@code null} if there is no initia
lization expression. |
4853 * @return the initialization expression | 5630 * @return the initialization expression |
4854 */ | 5631 */ |
4855 Expression get initialization => _initialization; | 5632 Expression get initialization => _initialization; |
| 5633 |
4856 /** | 5634 /** |
4857 * Return the left parenthesis. | 5635 * Return the left parenthesis. |
4858 * @return the left parenthesis | 5636 * @return the left parenthesis |
4859 */ | 5637 */ |
4860 Token get leftParenthesis => _leftParenthesis; | 5638 Token get leftParenthesis => _leftParenthesis; |
| 5639 |
4861 /** | 5640 /** |
4862 * Return the semicolon separating the initializer and the condition. | 5641 * Return the semicolon separating the initializer and the condition. |
4863 * @return the semicolon separating the initializer and the condition | 5642 * @return the semicolon separating the initializer and the condition |
4864 */ | 5643 */ |
4865 Token get leftSeparator => _leftSeparator; | 5644 Token get leftSeparator => _leftSeparator; |
| 5645 |
4866 /** | 5646 /** |
4867 * Return the right parenthesis. | 5647 * Return the right parenthesis. |
4868 * @return the right parenthesis | 5648 * @return the right parenthesis |
4869 */ | 5649 */ |
4870 Token get rightParenthesis => _rightParenthesis; | 5650 Token get rightParenthesis => _rightParenthesis; |
| 5651 |
4871 /** | 5652 /** |
4872 * Return the semicolon separating the condition and the updater. | 5653 * Return the semicolon separating the condition and the updater. |
4873 * @return the semicolon separating the condition and the updater | 5654 * @return the semicolon separating the condition and the updater |
4874 */ | 5655 */ |
4875 Token get rightSeparator => _rightSeparator; | 5656 Token get rightSeparator => _rightSeparator; |
| 5657 |
4876 /** | 5658 /** |
4877 * Return the list of expressions run after each execution of the loop body. | 5659 * Return the list of expressions run after each execution of the loop body. |
4878 * @return the list of expressions run after each execution of the loop body | 5660 * @return the list of expressions run after each execution of the loop body |
4879 */ | 5661 */ |
4880 NodeList<Expression> get updaters => _updaters; | 5662 NodeList<Expression> get updaters => _updaters; |
| 5663 |
4881 /** | 5664 /** |
4882 * Return the declaration of the loop variables, or {@code null} if there are
no variables. | 5665 * Return the declaration of the loop variables, or {@code null} if there are
no variables. |
4883 * @return the declaration of the loop variables, or {@code null} if there are
no variables | 5666 * @return the declaration of the loop variables, or {@code null} if there are
no variables |
4884 */ | 5667 */ |
4885 VariableDeclarationList get variables => _variableList; | 5668 VariableDeclarationList get variables => _variableList; |
| 5669 |
4886 /** | 5670 /** |
4887 * Set the body of the loop to the given statement. | 5671 * Set the body of the loop to the given statement. |
4888 * @param body the body of the loop | 5672 * @param body the body of the loop |
4889 */ | 5673 */ |
4890 void set body(Statement body2) { | 5674 void set body(Statement body2) { |
4891 this._body = becomeParentOf(body2); | 5675 this._body = becomeParentOf(body2); |
4892 } | 5676 } |
| 5677 |
4893 /** | 5678 /** |
4894 * Set the condition used to determine when to terminate the loop to the given
expression. | 5679 * Set the condition used to determine when to terminate the loop to the given
expression. |
4895 * @param expression the condition used to determine when to terminate the loo
p | 5680 * @param expression the condition used to determine when to terminate the loo
p |
4896 */ | 5681 */ |
4897 void set condition(Expression expression) { | 5682 void set condition(Expression expression) { |
4898 _condition = becomeParentOf(expression); | 5683 _condition = becomeParentOf(expression); |
4899 } | 5684 } |
| 5685 |
4900 /** | 5686 /** |
4901 * Set the token representing the 'for' keyword to the given token. | 5687 * Set the token representing the 'for' keyword to the given token. |
4902 * @param forKeyword the token representing the 'for' keyword | 5688 * @param forKeyword the token representing the 'for' keyword |
4903 */ | 5689 */ |
4904 void set forKeyword(Token forKeyword2) { | 5690 void set forKeyword(Token forKeyword2) { |
4905 this._forKeyword = forKeyword2; | 5691 this._forKeyword = forKeyword2; |
4906 } | 5692 } |
| 5693 |
4907 /** | 5694 /** |
4908 * Set the initialization expression to the given expression. | 5695 * Set the initialization expression to the given expression. |
4909 * @param initialization the initialization expression | 5696 * @param initialization the initialization expression |
4910 */ | 5697 */ |
4911 void set initialization(Expression initialization2) { | 5698 void set initialization(Expression initialization2) { |
4912 this._initialization = becomeParentOf(initialization2); | 5699 this._initialization = becomeParentOf(initialization2); |
4913 } | 5700 } |
| 5701 |
4914 /** | 5702 /** |
4915 * Set the left parenthesis to the given token. | 5703 * Set the left parenthesis to the given token. |
4916 * @param leftParenthesis the left parenthesis | 5704 * @param leftParenthesis the left parenthesis |
4917 */ | 5705 */ |
4918 void set leftParenthesis(Token leftParenthesis2) { | 5706 void set leftParenthesis(Token leftParenthesis2) { |
4919 this._leftParenthesis = leftParenthesis2; | 5707 this._leftParenthesis = leftParenthesis2; |
4920 } | 5708 } |
| 5709 |
4921 /** | 5710 /** |
4922 * Set the semicolon separating the initializer and the condition to the given
token. | 5711 * Set the semicolon separating the initializer and the condition to the given
token. |
4923 * @param leftSeparator the semicolon separating the initializer and the condi
tion | 5712 * @param leftSeparator the semicolon separating the initializer and the condi
tion |
4924 */ | 5713 */ |
4925 void set leftSeparator(Token leftSeparator2) { | 5714 void set leftSeparator(Token leftSeparator2) { |
4926 this._leftSeparator = leftSeparator2; | 5715 this._leftSeparator = leftSeparator2; |
4927 } | 5716 } |
| 5717 |
4928 /** | 5718 /** |
4929 * Set the right parenthesis to the given token. | 5719 * Set the right parenthesis to the given token. |
4930 * @param rightParenthesis the right parenthesis | 5720 * @param rightParenthesis the right parenthesis |
4931 */ | 5721 */ |
4932 void set rightParenthesis(Token rightParenthesis2) { | 5722 void set rightParenthesis(Token rightParenthesis2) { |
4933 this._rightParenthesis = rightParenthesis2; | 5723 this._rightParenthesis = rightParenthesis2; |
4934 } | 5724 } |
| 5725 |
4935 /** | 5726 /** |
4936 * Set the semicolon separating the condition and the updater to the given tok
en. | 5727 * Set the semicolon separating the condition and the updater to the given tok
en. |
4937 * @param rightSeparator the semicolon separating the condition and the update
r | 5728 * @param rightSeparator the semicolon separating the condition and the update
r |
4938 */ | 5729 */ |
4939 void set rightSeparator(Token rightSeparator2) { | 5730 void set rightSeparator(Token rightSeparator2) { |
4940 this._rightSeparator = rightSeparator2; | 5731 this._rightSeparator = rightSeparator2; |
4941 } | 5732 } |
| 5733 |
4942 /** | 5734 /** |
4943 * Set the declaration of the loop variables to the given parameter. | 5735 * Set the declaration of the loop variables to the given parameter. |
4944 * @param variableList the declaration of the loop variables | 5736 * @param variableList the declaration of the loop variables |
4945 */ | 5737 */ |
4946 void set variables(VariableDeclarationList variableList) { | 5738 void set variables(VariableDeclarationList variableList) { |
4947 variableList = becomeParentOf(variableList); | 5739 variableList = becomeParentOf(variableList); |
4948 } | 5740 } |
4949 void visitChildren(ASTVisitor<Object> visitor) { | 5741 void visitChildren(ASTVisitor<Object> visitor) { |
4950 safelyVisitChild(_variableList, visitor); | 5742 safelyVisitChild(_variableList, visitor); |
4951 safelyVisitChild(_initialization, visitor); | 5743 safelyVisitChild(_initialization, visitor); |
4952 safelyVisitChild(_condition, visitor); | 5744 safelyVisitChild(_condition, visitor); |
4953 _updaters.accept(visitor); | 5745 _updaters.accept(visitor); |
4954 safelyVisitChild(_body, visitor); | 5746 safelyVisitChild(_body, visitor); |
4955 } | 5747 } |
4956 } | 5748 } |
| 5749 |
4957 /** | 5750 /** |
4958 * The abstract class {@code FormalParameter} defines the behavior of objects re
presenting a | 5751 * The abstract class {@code FormalParameter} defines the behavior of objects re
presenting a |
4959 * parameter to a function. | 5752 * parameter to a function. |
4960 * <pre> | 5753 * <pre> |
4961 * formalParameter ::={@link NormalFormalParameter normalFormalParameter}| {@lin
k DefaultFormalParameter namedFormalParameter}| {@link DefaultFormalParameter op
tionalFormalParameter}</pre> | 5754 * formalParameter ::={@link NormalFormalParameter normalFormalParameter}| {@lin
k DefaultFormalParameter namedFormalParameter}| {@link DefaultFormalParameter op
tionalFormalParameter}</pre> |
4962 * @coverage dart.engine.ast | 5755 * @coverage dart.engine.ast |
4963 */ | 5756 */ |
4964 abstract class FormalParameter extends ASTNode { | 5757 abstract class FormalParameter extends ASTNode { |
| 5758 |
4965 /** | 5759 /** |
4966 * Return the element representing this parameter, or {@code null} if this par
ameter has not been | 5760 * Return the element representing this parameter, or {@code null} if this par
ameter has not been |
4967 * resolved. | 5761 * resolved. |
4968 * @return the element representing this parameter | 5762 * @return the element representing this parameter |
4969 */ | 5763 */ |
4970 ParameterElement get element { | 5764 ParameterElement get element { |
4971 SimpleIdentifier identifier2 = identifier; | 5765 SimpleIdentifier identifier2 = identifier; |
4972 if (identifier2 == null) { | 5766 if (identifier2 == null) { |
4973 return null; | 5767 return null; |
4974 } | 5768 } |
4975 return identifier2.element as ParameterElement; | 5769 return identifier2.element as ParameterElement; |
4976 } | 5770 } |
| 5771 |
4977 /** | 5772 /** |
4978 * Return the name of the parameter being declared. | 5773 * Return the name of the parameter being declared. |
4979 * @return the name of the parameter being declared | 5774 * @return the name of the parameter being declared |
4980 */ | 5775 */ |
4981 SimpleIdentifier get identifier; | 5776 SimpleIdentifier get identifier; |
| 5777 |
4982 /** | 5778 /** |
4983 * Return the kind of this parameter. | 5779 * Return the kind of this parameter. |
4984 * @return the kind of this parameter | 5780 * @return the kind of this parameter |
4985 */ | 5781 */ |
4986 ParameterKind get kind; | 5782 ParameterKind get kind; |
4987 } | 5783 } |
| 5784 |
4988 /** | 5785 /** |
4989 * Instances of the class {@code FormalParameterList} represent the formal param
eter list of a | 5786 * Instances of the class {@code FormalParameterList} represent the formal param
eter list of a |
4990 * method declaration, function declaration, or function type alias. | 5787 * method declaration, function declaration, or function type alias. |
4991 * <p> | 5788 * <p> |
4992 * While the grammar requires all optional formal parameters to follow all of th
e normal formal | 5789 * While the grammar requires all optional formal parameters to follow all of th
e normal formal |
4993 * parameters and at most one grouping of optional formal parameters, this class
does not enforce | 5790 * parameters and at most one grouping of optional formal parameters, this class
does not enforce |
4994 * those constraints. All parameters are flattened into a single list, which can
have any or all | 5791 * those constraints. All parameters are flattened into a single list, which can
have any or all |
4995 * kinds of parameters (normal, named, and positional) in any order. | 5792 * kinds of parameters (normal, named, and positional) in any order. |
4996 * <pre> | 5793 * <pre> |
4997 * formalParameterList ::= | 5794 * formalParameterList ::= |
4998 * '(' ')' | 5795 * '(' ')' |
4999 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' | 5796 * | '(' normalFormalParameters (',' optionalFormalParameters)? ')' |
5000 * | '(' optionalFormalParameters ')' | 5797 * | '(' optionalFormalParameters ')' |
5001 * normalFormalParameters ::={@link NormalFormalParameter normalFormalParameter}
(',' {@link NormalFormalParameter normalFormalParameter}) | 5798 * normalFormalParameters ::={@link NormalFormalParameter normalFormalParameter}
(',' {@link NormalFormalParameter normalFormalParameter}) |
5002 * optionalFormalParameters ::= | 5799 * optionalFormalParameters ::= |
5003 * optionalPositionalFormalParameters | 5800 * optionalPositionalFormalParameters |
5004 * | namedFormalParameters | 5801 * | namedFormalParameters |
5005 * optionalPositionalFormalParameters ::= | 5802 * optionalPositionalFormalParameters ::= |
5006 * '\[' {@link DefaultFormalParameter positionalFormalParameter} (',' {@link Def
aultFormalParameter positionalFormalParameter})* '\]' | 5803 * '\[' {@link DefaultFormalParameter positionalFormalParameter} (',' {@link Def
aultFormalParameter positionalFormalParameter})* '\]' |
5007 * namedFormalParameters ::= | 5804 * namedFormalParameters ::= |
5008 * '{' {@link DefaultFormalParameter namedFormalParameter} (',' {@link DefaultFo
rmalParameter namedFormalParameter})* '}' | 5805 * '{' {@link DefaultFormalParameter namedFormalParameter} (',' {@link DefaultFo
rmalParameter namedFormalParameter})* '}' |
5009 * </pre> | 5806 * </pre> |
5010 * @coverage dart.engine.ast | 5807 * @coverage dart.engine.ast |
5011 */ | 5808 */ |
5012 class FormalParameterList extends ASTNode { | 5809 class FormalParameterList extends ASTNode { |
| 5810 |
5013 /** | 5811 /** |
5014 * The left parenthesis. | 5812 * The left parenthesis. |
5015 */ | 5813 */ |
5016 Token _leftParenthesis; | 5814 Token _leftParenthesis; |
| 5815 |
5017 /** | 5816 /** |
5018 * The parameters associated with the method. | 5817 * The parameters associated with the method. |
5019 */ | 5818 */ |
5020 NodeList<FormalParameter> _parameters; | 5819 NodeList<FormalParameter> _parameters; |
| 5820 |
5021 /** | 5821 /** |
5022 * The left square bracket ('\[') or left curly brace ('{') introducing the op
tional parameters. | 5822 * The left square bracket ('\[') or left curly brace ('{') introducing the op
tional parameters. |
5023 */ | 5823 */ |
5024 Token _leftDelimiter; | 5824 Token _leftDelimiter; |
| 5825 |
5025 /** | 5826 /** |
5026 * The right square bracket ('\]') or right curly brace ('}') introducing the
optional parameters. | 5827 * The right square bracket ('\]') or right curly brace ('}') introducing the
optional parameters. |
5027 */ | 5828 */ |
5028 Token _rightDelimiter; | 5829 Token _rightDelimiter; |
| 5830 |
5029 /** | 5831 /** |
5030 * The right parenthesis. | 5832 * The right parenthesis. |
5031 */ | 5833 */ |
5032 Token _rightParenthesis; | 5834 Token _rightParenthesis; |
| 5835 |
5033 /** | 5836 /** |
5034 * Initialize a newly created parameter list. | 5837 * Initialize a newly created parameter list. |
5035 * @param leftParenthesis the left parenthesis | 5838 * @param leftParenthesis the left parenthesis |
5036 * @param parameters the parameters associated with the method | 5839 * @param parameters the parameters associated with the method |
5037 * @param leftDelimiter the left delimiter introducing the optional parameters | 5840 * @param leftDelimiter the left delimiter introducing the optional parameters |
5038 * @param rightDelimiter the right delimiter introducing the optional paramete
rs | 5841 * @param rightDelimiter the right delimiter introducing the optional paramete
rs |
5039 * @param rightParenthesis the right parenthesis | 5842 * @param rightParenthesis the right parenthesis |
5040 */ | 5843 */ |
5041 FormalParameterList.full(Token leftParenthesis, List<FormalParameter> paramete
rs, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis) { | 5844 FormalParameterList.full(Token leftParenthesis, List<FormalParameter> paramete
rs, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis) { |
5042 this._parameters = new NodeList<FormalParameter>(this); | 5845 this._parameters = new NodeList<FormalParameter>(this); |
5043 this._leftParenthesis = leftParenthesis; | 5846 this._leftParenthesis = leftParenthesis; |
5044 this._parameters.addAll(parameters); | 5847 this._parameters.addAll(parameters); |
5045 this._leftDelimiter = leftDelimiter; | 5848 this._leftDelimiter = leftDelimiter; |
5046 this._rightDelimiter = rightDelimiter; | 5849 this._rightDelimiter = rightDelimiter; |
5047 this._rightParenthesis = rightParenthesis; | 5850 this._rightParenthesis = rightParenthesis; |
5048 } | 5851 } |
| 5852 |
5049 /** | 5853 /** |
5050 * Initialize a newly created parameter list. | 5854 * Initialize a newly created parameter list. |
5051 * @param leftParenthesis the left parenthesis | 5855 * @param leftParenthesis the left parenthesis |
5052 * @param parameters the parameters associated with the method | 5856 * @param parameters the parameters associated with the method |
5053 * @param leftDelimiter the left delimiter introducing the optional parameters | 5857 * @param leftDelimiter the left delimiter introducing the optional parameters |
5054 * @param rightDelimiter the right delimiter introducing the optional paramete
rs | 5858 * @param rightDelimiter the right delimiter introducing the optional paramete
rs |
5055 * @param rightParenthesis the right parenthesis | 5859 * @param rightParenthesis the right parenthesis |
5056 */ | 5860 */ |
5057 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters,
Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full(
leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis); | 5861 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters,
Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full(
leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis); |
5058 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); | 5862 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); |
5059 Token get beginToken => _leftParenthesis; | 5863 Token get beginToken => _leftParenthesis; |
| 5864 |
5060 /** | 5865 /** |
5061 * Return an array containing the elements representing the parameters in this
list. The array | 5866 * Return an array containing the elements representing the parameters in this
list. The array |
5062 * will contain {@code null}s if the parameters in this list have not been res
olved. | 5867 * will contain {@code null}s if the parameters in this list have not been res
olved. |
5063 * @return the elements representing the parameters in this list | 5868 * @return the elements representing the parameters in this list |
5064 */ | 5869 */ |
5065 List<ParameterElement> get elements { | 5870 List<ParameterElement> get elements { |
5066 int count = _parameters.length; | 5871 int count = _parameters.length; |
5067 List<ParameterElement> types = new List<ParameterElement>(count); | 5872 List<ParameterElement> types = new List<ParameterElement>(count); |
5068 for (int i = 0; i < count; i++) { | 5873 for (int i = 0; i < count; i++) { |
5069 types[i] = _parameters[i].element; | 5874 types[i] = _parameters[i].element; |
5070 } | 5875 } |
5071 return types; | 5876 return types; |
5072 } | 5877 } |
5073 Token get endToken => _rightParenthesis; | 5878 Token get endToken => _rightParenthesis; |
| 5879 |
5074 /** | 5880 /** |
5075 * Return the left square bracket ('\[') or left curly brace ('{') introducing
the optional | 5881 * Return the left square bracket ('\[') or left curly brace ('{') introducing
the optional |
5076 * parameters. | 5882 * parameters. |
5077 * @return the left square bracket ('\[') or left curly brace ('{') introducin
g the optional | 5883 * @return the left square bracket ('\[') or left curly brace ('{') introducin
g the optional |
5078 * parameters | 5884 * parameters |
5079 */ | 5885 */ |
5080 Token get leftDelimiter => _leftDelimiter; | 5886 Token get leftDelimiter => _leftDelimiter; |
| 5887 |
5081 /** | 5888 /** |
5082 * Return the left parenthesis. | 5889 * Return the left parenthesis. |
5083 * @return the left parenthesis | 5890 * @return the left parenthesis |
5084 */ | 5891 */ |
5085 Token get leftParenthesis => _leftParenthesis; | 5892 Token get leftParenthesis => _leftParenthesis; |
| 5893 |
5086 /** | 5894 /** |
5087 * Return the parameters associated with the method. | 5895 * Return the parameters associated with the method. |
5088 * @return the parameters associated with the method | 5896 * @return the parameters associated with the method |
5089 */ | 5897 */ |
5090 NodeList<FormalParameter> get parameters => _parameters; | 5898 NodeList<FormalParameter> get parameters => _parameters; |
| 5899 |
5091 /** | 5900 /** |
5092 * Return the right square bracket ('\]') or right curly brace ('}') introduci
ng the optional | 5901 * Return the right square bracket ('\]') or right curly brace ('}') introduci
ng the optional |
5093 * parameters. | 5902 * parameters. |
5094 * @return the right square bracket ('\]') or right curly brace ('}') introduc
ing the optional | 5903 * @return the right square bracket ('\]') or right curly brace ('}') introduc
ing the optional |
5095 * parameters | 5904 * parameters |
5096 */ | 5905 */ |
5097 Token get rightDelimiter => _rightDelimiter; | 5906 Token get rightDelimiter => _rightDelimiter; |
| 5907 |
5098 /** | 5908 /** |
5099 * Return the right parenthesis. | 5909 * Return the right parenthesis. |
5100 * @return the right parenthesis | 5910 * @return the right parenthesis |
5101 */ | 5911 */ |
5102 Token get rightParenthesis => _rightParenthesis; | 5912 Token get rightParenthesis => _rightParenthesis; |
| 5913 |
5103 /** | 5914 /** |
5104 * Set the left square bracket ('\[') or left curly brace ('{') introducing th
e optional parameters | 5915 * Set the left square bracket ('\[') or left curly brace ('{') introducing th
e optional parameters |
5105 * to the given token. | 5916 * to the given token. |
5106 * @param bracket the left delimiter introducing the optional parameters | 5917 * @param bracket the left delimiter introducing the optional parameters |
5107 */ | 5918 */ |
5108 void set leftDelimiter(Token bracket) { | 5919 void set leftDelimiter(Token bracket) { |
5109 _leftDelimiter = bracket; | 5920 _leftDelimiter = bracket; |
5110 } | 5921 } |
| 5922 |
5111 /** | 5923 /** |
5112 * Set the left parenthesis to the given token. | 5924 * Set the left parenthesis to the given token. |
5113 * @param parenthesis the left parenthesis | 5925 * @param parenthesis the left parenthesis |
5114 */ | 5926 */ |
5115 void set leftParenthesis(Token parenthesis) { | 5927 void set leftParenthesis(Token parenthesis) { |
5116 _leftParenthesis = parenthesis; | 5928 _leftParenthesis = parenthesis; |
5117 } | 5929 } |
| 5930 |
5118 /** | 5931 /** |
5119 * Set the right square bracket ('\]') or right curly brace ('}') introducing
the optional | 5932 * Set the right square bracket ('\]') or right curly brace ('}') introducing
the optional |
5120 * parameters to the given token. | 5933 * parameters to the given token. |
5121 * @param bracket the right delimiter introducing the optional parameters | 5934 * @param bracket the right delimiter introducing the optional parameters |
5122 */ | 5935 */ |
5123 void set rightDelimiter(Token bracket) { | 5936 void set rightDelimiter(Token bracket) { |
5124 _rightDelimiter = bracket; | 5937 _rightDelimiter = bracket; |
5125 } | 5938 } |
| 5939 |
5126 /** | 5940 /** |
5127 * Set the right parenthesis to the given token. | 5941 * Set the right parenthesis to the given token. |
5128 * @param parenthesis the right parenthesis | 5942 * @param parenthesis the right parenthesis |
5129 */ | 5943 */ |
5130 void set rightParenthesis(Token parenthesis) { | 5944 void set rightParenthesis(Token parenthesis) { |
5131 _rightParenthesis = parenthesis; | 5945 _rightParenthesis = parenthesis; |
5132 } | 5946 } |
5133 void visitChildren(ASTVisitor<Object> visitor) { | 5947 void visitChildren(ASTVisitor<Object> visitor) { |
5134 _parameters.accept(visitor); | 5948 _parameters.accept(visitor); |
5135 } | 5949 } |
5136 } | 5950 } |
| 5951 |
5137 /** | 5952 /** |
5138 * The abstract class {@code FunctionBody} defines the behavior common to object
s representing the | 5953 * The abstract class {@code FunctionBody} defines the behavior common to object
s representing the |
5139 * body of a function or method. | 5954 * body of a function or method. |
5140 * <pre> | 5955 * <pre> |
5141 * functionBody ::={@link BlockFunctionBody blockFunctionBody}| {@link EmptyFunc
tionBody emptyFunctionBody}| {@link ExpressionFunctionBody expressionFunctionBod
y}</pre> | 5956 * functionBody ::={@link BlockFunctionBody blockFunctionBody}| {@link EmptyFunc
tionBody emptyFunctionBody}| {@link ExpressionFunctionBody expressionFunctionBod
y}</pre> |
5142 * @coverage dart.engine.ast | 5957 * @coverage dart.engine.ast |
5143 */ | 5958 */ |
5144 abstract class FunctionBody extends ASTNode { | 5959 abstract class FunctionBody extends ASTNode { |
5145 } | 5960 } |
| 5961 |
5146 /** | 5962 /** |
5147 * Instances of the class {@code FunctionDeclaration} wrap a {@link FunctionExpr
ession function | 5963 * Instances of the class {@code FunctionDeclaration} wrap a {@link FunctionExpr
ession function |
5148 * expression} as a top-level declaration. | 5964 * expression} as a top-level declaration. |
5149 * <pre> | 5965 * <pre> |
5150 * functionDeclaration ::= | 5966 * functionDeclaration ::= |
5151 * 'external' functionSignature | 5967 * 'external' functionSignature |
5152 * | functionSignature {@link FunctionBody functionBody}functionSignature ::={@l
ink Type returnType}? ('get' | 'set')? {@link SimpleIdentifier functionName} {@l
ink FormalParameterList formalParameterList}</pre> | 5968 * | functionSignature {@link FunctionBody functionBody}functionSignature ::={@l
ink Type returnType}? ('get' | 'set')? {@link SimpleIdentifier functionName} {@l
ink FormalParameterList formalParameterList}</pre> |
5153 * @coverage dart.engine.ast | 5969 * @coverage dart.engine.ast |
5154 */ | 5970 */ |
5155 class FunctionDeclaration extends CompilationUnitMember { | 5971 class FunctionDeclaration extends CompilationUnitMember { |
| 5972 |
5156 /** | 5973 /** |
5157 * The token representing the 'external' keyword, or {@code null} if this is n
ot an external | 5974 * The token representing the 'external' keyword, or {@code null} if this is n
ot an external |
5158 * function. | 5975 * function. |
5159 */ | 5976 */ |
5160 Token _externalKeyword; | 5977 Token _externalKeyword; |
| 5978 |
5161 /** | 5979 /** |
5162 * The return type of the function, or {@code null} if no return type was decl
ared. | 5980 * The return type of the function, or {@code null} if no return type was decl
ared. |
5163 */ | 5981 */ |
5164 TypeName _returnType; | 5982 TypeName _returnType; |
| 5983 |
5165 /** | 5984 /** |
5166 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a function | 5985 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a function |
5167 * declaration rather than a property declaration. | 5986 * declaration rather than a property declaration. |
5168 */ | 5987 */ |
5169 Token _propertyKeyword; | 5988 Token _propertyKeyword; |
| 5989 |
5170 /** | 5990 /** |
5171 * The name of the function, or {@code null} if the function is not named. | 5991 * The name of the function, or {@code null} if the function is not named. |
5172 */ | 5992 */ |
5173 SimpleIdentifier _name; | 5993 SimpleIdentifier _name; |
| 5994 |
5174 /** | 5995 /** |
5175 * The function expression being wrapped. | 5996 * The function expression being wrapped. |
5176 */ | 5997 */ |
5177 FunctionExpression _functionExpression; | 5998 FunctionExpression _functionExpression; |
| 5999 |
5178 /** | 6000 /** |
5179 * Initialize a newly created function declaration. | 6001 * Initialize a newly created function declaration. |
5180 * @param comment the documentation comment associated with this function | 6002 * @param comment the documentation comment associated with this function |
5181 * @param metadata the annotations associated with this function | 6003 * @param metadata the annotations associated with this function |
5182 * @param externalKeyword the token representing the 'external' keyword | 6004 * @param externalKeyword the token representing the 'external' keyword |
5183 * @param returnType the return type of the function | 6005 * @param returnType the return type of the function |
5184 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 6006 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
5185 * @param name the name of the function | 6007 * @param name the name of the function |
5186 * @param functionExpression the function expression being wrapped | 6008 * @param functionExpression the function expression being wrapped |
5187 */ | 6009 */ |
5188 FunctionDeclaration.full(Comment comment, List<Annotation> metadata, Token ext
ernalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name,
FunctionExpression functionExpression) : super.full(comment, metadata) { | 6010 FunctionDeclaration.full(Comment comment, List<Annotation> metadata, Token ext
ernalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name,
FunctionExpression functionExpression) : super.full(comment, metadata) { |
5189 this._externalKeyword = externalKeyword; | 6011 this._externalKeyword = externalKeyword; |
5190 this._returnType = becomeParentOf(returnType); | 6012 this._returnType = becomeParentOf(returnType); |
5191 this._propertyKeyword = propertyKeyword; | 6013 this._propertyKeyword = propertyKeyword; |
5192 this._name = becomeParentOf(name); | 6014 this._name = becomeParentOf(name); |
5193 this._functionExpression = becomeParentOf(functionExpression); | 6015 this._functionExpression = becomeParentOf(functionExpression); |
5194 } | 6016 } |
| 6017 |
5195 /** | 6018 /** |
5196 * Initialize a newly created function declaration. | 6019 * Initialize a newly created function declaration. |
5197 * @param comment the documentation comment associated with this function | 6020 * @param comment the documentation comment associated with this function |
5198 * @param metadata the annotations associated with this function | 6021 * @param metadata the annotations associated with this function |
5199 * @param externalKeyword the token representing the 'external' keyword | 6022 * @param externalKeyword the token representing the 'external' keyword |
5200 * @param returnType the return type of the function | 6023 * @param returnType the return type of the function |
5201 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 6024 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
5202 * @param name the name of the function | 6025 * @param name the name of the function |
5203 * @param functionExpression the function expression being wrapped | 6026 * @param functionExpression the function expression being wrapped |
5204 */ | 6027 */ |
5205 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); | 6028 FunctionDeclaration({Comment comment, List<Annotation> metadata, Token externa
lKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name, Fun
ctionExpression functionExpression}) : this.full(comment, metadata, externalKeyw
ord, returnType, propertyKeyword, name, functionExpression); |
5206 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); | 6029 accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this); |
5207 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; | 6030 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; |
5208 Token get endToken => _functionExpression.endToken; | 6031 Token get endToken => _functionExpression.endToken; |
| 6032 |
5209 /** | 6033 /** |
5210 * Return the token representing the 'external' keyword, or {@code null} if th
is is not an | 6034 * Return the token representing the 'external' keyword, or {@code null} if th
is is not an |
5211 * external function. | 6035 * external function. |
5212 * @return the token representing the 'external' keyword | 6036 * @return the token representing the 'external' keyword |
5213 */ | 6037 */ |
5214 Token get externalKeyword => _externalKeyword; | 6038 Token get externalKeyword => _externalKeyword; |
| 6039 |
5215 /** | 6040 /** |
5216 * Return the function expression being wrapped. | 6041 * Return the function expression being wrapped. |
5217 * @return the function expression being wrapped | 6042 * @return the function expression being wrapped |
5218 */ | 6043 */ |
5219 FunctionExpression get functionExpression => _functionExpression; | 6044 FunctionExpression get functionExpression => _functionExpression; |
| 6045 |
5220 /** | 6046 /** |
5221 * Return the name of the function, or {@code null} if the function is not nam
ed. | 6047 * Return the name of the function, or {@code null} if the function is not nam
ed. |
5222 * @return the name of the function | 6048 * @return the name of the function |
5223 */ | 6049 */ |
5224 SimpleIdentifier get name => _name; | 6050 SimpleIdentifier get name => _name; |
| 6051 |
5225 /** | 6052 /** |
5226 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a function | 6053 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a function |
5227 * declaration rather than a property declaration. | 6054 * declaration rather than a property declaration. |
5228 * @return the token representing the 'get' or 'set' keyword | 6055 * @return the token representing the 'get' or 'set' keyword |
5229 */ | 6056 */ |
5230 Token get propertyKeyword => _propertyKeyword; | 6057 Token get propertyKeyword => _propertyKeyword; |
| 6058 |
5231 /** | 6059 /** |
5232 * Return the return type of the function, or {@code null} if no return type w
as declared. | 6060 * Return the return type of the function, or {@code null} if no return type w
as declared. |
5233 * @return the return type of the function | 6061 * @return the return type of the function |
5234 */ | 6062 */ |
5235 TypeName get returnType => _returnType; | 6063 TypeName get returnType => _returnType; |
| 6064 |
5236 /** | 6065 /** |
5237 * Return {@code true} if this function declares a getter. | 6066 * Return {@code true} if this function declares a getter. |
5238 * @return {@code true} if this function declares a getter | 6067 * @return {@code true} if this function declares a getter |
5239 */ | 6068 */ |
5240 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); | 6069 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); |
| 6070 |
5241 /** | 6071 /** |
5242 * Return {@code true} if this function declares a setter. | 6072 * Return {@code true} if this function declares a setter. |
5243 * @return {@code true} if this function declares a setter | 6073 * @return {@code true} if this function declares a setter |
5244 */ | 6074 */ |
5245 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); | 6075 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); |
| 6076 |
5246 /** | 6077 /** |
5247 * Set the token representing the 'external' keyword to the given token. | 6078 * Set the token representing the 'external' keyword to the given token. |
5248 * @param externalKeyword the token representing the 'external' keyword | 6079 * @param externalKeyword the token representing the 'external' keyword |
5249 */ | 6080 */ |
5250 void set externalKeyword(Token externalKeyword2) { | 6081 void set externalKeyword(Token externalKeyword2) { |
5251 this._externalKeyword = externalKeyword2; | 6082 this._externalKeyword = externalKeyword2; |
5252 } | 6083 } |
| 6084 |
5253 /** | 6085 /** |
5254 * Set the function expression being wrapped to the given function expression. | 6086 * Set the function expression being wrapped to the given function expression. |
5255 * @param functionExpression the function expression being wrapped | 6087 * @param functionExpression the function expression being wrapped |
5256 */ | 6088 */ |
5257 void set functionExpression(FunctionExpression functionExpression2) { | 6089 void set functionExpression(FunctionExpression functionExpression2) { |
5258 functionExpression2 = becomeParentOf(functionExpression2); | 6090 functionExpression2 = becomeParentOf(functionExpression2); |
5259 } | 6091 } |
| 6092 |
5260 /** | 6093 /** |
5261 * Set the name of the function to the given identifier. | 6094 * Set the name of the function to the given identifier. |
5262 * @param identifier the name of the function | 6095 * @param identifier the name of the function |
5263 */ | 6096 */ |
5264 void set name(SimpleIdentifier identifier) { | 6097 void set name(SimpleIdentifier identifier) { |
5265 _name = becomeParentOf(identifier); | 6098 _name = becomeParentOf(identifier); |
5266 } | 6099 } |
| 6100 |
5267 /** | 6101 /** |
5268 * Set the token representing the 'get' or 'set' keyword to the given token. | 6102 * Set the token representing the 'get' or 'set' keyword to the given token. |
5269 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 6103 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
5270 */ | 6104 */ |
5271 void set propertyKeyword(Token propertyKeyword2) { | 6105 void set propertyKeyword(Token propertyKeyword2) { |
5272 this._propertyKeyword = propertyKeyword2; | 6106 this._propertyKeyword = propertyKeyword2; |
5273 } | 6107 } |
| 6108 |
5274 /** | 6109 /** |
5275 * Set the return type of the function to the given name. | 6110 * Set the return type of the function to the given name. |
5276 * @param name the return type of the function | 6111 * @param name the return type of the function |
5277 */ | 6112 */ |
5278 void set returnType(TypeName name) { | 6113 void set returnType(TypeName name) { |
5279 _returnType = becomeParentOf(name); | 6114 _returnType = becomeParentOf(name); |
5280 } | 6115 } |
5281 void visitChildren(ASTVisitor<Object> visitor) { | 6116 void visitChildren(ASTVisitor<Object> visitor) { |
5282 super.visitChildren(visitor); | 6117 super.visitChildren(visitor); |
5283 safelyVisitChild(_returnType, visitor); | 6118 safelyVisitChild(_returnType, visitor); |
5284 safelyVisitChild(_name, visitor); | 6119 safelyVisitChild(_name, visitor); |
5285 safelyVisitChild(_functionExpression, visitor); | 6120 safelyVisitChild(_functionExpression, visitor); |
5286 } | 6121 } |
5287 Token get firstTokenAfterCommentAndMetadata { | 6122 Token get firstTokenAfterCommentAndMetadata { |
5288 if (_externalKeyword != null) { | 6123 if (_externalKeyword != null) { |
5289 return _externalKeyword; | 6124 return _externalKeyword; |
5290 } | 6125 } |
5291 if (_returnType != null) { | 6126 if (_returnType != null) { |
5292 return _returnType.beginToken; | 6127 return _returnType.beginToken; |
5293 } else if (_propertyKeyword != null) { | 6128 } else if (_propertyKeyword != null) { |
5294 return _propertyKeyword; | 6129 return _propertyKeyword; |
5295 } else if (_name != null) { | 6130 } else if (_name != null) { |
5296 return _name.beginToken; | 6131 return _name.beginToken; |
5297 } | 6132 } |
5298 return _functionExpression.beginToken; | 6133 return _functionExpression.beginToken; |
5299 } | 6134 } |
5300 } | 6135 } |
| 6136 |
5301 /** | 6137 /** |
5302 * Instances of the class {@code FunctionDeclarationStatement} wrap a {@link Fun
ctionDeclarationfunction declaration} as a statement. | 6138 * Instances of the class {@code FunctionDeclarationStatement} wrap a {@link Fun
ctionDeclarationfunction declaration} as a statement. |
5303 * @coverage dart.engine.ast | 6139 * @coverage dart.engine.ast |
5304 */ | 6140 */ |
5305 class FunctionDeclarationStatement extends Statement { | 6141 class FunctionDeclarationStatement extends Statement { |
| 6142 |
5306 /** | 6143 /** |
5307 * The function declaration being wrapped. | 6144 * The function declaration being wrapped. |
5308 */ | 6145 */ |
5309 FunctionDeclaration _functionDeclaration; | 6146 FunctionDeclaration _functionDeclaration; |
| 6147 |
5310 /** | 6148 /** |
5311 * Initialize a newly created function declaration statement. | 6149 * Initialize a newly created function declaration statement. |
5312 * @param functionDeclaration the the function declaration being wrapped | 6150 * @param functionDeclaration the the function declaration being wrapped |
5313 */ | 6151 */ |
5314 FunctionDeclarationStatement.full(FunctionDeclaration functionDeclaration) { | 6152 FunctionDeclarationStatement.full(FunctionDeclaration functionDeclaration) { |
5315 this._functionDeclaration = becomeParentOf(functionDeclaration); | 6153 this._functionDeclaration = becomeParentOf(functionDeclaration); |
5316 } | 6154 } |
| 6155 |
5317 /** | 6156 /** |
5318 * Initialize a newly created function declaration statement. | 6157 * Initialize a newly created function declaration statement. |
5319 * @param functionDeclaration the the function declaration being wrapped | 6158 * @param functionDeclaration the the function declaration being wrapped |
5320 */ | 6159 */ |
5321 FunctionDeclarationStatement({FunctionDeclaration functionDeclaration}) : this
.full(functionDeclaration); | 6160 FunctionDeclarationStatement({FunctionDeclaration functionDeclaration}) : this
.full(functionDeclaration); |
5322 accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); | 6161 accept(ASTVisitor visitor) => visitor.visitFunctionDeclarationStatement(this); |
5323 Token get beginToken => _functionDeclaration.beginToken; | 6162 Token get beginToken => _functionDeclaration.beginToken; |
5324 Token get endToken => _functionDeclaration.endToken; | 6163 Token get endToken => _functionDeclaration.endToken; |
| 6164 |
5325 /** | 6165 /** |
5326 * Return the function declaration being wrapped. | 6166 * Return the function declaration being wrapped. |
5327 * @return the function declaration being wrapped | 6167 * @return the function declaration being wrapped |
5328 */ | 6168 */ |
5329 FunctionDeclaration get functionDeclaration => _functionDeclaration; | 6169 FunctionDeclaration get functionDeclaration => _functionDeclaration; |
| 6170 |
5330 /** | 6171 /** |
5331 * Set the function declaration being wrapped to the given function declaratio
n. | 6172 * Set the function declaration being wrapped to the given function declaratio
n. |
5332 * @param functionDeclaration the function declaration being wrapped | 6173 * @param functionDeclaration the function declaration being wrapped |
5333 */ | 6174 */ |
5334 void set functionExpression(FunctionDeclaration functionDeclaration2) { | 6175 void set functionExpression(FunctionDeclaration functionDeclaration2) { |
5335 this._functionDeclaration = becomeParentOf(functionDeclaration2); | 6176 this._functionDeclaration = becomeParentOf(functionDeclaration2); |
5336 } | 6177 } |
5337 void visitChildren(ASTVisitor<Object> visitor) { | 6178 void visitChildren(ASTVisitor<Object> visitor) { |
5338 safelyVisitChild(_functionDeclaration, visitor); | 6179 safelyVisitChild(_functionDeclaration, visitor); |
5339 } | 6180 } |
5340 } | 6181 } |
| 6182 |
5341 /** | 6183 /** |
5342 * Instances of the class {@code FunctionExpression} represent a function expres
sion. | 6184 * Instances of the class {@code FunctionExpression} represent a function expres
sion. |
5343 * <pre> | 6185 * <pre> |
5344 * functionExpression ::={@link FormalParameterList formalParameterList} {@link
FunctionBody functionBody}</pre> | 6186 * functionExpression ::={@link FormalParameterList formalParameterList} {@link
FunctionBody functionBody}</pre> |
5345 * @coverage dart.engine.ast | 6187 * @coverage dart.engine.ast |
5346 */ | 6188 */ |
5347 class FunctionExpression extends Expression { | 6189 class FunctionExpression extends Expression { |
| 6190 |
5348 /** | 6191 /** |
5349 * The parameters associated with the function. | 6192 * The parameters associated with the function. |
5350 */ | 6193 */ |
5351 FormalParameterList _parameters; | 6194 FormalParameterList _parameters; |
| 6195 |
5352 /** | 6196 /** |
5353 * The body of the function, or {@code null} if this is an external function. | 6197 * The body of the function, or {@code null} if this is an external function. |
5354 */ | 6198 */ |
5355 FunctionBody _body; | 6199 FunctionBody _body; |
| 6200 |
5356 /** | 6201 /** |
5357 * The element associated with the function, or {@code null} if the AST struct
ure has not been | 6202 * The element associated with the function, or {@code null} if the AST struct
ure has not been |
5358 * resolved. | 6203 * resolved. |
5359 */ | 6204 */ |
5360 ExecutableElement _element; | 6205 ExecutableElement _element; |
| 6206 |
5361 /** | 6207 /** |
5362 * Initialize a newly created function declaration. | 6208 * Initialize a newly created function declaration. |
5363 * @param parameters the parameters associated with the function | 6209 * @param parameters the parameters associated with the function |
5364 * @param body the body of the function | 6210 * @param body the body of the function |
5365 */ | 6211 */ |
5366 FunctionExpression.full(FormalParameterList parameters, FunctionBody body) { | 6212 FunctionExpression.full(FormalParameterList parameters, FunctionBody body) { |
5367 this._parameters = becomeParentOf(parameters); | 6213 this._parameters = becomeParentOf(parameters); |
5368 this._body = becomeParentOf(body); | 6214 this._body = becomeParentOf(body); |
5369 } | 6215 } |
| 6216 |
5370 /** | 6217 /** |
5371 * Initialize a newly created function declaration. | 6218 * Initialize a newly created function declaration. |
5372 * @param parameters the parameters associated with the function | 6219 * @param parameters the parameters associated with the function |
5373 * @param body the body of the function | 6220 * @param body the body of the function |
5374 */ | 6221 */ |
5375 FunctionExpression({FormalParameterList parameters, FunctionBody body}) : this
.full(parameters, body); | 6222 FunctionExpression({FormalParameterList parameters, FunctionBody body}) : this
.full(parameters, body); |
5376 accept(ASTVisitor visitor) => visitor.visitFunctionExpression(this); | 6223 accept(ASTVisitor visitor) => visitor.visitFunctionExpression(this); |
5377 Token get beginToken { | 6224 Token get beginToken { |
5378 if (_parameters != null) { | 6225 if (_parameters != null) { |
5379 return _parameters.beginToken; | 6226 return _parameters.beginToken; |
5380 } else if (_body != null) { | 6227 } else if (_body != null) { |
5381 return _body.beginToken; | 6228 return _body.beginToken; |
5382 } | 6229 } |
5383 throw new IllegalStateException("Non-external functions must have a body"); | 6230 throw new IllegalStateException("Non-external functions must have a body"); |
5384 } | 6231 } |
| 6232 |
5385 /** | 6233 /** |
5386 * Return the body of the function, or {@code null} if this is an external fun
ction. | 6234 * Return the body of the function, or {@code null} if this is an external fun
ction. |
5387 * @return the body of the function | 6235 * @return the body of the function |
5388 */ | 6236 */ |
5389 FunctionBody get body => _body; | 6237 FunctionBody get body => _body; |
| 6238 |
5390 /** | 6239 /** |
5391 * Return the element associated with this function, or {@code null} if the AS
T structure has not | 6240 * Return the element associated with this function, or {@code null} if the AS
T structure has not |
5392 * been resolved. | 6241 * been resolved. |
5393 * @return the element associated with this function | 6242 * @return the element associated with this function |
5394 */ | 6243 */ |
5395 ExecutableElement get element => _element; | 6244 ExecutableElement get element => _element; |
5396 Token get endToken { | 6245 Token get endToken { |
5397 if (_body != null) { | 6246 if (_body != null) { |
5398 return _body.endToken; | 6247 return _body.endToken; |
5399 } else if (_parameters != null) { | 6248 } else if (_parameters != null) { |
5400 return _parameters.endToken; | 6249 return _parameters.endToken; |
5401 } | 6250 } |
5402 throw new IllegalStateException("Non-external functions must have a body"); | 6251 throw new IllegalStateException("Non-external functions must have a body"); |
5403 } | 6252 } |
| 6253 |
5404 /** | 6254 /** |
5405 * Return the parameters associated with the function. | 6255 * Return the parameters associated with the function. |
5406 * @return the parameters associated with the function | 6256 * @return the parameters associated with the function |
5407 */ | 6257 */ |
5408 FormalParameterList get parameters => _parameters; | 6258 FormalParameterList get parameters => _parameters; |
| 6259 |
5409 /** | 6260 /** |
5410 * Set the body of the function to the given function body. | 6261 * Set the body of the function to the given function body. |
5411 * @param functionBody the body of the function | 6262 * @param functionBody the body of the function |
5412 */ | 6263 */ |
5413 void set body(FunctionBody functionBody) { | 6264 void set body(FunctionBody functionBody) { |
5414 _body = becomeParentOf(functionBody); | 6265 _body = becomeParentOf(functionBody); |
5415 } | 6266 } |
| 6267 |
5416 /** | 6268 /** |
5417 * Set the element associated with this function to the given element. | 6269 * Set the element associated with this function to the given element. |
5418 * @param element the element associated with this function | 6270 * @param element the element associated with this function |
5419 */ | 6271 */ |
5420 void set element(ExecutableElement element2) { | 6272 void set element(ExecutableElement element2) { |
5421 this._element = element2; | 6273 this._element = element2; |
5422 } | 6274 } |
| 6275 |
5423 /** | 6276 /** |
5424 * Set the parameters associated with the function to the given list of parame
ters. | 6277 * Set the parameters associated with the function to the given list of parame
ters. |
5425 * @param parameters the parameters associated with the function | 6278 * @param parameters the parameters associated with the function |
5426 */ | 6279 */ |
5427 void set parameters(FormalParameterList parameters2) { | 6280 void set parameters(FormalParameterList parameters2) { |
5428 this._parameters = becomeParentOf(parameters2); | 6281 this._parameters = becomeParentOf(parameters2); |
5429 } | 6282 } |
5430 void visitChildren(ASTVisitor<Object> visitor) { | 6283 void visitChildren(ASTVisitor<Object> visitor) { |
5431 safelyVisitChild(_parameters, visitor); | 6284 safelyVisitChild(_parameters, visitor); |
5432 safelyVisitChild(_body, visitor); | 6285 safelyVisitChild(_body, visitor); |
5433 } | 6286 } |
5434 } | 6287 } |
| 6288 |
5435 /** | 6289 /** |
5436 * Instances of the class {@code FunctionExpressionInvocation} represent the inv
ocation of a | 6290 * Instances of the class {@code FunctionExpressionInvocation} represent the inv
ocation of a |
5437 * function resulting from evaluating an expression. Invocations of methods and
other forms of | 6291 * function resulting from evaluating an expression. Invocations of methods and
other forms of |
5438 * functions are represented by {@link MethodInvocation method invocation} nodes
. Invocations of | 6292 * functions are represented by {@link MethodInvocation method invocation} nodes
. Invocations of |
5439 * getters and setters are represented by either {@link PrefixedIdentifier prefi
xed identifier} or{@link PropertyAccess property access} nodes. | 6293 * getters and setters are represented by either {@link PrefixedIdentifier prefi
xed identifier} or{@link PropertyAccess property access} nodes. |
5440 * <pre> | 6294 * <pre> |
5441 * functionExpressionInvoction ::={@link Expression function} {@link ArgumentLis
t argumentList}</pre> | 6295 * functionExpressionInvoction ::={@link Expression function} {@link ArgumentLis
t argumentList}</pre> |
5442 * @coverage dart.engine.ast | 6296 * @coverage dart.engine.ast |
5443 */ | 6297 */ |
5444 class FunctionExpressionInvocation extends Expression { | 6298 class FunctionExpressionInvocation extends Expression { |
| 6299 |
5445 /** | 6300 /** |
5446 * The expression producing the function being invoked. | 6301 * The expression producing the function being invoked. |
5447 */ | 6302 */ |
5448 Expression _function; | 6303 Expression _function; |
| 6304 |
5449 /** | 6305 /** |
5450 * The list of arguments to the function. | 6306 * The list of arguments to the function. |
5451 */ | 6307 */ |
5452 ArgumentList _argumentList; | 6308 ArgumentList _argumentList; |
| 6309 |
5453 /** | 6310 /** |
5454 * The element associated with the function being invoked, or {@code null} if
the AST structure | 6311 * The element associated with the function being invoked based on static type
information, or{@code null} if the AST structure has not been resolved or the f
unction could not be resolved. |
5455 * has not been resolved or the function could not be resolved. | |
5456 */ | 6312 */ |
5457 ExecutableElement _element; | 6313 ExecutableElement _staticElement; |
| 6314 |
| 6315 /** |
| 6316 * The element associated with the function being invoked based on propagated
type information, or{@code null} if the AST structure has not been resolved or t
he function could not be resolved. |
| 6317 */ |
| 6318 ExecutableElement _propagatedElement; |
| 6319 |
5458 /** | 6320 /** |
5459 * Initialize a newly created function expression invocation. | 6321 * Initialize a newly created function expression invocation. |
5460 * @param function the expression producing the function being invoked | 6322 * @param function the expression producing the function being invoked |
5461 * @param argumentList the list of arguments to the method | 6323 * @param argumentList the list of arguments to the method |
5462 */ | 6324 */ |
5463 FunctionExpressionInvocation.full(Expression function, ArgumentList argumentLi
st) { | 6325 FunctionExpressionInvocation.full(Expression function, ArgumentList argumentLi
st) { |
5464 this._function = becomeParentOf(function); | 6326 this._function = becomeParentOf(function); |
5465 this._argumentList = becomeParentOf(argumentList); | 6327 this._argumentList = becomeParentOf(argumentList); |
5466 } | 6328 } |
| 6329 |
5467 /** | 6330 /** |
5468 * Initialize a newly created function expression invocation. | 6331 * Initialize a newly created function expression invocation. |
5469 * @param function the expression producing the function being invoked | 6332 * @param function the expression producing the function being invoked |
5470 * @param argumentList the list of arguments to the method | 6333 * @param argumentList the list of arguments to the method |
5471 */ | 6334 */ |
5472 FunctionExpressionInvocation({Expression function, ArgumentList argumentList})
: this.full(function, argumentList); | 6335 FunctionExpressionInvocation({Expression function, ArgumentList argumentList})
: this.full(function, argumentList); |
5473 accept(ASTVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); | 6336 accept(ASTVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); |
| 6337 |
5474 /** | 6338 /** |
5475 * Return the list of arguments to the method. | 6339 * Return the list of arguments to the method. |
5476 * @return the list of arguments to the method | 6340 * @return the list of arguments to the method |
5477 */ | 6341 */ |
5478 ArgumentList get argumentList => _argumentList; | 6342 ArgumentList get argumentList => _argumentList; |
5479 Token get beginToken => _function.beginToken; | 6343 Token get beginToken => _function.beginToken; |
| 6344 |
5480 /** | 6345 /** |
5481 * Return the element associated with the function being invoked, or {@code nu
ll} if the AST | 6346 * Return the element associated with the function being invoked based on prop
agated type |
5482 * structure has not been resolved or the function could not be resolved. One
common example of | 6347 * information, or {@code null} if the AST structure has not been resolved or
the function could |
5483 * the latter case is an expression whose value can change over time. | 6348 * not be resolved. One common example of the latter case is an expression who
se value can change |
| 6349 * over time. |
5484 * @return the element associated with the function being invoked | 6350 * @return the element associated with the function being invoked |
5485 */ | 6351 */ |
5486 ExecutableElement get element => _element; | 6352 ExecutableElement get element => _propagatedElement; |
5487 Token get endToken => _argumentList.endToken; | 6353 Token get endToken => _argumentList.endToken; |
| 6354 |
5488 /** | 6355 /** |
5489 * Return the expression producing the function being invoked. | 6356 * Return the expression producing the function being invoked. |
5490 * @return the expression producing the function being invoked | 6357 * @return the expression producing the function being invoked |
5491 */ | 6358 */ |
5492 Expression get function => _function; | 6359 Expression get function => _function; |
| 6360 |
| 6361 /** |
| 6362 * Return the element associated with the function being invoked based on stat
ic type information, |
| 6363 * or {@code null} if the AST structure has not been resolved or the function
could not be |
| 6364 * resolved. One common example of the latter case is an expression whose valu
e can change over |
| 6365 * time. |
| 6366 * @return the element associated with the function |
| 6367 */ |
| 6368 ExecutableElement get staticElement => _staticElement; |
| 6369 |
5493 /** | 6370 /** |
5494 * Set the list of arguments to the method to the given list. | 6371 * Set the list of arguments to the method to the given list. |
5495 * @param argumentList the list of arguments to the method | 6372 * @param argumentList the list of arguments to the method |
5496 */ | 6373 */ |
5497 void set argumentList(ArgumentList argumentList2) { | 6374 void set argumentList(ArgumentList argumentList2) { |
5498 this._argumentList = becomeParentOf(argumentList2); | 6375 this._argumentList = becomeParentOf(argumentList2); |
5499 } | 6376 } |
| 6377 |
5500 /** | 6378 /** |
5501 * Set the element associated with the function being invoked to the given ele
ment. | 6379 * Set the element associated with the function being invoked based on propaga
ted type information |
5502 * @param element the element associated with the function being invoked | 6380 * to the given element. |
| 6381 * @param element the element to be associated with the function being invoked |
5503 */ | 6382 */ |
5504 void set element(ExecutableElement element2) { | 6383 void set element(ExecutableElement element2) { |
5505 this._element = element2; | 6384 _propagatedElement = element2; |
5506 } | 6385 } |
| 6386 |
5507 /** | 6387 /** |
5508 * Set the expression producing the function being invoked to the given expres
sion. | 6388 * Set the expression producing the function being invoked to the given expres
sion. |
5509 * @param function the expression producing the function being invoked | 6389 * @param function the expression producing the function being invoked |
5510 */ | 6390 */ |
5511 void set function(Expression function2) { | 6391 void set function(Expression function2) { |
5512 function2 = becomeParentOf(function2); | 6392 function2 = becomeParentOf(function2); |
5513 } | 6393 } |
| 6394 |
| 6395 /** |
| 6396 * Set the element associated with the function being invoked based on static
type information to |
| 6397 * the given element. |
| 6398 * @param element the element to be associated with the function |
| 6399 */ |
| 6400 void set staticElement(ExecutableElement element) { |
| 6401 this._staticElement = element; |
| 6402 } |
5514 void visitChildren(ASTVisitor<Object> visitor) { | 6403 void visitChildren(ASTVisitor<Object> visitor) { |
5515 safelyVisitChild(_function, visitor); | 6404 safelyVisitChild(_function, visitor); |
5516 safelyVisitChild(_argumentList, visitor); | 6405 safelyVisitChild(_argumentList, visitor); |
5517 } | 6406 } |
5518 } | 6407 } |
| 6408 |
5519 /** | 6409 /** |
5520 * Instances of the class {@code FunctionTypeAlias} represent a function type al
ias. | 6410 * Instances of the class {@code FunctionTypeAlias} represent a function type al
ias. |
5521 * <pre> | 6411 * <pre> |
5522 * functionTypeAlias ::= | 6412 * functionTypeAlias ::= |
5523 * functionPrefix {@link TypeParameterList typeParameterList}? {@link FormalPara
meterList formalParameterList} ';' | 6413 * functionPrefix {@link TypeParameterList typeParameterList}? {@link FormalPara
meterList formalParameterList} ';' |
5524 * functionPrefix ::={@link TypeName returnType}? {@link SimpleIdentifier name}<
/pre> | 6414 * functionPrefix ::={@link TypeName returnType}? {@link SimpleIdentifier name}<
/pre> |
5525 * @coverage dart.engine.ast | 6415 * @coverage dart.engine.ast |
5526 */ | 6416 */ |
5527 class FunctionTypeAlias extends TypeAlias { | 6417 class FunctionTypeAlias extends TypeAlias { |
| 6418 |
5528 /** | 6419 /** |
5529 * The name of the return type of the function type being defined, or {@code n
ull} if no return | 6420 * The name of the return type of the function type being defined, or {@code n
ull} if no return |
5530 * type was given. | 6421 * type was given. |
5531 */ | 6422 */ |
5532 TypeName _returnType; | 6423 TypeName _returnType; |
| 6424 |
5533 /** | 6425 /** |
5534 * The name of the function type being declared. | 6426 * The name of the function type being declared. |
5535 */ | 6427 */ |
5536 SimpleIdentifier _name; | 6428 SimpleIdentifier _name; |
| 6429 |
5537 /** | 6430 /** |
5538 * The type parameters for the function type, or {@code null} if the function
type does not have | 6431 * The type parameters for the function type, or {@code null} if the function
type does not have |
5539 * any type parameters. | 6432 * any type parameters. |
5540 */ | 6433 */ |
5541 TypeParameterList _typeParameters; | 6434 TypeParameterList _typeParameters; |
| 6435 |
5542 /** | 6436 /** |
5543 * The parameters associated with the function type. | 6437 * The parameters associated with the function type. |
5544 */ | 6438 */ |
5545 FormalParameterList _parameters; | 6439 FormalParameterList _parameters; |
| 6440 |
5546 /** | 6441 /** |
5547 * Initialize a newly created function type alias. | 6442 * Initialize a newly created function type alias. |
5548 * @param comment the documentation comment associated with this type alias | 6443 * @param comment the documentation comment associated with this type alias |
5549 * @param metadata the annotations associated with this type alias | 6444 * @param metadata the annotations associated with this type alias |
5550 * @param keyword the token representing the 'typedef' keyword | 6445 * @param keyword the token representing the 'typedef' keyword |
5551 * @param returnType the name of the return type of the function type being de
fined | 6446 * @param returnType the name of the return type of the function type being de
fined |
5552 * @param name the name of the type being declared | 6447 * @param name the name of the type being declared |
5553 * @param typeParameters the type parameters for the type | 6448 * @param typeParameters the type parameters for the type |
5554 * @param parameters the parameters associated with the function | 6449 * @param parameters the parameters associated with the function |
5555 * @param semicolon the semicolon terminating the declaration | 6450 * @param semicolon the semicolon terminating the declaration |
5556 */ | 6451 */ |
5557 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) { | 6452 FunctionTypeAlias.full(Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters
, FormalParameterList parameters, Token semicolon) : super.full(comment, metadat
a, keyword, semicolon) { |
5558 this._returnType = becomeParentOf(returnType); | 6453 this._returnType = becomeParentOf(returnType); |
5559 this._name = becomeParentOf(name); | 6454 this._name = becomeParentOf(name); |
5560 this._typeParameters = becomeParentOf(typeParameters); | 6455 this._typeParameters = becomeParentOf(typeParameters); |
5561 this._parameters = becomeParentOf(parameters); | 6456 this._parameters = becomeParentOf(parameters); |
5562 } | 6457 } |
| 6458 |
5563 /** | 6459 /** |
5564 * Initialize a newly created function type alias. | 6460 * Initialize a newly created function type alias. |
5565 * @param comment the documentation comment associated with this type alias | 6461 * @param comment the documentation comment associated with this type alias |
5566 * @param metadata the annotations associated with this type alias | 6462 * @param metadata the annotations associated with this type alias |
5567 * @param keyword the token representing the 'typedef' keyword | 6463 * @param keyword the token representing the 'typedef' keyword |
5568 * @param returnType the name of the return type of the function type being de
fined | 6464 * @param returnType the name of the return type of the function type being de
fined |
5569 * @param name the name of the type being declared | 6465 * @param name the name of the type being declared |
5570 * @param typeParameters the type parameters for the type | 6466 * @param typeParameters the type parameters for the type |
5571 * @param parameters the parameters associated with the function | 6467 * @param parameters the parameters associated with the function |
5572 * @param semicolon the semicolon terminating the declaration | 6468 * @param semicolon the semicolon terminating the declaration |
5573 */ | 6469 */ |
5574 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); | 6470 FunctionTypeAlias({Comment comment, List<Annotation> metadata, Token keyword,
TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, Fo
rmalParameterList parameters, Token semicolon}) : this.full(comment, metadata, k
eyword, returnType, name, typeParameters, parameters, semicolon); |
5575 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); | 6471 accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this); |
5576 FunctionTypeAliasElement get element => _name != null ? (_name.element as Func
tionTypeAliasElement) : null; | 6472 FunctionTypeAliasElement get element => _name != null ? (_name.element as Func
tionTypeAliasElement) : null; |
| 6473 |
5577 /** | 6474 /** |
5578 * Return the name of the function type being declared. | 6475 * Return the name of the function type being declared. |
5579 * @return the name of the function type being declared | 6476 * @return the name of the function type being declared |
5580 */ | 6477 */ |
5581 SimpleIdentifier get name => _name; | 6478 SimpleIdentifier get name => _name; |
| 6479 |
5582 /** | 6480 /** |
5583 * Return the parameters associated with the function type. | 6481 * Return the parameters associated with the function type. |
5584 * @return the parameters associated with the function type | 6482 * @return the parameters associated with the function type |
5585 */ | 6483 */ |
5586 FormalParameterList get parameters => _parameters; | 6484 FormalParameterList get parameters => _parameters; |
| 6485 |
5587 /** | 6486 /** |
5588 * Return the name of the return type of the function type being defined, or {
@code null} if no | 6487 * Return the name of the return type of the function type being defined, or {
@code null} if no |
5589 * return type was given. | 6488 * return type was given. |
5590 * @return the name of the return type of the function type being defined | 6489 * @return the name of the return type of the function type being defined |
5591 */ | 6490 */ |
5592 TypeName get returnType => _returnType; | 6491 TypeName get returnType => _returnType; |
| 6492 |
5593 /** | 6493 /** |
5594 * Return the type parameters for the function type, or {@code null} if the fu
nction type does not | 6494 * Return the type parameters for the function type, or {@code null} if the fu
nction type does not |
5595 * have any type parameters. | 6495 * have any type parameters. |
5596 * @return the type parameters for the function type | 6496 * @return the type parameters for the function type |
5597 */ | 6497 */ |
5598 TypeParameterList get typeParameters => _typeParameters; | 6498 TypeParameterList get typeParameters => _typeParameters; |
| 6499 |
5599 /** | 6500 /** |
5600 * Set the name of the function type being declared to the given identifier. | 6501 * Set the name of the function type being declared to the given identifier. |
5601 * @param name the name of the function type being declared | 6502 * @param name the name of the function type being declared |
5602 */ | 6503 */ |
5603 void set name(SimpleIdentifier name2) { | 6504 void set name(SimpleIdentifier name2) { |
5604 this._name = becomeParentOf(name2); | 6505 this._name = becomeParentOf(name2); |
5605 } | 6506 } |
| 6507 |
5606 /** | 6508 /** |
5607 * Set the parameters associated with the function type to the given list of p
arameters. | 6509 * Set the parameters associated with the function type to the given list of p
arameters. |
5608 * @param parameters the parameters associated with the function type | 6510 * @param parameters the parameters associated with the function type |
5609 */ | 6511 */ |
5610 void set parameters(FormalParameterList parameters2) { | 6512 void set parameters(FormalParameterList parameters2) { |
5611 this._parameters = becomeParentOf(parameters2); | 6513 this._parameters = becomeParentOf(parameters2); |
5612 } | 6514 } |
| 6515 |
5613 /** | 6516 /** |
5614 * Set the name of the return type of the function type being defined to the g
iven type name. | 6517 * Set the name of the return type of the function type being defined to the g
iven type name. |
5615 * @param typeName the name of the return type of the function type being defi
ned | 6518 * @param typeName the name of the return type of the function type being defi
ned |
5616 */ | 6519 */ |
5617 void set returnType(TypeName typeName) { | 6520 void set returnType(TypeName typeName) { |
5618 _returnType = becomeParentOf(typeName); | 6521 _returnType = becomeParentOf(typeName); |
5619 } | 6522 } |
| 6523 |
5620 /** | 6524 /** |
5621 * Set the type parameters for the function type to the given list of paramete
rs. | 6525 * Set the type parameters for the function type to the given list of paramete
rs. |
5622 * @param typeParameters the type parameters for the function type | 6526 * @param typeParameters the type parameters for the function type |
5623 */ | 6527 */ |
5624 void set typeParameters(TypeParameterList typeParameters2) { | 6528 void set typeParameters(TypeParameterList typeParameters2) { |
5625 this._typeParameters = becomeParentOf(typeParameters2); | 6529 this._typeParameters = becomeParentOf(typeParameters2); |
5626 } | 6530 } |
5627 void visitChildren(ASTVisitor<Object> visitor) { | 6531 void visitChildren(ASTVisitor<Object> visitor) { |
5628 super.visitChildren(visitor); | 6532 super.visitChildren(visitor); |
5629 safelyVisitChild(_returnType, visitor); | 6533 safelyVisitChild(_returnType, visitor); |
5630 safelyVisitChild(_name, visitor); | 6534 safelyVisitChild(_name, visitor); |
5631 safelyVisitChild(_typeParameters, visitor); | 6535 safelyVisitChild(_typeParameters, visitor); |
5632 safelyVisitChild(_parameters, visitor); | 6536 safelyVisitChild(_parameters, visitor); |
5633 } | 6537 } |
5634 } | 6538 } |
| 6539 |
5635 /** | 6540 /** |
5636 * Instances of the class {@code FunctionTypedFormalParameter} represent a funct
ion-typed formal | 6541 * Instances of the class {@code FunctionTypedFormalParameter} represent a funct
ion-typed formal |
5637 * parameter. | 6542 * parameter. |
5638 * <pre> | 6543 * <pre> |
5639 * functionSignature ::={@link TypeName returnType}? {@link SimpleIdentifier ide
ntifier} {@link FormalParameterList formalParameterList}</pre> | 6544 * functionSignature ::={@link TypeName returnType}? {@link SimpleIdentifier ide
ntifier} {@link FormalParameterList formalParameterList}</pre> |
5640 * @coverage dart.engine.ast | 6545 * @coverage dart.engine.ast |
5641 */ | 6546 */ |
5642 class FunctionTypedFormalParameter extends NormalFormalParameter { | 6547 class FunctionTypedFormalParameter extends NormalFormalParameter { |
| 6548 |
5643 /** | 6549 /** |
5644 * The return type of the function, or {@code null} if the function does not h
ave a return type. | 6550 * The return type of the function, or {@code null} if the function does not h
ave a return type. |
5645 */ | 6551 */ |
5646 TypeName _returnType; | 6552 TypeName _returnType; |
| 6553 |
5647 /** | 6554 /** |
5648 * The parameters of the function-typed parameter. | 6555 * The parameters of the function-typed parameter. |
5649 */ | 6556 */ |
5650 FormalParameterList _parameters; | 6557 FormalParameterList _parameters; |
| 6558 |
5651 /** | 6559 /** |
5652 * Initialize a newly created formal parameter. | 6560 * Initialize a newly created formal parameter. |
5653 * @param comment the documentation comment associated with this parameter | 6561 * @param comment the documentation comment associated with this parameter |
5654 * @param metadata the annotations associated with this parameter | 6562 * @param metadata the annotations associated with this parameter |
5655 * @param returnType the return type of the function, or {@code null} if the f
unction does not | 6563 * @param returnType the return type of the function, or {@code null} if the f
unction does not |
5656 * have a return type | 6564 * have a return type |
5657 * @param identifier the name of the function-typed parameter | 6565 * @param identifier the name of the function-typed parameter |
5658 * @param parameters the parameters of the function-typed parameter | 6566 * @param parameters the parameters of the function-typed parameter |
5659 */ | 6567 */ |
5660 FunctionTypedFormalParameter.full(Comment comment, List<Annotation> metadata,
TypeName returnType, SimpleIdentifier identifier, FormalParameterList parameters
) : super.full(comment, metadata, identifier) { | 6568 FunctionTypedFormalParameter.full(Comment comment, List<Annotation> metadata,
TypeName returnType, SimpleIdentifier identifier, FormalParameterList parameters
) : super.full(comment, metadata, identifier) { |
5661 this._returnType = becomeParentOf(returnType); | 6569 this._returnType = becomeParentOf(returnType); |
5662 this._parameters = becomeParentOf(parameters); | 6570 this._parameters = becomeParentOf(parameters); |
5663 } | 6571 } |
| 6572 |
5664 /** | 6573 /** |
5665 * Initialize a newly created formal parameter. | 6574 * Initialize a newly created formal parameter. |
5666 * @param comment the documentation comment associated with this parameter | 6575 * @param comment the documentation comment associated with this parameter |
5667 * @param metadata the annotations associated with this parameter | 6576 * @param metadata the annotations associated with this parameter |
5668 * @param returnType the return type of the function, or {@code null} if the f
unction does not | 6577 * @param returnType the return type of the function, or {@code null} if the f
unction does not |
5669 * have a return type | 6578 * have a return type |
5670 * @param identifier the name of the function-typed parameter | 6579 * @param identifier the name of the function-typed parameter |
5671 * @param parameters the parameters of the function-typed parameter | 6580 * @param parameters the parameters of the function-typed parameter |
5672 */ | 6581 */ |
5673 FunctionTypedFormalParameter({Comment comment, List<Annotation> metadata, Type
Name returnType, SimpleIdentifier identifier, FormalParameterList parameters}) :
this.full(comment, metadata, returnType, identifier, parameters); | 6582 FunctionTypedFormalParameter({Comment comment, List<Annotation> metadata, Type
Name returnType, SimpleIdentifier identifier, FormalParameterList parameters}) :
this.full(comment, metadata, returnType, identifier, parameters); |
5674 accept(ASTVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); | 6583 accept(ASTVisitor visitor) => visitor.visitFunctionTypedFormalParameter(this); |
5675 Token get beginToken { | 6584 Token get beginToken { |
5676 if (_returnType != null) { | 6585 if (_returnType != null) { |
5677 return _returnType.beginToken; | 6586 return _returnType.beginToken; |
5678 } | 6587 } |
5679 return identifier.beginToken; | 6588 return identifier.beginToken; |
5680 } | 6589 } |
5681 Token get endToken => _parameters.endToken; | 6590 Token get endToken => _parameters.endToken; |
| 6591 |
5682 /** | 6592 /** |
5683 * Return the parameters of the function-typed parameter. | 6593 * Return the parameters of the function-typed parameter. |
5684 * @return the parameters of the function-typed parameter | 6594 * @return the parameters of the function-typed parameter |
5685 */ | 6595 */ |
5686 FormalParameterList get parameters => _parameters; | 6596 FormalParameterList get parameters => _parameters; |
| 6597 |
5687 /** | 6598 /** |
5688 * Return the return type of the function, or {@code null} if the function doe
s not have a return | 6599 * Return the return type of the function, or {@code null} if the function doe
s not have a return |
5689 * type. | 6600 * type. |
5690 * @return the return type of the function | 6601 * @return the return type of the function |
5691 */ | 6602 */ |
5692 TypeName get returnType => _returnType; | 6603 TypeName get returnType => _returnType; |
5693 bool isConst() => false; | 6604 bool isConst() => false; |
5694 bool isFinal() => false; | 6605 bool isFinal() => false; |
| 6606 |
5695 /** | 6607 /** |
5696 * Set the parameters of the function-typed parameter to the given parameters. | 6608 * Set the parameters of the function-typed parameter to the given parameters. |
5697 * @param parameters the parameters of the function-typed parameter | 6609 * @param parameters the parameters of the function-typed parameter |
5698 */ | 6610 */ |
5699 void set parameters(FormalParameterList parameters2) { | 6611 void set parameters(FormalParameterList parameters2) { |
5700 this._parameters = becomeParentOf(parameters2); | 6612 this._parameters = becomeParentOf(parameters2); |
5701 } | 6613 } |
| 6614 |
5702 /** | 6615 /** |
5703 * Set the return type of the function to the given type. | 6616 * Set the return type of the function to the given type. |
5704 * @param returnType the return type of the function | 6617 * @param returnType the return type of the function |
5705 */ | 6618 */ |
5706 void set returnType(TypeName returnType2) { | 6619 void set returnType(TypeName returnType2) { |
5707 this._returnType = becomeParentOf(returnType2); | 6620 this._returnType = becomeParentOf(returnType2); |
5708 } | 6621 } |
5709 void visitChildren(ASTVisitor<Object> visitor) { | 6622 void visitChildren(ASTVisitor<Object> visitor) { |
5710 super.visitChildren(visitor); | 6623 super.visitChildren(visitor); |
5711 safelyVisitChild(_returnType, visitor); | 6624 safelyVisitChild(_returnType, visitor); |
5712 safelyVisitChild(identifier, visitor); | 6625 safelyVisitChild(identifier, visitor); |
5713 safelyVisitChild(_parameters, visitor); | 6626 safelyVisitChild(_parameters, visitor); |
5714 } | 6627 } |
5715 } | 6628 } |
| 6629 |
5716 /** | 6630 /** |
5717 * Instances of the class {@code HideCombinator} represent a combinator that res
tricts the names | 6631 * Instances of the class {@code HideCombinator} represent a combinator that res
tricts the names |
5718 * being imported to those that are not in a given list. | 6632 * being imported to those that are not in a given list. |
5719 * <pre> | 6633 * <pre> |
5720 * hideCombinator ::= | 6634 * hideCombinator ::= |
5721 * 'hide' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) | 6635 * 'hide' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) |
5722 * </pre> | 6636 * </pre> |
5723 * @coverage dart.engine.ast | 6637 * @coverage dart.engine.ast |
5724 */ | 6638 */ |
5725 class HideCombinator extends Combinator { | 6639 class HideCombinator extends Combinator { |
| 6640 |
5726 /** | 6641 /** |
5727 * The list of names from the library that are hidden by this combinator. | 6642 * The list of names from the library that are hidden by this combinator. |
5728 */ | 6643 */ |
5729 NodeList<SimpleIdentifier> _hiddenNames; | 6644 NodeList<SimpleIdentifier> _hiddenNames; |
| 6645 |
5730 /** | 6646 /** |
5731 * Initialize a newly created import show combinator. | 6647 * Initialize a newly created import show combinator. |
5732 * @param keyword the comma introducing the combinator | 6648 * @param keyword the comma introducing the combinator |
5733 * @param hiddenNames the list of names from the library that are hidden by th
is combinator | 6649 * @param hiddenNames the list of names from the library that are hidden by th
is combinator |
5734 */ | 6650 */ |
5735 HideCombinator.full(Token keyword, List<SimpleIdentifier> hiddenNames) : super
.full(keyword) { | 6651 HideCombinator.full(Token keyword, List<SimpleIdentifier> hiddenNames) : super
.full(keyword) { |
5736 this._hiddenNames = new NodeList<SimpleIdentifier>(this); | 6652 this._hiddenNames = new NodeList<SimpleIdentifier>(this); |
5737 this._hiddenNames.addAll(hiddenNames); | 6653 this._hiddenNames.addAll(hiddenNames); |
5738 } | 6654 } |
| 6655 |
5739 /** | 6656 /** |
5740 * Initialize a newly created import show combinator. | 6657 * Initialize a newly created import show combinator. |
5741 * @param keyword the comma introducing the combinator | 6658 * @param keyword the comma introducing the combinator |
5742 * @param hiddenNames the list of names from the library that are hidden by th
is combinator | 6659 * @param hiddenNames the list of names from the library that are hidden by th
is combinator |
5743 */ | 6660 */ |
5744 HideCombinator({Token keyword, List<SimpleIdentifier> hiddenNames}) : this.ful
l(keyword, hiddenNames); | 6661 HideCombinator({Token keyword, List<SimpleIdentifier> hiddenNames}) : this.ful
l(keyword, hiddenNames); |
5745 accept(ASTVisitor visitor) => visitor.visitHideCombinator(this); | 6662 accept(ASTVisitor visitor) => visitor.visitHideCombinator(this); |
5746 Token get endToken => _hiddenNames.endToken; | 6663 Token get endToken => _hiddenNames.endToken; |
| 6664 |
5747 /** | 6665 /** |
5748 * Return the list of names from the library that are hidden by this combinato
r. | 6666 * Return the list of names from the library that are hidden by this combinato
r. |
5749 * @return the list of names from the library that are hidden by this combinat
or | 6667 * @return the list of names from the library that are hidden by this combinat
or |
5750 */ | 6668 */ |
5751 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames; | 6669 NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames; |
5752 void visitChildren(ASTVisitor<Object> visitor) { | 6670 void visitChildren(ASTVisitor<Object> visitor) { |
5753 _hiddenNames.accept(visitor); | 6671 _hiddenNames.accept(visitor); |
5754 } | 6672 } |
5755 } | 6673 } |
| 6674 |
5756 /** | 6675 /** |
5757 * The abstract class {@code Identifier} defines the behavior common to nodes th
at represent an | 6676 * The abstract class {@code Identifier} defines the behavior common to nodes th
at represent an |
5758 * identifier. | 6677 * identifier. |
5759 * <pre> | 6678 * <pre> |
5760 * identifier ::={@link SimpleIdentifier simpleIdentifier}| {@link PrefixedIdent
ifier prefixedIdentifier}</pre> | 6679 * identifier ::={@link SimpleIdentifier simpleIdentifier}| {@link PrefixedIdent
ifier prefixedIdentifier}</pre> |
5761 * @coverage dart.engine.ast | 6680 * @coverage dart.engine.ast |
5762 */ | 6681 */ |
5763 abstract class Identifier extends Expression { | 6682 abstract class Identifier extends Expression { |
| 6683 |
5764 /** | 6684 /** |
5765 * Return {@code true} if the given name is visible only within the library in
which it is | 6685 * Return {@code true} if the given name is visible only within the library in
which it is |
5766 * declared. | 6686 * declared. |
5767 * @param name the name being tested | 6687 * @param name the name being tested |
5768 * @return {@code true} if the given name is private | 6688 * @return {@code true} if the given name is private |
5769 */ | 6689 */ |
5770 static bool isPrivateName(String name) => name.startsWith("_"); | 6690 static bool isPrivateName(String name) => name.startsWith("_"); |
| 6691 |
5771 /** | 6692 /** |
5772 * Return the element associated with this identifier, or {@code null} if the
AST structure has | 6693 * Return the element associated with this identifier based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
is identifier could not be |
5773 * not been resolved or if this identifier could not be resolved. One example
of the latter case | 6694 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope |
5774 * is an identifier that is not defined within the scope in which it appears. | 6695 * in which it appears. |
5775 * @return the element associated with this identifier | 6696 * @return the element associated with this identifier |
5776 */ | 6697 */ |
5777 Element get element; | 6698 Element get element; |
| 6699 |
5778 /** | 6700 /** |
5779 * Return the lexical representation of the identifier. | 6701 * Return the lexical representation of the identifier. |
5780 * @return the lexical representation of the identifier | 6702 * @return the lexical representation of the identifier |
5781 */ | 6703 */ |
5782 String get name; | 6704 String get name; |
| 6705 |
| 6706 /** |
| 6707 * Return the element associated with this identifier based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if this i
dentifier could not be |
| 6708 * resolved. One example of the latter case is an identifier that is not defin
ed within the scope |
| 6709 * in which it appears |
| 6710 * @return the element associated with the operator |
| 6711 */ |
| 6712 Element get staticElement; |
5783 bool isAssignable() => true; | 6713 bool isAssignable() => true; |
5784 } | 6714 } |
| 6715 |
5785 /** | 6716 /** |
5786 * Instances of the class {@code IfStatement} represent an if statement. | 6717 * Instances of the class {@code IfStatement} represent an if statement. |
5787 * <pre> | 6718 * <pre> |
5788 * ifStatement ::= | 6719 * ifStatement ::= |
5789 * 'if' '(' {@link Expression expression} ')' {@link Statement thenStatement} ('
else' {@link Statement elseStatement})? | 6720 * 'if' '(' {@link Expression expression} ')' {@link Statement thenStatement} ('
else' {@link Statement elseStatement})? |
5790 * </pre> | 6721 * </pre> |
5791 * @coverage dart.engine.ast | 6722 * @coverage dart.engine.ast |
5792 */ | 6723 */ |
5793 class IfStatement extends Statement { | 6724 class IfStatement extends Statement { |
| 6725 |
5794 /** | 6726 /** |
5795 * The token representing the 'if' keyword. | 6727 * The token representing the 'if' keyword. |
5796 */ | 6728 */ |
5797 Token _ifKeyword; | 6729 Token _ifKeyword; |
| 6730 |
5798 /** | 6731 /** |
5799 * The left parenthesis. | 6732 * The left parenthesis. |
5800 */ | 6733 */ |
5801 Token _leftParenthesis; | 6734 Token _leftParenthesis; |
| 6735 |
5802 /** | 6736 /** |
5803 * The condition used to determine which of the statements is executed next. | 6737 * The condition used to determine which of the statements is executed next. |
5804 */ | 6738 */ |
5805 Expression _condition; | 6739 Expression _condition; |
| 6740 |
5806 /** | 6741 /** |
5807 * The right parenthesis. | 6742 * The right parenthesis. |
5808 */ | 6743 */ |
5809 Token _rightParenthesis; | 6744 Token _rightParenthesis; |
| 6745 |
5810 /** | 6746 /** |
5811 * The statement that is executed if the condition evaluates to {@code true}. | 6747 * The statement that is executed if the condition evaluates to {@code true}. |
5812 */ | 6748 */ |
5813 Statement _thenStatement; | 6749 Statement _thenStatement; |
| 6750 |
5814 /** | 6751 /** |
5815 * The token representing the 'else' keyword. | 6752 * The token representing the 'else' keyword. |
5816 */ | 6753 */ |
5817 Token _elseKeyword; | 6754 Token _elseKeyword; |
| 6755 |
5818 /** | 6756 /** |
5819 * The statement that is executed if the condition evaluates to {@code false},
or {@code null} if | 6757 * The statement that is executed if the condition evaluates to {@code false},
or {@code null} if |
5820 * there is no else statement. | 6758 * there is no else statement. |
5821 */ | 6759 */ |
5822 Statement _elseStatement; | 6760 Statement _elseStatement; |
| 6761 |
5823 /** | 6762 /** |
5824 * Initialize a newly created if statement. | 6763 * Initialize a newly created if statement. |
5825 * @param ifKeyword the token representing the 'if' keyword | 6764 * @param ifKeyword the token representing the 'if' keyword |
5826 * @param leftParenthesis the left parenthesis | 6765 * @param leftParenthesis the left parenthesis |
5827 * @param condition the condition used to determine which of the statements is
executed next | 6766 * @param condition the condition used to determine which of the statements is
executed next |
5828 * @param rightParenthesis the right parenthesis | 6767 * @param rightParenthesis the right parenthesis |
5829 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} | 6768 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} |
5830 * @param elseKeyword the token representing the 'else' keyword | 6769 * @param elseKeyword the token representing the 'else' keyword |
5831 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} | 6770 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} |
5832 */ | 6771 */ |
5833 IfStatement.full(Token ifKeyword, Token leftParenthesis, Expression condition,
Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement e
lseStatement) { | 6772 IfStatement.full(Token ifKeyword, Token leftParenthesis, Expression condition,
Token rightParenthesis, Statement thenStatement, Token elseKeyword, Statement e
lseStatement) { |
5834 this._ifKeyword = ifKeyword; | 6773 this._ifKeyword = ifKeyword; |
5835 this._leftParenthesis = leftParenthesis; | 6774 this._leftParenthesis = leftParenthesis; |
5836 this._condition = becomeParentOf(condition); | 6775 this._condition = becomeParentOf(condition); |
5837 this._rightParenthesis = rightParenthesis; | 6776 this._rightParenthesis = rightParenthesis; |
5838 this._thenStatement = becomeParentOf(thenStatement); | 6777 this._thenStatement = becomeParentOf(thenStatement); |
5839 this._elseKeyword = elseKeyword; | 6778 this._elseKeyword = elseKeyword; |
5840 this._elseStatement = becomeParentOf(elseStatement); | 6779 this._elseStatement = becomeParentOf(elseStatement); |
5841 } | 6780 } |
| 6781 |
5842 /** | 6782 /** |
5843 * Initialize a newly created if statement. | 6783 * Initialize a newly created if statement. |
5844 * @param ifKeyword the token representing the 'if' keyword | 6784 * @param ifKeyword the token representing the 'if' keyword |
5845 * @param leftParenthesis the left parenthesis | 6785 * @param leftParenthesis the left parenthesis |
5846 * @param condition the condition used to determine which of the statements is
executed next | 6786 * @param condition the condition used to determine which of the statements is
executed next |
5847 * @param rightParenthesis the right parenthesis | 6787 * @param rightParenthesis the right parenthesis |
5848 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} | 6788 * @param thenStatement the statement that is executed if the condition evalua
tes to {@code true} |
5849 * @param elseKeyword the token representing the 'else' keyword | 6789 * @param elseKeyword the token representing the 'else' keyword |
5850 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} | 6790 * @param elseStatement the statement that is executed if the condition evalua
tes to {@code false} |
5851 */ | 6791 */ |
5852 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); | 6792 IfStatement({Token ifKeyword, Token leftParenthesis, Expression condition, Tok
en rightParenthesis, Statement thenStatement, Token elseKeyword, Statement elseS
tatement}) : this.full(ifKeyword, leftParenthesis, condition, rightParenthesis,
thenStatement, elseKeyword, elseStatement); |
5853 accept(ASTVisitor visitor) => visitor.visitIfStatement(this); | 6793 accept(ASTVisitor visitor) => visitor.visitIfStatement(this); |
5854 Token get beginToken => _ifKeyword; | 6794 Token get beginToken => _ifKeyword; |
| 6795 |
5855 /** | 6796 /** |
5856 * Return the condition used to determine which of the statements is executed
next. | 6797 * Return the condition used to determine which of the statements is executed
next. |
5857 * @return the condition used to determine which statement is executed next | 6798 * @return the condition used to determine which statement is executed next |
5858 */ | 6799 */ |
5859 Expression get condition => _condition; | 6800 Expression get condition => _condition; |
| 6801 |
5860 /** | 6802 /** |
5861 * Return the token representing the 'else' keyword. | 6803 * Return the token representing the 'else' keyword. |
5862 * @return the token representing the 'else' keyword | 6804 * @return the token representing the 'else' keyword |
5863 */ | 6805 */ |
5864 Token get elseKeyword => _elseKeyword; | 6806 Token get elseKeyword => _elseKeyword; |
| 6807 |
5865 /** | 6808 /** |
5866 * Return the statement that is executed if the condition evaluates to {@code
false}, or{@code null} if there is no else statement. | 6809 * Return the statement that is executed if the condition evaluates to {@code
false}, or{@code null} if there is no else statement. |
5867 * @return the statement that is executed if the condition evaluates to {@code
false} | 6810 * @return the statement that is executed if the condition evaluates to {@code
false} |
5868 */ | 6811 */ |
5869 Statement get elseStatement => _elseStatement; | 6812 Statement get elseStatement => _elseStatement; |
5870 Token get endToken { | 6813 Token get endToken { |
5871 if (_elseStatement != null) { | 6814 if (_elseStatement != null) { |
5872 return _elseStatement.endToken; | 6815 return _elseStatement.endToken; |
5873 } | 6816 } |
5874 return _thenStatement.endToken; | 6817 return _thenStatement.endToken; |
5875 } | 6818 } |
| 6819 |
5876 /** | 6820 /** |
5877 * Return the token representing the 'if' keyword. | 6821 * Return the token representing the 'if' keyword. |
5878 * @return the token representing the 'if' keyword | 6822 * @return the token representing the 'if' keyword |
5879 */ | 6823 */ |
5880 Token get ifKeyword => _ifKeyword; | 6824 Token get ifKeyword => _ifKeyword; |
| 6825 |
5881 /** | 6826 /** |
5882 * Return the left parenthesis. | 6827 * Return the left parenthesis. |
5883 * @return the left parenthesis | 6828 * @return the left parenthesis |
5884 */ | 6829 */ |
5885 Token get leftParenthesis => _leftParenthesis; | 6830 Token get leftParenthesis => _leftParenthesis; |
| 6831 |
5886 /** | 6832 /** |
5887 * Return the right parenthesis. | 6833 * Return the right parenthesis. |
5888 * @return the right parenthesis | 6834 * @return the right parenthesis |
5889 */ | 6835 */ |
5890 Token get rightParenthesis => _rightParenthesis; | 6836 Token get rightParenthesis => _rightParenthesis; |
| 6837 |
5891 /** | 6838 /** |
5892 * Return the statement that is executed if the condition evaluates to {@code
true}. | 6839 * Return the statement that is executed if the condition evaluates to {@code
true}. |
5893 * @return the statement that is executed if the condition evaluates to {@code
true} | 6840 * @return the statement that is executed if the condition evaluates to {@code
true} |
5894 */ | 6841 */ |
5895 Statement get thenStatement => _thenStatement; | 6842 Statement get thenStatement => _thenStatement; |
| 6843 |
5896 /** | 6844 /** |
5897 * Set the condition used to determine which of the statements is executed nex
t to the given | 6845 * Set the condition used to determine which of the statements is executed nex
t to the given |
5898 * expression. | 6846 * expression. |
5899 * @param expression the condition used to determine which statement is execut
ed next | 6847 * @param expression the condition used to determine which statement is execut
ed next |
5900 */ | 6848 */ |
5901 void set condition(Expression expression) { | 6849 void set condition(Expression expression) { |
5902 _condition = becomeParentOf(expression); | 6850 _condition = becomeParentOf(expression); |
5903 } | 6851 } |
| 6852 |
5904 /** | 6853 /** |
5905 * Set the token representing the 'else' keyword to the given token. | 6854 * Set the token representing the 'else' keyword to the given token. |
5906 * @param elseKeyword the token representing the 'else' keyword | 6855 * @param elseKeyword the token representing the 'else' keyword |
5907 */ | 6856 */ |
5908 void set elseKeyword(Token elseKeyword2) { | 6857 void set elseKeyword(Token elseKeyword2) { |
5909 this._elseKeyword = elseKeyword2; | 6858 this._elseKeyword = elseKeyword2; |
5910 } | 6859 } |
| 6860 |
5911 /** | 6861 /** |
5912 * Set the statement that is executed if the condition evaluates to {@code fal
se} to the given | 6862 * Set the statement that is executed if the condition evaluates to {@code fal
se} to the given |
5913 * statement. | 6863 * statement. |
5914 * @param statement the statement that is executed if the condition evaluates
to {@code false} | 6864 * @param statement the statement that is executed if the condition evaluates
to {@code false} |
5915 */ | 6865 */ |
5916 void set elseStatement(Statement statement) { | 6866 void set elseStatement(Statement statement) { |
5917 _elseStatement = becomeParentOf(statement); | 6867 _elseStatement = becomeParentOf(statement); |
5918 } | 6868 } |
| 6869 |
5919 /** | 6870 /** |
5920 * Set the token representing the 'if' keyword to the given token. | 6871 * Set the token representing the 'if' keyword to the given token. |
5921 * @param ifKeyword the token representing the 'if' keyword | 6872 * @param ifKeyword the token representing the 'if' keyword |
5922 */ | 6873 */ |
5923 void set ifKeyword(Token ifKeyword2) { | 6874 void set ifKeyword(Token ifKeyword2) { |
5924 this._ifKeyword = ifKeyword2; | 6875 this._ifKeyword = ifKeyword2; |
5925 } | 6876 } |
| 6877 |
5926 /** | 6878 /** |
5927 * Set the left parenthesis to the given token. | 6879 * Set the left parenthesis to the given token. |
5928 * @param leftParenthesis the left parenthesis | 6880 * @param leftParenthesis the left parenthesis |
5929 */ | 6881 */ |
5930 void set leftParenthesis(Token leftParenthesis2) { | 6882 void set leftParenthesis(Token leftParenthesis2) { |
5931 this._leftParenthesis = leftParenthesis2; | 6883 this._leftParenthesis = leftParenthesis2; |
5932 } | 6884 } |
| 6885 |
5933 /** | 6886 /** |
5934 * Set the right parenthesis to the given token. | 6887 * Set the right parenthesis to the given token. |
5935 * @param rightParenthesis the right parenthesis | 6888 * @param rightParenthesis the right parenthesis |
5936 */ | 6889 */ |
5937 void set rightParenthesis(Token rightParenthesis2) { | 6890 void set rightParenthesis(Token rightParenthesis2) { |
5938 this._rightParenthesis = rightParenthesis2; | 6891 this._rightParenthesis = rightParenthesis2; |
5939 } | 6892 } |
| 6893 |
5940 /** | 6894 /** |
5941 * Set the statement that is executed if the condition evaluates to {@code tru
e} to the given | 6895 * Set the statement that is executed if the condition evaluates to {@code tru
e} to the given |
5942 * statement. | 6896 * statement. |
5943 * @param statement the statement that is executed if the condition evaluates
to {@code true} | 6897 * @param statement the statement that is executed if the condition evaluates
to {@code true} |
5944 */ | 6898 */ |
5945 void set thenStatement(Statement statement) { | 6899 void set thenStatement(Statement statement) { |
5946 _thenStatement = becomeParentOf(statement); | 6900 _thenStatement = becomeParentOf(statement); |
5947 } | 6901 } |
5948 void visitChildren(ASTVisitor<Object> visitor) { | 6902 void visitChildren(ASTVisitor<Object> visitor) { |
5949 safelyVisitChild(_condition, visitor); | 6903 safelyVisitChild(_condition, visitor); |
5950 safelyVisitChild(_thenStatement, visitor); | 6904 safelyVisitChild(_thenStatement, visitor); |
5951 safelyVisitChild(_elseStatement, visitor); | 6905 safelyVisitChild(_elseStatement, visitor); |
5952 } | 6906 } |
5953 } | 6907 } |
| 6908 |
5954 /** | 6909 /** |
5955 * Instances of the class {@code ImplementsClause} represent the "implements" cl
ause in an class | 6910 * Instances of the class {@code ImplementsClause} represent the "implements" cl
ause in an class |
5956 * declaration. | 6911 * declaration. |
5957 * <pre> | 6912 * <pre> |
5958 * implementsClause ::= | 6913 * implementsClause ::= |
5959 * 'implements' {@link TypeName superclass} (',' {@link TypeName superclass}) | 6914 * 'implements' {@link TypeName superclass} (',' {@link TypeName superclass}) |
5960 * </pre> | 6915 * </pre> |
5961 * @coverage dart.engine.ast | 6916 * @coverage dart.engine.ast |
5962 */ | 6917 */ |
5963 class ImplementsClause extends ASTNode { | 6918 class ImplementsClause extends ASTNode { |
| 6919 |
5964 /** | 6920 /** |
5965 * The token representing the 'implements' keyword. | 6921 * The token representing the 'implements' keyword. |
5966 */ | 6922 */ |
5967 Token _keyword; | 6923 Token _keyword; |
| 6924 |
5968 /** | 6925 /** |
5969 * The interfaces that are being implemented. | 6926 * The interfaces that are being implemented. |
5970 */ | 6927 */ |
5971 NodeList<TypeName> _interfaces; | 6928 NodeList<TypeName> _interfaces; |
| 6929 |
5972 /** | 6930 /** |
5973 * Initialize a newly created extends clause. | 6931 * Initialize a newly created extends clause. |
5974 * @param keyword the token representing the 'implements' keyword | 6932 * @param keyword the token representing the 'implements' keyword |
5975 * @param interfaces the interfaces that are being implemented | 6933 * @param interfaces the interfaces that are being implemented |
5976 */ | 6934 */ |
5977 ImplementsClause.full(Token keyword, List<TypeName> interfaces) { | 6935 ImplementsClause.full(Token keyword, List<TypeName> interfaces) { |
5978 this._interfaces = new NodeList<TypeName>(this); | 6936 this._interfaces = new NodeList<TypeName>(this); |
5979 this._keyword = keyword; | 6937 this._keyword = keyword; |
5980 this._interfaces.addAll(interfaces); | 6938 this._interfaces.addAll(interfaces); |
5981 } | 6939 } |
| 6940 |
5982 /** | 6941 /** |
5983 * Initialize a newly created extends clause. | 6942 * Initialize a newly created extends clause. |
5984 * @param keyword the token representing the 'implements' keyword | 6943 * @param keyword the token representing the 'implements' keyword |
5985 * @param interfaces the interfaces that are being implemented | 6944 * @param interfaces the interfaces that are being implemented |
5986 */ | 6945 */ |
5987 ImplementsClause({Token keyword, List<TypeName> interfaces}) : this.full(keywo
rd, interfaces); | 6946 ImplementsClause({Token keyword, List<TypeName> interfaces}) : this.full(keywo
rd, interfaces); |
5988 accept(ASTVisitor visitor) => visitor.visitImplementsClause(this); | 6947 accept(ASTVisitor visitor) => visitor.visitImplementsClause(this); |
5989 Token get beginToken => _keyword; | 6948 Token get beginToken => _keyword; |
5990 Token get endToken => _interfaces.endToken; | 6949 Token get endToken => _interfaces.endToken; |
| 6950 |
5991 /** | 6951 /** |
5992 * Return the list of the interfaces that are being implemented. | 6952 * Return the list of the interfaces that are being implemented. |
5993 * @return the list of the interfaces that are being implemented | 6953 * @return the list of the interfaces that are being implemented |
5994 */ | 6954 */ |
5995 NodeList<TypeName> get interfaces => _interfaces; | 6955 NodeList<TypeName> get interfaces => _interfaces; |
| 6956 |
5996 /** | 6957 /** |
5997 * Return the token representing the 'implements' keyword. | 6958 * Return the token representing the 'implements' keyword. |
5998 * @return the token representing the 'implements' keyword | 6959 * @return the token representing the 'implements' keyword |
5999 */ | 6960 */ |
6000 Token get keyword => _keyword; | 6961 Token get keyword => _keyword; |
| 6962 |
6001 /** | 6963 /** |
6002 * Set the token representing the 'implements' keyword to the given token. | 6964 * Set the token representing the 'implements' keyword to the given token. |
6003 * @param keyword the token representing the 'implements' keyword | 6965 * @param keyword the token representing the 'implements' keyword |
6004 */ | 6966 */ |
6005 void set keyword(Token keyword2) { | 6967 void set keyword(Token keyword2) { |
6006 this._keyword = keyword2; | 6968 this._keyword = keyword2; |
6007 } | 6969 } |
6008 void visitChildren(ASTVisitor<Object> visitor) { | 6970 void visitChildren(ASTVisitor<Object> visitor) { |
6009 _interfaces.accept(visitor); | 6971 _interfaces.accept(visitor); |
6010 } | 6972 } |
6011 } | 6973 } |
| 6974 |
6012 /** | 6975 /** |
6013 * Instances of the class {@code ImportDirective} represent an import directive. | 6976 * Instances of the class {@code ImportDirective} represent an import directive. |
6014 * <pre> | 6977 * <pre> |
6015 * importDirective ::={@link Annotation metadata} 'import' {@link StringLiteral
libraryUri} ('as' identifier)? {@link Combinator combinator}* ';' | 6978 * importDirective ::={@link Annotation metadata} 'import' {@link StringLiteral
libraryUri} ('as' identifier)? {@link Combinator combinator}* ';' |
6016 * </pre> | 6979 * </pre> |
6017 * @coverage dart.engine.ast | 6980 * @coverage dart.engine.ast |
6018 */ | 6981 */ |
6019 class ImportDirective extends NamespaceDirective { | 6982 class ImportDirective extends NamespaceDirective { |
| 6983 |
6020 /** | 6984 /** |
6021 * The token representing the 'as' token, or {@code null} if the imported name
s are not prefixed. | 6985 * The token representing the 'as' token, or {@code null} if the imported name
s are not prefixed. |
6022 */ | 6986 */ |
6023 Token _asToken; | 6987 Token _asToken; |
| 6988 |
6024 /** | 6989 /** |
6025 * The prefix to be used with the imported names, or {@code null} if the impor
ted names are not | 6990 * The prefix to be used with the imported names, or {@code null} if the impor
ted names are not |
6026 * prefixed. | 6991 * prefixed. |
6027 */ | 6992 */ |
6028 SimpleIdentifier _prefix; | 6993 SimpleIdentifier _prefix; |
| 6994 |
6029 /** | 6995 /** |
6030 * Initialize a newly created import directive. | 6996 * Initialize a newly created import directive. |
6031 * @param comment the documentation comment associated with this directive | 6997 * @param comment the documentation comment associated with this directive |
6032 * @param metadata the annotations associated with the directive | 6998 * @param metadata the annotations associated with the directive |
6033 * @param keyword the token representing the 'import' keyword | 6999 * @param keyword the token representing the 'import' keyword |
6034 * @param libraryUri the URI of the library being imported | 7000 * @param libraryUri the URI of the library being imported |
6035 * @param asToken the token representing the 'as' token | 7001 * @param asToken the token representing the 'as' token |
6036 * @param prefix the prefix to be used with the imported names | 7002 * @param prefix the prefix to be used with the imported names |
6037 * @param combinators the combinators used to control how names are imported | 7003 * @param combinators the combinators used to control how names are imported |
6038 * @param semicolon the semicolon terminating the directive | 7004 * @param semicolon the semicolon terminating the directive |
6039 */ | 7005 */ |
6040 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) { | 7006 ImportDirective.full(Comment comment, List<Annotation> metadata, Token keyword
, StringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combina
tor> combinators, Token semicolon) : super.full(comment, metadata, keyword, libr
aryUri, combinators, semicolon) { |
6041 this._asToken = asToken; | 7007 this._asToken = asToken; |
6042 this._prefix = becomeParentOf(prefix); | 7008 this._prefix = becomeParentOf(prefix); |
6043 } | 7009 } |
| 7010 |
6044 /** | 7011 /** |
6045 * Initialize a newly created import directive. | 7012 * Initialize a newly created import directive. |
6046 * @param comment the documentation comment associated with this directive | 7013 * @param comment the documentation comment associated with this directive |
6047 * @param metadata the annotations associated with the directive | 7014 * @param metadata the annotations associated with the directive |
6048 * @param keyword the token representing the 'import' keyword | 7015 * @param keyword the token representing the 'import' keyword |
6049 * @param libraryUri the URI of the library being imported | 7016 * @param libraryUri the URI of the library being imported |
6050 * @param asToken the token representing the 'as' token | 7017 * @param asToken the token representing the 'as' token |
6051 * @param prefix the prefix to be used with the imported names | 7018 * @param prefix the prefix to be used with the imported names |
6052 * @param combinators the combinators used to control how names are imported | 7019 * @param combinators the combinators used to control how names are imported |
6053 * @param semicolon the semicolon terminating the directive | 7020 * @param semicolon the semicolon terminating the directive |
6054 */ | 7021 */ |
6055 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); | 7022 ImportDirective({Comment comment, List<Annotation> metadata, Token keyword, St
ringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combinator>
combinators, Token semicolon}) : this.full(comment, metadata, keyword, libraryU
ri, asToken, prefix, combinators, semicolon); |
6056 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); | 7023 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); |
| 7024 |
6057 /** | 7025 /** |
6058 * Return the token representing the 'as' token, or {@code null} if the import
ed names are not | 7026 * Return the token representing the 'as' token, or {@code null} if the import
ed names are not |
6059 * prefixed. | 7027 * prefixed. |
6060 * @return the token representing the 'as' token | 7028 * @return the token representing the 'as' token |
6061 */ | 7029 */ |
6062 Token get asToken => _asToken; | 7030 Token get asToken => _asToken; |
| 7031 |
6063 /** | 7032 /** |
6064 * Return the prefix to be used with the imported names, or {@code null} if th
e imported names are | 7033 * Return the prefix to be used with the imported names, or {@code null} if th
e imported names are |
6065 * not prefixed. | 7034 * not prefixed. |
6066 * @return the prefix to be used with the imported names | 7035 * @return the prefix to be used with the imported names |
6067 */ | 7036 */ |
6068 SimpleIdentifier get prefix => _prefix; | 7037 SimpleIdentifier get prefix => _prefix; |
| 7038 LibraryElement get uriElement { |
| 7039 Element element2 = element; |
| 7040 if (element2 is ImportElement) { |
| 7041 return ((element2 as ImportElement)).importedLibrary; |
| 7042 } |
| 7043 return null; |
| 7044 } |
| 7045 |
6069 /** | 7046 /** |
6070 * Set the token representing the 'as' token to the given token. | 7047 * Set the token representing the 'as' token to the given token. |
6071 * @param asToken the token representing the 'as' token | 7048 * @param asToken the token representing the 'as' token |
6072 */ | 7049 */ |
6073 void set asToken(Token asToken2) { | 7050 void set asToken(Token asToken2) { |
6074 this._asToken = asToken2; | 7051 this._asToken = asToken2; |
6075 } | 7052 } |
| 7053 |
6076 /** | 7054 /** |
6077 * Set the prefix to be used with the imported names to the given identifier. | 7055 * Set the prefix to be used with the imported names to the given identifier. |
6078 * @param prefix the prefix to be used with the imported names | 7056 * @param prefix the prefix to be used with the imported names |
6079 */ | 7057 */ |
6080 void set prefix(SimpleIdentifier prefix2) { | 7058 void set prefix(SimpleIdentifier prefix2) { |
6081 this._prefix = becomeParentOf(prefix2); | 7059 this._prefix = becomeParentOf(prefix2); |
6082 } | 7060 } |
6083 void visitChildren(ASTVisitor<Object> visitor) { | 7061 void visitChildren(ASTVisitor<Object> visitor) { |
6084 super.visitChildren(visitor); | 7062 super.visitChildren(visitor); |
6085 safelyVisitChild(_prefix, visitor); | 7063 safelyVisitChild(_prefix, visitor); |
6086 combinators.accept(visitor); | 7064 combinators.accept(visitor); |
6087 } | 7065 } |
6088 } | 7066 } |
| 7067 |
6089 /** | 7068 /** |
6090 * Instances of the class {@code IndexExpression} represent an index expression. | 7069 * Instances of the class {@code IndexExpression} represent an index expression. |
6091 * <pre> | 7070 * <pre> |
6092 * indexExpression ::={@link Expression target} '\[' {@link Expression index} '\
]' | 7071 * indexExpression ::={@link Expression target} '\[' {@link Expression index} '\
]' |
6093 * </pre> | 7072 * </pre> |
6094 * @coverage dart.engine.ast | 7073 * @coverage dart.engine.ast |
6095 */ | 7074 */ |
6096 class IndexExpression extends Expression { | 7075 class IndexExpression extends Expression { |
| 7076 |
6097 /** | 7077 /** |
6098 * The expression used to compute the object being indexed, or {@code null} if
this index | 7078 * The expression used to compute the object being indexed, or {@code null} if
this index |
6099 * expression is part of a cascade expression. | 7079 * expression is part of a cascade expression. |
6100 */ | 7080 */ |
6101 Expression _target; | 7081 Expression _target; |
| 7082 |
6102 /** | 7083 /** |
6103 * The period ("..") before a cascaded index expression, or {@code null} if th
is index expression | 7084 * The period ("..") before a cascaded index expression, or {@code null} if th
is index expression |
6104 * is not part of a cascade expression. | 7085 * is not part of a cascade expression. |
6105 */ | 7086 */ |
6106 Token _period; | 7087 Token _period; |
| 7088 |
6107 /** | 7089 /** |
6108 * The left square bracket. | 7090 * The left square bracket. |
6109 */ | 7091 */ |
6110 Token _leftBracket; | 7092 Token _leftBracket; |
| 7093 |
6111 /** | 7094 /** |
6112 * The expression used to compute the index. | 7095 * The expression used to compute the index. |
6113 */ | 7096 */ |
6114 Expression _index; | 7097 Expression _index; |
| 7098 |
6115 /** | 7099 /** |
6116 * The right square bracket. | 7100 * The right square bracket. |
6117 */ | 7101 */ |
6118 Token _rightBracket; | 7102 Token _rightBracket; |
| 7103 |
6119 /** | 7104 /** |
6120 * The element associated with the operator, or {@code null} if the AST struct
ure has not been | 7105 * The element associated with the operator based on the static type of the ta
rget, or{@code null} if the AST structure has not been resolved or if the operat
or could not be |
6121 * resolved or if the operator could not be resolved. | 7106 * resolved. |
6122 */ | 7107 */ |
6123 MethodElement _element; | 7108 MethodElement _staticElement; |
| 7109 |
| 7110 /** |
| 7111 * The element associated with the operator based on the propagated type of th
e target, or{@code null} if the AST structure has not been resolved or if the op
erator could not be |
| 7112 * resolved. |
| 7113 */ |
| 7114 MethodElement _propagatedElement; |
| 7115 |
6124 /** | 7116 /** |
6125 * Initialize a newly created index expression. | 7117 * Initialize a newly created index expression. |
6126 * @param target the expression used to compute the object being indexed | 7118 * @param target the expression used to compute the object being indexed |
6127 * @param leftBracket the left square bracket | 7119 * @param leftBracket the left square bracket |
6128 * @param index the expression used to compute the index | 7120 * @param index the expression used to compute the index |
6129 * @param rightBracket the right square bracket | 7121 * @param rightBracket the right square bracket |
6130 */ | 7122 */ |
6131 IndexExpression.forTarget_full(Expression target2, Token leftBracket2, Express
ion index2, Token rightBracket2) { | 7123 IndexExpression.forTarget_full(Expression target2, Token leftBracket2, Express
ion index2, Token rightBracket2) { |
6132 _jtd_constructor_58_impl(target2, leftBracket2, index2, rightBracket2); | 7124 _jtd_constructor_58_impl(target2, leftBracket2, index2, rightBracket2); |
6133 } | 7125 } |
| 7126 |
6134 /** | 7127 /** |
6135 * Initialize a newly created index expression. | 7128 * Initialize a newly created index expression. |
6136 * @param target the expression used to compute the object being indexed | 7129 * @param target the expression used to compute the object being indexed |
6137 * @param leftBracket the left square bracket | 7130 * @param leftBracket the left square bracket |
6138 * @param index the expression used to compute the index | 7131 * @param index the expression used to compute the index |
6139 * @param rightBracket the right square bracket | 7132 * @param rightBracket the right square bracket |
6140 */ | 7133 */ |
6141 IndexExpression.forTarget({Expression target2, Token leftBracket2, Expression
index2, Token rightBracket2}) : this.forTarget_full(target2, leftBracket2, index
2, rightBracket2); | 7134 IndexExpression.forTarget({Expression target2, Token leftBracket2, Expression
index2, Token rightBracket2}) : this.forTarget_full(target2, leftBracket2, index
2, rightBracket2); |
6142 _jtd_constructor_58_impl(Expression target2, Token leftBracket2, Expression in
dex2, Token rightBracket2) { | 7135 _jtd_constructor_58_impl(Expression target2, Token leftBracket2, Expression in
dex2, Token rightBracket2) { |
6143 this._target = becomeParentOf(target2); | 7136 this._target = becomeParentOf(target2); |
6144 this._leftBracket = leftBracket2; | 7137 this._leftBracket = leftBracket2; |
6145 this._index = becomeParentOf(index2); | 7138 this._index = becomeParentOf(index2); |
6146 this._rightBracket = rightBracket2; | 7139 this._rightBracket = rightBracket2; |
6147 } | 7140 } |
| 7141 |
6148 /** | 7142 /** |
6149 * Initialize a newly created index expression. | 7143 * Initialize a newly created index expression. |
6150 * @param period the period ("..") before a cascaded index expression | 7144 * @param period the period ("..") before a cascaded index expression |
6151 * @param leftBracket the left square bracket | 7145 * @param leftBracket the left square bracket |
6152 * @param index the expression used to compute the index | 7146 * @param index the expression used to compute the index |
6153 * @param rightBracket the right square bracket | 7147 * @param rightBracket the right square bracket |
6154 */ | 7148 */ |
6155 IndexExpression.forCascade_full(Token period2, Token leftBracket2, Expression
index2, Token rightBracket2) { | 7149 IndexExpression.forCascade_full(Token period2, Token leftBracket2, Expression
index2, Token rightBracket2) { |
6156 _jtd_constructor_59_impl(period2, leftBracket2, index2, rightBracket2); | 7150 _jtd_constructor_59_impl(period2, leftBracket2, index2, rightBracket2); |
6157 } | 7151 } |
| 7152 |
6158 /** | 7153 /** |
6159 * Initialize a newly created index expression. | 7154 * Initialize a newly created index expression. |
6160 * @param period the period ("..") before a cascaded index expression | 7155 * @param period the period ("..") before a cascaded index expression |
6161 * @param leftBracket the left square bracket | 7156 * @param leftBracket the left square bracket |
6162 * @param index the expression used to compute the index | 7157 * @param index the expression used to compute the index |
6163 * @param rightBracket the right square bracket | 7158 * @param rightBracket the right square bracket |
6164 */ | 7159 */ |
6165 IndexExpression.forCascade({Token period2, Token leftBracket2, Expression inde
x2, Token rightBracket2}) : this.forCascade_full(period2, leftBracket2, index2,
rightBracket2); | 7160 IndexExpression.forCascade({Token period2, Token leftBracket2, Expression inde
x2, Token rightBracket2}) : this.forCascade_full(period2, leftBracket2, index2,
rightBracket2); |
6166 _jtd_constructor_59_impl(Token period2, Token leftBracket2, Expression index2,
Token rightBracket2) { | 7161 _jtd_constructor_59_impl(Token period2, Token leftBracket2, Expression index2,
Token rightBracket2) { |
6167 this._period = period2; | 7162 this._period = period2; |
6168 this._leftBracket = leftBracket2; | 7163 this._leftBracket = leftBracket2; |
6169 this._index = becomeParentOf(index2); | 7164 this._index = becomeParentOf(index2); |
6170 this._rightBracket = rightBracket2; | 7165 this._rightBracket = rightBracket2; |
6171 } | 7166 } |
6172 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); | 7167 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); |
| 7168 |
6173 /** | 7169 /** |
6174 * Return the expression used to compute the object being indexed, or {@code n
ull} if this index | 7170 * Return the expression used to compute the object being indexed, or {@code n
ull} if this index |
6175 * expression is part of a cascade expression. | 7171 * expression is part of a cascade expression. |
6176 * @return the expression used to compute the object being indexed | 7172 * @return the expression used to compute the object being indexed |
6177 * @see #getRealTarget() | 7173 * @see #getRealTarget() |
6178 */ | 7174 */ |
6179 Expression get array => _target; | 7175 Expression get array => _target; |
6180 Token get beginToken { | 7176 Token get beginToken { |
6181 if (_target != null) { | 7177 if (_target != null) { |
6182 return _target.beginToken; | 7178 return _target.beginToken; |
6183 } | 7179 } |
6184 return _period; | 7180 return _period; |
6185 } | 7181 } |
| 7182 |
6186 /** | 7183 /** |
6187 * Return the element associated with the operator, or {@code null} if the AST
structure has not | 7184 * Return the element associated with the operator based on the propagated typ
e of the target, or{@code null} if the AST structure has not been resolved or if
the operator could not be |
6188 * been resolved or if the operator could not be resolved. One example of the
latter case is an | 7185 * resolved. One example of the latter case is an operator that is not defined
for the type of the |
6189 * operator that is not defined for the type of the left-hand operand. | 7186 * target. |
6190 * @return the element associated with this operator | 7187 * @return the element associated with this operator |
6191 */ | 7188 */ |
6192 MethodElement get element => _element; | 7189 MethodElement get element => _propagatedElement; |
6193 Token get endToken => _rightBracket; | 7190 Token get endToken => _rightBracket; |
| 7191 |
6194 /** | 7192 /** |
6195 * Return the expression used to compute the index. | 7193 * Return the expression used to compute the index. |
6196 * @return the expression used to compute the index | 7194 * @return the expression used to compute the index |
6197 */ | 7195 */ |
6198 Expression get index => _index; | 7196 Expression get index => _index; |
| 7197 |
6199 /** | 7198 /** |
6200 * Return the left square bracket. | 7199 * Return the left square bracket. |
6201 * @return the left square bracket | 7200 * @return the left square bracket |
6202 */ | 7201 */ |
6203 Token get leftBracket => _leftBracket; | 7202 Token get leftBracket => _leftBracket; |
| 7203 |
6204 /** | 7204 /** |
6205 * Return the period ("..") before a cascaded index expression, or {@code null
} if this index | 7205 * Return the period ("..") before a cascaded index expression, or {@code null
} if this index |
6206 * expression is not part of a cascade expression. | 7206 * expression is not part of a cascade expression. |
6207 * @return the period ("..") before a cascaded index expression | 7207 * @return the period ("..") before a cascaded index expression |
6208 */ | 7208 */ |
6209 Token get period => _period; | 7209 Token get period => _period; |
| 7210 |
6210 /** | 7211 /** |
6211 * Return the expression used to compute the object being indexed. If this ind
ex expression is not | 7212 * Return the expression used to compute the object being indexed. If this ind
ex expression is not |
6212 * part of a cascade expression, then this is the same as {@link #getArray()}.
If this index | 7213 * part of a cascade expression, then this is the same as {@link #getArray()}.
If this index |
6213 * expression is part of a cascade expression, then the target expression stor
ed with the cascade | 7214 * expression is part of a cascade expression, then the target expression stor
ed with the cascade |
6214 * expression is returned. | 7215 * expression is returned. |
6215 * @return the expression used to compute the object being indexed | 7216 * @return the expression used to compute the object being indexed |
6216 * @see #getArray() | 7217 * @see #getArray() |
6217 */ | 7218 */ |
6218 Expression get realTarget { | 7219 Expression get realTarget { |
6219 if (isCascaded()) { | 7220 if (isCascaded()) { |
6220 ASTNode ancestor = parent; | 7221 ASTNode ancestor = parent; |
6221 while (ancestor is! CascadeExpression) { | 7222 while (ancestor is! CascadeExpression) { |
6222 if (ancestor == null) { | 7223 if (ancestor == null) { |
6223 return _target; | 7224 return _target; |
6224 } | 7225 } |
6225 ancestor = ancestor.parent; | 7226 ancestor = ancestor.parent; |
6226 } | 7227 } |
6227 return ((ancestor as CascadeExpression)).target; | 7228 return ((ancestor as CascadeExpression)).target; |
6228 } | 7229 } |
6229 return _target; | 7230 return _target; |
6230 } | 7231 } |
| 7232 |
6231 /** | 7233 /** |
6232 * Return the right square bracket. | 7234 * Return the right square bracket. |
6233 * @return the right square bracket | 7235 * @return the right square bracket |
6234 */ | 7236 */ |
6235 Token get rightBracket => _rightBracket; | 7237 Token get rightBracket => _rightBracket; |
| 7238 |
| 7239 /** |
| 7240 * Return the element associated with the operator based on the static type of
the target, or{@code null} if the AST structure has not been resolved or if the
operator could not be |
| 7241 * resolved. One example of the latter case is an operator that is not defined
for the type of the |
| 7242 * target. |
| 7243 * @return the element associated with the operator |
| 7244 */ |
| 7245 MethodElement get staticElement => _staticElement; |
| 7246 |
6236 /** | 7247 /** |
6237 * Return {@code true} if this expression is computing a right-hand value. | 7248 * Return {@code true} if this expression is computing a right-hand value. |
6238 * <p> | 7249 * <p> |
6239 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 7250 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
6240 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 7251 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
6241 * @return {@code true} if this expression is in a context where the operator
'\[\]' will be invoked | 7252 * @return {@code true} if this expression is in a context where the operator
'\[\]' will be invoked |
6242 */ | 7253 */ |
6243 bool inGetterContext() { | 7254 bool inGetterContext() { |
6244 ASTNode parent2 = parent; | 7255 ASTNode parent2 = parent; |
6245 if (parent2 is AssignmentExpression) { | 7256 if (parent2 is AssignmentExpression) { |
6246 AssignmentExpression assignment = parent2 as AssignmentExpression; | 7257 AssignmentExpression assignment = parent2 as AssignmentExpression; |
6247 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { | 7258 if (identical(assignment.leftHandSide, this) && identical(assignment.opera
tor.type, TokenType.EQ)) { |
6248 return false; | 7259 return false; |
6249 } | 7260 } |
6250 } | 7261 } |
6251 return true; | 7262 return true; |
6252 } | 7263 } |
| 7264 |
6253 /** | 7265 /** |
6254 * Return {@code true} if this expression is computing a left-hand value. | 7266 * Return {@code true} if this expression is computing a left-hand value. |
6255 * <p> | 7267 * <p> |
6256 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 7268 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
6257 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 7269 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
6258 * @return {@code true} if this expression is in a context where the operator
'\[\]=' will be | 7270 * @return {@code true} if this expression is in a context where the operator
'\[\]=' will be |
6259 * invoked | 7271 * invoked |
6260 */ | 7272 */ |
6261 bool inSetterContext() { | 7273 bool inSetterContext() { |
6262 ASTNode parent2 = parent; | 7274 ASTNode parent2 = parent; |
6263 if (parent2 is PrefixExpression) { | 7275 if (parent2 is PrefixExpression) { |
6264 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; | 7276 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; |
6265 } else if (parent2 is PostfixExpression) { | 7277 } else if (parent2 is PostfixExpression) { |
6266 return true; | 7278 return true; |
6267 } else if (parent2 is AssignmentExpression) { | 7279 } else if (parent2 is AssignmentExpression) { |
6268 return identical(((parent2 as AssignmentExpression)).leftHandSide, this); | 7280 return identical(((parent2 as AssignmentExpression)).leftHandSide, this); |
6269 } | 7281 } |
6270 return false; | 7282 return false; |
6271 } | 7283 } |
6272 bool isAssignable() => true; | 7284 bool isAssignable() => true; |
| 7285 |
6273 /** | 7286 /** |
6274 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this | 7287 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this |
6275 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. | 7288 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. |
6276 * @return {@code true} if this expression is cascaded | 7289 * @return {@code true} if this expression is cascaded |
6277 */ | 7290 */ |
6278 bool isCascaded() => _period != null; | 7291 bool isCascaded() => _period != null; |
| 7292 |
6279 /** | 7293 /** |
6280 * Set the expression used to compute the object being indexed to the given ex
pression. | 7294 * Set the expression used to compute the object being indexed to the given ex
pression. |
6281 * @param expression the expression used to compute the object being indexed | 7295 * @param expression the expression used to compute the object being indexed |
6282 */ | 7296 */ |
6283 void set array(Expression expression) { | 7297 void set array(Expression expression) { |
6284 _target = becomeParentOf(expression); | 7298 _target = becomeParentOf(expression); |
6285 } | 7299 } |
| 7300 |
6286 /** | 7301 /** |
6287 * Set the element associated with the operator to the given element. | 7302 * Set the element associated with the operator based on the propagated type o
f the target to the |
6288 * @param element the element associated with this operator | 7303 * given element. |
| 7304 * @param element the element to be associated with this operator |
6289 */ | 7305 */ |
6290 void set element(MethodElement element2) { | 7306 void set element(MethodElement element2) { |
6291 this._element = element2; | 7307 _propagatedElement = element2; |
6292 } | 7308 } |
| 7309 |
6293 /** | 7310 /** |
6294 * Set the expression used to compute the index to the given expression. | 7311 * Set the expression used to compute the index to the given expression. |
6295 * @param expression the expression used to compute the index | 7312 * @param expression the expression used to compute the index |
6296 */ | 7313 */ |
6297 void set index(Expression expression) { | 7314 void set index(Expression expression) { |
6298 _index = becomeParentOf(expression); | 7315 _index = becomeParentOf(expression); |
6299 } | 7316 } |
| 7317 |
6300 /** | 7318 /** |
6301 * Set the left square bracket to the given token. | 7319 * Set the left square bracket to the given token. |
6302 * @param bracket the left square bracket | 7320 * @param bracket the left square bracket |
6303 */ | 7321 */ |
6304 void set leftBracket(Token bracket) { | 7322 void set leftBracket(Token bracket) { |
6305 _leftBracket = bracket; | 7323 _leftBracket = bracket; |
6306 } | 7324 } |
| 7325 |
6307 /** | 7326 /** |
6308 * Set the period ("..") before a cascaded index expression to the given token
. | 7327 * Set the period ("..") before a cascaded index expression to the given token
. |
6309 * @param period the period ("..") before a cascaded index expression | 7328 * @param period the period ("..") before a cascaded index expression |
6310 */ | 7329 */ |
6311 void set period(Token period2) { | 7330 void set period(Token period2) { |
6312 this._period = period2; | 7331 this._period = period2; |
6313 } | 7332 } |
| 7333 |
6314 /** | 7334 /** |
6315 * Set the right square bracket to the given token. | 7335 * Set the right square bracket to the given token. |
6316 * @param bracket the right square bracket | 7336 * @param bracket the right square bracket |
6317 */ | 7337 */ |
6318 void set rightBracket(Token bracket) { | 7338 void set rightBracket(Token bracket) { |
6319 _rightBracket = bracket; | 7339 _rightBracket = bracket; |
6320 } | 7340 } |
| 7341 |
| 7342 /** |
| 7343 * Set the element associated with the operator based on the static type of th
e target to the |
| 7344 * given element. |
| 7345 * @param element the static element to be associated with the operator |
| 7346 */ |
| 7347 void set staticElement(MethodElement element) { |
| 7348 _staticElement = element; |
| 7349 } |
6321 void visitChildren(ASTVisitor<Object> visitor) { | 7350 void visitChildren(ASTVisitor<Object> visitor) { |
6322 safelyVisitChild(_target, visitor); | 7351 safelyVisitChild(_target, visitor); |
6323 safelyVisitChild(_index, visitor); | 7352 safelyVisitChild(_index, visitor); |
6324 } | 7353 } |
| 7354 |
| 7355 /** |
| 7356 * Return the parameter element representing the parameter to which the value
of the index |
| 7357 * expression will be bound. May be {@code null}. |
| 7358 * <p> |
| 7359 * This method is only intended to be used by {@link Expression#getParameterEl
ement()}. |
| 7360 * @return the parameter element representing the parameter to which the value
of the index |
| 7361 * expression will be bound |
| 7362 */ |
| 7363 ParameterElement get parameterElementForIndex { |
| 7364 if (_propagatedElement == null) { |
| 7365 return null; |
| 7366 } |
| 7367 List<ParameterElement> parameters2 = _propagatedElement.parameters; |
| 7368 if (parameters2.length < 1) { |
| 7369 return null; |
| 7370 } |
| 7371 return parameters2[0]; |
| 7372 } |
6325 } | 7373 } |
| 7374 |
6326 /** | 7375 /** |
6327 * Instances of the class {@code InstanceCreationExpression} represent an instan
ce creation | 7376 * Instances of the class {@code InstanceCreationExpression} represent an instan
ce creation |
6328 * expression. | 7377 * expression. |
6329 * <pre> | 7378 * <pre> |
6330 * newExpression ::= | 7379 * newExpression ::= |
6331 * ('new' | 'const') {@link TypeName type} ('.' {@link SimpleIdentifier identifi
er})? {@link ArgumentList argumentList}</pre> | 7380 * ('new' | 'const') {@link TypeName type} ('.' {@link SimpleIdentifier identifi
er})? {@link ArgumentList argumentList}</pre> |
6332 * @coverage dart.engine.ast | 7381 * @coverage dart.engine.ast |
6333 */ | 7382 */ |
6334 class InstanceCreationExpression extends Expression { | 7383 class InstanceCreationExpression extends Expression { |
| 7384 |
6335 /** | 7385 /** |
6336 * The keyword used to indicate how an object should be created. | 7386 * The keyword used to indicate how an object should be created. |
6337 */ | 7387 */ |
6338 Token _keyword; | 7388 Token _keyword; |
| 7389 |
6339 /** | 7390 /** |
6340 * The name of the constructor to be invoked. | 7391 * The name of the constructor to be invoked. |
6341 */ | 7392 */ |
6342 ConstructorName _constructorName; | 7393 ConstructorName _constructorName; |
| 7394 |
6343 /** | 7395 /** |
6344 * The list of arguments to the constructor. | 7396 * The list of arguments to the constructor. |
6345 */ | 7397 */ |
6346 ArgumentList _argumentList; | 7398 ArgumentList _argumentList; |
| 7399 |
6347 /** | 7400 /** |
6348 * The element associated with the constructor, or {@code null} if the AST str
ucture has not been | 7401 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. |
6349 * resolved or if the constructor could not be resolved. | |
6350 */ | 7402 */ |
6351 ConstructorElement _element; | 7403 ConstructorElement _staticElement; |
| 7404 |
| 7405 /** |
| 7406 * The element associated with the constructor based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if the const
ructor could not be |
| 7407 * resolved. |
| 7408 */ |
| 7409 ConstructorElement _propagatedElement; |
| 7410 |
6352 /** | 7411 /** |
6353 * Initialize a newly created instance creation expression. | 7412 * Initialize a newly created instance creation expression. |
6354 * @param keyword the keyword used to indicate how an object should be created | 7413 * @param keyword the keyword used to indicate how an object should be created |
6355 * @param constructorName the name of the constructor to be invoked | 7414 * @param constructorName the name of the constructor to be invoked |
6356 * @param argumentList the list of arguments to the constructor | 7415 * @param argumentList the list of arguments to the constructor |
6357 */ | 7416 */ |
6358 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName
, ArgumentList argumentList) { | 7417 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName
, ArgumentList argumentList) { |
6359 this._keyword = keyword; | 7418 this._keyword = keyword; |
6360 this._constructorName = becomeParentOf(constructorName); | 7419 this._constructorName = becomeParentOf(constructorName); |
6361 this._argumentList = becomeParentOf(argumentList); | 7420 this._argumentList = becomeParentOf(argumentList); |
6362 } | 7421 } |
| 7422 |
6363 /** | 7423 /** |
6364 * Initialize a newly created instance creation expression. | 7424 * Initialize a newly created instance creation expression. |
6365 * @param keyword the keyword used to indicate how an object should be created | 7425 * @param keyword the keyword used to indicate how an object should be created |
6366 * @param constructorName the name of the constructor to be invoked | 7426 * @param constructorName the name of the constructor to be invoked |
6367 * @param argumentList the list of arguments to the constructor | 7427 * @param argumentList the list of arguments to the constructor |
6368 */ | 7428 */ |
6369 InstanceCreationExpression({Token keyword, ConstructorName constructorName, Ar
gumentList argumentList}) : this.full(keyword, constructorName, argumentList); | 7429 InstanceCreationExpression({Token keyword, ConstructorName constructorName, Ar
gumentList argumentList}) : this.full(keyword, constructorName, argumentList); |
6370 accept(ASTVisitor visitor) => visitor.visitInstanceCreationExpression(this); | 7430 accept(ASTVisitor visitor) => visitor.visitInstanceCreationExpression(this); |
| 7431 |
6371 /** | 7432 /** |
6372 * Return the list of arguments to the constructor. | 7433 * Return the list of arguments to the constructor. |
6373 * @return the list of arguments to the constructor | 7434 * @return the list of arguments to the constructor |
6374 */ | 7435 */ |
6375 ArgumentList get argumentList => _argumentList; | 7436 ArgumentList get argumentList => _argumentList; |
6376 Token get beginToken => _keyword; | 7437 Token get beginToken => _keyword; |
| 7438 |
6377 /** | 7439 /** |
6378 * Return the name of the constructor to be invoked. | 7440 * Return the name of the constructor to be invoked. |
6379 * @return the name of the constructor to be invoked | 7441 * @return the name of the constructor to be invoked |
6380 */ | 7442 */ |
6381 ConstructorName get constructorName => _constructorName; | 7443 ConstructorName get constructorName => _constructorName; |
| 7444 |
6382 /** | 7445 /** |
6383 * Return the element associated with the constructor, or {@code null} if the
AST structure has | 7446 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be |
6384 * not been resolved or if the constructor could not be resolved. | 7447 * resolved. |
6385 * @return the element associated with the constructor | 7448 * @return the element associated with the constructor |
6386 */ | 7449 */ |
6387 ConstructorElement get element => _element; | 7450 ConstructorElement get element => _propagatedElement; |
6388 Token get endToken => _argumentList.endToken; | 7451 Token get endToken => _argumentList.endToken; |
| 7452 |
6389 /** | 7453 /** |
6390 * Return the keyword used to indicate how an object should be created. | 7454 * Return the keyword used to indicate how an object should be created. |
6391 * @return the keyword used to indicate how an object should be created | 7455 * @return the keyword used to indicate how an object should be created |
6392 */ | 7456 */ |
6393 Token get keyword => _keyword; | 7457 Token get keyword => _keyword; |
| 7458 |
| 7459 /** |
| 7460 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be |
| 7461 * resolved. |
| 7462 * @return the element associated with the constructor |
| 7463 */ |
| 7464 ConstructorElement get staticElement => _staticElement; |
| 7465 |
6394 /** | 7466 /** |
6395 * Return {@code true} if this creation expression is used to invoke a constan
t constructor. | 7467 * Return {@code true} if this creation expression is used to invoke a constan
t constructor. |
6396 * @return {@code true} if this creation expression is used to invoke a consta
nt constructor | 7468 * @return {@code true} if this creation expression is used to invoke a consta
nt constructor |
6397 */ | 7469 */ |
6398 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); | 7470 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); |
| 7471 |
6399 /** | 7472 /** |
6400 * Set the list of arguments to the constructor to the given list. | 7473 * Set the list of arguments to the constructor to the given list. |
6401 * @param argumentList the list of arguments to the constructor | 7474 * @param argumentList the list of arguments to the constructor |
6402 */ | 7475 */ |
6403 void set argumentList(ArgumentList argumentList2) { | 7476 void set argumentList(ArgumentList argumentList2) { |
6404 this._argumentList = becomeParentOf(argumentList2); | 7477 this._argumentList = becomeParentOf(argumentList2); |
6405 } | 7478 } |
| 7479 |
6406 /** | 7480 /** |
6407 * Set the name of the constructor to be invoked to the given name. | 7481 * Set the name of the constructor to be invoked to the given name. |
6408 * @param constructorName the name of the constructor to be invoked | 7482 * @param constructorName the name of the constructor to be invoked |
6409 */ | 7483 */ |
6410 void set constructorName(ConstructorName constructorName2) { | 7484 void set constructorName(ConstructorName constructorName2) { |
6411 this._constructorName = constructorName2; | 7485 this._constructorName = constructorName2; |
6412 } | 7486 } |
| 7487 |
6413 /** | 7488 /** |
6414 * Set the element associated with the constructor to the given element. | 7489 * Set the element associated with the constructor based on propagated type in
formation to the |
6415 * @param element the element associated with the constructor | 7490 * given element. |
| 7491 * @param element the element to be associated with the constructor |
6416 */ | 7492 */ |
6417 void set element(ConstructorElement element2) { | 7493 void set element(ConstructorElement element2) { |
6418 this._element = element2; | 7494 this._propagatedElement = element2; |
6419 } | 7495 } |
| 7496 |
6420 /** | 7497 /** |
6421 * Set the keyword used to indicate how an object should be created to the giv
en keyword. | 7498 * Set the keyword used to indicate how an object should be created to the giv
en keyword. |
6422 * @param keyword the keyword used to indicate how an object should be created | 7499 * @param keyword the keyword used to indicate how an object should be created |
6423 */ | 7500 */ |
6424 void set keyword(Token keyword2) { | 7501 void set keyword(Token keyword2) { |
6425 this._keyword = keyword2; | 7502 this._keyword = keyword2; |
6426 } | 7503 } |
| 7504 |
| 7505 /** |
| 7506 * Set the element associated with the constructor based on static type inform
ation to the given |
| 7507 * element. |
| 7508 * @param element the element to be associated with the constructor |
| 7509 */ |
| 7510 void set staticElement(ConstructorElement element) { |
| 7511 this._staticElement = element; |
| 7512 } |
6427 void visitChildren(ASTVisitor<Object> visitor) { | 7513 void visitChildren(ASTVisitor<Object> visitor) { |
6428 safelyVisitChild(_constructorName, visitor); | 7514 safelyVisitChild(_constructorName, visitor); |
6429 safelyVisitChild(_argumentList, visitor); | 7515 safelyVisitChild(_argumentList, visitor); |
6430 } | 7516 } |
6431 } | 7517 } |
| 7518 |
6432 /** | 7519 /** |
6433 * Instances of the class {@code IntegerLiteral} represent an integer literal ex
pression. | 7520 * Instances of the class {@code IntegerLiteral} represent an integer literal ex
pression. |
6434 * <pre> | 7521 * <pre> |
6435 * integerLiteral ::= | 7522 * integerLiteral ::= |
6436 * decimalIntegerLiteral | 7523 * decimalIntegerLiteral |
6437 * | hexidecimalIntegerLiteral | 7524 * | hexidecimalIntegerLiteral |
6438 * decimalIntegerLiteral ::= | 7525 * decimalIntegerLiteral ::= |
6439 * decimalDigit+ | 7526 * decimalDigit+ |
6440 * hexidecimalIntegerLiteral ::= | 7527 * hexidecimalIntegerLiteral ::= |
6441 * '0x' hexidecimalDigit+ | 7528 * '0x' hexidecimalDigit+ |
6442 * | '0X' hexidecimalDigit+ | 7529 * | '0X' hexidecimalDigit+ |
6443 * </pre> | 7530 * </pre> |
6444 * @coverage dart.engine.ast | 7531 * @coverage dart.engine.ast |
6445 */ | 7532 */ |
6446 class IntegerLiteral extends Literal { | 7533 class IntegerLiteral extends Literal { |
| 7534 |
6447 /** | 7535 /** |
6448 * The token representing the literal. | 7536 * The token representing the literal. |
6449 */ | 7537 */ |
6450 Token _literal; | 7538 Token _literal; |
| 7539 |
6451 /** | 7540 /** |
6452 * The value of the literal. | 7541 * The value of the literal. |
6453 */ | 7542 */ |
6454 int _value = 0; | 7543 int _value = 0; |
| 7544 |
6455 /** | 7545 /** |
6456 * Initialize a newly created integer literal. | 7546 * Initialize a newly created integer literal. |
6457 * @param literal the token representing the literal | 7547 * @param literal the token representing the literal |
6458 * @param value the value of the literal | 7548 * @param value the value of the literal |
6459 */ | 7549 */ |
6460 IntegerLiteral.full(Token literal, int value) { | 7550 IntegerLiteral.full(Token literal, int value) { |
6461 this._literal = literal; | 7551 this._literal = literal; |
6462 this._value = value; | 7552 this._value = value; |
6463 } | 7553 } |
| 7554 |
6464 /** | 7555 /** |
6465 * Initialize a newly created integer literal. | 7556 * Initialize a newly created integer literal. |
6466 * @param literal the token representing the literal | 7557 * @param literal the token representing the literal |
6467 * @param value the value of the literal | 7558 * @param value the value of the literal |
6468 */ | 7559 */ |
6469 IntegerLiteral({Token literal, int value}) : this.full(literal, value); | 7560 IntegerLiteral({Token literal, int value}) : this.full(literal, value); |
6470 accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this); | 7561 accept(ASTVisitor visitor) => visitor.visitIntegerLiteral(this); |
6471 Token get beginToken => _literal; | 7562 Token get beginToken => _literal; |
6472 Token get endToken => _literal; | 7563 Token get endToken => _literal; |
| 7564 |
6473 /** | 7565 /** |
6474 * Return the token representing the literal. | 7566 * Return the token representing the literal. |
6475 * @return the token representing the literal | 7567 * @return the token representing the literal |
6476 */ | 7568 */ |
6477 Token get literal => _literal; | 7569 Token get literal => _literal; |
| 7570 |
6478 /** | 7571 /** |
6479 * Return the value of the literal. | 7572 * Return the value of the literal. |
6480 * @return the value of the literal | 7573 * @return the value of the literal |
6481 */ | 7574 */ |
6482 int get value => _value; | 7575 int get value => _value; |
| 7576 |
6483 /** | 7577 /** |
6484 * Set the token representing the literal to the given token. | 7578 * Set the token representing the literal to the given token. |
6485 * @param literal the token representing the literal | 7579 * @param literal the token representing the literal |
6486 */ | 7580 */ |
6487 void set literal(Token literal2) { | 7581 void set literal(Token literal2) { |
6488 this._literal = literal2; | 7582 this._literal = literal2; |
6489 } | 7583 } |
| 7584 |
6490 /** | 7585 /** |
6491 * Set the value of the literal to the given value. | 7586 * Set the value of the literal to the given value. |
6492 * @param value the value of the literal | 7587 * @param value the value of the literal |
6493 */ | 7588 */ |
6494 void set value(int value2) { | 7589 void set value(int value2) { |
6495 this._value = value2; | 7590 this._value = value2; |
6496 } | 7591 } |
6497 void visitChildren(ASTVisitor<Object> visitor) { | 7592 void visitChildren(ASTVisitor<Object> visitor) { |
6498 } | 7593 } |
6499 } | 7594 } |
| 7595 |
6500 /** | 7596 /** |
6501 * The abstract class {@code InterpolationElement} defines the behavior common t
o elements within a{@link StringInterpolation string interpolation}. | 7597 * The abstract class {@code InterpolationElement} defines the behavior common t
o elements within a{@link StringInterpolation string interpolation}. |
6502 * <pre> | 7598 * <pre> |
6503 * interpolationElement ::={@link InterpolationExpression interpolationExpressio
n}| {@link InterpolationString interpolationString}</pre> | 7599 * interpolationElement ::={@link InterpolationExpression interpolationExpressio
n}| {@link InterpolationString interpolationString}</pre> |
6504 * @coverage dart.engine.ast | 7600 * @coverage dart.engine.ast |
6505 */ | 7601 */ |
6506 abstract class InterpolationElement extends ASTNode { | 7602 abstract class InterpolationElement extends ASTNode { |
6507 } | 7603 } |
| 7604 |
6508 /** | 7605 /** |
6509 * Instances of the class {@code InterpolationExpression} represent an expressio
n embedded in a | 7606 * Instances of the class {@code InterpolationExpression} represent an expressio
n embedded in a |
6510 * string interpolation. | 7607 * string interpolation. |
6511 * <pre> | 7608 * <pre> |
6512 * interpolationExpression ::= | 7609 * interpolationExpression ::= |
6513 * '$' {@link SimpleIdentifier identifier}| '$' '{' {@link Expression expression
} '}' | 7610 * '$' {@link SimpleIdentifier identifier}| '$' '{' {@link Expression expression
} '}' |
6514 * </pre> | 7611 * </pre> |
6515 * @coverage dart.engine.ast | 7612 * @coverage dart.engine.ast |
6516 */ | 7613 */ |
6517 class InterpolationExpression extends InterpolationElement { | 7614 class InterpolationExpression extends InterpolationElement { |
| 7615 |
6518 /** | 7616 /** |
6519 * The token used to introduce the interpolation expression; either '$' if the
expression is a | 7617 * The token used to introduce the interpolation expression; either '$' if the
expression is a |
6520 * simple identifier or '${' if the expression is a full expression. | 7618 * simple identifier or '${' if the expression is a full expression. |
6521 */ | 7619 */ |
6522 Token _leftBracket; | 7620 Token _leftBracket; |
| 7621 |
6523 /** | 7622 /** |
6524 * The expression to be evaluated for the value to be converted into a string. | 7623 * The expression to be evaluated for the value to be converted into a string. |
6525 */ | 7624 */ |
6526 Expression _expression; | 7625 Expression _expression; |
| 7626 |
6527 /** | 7627 /** |
6528 * The right curly bracket, or {@code null} if the expression is an identifier
without brackets. | 7628 * The right curly bracket, or {@code null} if the expression is an identifier
without brackets. |
6529 */ | 7629 */ |
6530 Token _rightBracket; | 7630 Token _rightBracket; |
| 7631 |
6531 /** | 7632 /** |
6532 * Initialize a newly created interpolation expression. | 7633 * Initialize a newly created interpolation expression. |
6533 * @param leftBracket the left curly bracket | 7634 * @param leftBracket the left curly bracket |
6534 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 7635 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
6535 * @param rightBracket the right curly bracket | 7636 * @param rightBracket the right curly bracket |
6536 */ | 7637 */ |
6537 InterpolationExpression.full(Token leftBracket, Expression expression, Token r
ightBracket) { | 7638 InterpolationExpression.full(Token leftBracket, Expression expression, Token r
ightBracket) { |
6538 this._leftBracket = leftBracket; | 7639 this._leftBracket = leftBracket; |
6539 this._expression = becomeParentOf(expression); | 7640 this._expression = becomeParentOf(expression); |
6540 this._rightBracket = rightBracket; | 7641 this._rightBracket = rightBracket; |
6541 } | 7642 } |
| 7643 |
6542 /** | 7644 /** |
6543 * Initialize a newly created interpolation expression. | 7645 * Initialize a newly created interpolation expression. |
6544 * @param leftBracket the left curly bracket | 7646 * @param leftBracket the left curly bracket |
6545 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 7647 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
6546 * @param rightBracket the right curly bracket | 7648 * @param rightBracket the right curly bracket |
6547 */ | 7649 */ |
6548 InterpolationExpression({Token leftBracket, Expression expression, Token right
Bracket}) : this.full(leftBracket, expression, rightBracket); | 7650 InterpolationExpression({Token leftBracket, Expression expression, Token right
Bracket}) : this.full(leftBracket, expression, rightBracket); |
6549 accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this); | 7651 accept(ASTVisitor visitor) => visitor.visitInterpolationExpression(this); |
6550 Token get beginToken => _leftBracket; | 7652 Token get beginToken => _leftBracket; |
6551 Token get endToken { | 7653 Token get endToken { |
6552 if (_rightBracket != null) { | 7654 if (_rightBracket != null) { |
6553 return _rightBracket; | 7655 return _rightBracket; |
6554 } | 7656 } |
6555 return _expression.endToken; | 7657 return _expression.endToken; |
6556 } | 7658 } |
| 7659 |
6557 /** | 7660 /** |
6558 * Return the expression to be evaluated for the value to be converted into a
string. | 7661 * Return the expression to be evaluated for the value to be converted into a
string. |
6559 * @return the expression to be evaluated for the value to be converted into a
string | 7662 * @return the expression to be evaluated for the value to be converted into a
string |
6560 */ | 7663 */ |
6561 Expression get expression => _expression; | 7664 Expression get expression => _expression; |
| 7665 |
6562 /** | 7666 /** |
6563 * Return the left curly bracket. | 7667 * Return the left curly bracket. |
6564 * @return the left curly bracket | 7668 * @return the left curly bracket |
6565 */ | 7669 */ |
6566 Token get leftBracket => _leftBracket; | 7670 Token get leftBracket => _leftBracket; |
| 7671 |
6567 /** | 7672 /** |
6568 * Return the right curly bracket. | 7673 * Return the right curly bracket. |
6569 * @return the right curly bracket | 7674 * @return the right curly bracket |
6570 */ | 7675 */ |
6571 Token get rightBracket => _rightBracket; | 7676 Token get rightBracket => _rightBracket; |
| 7677 |
6572 /** | 7678 /** |
6573 * Set the expression to be evaluated for the value to be converted into a str
ing to the given | 7679 * Set the expression to be evaluated for the value to be converted into a str
ing to the given |
6574 * expression. | 7680 * expression. |
6575 * @param expression the expression to be evaluated for the value to be conver
ted into a string | 7681 * @param expression the expression to be evaluated for the value to be conver
ted into a string |
6576 */ | 7682 */ |
6577 void set expression(Expression expression2) { | 7683 void set expression(Expression expression2) { |
6578 this._expression = becomeParentOf(expression2); | 7684 this._expression = becomeParentOf(expression2); |
6579 } | 7685 } |
| 7686 |
6580 /** | 7687 /** |
6581 * Set the left curly bracket to the given token. | 7688 * Set the left curly bracket to the given token. |
6582 * @param leftBracket the left curly bracket | 7689 * @param leftBracket the left curly bracket |
6583 */ | 7690 */ |
6584 void set leftBracket(Token leftBracket2) { | 7691 void set leftBracket(Token leftBracket2) { |
6585 this._leftBracket = leftBracket2; | 7692 this._leftBracket = leftBracket2; |
6586 } | 7693 } |
| 7694 |
6587 /** | 7695 /** |
6588 * Set the right curly bracket to the given token. | 7696 * Set the right curly bracket to the given token. |
6589 * @param rightBracket the right curly bracket | 7697 * @param rightBracket the right curly bracket |
6590 */ | 7698 */ |
6591 void set rightBracket(Token rightBracket2) { | 7699 void set rightBracket(Token rightBracket2) { |
6592 this._rightBracket = rightBracket2; | 7700 this._rightBracket = rightBracket2; |
6593 } | 7701 } |
6594 void visitChildren(ASTVisitor<Object> visitor) { | 7702 void visitChildren(ASTVisitor<Object> visitor) { |
6595 safelyVisitChild(_expression, visitor); | 7703 safelyVisitChild(_expression, visitor); |
6596 } | 7704 } |
6597 } | 7705 } |
| 7706 |
6598 /** | 7707 /** |
6599 * Instances of the class {@code InterpolationString} represent a non-empty subs
tring of an | 7708 * Instances of the class {@code InterpolationString} represent a non-empty subs
tring of an |
6600 * interpolated string. | 7709 * interpolated string. |
6601 * <pre> | 7710 * <pre> |
6602 * interpolationString ::= | 7711 * interpolationString ::= |
6603 * characters | 7712 * characters |
6604 * </pre> | 7713 * </pre> |
6605 * @coverage dart.engine.ast | 7714 * @coverage dart.engine.ast |
6606 */ | 7715 */ |
6607 class InterpolationString extends InterpolationElement { | 7716 class InterpolationString extends InterpolationElement { |
| 7717 |
6608 /** | 7718 /** |
6609 * The characters that will be added to the string. | 7719 * The characters that will be added to the string. |
6610 */ | 7720 */ |
6611 Token _contents; | 7721 Token _contents; |
| 7722 |
6612 /** | 7723 /** |
6613 * The value of the literal. | 7724 * The value of the literal. |
6614 */ | 7725 */ |
6615 String _value; | 7726 String _value; |
| 7727 |
6616 /** | 7728 /** |
6617 * Initialize a newly created string of characters that are part of a string i
nterpolation. | 7729 * Initialize a newly created string of characters that are part of a string i
nterpolation. |
6618 * @param the characters that will be added to the string | 7730 * @param the characters that will be added to the string |
6619 * @param value the value of the literal | 7731 * @param value the value of the literal |
6620 */ | 7732 */ |
6621 InterpolationString.full(Token contents, String value) { | 7733 InterpolationString.full(Token contents, String value) { |
6622 this._contents = contents; | 7734 this._contents = contents; |
6623 this._value = value; | 7735 this._value = value; |
6624 } | 7736 } |
| 7737 |
6625 /** | 7738 /** |
6626 * Initialize a newly created string of characters that are part of a string i
nterpolation. | 7739 * Initialize a newly created string of characters that are part of a string i
nterpolation. |
6627 * @param the characters that will be added to the string | 7740 * @param the characters that will be added to the string |
6628 * @param value the value of the literal | 7741 * @param value the value of the literal |
6629 */ | 7742 */ |
6630 InterpolationString({Token contents, String value}) : this.full(contents, valu
e); | 7743 InterpolationString({Token contents, String value}) : this.full(contents, valu
e); |
6631 accept(ASTVisitor visitor) => visitor.visitInterpolationString(this); | 7744 accept(ASTVisitor visitor) => visitor.visitInterpolationString(this); |
6632 Token get beginToken => _contents; | 7745 Token get beginToken => _contents; |
| 7746 |
6633 /** | 7747 /** |
6634 * Return the characters that will be added to the string. | 7748 * Return the characters that will be added to the string. |
6635 * @return the characters that will be added to the string | 7749 * @return the characters that will be added to the string |
6636 */ | 7750 */ |
6637 Token get contents => _contents; | 7751 Token get contents => _contents; |
6638 Token get endToken => _contents; | 7752 Token get endToken => _contents; |
| 7753 |
6639 /** | 7754 /** |
6640 * Return the value of the literal. | 7755 * Return the value of the literal. |
6641 * @return the value of the literal | 7756 * @return the value of the literal |
6642 */ | 7757 */ |
6643 String get value => _value; | 7758 String get value => _value; |
| 7759 |
6644 /** | 7760 /** |
6645 * Set the characters that will be added to the string to those in the given s
tring. | 7761 * Set the characters that will be added to the string to those in the given s
tring. |
6646 * @param string the characters that will be added to the string | 7762 * @param string the characters that will be added to the string |
6647 */ | 7763 */ |
6648 void set contents(Token string) { | 7764 void set contents(Token string) { |
6649 _contents = string; | 7765 _contents = string; |
6650 } | 7766 } |
| 7767 |
6651 /** | 7768 /** |
6652 * Set the value of the literal to the given string. | 7769 * Set the value of the literal to the given string. |
6653 * @param string the value of the literal | 7770 * @param string the value of the literal |
6654 */ | 7771 */ |
6655 void set value(String string) { | 7772 void set value(String string) { |
6656 _value = string; | 7773 _value = string; |
6657 } | 7774 } |
6658 void visitChildren(ASTVisitor<Object> visitor) { | 7775 void visitChildren(ASTVisitor<Object> visitor) { |
6659 } | 7776 } |
6660 } | 7777 } |
| 7778 |
6661 /** | 7779 /** |
6662 * Instances of the class {@code IsExpression} represent an is expression. | 7780 * Instances of the class {@code IsExpression} represent an is expression. |
6663 * <pre> | 7781 * <pre> |
6664 * isExpression ::={@link Expression expression} 'is' '!'? {@link TypeName type}
</pre> | 7782 * isExpression ::={@link Expression expression} 'is' '!'? {@link TypeName type}
</pre> |
6665 * @coverage dart.engine.ast | 7783 * @coverage dart.engine.ast |
6666 */ | 7784 */ |
6667 class IsExpression extends Expression { | 7785 class IsExpression extends Expression { |
| 7786 |
6668 /** | 7787 /** |
6669 * The expression used to compute the value whose type is being tested. | 7788 * The expression used to compute the value whose type is being tested. |
6670 */ | 7789 */ |
6671 Expression _expression; | 7790 Expression _expression; |
| 7791 |
6672 /** | 7792 /** |
6673 * The is operator. | 7793 * The is operator. |
6674 */ | 7794 */ |
6675 Token _isOperator; | 7795 Token _isOperator; |
| 7796 |
6676 /** | 7797 /** |
6677 * The not operator, or {@code null} if the sense of the test is not negated. | 7798 * The not operator, or {@code null} if the sense of the test is not negated. |
6678 */ | 7799 */ |
6679 Token _notOperator; | 7800 Token _notOperator; |
| 7801 |
6680 /** | 7802 /** |
6681 * The name of the type being tested for. | 7803 * The name of the type being tested for. |
6682 */ | 7804 */ |
6683 TypeName _type; | 7805 TypeName _type; |
| 7806 |
6684 /** | 7807 /** |
6685 * Initialize a newly created is expression. | 7808 * Initialize a newly created is expression. |
6686 * @param expression the expression used to compute the value whose type is be
ing tested | 7809 * @param expression the expression used to compute the value whose type is be
ing tested |
6687 * @param isOperator the is operator | 7810 * @param isOperator the is operator |
6688 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated | 7811 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated |
6689 * @param type the name of the type being tested for | 7812 * @param type the name of the type being tested for |
6690 */ | 7813 */ |
6691 IsExpression.full(Expression expression, Token isOperator, Token notOperator,
TypeName type) { | 7814 IsExpression.full(Expression expression, Token isOperator, Token notOperator,
TypeName type) { |
6692 this._expression = becomeParentOf(expression); | 7815 this._expression = becomeParentOf(expression); |
6693 this._isOperator = isOperator; | 7816 this._isOperator = isOperator; |
6694 this._notOperator = notOperator; | 7817 this._notOperator = notOperator; |
6695 this._type = becomeParentOf(type); | 7818 this._type = becomeParentOf(type); |
6696 } | 7819 } |
| 7820 |
6697 /** | 7821 /** |
6698 * Initialize a newly created is expression. | 7822 * Initialize a newly created is expression. |
6699 * @param expression the expression used to compute the value whose type is be
ing tested | 7823 * @param expression the expression used to compute the value whose type is be
ing tested |
6700 * @param isOperator the is operator | 7824 * @param isOperator the is operator |
6701 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated | 7825 * @param notOperator the not operator, or {@code null} if the sense of the te
st is not negated |
6702 * @param type the name of the type being tested for | 7826 * @param type the name of the type being tested for |
6703 */ | 7827 */ |
6704 IsExpression({Expression expression, Token isOperator, Token notOperator, Type
Name type}) : this.full(expression, isOperator, notOperator, type); | 7828 IsExpression({Expression expression, Token isOperator, Token notOperator, Type
Name type}) : this.full(expression, isOperator, notOperator, type); |
6705 accept(ASTVisitor visitor) => visitor.visitIsExpression(this); | 7829 accept(ASTVisitor visitor) => visitor.visitIsExpression(this); |
6706 Token get beginToken => _expression.beginToken; | 7830 Token get beginToken => _expression.beginToken; |
6707 Token get endToken => _type.endToken; | 7831 Token get endToken => _type.endToken; |
| 7832 |
6708 /** | 7833 /** |
6709 * Return the expression used to compute the value whose type is being tested. | 7834 * Return the expression used to compute the value whose type is being tested. |
6710 * @return the expression used to compute the value whose type is being tested | 7835 * @return the expression used to compute the value whose type is being tested |
6711 */ | 7836 */ |
6712 Expression get expression => _expression; | 7837 Expression get expression => _expression; |
| 7838 |
6713 /** | 7839 /** |
6714 * Return the is operator being applied. | 7840 * Return the is operator being applied. |
6715 * @return the is operator being applied | 7841 * @return the is operator being applied |
6716 */ | 7842 */ |
6717 Token get isOperator => _isOperator; | 7843 Token get isOperator => _isOperator; |
| 7844 |
6718 /** | 7845 /** |
6719 * Return the not operator being applied. | 7846 * Return the not operator being applied. |
6720 * @return the not operator being applied | 7847 * @return the not operator being applied |
6721 */ | 7848 */ |
6722 Token get notOperator => _notOperator; | 7849 Token get notOperator => _notOperator; |
| 7850 |
6723 /** | 7851 /** |
6724 * Return the name of the type being tested for. | 7852 * Return the name of the type being tested for. |
6725 * @return the name of the type being tested for | 7853 * @return the name of the type being tested for |
6726 */ | 7854 */ |
6727 TypeName get type => _type; | 7855 TypeName get type => _type; |
| 7856 |
6728 /** | 7857 /** |
6729 * Set the expression used to compute the value whose type is being tested to
the given | 7858 * Set the expression used to compute the value whose type is being tested to
the given |
6730 * expression. | 7859 * expression. |
6731 * @param expression the expression used to compute the value whose type is be
ing tested | 7860 * @param expression the expression used to compute the value whose type is be
ing tested |
6732 */ | 7861 */ |
6733 void set expression(Expression expression2) { | 7862 void set expression(Expression expression2) { |
6734 this._expression = becomeParentOf(expression2); | 7863 this._expression = becomeParentOf(expression2); |
6735 } | 7864 } |
| 7865 |
6736 /** | 7866 /** |
6737 * Set the is operator being applied to the given operator. | 7867 * Set the is operator being applied to the given operator. |
6738 * @param isOperator the is operator being applied | 7868 * @param isOperator the is operator being applied |
6739 */ | 7869 */ |
6740 void set isOperator(Token isOperator2) { | 7870 void set isOperator(Token isOperator2) { |
6741 this._isOperator = isOperator2; | 7871 this._isOperator = isOperator2; |
6742 } | 7872 } |
| 7873 |
6743 /** | 7874 /** |
6744 * Set the not operator being applied to the given operator. | 7875 * Set the not operator being applied to the given operator. |
6745 * @param notOperator the is operator being applied | 7876 * @param notOperator the is operator being applied |
6746 */ | 7877 */ |
6747 void set notOperator(Token notOperator2) { | 7878 void set notOperator(Token notOperator2) { |
6748 this._notOperator = notOperator2; | 7879 this._notOperator = notOperator2; |
6749 } | 7880 } |
| 7881 |
6750 /** | 7882 /** |
6751 * Set the name of the type being tested for to the given name. | 7883 * Set the name of the type being tested for to the given name. |
6752 * @param name the name of the type being tested for | 7884 * @param name the name of the type being tested for |
6753 */ | 7885 */ |
6754 void set type(TypeName name) { | 7886 void set type(TypeName name) { |
6755 this._type = becomeParentOf(name); | 7887 this._type = becomeParentOf(name); |
6756 } | 7888 } |
6757 void visitChildren(ASTVisitor<Object> visitor) { | 7889 void visitChildren(ASTVisitor<Object> visitor) { |
6758 safelyVisitChild(_expression, visitor); | 7890 safelyVisitChild(_expression, visitor); |
6759 safelyVisitChild(_type, visitor); | 7891 safelyVisitChild(_type, visitor); |
6760 } | 7892 } |
6761 } | 7893 } |
| 7894 |
6762 /** | 7895 /** |
6763 * Instances of the class {@code Label} represent a label. | 7896 * Instances of the class {@code Label} represent a label. |
6764 * <pre> | 7897 * <pre> |
6765 * label ::={@link SimpleIdentifier label} ':' | 7898 * label ::={@link SimpleIdentifier label} ':' |
6766 * </pre> | 7899 * </pre> |
6767 * @coverage dart.engine.ast | 7900 * @coverage dart.engine.ast |
6768 */ | 7901 */ |
6769 class Label extends ASTNode { | 7902 class Label extends ASTNode { |
| 7903 |
6770 /** | 7904 /** |
6771 * The label being associated with the statement. | 7905 * The label being associated with the statement. |
6772 */ | 7906 */ |
6773 SimpleIdentifier _label; | 7907 SimpleIdentifier _label; |
| 7908 |
6774 /** | 7909 /** |
6775 * The colon that separates the label from the statement. | 7910 * The colon that separates the label from the statement. |
6776 */ | 7911 */ |
6777 Token _colon; | 7912 Token _colon; |
| 7913 |
6778 /** | 7914 /** |
6779 * Initialize a newly created label. | 7915 * Initialize a newly created label. |
6780 * @param label the label being applied | 7916 * @param label the label being applied |
6781 * @param colon the colon that separates the label from whatever follows | 7917 * @param colon the colon that separates the label from whatever follows |
6782 */ | 7918 */ |
6783 Label.full(SimpleIdentifier label, Token colon) { | 7919 Label.full(SimpleIdentifier label, Token colon) { |
6784 this._label = becomeParentOf(label); | 7920 this._label = becomeParentOf(label); |
6785 this._colon = colon; | 7921 this._colon = colon; |
6786 } | 7922 } |
| 7923 |
6787 /** | 7924 /** |
6788 * Initialize a newly created label. | 7925 * Initialize a newly created label. |
6789 * @param label the label being applied | 7926 * @param label the label being applied |
6790 * @param colon the colon that separates the label from whatever follows | 7927 * @param colon the colon that separates the label from whatever follows |
6791 */ | 7928 */ |
6792 Label({SimpleIdentifier label, Token colon}) : this.full(label, colon); | 7929 Label({SimpleIdentifier label, Token colon}) : this.full(label, colon); |
6793 accept(ASTVisitor visitor) => visitor.visitLabel(this); | 7930 accept(ASTVisitor visitor) => visitor.visitLabel(this); |
6794 Token get beginToken => _label.beginToken; | 7931 Token get beginToken => _label.beginToken; |
| 7932 |
6795 /** | 7933 /** |
6796 * Return the colon that separates the label from the statement. | 7934 * Return the colon that separates the label from the statement. |
6797 * @return the colon that separates the label from the statement | 7935 * @return the colon that separates the label from the statement |
6798 */ | 7936 */ |
6799 Token get colon => _colon; | 7937 Token get colon => _colon; |
6800 Token get endToken => _colon; | 7938 Token get endToken => _colon; |
| 7939 |
6801 /** | 7940 /** |
6802 * Return the label being associated with the statement. | 7941 * Return the label being associated with the statement. |
6803 * @return the label being associated with the statement | 7942 * @return the label being associated with the statement |
6804 */ | 7943 */ |
6805 SimpleIdentifier get label => _label; | 7944 SimpleIdentifier get label => _label; |
| 7945 |
6806 /** | 7946 /** |
6807 * Set the colon that separates the label from the statement to the given toke
n. | 7947 * Set the colon that separates the label from the statement to the given toke
n. |
6808 * @param colon the colon that separates the label from the statement | 7948 * @param colon the colon that separates the label from the statement |
6809 */ | 7949 */ |
6810 void set colon(Token colon2) { | 7950 void set colon(Token colon2) { |
6811 this._colon = colon2; | 7951 this._colon = colon2; |
6812 } | 7952 } |
| 7953 |
6813 /** | 7954 /** |
6814 * Set the label being associated with the statement to the given label. | 7955 * Set the label being associated with the statement to the given label. |
6815 * @param label the label being associated with the statement | 7956 * @param label the label being associated with the statement |
6816 */ | 7957 */ |
6817 void set label(SimpleIdentifier label2) { | 7958 void set label(SimpleIdentifier label2) { |
6818 this._label = becomeParentOf(label2); | 7959 this._label = becomeParentOf(label2); |
6819 } | 7960 } |
6820 void visitChildren(ASTVisitor<Object> visitor) { | 7961 void visitChildren(ASTVisitor<Object> visitor) { |
6821 safelyVisitChild(_label, visitor); | 7962 safelyVisitChild(_label, visitor); |
6822 } | 7963 } |
6823 } | 7964 } |
| 7965 |
6824 /** | 7966 /** |
6825 * Instances of the class {@code LabeledStatement} represent a statement that ha
s a label associated | 7967 * Instances of the class {@code LabeledStatement} represent a statement that ha
s a label associated |
6826 * with them. | 7968 * with them. |
6827 * <pre> | 7969 * <pre> |
6828 * labeledStatement ::={@link Label label}+ {@link Statement statement}</pre> | 7970 * labeledStatement ::={@link Label label}+ {@link Statement statement}</pre> |
6829 * @coverage dart.engine.ast | 7971 * @coverage dart.engine.ast |
6830 */ | 7972 */ |
6831 class LabeledStatement extends Statement { | 7973 class LabeledStatement extends Statement { |
| 7974 |
6832 /** | 7975 /** |
6833 * The labels being associated with the statement. | 7976 * The labels being associated with the statement. |
6834 */ | 7977 */ |
6835 NodeList<Label> _labels; | 7978 NodeList<Label> _labels; |
| 7979 |
6836 /** | 7980 /** |
6837 * The statement with which the labels are being associated. | 7981 * The statement with which the labels are being associated. |
6838 */ | 7982 */ |
6839 Statement _statement; | 7983 Statement _statement; |
| 7984 |
6840 /** | 7985 /** |
6841 * Initialize a newly created labeled statement. | 7986 * Initialize a newly created labeled statement. |
6842 * @param labels the labels being associated with the statement | 7987 * @param labels the labels being associated with the statement |
6843 * @param statement the statement with which the labels are being associated | 7988 * @param statement the statement with which the labels are being associated |
6844 */ | 7989 */ |
6845 LabeledStatement.full(List<Label> labels, Statement statement) { | 7990 LabeledStatement.full(List<Label> labels, Statement statement) { |
6846 this._labels = new NodeList<Label>(this); | 7991 this._labels = new NodeList<Label>(this); |
6847 this._labels.addAll(labels); | 7992 this._labels.addAll(labels); |
6848 this._statement = becomeParentOf(statement); | 7993 this._statement = becomeParentOf(statement); |
6849 } | 7994 } |
| 7995 |
6850 /** | 7996 /** |
6851 * Initialize a newly created labeled statement. | 7997 * Initialize a newly created labeled statement. |
6852 * @param labels the labels being associated with the statement | 7998 * @param labels the labels being associated with the statement |
6853 * @param statement the statement with which the labels are being associated | 7999 * @param statement the statement with which the labels are being associated |
6854 */ | 8000 */ |
6855 LabeledStatement({List<Label> labels, Statement statement}) : this.full(labels
, statement); | 8001 LabeledStatement({List<Label> labels, Statement statement}) : this.full(labels
, statement); |
6856 accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this); | 8002 accept(ASTVisitor visitor) => visitor.visitLabeledStatement(this); |
6857 Token get beginToken { | 8003 Token get beginToken { |
6858 if (!_labels.isEmpty) { | 8004 if (!_labels.isEmpty) { |
6859 return _labels.beginToken; | 8005 return _labels.beginToken; |
6860 } | 8006 } |
6861 return _statement.beginToken; | 8007 return _statement.beginToken; |
6862 } | 8008 } |
6863 Token get endToken => _statement.endToken; | 8009 Token get endToken => _statement.endToken; |
| 8010 |
6864 /** | 8011 /** |
6865 * Return the labels being associated with the statement. | 8012 * Return the labels being associated with the statement. |
6866 * @return the labels being associated with the statement | 8013 * @return the labels being associated with the statement |
6867 */ | 8014 */ |
6868 NodeList<Label> get labels => _labels; | 8015 NodeList<Label> get labels => _labels; |
| 8016 |
6869 /** | 8017 /** |
6870 * Return the statement with which the labels are being associated. | 8018 * Return the statement with which the labels are being associated. |
6871 * @return the statement with which the labels are being associated | 8019 * @return the statement with which the labels are being associated |
6872 */ | 8020 */ |
6873 Statement get statement => _statement; | 8021 Statement get statement => _statement; |
| 8022 |
6874 /** | 8023 /** |
6875 * Set the statement with which the labels are being associated to the given s
tatement. | 8024 * Set the statement with which the labels are being associated to the given s
tatement. |
6876 * @param statement the statement with which the labels are being associated | 8025 * @param statement the statement with which the labels are being associated |
6877 */ | 8026 */ |
6878 void set statement(Statement statement2) { | 8027 void set statement(Statement statement2) { |
6879 this._statement = becomeParentOf(statement2); | 8028 this._statement = becomeParentOf(statement2); |
6880 } | 8029 } |
6881 void visitChildren(ASTVisitor<Object> visitor) { | 8030 void visitChildren(ASTVisitor<Object> visitor) { |
6882 _labels.accept(visitor); | 8031 _labels.accept(visitor); |
6883 safelyVisitChild(_statement, visitor); | 8032 safelyVisitChild(_statement, visitor); |
6884 } | 8033 } |
6885 } | 8034 } |
| 8035 |
6886 /** | 8036 /** |
6887 * Instances of the class {@code LibraryDirective} represent a library directive
. | 8037 * Instances of the class {@code LibraryDirective} represent a library directive
. |
6888 * <pre> | 8038 * <pre> |
6889 * libraryDirective ::={@link Annotation metadata} 'library' {@link Identifier n
ame} ';' | 8039 * libraryDirective ::={@link Annotation metadata} 'library' {@link Identifier n
ame} ';' |
6890 * </pre> | 8040 * </pre> |
6891 * @coverage dart.engine.ast | 8041 * @coverage dart.engine.ast |
6892 */ | 8042 */ |
6893 class LibraryDirective extends Directive { | 8043 class LibraryDirective extends Directive { |
| 8044 |
6894 /** | 8045 /** |
6895 * The token representing the 'library' token. | 8046 * The token representing the 'library' token. |
6896 */ | 8047 */ |
6897 Token _libraryToken; | 8048 Token _libraryToken; |
| 8049 |
6898 /** | 8050 /** |
6899 * The name of the library being defined. | 8051 * The name of the library being defined. |
6900 */ | 8052 */ |
6901 LibraryIdentifier _name; | 8053 LibraryIdentifier _name; |
| 8054 |
6902 /** | 8055 /** |
6903 * The semicolon terminating the directive. | 8056 * The semicolon terminating the directive. |
6904 */ | 8057 */ |
6905 Token _semicolon; | 8058 Token _semicolon; |
| 8059 |
6906 /** | 8060 /** |
6907 * Initialize a newly created library directive. | 8061 * Initialize a newly created library directive. |
6908 * @param comment the documentation comment associated with this directive | 8062 * @param comment the documentation comment associated with this directive |
6909 * @param metadata the annotations associated with the directive | 8063 * @param metadata the annotations associated with the directive |
6910 * @param libraryToken the token representing the 'library' token | 8064 * @param libraryToken the token representing the 'library' token |
6911 * @param name the name of the library being defined | 8065 * @param name the name of the library being defined |
6912 * @param semicolon the semicolon terminating the directive | 8066 * @param semicolon the semicolon terminating the directive |
6913 */ | 8067 */ |
6914 LibraryDirective.full(Comment comment, List<Annotation> metadata, Token librar
yToken, LibraryIdentifier name, Token semicolon) : super.full(comment, metadata)
{ | 8068 LibraryDirective.full(Comment comment, List<Annotation> metadata, Token librar
yToken, LibraryIdentifier name, Token semicolon) : super.full(comment, metadata)
{ |
6915 this._libraryToken = libraryToken; | 8069 this._libraryToken = libraryToken; |
6916 this._name = becomeParentOf(name); | 8070 this._name = becomeParentOf(name); |
6917 this._semicolon = semicolon; | 8071 this._semicolon = semicolon; |
6918 } | 8072 } |
| 8073 |
6919 /** | 8074 /** |
6920 * Initialize a newly created library directive. | 8075 * Initialize a newly created library directive. |
6921 * @param comment the documentation comment associated with this directive | 8076 * @param comment the documentation comment associated with this directive |
6922 * @param metadata the annotations associated with the directive | 8077 * @param metadata the annotations associated with the directive |
6923 * @param libraryToken the token representing the 'library' token | 8078 * @param libraryToken the token representing the 'library' token |
6924 * @param name the name of the library being defined | 8079 * @param name the name of the library being defined |
6925 * @param semicolon the semicolon terminating the directive | 8080 * @param semicolon the semicolon terminating the directive |
6926 */ | 8081 */ |
6927 LibraryDirective({Comment comment, List<Annotation> metadata, Token libraryTok
en, LibraryIdentifier name, Token semicolon}) : this.full(comment, metadata, lib
raryToken, name, semicolon); | 8082 LibraryDirective({Comment comment, List<Annotation> metadata, Token libraryTok
en, LibraryIdentifier name, Token semicolon}) : this.full(comment, metadata, lib
raryToken, name, semicolon); |
6928 accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this); | 8083 accept(ASTVisitor visitor) => visitor.visitLibraryDirective(this); |
6929 Token get endToken => _semicolon; | 8084 Token get endToken => _semicolon; |
6930 Token get keyword => _libraryToken; | 8085 Token get keyword => _libraryToken; |
| 8086 |
6931 /** | 8087 /** |
6932 * Return the token representing the 'library' token. | 8088 * Return the token representing the 'library' token. |
6933 * @return the token representing the 'library' token | 8089 * @return the token representing the 'library' token |
6934 */ | 8090 */ |
6935 Token get libraryToken => _libraryToken; | 8091 Token get libraryToken => _libraryToken; |
| 8092 |
6936 /** | 8093 /** |
6937 * Return the name of the library being defined. | 8094 * Return the name of the library being defined. |
6938 * @return the name of the library being defined | 8095 * @return the name of the library being defined |
6939 */ | 8096 */ |
6940 LibraryIdentifier get name => _name; | 8097 LibraryIdentifier get name => _name; |
| 8098 |
6941 /** | 8099 /** |
6942 * Return the semicolon terminating the directive. | 8100 * Return the semicolon terminating the directive. |
6943 * @return the semicolon terminating the directive | 8101 * @return the semicolon terminating the directive |
6944 */ | 8102 */ |
6945 Token get semicolon => _semicolon; | 8103 Token get semicolon => _semicolon; |
| 8104 |
6946 /** | 8105 /** |
6947 * Set the token representing the 'library' token to the given token. | 8106 * Set the token representing the 'library' token to the given token. |
6948 * @param libraryToken the token representing the 'library' token | 8107 * @param libraryToken the token representing the 'library' token |
6949 */ | 8108 */ |
6950 void set libraryToken(Token libraryToken2) { | 8109 void set libraryToken(Token libraryToken2) { |
6951 this._libraryToken = libraryToken2; | 8110 this._libraryToken = libraryToken2; |
6952 } | 8111 } |
| 8112 |
6953 /** | 8113 /** |
6954 * Set the name of the library being defined to the given name. | 8114 * Set the name of the library being defined to the given name. |
6955 * @param name the name of the library being defined | 8115 * @param name the name of the library being defined |
6956 */ | 8116 */ |
6957 void set name(LibraryIdentifier name2) { | 8117 void set name(LibraryIdentifier name2) { |
6958 this._name = becomeParentOf(name2); | 8118 this._name = becomeParentOf(name2); |
6959 } | 8119 } |
| 8120 |
6960 /** | 8121 /** |
6961 * Set the semicolon terminating the directive to the given token. | 8122 * Set the semicolon terminating the directive to the given token. |
6962 * @param semicolon the semicolon terminating the directive | 8123 * @param semicolon the semicolon terminating the directive |
6963 */ | 8124 */ |
6964 void set semicolon(Token semicolon2) { | 8125 void set semicolon(Token semicolon2) { |
6965 this._semicolon = semicolon2; | 8126 this._semicolon = semicolon2; |
6966 } | 8127 } |
6967 void visitChildren(ASTVisitor<Object> visitor) { | 8128 void visitChildren(ASTVisitor<Object> visitor) { |
6968 super.visitChildren(visitor); | 8129 super.visitChildren(visitor); |
6969 safelyVisitChild(_name, visitor); | 8130 safelyVisitChild(_name, visitor); |
6970 } | 8131 } |
6971 Token get firstTokenAfterCommentAndMetadata => _libraryToken; | 8132 Token get firstTokenAfterCommentAndMetadata => _libraryToken; |
6972 } | 8133 } |
| 8134 |
6973 /** | 8135 /** |
6974 * Instances of the class {@code LibraryIdentifier} represent the identifier for
a library. | 8136 * Instances of the class {@code LibraryIdentifier} represent the identifier for
a library. |
6975 * <pre> | 8137 * <pre> |
6976 * libraryIdentifier ::={@link SimpleIdentifier component} ('.' {@link SimpleIde
ntifier component}) | 8138 * libraryIdentifier ::={@link SimpleIdentifier component} ('.' {@link SimpleIde
ntifier component}) |
6977 * </pre> | 8139 * </pre> |
6978 * @coverage dart.engine.ast | 8140 * @coverage dart.engine.ast |
6979 */ | 8141 */ |
6980 class LibraryIdentifier extends Identifier { | 8142 class LibraryIdentifier extends Identifier { |
| 8143 |
6981 /** | 8144 /** |
6982 * The components of the identifier. | 8145 * The components of the identifier. |
6983 */ | 8146 */ |
6984 NodeList<SimpleIdentifier> _components; | 8147 NodeList<SimpleIdentifier> _components; |
| 8148 |
6985 /** | 8149 /** |
6986 * Initialize a newly created prefixed identifier. | 8150 * Initialize a newly created prefixed identifier. |
6987 * @param components the components of the identifier | 8151 * @param components the components of the identifier |
6988 */ | 8152 */ |
6989 LibraryIdentifier.full(List<SimpleIdentifier> components) { | 8153 LibraryIdentifier.full(List<SimpleIdentifier> components) { |
6990 this._components = new NodeList<SimpleIdentifier>(this); | 8154 this._components = new NodeList<SimpleIdentifier>(this); |
6991 this._components.addAll(components); | 8155 this._components.addAll(components); |
6992 } | 8156 } |
| 8157 |
6993 /** | 8158 /** |
6994 * Initialize a newly created prefixed identifier. | 8159 * Initialize a newly created prefixed identifier. |
6995 * @param components the components of the identifier | 8160 * @param components the components of the identifier |
6996 */ | 8161 */ |
6997 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components)
; | 8162 LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components)
; |
6998 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); | 8163 accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this); |
6999 Token get beginToken => _components.beginToken; | 8164 Token get beginToken => _components.beginToken; |
| 8165 |
7000 /** | 8166 /** |
7001 * Return the components of the identifier. | 8167 * Return the components of the identifier. |
7002 * @return the components of the identifier | 8168 * @return the components of the identifier |
7003 */ | 8169 */ |
7004 NodeList<SimpleIdentifier> get components => _components; | 8170 NodeList<SimpleIdentifier> get components => _components; |
7005 Element get element => null; | 8171 Element get element => null; |
7006 Token get endToken => _components.endToken; | 8172 Token get endToken => _components.endToken; |
7007 String get name { | 8173 String get name { |
7008 JavaStringBuilder builder = new JavaStringBuilder(); | 8174 JavaStringBuilder builder = new JavaStringBuilder(); |
7009 bool needsPeriod = false; | 8175 bool needsPeriod = false; |
7010 for (SimpleIdentifier identifier in _components) { | 8176 for (SimpleIdentifier identifier in _components) { |
7011 if (needsPeriod) { | 8177 if (needsPeriod) { |
7012 builder.append("."); | 8178 builder.append("."); |
7013 } else { | 8179 } else { |
7014 needsPeriod = true; | 8180 needsPeriod = true; |
7015 } | 8181 } |
7016 builder.append(identifier.name); | 8182 builder.append(identifier.name); |
7017 } | 8183 } |
7018 return builder.toString(); | 8184 return builder.toString(); |
7019 } | 8185 } |
| 8186 Element get staticElement => null; |
7020 void visitChildren(ASTVisitor<Object> visitor) { | 8187 void visitChildren(ASTVisitor<Object> visitor) { |
7021 _components.accept(visitor); | 8188 _components.accept(visitor); |
7022 } | 8189 } |
7023 } | 8190 } |
| 8191 |
7024 /** | 8192 /** |
7025 * Instances of the class {@code ListLiteral} represent a list literal. | 8193 * Instances of the class {@code ListLiteral} represent a list literal. |
7026 * <pre> | 8194 * <pre> |
7027 * listLiteral ::= | 8195 * listLiteral ::= |
7028 * 'const'? ('<' {@link TypeName type} '>')? '\[' ({@link Expression expressionL
ist} ','?)? '\]' | 8196 * 'const'? ('<' {@link TypeName type} '>')? '\[' ({@link Expression expressionL
ist} ','?)? '\]' |
7029 * </pre> | 8197 * </pre> |
7030 * @coverage dart.engine.ast | 8198 * @coverage dart.engine.ast |
7031 */ | 8199 */ |
7032 class ListLiteral extends TypedLiteral { | 8200 class ListLiteral extends TypedLiteral { |
| 8201 |
7033 /** | 8202 /** |
7034 * The left square bracket. | 8203 * The left square bracket. |
7035 */ | 8204 */ |
7036 Token _leftBracket; | 8205 Token _leftBracket; |
| 8206 |
7037 /** | 8207 /** |
7038 * The expressions used to compute the elements of the list. | 8208 * The expressions used to compute the elements of the list. |
7039 */ | 8209 */ |
7040 NodeList<Expression> _elements; | 8210 NodeList<Expression> _elements; |
| 8211 |
7041 /** | 8212 /** |
7042 * The right square bracket. | 8213 * The right square bracket. |
7043 */ | 8214 */ |
7044 Token _rightBracket; | 8215 Token _rightBracket; |
| 8216 |
7045 /** | 8217 /** |
7046 * Initialize a newly created list literal. | 8218 * Initialize a newly created list literal. |
7047 * @param modifier the const modifier associated with this literal | 8219 * @param modifier the const modifier associated with this literal |
7048 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8220 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
7049 * arguments were declared | 8221 * arguments were declared |
7050 * @param leftBracket the left square bracket | 8222 * @param leftBracket the left square bracket |
7051 * @param elements the expressions used to compute the elements of the list | 8223 * @param elements the expressions used to compute the elements of the list |
7052 * @param rightBracket the right square bracket | 8224 * @param rightBracket the right square bracket |
7053 */ | 8225 */ |
7054 ListLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBra
cket, List<Expression> elements, Token rightBracket) : super.full(modifier, type
Arguments) { | 8226 ListLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBra
cket, List<Expression> elements, Token rightBracket) : super.full(modifier, type
Arguments) { |
7055 this._elements = new NodeList<Expression>(this); | 8227 this._elements = new NodeList<Expression>(this); |
7056 this._leftBracket = leftBracket; | 8228 this._leftBracket = leftBracket; |
7057 this._elements.addAll(elements); | 8229 this._elements.addAll(elements); |
7058 this._rightBracket = rightBracket; | 8230 this._rightBracket = rightBracket; |
7059 } | 8231 } |
| 8232 |
7060 /** | 8233 /** |
7061 * Initialize a newly created list literal. | 8234 * Initialize a newly created list literal. |
7062 * @param modifier the const modifier associated with this literal | 8235 * @param modifier the const modifier associated with this literal |
7063 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8236 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
7064 * arguments were declared | 8237 * arguments were declared |
7065 * @param leftBracket the left square bracket | 8238 * @param leftBracket the left square bracket |
7066 * @param elements the expressions used to compute the elements of the list | 8239 * @param elements the expressions used to compute the elements of the list |
7067 * @param rightBracket the right square bracket | 8240 * @param rightBracket the right square bracket |
7068 */ | 8241 */ |
7069 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); | 8242 ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket
, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArgu
ments, leftBracket, elements, rightBracket); |
7070 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); | 8243 accept(ASTVisitor visitor) => visitor.visitListLiteral(this); |
7071 Token get beginToken { | 8244 Token get beginToken { |
7072 Token token = modifier; | 8245 Token token = modifier; |
7073 if (token != null) { | 8246 if (token != null) { |
7074 return token; | 8247 return token; |
7075 } | 8248 } |
7076 TypeArgumentList typeArguments2 = typeArguments; | 8249 TypeArgumentList typeArguments2 = typeArguments; |
7077 if (typeArguments2 != null) { | 8250 if (typeArguments2 != null) { |
7078 return typeArguments2.beginToken; | 8251 return typeArguments2.beginToken; |
7079 } | 8252 } |
7080 return _leftBracket; | 8253 return _leftBracket; |
7081 } | 8254 } |
| 8255 |
7082 /** | 8256 /** |
7083 * Return the expressions used to compute the elements of the list. | 8257 * Return the expressions used to compute the elements of the list. |
7084 * @return the expressions used to compute the elements of the list | 8258 * @return the expressions used to compute the elements of the list |
7085 */ | 8259 */ |
7086 NodeList<Expression> get elements => _elements; | 8260 NodeList<Expression> get elements => _elements; |
7087 Token get endToken => _rightBracket; | 8261 Token get endToken => _rightBracket; |
| 8262 |
7088 /** | 8263 /** |
7089 * Return the left square bracket. | 8264 * Return the left square bracket. |
7090 * @return the left square bracket | 8265 * @return the left square bracket |
7091 */ | 8266 */ |
7092 Token get leftBracket => _leftBracket; | 8267 Token get leftBracket => _leftBracket; |
| 8268 |
7093 /** | 8269 /** |
7094 * Return the right square bracket. | 8270 * Return the right square bracket. |
7095 * @return the right square bracket | 8271 * @return the right square bracket |
7096 */ | 8272 */ |
7097 Token get rightBracket => _rightBracket; | 8273 Token get rightBracket => _rightBracket; |
| 8274 |
7098 /** | 8275 /** |
7099 * Set the left square bracket to the given token. | 8276 * Set the left square bracket to the given token. |
7100 * @param bracket the left square bracket | 8277 * @param bracket the left square bracket |
7101 */ | 8278 */ |
7102 void set leftBracket(Token bracket) { | 8279 void set leftBracket(Token bracket) { |
7103 _leftBracket = bracket; | 8280 _leftBracket = bracket; |
7104 } | 8281 } |
| 8282 |
7105 /** | 8283 /** |
7106 * Set the right square bracket to the given token. | 8284 * Set the right square bracket to the given token. |
7107 * @param bracket the right square bracket | 8285 * @param bracket the right square bracket |
7108 */ | 8286 */ |
7109 void set rightBracket(Token bracket) { | 8287 void set rightBracket(Token bracket) { |
7110 _rightBracket = bracket; | 8288 _rightBracket = bracket; |
7111 } | 8289 } |
7112 void visitChildren(ASTVisitor<Object> visitor) { | 8290 void visitChildren(ASTVisitor<Object> visitor) { |
7113 super.visitChildren(visitor); | 8291 super.visitChildren(visitor); |
7114 _elements.accept(visitor); | 8292 _elements.accept(visitor); |
7115 } | 8293 } |
7116 } | 8294 } |
| 8295 |
7117 /** | 8296 /** |
7118 * The abstract class {@code Literal} defines the behavior common to nodes that
represent a literal | 8297 * The abstract class {@code Literal} defines the behavior common to nodes that
represent a literal |
7119 * expression. | 8298 * expression. |
7120 * <pre> | 8299 * <pre> |
7121 * literal ::={@link BooleanLiteral booleanLiteral}| {@link DoubleLiteral double
Literal}| {@link IntegerLiteral integerLiteral}| {@link ListLiteral listLiteral}
| {@link MapLiteral mapLiteral}| {@link NullLiteral nullLiteral}| {@link StringL
iteral stringLiteral}</pre> | 8300 * literal ::={@link BooleanLiteral booleanLiteral}| {@link DoubleLiteral double
Literal}| {@link IntegerLiteral integerLiteral}| {@link ListLiteral listLiteral}
| {@link MapLiteral mapLiteral}| {@link NullLiteral nullLiteral}| {@link StringL
iteral stringLiteral}</pre> |
7122 * @coverage dart.engine.ast | 8301 * @coverage dart.engine.ast |
7123 */ | 8302 */ |
7124 abstract class Literal extends Expression { | 8303 abstract class Literal extends Expression { |
7125 } | 8304 } |
| 8305 |
7126 /** | 8306 /** |
7127 * Instances of the class {@code MapLiteral} represent a literal map. | 8307 * Instances of the class {@code MapLiteral} represent a literal map. |
7128 * <pre> | 8308 * <pre> |
7129 * mapLiteral ::= | 8309 * mapLiteral ::= |
7130 * 'const'? ('<' {@link TypeName type} (',' {@link TypeName type})* '>')? '{' ({
@link MapLiteralEntry entry} (',' {@link MapLiteralEntry entry})* ','?)? '}' | 8310 * 'const'? ('<' {@link TypeName type} (',' {@link TypeName type})* '>')? '{' ({
@link MapLiteralEntry entry} (',' {@link MapLiteralEntry entry})* ','?)? '}' |
7131 * </pre> | 8311 * </pre> |
7132 * @coverage dart.engine.ast | 8312 * @coverage dart.engine.ast |
7133 */ | 8313 */ |
7134 class MapLiteral extends TypedLiteral { | 8314 class MapLiteral extends TypedLiteral { |
| 8315 |
7135 /** | 8316 /** |
7136 * The left curly bracket. | 8317 * The left curly bracket. |
7137 */ | 8318 */ |
7138 Token _leftBracket; | 8319 Token _leftBracket; |
| 8320 |
7139 /** | 8321 /** |
7140 * The entries in the map. | 8322 * The entries in the map. |
7141 */ | 8323 */ |
7142 NodeList<MapLiteralEntry> _entries; | 8324 NodeList<MapLiteralEntry> _entries; |
| 8325 |
7143 /** | 8326 /** |
7144 * The right curly bracket. | 8327 * The right curly bracket. |
7145 */ | 8328 */ |
7146 Token _rightBracket; | 8329 Token _rightBracket; |
| 8330 |
7147 /** | 8331 /** |
7148 * Initialize a newly created map literal. | 8332 * Initialize a newly created map literal. |
7149 * @param modifier the const modifier associated with this literal | 8333 * @param modifier the const modifier associated with this literal |
7150 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8334 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
7151 * arguments were declared | 8335 * arguments were declared |
7152 * @param leftBracket the left curly bracket | 8336 * @param leftBracket the left curly bracket |
7153 * @param entries the entries in the map | 8337 * @param entries the entries in the map |
7154 * @param rightBracket the right curly bracket | 8338 * @param rightBracket the right curly bracket |
7155 */ | 8339 */ |
7156 MapLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBrac
ket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(modifier, t
ypeArguments) { | 8340 MapLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBrac
ket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(modifier, t
ypeArguments) { |
7157 this._entries = new NodeList<MapLiteralEntry>(this); | 8341 this._entries = new NodeList<MapLiteralEntry>(this); |
7158 this._leftBracket = leftBracket; | 8342 this._leftBracket = leftBracket; |
7159 this._entries.addAll(entries); | 8343 this._entries.addAll(entries); |
7160 this._rightBracket = rightBracket; | 8344 this._rightBracket = rightBracket; |
7161 } | 8345 } |
| 8346 |
7162 /** | 8347 /** |
7163 * Initialize a newly created map literal. | 8348 * Initialize a newly created map literal. |
7164 * @param modifier the const modifier associated with this literal | 8349 * @param modifier the const modifier associated with this literal |
7165 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 8350 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
7166 * arguments were declared | 8351 * arguments were declared |
7167 * @param leftBracket the left curly bracket | 8352 * @param leftBracket the left curly bracket |
7168 * @param entries the entries in the map | 8353 * @param entries the entries in the map |
7169 * @param rightBracket the right curly bracket | 8354 * @param rightBracket the right curly bracket |
7170 */ | 8355 */ |
7171 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); | 8356 MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket,
List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeA
rguments, leftBracket, entries, rightBracket); |
7172 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); | 8357 accept(ASTVisitor visitor) => visitor.visitMapLiteral(this); |
7173 Token get beginToken { | 8358 Token get beginToken { |
7174 Token token = modifier; | 8359 Token token = modifier; |
7175 if (token != null) { | 8360 if (token != null) { |
7176 return token; | 8361 return token; |
7177 } | 8362 } |
7178 TypeArgumentList typeArguments2 = typeArguments; | 8363 TypeArgumentList typeArguments2 = typeArguments; |
7179 if (typeArguments2 != null) { | 8364 if (typeArguments2 != null) { |
7180 return typeArguments2.beginToken; | 8365 return typeArguments2.beginToken; |
7181 } | 8366 } |
7182 return _leftBracket; | 8367 return _leftBracket; |
7183 } | 8368 } |
7184 Token get endToken => _rightBracket; | 8369 Token get endToken => _rightBracket; |
| 8370 |
7185 /** | 8371 /** |
7186 * Return the entries in the map. | 8372 * Return the entries in the map. |
7187 * @return the entries in the map | 8373 * @return the entries in the map |
7188 */ | 8374 */ |
7189 NodeList<MapLiteralEntry> get entries => _entries; | 8375 NodeList<MapLiteralEntry> get entries => _entries; |
| 8376 |
7190 /** | 8377 /** |
7191 * Return the left curly bracket. | 8378 * Return the left curly bracket. |
7192 * @return the left curly bracket | 8379 * @return the left curly bracket |
7193 */ | 8380 */ |
7194 Token get leftBracket => _leftBracket; | 8381 Token get leftBracket => _leftBracket; |
| 8382 |
7195 /** | 8383 /** |
7196 * Return the right curly bracket. | 8384 * Return the right curly bracket. |
7197 * @return the right curly bracket | 8385 * @return the right curly bracket |
7198 */ | 8386 */ |
7199 Token get rightBracket => _rightBracket; | 8387 Token get rightBracket => _rightBracket; |
| 8388 |
7200 /** | 8389 /** |
7201 * Set the left curly bracket to the given token. | 8390 * Set the left curly bracket to the given token. |
7202 * @param bracket the left curly bracket | 8391 * @param bracket the left curly bracket |
7203 */ | 8392 */ |
7204 void set leftBracket(Token bracket) { | 8393 void set leftBracket(Token bracket) { |
7205 _leftBracket = bracket; | 8394 _leftBracket = bracket; |
7206 } | 8395 } |
| 8396 |
7207 /** | 8397 /** |
7208 * Set the right curly bracket to the given token. | 8398 * Set the right curly bracket to the given token. |
7209 * @param bracket the right curly bracket | 8399 * @param bracket the right curly bracket |
7210 */ | 8400 */ |
7211 void set rightBracket(Token bracket) { | 8401 void set rightBracket(Token bracket) { |
7212 _rightBracket = bracket; | 8402 _rightBracket = bracket; |
7213 } | 8403 } |
7214 void visitChildren(ASTVisitor<Object> visitor) { | 8404 void visitChildren(ASTVisitor<Object> visitor) { |
7215 super.visitChildren(visitor); | 8405 super.visitChildren(visitor); |
7216 _entries.accept(visitor); | 8406 _entries.accept(visitor); |
7217 } | 8407 } |
7218 } | 8408 } |
| 8409 |
7219 /** | 8410 /** |
7220 * Instances of the class {@code MapLiteralEntry} represent a single key/value p
air in a map | 8411 * Instances of the class {@code MapLiteralEntry} represent a single key/value p
air in a map |
7221 * literal. | 8412 * literal. |
7222 * <pre> | 8413 * <pre> |
7223 * mapLiteralEntry ::={@link StringLiteral key} ':' {@link Expression value}</pr
e> | 8414 * mapLiteralEntry ::={@link Expression key} ':' {@link Expression value}</pre> |
7224 * @coverage dart.engine.ast | 8415 * @coverage dart.engine.ast |
7225 */ | 8416 */ |
7226 class MapLiteralEntry extends ASTNode { | 8417 class MapLiteralEntry extends ASTNode { |
| 8418 |
7227 /** | 8419 /** |
7228 * The key with which the value will be associated. | 8420 * The expression computing the key with which the value will be associated. |
7229 */ | 8421 */ |
7230 StringLiteral _key; | 8422 Expression _key; |
| 8423 |
7231 /** | 8424 /** |
7232 * The colon that separates the key from the value. | 8425 * The colon that separates the key from the value. |
7233 */ | 8426 */ |
7234 Token _separator; | 8427 Token _separator; |
| 8428 |
7235 /** | 8429 /** |
7236 * The expression computing the value that will be associated with the key. | 8430 * The expression computing the value that will be associated with the key. |
7237 */ | 8431 */ |
7238 Expression _value; | 8432 Expression _value; |
| 8433 |
7239 /** | 8434 /** |
7240 * Initialize a newly created map literal entry. | 8435 * Initialize a newly created map literal entry. |
7241 * @param key the key with which the value will be associated | 8436 * @param key the expression computing the key with which the value will be as
sociated |
7242 * @param separator the colon that separates the key from the value | 8437 * @param separator the colon that separates the key from the value |
7243 * @param value the expression computing the value that will be associated wit
h the key | 8438 * @param value the expression computing the value that will be associated wit
h the key |
7244 */ | 8439 */ |
7245 MapLiteralEntry.full(StringLiteral key, Token separator, Expression value) { | 8440 MapLiteralEntry.full(Expression key, Token separator, Expression value) { |
7246 this._key = becomeParentOf(key); | 8441 this._key = becomeParentOf(key); |
7247 this._separator = separator; | 8442 this._separator = separator; |
7248 this._value = becomeParentOf(value); | 8443 this._value = becomeParentOf(value); |
7249 } | 8444 } |
| 8445 |
7250 /** | 8446 /** |
7251 * Initialize a newly created map literal entry. | 8447 * Initialize a newly created map literal entry. |
7252 * @param key the key with which the value will be associated | 8448 * @param key the expression computing the key with which the value will be as
sociated |
7253 * @param separator the colon that separates the key from the value | 8449 * @param separator the colon that separates the key from the value |
7254 * @param value the expression computing the value that will be associated wit
h the key | 8450 * @param value the expression computing the value that will be associated wit
h the key |
7255 */ | 8451 */ |
7256 MapLiteralEntry({StringLiteral key, Token separator, Expression value}) : this
.full(key, separator, value); | 8452 MapLiteralEntry({Expression key, Token separator, Expression value}) : this.fu
ll(key, separator, value); |
7257 accept(ASTVisitor visitor) => visitor.visitMapLiteralEntry(this); | 8453 accept(ASTVisitor visitor) => visitor.visitMapLiteralEntry(this); |
7258 Token get beginToken => _key.beginToken; | 8454 Token get beginToken => _key.beginToken; |
7259 Token get endToken => _value.endToken; | 8455 Token get endToken => _value.endToken; |
| 8456 |
7260 /** | 8457 /** |
7261 * Return the key with which the value will be associated. | 8458 * Return the expression computing the key with which the value will be associ
ated. |
7262 * @return the key with which the value will be associated | 8459 * @return the expression computing the key with which the value will be assoc
iated |
7263 */ | 8460 */ |
7264 StringLiteral get key => _key; | 8461 Expression get key => _key; |
| 8462 |
7265 /** | 8463 /** |
7266 * Return the colon that separates the key from the value. | 8464 * Return the colon that separates the key from the value. |
7267 * @return the colon that separates the key from the value | 8465 * @return the colon that separates the key from the value |
7268 */ | 8466 */ |
7269 Token get separator => _separator; | 8467 Token get separator => _separator; |
| 8468 |
7270 /** | 8469 /** |
7271 * Return the expression computing the value that will be associated with the
key. | 8470 * Return the expression computing the value that will be associated with the
key. |
7272 * @return the expression computing the value that will be associated with the
key | 8471 * @return the expression computing the value that will be associated with the
key |
7273 */ | 8472 */ |
7274 Expression get value => _value; | 8473 Expression get value => _value; |
| 8474 |
7275 /** | 8475 /** |
7276 * Set the key with which the value will be associated to the given string. | 8476 * Set the expression computing the key with which the value will be associate
d to the given |
7277 * @param string the key with which the value will be associated | 8477 * string. |
| 8478 * @param string the expression computing the key with which the value will be
associated |
7278 */ | 8479 */ |
7279 void set key(StringLiteral string) { | 8480 void set key(Expression string) { |
7280 _key = becomeParentOf(string); | 8481 _key = becomeParentOf(string); |
7281 } | 8482 } |
| 8483 |
7282 /** | 8484 /** |
7283 * Set the colon that separates the key from the value to the given token. | 8485 * Set the colon that separates the key from the value to the given token. |
7284 * @param separator the colon that separates the key from the value | 8486 * @param separator the colon that separates the key from the value |
7285 */ | 8487 */ |
7286 void set separator(Token separator2) { | 8488 void set separator(Token separator2) { |
7287 this._separator = separator2; | 8489 this._separator = separator2; |
7288 } | 8490 } |
| 8491 |
7289 /** | 8492 /** |
7290 * Set the expression computing the value that will be associated with the key
to the given | 8493 * Set the expression computing the value that will be associated with the key
to the given |
7291 * expression. | 8494 * expression. |
7292 * @param expression the expression computing the value that will be associate
d with the key | 8495 * @param expression the expression computing the value that will be associate
d with the key |
7293 */ | 8496 */ |
7294 void set value(Expression expression) { | 8497 void set value(Expression expression) { |
7295 _value = becomeParentOf(expression); | 8498 _value = becomeParentOf(expression); |
7296 } | 8499 } |
7297 void visitChildren(ASTVisitor<Object> visitor) { | 8500 void visitChildren(ASTVisitor<Object> visitor) { |
7298 safelyVisitChild(_key, visitor); | 8501 safelyVisitChild(_key, visitor); |
7299 safelyVisitChild(_value, visitor); | 8502 safelyVisitChild(_value, visitor); |
7300 } | 8503 } |
7301 } | 8504 } |
| 8505 |
7302 /** | 8506 /** |
7303 * Instances of the class {@code MethodDeclaration} represent a method declarati
on. | 8507 * Instances of the class {@code MethodDeclaration} represent a method declarati
on. |
7304 * <pre> | 8508 * <pre> |
7305 * methodDeclaration ::= | 8509 * methodDeclaration ::= |
7306 * methodSignature {@link FunctionBody body}methodSignature ::= | 8510 * methodSignature {@link FunctionBody body}methodSignature ::= |
7307 * 'external'? ('abstract' | 'static')? {@link Type returnType}? ('get' | 'set')
? methodName{@link FormalParameterList formalParameterList}methodName ::={@link
SimpleIdentifier name}| 'operator' {@link SimpleIdentifier operator}</pre> | 8511 * 'external'? ('abstract' | 'static')? {@link Type returnType}? ('get' | 'set')
? methodName{@link FormalParameterList formalParameterList}methodName ::={@link
SimpleIdentifier name}| 'operator' {@link SimpleIdentifier operator}</pre> |
7308 * @coverage dart.engine.ast | 8512 * @coverage dart.engine.ast |
7309 */ | 8513 */ |
7310 class MethodDeclaration extends ClassMember { | 8514 class MethodDeclaration extends ClassMember { |
| 8515 |
7311 /** | 8516 /** |
7312 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. | 8517 * The token for the 'external' keyword, or {@code null} if the constructor is
not external. |
7313 */ | 8518 */ |
7314 Token _externalKeyword; | 8519 Token _externalKeyword; |
| 8520 |
7315 /** | 8521 /** |
7316 * The token representing the 'abstract' or 'static' keyword, or {@code null}
if neither modifier | 8522 * The token representing the 'abstract' or 'static' keyword, or {@code null}
if neither modifier |
7317 * was specified. | 8523 * was specified. |
7318 */ | 8524 */ |
7319 Token _modifierKeyword; | 8525 Token _modifierKeyword; |
| 8526 |
7320 /** | 8527 /** |
7321 * The return type of the method, or {@code null} if no return type was declar
ed. | 8528 * The return type of the method, or {@code null} if no return type was declar
ed. |
7322 */ | 8529 */ |
7323 TypeName _returnType; | 8530 TypeName _returnType; |
| 8531 |
7324 /** | 8532 /** |
7325 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a method | 8533 * The token representing the 'get' or 'set' keyword, or {@code null} if this
is a method |
7326 * declaration rather than a property declaration. | 8534 * declaration rather than a property declaration. |
7327 */ | 8535 */ |
7328 Token _propertyKeyword; | 8536 Token _propertyKeyword; |
| 8537 |
7329 /** | 8538 /** |
7330 * The token representing the 'operator' keyword, or {@code null} if this meth
od does not declare | 8539 * The token representing the 'operator' keyword, or {@code null} if this meth
od does not declare |
7331 * an operator. | 8540 * an operator. |
7332 */ | 8541 */ |
7333 Token _operatorKeyword; | 8542 Token _operatorKeyword; |
| 8543 |
7334 /** | 8544 /** |
7335 * The name of the method. | 8545 * The name of the method. |
7336 */ | 8546 */ |
7337 SimpleIdentifier _name; | 8547 SimpleIdentifier _name; |
| 8548 |
7338 /** | 8549 /** |
7339 * The parameters associated with the method, or {@code null} if this method d
eclares a getter. | 8550 * The parameters associated with the method, or {@code null} if this method d
eclares a getter. |
7340 */ | 8551 */ |
7341 FormalParameterList _parameters; | 8552 FormalParameterList _parameters; |
| 8553 |
7342 /** | 8554 /** |
7343 * The body of the method. | 8555 * The body of the method. |
7344 */ | 8556 */ |
7345 FunctionBody _body; | 8557 FunctionBody _body; |
| 8558 |
7346 /** | 8559 /** |
7347 * Initialize a newly created method declaration. | 8560 * Initialize a newly created method declaration. |
7348 * @param externalKeyword the token for the 'external' keyword | 8561 * @param externalKeyword the token for the 'external' keyword |
7349 * @param comment the documentation comment associated with this method | 8562 * @param comment the documentation comment associated with this method |
7350 * @param metadata the annotations associated with this method | 8563 * @param metadata the annotations associated with this method |
7351 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 8564 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
7352 * @param returnType the return type of the method | 8565 * @param returnType the return type of the method |
7353 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 8566 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
7354 * @param operatorKeyword the token representing the 'operator' keyword | 8567 * @param operatorKeyword the token representing the 'operator' keyword |
7355 * @param name the name of the method | 8568 * @param name the name of the method |
7356 * @param parameters the parameters associated with the method, or {@code null
} if this method | 8569 * @param parameters the parameters associated with the method, or {@code null
} if this method |
7357 * declares a getter | 8570 * declares a getter |
7358 * @param body the body of the method | 8571 * @param body the body of the method |
7359 */ | 8572 */ |
7360 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) { | 8573 MethodDeclaration.full(Comment comment, List<Annotation> metadata, Token exter
nalKeyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, T
oken operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Fun
ctionBody body) : super.full(comment, metadata) { |
7361 this._externalKeyword = externalKeyword; | 8574 this._externalKeyword = externalKeyword; |
7362 this._modifierKeyword = modifierKeyword; | 8575 this._modifierKeyword = modifierKeyword; |
7363 this._returnType = becomeParentOf(returnType); | 8576 this._returnType = becomeParentOf(returnType); |
7364 this._propertyKeyword = propertyKeyword; | 8577 this._propertyKeyword = propertyKeyword; |
7365 this._operatorKeyword = operatorKeyword; | 8578 this._operatorKeyword = operatorKeyword; |
7366 this._name = becomeParentOf(name); | 8579 this._name = becomeParentOf(name); |
7367 this._parameters = becomeParentOf(parameters); | 8580 this._parameters = becomeParentOf(parameters); |
7368 this._body = becomeParentOf(body); | 8581 this._body = becomeParentOf(body); |
7369 } | 8582 } |
| 8583 |
7370 /** | 8584 /** |
7371 * Initialize a newly created method declaration. | 8585 * Initialize a newly created method declaration. |
7372 * @param externalKeyword the token for the 'external' keyword | 8586 * @param externalKeyword the token for the 'external' keyword |
7373 * @param comment the documentation comment associated with this method | 8587 * @param comment the documentation comment associated with this method |
7374 * @param metadata the annotations associated with this method | 8588 * @param metadata the annotations associated with this method |
7375 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 8589 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
7376 * @param returnType the return type of the method | 8590 * @param returnType the return type of the method |
7377 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 8591 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
7378 * @param operatorKeyword the token representing the 'operator' keyword | 8592 * @param operatorKeyword the token representing the 'operator' keyword |
7379 * @param name the name of the method | 8593 * @param name the name of the method |
7380 * @param parameters the parameters associated with the method, or {@code null
} if this method | 8594 * @param parameters the parameters associated with the method, or {@code null
} if this method |
7381 * declares a getter | 8595 * declares a getter |
7382 * @param body the body of the method | 8596 * @param body the body of the method |
7383 */ | 8597 */ |
7384 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); | 8598 MethodDeclaration({Comment comment, List<Annotation> metadata, Token externalK
eyword, Token modifierKeyword, TypeName returnType, Token propertyKeyword, Token
operatorKeyword, SimpleIdentifier name, FormalParameterList parameters, Functio
nBody body}) : this.full(comment, metadata, externalKeyword, modifierKeyword, re
turnType, propertyKeyword, operatorKeyword, name, parameters, body); |
7385 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); | 8599 accept(ASTVisitor visitor) => visitor.visitMethodDeclaration(this); |
| 8600 |
7386 /** | 8601 /** |
7387 * Return the body of the method. | 8602 * Return the body of the method. |
7388 * @return the body of the method | 8603 * @return the body of the method |
7389 */ | 8604 */ |
7390 FunctionBody get body => _body; | 8605 FunctionBody get body => _body; |
| 8606 |
7391 /** | 8607 /** |
7392 * Return the element associated with this method, or {@code null} if the AST
structure has not | 8608 * Return the element associated with this method, or {@code null} if the AST
structure has not |
7393 * been resolved. The element can either be a {@link MethodElement}, if this r
epresents the | 8609 * been resolved. The element can either be a {@link MethodElement}, if this r
epresents the |
7394 * declaration of a normal method, or a {@link PropertyAccessorElement} if thi
s represents the | 8610 * declaration of a normal method, or a {@link PropertyAccessorElement} if thi
s represents the |
7395 * declaration of either a getter or a setter. | 8611 * declaration of either a getter or a setter. |
7396 * @return the element associated with this method | 8612 * @return the element associated with this method |
7397 */ | 8613 */ |
7398 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; | 8614 ExecutableElement get element => _name != null ? (_name.element as ExecutableE
lement) : null; |
7399 Token get endToken => _body.endToken; | 8615 Token get endToken => _body.endToken; |
| 8616 |
7400 /** | 8617 /** |
7401 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not | 8618 * Return the token for the 'external' keyword, or {@code null} if the constru
ctor is not |
7402 * external. | 8619 * external. |
7403 * @return the token for the 'external' keyword | 8620 * @return the token for the 'external' keyword |
7404 */ | 8621 */ |
7405 Token get externalKeyword => _externalKeyword; | 8622 Token get externalKeyword => _externalKeyword; |
| 8623 |
7406 /** | 8624 /** |
7407 * Return the token representing the 'abstract' or 'static' keyword, or {@code
null} if neither | 8625 * Return the token representing the 'abstract' or 'static' keyword, or {@code
null} if neither |
7408 * modifier was specified. | 8626 * modifier was specified. |
7409 * @return the token representing the 'abstract' or 'static' keyword | 8627 * @return the token representing the 'abstract' or 'static' keyword |
7410 */ | 8628 */ |
7411 Token get modifierKeyword => _modifierKeyword; | 8629 Token get modifierKeyword => _modifierKeyword; |
| 8630 |
7412 /** | 8631 /** |
7413 * Return the name of the method. | 8632 * Return the name of the method. |
7414 * @return the name of the method | 8633 * @return the name of the method |
7415 */ | 8634 */ |
7416 SimpleIdentifier get name => _name; | 8635 SimpleIdentifier get name => _name; |
| 8636 |
7417 /** | 8637 /** |
7418 * Return the token representing the 'operator' keyword, or {@code null} if th
is method does not | 8638 * Return the token representing the 'operator' keyword, or {@code null} if th
is method does not |
7419 * declare an operator. | 8639 * declare an operator. |
7420 * @return the token representing the 'operator' keyword | 8640 * @return the token representing the 'operator' keyword |
7421 */ | 8641 */ |
7422 Token get operatorKeyword => _operatorKeyword; | 8642 Token get operatorKeyword => _operatorKeyword; |
| 8643 |
7423 /** | 8644 /** |
7424 * Return the parameters associated with the method, or {@code null} if this m
ethod declares a | 8645 * Return the parameters associated with the method, or {@code null} if this m
ethod declares a |
7425 * getter. | 8646 * getter. |
7426 * @return the parameters associated with the method | 8647 * @return the parameters associated with the method |
7427 */ | 8648 */ |
7428 FormalParameterList get parameters => _parameters; | 8649 FormalParameterList get parameters => _parameters; |
| 8650 |
7429 /** | 8651 /** |
7430 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a method | 8652 * Return the token representing the 'get' or 'set' keyword, or {@code null} i
f this is a method |
7431 * declaration rather than a property declaration. | 8653 * declaration rather than a property declaration. |
7432 * @return the token representing the 'get' or 'set' keyword | 8654 * @return the token representing the 'get' or 'set' keyword |
7433 */ | 8655 */ |
7434 Token get propertyKeyword => _propertyKeyword; | 8656 Token get propertyKeyword => _propertyKeyword; |
| 8657 |
7435 /** | 8658 /** |
7436 * Return the return type of the method, or {@code null} if no return type was
declared. | 8659 * Return the return type of the method, or {@code null} if no return type was
declared. |
7437 * @return the return type of the method | 8660 * @return the return type of the method |
7438 */ | 8661 */ |
7439 TypeName get returnType => _returnType; | 8662 TypeName get returnType => _returnType; |
| 8663 |
7440 /** | 8664 /** |
7441 * Return {@code true} if this method is declared to be an abstract method. | 8665 * Return {@code true} if this method is declared to be an abstract method. |
7442 * @return {@code true} if this method is declared to be an abstract method | 8666 * @return {@code true} if this method is declared to be an abstract method |
7443 */ | 8667 */ |
7444 bool isAbstract() => _externalKeyword == null && (_body is EmptyFunctionBody); | 8668 bool isAbstract() => _externalKeyword == null && (_body is EmptyFunctionBody); |
| 8669 |
7445 /** | 8670 /** |
7446 * Return {@code true} if this method declares a getter. | 8671 * Return {@code true} if this method declares a getter. |
7447 * @return {@code true} if this method declares a getter | 8672 * @return {@code true} if this method declares a getter |
7448 */ | 8673 */ |
7449 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); | 8674 bool isGetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.GET); |
| 8675 |
7450 /** | 8676 /** |
7451 * Return {@code true} if this method declares an operator. | 8677 * Return {@code true} if this method declares an operator. |
7452 * @return {@code true} if this method declares an operator | 8678 * @return {@code true} if this method declares an operator |
7453 */ | 8679 */ |
7454 bool isOperator() => _operatorKeyword != null; | 8680 bool isOperator() => _operatorKeyword != null; |
| 8681 |
7455 /** | 8682 /** |
7456 * Return {@code true} if this method declares a setter. | 8683 * Return {@code true} if this method declares a setter. |
7457 * @return {@code true} if this method declares a setter | 8684 * @return {@code true} if this method declares a setter |
7458 */ | 8685 */ |
7459 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); | 8686 bool isSetter() => _propertyKeyword != null && identical(((_propertyKeyword as
KeywordToken)).keyword, Keyword.SET); |
| 8687 |
7460 /** | 8688 /** |
7461 * Return {@code true} if this method is declared to be a static method. | 8689 * Return {@code true} if this method is declared to be a static method. |
7462 * @return {@code true} if this method is declared to be a static method | 8690 * @return {@code true} if this method is declared to be a static method |
7463 */ | 8691 */ |
7464 bool isStatic() => _modifierKeyword != null && identical(((_modifierKeyword as
KeywordToken)).keyword, Keyword.STATIC); | 8692 bool isStatic() => _modifierKeyword != null && identical(((_modifierKeyword as
KeywordToken)).keyword, Keyword.STATIC); |
| 8693 |
7465 /** | 8694 /** |
7466 * Set the body of the method to the given function body. | 8695 * Set the body of the method to the given function body. |
7467 * @param functionBody the body of the method | 8696 * @param functionBody the body of the method |
7468 */ | 8697 */ |
7469 void set body(FunctionBody functionBody) { | 8698 void set body(FunctionBody functionBody) { |
7470 _body = becomeParentOf(functionBody); | 8699 _body = becomeParentOf(functionBody); |
7471 } | 8700 } |
| 8701 |
7472 /** | 8702 /** |
7473 * Set the token for the 'external' keyword to the given token. | 8703 * Set the token for the 'external' keyword to the given token. |
7474 * @param externalKeyword the token for the 'external' keyword | 8704 * @param externalKeyword the token for the 'external' keyword |
7475 */ | 8705 */ |
7476 void set externalKeyword(Token externalKeyword2) { | 8706 void set externalKeyword(Token externalKeyword2) { |
7477 this._externalKeyword = externalKeyword2; | 8707 this._externalKeyword = externalKeyword2; |
7478 } | 8708 } |
| 8709 |
7479 /** | 8710 /** |
7480 * Set the token representing the 'abstract' or 'static' keyword to the given
token. | 8711 * Set the token representing the 'abstract' or 'static' keyword to the given
token. |
7481 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword | 8712 * @param modifierKeyword the token representing the 'abstract' or 'static' ke
yword |
7482 */ | 8713 */ |
7483 void set modifierKeyword(Token modifierKeyword2) { | 8714 void set modifierKeyword(Token modifierKeyword2) { |
7484 this._modifierKeyword = modifierKeyword2; | 8715 this._modifierKeyword = modifierKeyword2; |
7485 } | 8716 } |
| 8717 |
7486 /** | 8718 /** |
7487 * Set the name of the method to the given identifier. | 8719 * Set the name of the method to the given identifier. |
7488 * @param identifier the name of the method | 8720 * @param identifier the name of the method |
7489 */ | 8721 */ |
7490 void set name(SimpleIdentifier identifier) { | 8722 void set name(SimpleIdentifier identifier) { |
7491 _name = becomeParentOf(identifier); | 8723 _name = becomeParentOf(identifier); |
7492 } | 8724 } |
| 8725 |
7493 /** | 8726 /** |
7494 * Set the token representing the 'operator' keyword to the given token. | 8727 * Set the token representing the 'operator' keyword to the given token. |
7495 * @param operatorKeyword the token representing the 'operator' keyword | 8728 * @param operatorKeyword the token representing the 'operator' keyword |
7496 */ | 8729 */ |
7497 void set operatorKeyword(Token operatorKeyword2) { | 8730 void set operatorKeyword(Token operatorKeyword2) { |
7498 this._operatorKeyword = operatorKeyword2; | 8731 this._operatorKeyword = operatorKeyword2; |
7499 } | 8732 } |
| 8733 |
7500 /** | 8734 /** |
7501 * Set the parameters associated with the method to the given list of paramete
rs. | 8735 * Set the parameters associated with the method to the given list of paramete
rs. |
7502 * @param parameters the parameters associated with the method | 8736 * @param parameters the parameters associated with the method |
7503 */ | 8737 */ |
7504 void set parameters(FormalParameterList parameters2) { | 8738 void set parameters(FormalParameterList parameters2) { |
7505 this._parameters = becomeParentOf(parameters2); | 8739 this._parameters = becomeParentOf(parameters2); |
7506 } | 8740 } |
| 8741 |
7507 /** | 8742 /** |
7508 * Set the token representing the 'get' or 'set' keyword to the given token. | 8743 * Set the token representing the 'get' or 'set' keyword to the given token. |
7509 * @param propertyKeyword the token representing the 'get' or 'set' keyword | 8744 * @param propertyKeyword the token representing the 'get' or 'set' keyword |
7510 */ | 8745 */ |
7511 void set propertyKeyword(Token propertyKeyword2) { | 8746 void set propertyKeyword(Token propertyKeyword2) { |
7512 this._propertyKeyword = propertyKeyword2; | 8747 this._propertyKeyword = propertyKeyword2; |
7513 } | 8748 } |
| 8749 |
7514 /** | 8750 /** |
7515 * Set the return type of the method to the given type name. | 8751 * Set the return type of the method to the given type name. |
7516 * @param typeName the return type of the method | 8752 * @param typeName the return type of the method |
7517 */ | 8753 */ |
7518 void set returnType(TypeName typeName) { | 8754 void set returnType(TypeName typeName) { |
7519 _returnType = becomeParentOf(typeName); | 8755 _returnType = becomeParentOf(typeName); |
7520 } | 8756 } |
7521 void visitChildren(ASTVisitor<Object> visitor) { | 8757 void visitChildren(ASTVisitor<Object> visitor) { |
7522 super.visitChildren(visitor); | 8758 super.visitChildren(visitor); |
7523 safelyVisitChild(_returnType, visitor); | 8759 safelyVisitChild(_returnType, visitor); |
7524 safelyVisitChild(_name, visitor); | 8760 safelyVisitChild(_name, visitor); |
7525 safelyVisitChild(_parameters, visitor); | 8761 safelyVisitChild(_parameters, visitor); |
7526 safelyVisitChild(_body, visitor); | 8762 safelyVisitChild(_body, visitor); |
7527 } | 8763 } |
7528 Token get firstTokenAfterCommentAndMetadata { | 8764 Token get firstTokenAfterCommentAndMetadata { |
7529 if (_modifierKeyword != null) { | 8765 if (_modifierKeyword != null) { |
7530 return _modifierKeyword; | 8766 return _modifierKeyword; |
7531 } else if (_returnType != null) { | 8767 } else if (_returnType != null) { |
7532 return _returnType.beginToken; | 8768 return _returnType.beginToken; |
7533 } else if (_propertyKeyword != null) { | 8769 } else if (_propertyKeyword != null) { |
7534 return _propertyKeyword; | 8770 return _propertyKeyword; |
7535 } else if (_operatorKeyword != null) { | 8771 } else if (_operatorKeyword != null) { |
7536 return _operatorKeyword; | 8772 return _operatorKeyword; |
7537 } | 8773 } |
7538 return _name.beginToken; | 8774 return _name.beginToken; |
7539 } | 8775 } |
7540 } | 8776 } |
| 8777 |
7541 /** | 8778 /** |
7542 * Instances of the class {@code MethodInvocation} represent the invocation of e
ither a function or | 8779 * Instances of the class {@code MethodInvocation} represent the invocation of e
ither a function or |
7543 * a method. Invocations of functions resulting from evaluating an expression ar
e represented by{@link FunctionExpressionInvocation function expression invocati
on} nodes. Invocations of getters | 8780 * a method. Invocations of functions resulting from evaluating an expression ar
e represented by{@link FunctionExpressionInvocation function expression invocati
on} nodes. Invocations of getters |
7544 * and setters are represented by either {@link PrefixedIdentifier prefixed iden
tifier} or{@link PropertyAccess property access} nodes. | 8781 * and setters are represented by either {@link PrefixedIdentifier prefixed iden
tifier} or{@link PropertyAccess property access} nodes. |
7545 * <pre> | 8782 * <pre> |
7546 * methodInvoction ::= | 8783 * methodInvoction ::= |
7547 * ({@link Expression target} '.')? {@link SimpleIdentifier methodName} {@link A
rgumentList argumentList}</pre> | 8784 * ({@link Expression target} '.')? {@link SimpleIdentifier methodName} {@link A
rgumentList argumentList}</pre> |
7548 * @coverage dart.engine.ast | 8785 * @coverage dart.engine.ast |
7549 */ | 8786 */ |
7550 class MethodInvocation extends Expression { | 8787 class MethodInvocation extends Expression { |
| 8788 |
7551 /** | 8789 /** |
7552 * The expression producing the object on which the method is defined, or {@co
de null} if there is | 8790 * The expression producing the object on which the method is defined, or {@co
de null} if there is |
7553 * no target (that is, the target is implicitly {@code this}). | 8791 * no target (that is, the target is implicitly {@code this}). |
7554 */ | 8792 */ |
7555 Expression _target; | 8793 Expression _target; |
| 8794 |
7556 /** | 8795 /** |
7557 * The period that separates the target from the method name, or {@code null}
if there is no | 8796 * The period that separates the target from the method name, or {@code null}
if there is no |
7558 * target. | 8797 * target. |
7559 */ | 8798 */ |
7560 Token _period; | 8799 Token _period; |
| 8800 |
7561 /** | 8801 /** |
7562 * The name of the method being invoked. | 8802 * The name of the method being invoked. |
7563 */ | 8803 */ |
7564 SimpleIdentifier _methodName; | 8804 SimpleIdentifier _methodName; |
| 8805 |
7565 /** | 8806 /** |
7566 * The list of arguments to the method. | 8807 * The list of arguments to the method. |
7567 */ | 8808 */ |
7568 ArgumentList _argumentList; | 8809 ArgumentList _argumentList; |
| 8810 |
7569 /** | 8811 /** |
7570 * Initialize a newly created method invocation. | 8812 * Initialize a newly created method invocation. |
7571 * @param target the expression producing the object on which the method is de
fined | 8813 * @param target the expression producing the object on which the method is de
fined |
7572 * @param period the period that separates the target from the method name | 8814 * @param period the period that separates the target from the method name |
7573 * @param methodName the name of the method being invoked | 8815 * @param methodName the name of the method being invoked |
7574 * @param argumentList the list of arguments to the method | 8816 * @param argumentList the list of arguments to the method |
7575 */ | 8817 */ |
7576 MethodInvocation.full(Expression target, Token period, SimpleIdentifier method
Name, ArgumentList argumentList) { | 8818 MethodInvocation.full(Expression target, Token period, SimpleIdentifier method
Name, ArgumentList argumentList) { |
7577 this._target = becomeParentOf(target); | 8819 this._target = becomeParentOf(target); |
7578 this._period = period; | 8820 this._period = period; |
7579 this._methodName = becomeParentOf(methodName); | 8821 this._methodName = becomeParentOf(methodName); |
7580 this._argumentList = becomeParentOf(argumentList); | 8822 this._argumentList = becomeParentOf(argumentList); |
7581 } | 8823 } |
| 8824 |
7582 /** | 8825 /** |
7583 * Initialize a newly created method invocation. | 8826 * Initialize a newly created method invocation. |
7584 * @param target the expression producing the object on which the method is de
fined | 8827 * @param target the expression producing the object on which the method is de
fined |
7585 * @param period the period that separates the target from the method name | 8828 * @param period the period that separates the target from the method name |
7586 * @param methodName the name of the method being invoked | 8829 * @param methodName the name of the method being invoked |
7587 * @param argumentList the list of arguments to the method | 8830 * @param argumentList the list of arguments to the method |
7588 */ | 8831 */ |
7589 MethodInvocation({Expression target, Token period, SimpleIdentifier methodName
, ArgumentList argumentList}) : this.full(target, period, methodName, argumentLi
st); | 8832 MethodInvocation({Expression target, Token period, SimpleIdentifier methodName
, ArgumentList argumentList}) : this.full(target, period, methodName, argumentLi
st); |
7590 accept(ASTVisitor visitor) => visitor.visitMethodInvocation(this); | 8833 accept(ASTVisitor visitor) => visitor.visitMethodInvocation(this); |
| 8834 |
7591 /** | 8835 /** |
7592 * Return the list of arguments to the method. | 8836 * Return the list of arguments to the method. |
7593 * @return the list of arguments to the method | 8837 * @return the list of arguments to the method |
7594 */ | 8838 */ |
7595 ArgumentList get argumentList => _argumentList; | 8839 ArgumentList get argumentList => _argumentList; |
7596 Token get beginToken { | 8840 Token get beginToken { |
7597 if (_target != null) { | 8841 if (_target != null) { |
7598 return _target.beginToken; | 8842 return _target.beginToken; |
7599 } else if (_period != null) { | 8843 } else if (_period != null) { |
7600 return _period; | 8844 return _period; |
7601 } | 8845 } |
7602 return _methodName.beginToken; | 8846 return _methodName.beginToken; |
7603 } | 8847 } |
7604 Token get endToken => _argumentList.endToken; | 8848 Token get endToken => _argumentList.endToken; |
| 8849 |
7605 /** | 8850 /** |
7606 * Return the name of the method being invoked. | 8851 * Return the name of the method being invoked. |
7607 * @return the name of the method being invoked | 8852 * @return the name of the method being invoked |
7608 */ | 8853 */ |
7609 SimpleIdentifier get methodName => _methodName; | 8854 SimpleIdentifier get methodName => _methodName; |
| 8855 |
7610 /** | 8856 /** |
7611 * Return the period that separates the target from the method name, or {@code
null} if there is | 8857 * Return the period that separates the target from the method name, or {@code
null} if there is |
7612 * no target. | 8858 * no target. |
7613 * @return the period that separates the target from the method name | 8859 * @return the period that separates the target from the method name |
7614 */ | 8860 */ |
7615 Token get period => _period; | 8861 Token get period => _period; |
| 8862 |
7616 /** | 8863 /** |
7617 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not | 8864 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not |
7618 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation | 8865 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation |
7619 * is part of a cascade expression, then the target stored with the cascade ex
pression is | 8866 * is part of a cascade expression, then the target stored with the cascade ex
pression is |
7620 * returned. | 8867 * returned. |
7621 * @return the expression used to compute the receiver of the invocation | 8868 * @return the expression used to compute the receiver of the invocation |
7622 * @see #getTarget() | 8869 * @see #getTarget() |
7623 */ | 8870 */ |
7624 Expression get realTarget { | 8871 Expression get realTarget { |
7625 if (isCascaded()) { | 8872 if (isCascaded()) { |
7626 ASTNode ancestor = parent; | 8873 ASTNode ancestor = parent; |
7627 while (ancestor is! CascadeExpression) { | 8874 while (ancestor is! CascadeExpression) { |
7628 if (ancestor == null) { | 8875 if (ancestor == null) { |
7629 return _target; | 8876 return _target; |
7630 } | 8877 } |
7631 ancestor = ancestor.parent; | 8878 ancestor = ancestor.parent; |
7632 } | 8879 } |
7633 return ((ancestor as CascadeExpression)).target; | 8880 return ((ancestor as CascadeExpression)).target; |
7634 } | 8881 } |
7635 return _target; | 8882 return _target; |
7636 } | 8883 } |
| 8884 |
7637 /** | 8885 /** |
7638 * Return the expression producing the object on which the method is defined,
or {@code null} if | 8886 * Return the expression producing the object on which the method is defined,
or {@code null} if |
7639 * there is no target (that is, the target is implicitly {@code this}) or if t
his method | 8887 * there is no target (that is, the target is implicitly {@code this}) or if t
his method |
7640 * invocation is part of a cascade expression. | 8888 * invocation is part of a cascade expression. |
7641 * @return the expression producing the object on which the method is defined | 8889 * @return the expression producing the object on which the method is defined |
7642 * @see #getRealTarget() | 8890 * @see #getRealTarget() |
7643 */ | 8891 */ |
7644 Expression get target => _target; | 8892 Expression get target => _target; |
| 8893 |
7645 /** | 8894 /** |
7646 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this | 8895 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this |
7647 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. | 8896 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. |
7648 * @return {@code true} if this expression is cascaded | 8897 * @return {@code true} if this expression is cascaded |
7649 */ | 8898 */ |
7650 bool isCascaded() => _period != null && identical(_period.type, TokenType.PERI
OD_PERIOD); | 8899 bool isCascaded() => _period != null && identical(_period.type, TokenType.PERI
OD_PERIOD); |
| 8900 |
7651 /** | 8901 /** |
7652 * Set the list of arguments to the method to the given list. | 8902 * Set the list of arguments to the method to the given list. |
7653 * @param argumentList the list of arguments to the method | 8903 * @param argumentList the list of arguments to the method |
7654 */ | 8904 */ |
7655 void set argumentList(ArgumentList argumentList2) { | 8905 void set argumentList(ArgumentList argumentList2) { |
7656 this._argumentList = becomeParentOf(argumentList2); | 8906 this._argumentList = becomeParentOf(argumentList2); |
7657 } | 8907 } |
| 8908 |
7658 /** | 8909 /** |
7659 * Set the name of the method being invoked to the given identifier. | 8910 * Set the name of the method being invoked to the given identifier. |
7660 * @param identifier the name of the method being invoked | 8911 * @param identifier the name of the method being invoked |
7661 */ | 8912 */ |
7662 void set methodName(SimpleIdentifier identifier) { | 8913 void set methodName(SimpleIdentifier identifier) { |
7663 _methodName = becomeParentOf(identifier); | 8914 _methodName = becomeParentOf(identifier); |
7664 } | 8915 } |
| 8916 |
7665 /** | 8917 /** |
7666 * Set the period that separates the target from the method name to the given
token. | 8918 * Set the period that separates the target from the method name to the given
token. |
7667 * @param period the period that separates the target from the method name | 8919 * @param period the period that separates the target from the method name |
7668 */ | 8920 */ |
7669 void set period(Token period2) { | 8921 void set period(Token period2) { |
7670 this._period = period2; | 8922 this._period = period2; |
7671 } | 8923 } |
| 8924 |
7672 /** | 8925 /** |
7673 * Set the expression producing the object on which the method is defined to t
he given expression. | 8926 * Set the expression producing the object on which the method is defined to t
he given expression. |
7674 * @param expression the expression producing the object on which the method i
s defined | 8927 * @param expression the expression producing the object on which the method i
s defined |
7675 */ | 8928 */ |
7676 void set target(Expression expression) { | 8929 void set target(Expression expression) { |
7677 _target = becomeParentOf(expression); | 8930 _target = becomeParentOf(expression); |
7678 } | 8931 } |
7679 void visitChildren(ASTVisitor<Object> visitor) { | 8932 void visitChildren(ASTVisitor<Object> visitor) { |
7680 safelyVisitChild(_target, visitor); | 8933 safelyVisitChild(_target, visitor); |
7681 safelyVisitChild(_methodName, visitor); | 8934 safelyVisitChild(_methodName, visitor); |
7682 safelyVisitChild(_argumentList, visitor); | 8935 safelyVisitChild(_argumentList, visitor); |
7683 } | 8936 } |
7684 } | 8937 } |
| 8938 |
7685 /** | 8939 /** |
7686 * Instances of the class {@code NamedExpression} represent an expression that h
as a name associated | 8940 * Instances of the class {@code NamedExpression} represent an expression that h
as a name associated |
7687 * with it. They are used in method invocations when there are named parameters. | 8941 * with it. They are used in method invocations when there are named parameters. |
7688 * <pre> | 8942 * <pre> |
7689 * namedExpression ::={@link Label name} {@link Expression expression}</pre> | 8943 * namedExpression ::={@link Label name} {@link Expression expression}</pre> |
7690 * @coverage dart.engine.ast | 8944 * @coverage dart.engine.ast |
7691 */ | 8945 */ |
7692 class NamedExpression extends Expression { | 8946 class NamedExpression extends Expression { |
| 8947 |
7693 /** | 8948 /** |
7694 * The name associated with the expression. | 8949 * The name associated with the expression. |
7695 */ | 8950 */ |
7696 Label _name; | 8951 Label _name; |
| 8952 |
7697 /** | 8953 /** |
7698 * The expression with which the name is associated. | 8954 * The expression with which the name is associated. |
7699 */ | 8955 */ |
7700 Expression _expression; | 8956 Expression _expression; |
| 8957 |
7701 /** | 8958 /** |
7702 * Initialize a newly created named expression. | 8959 * Initialize a newly created named expression. |
7703 * @param name the name associated with the expression | 8960 * @param name the name associated with the expression |
7704 * @param expression the expression with which the name is associated | 8961 * @param expression the expression with which the name is associated |
7705 */ | 8962 */ |
7706 NamedExpression.full(Label name, Expression expression) { | 8963 NamedExpression.full(Label name, Expression expression) { |
7707 this._name = becomeParentOf(name); | 8964 this._name = becomeParentOf(name); |
7708 this._expression = becomeParentOf(expression); | 8965 this._expression = becomeParentOf(expression); |
7709 } | 8966 } |
| 8967 |
7710 /** | 8968 /** |
7711 * Initialize a newly created named expression. | 8969 * Initialize a newly created named expression. |
7712 * @param name the name associated with the expression | 8970 * @param name the name associated with the expression |
7713 * @param expression the expression with which the name is associated | 8971 * @param expression the expression with which the name is associated |
7714 */ | 8972 */ |
7715 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); | 8973 NamedExpression({Label name, Expression expression}) : this.full(name, express
ion); |
7716 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); | 8974 accept(ASTVisitor visitor) => visitor.visitNamedExpression(this); |
7717 Token get beginToken => _name.beginToken; | 8975 Token get beginToken => _name.beginToken; |
| 8976 |
7718 /** | 8977 /** |
7719 * Return the element representing the parameter being named by this expressio
n, or {@code null}if the AST structure has not been resolved or if there is no p
arameter with the same name as | 8978 * Return the element representing the parameter being named by this expressio
n, or {@code null}if the AST structure has not been resolved or if there is no p
arameter with the same name as |
7720 * this expression. | 8979 * this expression. |
7721 * @return the element representing the parameter being named by this expressi
on | 8980 * @return the element representing the parameter being named by this expressi
on |
7722 */ | 8981 */ |
7723 ParameterElement get element { | 8982 ParameterElement get element { |
7724 Element element2 = _name.label.element; | 8983 Element element2 = _name.label.element; |
7725 if (element2 is ParameterElement) { | 8984 if (element2 is ParameterElement) { |
7726 return element2 as ParameterElement; | 8985 return element2 as ParameterElement; |
7727 } | 8986 } |
7728 return null; | 8987 return null; |
7729 } | 8988 } |
7730 Token get endToken => _expression.endToken; | 8989 Token get endToken => _expression.endToken; |
| 8990 |
7731 /** | 8991 /** |
7732 * Return the expression with which the name is associated. | 8992 * Return the expression with which the name is associated. |
7733 * @return the expression with which the name is associated | 8993 * @return the expression with which the name is associated |
7734 */ | 8994 */ |
7735 Expression get expression => _expression; | 8995 Expression get expression => _expression; |
| 8996 |
7736 /** | 8997 /** |
7737 * Return the name associated with the expression. | 8998 * Return the name associated with the expression. |
7738 * @return the name associated with the expression | 8999 * @return the name associated with the expression |
7739 */ | 9000 */ |
7740 Label get name => _name; | 9001 Label get name => _name; |
| 9002 |
7741 /** | 9003 /** |
7742 * Set the expression with which the name is associated to the given expressio
n. | 9004 * Set the expression with which the name is associated to the given expressio
n. |
7743 * @param expression the expression with which the name is associated | 9005 * @param expression the expression with which the name is associated |
7744 */ | 9006 */ |
7745 void set expression(Expression expression2) { | 9007 void set expression(Expression expression2) { |
7746 this._expression = becomeParentOf(expression2); | 9008 this._expression = becomeParentOf(expression2); |
7747 } | 9009 } |
| 9010 |
7748 /** | 9011 /** |
7749 * Set the name associated with the expression to the given identifier. | 9012 * Set the name associated with the expression to the given identifier. |
7750 * @param identifier the name associated with the expression | 9013 * @param identifier the name associated with the expression |
7751 */ | 9014 */ |
7752 void set name(Label identifier) { | 9015 void set name(Label identifier) { |
7753 _name = becomeParentOf(identifier); | 9016 _name = becomeParentOf(identifier); |
7754 } | 9017 } |
7755 void visitChildren(ASTVisitor<Object> visitor) { | 9018 void visitChildren(ASTVisitor<Object> visitor) { |
7756 safelyVisitChild(_name, visitor); | 9019 safelyVisitChild(_name, visitor); |
7757 safelyVisitChild(_expression, visitor); | 9020 safelyVisitChild(_expression, visitor); |
7758 } | 9021 } |
7759 } | 9022 } |
| 9023 |
7760 /** | 9024 /** |
7761 * The abstract class {@code NamespaceDirective} defines the behavior common to
nodes that represent | 9025 * The abstract class {@code NamespaceDirective} defines the behavior common to
nodes that represent |
7762 * a directive that impacts the namespace of a library. | 9026 * a directive that impacts the namespace of a library. |
7763 * <pre> | 9027 * <pre> |
7764 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}</pre> | 9028 * directive ::={@link ExportDirective exportDirective}| {@link ImportDirective
importDirective}</pre> |
7765 * @coverage dart.engine.ast | 9029 * @coverage dart.engine.ast |
7766 */ | 9030 */ |
7767 abstract class NamespaceDirective extends UriBasedDirective { | 9031 abstract class NamespaceDirective extends UriBasedDirective { |
| 9032 |
7768 /** | 9033 /** |
7769 * The token representing the 'import' or 'export' keyword. | 9034 * The token representing the 'import' or 'export' keyword. |
7770 */ | 9035 */ |
7771 Token _keyword; | 9036 Token _keyword; |
| 9037 |
7772 /** | 9038 /** |
7773 * The combinators used to control which names are imported or exported. | 9039 * The combinators used to control which names are imported or exported. |
7774 */ | 9040 */ |
7775 NodeList<Combinator> _combinators; | 9041 NodeList<Combinator> _combinators; |
| 9042 |
7776 /** | 9043 /** |
7777 * The semicolon terminating the directive. | 9044 * The semicolon terminating the directive. |
7778 */ | 9045 */ |
7779 Token _semicolon; | 9046 Token _semicolon; |
| 9047 |
7780 /** | 9048 /** |
7781 * Initialize a newly created namespace directive. | 9049 * Initialize a newly created namespace directive. |
7782 * @param comment the documentation comment associated with this directive | 9050 * @param comment the documentation comment associated with this directive |
7783 * @param metadata the annotations associated with the directive | 9051 * @param metadata the annotations associated with the directive |
7784 * @param keyword the token representing the 'import' or 'export' keyword | 9052 * @param keyword the token representing the 'import' or 'export' keyword |
7785 * @param libraryUri the URI of the library being imported or exported | 9053 * @param libraryUri the URI of the library being imported or exported |
7786 * @param combinators the combinators used to control which names are imported
or exported | 9054 * @param combinators the combinators used to control which names are imported
or exported |
7787 * @param semicolon the semicolon terminating the directive | 9055 * @param semicolon the semicolon terminating the directive |
7788 */ | 9056 */ |
7789 NamespaceDirective.full(Comment comment, List<Annotation> metadata, Token keyw
ord, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) :
super.full(comment, metadata, libraryUri) { | 9057 NamespaceDirective.full(Comment comment, List<Annotation> metadata, Token keyw
ord, StringLiteral libraryUri, List<Combinator> combinators, Token semicolon) :
super.full(comment, metadata, libraryUri) { |
7790 this._combinators = new NodeList<Combinator>(this); | 9058 this._combinators = new NodeList<Combinator>(this); |
7791 this._keyword = keyword; | 9059 this._keyword = keyword; |
7792 this._combinators.addAll(combinators); | 9060 this._combinators.addAll(combinators); |
7793 this._semicolon = semicolon; | 9061 this._semicolon = semicolon; |
7794 } | 9062 } |
| 9063 |
7795 /** | 9064 /** |
7796 * Initialize a newly created namespace directive. | 9065 * Initialize a newly created namespace directive. |
7797 * @param comment the documentation comment associated with this directive | 9066 * @param comment the documentation comment associated with this directive |
7798 * @param metadata the annotations associated with the directive | 9067 * @param metadata the annotations associated with the directive |
7799 * @param keyword the token representing the 'import' or 'export' keyword | 9068 * @param keyword the token representing the 'import' or 'export' keyword |
7800 * @param libraryUri the URI of the library being imported or exported | 9069 * @param libraryUri the URI of the library being imported or exported |
7801 * @param combinators the combinators used to control which names are imported
or exported | 9070 * @param combinators the combinators used to control which names are imported
or exported |
7802 * @param semicolon the semicolon terminating the directive | 9071 * @param semicolon the semicolon terminating the directive |
7803 */ | 9072 */ |
7804 NamespaceDirective({Comment comment, List<Annotation> metadata, Token keyword,
StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : thi
s.full(comment, metadata, keyword, libraryUri, combinators, semicolon); | 9073 NamespaceDirective({Comment comment, List<Annotation> metadata, Token keyword,
StringLiteral libraryUri, List<Combinator> combinators, Token semicolon}) : thi
s.full(comment, metadata, keyword, libraryUri, combinators, semicolon); |
| 9074 |
7805 /** | 9075 /** |
7806 * Return the combinators used to control how names are imported or exported. | 9076 * Return the combinators used to control how names are imported or exported. |
7807 * @return the combinators used to control how names are imported or exported | 9077 * @return the combinators used to control how names are imported or exported |
7808 */ | 9078 */ |
7809 NodeList<Combinator> get combinators => _combinators; | 9079 NodeList<Combinator> get combinators => _combinators; |
7810 Token get endToken => _semicolon; | 9080 Token get endToken => _semicolon; |
7811 Token get keyword => _keyword; | 9081 Token get keyword => _keyword; |
| 9082 |
7812 /** | 9083 /** |
7813 * Return the semicolon terminating the directive. | 9084 * Return the semicolon terminating the directive. |
7814 * @return the semicolon terminating the directive | 9085 * @return the semicolon terminating the directive |
7815 */ | 9086 */ |
7816 Token get semicolon => _semicolon; | 9087 Token get semicolon => _semicolon; |
| 9088 LibraryElement get uriElement; |
| 9089 |
7817 /** | 9090 /** |
7818 * Set the token representing the 'import' or 'export' keyword to the given to
ken. | 9091 * Set the token representing the 'import' or 'export' keyword to the given to
ken. |
7819 * @param exportToken the token representing the 'import' or 'export' keyword | 9092 * @param exportToken the token representing the 'import' or 'export' keyword |
7820 */ | 9093 */ |
7821 void set keyword(Token exportToken) { | 9094 void set keyword(Token exportToken) { |
7822 this._keyword = exportToken; | 9095 this._keyword = exportToken; |
7823 } | 9096 } |
| 9097 |
7824 /** | 9098 /** |
7825 * Set the semicolon terminating the directive to the given token. | 9099 * Set the semicolon terminating the directive to the given token. |
7826 * @param semicolon the semicolon terminating the directive | 9100 * @param semicolon the semicolon terminating the directive |
7827 */ | 9101 */ |
7828 void set semicolon(Token semicolon2) { | 9102 void set semicolon(Token semicolon2) { |
7829 this._semicolon = semicolon2; | 9103 this._semicolon = semicolon2; |
7830 } | 9104 } |
7831 Token get firstTokenAfterCommentAndMetadata => _keyword; | 9105 Token get firstTokenAfterCommentAndMetadata => _keyword; |
7832 } | 9106 } |
| 9107 |
7833 /** | 9108 /** |
7834 * Instances of the class {@code NativeFunctionBody} represent a function body t
hat consists of a | 9109 * Instances of the class {@code NativeFunctionBody} represent a function body t
hat consists of a |
7835 * native keyword followed by a string literal. | 9110 * native keyword followed by a string literal. |
7836 * <pre> | 9111 * <pre> |
7837 * nativeFunctionBody ::= | 9112 * nativeFunctionBody ::= |
7838 * 'native' {@link SimpleStringLiteral simpleStringLiteral} ';' | 9113 * 'native' {@link SimpleStringLiteral simpleStringLiteral} ';' |
7839 * </pre> | 9114 * </pre> |
7840 * @coverage dart.engine.ast | 9115 * @coverage dart.engine.ast |
7841 */ | 9116 */ |
7842 class NativeFunctionBody extends FunctionBody { | 9117 class NativeFunctionBody extends FunctionBody { |
| 9118 |
7843 /** | 9119 /** |
7844 * The token representing 'native' that marks the start of the function body. | 9120 * The token representing 'native' that marks the start of the function body. |
7845 */ | 9121 */ |
7846 Token _nativeToken; | 9122 Token _nativeToken; |
| 9123 |
7847 /** | 9124 /** |
7848 * The string literal, after the 'native' token. | 9125 * The string literal, after the 'native' token. |
7849 */ | 9126 */ |
7850 StringLiteral _stringLiteral; | 9127 StringLiteral _stringLiteral; |
| 9128 |
7851 /** | 9129 /** |
7852 * The token representing the semicolon that marks the end of the function bod
y. | 9130 * The token representing the semicolon that marks the end of the function bod
y. |
7853 */ | 9131 */ |
7854 Token _semicolon; | 9132 Token _semicolon; |
| 9133 |
7855 /** | 9134 /** |
7856 * Initialize a newly created function body consisting of the 'native' token,
a string literal, | 9135 * Initialize a newly created function body consisting of the 'native' token,
a string literal, |
7857 * and a semicolon. | 9136 * and a semicolon. |
7858 * @param nativeToken the token representing 'native' that marks the start of
the function body | 9137 * @param nativeToken the token representing 'native' that marks the start of
the function body |
7859 * @param stringLiteral the string literal | 9138 * @param stringLiteral the string literal |
7860 * @param semicolon the token representing the semicolon that marks the end of
the function body | 9139 * @param semicolon the token representing the semicolon that marks the end of
the function body |
7861 */ | 9140 */ |
7862 NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token
semicolon) { | 9141 NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token
semicolon) { |
7863 this._nativeToken = nativeToken; | 9142 this._nativeToken = nativeToken; |
7864 this._stringLiteral = becomeParentOf(stringLiteral); | 9143 this._stringLiteral = becomeParentOf(stringLiteral); |
7865 this._semicolon = semicolon; | 9144 this._semicolon = semicolon; |
7866 } | 9145 } |
| 9146 |
7867 /** | 9147 /** |
7868 * Initialize a newly created function body consisting of the 'native' token,
a string literal, | 9148 * Initialize a newly created function body consisting of the 'native' token,
a string literal, |
7869 * and a semicolon. | 9149 * and a semicolon. |
7870 * @param nativeToken the token representing 'native' that marks the start of
the function body | 9150 * @param nativeToken the token representing 'native' that marks the start of
the function body |
7871 * @param stringLiteral the string literal | 9151 * @param stringLiteral the string literal |
7872 * @param semicolon the token representing the semicolon that marks the end of
the function body | 9152 * @param semicolon the token representing the semicolon that marks the end of
the function body |
7873 */ | 9153 */ |
7874 NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semi
colon}) : this.full(nativeToken, stringLiteral, semicolon); | 9154 NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semi
colon}) : this.full(nativeToken, stringLiteral, semicolon); |
7875 accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this); | 9155 accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this); |
7876 Token get beginToken => _nativeToken; | 9156 Token get beginToken => _nativeToken; |
7877 Token get endToken => _semicolon; | 9157 Token get endToken => _semicolon; |
| 9158 |
7878 /** | 9159 /** |
7879 * Return the simple identifier representing the 'native' token. | 9160 * Return the simple identifier representing the 'native' token. |
7880 * @return the simple identifier representing the 'native' token | 9161 * @return the simple identifier representing the 'native' token |
7881 */ | 9162 */ |
7882 Token get nativeToken => _nativeToken; | 9163 Token get nativeToken => _nativeToken; |
| 9164 |
7883 /** | 9165 /** |
7884 * Return the token representing the semicolon that marks the end of the funct
ion body. | 9166 * Return the token representing the semicolon that marks the end of the funct
ion body. |
7885 * @return the token representing the semicolon that marks the end of the func
tion body | 9167 * @return the token representing the semicolon that marks the end of the func
tion body |
7886 */ | 9168 */ |
7887 Token get semicolon => _semicolon; | 9169 Token get semicolon => _semicolon; |
| 9170 |
7888 /** | 9171 /** |
7889 * Return the string literal representing the string after the 'native' token. | 9172 * Return the string literal representing the string after the 'native' token. |
7890 * @return the string literal representing the string after the 'native' token | 9173 * @return the string literal representing the string after the 'native' token |
7891 */ | 9174 */ |
7892 StringLiteral get stringLiteral => _stringLiteral; | 9175 StringLiteral get stringLiteral => _stringLiteral; |
7893 void visitChildren(ASTVisitor<Object> visitor) { | 9176 void visitChildren(ASTVisitor<Object> visitor) { |
7894 safelyVisitChild(_stringLiteral, visitor); | 9177 safelyVisitChild(_stringLiteral, visitor); |
7895 } | 9178 } |
7896 } | 9179 } |
| 9180 |
7897 /** | 9181 /** |
7898 * The abstract class {@code NormalFormalParameter} defines the behavior common
to formal parameters | 9182 * The abstract class {@code NormalFormalParameter} defines the behavior common
to formal parameters |
7899 * that are required (are not optional). | 9183 * that are required (are not optional). |
7900 * <pre> | 9184 * <pre> |
7901 * normalFormalParameter ::={@link FunctionTypedFormalParameter functionSignatur
e}| {@link FieldFormalParameter fieldFormalParameter}| {@link SimpleFormalParame
ter simpleFormalParameter}</pre> | 9185 * normalFormalParameter ::={@link FunctionTypedFormalParameter functionSignatur
e}| {@link FieldFormalParameter fieldFormalParameter}| {@link SimpleFormalParame
ter simpleFormalParameter}</pre> |
7902 * @coverage dart.engine.ast | 9186 * @coverage dart.engine.ast |
7903 */ | 9187 */ |
7904 abstract class NormalFormalParameter extends FormalParameter { | 9188 abstract class NormalFormalParameter extends FormalParameter { |
| 9189 |
7905 /** | 9190 /** |
7906 * The documentation comment associated with this parameter, or {@code null} i
f this parameter | 9191 * The documentation comment associated with this parameter, or {@code null} i
f this parameter |
7907 * does not have a documentation comment associated with it. | 9192 * does not have a documentation comment associated with it. |
7908 */ | 9193 */ |
7909 Comment _comment; | 9194 Comment _comment; |
| 9195 |
7910 /** | 9196 /** |
7911 * The annotations associated with this parameter. | 9197 * The annotations associated with this parameter. |
7912 */ | 9198 */ |
7913 NodeList<Annotation> _metadata; | 9199 NodeList<Annotation> _metadata; |
| 9200 |
7914 /** | 9201 /** |
7915 * The name of the parameter being declared. | 9202 * The name of the parameter being declared. |
7916 */ | 9203 */ |
7917 SimpleIdentifier _identifier; | 9204 SimpleIdentifier _identifier; |
| 9205 |
7918 /** | 9206 /** |
7919 * Initialize a newly created formal parameter. | 9207 * Initialize a newly created formal parameter. |
7920 * @param comment the documentation comment associated with this parameter | 9208 * @param comment the documentation comment associated with this parameter |
7921 * @param metadata the annotations associated with this parameter | 9209 * @param metadata the annotations associated with this parameter |
7922 * @param identifier the name of the parameter being declared | 9210 * @param identifier the name of the parameter being declared |
7923 */ | 9211 */ |
7924 NormalFormalParameter.full(Comment comment, List<Annotation> metadata, SimpleI
dentifier identifier) { | 9212 NormalFormalParameter.full(Comment comment, List<Annotation> metadata, SimpleI
dentifier identifier) { |
7925 this._metadata = new NodeList<Annotation>(this); | 9213 this._metadata = new NodeList<Annotation>(this); |
7926 this._comment = becomeParentOf(comment); | 9214 this._comment = becomeParentOf(comment); |
7927 this._metadata.addAll(metadata); | 9215 this._metadata.addAll(metadata); |
7928 this._identifier = becomeParentOf(identifier); | 9216 this._identifier = becomeParentOf(identifier); |
7929 } | 9217 } |
| 9218 |
7930 /** | 9219 /** |
7931 * Initialize a newly created formal parameter. | 9220 * Initialize a newly created formal parameter. |
7932 * @param comment the documentation comment associated with this parameter | 9221 * @param comment the documentation comment associated with this parameter |
7933 * @param metadata the annotations associated with this parameter | 9222 * @param metadata the annotations associated with this parameter |
7934 * @param identifier the name of the parameter being declared | 9223 * @param identifier the name of the parameter being declared |
7935 */ | 9224 */ |
7936 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); | 9225 NormalFormalParameter({Comment comment, List<Annotation> metadata, SimpleIdent
ifier identifier}) : this.full(comment, metadata, identifier); |
| 9226 |
7937 /** | 9227 /** |
7938 * Return the documentation comment associated with this parameter, or {@code
null} if this | 9228 * Return the documentation comment associated with this parameter, or {@code
null} if this |
7939 * parameter does not have a documentation comment associated with it. | 9229 * parameter does not have a documentation comment associated with it. |
7940 * @return the documentation comment associated with this parameter | 9230 * @return the documentation comment associated with this parameter |
7941 */ | 9231 */ |
7942 Comment get documentationComment => _comment; | 9232 Comment get documentationComment => _comment; |
7943 SimpleIdentifier get identifier => _identifier; | 9233 SimpleIdentifier get identifier => _identifier; |
7944 ParameterKind get kind { | 9234 ParameterKind get kind { |
7945 ASTNode parent2 = parent; | 9235 ASTNode parent2 = parent; |
7946 if (parent2 is DefaultFormalParameter) { | 9236 if (parent2 is DefaultFormalParameter) { |
7947 return ((parent2 as DefaultFormalParameter)).kind; | 9237 return ((parent2 as DefaultFormalParameter)).kind; |
7948 } | 9238 } |
7949 return ParameterKind.REQUIRED; | 9239 return ParameterKind.REQUIRED; |
7950 } | 9240 } |
| 9241 |
7951 /** | 9242 /** |
7952 * Return the annotations associated with this parameter. | 9243 * Return the annotations associated with this parameter. |
7953 * @return the annotations associated with this parameter | 9244 * @return the annotations associated with this parameter |
7954 */ | 9245 */ |
7955 NodeList<Annotation> get metadata => _metadata; | 9246 NodeList<Annotation> get metadata => _metadata; |
| 9247 |
7956 /** | 9248 /** |
7957 * Return {@code true} if this parameter was declared with the 'const' modifie
r. | 9249 * Return {@code true} if this parameter was declared with the 'const' modifie
r. |
7958 * @return {@code true} if this parameter was declared with the 'const' modifi
er | 9250 * @return {@code true} if this parameter was declared with the 'const' modifi
er |
7959 */ | 9251 */ |
7960 bool isConst(); | 9252 bool isConst(); |
| 9253 |
7961 /** | 9254 /** |
7962 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that | 9255 * Return {@code true} if this parameter was declared with the 'final' modifie
r. Parameters that |
7963 * are declared with the 'const' modifier will return {@code false} even thoug
h they are | 9256 * are declared with the 'const' modifier will return {@code false} even thoug
h they are |
7964 * implicitly final. | 9257 * implicitly final. |
7965 * @return {@code true} if this parameter was declared with the 'final' modifi
er | 9258 * @return {@code true} if this parameter was declared with the 'final' modifi
er |
7966 */ | 9259 */ |
7967 bool isFinal(); | 9260 bool isFinal(); |
| 9261 |
7968 /** | 9262 /** |
7969 * Set the documentation comment associated with this parameter to the given c
omment | 9263 * Set the documentation comment associated with this parameter to the given c
omment |
7970 * @param comment the documentation comment to be associated with this paramet
er | 9264 * @param comment the documentation comment to be associated with this paramet
er |
7971 */ | 9265 */ |
7972 void set documentationComment(Comment comment2) { | 9266 void set documentationComment(Comment comment2) { |
7973 this._comment = becomeParentOf(comment2); | 9267 this._comment = becomeParentOf(comment2); |
7974 } | 9268 } |
| 9269 |
7975 /** | 9270 /** |
7976 * Set the name of the parameter being declared to the given identifier. | 9271 * Set the name of the parameter being declared to the given identifier. |
7977 * @param identifier the name of the parameter being declared | 9272 * @param identifier the name of the parameter being declared |
7978 */ | 9273 */ |
7979 void set identifier(SimpleIdentifier identifier2) { | 9274 void set identifier(SimpleIdentifier identifier2) { |
7980 this._identifier = becomeParentOf(identifier2); | 9275 this._identifier = becomeParentOf(identifier2); |
7981 } | 9276 } |
7982 void visitChildren(ASTVisitor<Object> visitor) { | 9277 void visitChildren(ASTVisitor<Object> visitor) { |
7983 if (commentIsBeforeAnnotations()) { | 9278 if (commentIsBeforeAnnotations()) { |
7984 safelyVisitChild(_comment, visitor); | 9279 safelyVisitChild(_comment, visitor); |
7985 _metadata.accept(visitor); | 9280 _metadata.accept(visitor); |
7986 } else { | 9281 } else { |
7987 for (ASTNode child in sortedCommentAndAnnotations) { | 9282 for (ASTNode child in sortedCommentAndAnnotations) { |
7988 child.accept(visitor); | 9283 child.accept(visitor); |
7989 } | 9284 } |
7990 } | 9285 } |
7991 } | 9286 } |
| 9287 |
7992 /** | 9288 /** |
7993 * Return {@code true} if the comment is lexically before any annotations. | 9289 * Return {@code true} if the comment is lexically before any annotations. |
7994 * @return {@code true} if the comment is lexically before any annotations | 9290 * @return {@code true} if the comment is lexically before any annotations |
7995 */ | 9291 */ |
7996 bool commentIsBeforeAnnotations() { | 9292 bool commentIsBeforeAnnotations() { |
7997 if (_comment == null || _metadata.isEmpty) { | 9293 if (_comment == null || _metadata.isEmpty) { |
7998 return true; | 9294 return true; |
7999 } | 9295 } |
8000 Annotation firstAnnotation = _metadata[0]; | 9296 Annotation firstAnnotation = _metadata[0]; |
8001 return _comment.offset < firstAnnotation.offset; | 9297 return _comment.offset < firstAnnotation.offset; |
8002 } | 9298 } |
| 9299 |
8003 /** | 9300 /** |
8004 * Return an array containing the comment and annotations associated with this
parameter, sorted | 9301 * Return an array containing the comment and annotations associated with this
parameter, sorted |
8005 * in lexical order. | 9302 * in lexical order. |
8006 * @return the comment and annotations associated with this parameter in the o
rder in which they | 9303 * @return the comment and annotations associated with this parameter in the o
rder in which they |
8007 * appeared in the original source | 9304 * appeared in the original source |
8008 */ | 9305 */ |
8009 List<ASTNode> get sortedCommentAndAnnotations { | 9306 List<ASTNode> get sortedCommentAndAnnotations { |
8010 List<ASTNode> childList = new List<ASTNode>(); | 9307 List<ASTNode> childList = new List<ASTNode>(); |
8011 childList.add(_comment); | 9308 childList.add(_comment); |
8012 childList.addAll(_metadata); | 9309 childList.addAll(_metadata); |
8013 List<ASTNode> children = new List.from(childList); | 9310 List<ASTNode> children = new List.from(childList); |
8014 children.sort(); | 9311 children.sort(); |
8015 return children; | 9312 return children; |
8016 } | 9313 } |
8017 } | 9314 } |
| 9315 |
8018 /** | 9316 /** |
8019 * Instances of the class {@code NullLiteral} represent a null literal expressio
n. | 9317 * Instances of the class {@code NullLiteral} represent a null literal expressio
n. |
8020 * <pre> | 9318 * <pre> |
8021 * nullLiteral ::= | 9319 * nullLiteral ::= |
8022 * 'null' | 9320 * 'null' |
8023 * </pre> | 9321 * </pre> |
8024 * @coverage dart.engine.ast | 9322 * @coverage dart.engine.ast |
8025 */ | 9323 */ |
8026 class NullLiteral extends Literal { | 9324 class NullLiteral extends Literal { |
| 9325 |
8027 /** | 9326 /** |
8028 * The token representing the literal. | 9327 * The token representing the literal. |
8029 */ | 9328 */ |
8030 Token _literal; | 9329 Token _literal; |
| 9330 |
8031 /** | 9331 /** |
8032 * Initialize a newly created null literal. | 9332 * Initialize a newly created null literal. |
8033 * @param token the token representing the literal | 9333 * @param token the token representing the literal |
8034 */ | 9334 */ |
8035 NullLiteral.full(Token token) { | 9335 NullLiteral.full(Token token) { |
8036 this._literal = token; | 9336 this._literal = token; |
8037 } | 9337 } |
| 9338 |
8038 /** | 9339 /** |
8039 * Initialize a newly created null literal. | 9340 * Initialize a newly created null literal. |
8040 * @param token the token representing the literal | 9341 * @param token the token representing the literal |
8041 */ | 9342 */ |
8042 NullLiteral({Token token}) : this.full(token); | 9343 NullLiteral({Token token}) : this.full(token); |
8043 accept(ASTVisitor visitor) => visitor.visitNullLiteral(this); | 9344 accept(ASTVisitor visitor) => visitor.visitNullLiteral(this); |
8044 Token get beginToken => _literal; | 9345 Token get beginToken => _literal; |
8045 Token get endToken => _literal; | 9346 Token get endToken => _literal; |
| 9347 |
8046 /** | 9348 /** |
8047 * Return the token representing the literal. | 9349 * Return the token representing the literal. |
8048 * @return the token representing the literal | 9350 * @return the token representing the literal |
8049 */ | 9351 */ |
8050 Token get literal => _literal; | 9352 Token get literal => _literal; |
| 9353 |
8051 /** | 9354 /** |
8052 * Set the token representing the literal to the given token. | 9355 * Set the token representing the literal to the given token. |
8053 * @param literal the token representing the literal | 9356 * @param literal the token representing the literal |
8054 */ | 9357 */ |
8055 void set literal(Token literal2) { | 9358 void set literal(Token literal2) { |
8056 this._literal = literal2; | 9359 this._literal = literal2; |
8057 } | 9360 } |
8058 void visitChildren(ASTVisitor<Object> visitor) { | 9361 void visitChildren(ASTVisitor<Object> visitor) { |
8059 } | 9362 } |
8060 } | 9363 } |
| 9364 |
8061 /** | 9365 /** |
8062 * Instances of the class {@code ParenthesizedExpression} represent a parenthesi
zed expression. | 9366 * Instances of the class {@code ParenthesizedExpression} represent a parenthesi
zed expression. |
8063 * <pre> | 9367 * <pre> |
8064 * parenthesizedExpression ::= | 9368 * parenthesizedExpression ::= |
8065 * '(' {@link Expression expression} ')' | 9369 * '(' {@link Expression expression} ')' |
8066 * </pre> | 9370 * </pre> |
8067 * @coverage dart.engine.ast | 9371 * @coverage dart.engine.ast |
8068 */ | 9372 */ |
8069 class ParenthesizedExpression extends Expression { | 9373 class ParenthesizedExpression extends Expression { |
| 9374 |
8070 /** | 9375 /** |
8071 * The left parenthesis. | 9376 * The left parenthesis. |
8072 */ | 9377 */ |
8073 Token _leftParenthesis; | 9378 Token _leftParenthesis; |
| 9379 |
8074 /** | 9380 /** |
8075 * The expression within the parentheses. | 9381 * The expression within the parentheses. |
8076 */ | 9382 */ |
8077 Expression _expression; | 9383 Expression _expression; |
| 9384 |
8078 /** | 9385 /** |
8079 * The right parenthesis. | 9386 * The right parenthesis. |
8080 */ | 9387 */ |
8081 Token _rightParenthesis; | 9388 Token _rightParenthesis; |
| 9389 |
8082 /** | 9390 /** |
8083 * Initialize a newly created parenthesized expression. | 9391 * Initialize a newly created parenthesized expression. |
8084 * @param leftParenthesis the left parenthesis | 9392 * @param leftParenthesis the left parenthesis |
8085 * @param expression the expression within the parentheses | 9393 * @param expression the expression within the parentheses |
8086 * @param rightParenthesis the right parenthesis | 9394 * @param rightParenthesis the right parenthesis |
8087 */ | 9395 */ |
8088 ParenthesizedExpression.full(Token leftParenthesis, Expression expression, Tok
en rightParenthesis) { | 9396 ParenthesizedExpression.full(Token leftParenthesis, Expression expression, Tok
en rightParenthesis) { |
8089 this._leftParenthesis = leftParenthesis; | 9397 this._leftParenthesis = leftParenthesis; |
8090 this._expression = becomeParentOf(expression); | 9398 this._expression = becomeParentOf(expression); |
8091 this._rightParenthesis = rightParenthesis; | 9399 this._rightParenthesis = rightParenthesis; |
8092 } | 9400 } |
| 9401 |
8093 /** | 9402 /** |
8094 * Initialize a newly created parenthesized expression. | 9403 * Initialize a newly created parenthesized expression. |
8095 * @param leftParenthesis the left parenthesis | 9404 * @param leftParenthesis the left parenthesis |
8096 * @param expression the expression within the parentheses | 9405 * @param expression the expression within the parentheses |
8097 * @param rightParenthesis the right parenthesis | 9406 * @param rightParenthesis the right parenthesis |
8098 */ | 9407 */ |
8099 ParenthesizedExpression({Token leftParenthesis, Expression expression, Token r
ightParenthesis}) : this.full(leftParenthesis, expression, rightParenthesis); | 9408 ParenthesizedExpression({Token leftParenthesis, Expression expression, Token r
ightParenthesis}) : this.full(leftParenthesis, expression, rightParenthesis); |
8100 accept(ASTVisitor visitor) => visitor.visitParenthesizedExpression(this); | 9409 accept(ASTVisitor visitor) => visitor.visitParenthesizedExpression(this); |
8101 Token get beginToken => _leftParenthesis; | 9410 Token get beginToken => _leftParenthesis; |
8102 Token get endToken => _rightParenthesis; | 9411 Token get endToken => _rightParenthesis; |
| 9412 |
8103 /** | 9413 /** |
8104 * Return the expression within the parentheses. | 9414 * Return the expression within the parentheses. |
8105 * @return the expression within the parentheses | 9415 * @return the expression within the parentheses |
8106 */ | 9416 */ |
8107 Expression get expression => _expression; | 9417 Expression get expression => _expression; |
| 9418 |
8108 /** | 9419 /** |
8109 * Return the left parenthesis. | 9420 * Return the left parenthesis. |
8110 * @return the left parenthesis | 9421 * @return the left parenthesis |
8111 */ | 9422 */ |
8112 Token get leftParenthesis => _leftParenthesis; | 9423 Token get leftParenthesis => _leftParenthesis; |
| 9424 |
8113 /** | 9425 /** |
8114 * Return the right parenthesis. | 9426 * Return the right parenthesis. |
8115 * @return the right parenthesis | 9427 * @return the right parenthesis |
8116 */ | 9428 */ |
8117 Token get rightParenthesis => _rightParenthesis; | 9429 Token get rightParenthesis => _rightParenthesis; |
| 9430 |
8118 /** | 9431 /** |
8119 * Set the expression within the parentheses to the given expression. | 9432 * Set the expression within the parentheses to the given expression. |
8120 * @param expression the expression within the parentheses | 9433 * @param expression the expression within the parentheses |
8121 */ | 9434 */ |
8122 void set expression(Expression expression2) { | 9435 void set expression(Expression expression2) { |
8123 this._expression = becomeParentOf(expression2); | 9436 this._expression = becomeParentOf(expression2); |
8124 } | 9437 } |
| 9438 |
8125 /** | 9439 /** |
8126 * Set the left parenthesis to the given token. | 9440 * Set the left parenthesis to the given token. |
8127 * @param parenthesis the left parenthesis | 9441 * @param parenthesis the left parenthesis |
8128 */ | 9442 */ |
8129 void set leftParenthesis(Token parenthesis) { | 9443 void set leftParenthesis(Token parenthesis) { |
8130 _leftParenthesis = parenthesis; | 9444 _leftParenthesis = parenthesis; |
8131 } | 9445 } |
| 9446 |
8132 /** | 9447 /** |
8133 * Set the right parenthesis to the given token. | 9448 * Set the right parenthesis to the given token. |
8134 * @param parenthesis the right parenthesis | 9449 * @param parenthesis the right parenthesis |
8135 */ | 9450 */ |
8136 void set rightParenthesis(Token parenthesis) { | 9451 void set rightParenthesis(Token parenthesis) { |
8137 _rightParenthesis = parenthesis; | 9452 _rightParenthesis = parenthesis; |
8138 } | 9453 } |
8139 void visitChildren(ASTVisitor<Object> visitor) { | 9454 void visitChildren(ASTVisitor<Object> visitor) { |
8140 safelyVisitChild(_expression, visitor); | 9455 safelyVisitChild(_expression, visitor); |
8141 } | 9456 } |
8142 } | 9457 } |
| 9458 |
8143 /** | 9459 /** |
8144 * Instances of the class {@code PartDirective} represent a part directive. | 9460 * Instances of the class {@code PartDirective} represent a part directive. |
8145 * <pre> | 9461 * <pre> |
8146 * partDirective ::={@link Annotation metadata} 'part' {@link StringLiteral part
Uri} ';' | 9462 * partDirective ::={@link Annotation metadata} 'part' {@link StringLiteral part
Uri} ';' |
8147 * </pre> | 9463 * </pre> |
8148 * @coverage dart.engine.ast | 9464 * @coverage dart.engine.ast |
8149 */ | 9465 */ |
8150 class PartDirective extends UriBasedDirective { | 9466 class PartDirective extends UriBasedDirective { |
| 9467 |
8151 /** | 9468 /** |
8152 * The token representing the 'part' token. | 9469 * The token representing the 'part' token. |
8153 */ | 9470 */ |
8154 Token _partToken; | 9471 Token _partToken; |
| 9472 |
8155 /** | 9473 /** |
8156 * The semicolon terminating the directive. | 9474 * The semicolon terminating the directive. |
8157 */ | 9475 */ |
8158 Token _semicolon; | 9476 Token _semicolon; |
| 9477 |
8159 /** | 9478 /** |
8160 * Initialize a newly created part directive. | 9479 * Initialize a newly created part directive. |
8161 * @param comment the documentation comment associated with this directive | 9480 * @param comment the documentation comment associated with this directive |
8162 * @param metadata the annotations associated with the directive | 9481 * @param metadata the annotations associated with the directive |
8163 * @param partToken the token representing the 'part' token | 9482 * @param partToken the token representing the 'part' token |
8164 * @param partUri the URI of the part being included | 9483 * @param partUri the URI of the part being included |
8165 * @param semicolon the semicolon terminating the directive | 9484 * @param semicolon the semicolon terminating the directive |
8166 */ | 9485 */ |
8167 PartDirective.full(Comment comment, List<Annotation> metadata, Token partToken
, StringLiteral partUri, Token semicolon) : super.full(comment, metadata, partUr
i) { | 9486 PartDirective.full(Comment comment, List<Annotation> metadata, Token partToken
, StringLiteral partUri, Token semicolon) : super.full(comment, metadata, partUr
i) { |
8168 this._partToken = partToken; | 9487 this._partToken = partToken; |
8169 this._semicolon = semicolon; | 9488 this._semicolon = semicolon; |
8170 } | 9489 } |
| 9490 |
8171 /** | 9491 /** |
8172 * Initialize a newly created part directive. | 9492 * Initialize a newly created part directive. |
8173 * @param comment the documentation comment associated with this directive | 9493 * @param comment the documentation comment associated with this directive |
8174 * @param metadata the annotations associated with the directive | 9494 * @param metadata the annotations associated with the directive |
8175 * @param partToken the token representing the 'part' token | 9495 * @param partToken the token representing the 'part' token |
8176 * @param partUri the URI of the part being included | 9496 * @param partUri the URI of the part being included |
8177 * @param semicolon the semicolon terminating the directive | 9497 * @param semicolon the semicolon terminating the directive |
8178 */ | 9498 */ |
8179 PartDirective({Comment comment, List<Annotation> metadata, Token partToken, St
ringLiteral partUri, Token semicolon}) : this.full(comment, metadata, partToken,
partUri, semicolon); | 9499 PartDirective({Comment comment, List<Annotation> metadata, Token partToken, St
ringLiteral partUri, Token semicolon}) : this.full(comment, metadata, partToken,
partUri, semicolon); |
8180 accept(ASTVisitor visitor) => visitor.visitPartDirective(this); | 9500 accept(ASTVisitor visitor) => visitor.visitPartDirective(this); |
8181 Token get endToken => _semicolon; | 9501 Token get endToken => _semicolon; |
8182 Token get keyword => _partToken; | 9502 Token get keyword => _partToken; |
| 9503 |
8183 /** | 9504 /** |
8184 * Return the token representing the 'part' token. | 9505 * Return the token representing the 'part' token. |
8185 * @return the token representing the 'part' token | 9506 * @return the token representing the 'part' token |
8186 */ | 9507 */ |
8187 Token get partToken => _partToken; | 9508 Token get partToken => _partToken; |
| 9509 |
8188 /** | 9510 /** |
8189 * Return the semicolon terminating the directive. | 9511 * Return the semicolon terminating the directive. |
8190 * @return the semicolon terminating the directive | 9512 * @return the semicolon terminating the directive |
8191 */ | 9513 */ |
8192 Token get semicolon => _semicolon; | 9514 Token get semicolon => _semicolon; |
| 9515 CompilationUnitElement get uriElement => element as CompilationUnitElement; |
| 9516 |
8193 /** | 9517 /** |
8194 * Set the token representing the 'part' token to the given token. | 9518 * Set the token representing the 'part' token to the given token. |
8195 * @param partToken the token representing the 'part' token | 9519 * @param partToken the token representing the 'part' token |
8196 */ | 9520 */ |
8197 void set partToken(Token partToken2) { | 9521 void set partToken(Token partToken2) { |
8198 this._partToken = partToken2; | 9522 this._partToken = partToken2; |
8199 } | 9523 } |
| 9524 |
8200 /** | 9525 /** |
8201 * Set the semicolon terminating the directive to the given token. | 9526 * Set the semicolon terminating the directive to the given token. |
8202 * @param semicolon the semicolon terminating the directive | 9527 * @param semicolon the semicolon terminating the directive |
8203 */ | 9528 */ |
8204 void set semicolon(Token semicolon2) { | 9529 void set semicolon(Token semicolon2) { |
8205 this._semicolon = semicolon2; | 9530 this._semicolon = semicolon2; |
8206 } | 9531 } |
8207 Token get firstTokenAfterCommentAndMetadata => _partToken; | 9532 Token get firstTokenAfterCommentAndMetadata => _partToken; |
8208 } | 9533 } |
| 9534 |
8209 /** | 9535 /** |
8210 * Instances of the class {@code PartOfDirective} represent a part-of directive. | 9536 * Instances of the class {@code PartOfDirective} represent a part-of directive. |
8211 * <pre> | 9537 * <pre> |
8212 * partOfDirective ::={@link Annotation metadata} 'part' 'of' {@link Identifier
libraryName} ';' | 9538 * partOfDirective ::={@link Annotation metadata} 'part' 'of' {@link Identifier
libraryName} ';' |
8213 * </pre> | 9539 * </pre> |
8214 * @coverage dart.engine.ast | 9540 * @coverage dart.engine.ast |
8215 */ | 9541 */ |
8216 class PartOfDirective extends Directive { | 9542 class PartOfDirective extends Directive { |
| 9543 |
8217 /** | 9544 /** |
8218 * The token representing the 'part' token. | 9545 * The token representing the 'part' token. |
8219 */ | 9546 */ |
8220 Token _partToken; | 9547 Token _partToken; |
| 9548 |
8221 /** | 9549 /** |
8222 * The token representing the 'of' token. | 9550 * The token representing the 'of' token. |
8223 */ | 9551 */ |
8224 Token _ofToken; | 9552 Token _ofToken; |
| 9553 |
8225 /** | 9554 /** |
8226 * The name of the library that the containing compilation unit is part of. | 9555 * The name of the library that the containing compilation unit is part of. |
8227 */ | 9556 */ |
8228 LibraryIdentifier _libraryName; | 9557 LibraryIdentifier _libraryName; |
| 9558 |
8229 /** | 9559 /** |
8230 * The semicolon terminating the directive. | 9560 * The semicolon terminating the directive. |
8231 */ | 9561 */ |
8232 Token _semicolon; | 9562 Token _semicolon; |
| 9563 |
8233 /** | 9564 /** |
8234 * Initialize a newly created part-of directive. | 9565 * Initialize a newly created part-of directive. |
8235 * @param comment the documentation comment associated with this directive | 9566 * @param comment the documentation comment associated with this directive |
8236 * @param metadata the annotations associated with the directive | 9567 * @param metadata the annotations associated with the directive |
8237 * @param partToken the token representing the 'part' token | 9568 * @param partToken the token representing the 'part' token |
8238 * @param ofToken the token representing the 'of' token | 9569 * @param ofToken the token representing the 'of' token |
8239 * @param libraryName the name of the library that the containing compilation
unit is part of | 9570 * @param libraryName the name of the library that the containing compilation
unit is part of |
8240 * @param semicolon the semicolon terminating the directive | 9571 * @param semicolon the semicolon terminating the directive |
8241 */ | 9572 */ |
8242 PartOfDirective.full(Comment comment, List<Annotation> metadata, Token partTok
en, Token ofToken, LibraryIdentifier libraryName, Token semicolon) : super.full(
comment, metadata) { | 9573 PartOfDirective.full(Comment comment, List<Annotation> metadata, Token partTok
en, Token ofToken, LibraryIdentifier libraryName, Token semicolon) : super.full(
comment, metadata) { |
8243 this._partToken = partToken; | 9574 this._partToken = partToken; |
8244 this._ofToken = ofToken; | 9575 this._ofToken = ofToken; |
8245 this._libraryName = becomeParentOf(libraryName); | 9576 this._libraryName = becomeParentOf(libraryName); |
8246 this._semicolon = semicolon; | 9577 this._semicolon = semicolon; |
8247 } | 9578 } |
| 9579 |
8248 /** | 9580 /** |
8249 * Initialize a newly created part-of directive. | 9581 * Initialize a newly created part-of directive. |
8250 * @param comment the documentation comment associated with this directive | 9582 * @param comment the documentation comment associated with this directive |
8251 * @param metadata the annotations associated with the directive | 9583 * @param metadata the annotations associated with the directive |
8252 * @param partToken the token representing the 'part' token | 9584 * @param partToken the token representing the 'part' token |
8253 * @param ofToken the token representing the 'of' token | 9585 * @param ofToken the token representing the 'of' token |
8254 * @param libraryName the name of the library that the containing compilation
unit is part of | 9586 * @param libraryName the name of the library that the containing compilation
unit is part of |
8255 * @param semicolon the semicolon terminating the directive | 9587 * @param semicolon the semicolon terminating the directive |
8256 */ | 9588 */ |
8257 PartOfDirective({Comment comment, List<Annotation> metadata, Token partToken,
Token ofToken, LibraryIdentifier libraryName, Token semicolon}) : this.full(comm
ent, metadata, partToken, ofToken, libraryName, semicolon); | 9589 PartOfDirective({Comment comment, List<Annotation> metadata, Token partToken,
Token ofToken, LibraryIdentifier libraryName, Token semicolon}) : this.full(comm
ent, metadata, partToken, ofToken, libraryName, semicolon); |
8258 accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this); | 9590 accept(ASTVisitor visitor) => visitor.visitPartOfDirective(this); |
8259 Token get endToken => _semicolon; | 9591 Token get endToken => _semicolon; |
8260 Token get keyword => _partToken; | 9592 Token get keyword => _partToken; |
| 9593 |
8261 /** | 9594 /** |
8262 * Return the name of the library that the containing compilation unit is part
of. | 9595 * Return the name of the library that the containing compilation unit is part
of. |
8263 * @return the name of the library that the containing compilation unit is par
t of | 9596 * @return the name of the library that the containing compilation unit is par
t of |
8264 */ | 9597 */ |
8265 LibraryIdentifier get libraryName => _libraryName; | 9598 LibraryIdentifier get libraryName => _libraryName; |
| 9599 |
8266 /** | 9600 /** |
8267 * Return the token representing the 'of' token. | 9601 * Return the token representing the 'of' token. |
8268 * @return the token representing the 'of' token | 9602 * @return the token representing the 'of' token |
8269 */ | 9603 */ |
8270 Token get ofToken => _ofToken; | 9604 Token get ofToken => _ofToken; |
| 9605 |
8271 /** | 9606 /** |
8272 * Return the token representing the 'part' token. | 9607 * Return the token representing the 'part' token. |
8273 * @return the token representing the 'part' token | 9608 * @return the token representing the 'part' token |
8274 */ | 9609 */ |
8275 Token get partToken => _partToken; | 9610 Token get partToken => _partToken; |
| 9611 |
8276 /** | 9612 /** |
8277 * Return the semicolon terminating the directive. | 9613 * Return the semicolon terminating the directive. |
8278 * @return the semicolon terminating the directive | 9614 * @return the semicolon terminating the directive |
8279 */ | 9615 */ |
8280 Token get semicolon => _semicolon; | 9616 Token get semicolon => _semicolon; |
| 9617 |
8281 /** | 9618 /** |
8282 * Set the name of the library that the containing compilation unit is part of
to the given name. | 9619 * Set the name of the library that the containing compilation unit is part of
to the given name. |
8283 * @param libraryName the name of the library that the containing compilation
unit is part of | 9620 * @param libraryName the name of the library that the containing compilation
unit is part of |
8284 */ | 9621 */ |
8285 void set libraryName(LibraryIdentifier libraryName2) { | 9622 void set libraryName(LibraryIdentifier libraryName2) { |
8286 this._libraryName = becomeParentOf(libraryName2); | 9623 this._libraryName = becomeParentOf(libraryName2); |
8287 } | 9624 } |
| 9625 |
8288 /** | 9626 /** |
8289 * Set the token representing the 'of' token to the given token. | 9627 * Set the token representing the 'of' token to the given token. |
8290 * @param ofToken the token representing the 'of' token | 9628 * @param ofToken the token representing the 'of' token |
8291 */ | 9629 */ |
8292 void set ofToken(Token ofToken2) { | 9630 void set ofToken(Token ofToken2) { |
8293 this._ofToken = ofToken2; | 9631 this._ofToken = ofToken2; |
8294 } | 9632 } |
| 9633 |
8295 /** | 9634 /** |
8296 * Set the token representing the 'part' token to the given token. | 9635 * Set the token representing the 'part' token to the given token. |
8297 * @param partToken the token representing the 'part' token | 9636 * @param partToken the token representing the 'part' token |
8298 */ | 9637 */ |
8299 void set partToken(Token partToken2) { | 9638 void set partToken(Token partToken2) { |
8300 this._partToken = partToken2; | 9639 this._partToken = partToken2; |
8301 } | 9640 } |
| 9641 |
8302 /** | 9642 /** |
8303 * Set the semicolon terminating the directive to the given token. | 9643 * Set the semicolon terminating the directive to the given token. |
8304 * @param semicolon the semicolon terminating the directive | 9644 * @param semicolon the semicolon terminating the directive |
8305 */ | 9645 */ |
8306 void set semicolon(Token semicolon2) { | 9646 void set semicolon(Token semicolon2) { |
8307 this._semicolon = semicolon2; | 9647 this._semicolon = semicolon2; |
8308 } | 9648 } |
8309 void visitChildren(ASTVisitor<Object> visitor) { | 9649 void visitChildren(ASTVisitor<Object> visitor) { |
8310 super.visitChildren(visitor); | 9650 super.visitChildren(visitor); |
8311 safelyVisitChild(_libraryName, visitor); | 9651 safelyVisitChild(_libraryName, visitor); |
8312 } | 9652 } |
8313 Token get firstTokenAfterCommentAndMetadata => _partToken; | 9653 Token get firstTokenAfterCommentAndMetadata => _partToken; |
8314 } | 9654 } |
| 9655 |
8315 /** | 9656 /** |
8316 * Instances of the class {@code PostfixExpression} represent a postfix unary ex
pression. | 9657 * Instances of the class {@code PostfixExpression} represent a postfix unary ex
pression. |
8317 * <pre> | 9658 * <pre> |
8318 * postfixExpression ::={@link Expression operand} {@link Token operator}</pre> | 9659 * postfixExpression ::={@link Expression operand} {@link Token operator}</pre> |
8319 * @coverage dart.engine.ast | 9660 * @coverage dart.engine.ast |
8320 */ | 9661 */ |
8321 class PostfixExpression extends Expression { | 9662 class PostfixExpression extends Expression { |
| 9663 |
8322 /** | 9664 /** |
8323 * The expression computing the operand for the operator. | 9665 * The expression computing the operand for the operator. |
8324 */ | 9666 */ |
8325 Expression _operand; | 9667 Expression _operand; |
| 9668 |
8326 /** | 9669 /** |
8327 * The postfix operator being applied to the operand. | 9670 * The postfix operator being applied to the operand. |
8328 */ | 9671 */ |
8329 Token _operator; | 9672 Token _operator; |
| 9673 |
8330 /** | 9674 /** |
8331 * The element associated with this the operator, or {@code null} if the AST s
tructure has not | 9675 * The element associated with this the operator based on the propagated type
of the operand, or{@code null} if the AST structure has not been resolved, if th
e operator is not user definable, |
8332 * been resolved, if the operator is not user definable, or if the operator co
uld not be resolved. | 9676 * or if the operator could not be resolved. |
8333 */ | 9677 */ |
8334 MethodElement _element; | 9678 MethodElement _propagatedElement; |
| 9679 |
| 9680 /** |
| 9681 * The element associated with the operator based on the static type of the op
erand, or{@code null} if the AST structure has not been resolved, if the operato
r is not user definable, |
| 9682 * or if the operator could not be resolved. |
| 9683 */ |
| 9684 MethodElement _staticElement; |
| 9685 |
8335 /** | 9686 /** |
8336 * Initialize a newly created postfix expression. | 9687 * Initialize a newly created postfix expression. |
8337 * @param operand the expression computing the operand for the operator | 9688 * @param operand the expression computing the operand for the operator |
8338 * @param operator the postfix operator being applied to the operand | 9689 * @param operator the postfix operator being applied to the operand |
8339 */ | 9690 */ |
8340 PostfixExpression.full(Expression operand, Token operator) { | 9691 PostfixExpression.full(Expression operand, Token operator) { |
8341 this._operand = becomeParentOf(operand); | 9692 this._operand = becomeParentOf(operand); |
8342 this._operator = operator; | 9693 this._operator = operator; |
8343 } | 9694 } |
| 9695 |
8344 /** | 9696 /** |
8345 * Initialize a newly created postfix expression. | 9697 * Initialize a newly created postfix expression. |
8346 * @param operand the expression computing the operand for the operator | 9698 * @param operand the expression computing the operand for the operator |
8347 * @param operator the postfix operator being applied to the operand | 9699 * @param operator the postfix operator being applied to the operand |
8348 */ | 9700 */ |
8349 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o
perator); | 9701 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o
perator); |
8350 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); | 9702 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); |
8351 Token get beginToken => _operand.beginToken; | 9703 Token get beginToken => _operand.beginToken; |
| 9704 |
8352 /** | 9705 /** |
8353 * Return the element associated with the operator, or {@code null} if the AST
structure has not | 9706 * Return the element associated with the operator based on the propagated typ
e of the operand, or{@code null} if the AST structure has not been resolved, if
the operator is not user definable, |
8354 * been resolved, if the operator is not user definable, or if the operator co
uld not be resolved. | 9707 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
8355 * One example of the latter case is an operator that is not defined for the t
ype of the operand. | 9708 * not defined for the type of the operand. |
8356 * @return the element associated with the operator | 9709 * @return the element associated with the operator |
8357 */ | 9710 */ |
8358 MethodElement get element => _element; | 9711 MethodElement get element => _propagatedElement; |
8359 Token get endToken => _operator; | 9712 Token get endToken => _operator; |
| 9713 |
8360 /** | 9714 /** |
8361 * Return the expression computing the operand for the operator. | 9715 * Return the expression computing the operand for the operator. |
8362 * @return the expression computing the operand for the operator | 9716 * @return the expression computing the operand for the operator |
8363 */ | 9717 */ |
8364 Expression get operand => _operand; | 9718 Expression get operand => _operand; |
| 9719 |
8365 /** | 9720 /** |
8366 * Return the postfix operator being applied to the operand. | 9721 * Return the postfix operator being applied to the operand. |
8367 * @return the postfix operator being applied to the operand | 9722 * @return the postfix operator being applied to the operand |
8368 */ | 9723 */ |
8369 Token get operator => _operator; | 9724 Token get operator => _operator; |
| 9725 |
8370 /** | 9726 /** |
8371 * Set the element associated with the operator to the given element. | 9727 * Return the element associated with the operator based on the static type of
the operand, or{@code null} if the AST structure has not been resolved, if the
operator is not user definable, |
8372 * @param element the element associated with the operator | 9728 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9729 * not defined for the type of the operand. |
| 9730 * @return the element associated with the operator |
| 9731 */ |
| 9732 MethodElement get staticElement => _staticElement; |
| 9733 |
| 9734 /** |
| 9735 * Set the element associated with the operator based on the propagated type o
f the operand to the |
| 9736 * given element. |
| 9737 * @param element the element to be associated with the operator |
8373 */ | 9738 */ |
8374 void set element(MethodElement element2) { | 9739 void set element(MethodElement element2) { |
8375 this._element = element2; | 9740 _propagatedElement = element2; |
8376 } | 9741 } |
| 9742 |
8377 /** | 9743 /** |
8378 * Set the expression computing the operand for the operator to the given expr
ession. | 9744 * Set the expression computing the operand for the operator to the given expr
ession. |
8379 * @param expression the expression computing the operand for the operator | 9745 * @param expression the expression computing the operand for the operator |
8380 */ | 9746 */ |
8381 void set operand(Expression expression) { | 9747 void set operand(Expression expression) { |
8382 _operand = becomeParentOf(expression); | 9748 _operand = becomeParentOf(expression); |
8383 } | 9749 } |
| 9750 |
8384 /** | 9751 /** |
8385 * Set the postfix operator being applied to the operand to the given operator
. | 9752 * Set the postfix operator being applied to the operand to the given operator
. |
8386 * @param operator the postfix operator being applied to the operand | 9753 * @param operator the postfix operator being applied to the operand |
8387 */ | 9754 */ |
8388 void set operator(Token operator2) { | 9755 void set operator(Token operator2) { |
8389 this._operator = operator2; | 9756 this._operator = operator2; |
8390 } | 9757 } |
| 9758 |
| 9759 /** |
| 9760 * Set the element associated with the operator based on the static type of th
e operand to the |
| 9761 * given element. |
| 9762 * @param element the element to be associated with the operator |
| 9763 */ |
| 9764 void set staticElement(MethodElement element) { |
| 9765 _staticElement = element; |
| 9766 } |
8391 void visitChildren(ASTVisitor<Object> visitor) { | 9767 void visitChildren(ASTVisitor<Object> visitor) { |
8392 safelyVisitChild(_operand, visitor); | 9768 safelyVisitChild(_operand, visitor); |
8393 } | 9769 } |
8394 } | 9770 } |
| 9771 |
8395 /** | 9772 /** |
8396 * Instances of the class {@code PrefixExpression} represent a prefix unary expr
ession. | 9773 * Instances of the class {@code PrefixExpression} represent a prefix unary expr
ession. |
8397 * <pre> | 9774 * <pre> |
8398 * prefixExpression ::={@link Token operator} {@link Expression operand}</pre> | 9775 * prefixExpression ::={@link Token operator} {@link Expression operand}</pre> |
8399 * @coverage dart.engine.ast | 9776 * @coverage dart.engine.ast |
8400 */ | 9777 */ |
8401 class PrefixExpression extends Expression { | 9778 class PrefixExpression extends Expression { |
| 9779 |
8402 /** | 9780 /** |
8403 * The prefix operator being applied to the operand. | 9781 * The prefix operator being applied to the operand. |
8404 */ | 9782 */ |
8405 Token _operator; | 9783 Token _operator; |
| 9784 |
8406 /** | 9785 /** |
8407 * The expression computing the operand for the operator. | 9786 * The expression computing the operand for the operator. |
8408 */ | 9787 */ |
8409 Expression _operand; | 9788 Expression _operand; |
| 9789 |
8410 /** | 9790 /** |
8411 * The element associated with the operator, or {@code null} if the AST struct
ure has not been | 9791 * The element associated with the operator based on the static type of the op
erand, or{@code null} if the AST structure has not been resolved, if the operato
r is not user definable, |
8412 * resolved, if the operator is not user definable, or if the operator could n
ot be resolved. | 9792 * or if the operator could not be resolved. |
8413 */ | 9793 */ |
8414 MethodElement _element; | 9794 MethodElement _staticElement; |
| 9795 |
| 9796 /** |
| 9797 * The element associated with the operator based on the propagated type of th
e operand, or{@code null} if the AST structure has not been resolved, if the ope
rator is not user definable, |
| 9798 * or if the operator could not be resolved. |
| 9799 */ |
| 9800 MethodElement _propagatedElement; |
| 9801 |
8415 /** | 9802 /** |
8416 * Initialize a newly created prefix expression. | 9803 * Initialize a newly created prefix expression. |
8417 * @param operator the prefix operator being applied to the operand | 9804 * @param operator the prefix operator being applied to the operand |
8418 * @param operand the expression computing the operand for the operator | 9805 * @param operand the expression computing the operand for the operator |
8419 */ | 9806 */ |
8420 PrefixExpression.full(Token operator, Expression operand) { | 9807 PrefixExpression.full(Token operator, Expression operand) { |
8421 this._operator = operator; | 9808 this._operator = operator; |
8422 this._operand = becomeParentOf(operand); | 9809 this._operand = becomeParentOf(operand); |
8423 } | 9810 } |
| 9811 |
8424 /** | 9812 /** |
8425 * Initialize a newly created prefix expression. | 9813 * Initialize a newly created prefix expression. |
8426 * @param operator the prefix operator being applied to the operand | 9814 * @param operator the prefix operator being applied to the operand |
8427 * @param operand the expression computing the operand for the operator | 9815 * @param operand the expression computing the operand for the operator |
8428 */ | 9816 */ |
8429 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o
perand); | 9817 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o
perand); |
8430 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); | 9818 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); |
8431 Token get beginToken => _operator; | 9819 Token get beginToken => _operator; |
| 9820 |
8432 /** | 9821 /** |
8433 * Return the element associated with the operator, or {@code null} if the AST
structure has not | 9822 * Return the element associated with the operator based on the propagated typ
e of the operand, or{@code null} if the AST structure has not been resolved, if
the operator is not user definable, |
8434 * been resolved, if the operator is not user definable, or if the operator co
uld not be resolved. | 9823 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
8435 * One example of the latter case is an operator that is not defined for the t
ype of the operand. | 9824 * not defined for the type of the operand. |
8436 * @return the element associated with the operator | 9825 * @return the element associated with the operator |
8437 */ | 9826 */ |
8438 MethodElement get element => _element; | 9827 MethodElement get element => _propagatedElement; |
8439 Token get endToken => _operand.endToken; | 9828 Token get endToken => _operand.endToken; |
| 9829 |
8440 /** | 9830 /** |
8441 * Return the expression computing the operand for the operator. | 9831 * Return the expression computing the operand for the operator. |
8442 * @return the expression computing the operand for the operator | 9832 * @return the expression computing the operand for the operator |
8443 */ | 9833 */ |
8444 Expression get operand => _operand; | 9834 Expression get operand => _operand; |
| 9835 |
8445 /** | 9836 /** |
8446 * Return the prefix operator being applied to the operand. | 9837 * Return the prefix operator being applied to the operand. |
8447 * @return the prefix operator being applied to the operand | 9838 * @return the prefix operator being applied to the operand |
8448 */ | 9839 */ |
8449 Token get operator => _operator; | 9840 Token get operator => _operator; |
| 9841 |
8450 /** | 9842 /** |
8451 * Set the element associated with the operator to the given element. | 9843 * Return the element associated with the operator based on the static type of
the operand, or{@code null} if the AST structure has not been resolved, if the
operator is not user definable, |
8452 * @param element the element associated with the operator | 9844 * or if the operator could not be resolved. One example of the latter case is
an operator that is |
| 9845 * not defined for the type of the operand. |
| 9846 * @return the element associated with the operator |
| 9847 */ |
| 9848 MethodElement get staticElement => _staticElement; |
| 9849 |
| 9850 /** |
| 9851 * Set the element associated with the operator based on the propagated type o
f the operand to the |
| 9852 * given element. |
| 9853 * @param element the element to be associated with the operator |
8453 */ | 9854 */ |
8454 void set element(MethodElement element2) { | 9855 void set element(MethodElement element2) { |
8455 this._element = element2; | 9856 _propagatedElement = element2; |
8456 } | 9857 } |
| 9858 |
8457 /** | 9859 /** |
8458 * Set the expression computing the operand for the operator to the given expr
ession. | 9860 * Set the expression computing the operand for the operator to the given expr
ession. |
8459 * @param expression the expression computing the operand for the operator | 9861 * @param expression the expression computing the operand for the operator |
8460 */ | 9862 */ |
8461 void set operand(Expression expression) { | 9863 void set operand(Expression expression) { |
8462 _operand = becomeParentOf(expression); | 9864 _operand = becomeParentOf(expression); |
8463 } | 9865 } |
| 9866 |
8464 /** | 9867 /** |
8465 * Set the prefix operator being applied to the operand to the given operator. | 9868 * Set the prefix operator being applied to the operand to the given operator. |
8466 * @param operator the prefix operator being applied to the operand | 9869 * @param operator the prefix operator being applied to the operand |
8467 */ | 9870 */ |
8468 void set operator(Token operator2) { | 9871 void set operator(Token operator2) { |
8469 this._operator = operator2; | 9872 this._operator = operator2; |
8470 } | 9873 } |
| 9874 |
| 9875 /** |
| 9876 * Set the element associated with the operator based on the static type of th
e operand to the |
| 9877 * given element. |
| 9878 * @param element the static element to be associated with the operator |
| 9879 */ |
| 9880 void set staticElement(MethodElement element) { |
| 9881 _staticElement = element; |
| 9882 } |
8471 void visitChildren(ASTVisitor<Object> visitor) { | 9883 void visitChildren(ASTVisitor<Object> visitor) { |
8472 safelyVisitChild(_operand, visitor); | 9884 safelyVisitChild(_operand, visitor); |
8473 } | 9885 } |
8474 } | 9886 } |
| 9887 |
8475 /** | 9888 /** |
8476 * Instances of the class {@code PrefixedIdentifier} represent either an identif
ier that is prefixed | 9889 * Instances of the class {@code PrefixedIdentifier} represent either an identif
ier that is prefixed |
8477 * or an access to an object property where the target of the property access is
a simple | 9890 * or an access to an object property where the target of the property access is
a simple |
8478 * identifier. | 9891 * identifier. |
8479 * <pre> | 9892 * <pre> |
8480 * prefixedIdentifier ::={@link SimpleIdentifier prefix} '.' {@link SimpleIdenti
fier identifier}</pre> | 9893 * prefixedIdentifier ::={@link SimpleIdentifier prefix} '.' {@link SimpleIdenti
fier identifier}</pre> |
8481 * @coverage dart.engine.ast | 9894 * @coverage dart.engine.ast |
8482 */ | 9895 */ |
8483 class PrefixedIdentifier extends Identifier { | 9896 class PrefixedIdentifier extends Identifier { |
| 9897 |
8484 /** | 9898 /** |
8485 * The prefix associated with the library in which the identifier is defined. | 9899 * The prefix associated with the library in which the identifier is defined. |
8486 */ | 9900 */ |
8487 SimpleIdentifier _prefix; | 9901 SimpleIdentifier _prefix; |
| 9902 |
8488 /** | 9903 /** |
8489 * The period used to separate the prefix from the identifier. | 9904 * The period used to separate the prefix from the identifier. |
8490 */ | 9905 */ |
8491 Token _period; | 9906 Token _period; |
| 9907 |
8492 /** | 9908 /** |
8493 * The identifier being prefixed. | 9909 * The identifier being prefixed. |
8494 */ | 9910 */ |
8495 SimpleIdentifier _identifier; | 9911 SimpleIdentifier _identifier; |
| 9912 |
8496 /** | 9913 /** |
8497 * Initialize a newly created prefixed identifier. | 9914 * Initialize a newly created prefixed identifier. |
8498 * @param prefix the identifier being prefixed | 9915 * @param prefix the identifier being prefixed |
8499 * @param period the period used to separate the prefix from the identifier | 9916 * @param period the period used to separate the prefix from the identifier |
8500 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 9917 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
8501 */ | 9918 */ |
8502 PrefixedIdentifier.full(SimpleIdentifier prefix, Token period, SimpleIdentifie
r identifier) { | 9919 PrefixedIdentifier.full(SimpleIdentifier prefix, Token period, SimpleIdentifie
r identifier) { |
8503 this._prefix = becomeParentOf(prefix); | 9920 this._prefix = becomeParentOf(prefix); |
8504 this._period = period; | 9921 this._period = period; |
8505 this._identifier = becomeParentOf(identifier); | 9922 this._identifier = becomeParentOf(identifier); |
8506 } | 9923 } |
| 9924 |
8507 /** | 9925 /** |
8508 * Initialize a newly created prefixed identifier. | 9926 * Initialize a newly created prefixed identifier. |
8509 * @param prefix the identifier being prefixed | 9927 * @param prefix the identifier being prefixed |
8510 * @param period the period used to separate the prefix from the identifier | 9928 * @param period the period used to separate the prefix from the identifier |
8511 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 9929 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
8512 */ | 9930 */ |
8513 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id
entifier}) : this.full(prefix, period, identifier); | 9931 PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier id
entifier}) : this.full(prefix, period, identifier); |
8514 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); | 9932 accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this); |
8515 Token get beginToken => _prefix.beginToken; | 9933 Token get beginToken => _prefix.beginToken; |
8516 Element get element { | 9934 Element get element { |
8517 if (_identifier == null) { | 9935 if (_identifier == null) { |
8518 return null; | 9936 return null; |
8519 } | 9937 } |
8520 return _identifier.element; | 9938 return _identifier.element; |
8521 } | 9939 } |
8522 Token get endToken => _identifier.endToken; | 9940 Token get endToken => _identifier.endToken; |
| 9941 |
8523 /** | 9942 /** |
8524 * Return the identifier being prefixed. | 9943 * Return the identifier being prefixed. |
8525 * @return the identifier being prefixed | 9944 * @return the identifier being prefixed |
8526 */ | 9945 */ |
8527 SimpleIdentifier get identifier => _identifier; | 9946 SimpleIdentifier get identifier => _identifier; |
8528 String get name => "${_prefix.name}.${_identifier.name}"; | 9947 String get name => "${_prefix.name}.${_identifier.name}"; |
| 9948 |
8529 /** | 9949 /** |
8530 * Return the period used to separate the prefix from the identifier. | 9950 * Return the period used to separate the prefix from the identifier. |
8531 * @return the period used to separate the prefix from the identifier | 9951 * @return the period used to separate the prefix from the identifier |
8532 */ | 9952 */ |
8533 Token get period => _period; | 9953 Token get period => _period; |
| 9954 |
8534 /** | 9955 /** |
8535 * Return the prefix associated with the library in which the identifier is de
fined. | 9956 * Return the prefix associated with the library in which the identifier is de
fined. |
8536 * @return the prefix associated with the library in which the identifier is d
efined | 9957 * @return the prefix associated with the library in which the identifier is d
efined |
8537 */ | 9958 */ |
8538 SimpleIdentifier get prefix => _prefix; | 9959 SimpleIdentifier get prefix => _prefix; |
| 9960 Element get staticElement { |
| 9961 if (_identifier == null) { |
| 9962 return null; |
| 9963 } |
| 9964 return _identifier.staticElement; |
| 9965 } |
| 9966 |
8539 /** | 9967 /** |
8540 * Set the identifier being prefixed to the given identifier. | 9968 * Set the identifier being prefixed to the given identifier. |
8541 * @param identifier the identifier being prefixed | 9969 * @param identifier the identifier being prefixed |
8542 */ | 9970 */ |
8543 void set identifier(SimpleIdentifier identifier2) { | 9971 void set identifier(SimpleIdentifier identifier2) { |
8544 this._identifier = becomeParentOf(identifier2); | 9972 this._identifier = becomeParentOf(identifier2); |
8545 } | 9973 } |
| 9974 |
8546 /** | 9975 /** |
8547 * Set the period used to separate the prefix from the identifier to the given
token. | 9976 * Set the period used to separate the prefix from the identifier to the given
token. |
8548 * @param period the period used to separate the prefix from the identifier | 9977 * @param period the period used to separate the prefix from the identifier |
8549 */ | 9978 */ |
8550 void set period(Token period2) { | 9979 void set period(Token period2) { |
8551 this._period = period2; | 9980 this._period = period2; |
8552 } | 9981 } |
| 9982 |
8553 /** | 9983 /** |
8554 * Set the prefix associated with the library in which the identifier is defin
ed to the given | 9984 * Set the prefix associated with the library in which the identifier is defin
ed to the given |
8555 * identifier. | 9985 * identifier. |
8556 * @param identifier the prefix associated with the library in which the ident
ifier is defined | 9986 * @param identifier the prefix associated with the library in which the ident
ifier is defined |
8557 */ | 9987 */ |
8558 void set prefix(SimpleIdentifier identifier) { | 9988 void set prefix(SimpleIdentifier identifier) { |
8559 _prefix = becomeParentOf(identifier); | 9989 _prefix = becomeParentOf(identifier); |
8560 } | 9990 } |
8561 void visitChildren(ASTVisitor<Object> visitor) { | 9991 void visitChildren(ASTVisitor<Object> visitor) { |
8562 safelyVisitChild(_prefix, visitor); | 9992 safelyVisitChild(_prefix, visitor); |
8563 safelyVisitChild(_identifier, visitor); | 9993 safelyVisitChild(_identifier, visitor); |
8564 } | 9994 } |
8565 } | 9995 } |
| 9996 |
8566 /** | 9997 /** |
8567 * Instances of the class {@code PropertyAccess} represent the access of a prope
rty of an object. | 9998 * Instances of the class {@code PropertyAccess} represent the access of a prope
rty of an object. |
8568 * <p> | 9999 * <p> |
8569 * Note, however, that accesses to properties of objects can also be represented
as{@link PrefixedIdentifier prefixed identifier} nodes in cases where the targe
t is also a simple | 10000 * Note, however, that accesses to properties of objects can also be represented
as{@link PrefixedIdentifier prefixed identifier} nodes in cases where the targe
t is also a simple |
8570 * identifier. | 10001 * identifier. |
8571 * <pre> | 10002 * <pre> |
8572 * propertyAccess ::={@link Expression target} '.' {@link SimpleIdentifier prope
rtyName}</pre> | 10003 * propertyAccess ::={@link Expression target} '.' {@link SimpleIdentifier prope
rtyName}</pre> |
8573 * @coverage dart.engine.ast | 10004 * @coverage dart.engine.ast |
8574 */ | 10005 */ |
8575 class PropertyAccess extends Expression { | 10006 class PropertyAccess extends Expression { |
| 10007 |
8576 /** | 10008 /** |
8577 * The expression computing the object defining the property being accessed. | 10009 * The expression computing the object defining the property being accessed. |
8578 */ | 10010 */ |
8579 Expression _target; | 10011 Expression _target; |
| 10012 |
8580 /** | 10013 /** |
8581 * The property access operator. | 10014 * The property access operator. |
8582 */ | 10015 */ |
8583 Token _operator; | 10016 Token _operator; |
| 10017 |
8584 /** | 10018 /** |
8585 * The name of the property being accessed. | 10019 * The name of the property being accessed. |
8586 */ | 10020 */ |
8587 SimpleIdentifier _propertyName; | 10021 SimpleIdentifier _propertyName; |
| 10022 |
8588 /** | 10023 /** |
8589 * Initialize a newly created property access expression. | 10024 * Initialize a newly created property access expression. |
8590 * @param target the expression computing the object defining the property bei
ng accessed | 10025 * @param target the expression computing the object defining the property bei
ng accessed |
8591 * @param operator the property access operator | 10026 * @param operator the property access operator |
8592 * @param propertyName the name of the property being accessed | 10027 * @param propertyName the name of the property being accessed |
8593 */ | 10028 */ |
8594 PropertyAccess.full(Expression target, Token operator, SimpleIdentifier proper
tyName) { | 10029 PropertyAccess.full(Expression target, Token operator, SimpleIdentifier proper
tyName) { |
8595 this._target = becomeParentOf(target); | 10030 this._target = becomeParentOf(target); |
8596 this._operator = operator; | 10031 this._operator = operator; |
8597 this._propertyName = becomeParentOf(propertyName); | 10032 this._propertyName = becomeParentOf(propertyName); |
8598 } | 10033 } |
| 10034 |
8599 /** | 10035 /** |
8600 * Initialize a newly created property access expression. | 10036 * Initialize a newly created property access expression. |
8601 * @param target the expression computing the object defining the property bei
ng accessed | 10037 * @param target the expression computing the object defining the property bei
ng accessed |
8602 * @param operator the property access operator | 10038 * @param operator the property access operator |
8603 * @param propertyName the name of the property being accessed | 10039 * @param propertyName the name of the property being accessed |
8604 */ | 10040 */ |
8605 PropertyAccess({Expression target, Token operator, SimpleIdentifier propertyNa
me}) : this.full(target, operator, propertyName); | 10041 PropertyAccess({Expression target, Token operator, SimpleIdentifier propertyNa
me}) : this.full(target, operator, propertyName); |
8606 accept(ASTVisitor visitor) => visitor.visitPropertyAccess(this); | 10042 accept(ASTVisitor visitor) => visitor.visitPropertyAccess(this); |
8607 Token get beginToken { | 10043 Token get beginToken { |
8608 if (_target != null) { | 10044 if (_target != null) { |
8609 return _target.beginToken; | 10045 return _target.beginToken; |
8610 } | 10046 } |
8611 return _operator; | 10047 return _operator; |
8612 } | 10048 } |
8613 Token get endToken => _propertyName.endToken; | 10049 Token get endToken => _propertyName.endToken; |
| 10050 |
8614 /** | 10051 /** |
8615 * Return the property access operator. | 10052 * Return the property access operator. |
8616 * @return the property access operator | 10053 * @return the property access operator |
8617 */ | 10054 */ |
8618 Token get operator => _operator; | 10055 Token get operator => _operator; |
| 10056 |
8619 /** | 10057 /** |
8620 * Return the name of the property being accessed. | 10058 * Return the name of the property being accessed. |
8621 * @return the name of the property being accessed | 10059 * @return the name of the property being accessed |
8622 */ | 10060 */ |
8623 SimpleIdentifier get propertyName => _propertyName; | 10061 SimpleIdentifier get propertyName => _propertyName; |
| 10062 |
8624 /** | 10063 /** |
8625 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not | 10064 * Return the expression used to compute the receiver of the invocation. If th
is invocation is not |
8626 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation | 10065 * part of a cascade expression, then this is the same as {@link #getTarget()}
. If this invocation |
8627 * is part of a cascade expression, then the target stored with the cascade ex
pression is | 10066 * is part of a cascade expression, then the target stored with the cascade ex
pression is |
8628 * returned. | 10067 * returned. |
8629 * @return the expression used to compute the receiver of the invocation | 10068 * @return the expression used to compute the receiver of the invocation |
8630 * @see #getTarget() | 10069 * @see #getTarget() |
8631 */ | 10070 */ |
8632 Expression get realTarget { | 10071 Expression get realTarget { |
8633 if (isCascaded()) { | 10072 if (isCascaded()) { |
8634 ASTNode ancestor = parent; | 10073 ASTNode ancestor = parent; |
8635 while (ancestor is! CascadeExpression) { | 10074 while (ancestor is! CascadeExpression) { |
8636 if (ancestor == null) { | 10075 if (ancestor == null) { |
8637 return _target; | 10076 return _target; |
8638 } | 10077 } |
8639 ancestor = ancestor.parent; | 10078 ancestor = ancestor.parent; |
8640 } | 10079 } |
8641 return ((ancestor as CascadeExpression)).target; | 10080 return ((ancestor as CascadeExpression)).target; |
8642 } | 10081 } |
8643 return _target; | 10082 return _target; |
8644 } | 10083 } |
| 10084 |
8645 /** | 10085 /** |
8646 * Return the expression computing the object defining the property being acce
ssed, or{@code null} if this property access is part of a cascade expression. | 10086 * Return the expression computing the object defining the property being acce
ssed, or{@code null} if this property access is part of a cascade expression. |
8647 * @return the expression computing the object defining the property being acc
essed | 10087 * @return the expression computing the object defining the property being acc
essed |
8648 * @see #getRealTarget() | 10088 * @see #getRealTarget() |
8649 */ | 10089 */ |
8650 Expression get target => _target; | 10090 Expression get target => _target; |
8651 bool isAssignable() => true; | 10091 bool isAssignable() => true; |
| 10092 |
8652 /** | 10093 /** |
8653 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this | 10094 * Return {@code true} if this expression is cascaded. If it is, then the targ
et of this |
8654 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. | 10095 * expression is not stored locally but is stored in the nearest ancestor that
is a{@link CascadeExpression}. |
8655 * @return {@code true} if this expression is cascaded | 10096 * @return {@code true} if this expression is cascaded |
8656 */ | 10097 */ |
8657 bool isCascaded() => _operator != null && identical(_operator.type, TokenType.
PERIOD_PERIOD); | 10098 bool isCascaded() => _operator != null && identical(_operator.type, TokenType.
PERIOD_PERIOD); |
| 10099 |
8658 /** | 10100 /** |
8659 * Set the property access operator to the given token. | 10101 * Set the property access operator to the given token. |
8660 * @param operator the property access operator | 10102 * @param operator the property access operator |
8661 */ | 10103 */ |
8662 void set operator(Token operator2) { | 10104 void set operator(Token operator2) { |
8663 this._operator = operator2; | 10105 this._operator = operator2; |
8664 } | 10106 } |
| 10107 |
8665 /** | 10108 /** |
8666 * Set the name of the property being accessed to the given identifier. | 10109 * Set the name of the property being accessed to the given identifier. |
8667 * @param identifier the name of the property being accessed | 10110 * @param identifier the name of the property being accessed |
8668 */ | 10111 */ |
8669 void set propertyName(SimpleIdentifier identifier) { | 10112 void set propertyName(SimpleIdentifier identifier) { |
8670 _propertyName = becomeParentOf(identifier); | 10113 _propertyName = becomeParentOf(identifier); |
8671 } | 10114 } |
| 10115 |
8672 /** | 10116 /** |
8673 * Set the expression computing the object defining the property being accesse
d to the given | 10117 * Set the expression computing the object defining the property being accesse
d to the given |
8674 * expression. | 10118 * expression. |
8675 * @param expression the expression computing the object defining the property
being accessed | 10119 * @param expression the expression computing the object defining the property
being accessed |
8676 */ | 10120 */ |
8677 void set target(Expression expression) { | 10121 void set target(Expression expression) { |
8678 _target = becomeParentOf(expression); | 10122 _target = becomeParentOf(expression); |
8679 } | 10123 } |
8680 void visitChildren(ASTVisitor<Object> visitor) { | 10124 void visitChildren(ASTVisitor<Object> visitor) { |
8681 safelyVisitChild(_target, visitor); | 10125 safelyVisitChild(_target, visitor); |
8682 safelyVisitChild(_propertyName, visitor); | 10126 safelyVisitChild(_propertyName, visitor); |
8683 } | 10127 } |
8684 } | 10128 } |
| 10129 |
8685 /** | 10130 /** |
8686 * Instances of the class {@code RedirectingConstructorInvocation} represent the
invocation of a | 10131 * Instances of the class {@code RedirectingConstructorInvocation} represent the
invocation of a |
8687 * another constructor in the same class from within a constructor's initializat
ion list. | 10132 * another constructor in the same class from within a constructor's initializat
ion list. |
8688 * <pre> | 10133 * <pre> |
8689 * redirectingConstructorInvocation ::= | 10134 * redirectingConstructorInvocation ::= |
8690 * 'this' ('.' identifier)? arguments | 10135 * 'this' ('.' identifier)? arguments |
8691 * </pre> | 10136 * </pre> |
8692 * @coverage dart.engine.ast | 10137 * @coverage dart.engine.ast |
8693 */ | 10138 */ |
8694 class RedirectingConstructorInvocation extends ConstructorInitializer { | 10139 class RedirectingConstructorInvocation extends ConstructorInitializer { |
| 10140 |
8695 /** | 10141 /** |
8696 * The token for the 'this' keyword. | 10142 * The token for the 'this' keyword. |
8697 */ | 10143 */ |
8698 Token _keyword; | 10144 Token _keyword; |
| 10145 |
8699 /** | 10146 /** |
8700 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. | 10147 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. |
8701 */ | 10148 */ |
8702 Token _period; | 10149 Token _period; |
| 10150 |
8703 /** | 10151 /** |
8704 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor | 10152 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor |
8705 * is being invoked. | 10153 * is being invoked. |
8706 */ | 10154 */ |
8707 SimpleIdentifier _constructorName; | 10155 SimpleIdentifier _constructorName; |
| 10156 |
8708 /** | 10157 /** |
8709 * The list of arguments to the constructor. | 10158 * The list of arguments to the constructor. |
8710 */ | 10159 */ |
8711 ArgumentList _argumentList; | 10160 ArgumentList _argumentList; |
| 10161 |
8712 /** | 10162 /** |
8713 * The element associated with the constructor, or {@code null} if the AST str
ucture has not been | 10163 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. |
8714 * resolved or if the constructor could not be resolved. | |
8715 */ | 10164 */ |
8716 ConstructorElement _element; | 10165 ConstructorElement _staticElement; |
| 10166 |
| 10167 /** |
| 10168 * The element associated with the constructor based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if the const
ructor could not be |
| 10169 * resolved. |
| 10170 */ |
| 10171 ConstructorElement _propagatedElement; |
| 10172 |
8717 /** | 10173 /** |
8718 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name | 10174 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name |
8719 * with the given arguments. | 10175 * with the given arguments. |
8720 * @param keyword the token for the 'this' keyword | 10176 * @param keyword the token for the 'this' keyword |
8721 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10177 * @param period the token for the period before the name of the constructor t
hat is being invoked |
8722 * @param constructorName the name of the constructor that is being invoked | 10178 * @param constructorName the name of the constructor that is being invoked |
8723 * @param argumentList the list of arguments to the constructor | 10179 * @param argumentList the list of arguments to the constructor |
8724 */ | 10180 */ |
8725 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent
ifier constructorName, ArgumentList argumentList) { | 10181 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent
ifier constructorName, ArgumentList argumentList) { |
8726 this._keyword = keyword; | 10182 this._keyword = keyword; |
8727 this._period = period; | 10183 this._period = period; |
8728 this._constructorName = becomeParentOf(constructorName); | 10184 this._constructorName = becomeParentOf(constructorName); |
8729 this._argumentList = becomeParentOf(argumentList); | 10185 this._argumentList = becomeParentOf(argumentList); |
8730 } | 10186 } |
| 10187 |
8731 /** | 10188 /** |
8732 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name | 10189 * Initialize a newly created redirecting invocation to invoke the constructor
with the given name |
8733 * with the given arguments. | 10190 * with the given arguments. |
8734 * @param keyword the token for the 'this' keyword | 10191 * @param keyword the token for the 'this' keyword |
8735 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10192 * @param period the token for the period before the name of the constructor t
hat is being invoked |
8736 * @param constructorName the name of the constructor that is being invoked | 10193 * @param constructorName the name of the constructor that is being invoked |
8737 * @param argumentList the list of arguments to the constructor | 10194 * @param argumentList the list of arguments to the constructor |
8738 */ | 10195 */ |
8739 RedirectingConstructorInvocation({Token keyword, Token period, SimpleIdentifie
r constructorName, ArgumentList argumentList}) : this.full(keyword, period, cons
tructorName, argumentList); | 10196 RedirectingConstructorInvocation({Token keyword, Token period, SimpleIdentifie
r constructorName, ArgumentList argumentList}) : this.full(keyword, period, cons
tructorName, argumentList); |
8740 accept(ASTVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th
is); | 10197 accept(ASTVisitor visitor) => visitor.visitRedirectingConstructorInvocation(th
is); |
| 10198 |
8741 /** | 10199 /** |
8742 * Return the list of arguments to the constructor. | 10200 * Return the list of arguments to the constructor. |
8743 * @return the list of arguments to the constructor | 10201 * @return the list of arguments to the constructor |
8744 */ | 10202 */ |
8745 ArgumentList get argumentList => _argumentList; | 10203 ArgumentList get argumentList => _argumentList; |
8746 Token get beginToken => _keyword; | 10204 Token get beginToken => _keyword; |
| 10205 |
8747 /** | 10206 /** |
8748 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed | 10207 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed |
8749 * constructor is being invoked. | 10208 * constructor is being invoked. |
8750 * @return the name of the constructor that is being invoked | 10209 * @return the name of the constructor that is being invoked |
8751 */ | 10210 */ |
8752 SimpleIdentifier get constructorName => _constructorName; | 10211 SimpleIdentifier get constructorName => _constructorName; |
| 10212 |
8753 /** | 10213 /** |
8754 * Return the element associated with the constructor, or {@code null} if the
AST structure has | 10214 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be |
8755 * not been resolved or if the constructor could not be resolved. | 10215 * resolved. |
8756 * @return the element associated with the super constructor | 10216 * @return the element associated with the super constructor |
8757 */ | 10217 */ |
8758 ConstructorElement get element => _element; | 10218 ConstructorElement get element => _propagatedElement; |
8759 Token get endToken => _argumentList.endToken; | 10219 Token get endToken => _argumentList.endToken; |
| 10220 |
8760 /** | 10221 /** |
8761 * Return the token for the 'this' keyword. | 10222 * Return the token for the 'this' keyword. |
8762 * @return the token for the 'this' keyword | 10223 * @return the token for the 'this' keyword |
8763 */ | 10224 */ |
8764 Token get keyword => _keyword; | 10225 Token get keyword => _keyword; |
| 10226 |
8765 /** | 10227 /** |
8766 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. | 10228 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. |
8767 * @return the token for the period before the name of the constructor that is
being invoked | 10229 * @return the token for the period before the name of the constructor that is
being invoked |
8768 */ | 10230 */ |
8769 Token get period => _period; | 10231 Token get period => _period; |
| 10232 |
| 10233 /** |
| 10234 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be |
| 10235 * resolved. |
| 10236 * @return the element associated with the constructor |
| 10237 */ |
| 10238 ConstructorElement get staticElement => _staticElement; |
| 10239 |
8770 /** | 10240 /** |
8771 * Set the list of arguments to the constructor to the given list. | 10241 * Set the list of arguments to the constructor to the given list. |
8772 * @param argumentList the list of arguments to the constructor | 10242 * @param argumentList the list of arguments to the constructor |
8773 */ | 10243 */ |
8774 void set argumentList(ArgumentList argumentList2) { | 10244 void set argumentList(ArgumentList argumentList2) { |
8775 this._argumentList = becomeParentOf(argumentList2); | 10245 this._argumentList = becomeParentOf(argumentList2); |
8776 } | 10246 } |
| 10247 |
8777 /** | 10248 /** |
8778 * Set the name of the constructor that is being invoked to the given identifi
er. | 10249 * Set the name of the constructor that is being invoked to the given identifi
er. |
8779 * @param identifier the name of the constructor that is being invoked | 10250 * @param identifier the name of the constructor that is being invoked |
8780 */ | 10251 */ |
8781 void set constructorName(SimpleIdentifier identifier) { | 10252 void set constructorName(SimpleIdentifier identifier) { |
8782 _constructorName = becomeParentOf(identifier); | 10253 _constructorName = becomeParentOf(identifier); |
8783 } | 10254 } |
| 10255 |
8784 /** | 10256 /** |
8785 * Set the element associated with the constructor to the given element. | 10257 * Set the element associated with the constructor based on propagated type in
formation to the |
8786 * @param element the element associated with the constructor | 10258 * given element. |
| 10259 * @param element the element to be associated with the constructor |
8787 */ | 10260 */ |
8788 void set element(ConstructorElement element2) { | 10261 void set element(ConstructorElement element2) { |
8789 this._element = element2; | 10262 _propagatedElement = element2; |
8790 } | 10263 } |
| 10264 |
8791 /** | 10265 /** |
8792 * Set the token for the 'this' keyword to the given token. | 10266 * Set the token for the 'this' keyword to the given token. |
8793 * @param keyword the token for the 'this' keyword | 10267 * @param keyword the token for the 'this' keyword |
8794 */ | 10268 */ |
8795 void set keyword(Token keyword2) { | 10269 void set keyword(Token keyword2) { |
8796 this._keyword = keyword2; | 10270 this._keyword = keyword2; |
8797 } | 10271 } |
| 10272 |
8798 /** | 10273 /** |
8799 * Set the token for the period before the name of the constructor that is bei
ng invoked to the | 10274 * Set the token for the period before the name of the constructor that is bei
ng invoked to the |
8800 * given token. | 10275 * given token. |
8801 * @param period the token for the period before the name of the constructor t
hat is being invoked | 10276 * @param period the token for the period before the name of the constructor t
hat is being invoked |
8802 */ | 10277 */ |
8803 void set period(Token period2) { | 10278 void set period(Token period2) { |
8804 this._period = period2; | 10279 this._period = period2; |
8805 } | 10280 } |
| 10281 |
| 10282 /** |
| 10283 * Set the element associated with the constructor based on static type inform
ation to the given |
| 10284 * element. |
| 10285 * @param element the element to be associated with the constructor |
| 10286 */ |
| 10287 void set staticElement(ConstructorElement element) { |
| 10288 this._staticElement = element; |
| 10289 } |
8806 void visitChildren(ASTVisitor<Object> visitor) { | 10290 void visitChildren(ASTVisitor<Object> visitor) { |
8807 safelyVisitChild(_constructorName, visitor); | 10291 safelyVisitChild(_constructorName, visitor); |
8808 safelyVisitChild(_argumentList, visitor); | 10292 safelyVisitChild(_argumentList, visitor); |
8809 } | 10293 } |
8810 } | 10294 } |
| 10295 |
8811 /** | 10296 /** |
8812 * Instances of the class {@code RethrowExpression} represent a rethrow expressi
on. | 10297 * Instances of the class {@code RethrowExpression} represent a rethrow expressi
on. |
8813 * <pre> | 10298 * <pre> |
8814 * rethrowExpression ::= | 10299 * rethrowExpression ::= |
8815 * 'rethrow' | 10300 * 'rethrow' |
8816 * </pre> | 10301 * </pre> |
8817 * @coverage dart.engine.ast | 10302 * @coverage dart.engine.ast |
8818 */ | 10303 */ |
8819 class RethrowExpression extends Expression { | 10304 class RethrowExpression extends Expression { |
| 10305 |
8820 /** | 10306 /** |
8821 * The token representing the 'rethrow' keyword. | 10307 * The token representing the 'rethrow' keyword. |
8822 */ | 10308 */ |
8823 Token _keyword; | 10309 Token _keyword; |
| 10310 |
8824 /** | 10311 /** |
8825 * Initialize a newly created rethrow expression. | 10312 * Initialize a newly created rethrow expression. |
8826 * @param keyword the token representing the 'rethrow' keyword | 10313 * @param keyword the token representing the 'rethrow' keyword |
8827 */ | 10314 */ |
8828 RethrowExpression.full(Token keyword) { | 10315 RethrowExpression.full(Token keyword) { |
8829 this._keyword = keyword; | 10316 this._keyword = keyword; |
8830 } | 10317 } |
| 10318 |
8831 /** | 10319 /** |
8832 * Initialize a newly created rethrow expression. | 10320 * Initialize a newly created rethrow expression. |
8833 * @param keyword the token representing the 'rethrow' keyword | 10321 * @param keyword the token representing the 'rethrow' keyword |
8834 */ | 10322 */ |
8835 RethrowExpression({Token keyword}) : this.full(keyword); | 10323 RethrowExpression({Token keyword}) : this.full(keyword); |
8836 accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this); | 10324 accept(ASTVisitor visitor) => visitor.visitRethrowExpression(this); |
8837 Token get beginToken => _keyword; | 10325 Token get beginToken => _keyword; |
8838 Token get endToken => _keyword; | 10326 Token get endToken => _keyword; |
| 10327 |
8839 /** | 10328 /** |
8840 * Return the token representing the 'rethrow' keyword. | 10329 * Return the token representing the 'rethrow' keyword. |
8841 * @return the token representing the 'rethrow' keyword | 10330 * @return the token representing the 'rethrow' keyword |
8842 */ | 10331 */ |
8843 Token get keyword => _keyword; | 10332 Token get keyword => _keyword; |
| 10333 |
8844 /** | 10334 /** |
8845 * Set the token representing the 'rethrow' keyword to the given token. | 10335 * Set the token representing the 'rethrow' keyword to the given token. |
8846 * @param keyword the token representing the 'rethrow' keyword | 10336 * @param keyword the token representing the 'rethrow' keyword |
8847 */ | 10337 */ |
8848 void set keyword(Token keyword2) { | 10338 void set keyword(Token keyword2) { |
8849 this._keyword = keyword2; | 10339 this._keyword = keyword2; |
8850 } | 10340 } |
8851 void visitChildren(ASTVisitor<Object> visitor) { | 10341 void visitChildren(ASTVisitor<Object> visitor) { |
8852 } | 10342 } |
8853 } | 10343 } |
| 10344 |
8854 /** | 10345 /** |
8855 * Instances of the class {@code ReturnStatement} represent a return statement. | 10346 * Instances of the class {@code ReturnStatement} represent a return statement. |
8856 * <pre> | 10347 * <pre> |
8857 * returnStatement ::= | 10348 * returnStatement ::= |
8858 * 'return' {@link Expression expression}? ';' | 10349 * 'return' {@link Expression expression}? ';' |
8859 * </pre> | 10350 * </pre> |
8860 * @coverage dart.engine.ast | 10351 * @coverage dart.engine.ast |
8861 */ | 10352 */ |
8862 class ReturnStatement extends Statement { | 10353 class ReturnStatement extends Statement { |
| 10354 |
8863 /** | 10355 /** |
8864 * The token representing the 'return' keyword. | 10356 * The token representing the 'return' keyword. |
8865 */ | 10357 */ |
8866 Token _keyword; | 10358 Token _keyword; |
| 10359 |
8867 /** | 10360 /** |
8868 * The expression computing the value to be returned, or {@code null} if no ex
plicit value was | 10361 * The expression computing the value to be returned, or {@code null} if no ex
plicit value was |
8869 * provided. | 10362 * provided. |
8870 */ | 10363 */ |
8871 Expression _expression; | 10364 Expression _expression; |
| 10365 |
8872 /** | 10366 /** |
8873 * The semicolon terminating the statement. | 10367 * The semicolon terminating the statement. |
8874 */ | 10368 */ |
8875 Token _semicolon; | 10369 Token _semicolon; |
| 10370 |
8876 /** | 10371 /** |
8877 * Initialize a newly created return statement. | 10372 * Initialize a newly created return statement. |
8878 * @param keyword the token representing the 'return' keyword | 10373 * @param keyword the token representing the 'return' keyword |
8879 * @param expression the expression computing the value to be returned | 10374 * @param expression the expression computing the value to be returned |
8880 * @param semicolon the semicolon terminating the statement | 10375 * @param semicolon the semicolon terminating the statement |
8881 */ | 10376 */ |
8882 ReturnStatement.full(Token keyword, Expression expression, Token semicolon) { | 10377 ReturnStatement.full(Token keyword, Expression expression, Token semicolon) { |
8883 this._keyword = keyword; | 10378 this._keyword = keyword; |
8884 this._expression = becomeParentOf(expression); | 10379 this._expression = becomeParentOf(expression); |
8885 this._semicolon = semicolon; | 10380 this._semicolon = semicolon; |
8886 } | 10381 } |
| 10382 |
8887 /** | 10383 /** |
8888 * Initialize a newly created return statement. | 10384 * Initialize a newly created return statement. |
8889 * @param keyword the token representing the 'return' keyword | 10385 * @param keyword the token representing the 'return' keyword |
8890 * @param expression the expression computing the value to be returned | 10386 * @param expression the expression computing the value to be returned |
8891 * @param semicolon the semicolon terminating the statement | 10387 * @param semicolon the semicolon terminating the statement |
8892 */ | 10388 */ |
8893 ReturnStatement({Token keyword, Expression expression, Token semicolon}) : thi
s.full(keyword, expression, semicolon); | 10389 ReturnStatement({Token keyword, Expression expression, Token semicolon}) : thi
s.full(keyword, expression, semicolon); |
8894 accept(ASTVisitor visitor) => visitor.visitReturnStatement(this); | 10390 accept(ASTVisitor visitor) => visitor.visitReturnStatement(this); |
8895 Token get beginToken => _keyword; | 10391 Token get beginToken => _keyword; |
8896 Token get endToken => _semicolon; | 10392 Token get endToken => _semicolon; |
| 10393 |
8897 /** | 10394 /** |
8898 * Return the expression computing the value to be returned, or {@code null} i
f no explicit value | 10395 * Return the expression computing the value to be returned, or {@code null} i
f no explicit value |
8899 * was provided. | 10396 * was provided. |
8900 * @return the expression computing the value to be returned | 10397 * @return the expression computing the value to be returned |
8901 */ | 10398 */ |
8902 Expression get expression => _expression; | 10399 Expression get expression => _expression; |
| 10400 |
8903 /** | 10401 /** |
8904 * Return the token representing the 'return' keyword. | 10402 * Return the token representing the 'return' keyword. |
8905 * @return the token representing the 'return' keyword | 10403 * @return the token representing the 'return' keyword |
8906 */ | 10404 */ |
8907 Token get keyword => _keyword; | 10405 Token get keyword => _keyword; |
| 10406 |
8908 /** | 10407 /** |
8909 * Return the semicolon terminating the statement. | 10408 * Return the semicolon terminating the statement. |
8910 * @return the semicolon terminating the statement | 10409 * @return the semicolon terminating the statement |
8911 */ | 10410 */ |
8912 Token get semicolon => _semicolon; | 10411 Token get semicolon => _semicolon; |
| 10412 |
8913 /** | 10413 /** |
8914 * Set the expression computing the value to be returned to the given expressi
on. | 10414 * Set the expression computing the value to be returned to the given expressi
on. |
8915 * @param expression the expression computing the value to be returned | 10415 * @param expression the expression computing the value to be returned |
8916 */ | 10416 */ |
8917 void set expression(Expression expression2) { | 10417 void set expression(Expression expression2) { |
8918 this._expression = becomeParentOf(expression2); | 10418 this._expression = becomeParentOf(expression2); |
8919 } | 10419 } |
| 10420 |
8920 /** | 10421 /** |
8921 * Set the token representing the 'return' keyword to the given token. | 10422 * Set the token representing the 'return' keyword to the given token. |
8922 * @param keyword the token representing the 'return' keyword | 10423 * @param keyword the token representing the 'return' keyword |
8923 */ | 10424 */ |
8924 void set keyword(Token keyword2) { | 10425 void set keyword(Token keyword2) { |
8925 this._keyword = keyword2; | 10426 this._keyword = keyword2; |
8926 } | 10427 } |
| 10428 |
8927 /** | 10429 /** |
8928 * Set the semicolon terminating the statement to the given token. | 10430 * Set the semicolon terminating the statement to the given token. |
8929 * @param semicolon the semicolon terminating the statement | 10431 * @param semicolon the semicolon terminating the statement |
8930 */ | 10432 */ |
8931 void set semicolon(Token semicolon2) { | 10433 void set semicolon(Token semicolon2) { |
8932 this._semicolon = semicolon2; | 10434 this._semicolon = semicolon2; |
8933 } | 10435 } |
8934 void visitChildren(ASTVisitor<Object> visitor) { | 10436 void visitChildren(ASTVisitor<Object> visitor) { |
8935 safelyVisitChild(_expression, visitor); | 10437 safelyVisitChild(_expression, visitor); |
8936 } | 10438 } |
8937 } | 10439 } |
| 10440 |
8938 /** | 10441 /** |
8939 * Instances of the class {@code ScriptTag} represent the script tag that can op
tionally occur at | 10442 * Instances of the class {@code ScriptTag} represent the script tag that can op
tionally occur at |
8940 * the beginning of a compilation unit. | 10443 * the beginning of a compilation unit. |
8941 * <pre> | 10444 * <pre> |
8942 * scriptTag ::= | 10445 * scriptTag ::= |
8943 * '#!' (~NEWLINE)* NEWLINE | 10446 * '#!' (~NEWLINE)* NEWLINE |
8944 * </pre> | 10447 * </pre> |
8945 * @coverage dart.engine.ast | 10448 * @coverage dart.engine.ast |
8946 */ | 10449 */ |
8947 class ScriptTag extends ASTNode { | 10450 class ScriptTag extends ASTNode { |
| 10451 |
8948 /** | 10452 /** |
8949 * The token representing this script tag. | 10453 * The token representing this script tag. |
8950 */ | 10454 */ |
8951 Token _scriptTag; | 10455 Token _scriptTag; |
| 10456 |
8952 /** | 10457 /** |
8953 * Initialize a newly created script tag. | 10458 * Initialize a newly created script tag. |
8954 * @param scriptTag the token representing this script tag | 10459 * @param scriptTag the token representing this script tag |
8955 */ | 10460 */ |
8956 ScriptTag.full(Token scriptTag) { | 10461 ScriptTag.full(Token scriptTag) { |
8957 this._scriptTag = scriptTag; | 10462 this._scriptTag = scriptTag; |
8958 } | 10463 } |
| 10464 |
8959 /** | 10465 /** |
8960 * Initialize a newly created script tag. | 10466 * Initialize a newly created script tag. |
8961 * @param scriptTag the token representing this script tag | 10467 * @param scriptTag the token representing this script tag |
8962 */ | 10468 */ |
8963 ScriptTag({Token scriptTag}) : this.full(scriptTag); | 10469 ScriptTag({Token scriptTag}) : this.full(scriptTag); |
8964 accept(ASTVisitor visitor) => visitor.visitScriptTag(this); | 10470 accept(ASTVisitor visitor) => visitor.visitScriptTag(this); |
8965 Token get beginToken => _scriptTag; | 10471 Token get beginToken => _scriptTag; |
8966 Token get endToken => _scriptTag; | 10472 Token get endToken => _scriptTag; |
| 10473 |
8967 /** | 10474 /** |
8968 * Return the token representing this script tag. | 10475 * Return the token representing this script tag. |
8969 * @return the token representing this script tag | 10476 * @return the token representing this script tag |
8970 */ | 10477 */ |
8971 Token get scriptTag => _scriptTag; | 10478 Token get scriptTag => _scriptTag; |
| 10479 |
8972 /** | 10480 /** |
8973 * Set the token representing this script tag to the given script tag. | 10481 * Set the token representing this script tag to the given script tag. |
8974 * @param scriptTag the token representing this script tag | 10482 * @param scriptTag the token representing this script tag |
8975 */ | 10483 */ |
8976 void set scriptTag(Token scriptTag2) { | 10484 void set scriptTag(Token scriptTag2) { |
8977 this._scriptTag = scriptTag2; | 10485 this._scriptTag = scriptTag2; |
8978 } | 10486 } |
8979 void visitChildren(ASTVisitor<Object> visitor) { | 10487 void visitChildren(ASTVisitor<Object> visitor) { |
8980 } | 10488 } |
8981 } | 10489 } |
| 10490 |
8982 /** | 10491 /** |
8983 * Instances of the class {@code ShowCombinator} represent a combinator that res
tricts the names | 10492 * Instances of the class {@code ShowCombinator} represent a combinator that res
tricts the names |
8984 * being imported to those in a given list. | 10493 * being imported to those in a given list. |
8985 * <pre> | 10494 * <pre> |
8986 * showCombinator ::= | 10495 * showCombinator ::= |
8987 * 'show' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) | 10496 * 'show' {@link SimpleIdentifier identifier} (',' {@link SimpleIdentifier ident
ifier}) |
8988 * </pre> | 10497 * </pre> |
8989 * @coverage dart.engine.ast | 10498 * @coverage dart.engine.ast |
8990 */ | 10499 */ |
8991 class ShowCombinator extends Combinator { | 10500 class ShowCombinator extends Combinator { |
| 10501 |
8992 /** | 10502 /** |
8993 * The list of names from the library that are made visible by this combinator
. | 10503 * The list of names from the library that are made visible by this combinator
. |
8994 */ | 10504 */ |
8995 NodeList<SimpleIdentifier> _shownNames; | 10505 NodeList<SimpleIdentifier> _shownNames; |
| 10506 |
8996 /** | 10507 /** |
8997 * Initialize a newly created import show combinator. | 10508 * Initialize a newly created import show combinator. |
8998 * @param keyword the comma introducing the combinator | 10509 * @param keyword the comma introducing the combinator |
8999 * @param shownNames the list of names from the library that are made visible
by this combinator | 10510 * @param shownNames the list of names from the library that are made visible
by this combinator |
9000 */ | 10511 */ |
9001 ShowCombinator.full(Token keyword, List<SimpleIdentifier> shownNames) : super.
full(keyword) { | 10512 ShowCombinator.full(Token keyword, List<SimpleIdentifier> shownNames) : super.
full(keyword) { |
9002 this._shownNames = new NodeList<SimpleIdentifier>(this); | 10513 this._shownNames = new NodeList<SimpleIdentifier>(this); |
9003 this._shownNames.addAll(shownNames); | 10514 this._shownNames.addAll(shownNames); |
9004 } | 10515 } |
| 10516 |
9005 /** | 10517 /** |
9006 * Initialize a newly created import show combinator. | 10518 * Initialize a newly created import show combinator. |
9007 * @param keyword the comma introducing the combinator | 10519 * @param keyword the comma introducing the combinator |
9008 * @param shownNames the list of names from the library that are made visible
by this combinator | 10520 * @param shownNames the list of names from the library that are made visible
by this combinator |
9009 */ | 10521 */ |
9010 ShowCombinator({Token keyword, List<SimpleIdentifier> shownNames}) : this.full
(keyword, shownNames); | 10522 ShowCombinator({Token keyword, List<SimpleIdentifier> shownNames}) : this.full
(keyword, shownNames); |
9011 accept(ASTVisitor visitor) => visitor.visitShowCombinator(this); | 10523 accept(ASTVisitor visitor) => visitor.visitShowCombinator(this); |
9012 Token get endToken => _shownNames.endToken; | 10524 Token get endToken => _shownNames.endToken; |
| 10525 |
9013 /** | 10526 /** |
9014 * Return the list of names from the library that are made visible by this com
binator. | 10527 * Return the list of names from the library that are made visible by this com
binator. |
9015 * @return the list of names from the library that are made visible by this co
mbinator | 10528 * @return the list of names from the library that are made visible by this co
mbinator |
9016 */ | 10529 */ |
9017 NodeList<SimpleIdentifier> get shownNames => _shownNames; | 10530 NodeList<SimpleIdentifier> get shownNames => _shownNames; |
9018 void visitChildren(ASTVisitor<Object> visitor) { | 10531 void visitChildren(ASTVisitor<Object> visitor) { |
9019 _shownNames.accept(visitor); | 10532 _shownNames.accept(visitor); |
9020 } | 10533 } |
9021 } | 10534 } |
| 10535 |
9022 /** | 10536 /** |
9023 * Instances of the class {@code SimpleFormalParameter} represent a simple forma
l parameter. | 10537 * Instances of the class {@code SimpleFormalParameter} represent a simple forma
l parameter. |
9024 * <pre> | 10538 * <pre> |
9025 * simpleFormalParameter ::= | 10539 * simpleFormalParameter ::= |
9026 * ('final' {@link TypeName type} | 'var' | {@link TypeName type})? {@link Simpl
eIdentifier identifier}</pre> | 10540 * ('final' {@link TypeName type} | 'var' | {@link TypeName type})? {@link Simpl
eIdentifier identifier}</pre> |
9027 * @coverage dart.engine.ast | 10541 * @coverage dart.engine.ast |
9028 */ | 10542 */ |
9029 class SimpleFormalParameter extends NormalFormalParameter { | 10543 class SimpleFormalParameter extends NormalFormalParameter { |
| 10544 |
9030 /** | 10545 /** |
9031 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 10546 * The token representing either the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
9032 * keyword was used. | 10547 * keyword was used. |
9033 */ | 10548 */ |
9034 Token _keyword; | 10549 Token _keyword; |
| 10550 |
9035 /** | 10551 /** |
9036 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have | 10552 * The name of the declared type of the parameter, or {@code null} if the para
meter does not have |
9037 * a declared type. | 10553 * a declared type. |
9038 */ | 10554 */ |
9039 TypeName _type; | 10555 TypeName _type; |
| 10556 |
9040 /** | 10557 /** |
9041 * Initialize a newly created formal parameter. | 10558 * Initialize a newly created formal parameter. |
9042 * @param comment the documentation comment associated with this parameter | 10559 * @param comment the documentation comment associated with this parameter |
9043 * @param metadata the annotations associated with this parameter | 10560 * @param metadata the annotations associated with this parameter |
9044 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 10561 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
9045 * @param type the name of the declared type of the parameter | 10562 * @param type the name of the declared type of the parameter |
9046 * @param identifier the name of the parameter being declared | 10563 * @param identifier the name of the parameter being declared |
9047 */ | 10564 */ |
9048 SimpleFormalParameter.full(Comment comment, List<Annotation> metadata, Token k
eyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metada
ta, identifier) { | 10565 SimpleFormalParameter.full(Comment comment, List<Annotation> metadata, Token k
eyword, TypeName type, SimpleIdentifier identifier) : super.full(comment, metada
ta, identifier) { |
9049 this._keyword = keyword; | 10566 this._keyword = keyword; |
9050 this._type = becomeParentOf(type); | 10567 this._type = becomeParentOf(type); |
9051 } | 10568 } |
| 10569 |
9052 /** | 10570 /** |
9053 * Initialize a newly created formal parameter. | 10571 * Initialize a newly created formal parameter. |
9054 * @param comment the documentation comment associated with this parameter | 10572 * @param comment the documentation comment associated with this parameter |
9055 * @param metadata the annotations associated with this parameter | 10573 * @param metadata the annotations associated with this parameter |
9056 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 10574 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
9057 * @param type the name of the declared type of the parameter | 10575 * @param type the name of the declared type of the parameter |
9058 * @param identifier the name of the parameter being declared | 10576 * @param identifier the name of the parameter being declared |
9059 */ | 10577 */ |
9060 SimpleFormalParameter({Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata,
keyword, type, identifier); | 10578 SimpleFormalParameter({Comment comment, List<Annotation> metadata, Token keywo
rd, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata,
keyword, type, identifier); |
9061 accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this); | 10579 accept(ASTVisitor visitor) => visitor.visitSimpleFormalParameter(this); |
9062 Token get beginToken { | 10580 Token get beginToken { |
9063 if (_keyword != null) { | 10581 if (_keyword != null) { |
9064 return _keyword; | 10582 return _keyword; |
9065 } else if (_type != null) { | 10583 } else if (_type != null) { |
9066 return _type.beginToken; | 10584 return _type.beginToken; |
9067 } | 10585 } |
9068 return identifier.beginToken; | 10586 return identifier.beginToken; |
9069 } | 10587 } |
9070 Token get endToken => identifier.endToken; | 10588 Token get endToken => identifier.endToken; |
| 10589 |
9071 /** | 10590 /** |
9072 * Return the token representing either the 'final', 'const' or 'var' keyword. | 10591 * Return the token representing either the 'final', 'const' or 'var' keyword. |
9073 * @return the token representing either the 'final', 'const' or 'var' keyword | 10592 * @return the token representing either the 'final', 'const' or 'var' keyword |
9074 */ | 10593 */ |
9075 Token get keyword => _keyword; | 10594 Token get keyword => _keyword; |
| 10595 |
9076 /** | 10596 /** |
9077 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does | 10597 * Return the name of the declared type of the parameter, or {@code null} if t
he parameter does |
9078 * not have a declared type. | 10598 * not have a declared type. |
9079 * @return the name of the declared type of the parameter | 10599 * @return the name of the declared type of the parameter |
9080 */ | 10600 */ |
9081 TypeName get type => _type; | 10601 TypeName get type => _type; |
9082 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); | 10602 bool isConst() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.CONST); |
9083 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); | 10603 bool isFinal() => (_keyword is KeywordToken) && identical(((_keyword as Keywor
dToken)).keyword, Keyword.FINAL); |
| 10604 |
9084 /** | 10605 /** |
9085 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. | 10606 * Set the token representing either the 'final', 'const' or 'var' keyword to
the given token. |
9086 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword | 10607 * @param keyword the token representing either the 'final', 'const' or 'var'
keyword |
9087 */ | 10608 */ |
9088 void set keyword(Token keyword2) { | 10609 void set keyword(Token keyword2) { |
9089 this._keyword = keyword2; | 10610 this._keyword = keyword2; |
9090 } | 10611 } |
| 10612 |
9091 /** | 10613 /** |
9092 * Set the name of the declared type of the parameter to the given type name. | 10614 * Set the name of the declared type of the parameter to the given type name. |
9093 * @param typeName the name of the declared type of the parameter | 10615 * @param typeName the name of the declared type of the parameter |
9094 */ | 10616 */ |
9095 void set type(TypeName typeName) { | 10617 void set type(TypeName typeName) { |
9096 _type = becomeParentOf(typeName); | 10618 _type = becomeParentOf(typeName); |
9097 } | 10619 } |
9098 void visitChildren(ASTVisitor<Object> visitor) { | 10620 void visitChildren(ASTVisitor<Object> visitor) { |
9099 super.visitChildren(visitor); | 10621 super.visitChildren(visitor); |
9100 safelyVisitChild(_type, visitor); | 10622 safelyVisitChild(_type, visitor); |
9101 safelyVisitChild(identifier, visitor); | 10623 safelyVisitChild(identifier, visitor); |
9102 } | 10624 } |
9103 } | 10625 } |
| 10626 |
9104 /** | 10627 /** |
9105 * Instances of the class {@code SimpleIdentifier} represent a simple identifier
. | 10628 * Instances of the class {@code SimpleIdentifier} represent a simple identifier
. |
9106 * <pre> | 10629 * <pre> |
9107 * simpleIdentifier ::= | 10630 * simpleIdentifier ::= |
9108 * initialCharacter internalCharacter | 10631 * initialCharacter internalCharacter |
9109 * initialCharacter ::= '_' | '$' | letter | 10632 * initialCharacter ::= '_' | '$' | letter |
9110 * internalCharacter ::= '_' | '$' | letter | digit | 10633 * internalCharacter ::= '_' | '$' | letter | digit |
9111 * </pre> | 10634 * </pre> |
9112 * @coverage dart.engine.ast | 10635 * @coverage dart.engine.ast |
9113 */ | 10636 */ |
9114 class SimpleIdentifier extends Identifier { | 10637 class SimpleIdentifier extends Identifier { |
| 10638 |
9115 /** | 10639 /** |
9116 * The token representing the identifier. | 10640 * The token representing the identifier. |
9117 */ | 10641 */ |
9118 Token _token; | 10642 Token _token; |
| 10643 |
9119 /** | 10644 /** |
9120 * The element associated with this identifier, or {@code null} if the AST str
ucture has not been | 10645 * The element associated with this identifier based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if this identifi
er could not be resolved. |
9121 * resolved or if this identifier could not be resolved. | |
9122 */ | 10646 */ |
9123 Element _element; | 10647 Element _staticElement; |
| 10648 |
| 10649 /** |
| 10650 * The element associated with this identifier based on propagated type inform
ation, or{@code null} if the AST structure has not been resolved or if this iden
tifier could not be |
| 10651 * resolved. |
| 10652 */ |
| 10653 Element _propagatedElement; |
| 10654 |
9124 /** | 10655 /** |
9125 * Initialize a newly created identifier. | 10656 * Initialize a newly created identifier. |
9126 * @param token the token representing the identifier | 10657 * @param token the token representing the identifier |
9127 */ | 10658 */ |
9128 SimpleIdentifier.full(Token token) { | 10659 SimpleIdentifier.full(Token token) { |
9129 this._token = token; | 10660 this._token = token; |
9130 } | 10661 } |
| 10662 |
9131 /** | 10663 /** |
9132 * Initialize a newly created identifier. | 10664 * Initialize a newly created identifier. |
9133 * @param token the token representing the identifier | 10665 * @param token the token representing the identifier |
9134 */ | 10666 */ |
9135 SimpleIdentifier({Token token}) : this.full(token); | 10667 SimpleIdentifier({Token token}) : this.full(token); |
9136 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); | 10668 accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this); |
9137 Token get beginToken => _token; | 10669 Token get beginToken => _token; |
9138 Element get element => _element; | 10670 Element get element => _propagatedElement; |
9139 Token get endToken => _token; | 10671 Token get endToken => _token; |
9140 String get name => _token.lexeme; | 10672 String get name => _token.lexeme; |
| 10673 Element get staticElement => _staticElement; |
| 10674 |
9141 /** | 10675 /** |
9142 * Return the token representing the identifier. | 10676 * Return the token representing the identifier. |
9143 * @return the token representing the identifier | 10677 * @return the token representing the identifier |
9144 */ | 10678 */ |
9145 Token get token => _token; | 10679 Token get token => _token; |
| 10680 |
9146 /** | 10681 /** |
9147 * Return {@code true} if this identifier is the name being declared in a decl
aration. | 10682 * Return {@code true} if this identifier is the name being declared in a decl
aration. |
9148 * @return {@code true} if this identifier is the name being declared in a dec
laration | 10683 * @return {@code true} if this identifier is the name being declared in a dec
laration |
9149 */ | 10684 */ |
9150 bool inDeclarationContext() { | 10685 bool inDeclarationContext() { |
9151 ASTNode parent2 = parent; | 10686 ASTNode parent2 = parent; |
9152 if (parent2 is CatchClause) { | 10687 if (parent2 is CatchClause) { |
9153 CatchClause clause = parent2 as CatchClause; | 10688 CatchClause clause = parent2 as CatchClause; |
9154 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); | 10689 return identical(this, clause.exceptionParameter) || identical(this, claus
e.stackTraceParameter); |
9155 } else if (parent2 is ClassDeclaration) { | 10690 } else if (parent2 is ClassDeclaration) { |
(...skipping 12 matching lines...) Expand all Loading... |
9168 return identical(this, ((parent2 as MethodDeclaration)).name); | 10703 return identical(this, ((parent2 as MethodDeclaration)).name); |
9169 } else if (parent2 is FunctionTypedFormalParameter || parent2 is SimpleForma
lParameter) { | 10704 } else if (parent2 is FunctionTypedFormalParameter || parent2 is SimpleForma
lParameter) { |
9170 return identical(this, ((parent2 as NormalFormalParameter)).identifier); | 10705 return identical(this, ((parent2 as NormalFormalParameter)).identifier); |
9171 } else if (parent2 is TypeParameter) { | 10706 } else if (parent2 is TypeParameter) { |
9172 return identical(this, ((parent2 as TypeParameter)).name); | 10707 return identical(this, ((parent2 as TypeParameter)).name); |
9173 } else if (parent2 is VariableDeclaration) { | 10708 } else if (parent2 is VariableDeclaration) { |
9174 return identical(this, ((parent2 as VariableDeclaration)).name); | 10709 return identical(this, ((parent2 as VariableDeclaration)).name); |
9175 } | 10710 } |
9176 return false; | 10711 return false; |
9177 } | 10712 } |
| 10713 |
9178 /** | 10714 /** |
9179 * Return {@code true} if this expression is computing a right-hand value. | 10715 * Return {@code true} if this expression is computing a right-hand value. |
9180 * <p> | 10716 * <p> |
9181 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 10717 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
9182 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 10718 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
9183 * @return {@code true} if this expression is in a context where a getter will
be invoked | 10719 * @return {@code true} if this expression is in a context where a getter will
be invoked |
9184 */ | 10720 */ |
9185 bool inGetterContext() { | 10721 bool inGetterContext() { |
9186 ASTNode parent2 = parent; | 10722 ASTNode parent2 = parent; |
9187 ASTNode target = this; | 10723 ASTNode target = this; |
(...skipping 16 matching lines...) Expand all Loading... |
9204 return false; | 10740 return false; |
9205 } | 10741 } |
9206 if (parent2 is AssignmentExpression) { | 10742 if (parent2 is AssignmentExpression) { |
9207 AssignmentExpression expr = parent2 as AssignmentExpression; | 10743 AssignmentExpression expr = parent2 as AssignmentExpression; |
9208 if (identical(expr.leftHandSide, target) && identical(expr.operator.type,
TokenType.EQ)) { | 10744 if (identical(expr.leftHandSide, target) && identical(expr.operator.type,
TokenType.EQ)) { |
9209 return false; | 10745 return false; |
9210 } | 10746 } |
9211 } | 10747 } |
9212 return true; | 10748 return true; |
9213 } | 10749 } |
| 10750 |
9214 /** | 10751 /** |
9215 * Return {@code true} if this expression is computing a left-hand value. | 10752 * Return {@code true} if this expression is computing a left-hand value. |
9216 * <p> | 10753 * <p> |
9217 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are | 10754 * Note that {@link #inGetterContext()} and {@link #inSetterContext()} are not
opposites, nor are |
9218 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. | 10755 * they mutually exclusive. In other words, it is possible for both methods to
return {@code true}when invoked on the same node. |
9219 * @return {@code true} if this expression is in a context where a setter will
be invoked | 10756 * @return {@code true} if this expression is in a context where a setter will
be invoked |
9220 */ | 10757 */ |
9221 bool inSetterContext() { | 10758 bool inSetterContext() { |
9222 ASTNode parent2 = parent; | 10759 ASTNode parent2 = parent; |
9223 ASTNode target = this; | 10760 ASTNode target = this; |
(...skipping 15 matching lines...) Expand all Loading... |
9239 if (parent2 is PrefixExpression) { | 10776 if (parent2 is PrefixExpression) { |
9240 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; | 10777 return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator()
; |
9241 } else if (parent2 is PostfixExpression) { | 10778 } else if (parent2 is PostfixExpression) { |
9242 return true; | 10779 return true; |
9243 } else if (parent2 is AssignmentExpression) { | 10780 } else if (parent2 is AssignmentExpression) { |
9244 return identical(((parent2 as AssignmentExpression)).leftHandSide, target)
; | 10781 return identical(((parent2 as AssignmentExpression)).leftHandSide, target)
; |
9245 } | 10782 } |
9246 return false; | 10783 return false; |
9247 } | 10784 } |
9248 bool isSynthetic() => _token.isSynthetic(); | 10785 bool isSynthetic() => _token.isSynthetic(); |
| 10786 |
9249 /** | 10787 /** |
9250 * Set the element associated with this identifier to the given element. | 10788 * Set the element associated with this identifier based on propagated type in
formation to the |
9251 * @param element the element associated with this identifier | 10789 * given element. |
| 10790 * @param element the element to be associated with this identifier |
9252 */ | 10791 */ |
9253 void set element(Element element2) { | 10792 void set element(Element element2) { |
9254 this._element = element2; | 10793 _propagatedElement = element2; |
9255 } | 10794 } |
| 10795 |
| 10796 /** |
| 10797 * Set the element associated with this identifier based on static type inform
ation to the given |
| 10798 * element. |
| 10799 * @param element the element to be associated with this identifier |
| 10800 */ |
| 10801 void set staticElement(Element element) { |
| 10802 _staticElement = element; |
| 10803 } |
| 10804 |
9256 /** | 10805 /** |
9257 * Set the token representing the identifier to the given token. | 10806 * Set the token representing the identifier to the given token. |
9258 * @param token the token representing the literal | 10807 * @param token the token representing the literal |
9259 */ | 10808 */ |
9260 void set token(Token token2) { | 10809 void set token(Token token2) { |
9261 this._token = token2; | 10810 this._token = token2; |
9262 } | 10811 } |
9263 void visitChildren(ASTVisitor<Object> visitor) { | 10812 void visitChildren(ASTVisitor<Object> visitor) { |
9264 } | 10813 } |
9265 } | 10814 } |
| 10815 |
9266 /** | 10816 /** |
9267 * Instances of the class {@code SimpleStringLiteral} represent a string literal
expression that | 10817 * Instances of the class {@code SimpleStringLiteral} represent a string literal
expression that |
9268 * does not contain any interpolations. | 10818 * does not contain any interpolations. |
9269 * <pre> | 10819 * <pre> |
9270 * simpleStringLiteral ::= | 10820 * simpleStringLiteral ::= |
9271 * rawStringLiteral | 10821 * rawStringLiteral |
9272 * | basicStringLiteral | 10822 * | basicStringLiteral |
9273 * rawStringLiteral ::= | 10823 * rawStringLiteral ::= |
9274 * '@' basicStringLiteral | 10824 * '@' basicStringLiteral |
9275 * simpleStringLiteral ::= | 10825 * simpleStringLiteral ::= |
9276 * multiLineStringLiteral | 10826 * multiLineStringLiteral |
9277 * | singleLineStringLiteral | 10827 * | singleLineStringLiteral |
9278 * multiLineStringLiteral ::= | 10828 * multiLineStringLiteral ::= |
9279 * "'''" characters "'''" | 10829 * "'''" characters "'''" |
9280 * | '"""' characters '"""' | 10830 * | '"""' characters '"""' |
9281 * singleLineStringLiteral ::= | 10831 * singleLineStringLiteral ::= |
9282 * "'" characters "'" | 10832 * "'" characters "'" |
9283 * '"' characters '"' | 10833 * '"' characters '"' |
9284 * </pre> | 10834 * </pre> |
9285 * @coverage dart.engine.ast | 10835 * @coverage dart.engine.ast |
9286 */ | 10836 */ |
9287 class SimpleStringLiteral extends StringLiteral { | 10837 class SimpleStringLiteral extends StringLiteral { |
| 10838 |
9288 /** | 10839 /** |
9289 * The token representing the literal. | 10840 * The token representing the literal. |
9290 */ | 10841 */ |
9291 Token _literal; | 10842 Token _literal; |
| 10843 |
9292 /** | 10844 /** |
9293 * The value of the literal. | 10845 * The value of the literal. |
9294 */ | 10846 */ |
9295 String _value; | 10847 String _value; |
| 10848 |
9296 /** | 10849 /** |
9297 * Initialize a newly created simple string literal. | 10850 * Initialize a newly created simple string literal. |
9298 * @param literal the token representing the literal | 10851 * @param literal the token representing the literal |
9299 * @param value the value of the literal | 10852 * @param value the value of the literal |
9300 */ | 10853 */ |
9301 SimpleStringLiteral.full(Token literal, String value) { | 10854 SimpleStringLiteral.full(Token literal, String value) { |
9302 this._literal = literal; | 10855 this._literal = literal; |
9303 this._value = StringUtilities.intern(value); | 10856 this._value = StringUtilities.intern(value); |
9304 } | 10857 } |
| 10858 |
9305 /** | 10859 /** |
9306 * Initialize a newly created simple string literal. | 10860 * Initialize a newly created simple string literal. |
9307 * @param literal the token representing the literal | 10861 * @param literal the token representing the literal |
9308 * @param value the value of the literal | 10862 * @param value the value of the literal |
9309 */ | 10863 */ |
9310 SimpleStringLiteral({Token literal, String value}) : this.full(literal, value)
; | 10864 SimpleStringLiteral({Token literal, String value}) : this.full(literal, value)
; |
9311 accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this); | 10865 accept(ASTVisitor visitor) => visitor.visitSimpleStringLiteral(this); |
9312 Token get beginToken => _literal; | 10866 Token get beginToken => _literal; |
9313 Token get endToken => _literal; | 10867 Token get endToken => _literal; |
| 10868 |
9314 /** | 10869 /** |
9315 * Return the token representing the literal. | 10870 * Return the token representing the literal. |
9316 * @return the token representing the literal | 10871 * @return the token representing the literal |
9317 */ | 10872 */ |
9318 Token get literal => _literal; | 10873 Token get literal => _literal; |
| 10874 |
9319 /** | 10875 /** |
9320 * Return the value of the literal. | 10876 * Return the value of the literal. |
9321 * @return the value of the literal | 10877 * @return the value of the literal |
9322 */ | 10878 */ |
9323 String get value => _value; | 10879 String get value => _value; |
| 10880 |
9324 /** | 10881 /** |
9325 * Return {@code true} if this string literal is a multi-line string. | 10882 * Return {@code true} if this string literal is a multi-line string. |
9326 * @return {@code true} if this string literal is a multi-line string | 10883 * @return {@code true} if this string literal is a multi-line string |
9327 */ | 10884 */ |
9328 bool isMultiline() { | 10885 bool isMultiline() { |
9329 if (_value.length < 6) { | 10886 if (_value.length < 6) { |
9330 return false; | 10887 return false; |
9331 } | 10888 } |
9332 return _value.endsWith("\"\"\"") || _value.endsWith("'''"); | 10889 return _value.endsWith("\"\"\"") || _value.endsWith("'''"); |
9333 } | 10890 } |
| 10891 |
9334 /** | 10892 /** |
9335 * Return {@code true} if this string literal is a raw string. | 10893 * Return {@code true} if this string literal is a raw string. |
9336 * @return {@code true} if this string literal is a raw string | 10894 * @return {@code true} if this string literal is a raw string |
9337 */ | 10895 */ |
9338 bool isRaw() => _value.codeUnitAt(0) == 0x40; | 10896 bool isRaw() => _value.codeUnitAt(0) == 0x40; |
9339 bool isSynthetic() => _literal.isSynthetic(); | 10897 bool isSynthetic() => _literal.isSynthetic(); |
| 10898 |
9340 /** | 10899 /** |
9341 * Set the token representing the literal to the given token. | 10900 * Set the token representing the literal to the given token. |
9342 * @param literal the token representing the literal | 10901 * @param literal the token representing the literal |
9343 */ | 10902 */ |
9344 void set literal(Token literal2) { | 10903 void set literal(Token literal2) { |
9345 this._literal = literal2; | 10904 this._literal = literal2; |
9346 } | 10905 } |
| 10906 |
9347 /** | 10907 /** |
9348 * Set the value of the literal to the given string. | 10908 * Set the value of the literal to the given string. |
9349 * @param string the value of the literal | 10909 * @param string the value of the literal |
9350 */ | 10910 */ |
9351 void set value(String string) { | 10911 void set value(String string) { |
9352 _value = StringUtilities.intern(_value); | 10912 _value = StringUtilities.intern(_value); |
9353 } | 10913 } |
9354 void visitChildren(ASTVisitor<Object> visitor) { | 10914 void visitChildren(ASTVisitor<Object> visitor) { |
9355 } | 10915 } |
| 10916 void appendStringValue(JavaStringBuilder builder) { |
| 10917 builder.append(value); |
| 10918 } |
9356 } | 10919 } |
| 10920 |
9357 /** | 10921 /** |
9358 * Instances of the class {@code Statement} defines the behavior common to nodes
that represent a | 10922 * Instances of the class {@code Statement} defines the behavior common to nodes
that represent a |
9359 * statement. | 10923 * statement. |
9360 * <pre> | 10924 * <pre> |
9361 * statement ::={@link Block block}| {@link VariableDeclarationStatement initial
izedVariableDeclaration ';'}| {@link ForStatement forStatement}| {@link ForEachS
tatement forEachStatement}| {@link WhileStatement whileStatement}| {@link DoStat
ement doStatement}| {@link SwitchStatement switchStatement}| {@link IfStatement
ifStatement}| {@link TryStatement tryStatement}| {@link BreakStatement breakStat
ement}| {@link ContinueStatement continueStatement}| {@link ReturnStatement retu
rnStatement}| {@link ExpressionStatement expressionStatement}| {@link FunctionDe
clarationStatement functionSignature functionBody}</pre> | 10925 * statement ::={@link Block block}| {@link VariableDeclarationStatement initial
izedVariableDeclaration ';'}| {@link ForStatement forStatement}| {@link ForEachS
tatement forEachStatement}| {@link WhileStatement whileStatement}| {@link DoStat
ement doStatement}| {@link SwitchStatement switchStatement}| {@link IfStatement
ifStatement}| {@link TryStatement tryStatement}| {@link BreakStatement breakStat
ement}| {@link ContinueStatement continueStatement}| {@link ReturnStatement retu
rnStatement}| {@link ExpressionStatement expressionStatement}| {@link FunctionDe
clarationStatement functionSignature functionBody}</pre> |
9362 * @coverage dart.engine.ast | 10926 * @coverage dart.engine.ast |
9363 */ | 10927 */ |
9364 abstract class Statement extends ASTNode { | 10928 abstract class Statement extends ASTNode { |
9365 } | 10929 } |
| 10930 |
9366 /** | 10931 /** |
9367 * Instances of the class {@code StringInterpolation} represent a string interpo
lation literal. | 10932 * Instances of the class {@code StringInterpolation} represent a string interpo
lation literal. |
9368 * <pre> | 10933 * <pre> |
9369 * stringInterpolation ::= | 10934 * stringInterpolation ::= |
9370 * ''' {@link InterpolationElement interpolationElement}* ''' | 10935 * ''' {@link InterpolationElement interpolationElement}* ''' |
9371 * | '"' {@link InterpolationElement interpolationElement}* '"' | 10936 * | '"' {@link InterpolationElement interpolationElement}* '"' |
9372 * </pre> | 10937 * </pre> |
9373 * @coverage dart.engine.ast | 10938 * @coverage dart.engine.ast |
9374 */ | 10939 */ |
9375 class StringInterpolation extends StringLiteral { | 10940 class StringInterpolation extends StringLiteral { |
| 10941 |
9376 /** | 10942 /** |
9377 * The elements that will be composed to produce the resulting string. | 10943 * The elements that will be composed to produce the resulting string. |
9378 */ | 10944 */ |
9379 NodeList<InterpolationElement> _elements; | 10945 NodeList<InterpolationElement> _elements; |
| 10946 |
9380 /** | 10947 /** |
9381 * Initialize a newly created string interpolation expression. | 10948 * Initialize a newly created string interpolation expression. |
9382 * @param elements the elements that will be composed to produce the resulting
string | 10949 * @param elements the elements that will be composed to produce the resulting
string |
9383 */ | 10950 */ |
9384 StringInterpolation.full(List<InterpolationElement> elements) { | 10951 StringInterpolation.full(List<InterpolationElement> elements) { |
9385 this._elements = new NodeList<InterpolationElement>(this); | 10952 this._elements = new NodeList<InterpolationElement>(this); |
9386 this._elements.addAll(elements); | 10953 this._elements.addAll(elements); |
9387 } | 10954 } |
| 10955 |
9388 /** | 10956 /** |
9389 * Initialize a newly created string interpolation expression. | 10957 * Initialize a newly created string interpolation expression. |
9390 * @param elements the elements that will be composed to produce the resulting
string | 10958 * @param elements the elements that will be composed to produce the resulting
string |
9391 */ | 10959 */ |
9392 StringInterpolation({List<InterpolationElement> elements}) : this.full(element
s); | 10960 StringInterpolation({List<InterpolationElement> elements}) : this.full(element
s); |
9393 accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this); | 10961 accept(ASTVisitor visitor) => visitor.visitStringInterpolation(this); |
9394 Token get beginToken => _elements.beginToken; | 10962 Token get beginToken => _elements.beginToken; |
| 10963 |
9395 /** | 10964 /** |
9396 * Return the elements that will be composed to produce the resulting string. | 10965 * Return the elements that will be composed to produce the resulting string. |
9397 * @return the elements that will be composed to produce the resulting string | 10966 * @return the elements that will be composed to produce the resulting string |
9398 */ | 10967 */ |
9399 NodeList<InterpolationElement> get elements => _elements; | 10968 NodeList<InterpolationElement> get elements => _elements; |
9400 Token get endToken => _elements.endToken; | 10969 Token get endToken => _elements.endToken; |
9401 void visitChildren(ASTVisitor<Object> visitor) { | 10970 void visitChildren(ASTVisitor<Object> visitor) { |
9402 _elements.accept(visitor); | 10971 _elements.accept(visitor); |
9403 } | 10972 } |
| 10973 void appendStringValue(JavaStringBuilder builder) { |
| 10974 throw new IllegalArgumentException(); |
| 10975 } |
9404 } | 10976 } |
| 10977 |
9405 /** | 10978 /** |
9406 * Instances of the class {@code StringLiteral} represent a string literal expre
ssion. | 10979 * Instances of the class {@code StringLiteral} represent a string literal expre
ssion. |
9407 * <pre> | 10980 * <pre> |
9408 * stringLiteral ::={@link SimpleStringLiteral simpleStringLiteral}| {@link Adja
centStrings adjacentStrings}| {@link StringInterpolation stringInterpolation}</p
re> | 10981 * stringLiteral ::={@link SimpleStringLiteral simpleStringLiteral}| {@link Adja
centStrings adjacentStrings}| {@link StringInterpolation stringInterpolation}</p
re> |
9409 * @coverage dart.engine.ast | 10982 * @coverage dart.engine.ast |
9410 */ | 10983 */ |
9411 abstract class StringLiteral extends Literal { | 10984 abstract class StringLiteral extends Literal { |
| 10985 |
| 10986 /** |
| 10987 * Return the value of the string literal, or {@code null} if the string is no
t a constant string |
| 10988 * without any string interpolation. |
| 10989 * @return the value of the string literal |
| 10990 */ |
| 10991 String get stringValue { |
| 10992 JavaStringBuilder builder = new JavaStringBuilder(); |
| 10993 try { |
| 10994 appendStringValue(builder); |
| 10995 } on IllegalArgumentException catch (exception) { |
| 10996 return null; |
| 10997 } |
| 10998 return builder.toString(); |
| 10999 } |
| 11000 |
| 11001 /** |
| 11002 * Append the value of the given string literal to the given string builder. |
| 11003 * @param builder the builder to which the string's value is to be appended |
| 11004 * @throws IllegalArgumentException if the string is not a constant string wit
hout any string |
| 11005 * interpolation |
| 11006 */ |
| 11007 void appendStringValue(JavaStringBuilder builder); |
9412 } | 11008 } |
| 11009 |
9413 /** | 11010 /** |
9414 * Instances of the class {@code SuperConstructorInvocation} represent the invoc
ation of a | 11011 * Instances of the class {@code SuperConstructorInvocation} represent the invoc
ation of a |
9415 * superclass' constructor from within a constructor's initialization list. | 11012 * superclass' constructor from within a constructor's initialization list. |
9416 * <pre> | 11013 * <pre> |
9417 * superInvocation ::= | 11014 * superInvocation ::= |
9418 * 'super' ('.' {@link SimpleIdentifier name})? {@link ArgumentList argumentList
}</pre> | 11015 * 'super' ('.' {@link SimpleIdentifier name})? {@link ArgumentList argumentList
}</pre> |
9419 * @coverage dart.engine.ast | 11016 * @coverage dart.engine.ast |
9420 */ | 11017 */ |
9421 class SuperConstructorInvocation extends ConstructorInitializer { | 11018 class SuperConstructorInvocation extends ConstructorInitializer { |
| 11019 |
9422 /** | 11020 /** |
9423 * The token for the 'super' keyword. | 11021 * The token for the 'super' keyword. |
9424 */ | 11022 */ |
9425 Token _keyword; | 11023 Token _keyword; |
| 11024 |
9426 /** | 11025 /** |
9427 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. | 11026 * The token for the period before the name of the constructor that is being i
nvoked, or{@code null} if the unnamed constructor is being invoked. |
9428 */ | 11027 */ |
9429 Token _period; | 11028 Token _period; |
| 11029 |
9430 /** | 11030 /** |
9431 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor | 11031 * The name of the constructor that is being invoked, or {@code null} if the u
nnamed constructor |
9432 * is being invoked. | 11032 * is being invoked. |
9433 */ | 11033 */ |
9434 SimpleIdentifier _constructorName; | 11034 SimpleIdentifier _constructorName; |
| 11035 |
9435 /** | 11036 /** |
9436 * The list of arguments to the constructor. | 11037 * The list of arguments to the constructor. |
9437 */ | 11038 */ |
9438 ArgumentList _argumentList; | 11039 ArgumentList _argumentList; |
| 11040 |
9439 /** | 11041 /** |
9440 * The element associated with the constructor, or {@code null} if the AST str
ucture has not been | 11042 * The element associated with the constructor based on static type informatio
n, or {@code null}if the AST structure has not been resolved or if the construct
or could not be resolved. |
| 11043 */ |
| 11044 ConstructorElement _staticElement; |
| 11045 |
| 11046 /** |
| 11047 * The element associated with the constructor based on propagated type inform
ation, or {@code null} if the AST structure has not been |
9441 * resolved or if the constructor could not be resolved. | 11048 * resolved or if the constructor could not be resolved. |
9442 */ | 11049 */ |
9443 ConstructorElement _element; | 11050 ConstructorElement _propagatedElement; |
| 11051 |
9444 /** | 11052 /** |
9445 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given | 11053 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given |
9446 * name with the given arguments. | 11054 * name with the given arguments. |
9447 * @param keyword the token for the 'super' keyword | 11055 * @param keyword the token for the 'super' keyword |
9448 * @param period the token for the period before the name of the constructor t
hat is being invoked | 11056 * @param period the token for the period before the name of the constructor t
hat is being invoked |
9449 * @param constructorName the name of the constructor that is being invoked | 11057 * @param constructorName the name of the constructor that is being invoked |
9450 * @param argumentList the list of arguments to the constructor | 11058 * @param argumentList the list of arguments to the constructor |
9451 */ | 11059 */ |
9452 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier
constructorName, ArgumentList argumentList) { | 11060 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier
constructorName, ArgumentList argumentList) { |
9453 this._keyword = keyword; | 11061 this._keyword = keyword; |
9454 this._period = period; | 11062 this._period = period; |
9455 this._constructorName = becomeParentOf(constructorName); | 11063 this._constructorName = becomeParentOf(constructorName); |
9456 this._argumentList = becomeParentOf(argumentList); | 11064 this._argumentList = becomeParentOf(argumentList); |
9457 } | 11065 } |
| 11066 |
9458 /** | 11067 /** |
9459 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given | 11068 * Initialize a newly created super invocation to invoke the inherited constru
ctor with the given |
9460 * name with the given arguments. | 11069 * name with the given arguments. |
9461 * @param keyword the token for the 'super' keyword | 11070 * @param keyword the token for the 'super' keyword |
9462 * @param period the token for the period before the name of the constructor t
hat is being invoked | 11071 * @param period the token for the period before the name of the constructor t
hat is being invoked |
9463 * @param constructorName the name of the constructor that is being invoked | 11072 * @param constructorName the name of the constructor that is being invoked |
9464 * @param argumentList the list of arguments to the constructor | 11073 * @param argumentList the list of arguments to the constructor |
9465 */ | 11074 */ |
9466 SuperConstructorInvocation({Token keyword, Token period, SimpleIdentifier cons
tructorName, ArgumentList argumentList}) : this.full(keyword, period, constructo
rName, argumentList); | 11075 SuperConstructorInvocation({Token keyword, Token period, SimpleIdentifier cons
tructorName, ArgumentList argumentList}) : this.full(keyword, period, constructo
rName, argumentList); |
9467 accept(ASTVisitor visitor) => visitor.visitSuperConstructorInvocation(this); | 11076 accept(ASTVisitor visitor) => visitor.visitSuperConstructorInvocation(this); |
| 11077 |
9468 /** | 11078 /** |
9469 * Return the list of arguments to the constructor. | 11079 * Return the list of arguments to the constructor. |
9470 * @return the list of arguments to the constructor | 11080 * @return the list of arguments to the constructor |
9471 */ | 11081 */ |
9472 ArgumentList get argumentList => _argumentList; | 11082 ArgumentList get argumentList => _argumentList; |
9473 Token get beginToken => _keyword; | 11083 Token get beginToken => _keyword; |
| 11084 |
9474 /** | 11085 /** |
9475 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed | 11086 * Return the name of the constructor that is being invoked, or {@code null} i
f the unnamed |
9476 * constructor is being invoked. | 11087 * constructor is being invoked. |
9477 * @return the name of the constructor that is being invoked | 11088 * @return the name of the constructor that is being invoked |
9478 */ | 11089 */ |
9479 SimpleIdentifier get constructorName => _constructorName; | 11090 SimpleIdentifier get constructorName => _constructorName; |
| 11091 |
9480 /** | 11092 /** |
9481 * Return the element associated with the constructor, or {@code null} if the
AST structure has | 11093 * Return the element associated with the constructor based on propagated type
information, or{@code null} if the AST structure has not been resolved or if th
e constructor could not be |
9482 * not been resolved or if the constructor could not be resolved. | 11094 * resolved. |
9483 * @return the element associated with the super constructor | 11095 * @return the element associated with the super constructor |
9484 */ | 11096 */ |
9485 ConstructorElement get element => _element; | 11097 ConstructorElement get element => _propagatedElement; |
9486 Token get endToken => _argumentList.endToken; | 11098 Token get endToken => _argumentList.endToken; |
| 11099 |
9487 /** | 11100 /** |
9488 * Return the token for the 'super' keyword. | 11101 * Return the token for the 'super' keyword. |
9489 * @return the token for the 'super' keyword | 11102 * @return the token for the 'super' keyword |
9490 */ | 11103 */ |
9491 Token get keyword => _keyword; | 11104 Token get keyword => _keyword; |
| 11105 |
9492 /** | 11106 /** |
9493 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. | 11107 * Return the token for the period before the name of the constructor that is
being invoked, or{@code null} if the unnamed constructor is being invoked. |
9494 * @return the token for the period before the name of the constructor that is
being invoked | 11108 * @return the token for the period before the name of the constructor that is
being invoked |
9495 */ | 11109 */ |
9496 Token get period => _period; | 11110 Token get period => _period; |
| 11111 |
| 11112 /** |
| 11113 * Return the element associated with the constructor based on static type inf
ormation, or{@code null} if the AST structure has not been resolved or if the co
nstructor could not be |
| 11114 * resolved. |
| 11115 * @return the element associated with the constructor |
| 11116 */ |
| 11117 ConstructorElement get staticElement => _staticElement; |
| 11118 |
9497 /** | 11119 /** |
9498 * Set the list of arguments to the constructor to the given list. | 11120 * Set the list of arguments to the constructor to the given list. |
9499 * @param argumentList the list of arguments to the constructor | 11121 * @param argumentList the list of arguments to the constructor |
9500 */ | 11122 */ |
9501 void set argumentList(ArgumentList argumentList2) { | 11123 void set argumentList(ArgumentList argumentList2) { |
9502 this._argumentList = becomeParentOf(argumentList2); | 11124 this._argumentList = becomeParentOf(argumentList2); |
9503 } | 11125 } |
| 11126 |
9504 /** | 11127 /** |
9505 * Set the name of the constructor that is being invoked to the given identifi
er. | 11128 * Set the name of the constructor that is being invoked to the given identifi
er. |
9506 * @param identifier the name of the constructor that is being invoked | 11129 * @param identifier the name of the constructor that is being invoked |
9507 */ | 11130 */ |
9508 void set constructorName(SimpleIdentifier identifier) { | 11131 void set constructorName(SimpleIdentifier identifier) { |
9509 _constructorName = becomeParentOf(identifier); | 11132 _constructorName = becomeParentOf(identifier); |
9510 } | 11133 } |
| 11134 |
9511 /** | 11135 /** |
9512 * Set the element associated with the constructor to the given element. | 11136 * Set the element associated with the constructor based on propagated type in
formation to the |
9513 * @param element the element associated with the constructor | 11137 * given element. |
| 11138 * @param element the element to be associated with the constructor |
9514 */ | 11139 */ |
9515 void set element(ConstructorElement element2) { | 11140 void set element(ConstructorElement element2) { |
9516 this._element = element2; | 11141 _propagatedElement = element2; |
9517 } | 11142 } |
| 11143 |
9518 /** | 11144 /** |
9519 * Set the token for the 'super' keyword to the given token. | 11145 * Set the token for the 'super' keyword to the given token. |
9520 * @param keyword the token for the 'super' keyword | 11146 * @param keyword the token for the 'super' keyword |
9521 */ | 11147 */ |
9522 void set keyword(Token keyword2) { | 11148 void set keyword(Token keyword2) { |
9523 this._keyword = keyword2; | 11149 this._keyword = keyword2; |
9524 } | 11150 } |
| 11151 |
9525 /** | 11152 /** |
9526 * Set the token for the period before the name of the constructor that is bei
ng invoked to the | 11153 * Set the token for the period before the name of the constructor that is bei
ng invoked to the |
9527 * given token. | 11154 * given token. |
9528 * @param period the token for the period before the name of the constructor t
hat is being invoked | 11155 * @param period the token for the period before the name of the constructor t
hat is being invoked |
9529 */ | 11156 */ |
9530 void set period(Token period2) { | 11157 void set period(Token period2) { |
9531 this._period = period2; | 11158 this._period = period2; |
9532 } | 11159 } |
| 11160 |
| 11161 /** |
| 11162 * Set the element associated with the constructor based on static type inform
ation to the given |
| 11163 * element. |
| 11164 * @param element the element to be associated with the constructor |
| 11165 */ |
| 11166 void set staticElement(ConstructorElement element) { |
| 11167 this._staticElement = element; |
| 11168 } |
9533 void visitChildren(ASTVisitor<Object> visitor) { | 11169 void visitChildren(ASTVisitor<Object> visitor) { |
9534 safelyVisitChild(_constructorName, visitor); | 11170 safelyVisitChild(_constructorName, visitor); |
9535 safelyVisitChild(_argumentList, visitor); | 11171 safelyVisitChild(_argumentList, visitor); |
9536 } | 11172 } |
9537 } | 11173 } |
| 11174 |
9538 /** | 11175 /** |
9539 * Instances of the class {@code SuperExpression} represent a super expression. | 11176 * Instances of the class {@code SuperExpression} represent a super expression. |
9540 * <pre> | 11177 * <pre> |
9541 * superExpression ::= | 11178 * superExpression ::= |
9542 * 'super' | 11179 * 'super' |
9543 * </pre> | 11180 * </pre> |
9544 * @coverage dart.engine.ast | 11181 * @coverage dart.engine.ast |
9545 */ | 11182 */ |
9546 class SuperExpression extends Expression { | 11183 class SuperExpression extends Expression { |
| 11184 |
9547 /** | 11185 /** |
9548 * The token representing the keyword. | 11186 * The token representing the keyword. |
9549 */ | 11187 */ |
9550 Token _keyword; | 11188 Token _keyword; |
| 11189 |
9551 /** | 11190 /** |
9552 * Initialize a newly created super expression. | 11191 * Initialize a newly created super expression. |
9553 * @param keyword the token representing the keyword | 11192 * @param keyword the token representing the keyword |
9554 */ | 11193 */ |
9555 SuperExpression.full(Token keyword) { | 11194 SuperExpression.full(Token keyword) { |
9556 this._keyword = keyword; | 11195 this._keyword = keyword; |
9557 } | 11196 } |
| 11197 |
9558 /** | 11198 /** |
9559 * Initialize a newly created super expression. | 11199 * Initialize a newly created super expression. |
9560 * @param keyword the token representing the keyword | 11200 * @param keyword the token representing the keyword |
9561 */ | 11201 */ |
9562 SuperExpression({Token keyword}) : this.full(keyword); | 11202 SuperExpression({Token keyword}) : this.full(keyword); |
9563 accept(ASTVisitor visitor) => visitor.visitSuperExpression(this); | 11203 accept(ASTVisitor visitor) => visitor.visitSuperExpression(this); |
9564 Token get beginToken => _keyword; | 11204 Token get beginToken => _keyword; |
9565 Token get endToken => _keyword; | 11205 Token get endToken => _keyword; |
| 11206 |
9566 /** | 11207 /** |
9567 * Return the token representing the keyword. | 11208 * Return the token representing the keyword. |
9568 * @return the token representing the keyword | 11209 * @return the token representing the keyword |
9569 */ | 11210 */ |
9570 Token get keyword => _keyword; | 11211 Token get keyword => _keyword; |
| 11212 |
9571 /** | 11213 /** |
9572 * Set the token representing the keyword to the given token. | 11214 * Set the token representing the keyword to the given token. |
9573 * @param keyword the token representing the keyword | 11215 * @param keyword the token representing the keyword |
9574 */ | 11216 */ |
9575 void set keyword(Token keyword2) { | 11217 void set keyword(Token keyword2) { |
9576 this._keyword = keyword2; | 11218 this._keyword = keyword2; |
9577 } | 11219 } |
9578 void visitChildren(ASTVisitor<Object> visitor) { | 11220 void visitChildren(ASTVisitor<Object> visitor) { |
9579 } | 11221 } |
9580 } | 11222 } |
| 11223 |
9581 /** | 11224 /** |
9582 * Instances of the class {@code SwitchCase} represent the case in a switch stat
ement. | 11225 * Instances of the class {@code SwitchCase} represent the case in a switch stat
ement. |
9583 * <pre> | 11226 * <pre> |
9584 * switchCase ::={@link SimpleIdentifier label}* 'case' {@link Expression expres
sion} ':' {@link Statement statement}</pre> | 11227 * switchCase ::={@link SimpleIdentifier label}* 'case' {@link Expression expres
sion} ':' {@link Statement statement}</pre> |
9585 * @coverage dart.engine.ast | 11228 * @coverage dart.engine.ast |
9586 */ | 11229 */ |
9587 class SwitchCase extends SwitchMember { | 11230 class SwitchCase extends SwitchMember { |
| 11231 |
9588 /** | 11232 /** |
9589 * The expression controlling whether the statements will be executed. | 11233 * The expression controlling whether the statements will be executed. |
9590 */ | 11234 */ |
9591 Expression _expression; | 11235 Expression _expression; |
| 11236 |
9592 /** | 11237 /** |
9593 * Initialize a newly created switch case. | 11238 * Initialize a newly created switch case. |
9594 * @param labels the labels associated with the switch member | 11239 * @param labels the labels associated with the switch member |
9595 * @param keyword the token representing the 'case' or 'default' keyword | 11240 * @param keyword the token representing the 'case' or 'default' keyword |
9596 * @param expression the expression controlling whether the statements will be
executed | 11241 * @param expression the expression controlling whether the statements will be
executed |
9597 * @param colon the colon separating the keyword or the expression from the st
atements | 11242 * @param colon the colon separating the keyword or the expression from the st
atements |
9598 * @param statements the statements that will be executed if this switch membe
r is selected | 11243 * @param statements the statements that will be executed if this switch membe
r is selected |
9599 */ | 11244 */ |
9600 SwitchCase.full(List<Label> labels, Token keyword, Expression expression, Toke
n colon, List<Statement> statements) : super.full(labels, keyword, colon, statem
ents) { | 11245 SwitchCase.full(List<Label> labels, Token keyword, Expression expression, Toke
n colon, List<Statement> statements) : super.full(labels, keyword, colon, statem
ents) { |
9601 this._expression = becomeParentOf(expression); | 11246 this._expression = becomeParentOf(expression); |
9602 } | 11247 } |
| 11248 |
9603 /** | 11249 /** |
9604 * Initialize a newly created switch case. | 11250 * Initialize a newly created switch case. |
9605 * @param labels the labels associated with the switch member | 11251 * @param labels the labels associated with the switch member |
9606 * @param keyword the token representing the 'case' or 'default' keyword | 11252 * @param keyword the token representing the 'case' or 'default' keyword |
9607 * @param expression the expression controlling whether the statements will be
executed | 11253 * @param expression the expression controlling whether the statements will be
executed |
9608 * @param colon the colon separating the keyword or the expression from the st
atements | 11254 * @param colon the colon separating the keyword or the expression from the st
atements |
9609 * @param statements the statements that will be executed if this switch membe
r is selected | 11255 * @param statements the statements that will be executed if this switch membe
r is selected |
9610 */ | 11256 */ |
9611 SwitchCase({List<Label> labels, Token keyword, Expression expression, Token co
lon, List<Statement> statements}) : this.full(labels, keyword, expression, colon
, statements); | 11257 SwitchCase({List<Label> labels, Token keyword, Expression expression, Token co
lon, List<Statement> statements}) : this.full(labels, keyword, expression, colon
, statements); |
9612 accept(ASTVisitor visitor) => visitor.visitSwitchCase(this); | 11258 accept(ASTVisitor visitor) => visitor.visitSwitchCase(this); |
| 11259 |
9613 /** | 11260 /** |
9614 * Return the expression controlling whether the statements will be executed. | 11261 * Return the expression controlling whether the statements will be executed. |
9615 * @return the expression controlling whether the statements will be executed | 11262 * @return the expression controlling whether the statements will be executed |
9616 */ | 11263 */ |
9617 Expression get expression => _expression; | 11264 Expression get expression => _expression; |
| 11265 |
9618 /** | 11266 /** |
9619 * Set the expression controlling whether the statements will be executed to t
he given expression. | 11267 * Set the expression controlling whether the statements will be executed to t
he given expression. |
9620 * @param expression the expression controlling whether the statements will be
executed | 11268 * @param expression the expression controlling whether the statements will be
executed |
9621 */ | 11269 */ |
9622 void set expression(Expression expression2) { | 11270 void set expression(Expression expression2) { |
9623 this._expression = becomeParentOf(expression2); | 11271 this._expression = becomeParentOf(expression2); |
9624 } | 11272 } |
9625 void visitChildren(ASTVisitor<Object> visitor) { | 11273 void visitChildren(ASTVisitor<Object> visitor) { |
9626 labels.accept(visitor); | 11274 labels.accept(visitor); |
9627 safelyVisitChild(_expression, visitor); | 11275 safelyVisitChild(_expression, visitor); |
9628 statements.accept(visitor); | 11276 statements.accept(visitor); |
9629 } | 11277 } |
9630 } | 11278 } |
| 11279 |
9631 /** | 11280 /** |
9632 * Instances of the class {@code SwitchDefault} represent the default case in a
switch statement. | 11281 * Instances of the class {@code SwitchDefault} represent the default case in a
switch statement. |
9633 * <pre> | 11282 * <pre> |
9634 * switchDefault ::={@link SimpleIdentifier label}* 'default' ':' {@link Stateme
nt statement}</pre> | 11283 * switchDefault ::={@link SimpleIdentifier label}* 'default' ':' {@link Stateme
nt statement}</pre> |
9635 * @coverage dart.engine.ast | 11284 * @coverage dart.engine.ast |
9636 */ | 11285 */ |
9637 class SwitchDefault extends SwitchMember { | 11286 class SwitchDefault extends SwitchMember { |
| 11287 |
9638 /** | 11288 /** |
9639 * Initialize a newly created switch default. | 11289 * Initialize a newly created switch default. |
9640 * @param labels the labels associated with the switch member | 11290 * @param labels the labels associated with the switch member |
9641 * @param keyword the token representing the 'case' or 'default' keyword | 11291 * @param keyword the token representing the 'case' or 'default' keyword |
9642 * @param colon the colon separating the keyword or the expression from the st
atements | 11292 * @param colon the colon separating the keyword or the expression from the st
atements |
9643 * @param statements the statements that will be executed if this switch membe
r is selected | 11293 * @param statements the statements that will be executed if this switch membe
r is selected |
9644 */ | 11294 */ |
9645 SwitchDefault.full(List<Label> labels, Token keyword, Token colon, List<Statem
ent> statements) : super.full(labels, keyword, colon, statements) { | 11295 SwitchDefault.full(List<Label> labels, Token keyword, Token colon, List<Statem
ent> statements) : super.full(labels, keyword, colon, statements) { |
9646 } | 11296 } |
| 11297 |
9647 /** | 11298 /** |
9648 * Initialize a newly created switch default. | 11299 * Initialize a newly created switch default. |
9649 * @param labels the labels associated with the switch member | 11300 * @param labels the labels associated with the switch member |
9650 * @param keyword the token representing the 'case' or 'default' keyword | 11301 * @param keyword the token representing the 'case' or 'default' keyword |
9651 * @param colon the colon separating the keyword or the expression from the st
atements | 11302 * @param colon the colon separating the keyword or the expression from the st
atements |
9652 * @param statements the statements that will be executed if this switch membe
r is selected | 11303 * @param statements the statements that will be executed if this switch membe
r is selected |
9653 */ | 11304 */ |
9654 SwitchDefault({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); | 11305 SwitchDefault({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); |
9655 accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this); | 11306 accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this); |
9656 void visitChildren(ASTVisitor<Object> visitor) { | 11307 void visitChildren(ASTVisitor<Object> visitor) { |
9657 labels.accept(visitor); | 11308 labels.accept(visitor); |
9658 statements.accept(visitor); | 11309 statements.accept(visitor); |
9659 } | 11310 } |
9660 } | 11311 } |
| 11312 |
9661 /** | 11313 /** |
9662 * The abstract class {@code SwitchMember} defines the behavior common to object
s representing | 11314 * The abstract class {@code SwitchMember} defines the behavior common to object
s representing |
9663 * elements within a switch statement. | 11315 * elements within a switch statement. |
9664 * <pre> | 11316 * <pre> |
9665 * switchMember ::= | 11317 * switchMember ::= |
9666 * switchCase | 11318 * switchCase |
9667 * | switchDefault | 11319 * | switchDefault |
9668 * </pre> | 11320 * </pre> |
9669 * @coverage dart.engine.ast | 11321 * @coverage dart.engine.ast |
9670 */ | 11322 */ |
9671 abstract class SwitchMember extends ASTNode { | 11323 abstract class SwitchMember extends ASTNode { |
| 11324 |
9672 /** | 11325 /** |
9673 * The labels associated with the switch member. | 11326 * The labels associated with the switch member. |
9674 */ | 11327 */ |
9675 NodeList<Label> _labels; | 11328 NodeList<Label> _labels; |
| 11329 |
9676 /** | 11330 /** |
9677 * The token representing the 'case' or 'default' keyword. | 11331 * The token representing the 'case' or 'default' keyword. |
9678 */ | 11332 */ |
9679 Token _keyword; | 11333 Token _keyword; |
| 11334 |
9680 /** | 11335 /** |
9681 * The colon separating the keyword or the expression from the statements. | 11336 * The colon separating the keyword or the expression from the statements. |
9682 */ | 11337 */ |
9683 Token _colon; | 11338 Token _colon; |
| 11339 |
9684 /** | 11340 /** |
9685 * The statements that will be executed if this switch member is selected. | 11341 * The statements that will be executed if this switch member is selected. |
9686 */ | 11342 */ |
9687 NodeList<Statement> _statements; | 11343 NodeList<Statement> _statements; |
| 11344 |
9688 /** | 11345 /** |
9689 * Initialize a newly created switch member. | 11346 * Initialize a newly created switch member. |
9690 * @param labels the labels associated with the switch member | 11347 * @param labels the labels associated with the switch member |
9691 * @param keyword the token representing the 'case' or 'default' keyword | 11348 * @param keyword the token representing the 'case' or 'default' keyword |
9692 * @param colon the colon separating the keyword or the expression from the st
atements | 11349 * @param colon the colon separating the keyword or the expression from the st
atements |
9693 * @param statements the statements that will be executed if this switch membe
r is selected | 11350 * @param statements the statements that will be executed if this switch membe
r is selected |
9694 */ | 11351 */ |
9695 SwitchMember.full(List<Label> labels, Token keyword, Token colon, List<Stateme
nt> statements) { | 11352 SwitchMember.full(List<Label> labels, Token keyword, Token colon, List<Stateme
nt> statements) { |
9696 this._labels = new NodeList<Label>(this); | 11353 this._labels = new NodeList<Label>(this); |
9697 this._statements = new NodeList<Statement>(this); | 11354 this._statements = new NodeList<Statement>(this); |
9698 this._labels.addAll(labels); | 11355 this._labels.addAll(labels); |
9699 this._keyword = keyword; | 11356 this._keyword = keyword; |
9700 this._colon = colon; | 11357 this._colon = colon; |
9701 this._statements.addAll(statements); | 11358 this._statements.addAll(statements); |
9702 } | 11359 } |
| 11360 |
9703 /** | 11361 /** |
9704 * Initialize a newly created switch member. | 11362 * Initialize a newly created switch member. |
9705 * @param labels the labels associated with the switch member | 11363 * @param labels the labels associated with the switch member |
9706 * @param keyword the token representing the 'case' or 'default' keyword | 11364 * @param keyword the token representing the 'case' or 'default' keyword |
9707 * @param colon the colon separating the keyword or the expression from the st
atements | 11365 * @param colon the colon separating the keyword or the expression from the st
atements |
9708 * @param statements the statements that will be executed if this switch membe
r is selected | 11366 * @param statements the statements that will be executed if this switch membe
r is selected |
9709 */ | 11367 */ |
9710 SwitchMember({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); | 11368 SwitchMember({List<Label> labels, Token keyword, Token colon, List<Statement>
statements}) : this.full(labels, keyword, colon, statements); |
9711 Token get beginToken { | 11369 Token get beginToken { |
9712 if (!_labels.isEmpty) { | 11370 if (!_labels.isEmpty) { |
9713 return _labels.beginToken; | 11371 return _labels.beginToken; |
9714 } | 11372 } |
9715 return _keyword; | 11373 return _keyword; |
9716 } | 11374 } |
| 11375 |
9717 /** | 11376 /** |
9718 * Return the colon separating the keyword or the expression from the statemen
ts. | 11377 * Return the colon separating the keyword or the expression from the statemen
ts. |
9719 * @return the colon separating the keyword or the expression from the stateme
nts | 11378 * @return the colon separating the keyword or the expression from the stateme
nts |
9720 */ | 11379 */ |
9721 Token get colon => _colon; | 11380 Token get colon => _colon; |
9722 Token get endToken { | 11381 Token get endToken { |
9723 if (!_statements.isEmpty) { | 11382 if (!_statements.isEmpty) { |
9724 return _statements.endToken; | 11383 return _statements.endToken; |
9725 } | 11384 } |
9726 return _colon; | 11385 return _colon; |
9727 } | 11386 } |
| 11387 |
9728 /** | 11388 /** |
9729 * Return the token representing the 'case' or 'default' keyword. | 11389 * Return the token representing the 'case' or 'default' keyword. |
9730 * @return the token representing the 'case' or 'default' keyword | 11390 * @return the token representing the 'case' or 'default' keyword |
9731 */ | 11391 */ |
9732 Token get keyword => _keyword; | 11392 Token get keyword => _keyword; |
| 11393 |
9733 /** | 11394 /** |
9734 * Return the labels associated with the switch member. | 11395 * Return the labels associated with the switch member. |
9735 * @return the labels associated with the switch member | 11396 * @return the labels associated with the switch member |
9736 */ | 11397 */ |
9737 NodeList<Label> get labels => _labels; | 11398 NodeList<Label> get labels => _labels; |
| 11399 |
9738 /** | 11400 /** |
9739 * Return the statements that will be executed if this switch member is select
ed. | 11401 * Return the statements that will be executed if this switch member is select
ed. |
9740 * @return the statements that will be executed if this switch member is selec
ted | 11402 * @return the statements that will be executed if this switch member is selec
ted |
9741 */ | 11403 */ |
9742 NodeList<Statement> get statements => _statements; | 11404 NodeList<Statement> get statements => _statements; |
| 11405 |
9743 /** | 11406 /** |
9744 * Set the colon separating the keyword or the expression from the statements
to the given token. | 11407 * Set the colon separating the keyword or the expression from the statements
to the given token. |
9745 * @param colon the colon separating the keyword or the expression from the st
atements | 11408 * @param colon the colon separating the keyword or the expression from the st
atements |
9746 */ | 11409 */ |
9747 void set colon(Token colon2) { | 11410 void set colon(Token colon2) { |
9748 this._colon = colon2; | 11411 this._colon = colon2; |
9749 } | 11412 } |
| 11413 |
9750 /** | 11414 /** |
9751 * Set the token representing the 'case' or 'default' keyword to the given tok
en. | 11415 * Set the token representing the 'case' or 'default' keyword to the given tok
en. |
9752 * @param keyword the token representing the 'case' or 'default' keyword | 11416 * @param keyword the token representing the 'case' or 'default' keyword |
9753 */ | 11417 */ |
9754 void set keyword(Token keyword2) { | 11418 void set keyword(Token keyword2) { |
9755 this._keyword = keyword2; | 11419 this._keyword = keyword2; |
9756 } | 11420 } |
9757 } | 11421 } |
| 11422 |
9758 /** | 11423 /** |
9759 * Instances of the class {@code SwitchStatement} represent a switch statement. | 11424 * Instances of the class {@code SwitchStatement} represent a switch statement. |
9760 * <pre> | 11425 * <pre> |
9761 * switchStatement ::= | 11426 * switchStatement ::= |
9762 * 'switch' '(' {@link Expression expression} ')' '{' {@link SwitchCase switchCa
se}* {@link SwitchDefault defaultCase}? '}' | 11427 * 'switch' '(' {@link Expression expression} ')' '{' {@link SwitchCase switchCa
se}* {@link SwitchDefault defaultCase}? '}' |
9763 * </pre> | 11428 * </pre> |
9764 * @coverage dart.engine.ast | 11429 * @coverage dart.engine.ast |
9765 */ | 11430 */ |
9766 class SwitchStatement extends Statement { | 11431 class SwitchStatement extends Statement { |
| 11432 |
9767 /** | 11433 /** |
9768 * The token representing the 'switch' keyword. | 11434 * The token representing the 'switch' keyword. |
9769 */ | 11435 */ |
9770 Token _keyword; | 11436 Token _keyword; |
| 11437 |
9771 /** | 11438 /** |
9772 * The left parenthesis. | 11439 * The left parenthesis. |
9773 */ | 11440 */ |
9774 Token _leftParenthesis; | 11441 Token _leftParenthesis; |
| 11442 |
9775 /** | 11443 /** |
9776 * The expression used to determine which of the switch members will be select
ed. | 11444 * The expression used to determine which of the switch members will be select
ed. |
9777 */ | 11445 */ |
9778 Expression _expression; | 11446 Expression _expression; |
| 11447 |
9779 /** | 11448 /** |
9780 * The right parenthesis. | 11449 * The right parenthesis. |
9781 */ | 11450 */ |
9782 Token _rightParenthesis; | 11451 Token _rightParenthesis; |
| 11452 |
9783 /** | 11453 /** |
9784 * The left curly bracket. | 11454 * The left curly bracket. |
9785 */ | 11455 */ |
9786 Token _leftBracket; | 11456 Token _leftBracket; |
| 11457 |
9787 /** | 11458 /** |
9788 * The switch members that can be selected by the expression. | 11459 * The switch members that can be selected by the expression. |
9789 */ | 11460 */ |
9790 NodeList<SwitchMember> _members; | 11461 NodeList<SwitchMember> _members; |
| 11462 |
9791 /** | 11463 /** |
9792 * The right curly bracket. | 11464 * The right curly bracket. |
9793 */ | 11465 */ |
9794 Token _rightBracket; | 11466 Token _rightBracket; |
| 11467 |
9795 /** | 11468 /** |
9796 * Initialize a newly created switch statement. | 11469 * Initialize a newly created switch statement. |
9797 * @param keyword the token representing the 'switch' keyword | 11470 * @param keyword the token representing the 'switch' keyword |
9798 * @param leftParenthesis the left parenthesis | 11471 * @param leftParenthesis the left parenthesis |
9799 * @param expression the expression used to determine which of the switch memb
ers will be selected | 11472 * @param expression the expression used to determine which of the switch memb
ers will be selected |
9800 * @param rightParenthesis the right parenthesis | 11473 * @param rightParenthesis the right parenthesis |
9801 * @param leftBracket the left curly bracket | 11474 * @param leftBracket the left curly bracket |
9802 * @param members the switch members that can be selected by the expression | 11475 * @param members the switch members that can be selected by the expression |
9803 * @param rightBracket the right curly bracket | 11476 * @param rightBracket the right curly bracket |
9804 */ | 11477 */ |
9805 SwitchStatement.full(Token keyword, Token leftParenthesis, Expression expressi
on, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token
rightBracket) { | 11478 SwitchStatement.full(Token keyword, Token leftParenthesis, Expression expressi
on, Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token
rightBracket) { |
9806 this._members = new NodeList<SwitchMember>(this); | 11479 this._members = new NodeList<SwitchMember>(this); |
9807 this._keyword = keyword; | 11480 this._keyword = keyword; |
9808 this._leftParenthesis = leftParenthesis; | 11481 this._leftParenthesis = leftParenthesis; |
9809 this._expression = becomeParentOf(expression); | 11482 this._expression = becomeParentOf(expression); |
9810 this._rightParenthesis = rightParenthesis; | 11483 this._rightParenthesis = rightParenthesis; |
9811 this._leftBracket = leftBracket; | 11484 this._leftBracket = leftBracket; |
9812 this._members.addAll(members); | 11485 this._members.addAll(members); |
9813 this._rightBracket = rightBracket; | 11486 this._rightBracket = rightBracket; |
9814 } | 11487 } |
| 11488 |
9815 /** | 11489 /** |
9816 * Initialize a newly created switch statement. | 11490 * Initialize a newly created switch statement. |
9817 * @param keyword the token representing the 'switch' keyword | 11491 * @param keyword the token representing the 'switch' keyword |
9818 * @param leftParenthesis the left parenthesis | 11492 * @param leftParenthesis the left parenthesis |
9819 * @param expression the expression used to determine which of the switch memb
ers will be selected | 11493 * @param expression the expression used to determine which of the switch memb
ers will be selected |
9820 * @param rightParenthesis the right parenthesis | 11494 * @param rightParenthesis the right parenthesis |
9821 * @param leftBracket the left curly bracket | 11495 * @param leftBracket the left curly bracket |
9822 * @param members the switch members that can be selected by the expression | 11496 * @param members the switch members that can be selected by the expression |
9823 * @param rightBracket the right curly bracket | 11497 * @param rightBracket the right curly bracket |
9824 */ | 11498 */ |
9825 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); | 11499 SwitchStatement({Token keyword, Token leftParenthesis, Expression expression,
Token rightParenthesis, Token leftBracket, List<SwitchMember> members, Token rig
htBracket}) : this.full(keyword, leftParenthesis, expression, rightParenthesis,
leftBracket, members, rightBracket); |
9826 accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this); | 11500 accept(ASTVisitor visitor) => visitor.visitSwitchStatement(this); |
9827 Token get beginToken => _keyword; | 11501 Token get beginToken => _keyword; |
9828 Token get endToken => _rightBracket; | 11502 Token get endToken => _rightBracket; |
| 11503 |
9829 /** | 11504 /** |
9830 * Return the expression used to determine which of the switch members will be
selected. | 11505 * Return the expression used to determine which of the switch members will be
selected. |
9831 * @return the expression used to determine which of the switch members will b
e selected | 11506 * @return the expression used to determine which of the switch members will b
e selected |
9832 */ | 11507 */ |
9833 Expression get expression => _expression; | 11508 Expression get expression => _expression; |
| 11509 |
9834 /** | 11510 /** |
9835 * Return the token representing the 'switch' keyword. | 11511 * Return the token representing the 'switch' keyword. |
9836 * @return the token representing the 'switch' keyword | 11512 * @return the token representing the 'switch' keyword |
9837 */ | 11513 */ |
9838 Token get keyword => _keyword; | 11514 Token get keyword => _keyword; |
| 11515 |
9839 /** | 11516 /** |
9840 * Return the left curly bracket. | 11517 * Return the left curly bracket. |
9841 * @return the left curly bracket | 11518 * @return the left curly bracket |
9842 */ | 11519 */ |
9843 Token get leftBracket => _leftBracket; | 11520 Token get leftBracket => _leftBracket; |
| 11521 |
9844 /** | 11522 /** |
9845 * Return the left parenthesis. | 11523 * Return the left parenthesis. |
9846 * @return the left parenthesis | 11524 * @return the left parenthesis |
9847 */ | 11525 */ |
9848 Token get leftParenthesis => _leftParenthesis; | 11526 Token get leftParenthesis => _leftParenthesis; |
| 11527 |
9849 /** | 11528 /** |
9850 * Return the switch members that can be selected by the expression. | 11529 * Return the switch members that can be selected by the expression. |
9851 * @return the switch members that can be selected by the expression | 11530 * @return the switch members that can be selected by the expression |
9852 */ | 11531 */ |
9853 NodeList<SwitchMember> get members => _members; | 11532 NodeList<SwitchMember> get members => _members; |
| 11533 |
9854 /** | 11534 /** |
9855 * Return the right curly bracket. | 11535 * Return the right curly bracket. |
9856 * @return the right curly bracket | 11536 * @return the right curly bracket |
9857 */ | 11537 */ |
9858 Token get rightBracket => _rightBracket; | 11538 Token get rightBracket => _rightBracket; |
| 11539 |
9859 /** | 11540 /** |
9860 * Return the right parenthesis. | 11541 * Return the right parenthesis. |
9861 * @return the right parenthesis | 11542 * @return the right parenthesis |
9862 */ | 11543 */ |
9863 Token get rightParenthesis => _rightParenthesis; | 11544 Token get rightParenthesis => _rightParenthesis; |
| 11545 |
9864 /** | 11546 /** |
9865 * Set the expression used to determine which of the switch members will be se
lected to the given | 11547 * Set the expression used to determine which of the switch members will be se
lected to the given |
9866 * expression. | 11548 * expression. |
9867 * @param expression the expression used to determine which of the switch memb
ers will be selected | 11549 * @param expression the expression used to determine which of the switch memb
ers will be selected |
9868 */ | 11550 */ |
9869 void set expression(Expression expression2) { | 11551 void set expression(Expression expression2) { |
9870 this._expression = becomeParentOf(expression2); | 11552 this._expression = becomeParentOf(expression2); |
9871 } | 11553 } |
| 11554 |
9872 /** | 11555 /** |
9873 * Set the token representing the 'switch' keyword to the given token. | 11556 * Set the token representing the 'switch' keyword to the given token. |
9874 * @param keyword the token representing the 'switch' keyword | 11557 * @param keyword the token representing the 'switch' keyword |
9875 */ | 11558 */ |
9876 void set keyword(Token keyword2) { | 11559 void set keyword(Token keyword2) { |
9877 this._keyword = keyword2; | 11560 this._keyword = keyword2; |
9878 } | 11561 } |
| 11562 |
9879 /** | 11563 /** |
9880 * Set the left curly bracket to the given token. | 11564 * Set the left curly bracket to the given token. |
9881 * @param leftBracket the left curly bracket | 11565 * @param leftBracket the left curly bracket |
9882 */ | 11566 */ |
9883 void set leftBracket(Token leftBracket2) { | 11567 void set leftBracket(Token leftBracket2) { |
9884 this._leftBracket = leftBracket2; | 11568 this._leftBracket = leftBracket2; |
9885 } | 11569 } |
| 11570 |
9886 /** | 11571 /** |
9887 * Set the left parenthesis to the given token. | 11572 * Set the left parenthesis to the given token. |
9888 * @param leftParenthesis the left parenthesis | 11573 * @param leftParenthesis the left parenthesis |
9889 */ | 11574 */ |
9890 void set leftParenthesis(Token leftParenthesis2) { | 11575 void set leftParenthesis(Token leftParenthesis2) { |
9891 this._leftParenthesis = leftParenthesis2; | 11576 this._leftParenthesis = leftParenthesis2; |
9892 } | 11577 } |
| 11578 |
9893 /** | 11579 /** |
9894 * Set the right curly bracket to the given token. | 11580 * Set the right curly bracket to the given token. |
9895 * @param rightBracket the right curly bracket | 11581 * @param rightBracket the right curly bracket |
9896 */ | 11582 */ |
9897 void set rightBracket(Token rightBracket2) { | 11583 void set rightBracket(Token rightBracket2) { |
9898 this._rightBracket = rightBracket2; | 11584 this._rightBracket = rightBracket2; |
9899 } | 11585 } |
| 11586 |
9900 /** | 11587 /** |
9901 * Set the right parenthesis to the given token. | 11588 * Set the right parenthesis to the given token. |
9902 * @param rightParenthesis the right parenthesis | 11589 * @param rightParenthesis the right parenthesis |
9903 */ | 11590 */ |
9904 void set rightParenthesis(Token rightParenthesis2) { | 11591 void set rightParenthesis(Token rightParenthesis2) { |
9905 this._rightParenthesis = rightParenthesis2; | 11592 this._rightParenthesis = rightParenthesis2; |
9906 } | 11593 } |
9907 void visitChildren(ASTVisitor<Object> visitor) { | 11594 void visitChildren(ASTVisitor<Object> visitor) { |
9908 safelyVisitChild(_expression, visitor); | 11595 safelyVisitChild(_expression, visitor); |
9909 _members.accept(visitor); | 11596 _members.accept(visitor); |
9910 } | 11597 } |
9911 } | 11598 } |
| 11599 |
9912 /** | 11600 /** |
9913 * Instances of the class {@code ThisExpression} represent a this expression. | 11601 * Instances of the class {@code ThisExpression} represent a this expression. |
9914 * <pre> | 11602 * <pre> |
9915 * thisExpression ::= | 11603 * thisExpression ::= |
9916 * 'this' | 11604 * 'this' |
9917 * </pre> | 11605 * </pre> |
9918 * @coverage dart.engine.ast | 11606 * @coverage dart.engine.ast |
9919 */ | 11607 */ |
9920 class ThisExpression extends Expression { | 11608 class ThisExpression extends Expression { |
| 11609 |
9921 /** | 11610 /** |
9922 * The token representing the keyword. | 11611 * The token representing the keyword. |
9923 */ | 11612 */ |
9924 Token _keyword; | 11613 Token _keyword; |
| 11614 |
9925 /** | 11615 /** |
9926 * Initialize a newly created this expression. | 11616 * Initialize a newly created this expression. |
9927 * @param keyword the token representing the keyword | 11617 * @param keyword the token representing the keyword |
9928 */ | 11618 */ |
9929 ThisExpression.full(Token keyword) { | 11619 ThisExpression.full(Token keyword) { |
9930 this._keyword = keyword; | 11620 this._keyword = keyword; |
9931 } | 11621 } |
| 11622 |
9932 /** | 11623 /** |
9933 * Initialize a newly created this expression. | 11624 * Initialize a newly created this expression. |
9934 * @param keyword the token representing the keyword | 11625 * @param keyword the token representing the keyword |
9935 */ | 11626 */ |
9936 ThisExpression({Token keyword}) : this.full(keyword); | 11627 ThisExpression({Token keyword}) : this.full(keyword); |
9937 accept(ASTVisitor visitor) => visitor.visitThisExpression(this); | 11628 accept(ASTVisitor visitor) => visitor.visitThisExpression(this); |
9938 Token get beginToken => _keyword; | 11629 Token get beginToken => _keyword; |
9939 Token get endToken => _keyword; | 11630 Token get endToken => _keyword; |
| 11631 |
9940 /** | 11632 /** |
9941 * Return the token representing the keyword. | 11633 * Return the token representing the keyword. |
9942 * @return the token representing the keyword | 11634 * @return the token representing the keyword |
9943 */ | 11635 */ |
9944 Token get keyword => _keyword; | 11636 Token get keyword => _keyword; |
| 11637 |
9945 /** | 11638 /** |
9946 * Set the token representing the keyword to the given token. | 11639 * Set the token representing the keyword to the given token. |
9947 * @param keyword the token representing the keyword | 11640 * @param keyword the token representing the keyword |
9948 */ | 11641 */ |
9949 void set keyword(Token keyword2) { | 11642 void set keyword(Token keyword2) { |
9950 this._keyword = keyword2; | 11643 this._keyword = keyword2; |
9951 } | 11644 } |
9952 void visitChildren(ASTVisitor<Object> visitor) { | 11645 void visitChildren(ASTVisitor<Object> visitor) { |
9953 } | 11646 } |
9954 } | 11647 } |
| 11648 |
9955 /** | 11649 /** |
9956 * Instances of the class {@code ThrowExpression} represent a throw expression. | 11650 * Instances of the class {@code ThrowExpression} represent a throw expression. |
9957 * <pre> | 11651 * <pre> |
9958 * throwExpression ::= | 11652 * throwExpression ::= |
9959 * 'throw' {@link Expression expression}</pre> | 11653 * 'throw' {@link Expression expression}</pre> |
9960 * @coverage dart.engine.ast | 11654 * @coverage dart.engine.ast |
9961 */ | 11655 */ |
9962 class ThrowExpression extends Expression { | 11656 class ThrowExpression extends Expression { |
| 11657 |
9963 /** | 11658 /** |
9964 * The token representing the 'throw' keyword. | 11659 * The token representing the 'throw' keyword. |
9965 */ | 11660 */ |
9966 Token _keyword; | 11661 Token _keyword; |
| 11662 |
9967 /** | 11663 /** |
9968 * The expression computing the exception to be thrown. | 11664 * The expression computing the exception to be thrown. |
9969 */ | 11665 */ |
9970 Expression _expression; | 11666 Expression _expression; |
| 11667 |
9971 /** | 11668 /** |
9972 * Initialize a newly created throw expression. | 11669 * Initialize a newly created throw expression. |
9973 * @param keyword the token representing the 'throw' keyword | 11670 * @param keyword the token representing the 'throw' keyword |
9974 * @param expression the expression computing the exception to be thrown | 11671 * @param expression the expression computing the exception to be thrown |
9975 */ | 11672 */ |
9976 ThrowExpression.full(Token keyword, Expression expression) { | 11673 ThrowExpression.full(Token keyword, Expression expression) { |
9977 this._keyword = keyword; | 11674 this._keyword = keyword; |
9978 this._expression = becomeParentOf(expression); | 11675 this._expression = becomeParentOf(expression); |
9979 } | 11676 } |
| 11677 |
9980 /** | 11678 /** |
9981 * Initialize a newly created throw expression. | 11679 * Initialize a newly created throw expression. |
9982 * @param keyword the token representing the 'throw' keyword | 11680 * @param keyword the token representing the 'throw' keyword |
9983 * @param expression the expression computing the exception to be thrown | 11681 * @param expression the expression computing the exception to be thrown |
9984 */ | 11682 */ |
9985 ThrowExpression({Token keyword, Expression expression}) : this.full(keyword, e
xpression); | 11683 ThrowExpression({Token keyword, Expression expression}) : this.full(keyword, e
xpression); |
9986 accept(ASTVisitor visitor) => visitor.visitThrowExpression(this); | 11684 accept(ASTVisitor visitor) => visitor.visitThrowExpression(this); |
9987 Token get beginToken => _keyword; | 11685 Token get beginToken => _keyword; |
9988 Token get endToken { | 11686 Token get endToken { |
9989 if (_expression != null) { | 11687 if (_expression != null) { |
9990 return _expression.endToken; | 11688 return _expression.endToken; |
9991 } | 11689 } |
9992 return _keyword; | 11690 return _keyword; |
9993 } | 11691 } |
| 11692 |
9994 /** | 11693 /** |
9995 * Return the expression computing the exception to be thrown. | 11694 * Return the expression computing the exception to be thrown. |
9996 * @return the expression computing the exception to be thrown | 11695 * @return the expression computing the exception to be thrown |
9997 */ | 11696 */ |
9998 Expression get expression => _expression; | 11697 Expression get expression => _expression; |
| 11698 |
9999 /** | 11699 /** |
10000 * Return the token representing the 'throw' keyword. | 11700 * Return the token representing the 'throw' keyword. |
10001 * @return the token representing the 'throw' keyword | 11701 * @return the token representing the 'throw' keyword |
10002 */ | 11702 */ |
10003 Token get keyword => _keyword; | 11703 Token get keyword => _keyword; |
| 11704 |
10004 /** | 11705 /** |
10005 * Set the expression computing the exception to be thrown to the given expres
sion. | 11706 * Set the expression computing the exception to be thrown to the given expres
sion. |
10006 * @param expression the expression computing the exception to be thrown | 11707 * @param expression the expression computing the exception to be thrown |
10007 */ | 11708 */ |
10008 void set expression(Expression expression2) { | 11709 void set expression(Expression expression2) { |
10009 this._expression = becomeParentOf(expression2); | 11710 this._expression = becomeParentOf(expression2); |
10010 } | 11711 } |
| 11712 |
10011 /** | 11713 /** |
10012 * Set the token representing the 'throw' keyword to the given token. | 11714 * Set the token representing the 'throw' keyword to the given token. |
10013 * @param keyword the token representing the 'throw' keyword | 11715 * @param keyword the token representing the 'throw' keyword |
10014 */ | 11716 */ |
10015 void set keyword(Token keyword2) { | 11717 void set keyword(Token keyword2) { |
10016 this._keyword = keyword2; | 11718 this._keyword = keyword2; |
10017 } | 11719 } |
10018 void visitChildren(ASTVisitor<Object> visitor) { | 11720 void visitChildren(ASTVisitor<Object> visitor) { |
10019 safelyVisitChild(_expression, visitor); | 11721 safelyVisitChild(_expression, visitor); |
10020 } | 11722 } |
10021 } | 11723 } |
| 11724 |
10022 /** | 11725 /** |
10023 * Instances of the class {@code TopLevelVariableDeclaration} represent the decl
aration of one or | 11726 * Instances of the class {@code TopLevelVariableDeclaration} represent the decl
aration of one or |
10024 * more top-level variables of the same type. | 11727 * more top-level variables of the same type. |
10025 * <pre> | 11728 * <pre> |
10026 * topLevelVariableDeclaration ::= | 11729 * topLevelVariableDeclaration ::= |
10027 * ('final' | 'const') type? staticFinalDeclarationList ';' | 11730 * ('final' | 'const') type? staticFinalDeclarationList ';' |
10028 * | variableDeclaration ';' | 11731 * | variableDeclaration ';' |
10029 * </pre> | 11732 * </pre> |
10030 * @coverage dart.engine.ast | 11733 * @coverage dart.engine.ast |
10031 */ | 11734 */ |
10032 class TopLevelVariableDeclaration extends CompilationUnitMember { | 11735 class TopLevelVariableDeclaration extends CompilationUnitMember { |
| 11736 |
10033 /** | 11737 /** |
10034 * The top-level variables being declared. | 11738 * The top-level variables being declared. |
10035 */ | 11739 */ |
10036 VariableDeclarationList _variableList; | 11740 VariableDeclarationList _variableList; |
| 11741 |
10037 /** | 11742 /** |
10038 * The semicolon terminating the declaration. | 11743 * The semicolon terminating the declaration. |
10039 */ | 11744 */ |
10040 Token _semicolon; | 11745 Token _semicolon; |
| 11746 |
10041 /** | 11747 /** |
10042 * Initialize a newly created top-level variable declaration. | 11748 * Initialize a newly created top-level variable declaration. |
10043 * @param comment the documentation comment associated with this variable | 11749 * @param comment the documentation comment associated with this variable |
10044 * @param metadata the annotations associated with this variable | 11750 * @param metadata the annotations associated with this variable |
10045 * @param variableList the top-level variables being declared | 11751 * @param variableList the top-level variables being declared |
10046 * @param semicolon the semicolon terminating the declaration | 11752 * @param semicolon the semicolon terminating the declaration |
10047 */ | 11753 */ |
10048 TopLevelVariableDeclaration.full(Comment comment, List<Annotation> metadata, V
ariableDeclarationList variableList, Token semicolon) : super.full(comment, meta
data) { | 11754 TopLevelVariableDeclaration.full(Comment comment, List<Annotation> metadata, V
ariableDeclarationList variableList, Token semicolon) : super.full(comment, meta
data) { |
10049 this._variableList = becomeParentOf(variableList); | 11755 this._variableList = becomeParentOf(variableList); |
10050 this._semicolon = semicolon; | 11756 this._semicolon = semicolon; |
10051 } | 11757 } |
| 11758 |
10052 /** | 11759 /** |
10053 * Initialize a newly created top-level variable declaration. | 11760 * Initialize a newly created top-level variable declaration. |
10054 * @param comment the documentation comment associated with this variable | 11761 * @param comment the documentation comment associated with this variable |
10055 * @param metadata the annotations associated with this variable | 11762 * @param metadata the annotations associated with this variable |
10056 * @param variableList the top-level variables being declared | 11763 * @param variableList the top-level variables being declared |
10057 * @param semicolon the semicolon terminating the declaration | 11764 * @param semicolon the semicolon terminating the declaration |
10058 */ | 11765 */ |
10059 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia
bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata
, variableList, semicolon); | 11766 TopLevelVariableDeclaration({Comment comment, List<Annotation> metadata, Varia
bleDeclarationList variableList, Token semicolon}) : this.full(comment, metadata
, variableList, semicolon); |
10060 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); | 11767 accept(ASTVisitor visitor) => visitor.visitTopLevelVariableDeclaration(this); |
10061 Element get element => null; | 11768 Element get element => null; |
10062 Token get endToken => _semicolon; | 11769 Token get endToken => _semicolon; |
| 11770 |
10063 /** | 11771 /** |
10064 * Return the semicolon terminating the declaration. | 11772 * Return the semicolon terminating the declaration. |
10065 * @return the semicolon terminating the declaration | 11773 * @return the semicolon terminating the declaration |
10066 */ | 11774 */ |
10067 Token get semicolon => _semicolon; | 11775 Token get semicolon => _semicolon; |
| 11776 |
10068 /** | 11777 /** |
10069 * Return the top-level variables being declared. | 11778 * Return the top-level variables being declared. |
10070 * @return the top-level variables being declared | 11779 * @return the top-level variables being declared |
10071 */ | 11780 */ |
10072 VariableDeclarationList get variables => _variableList; | 11781 VariableDeclarationList get variables => _variableList; |
| 11782 |
10073 /** | 11783 /** |
10074 * Set the semicolon terminating the declaration to the given token. | 11784 * Set the semicolon terminating the declaration to the given token. |
10075 * @param semicolon the semicolon terminating the declaration | 11785 * @param semicolon the semicolon terminating the declaration |
10076 */ | 11786 */ |
10077 void set semicolon(Token semicolon2) { | 11787 void set semicolon(Token semicolon2) { |
10078 this._semicolon = semicolon2; | 11788 this._semicolon = semicolon2; |
10079 } | 11789 } |
| 11790 |
10080 /** | 11791 /** |
10081 * Set the top-level variables being declared to the given list of variables. | 11792 * Set the top-level variables being declared to the given list of variables. |
10082 * @param variableList the top-level variables being declared | 11793 * @param variableList the top-level variables being declared |
10083 */ | 11794 */ |
10084 void set variables(VariableDeclarationList variableList) { | 11795 void set variables(VariableDeclarationList variableList) { |
10085 variableList = becomeParentOf(variableList); | 11796 variableList = becomeParentOf(variableList); |
10086 } | 11797 } |
10087 void visitChildren(ASTVisitor<Object> visitor) { | 11798 void visitChildren(ASTVisitor<Object> visitor) { |
10088 super.visitChildren(visitor); | 11799 super.visitChildren(visitor); |
10089 safelyVisitChild(_variableList, visitor); | 11800 safelyVisitChild(_variableList, visitor); |
10090 } | 11801 } |
10091 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; | 11802 Token get firstTokenAfterCommentAndMetadata => _variableList.beginToken; |
10092 } | 11803 } |
| 11804 |
10093 /** | 11805 /** |
10094 * Instances of the class {@code TryStatement} represent a try statement. | 11806 * Instances of the class {@code TryStatement} represent a try statement. |
10095 * <pre> | 11807 * <pre> |
10096 * tryStatement ::= | 11808 * tryStatement ::= |
10097 * 'try' {@link Block block} ({@link CatchClause catchClause}+ finallyClause? |
finallyClause) | 11809 * 'try' {@link Block block} ({@link CatchClause catchClause}+ finallyClause? |
finallyClause) |
10098 * finallyClause ::= | 11810 * finallyClause ::= |
10099 * 'finally' {@link Block block}</pre> | 11811 * 'finally' {@link Block block}</pre> |
10100 * @coverage dart.engine.ast | 11812 * @coverage dart.engine.ast |
10101 */ | 11813 */ |
10102 class TryStatement extends Statement { | 11814 class TryStatement extends Statement { |
| 11815 |
10103 /** | 11816 /** |
10104 * The token representing the 'try' keyword. | 11817 * The token representing the 'try' keyword. |
10105 */ | 11818 */ |
10106 Token _tryKeyword; | 11819 Token _tryKeyword; |
| 11820 |
10107 /** | 11821 /** |
10108 * The body of the statement. | 11822 * The body of the statement. |
10109 */ | 11823 */ |
10110 Block _body; | 11824 Block _body; |
| 11825 |
10111 /** | 11826 /** |
10112 * The catch clauses contained in the try statement. | 11827 * The catch clauses contained in the try statement. |
10113 */ | 11828 */ |
10114 NodeList<CatchClause> _catchClauses; | 11829 NodeList<CatchClause> _catchClauses; |
| 11830 |
10115 /** | 11831 /** |
10116 * The token representing the 'finally' keyword, or {@code null} if the statem
ent does not contain | 11832 * The token representing the 'finally' keyword, or {@code null} if the statem
ent does not contain |
10117 * a finally clause. | 11833 * a finally clause. |
10118 */ | 11834 */ |
10119 Token _finallyKeyword; | 11835 Token _finallyKeyword; |
| 11836 |
10120 /** | 11837 /** |
10121 * The finally clause contained in the try statement, or {@code null} if the s
tatement does not | 11838 * The finally clause contained in the try statement, or {@code null} if the s
tatement does not |
10122 * contain a finally clause. | 11839 * contain a finally clause. |
10123 */ | 11840 */ |
10124 Block _finallyClause; | 11841 Block _finallyClause; |
| 11842 |
10125 /** | 11843 /** |
10126 * Initialize a newly created try statement. | 11844 * Initialize a newly created try statement. |
10127 * @param tryKeyword the token representing the 'try' keyword | 11845 * @param tryKeyword the token representing the 'try' keyword |
10128 * @param body the body of the statement | 11846 * @param body the body of the statement |
10129 * @param catchClauses the catch clauses contained in the try statement | 11847 * @param catchClauses the catch clauses contained in the try statement |
10130 * @param finallyKeyword the token representing the 'finally' keyword | 11848 * @param finallyKeyword the token representing the 'finally' keyword |
10131 * @param finallyClause the finally clause contained in the try statement | 11849 * @param finallyClause the finally clause contained in the try statement |
10132 */ | 11850 */ |
10133 TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses
, Token finallyKeyword, Block finallyClause) { | 11851 TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses
, Token finallyKeyword, Block finallyClause) { |
10134 this._catchClauses = new NodeList<CatchClause>(this); | 11852 this._catchClauses = new NodeList<CatchClause>(this); |
10135 this._tryKeyword = tryKeyword; | 11853 this._tryKeyword = tryKeyword; |
10136 this._body = becomeParentOf(body); | 11854 this._body = becomeParentOf(body); |
10137 this._catchClauses.addAll(catchClauses); | 11855 this._catchClauses.addAll(catchClauses); |
10138 this._finallyKeyword = finallyKeyword; | 11856 this._finallyKeyword = finallyKeyword; |
10139 this._finallyClause = becomeParentOf(finallyClause); | 11857 this._finallyClause = becomeParentOf(finallyClause); |
10140 } | 11858 } |
| 11859 |
10141 /** | 11860 /** |
10142 * Initialize a newly created try statement. | 11861 * Initialize a newly created try statement. |
10143 * @param tryKeyword the token representing the 'try' keyword | 11862 * @param tryKeyword the token representing the 'try' keyword |
10144 * @param body the body of the statement | 11863 * @param body the body of the statement |
10145 * @param catchClauses the catch clauses contained in the try statement | 11864 * @param catchClauses the catch clauses contained in the try statement |
10146 * @param finallyKeyword the token representing the 'finally' keyword | 11865 * @param finallyKeyword the token representing the 'finally' keyword |
10147 * @param finallyClause the finally clause contained in the try statement | 11866 * @param finallyClause the finally clause contained in the try statement |
10148 */ | 11867 */ |
10149 TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, To
ken finallyKeyword, Block finallyClause}) : this.full(tryKeyword, body, catchCla
uses, finallyKeyword, finallyClause); | 11868 TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, To
ken finallyKeyword, Block finallyClause}) : this.full(tryKeyword, body, catchCla
uses, finallyKeyword, finallyClause); |
10150 accept(ASTVisitor visitor) => visitor.visitTryStatement(this); | 11869 accept(ASTVisitor visitor) => visitor.visitTryStatement(this); |
10151 Token get beginToken => _tryKeyword; | 11870 Token get beginToken => _tryKeyword; |
| 11871 |
10152 /** | 11872 /** |
10153 * Return the body of the statement. | 11873 * Return the body of the statement. |
10154 * @return the body of the statement | 11874 * @return the body of the statement |
10155 */ | 11875 */ |
10156 Block get body => _body; | 11876 Block get body => _body; |
| 11877 |
10157 /** | 11878 /** |
10158 * Return the catch clauses contained in the try statement. | 11879 * Return the catch clauses contained in the try statement. |
10159 * @return the catch clauses contained in the try statement | 11880 * @return the catch clauses contained in the try statement |
10160 */ | 11881 */ |
10161 NodeList<CatchClause> get catchClauses => _catchClauses; | 11882 NodeList<CatchClause> get catchClauses => _catchClauses; |
10162 Token get endToken { | 11883 Token get endToken { |
10163 if (_finallyClause != null) { | 11884 if (_finallyClause != null) { |
10164 return _finallyClause.endToken; | 11885 return _finallyClause.endToken; |
10165 } else if (_finallyKeyword != null) { | 11886 } else if (_finallyKeyword != null) { |
10166 return _finallyKeyword; | 11887 return _finallyKeyword; |
10167 } else if (!_catchClauses.isEmpty) { | 11888 } else if (!_catchClauses.isEmpty) { |
10168 return _catchClauses.endToken; | 11889 return _catchClauses.endToken; |
10169 } | 11890 } |
10170 return _body.endToken; | 11891 return _body.endToken; |
10171 } | 11892 } |
| 11893 |
10172 /** | 11894 /** |
10173 * Return the finally clause contained in the try statement, or {@code null} i
f the statement does | 11895 * Return the finally clause contained in the try statement, or {@code null} i
f the statement does |
10174 * not contain a finally clause. | 11896 * not contain a finally clause. |
10175 * @return the finally clause contained in the try statement | 11897 * @return the finally clause contained in the try statement |
10176 */ | 11898 */ |
10177 Block get finallyClause => _finallyClause; | 11899 Block get finallyClause => _finallyClause; |
| 11900 |
10178 /** | 11901 /** |
10179 * Return the token representing the 'finally' keyword, or {@code null} if the
statement does not | 11902 * Return the token representing the 'finally' keyword, or {@code null} if the
statement does not |
10180 * contain a finally clause. | 11903 * contain a finally clause. |
10181 * @return the token representing the 'finally' keyword | 11904 * @return the token representing the 'finally' keyword |
10182 */ | 11905 */ |
10183 Token get finallyKeyword => _finallyKeyword; | 11906 Token get finallyKeyword => _finallyKeyword; |
| 11907 |
10184 /** | 11908 /** |
10185 * Return the token representing the 'try' keyword. | 11909 * Return the token representing the 'try' keyword. |
10186 * @return the token representing the 'try' keyword | 11910 * @return the token representing the 'try' keyword |
10187 */ | 11911 */ |
10188 Token get tryKeyword => _tryKeyword; | 11912 Token get tryKeyword => _tryKeyword; |
| 11913 |
10189 /** | 11914 /** |
10190 * Set the body of the statement to the given block. | 11915 * Set the body of the statement to the given block. |
10191 * @param block the body of the statement | 11916 * @param block the body of the statement |
10192 */ | 11917 */ |
10193 void set body(Block block) { | 11918 void set body(Block block) { |
10194 _body = becomeParentOf(block); | 11919 _body = becomeParentOf(block); |
10195 } | 11920 } |
| 11921 |
10196 /** | 11922 /** |
10197 * Set the finally clause contained in the try statement to the given block. | 11923 * Set the finally clause contained in the try statement to the given block. |
10198 * @param block the finally clause contained in the try statement | 11924 * @param block the finally clause contained in the try statement |
10199 */ | 11925 */ |
10200 void set finallyClause(Block block) { | 11926 void set finallyClause(Block block) { |
10201 _finallyClause = becomeParentOf(block); | 11927 _finallyClause = becomeParentOf(block); |
10202 } | 11928 } |
| 11929 |
10203 /** | 11930 /** |
10204 * Set the token representing the 'finally' keyword to the given token. | 11931 * Set the token representing the 'finally' keyword to the given token. |
10205 * @param finallyKeyword the token representing the 'finally' keyword | 11932 * @param finallyKeyword the token representing the 'finally' keyword |
10206 */ | 11933 */ |
10207 void set finallyKeyword(Token finallyKeyword2) { | 11934 void set finallyKeyword(Token finallyKeyword2) { |
10208 this._finallyKeyword = finallyKeyword2; | 11935 this._finallyKeyword = finallyKeyword2; |
10209 } | 11936 } |
| 11937 |
10210 /** | 11938 /** |
10211 * Set the token representing the 'try' keyword to the given token. | 11939 * Set the token representing the 'try' keyword to the given token. |
10212 * @param tryKeyword the token representing the 'try' keyword | 11940 * @param tryKeyword the token representing the 'try' keyword |
10213 */ | 11941 */ |
10214 void set tryKeyword(Token tryKeyword2) { | 11942 void set tryKeyword(Token tryKeyword2) { |
10215 this._tryKeyword = tryKeyword2; | 11943 this._tryKeyword = tryKeyword2; |
10216 } | 11944 } |
10217 void visitChildren(ASTVisitor<Object> visitor) { | 11945 void visitChildren(ASTVisitor<Object> visitor) { |
10218 safelyVisitChild(_body, visitor); | 11946 safelyVisitChild(_body, visitor); |
10219 _catchClauses.accept(visitor); | 11947 _catchClauses.accept(visitor); |
10220 safelyVisitChild(_finallyClause, visitor); | 11948 safelyVisitChild(_finallyClause, visitor); |
10221 } | 11949 } |
10222 } | 11950 } |
| 11951 |
10223 /** | 11952 /** |
10224 * The abstract class {@code TypeAlias} defines the behavior common to declarati
ons of type aliases. | 11953 * The abstract class {@code TypeAlias} defines the behavior common to declarati
ons of type aliases. |
10225 * <pre> | 11954 * <pre> |
10226 * typeAlias ::= | 11955 * typeAlias ::= |
10227 * 'typedef' typeAliasBody | 11956 * 'typedef' typeAliasBody |
10228 * typeAliasBody ::= | 11957 * typeAliasBody ::= |
10229 * classTypeAlias | 11958 * classTypeAlias |
10230 * | functionTypeAlias | 11959 * | functionTypeAlias |
10231 * </pre> | 11960 * </pre> |
10232 * @coverage dart.engine.ast | 11961 * @coverage dart.engine.ast |
10233 */ | 11962 */ |
10234 abstract class TypeAlias extends CompilationUnitMember { | 11963 abstract class TypeAlias extends CompilationUnitMember { |
| 11964 |
10235 /** | 11965 /** |
10236 * The token representing the 'typedef' keyword. | 11966 * The token representing the 'typedef' keyword. |
10237 */ | 11967 */ |
10238 Token _keyword; | 11968 Token _keyword; |
| 11969 |
10239 /** | 11970 /** |
10240 * The semicolon terminating the declaration. | 11971 * The semicolon terminating the declaration. |
10241 */ | 11972 */ |
10242 Token _semicolon; | 11973 Token _semicolon; |
| 11974 |
10243 /** | 11975 /** |
10244 * Initialize a newly created type alias. | 11976 * Initialize a newly created type alias. |
10245 * @param comment the documentation comment associated with this type alias | 11977 * @param comment the documentation comment associated with this type alias |
10246 * @param metadata the annotations associated with this type alias | 11978 * @param metadata the annotations associated with this type alias |
10247 * @param keyword the token representing the 'typedef' keyword | 11979 * @param keyword the token representing the 'typedef' keyword |
10248 * @param semicolon the semicolon terminating the declaration | 11980 * @param semicolon the semicolon terminating the declaration |
10249 */ | 11981 */ |
10250 TypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, Toke
n semicolon) : super.full(comment, metadata) { | 11982 TypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, Toke
n semicolon) : super.full(comment, metadata) { |
10251 this._keyword = keyword; | 11983 this._keyword = keyword; |
10252 this._semicolon = semicolon; | 11984 this._semicolon = semicolon; |
10253 } | 11985 } |
| 11986 |
10254 /** | 11987 /** |
10255 * Initialize a newly created type alias. | 11988 * Initialize a newly created type alias. |
10256 * @param comment the documentation comment associated with this type alias | 11989 * @param comment the documentation comment associated with this type alias |
10257 * @param metadata the annotations associated with this type alias | 11990 * @param metadata the annotations associated with this type alias |
10258 * @param keyword the token representing the 'typedef' keyword | 11991 * @param keyword the token representing the 'typedef' keyword |
10259 * @param semicolon the semicolon terminating the declaration | 11992 * @param semicolon the semicolon terminating the declaration |
10260 */ | 11993 */ |
10261 TypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Token se
micolon}) : this.full(comment, metadata, keyword, semicolon); | 11994 TypeAlias({Comment comment, List<Annotation> metadata, Token keyword, Token se
micolon}) : this.full(comment, metadata, keyword, semicolon); |
10262 Token get endToken => _semicolon; | 11995 Token get endToken => _semicolon; |
| 11996 |
10263 /** | 11997 /** |
10264 * Return the token representing the 'typedef' keyword. | 11998 * Return the token representing the 'typedef' keyword. |
10265 * @return the token representing the 'typedef' keyword | 11999 * @return the token representing the 'typedef' keyword |
10266 */ | 12000 */ |
10267 Token get keyword => _keyword; | 12001 Token get keyword => _keyword; |
| 12002 |
10268 /** | 12003 /** |
10269 * Return the semicolon terminating the declaration. | 12004 * Return the semicolon terminating the declaration. |
10270 * @return the semicolon terminating the declaration | 12005 * @return the semicolon terminating the declaration |
10271 */ | 12006 */ |
10272 Token get semicolon => _semicolon; | 12007 Token get semicolon => _semicolon; |
| 12008 |
10273 /** | 12009 /** |
10274 * Set the token representing the 'typedef' keyword to the given token. | 12010 * Set the token representing the 'typedef' keyword to the given token. |
10275 * @param keyword the token representing the 'typedef' keyword | 12011 * @param keyword the token representing the 'typedef' keyword |
10276 */ | 12012 */ |
10277 void set keyword(Token keyword2) { | 12013 void set keyword(Token keyword2) { |
10278 this._keyword = keyword2; | 12014 this._keyword = keyword2; |
10279 } | 12015 } |
| 12016 |
10280 /** | 12017 /** |
10281 * Set the semicolon terminating the declaration to the given token. | 12018 * Set the semicolon terminating the declaration to the given token. |
10282 * @param semicolon the semicolon terminating the declaration | 12019 * @param semicolon the semicolon terminating the declaration |
10283 */ | 12020 */ |
10284 void set semicolon(Token semicolon2) { | 12021 void set semicolon(Token semicolon2) { |
10285 this._semicolon = semicolon2; | 12022 this._semicolon = semicolon2; |
10286 } | 12023 } |
10287 Token get firstTokenAfterCommentAndMetadata => _keyword; | 12024 Token get firstTokenAfterCommentAndMetadata => _keyword; |
10288 } | 12025 } |
| 12026 |
10289 /** | 12027 /** |
10290 * Instances of the class {@code TypeArgumentList} represent a list of type argu
ments. | 12028 * Instances of the class {@code TypeArgumentList} represent a list of type argu
ments. |
10291 * <pre> | 12029 * <pre> |
10292 * typeArguments ::= | 12030 * typeArguments ::= |
10293 * '<' typeName (',' typeName)* '>' | 12031 * '<' typeName (',' typeName)* '>' |
10294 * </pre> | 12032 * </pre> |
10295 * @coverage dart.engine.ast | 12033 * @coverage dart.engine.ast |
10296 */ | 12034 */ |
10297 class TypeArgumentList extends ASTNode { | 12035 class TypeArgumentList extends ASTNode { |
| 12036 |
10298 /** | 12037 /** |
10299 * The left bracket. | 12038 * The left bracket. |
10300 */ | 12039 */ |
10301 Token _leftBracket; | 12040 Token _leftBracket; |
| 12041 |
10302 /** | 12042 /** |
10303 * The type arguments associated with the type. | 12043 * The type arguments associated with the type. |
10304 */ | 12044 */ |
10305 NodeList<TypeName> _arguments; | 12045 NodeList<TypeName> _arguments; |
| 12046 |
10306 /** | 12047 /** |
10307 * The right bracket. | 12048 * The right bracket. |
10308 */ | 12049 */ |
10309 Token _rightBracket; | 12050 Token _rightBracket; |
| 12051 |
10310 /** | 12052 /** |
10311 * Initialize a newly created list of type arguments. | 12053 * Initialize a newly created list of type arguments. |
10312 * @param leftBracket the left bracket | 12054 * @param leftBracket the left bracket |
10313 * @param arguments the type arguments associated with the type | 12055 * @param arguments the type arguments associated with the type |
10314 * @param rightBracket the right bracket | 12056 * @param rightBracket the right bracket |
10315 */ | 12057 */ |
10316 TypeArgumentList.full(Token leftBracket, List<TypeName> arguments, Token right
Bracket) { | 12058 TypeArgumentList.full(Token leftBracket, List<TypeName> arguments, Token right
Bracket) { |
10317 this._arguments = new NodeList<TypeName>(this); | 12059 this._arguments = new NodeList<TypeName>(this); |
10318 this._leftBracket = leftBracket; | 12060 this._leftBracket = leftBracket; |
10319 this._arguments.addAll(arguments); | 12061 this._arguments.addAll(arguments); |
10320 this._rightBracket = rightBracket; | 12062 this._rightBracket = rightBracket; |
10321 } | 12063 } |
| 12064 |
10322 /** | 12065 /** |
10323 * Initialize a newly created list of type arguments. | 12066 * Initialize a newly created list of type arguments. |
10324 * @param leftBracket the left bracket | 12067 * @param leftBracket the left bracket |
10325 * @param arguments the type arguments associated with the type | 12068 * @param arguments the type arguments associated with the type |
10326 * @param rightBracket the right bracket | 12069 * @param rightBracket the right bracket |
10327 */ | 12070 */ |
10328 TypeArgumentList({Token leftBracket, List<TypeName> arguments, Token rightBrac
ket}) : this.full(leftBracket, arguments, rightBracket); | 12071 TypeArgumentList({Token leftBracket, List<TypeName> arguments, Token rightBrac
ket}) : this.full(leftBracket, arguments, rightBracket); |
10329 accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this); | 12072 accept(ASTVisitor visitor) => visitor.visitTypeArgumentList(this); |
| 12073 |
10330 /** | 12074 /** |
10331 * Return the type arguments associated with the type. | 12075 * Return the type arguments associated with the type. |
10332 * @return the type arguments associated with the type | 12076 * @return the type arguments associated with the type |
10333 */ | 12077 */ |
10334 NodeList<TypeName> get arguments => _arguments; | 12078 NodeList<TypeName> get arguments => _arguments; |
10335 Token get beginToken => _leftBracket; | 12079 Token get beginToken => _leftBracket; |
10336 Token get endToken => _rightBracket; | 12080 Token get endToken => _rightBracket; |
| 12081 |
10337 /** | 12082 /** |
10338 * Return the left bracket. | 12083 * Return the left bracket. |
10339 * @return the left bracket | 12084 * @return the left bracket |
10340 */ | 12085 */ |
10341 Token get leftBracket => _leftBracket; | 12086 Token get leftBracket => _leftBracket; |
| 12087 |
10342 /** | 12088 /** |
10343 * Return the right bracket. | 12089 * Return the right bracket. |
10344 * @return the right bracket | 12090 * @return the right bracket |
10345 */ | 12091 */ |
10346 Token get rightBracket => _rightBracket; | 12092 Token get rightBracket => _rightBracket; |
| 12093 |
10347 /** | 12094 /** |
10348 * Set the left bracket to the given token. | 12095 * Set the left bracket to the given token. |
10349 * @param leftBracket the left bracket | 12096 * @param leftBracket the left bracket |
10350 */ | 12097 */ |
10351 void set leftBracket(Token leftBracket2) { | 12098 void set leftBracket(Token leftBracket2) { |
10352 this._leftBracket = leftBracket2; | 12099 this._leftBracket = leftBracket2; |
10353 } | 12100 } |
| 12101 |
10354 /** | 12102 /** |
10355 * Set the right bracket to the given token. | 12103 * Set the right bracket to the given token. |
10356 * @param rightBracket the right bracket | 12104 * @param rightBracket the right bracket |
10357 */ | 12105 */ |
10358 void set rightBracket(Token rightBracket2) { | 12106 void set rightBracket(Token rightBracket2) { |
10359 this._rightBracket = rightBracket2; | 12107 this._rightBracket = rightBracket2; |
10360 } | 12108 } |
10361 void visitChildren(ASTVisitor<Object> visitor) { | 12109 void visitChildren(ASTVisitor<Object> visitor) { |
10362 _arguments.accept(visitor); | 12110 _arguments.accept(visitor); |
10363 } | 12111 } |
10364 } | 12112 } |
| 12113 |
10365 /** | 12114 /** |
10366 * Instances of the class {@code TypeName} represent the name of a type, which c
an optionally | 12115 * Instances of the class {@code TypeName} represent the name of a type, which c
an optionally |
10367 * include type arguments. | 12116 * include type arguments. |
10368 * <pre> | 12117 * <pre> |
10369 * typeName ::={@link Identifier identifier} typeArguments? | 12118 * typeName ::={@link Identifier identifier} typeArguments? |
10370 * </pre> | 12119 * </pre> |
10371 * @coverage dart.engine.ast | 12120 * @coverage dart.engine.ast |
10372 */ | 12121 */ |
10373 class TypeName extends ASTNode { | 12122 class TypeName extends ASTNode { |
| 12123 |
10374 /** | 12124 /** |
10375 * The name of the type. | 12125 * The name of the type. |
10376 */ | 12126 */ |
10377 Identifier _name; | 12127 Identifier _name; |
| 12128 |
10378 /** | 12129 /** |
10379 * The type arguments associated with the type, or {@code null} if there are n
o type arguments. | 12130 * The type arguments associated with the type, or {@code null} if there are n
o type arguments. |
10380 */ | 12131 */ |
10381 TypeArgumentList _typeArguments; | 12132 TypeArgumentList _typeArguments; |
| 12133 |
10382 /** | 12134 /** |
10383 * The type being named, or {@code null} if the AST structure has not been res
olved. | 12135 * The type being named, or {@code null} if the AST structure has not been res
olved. |
10384 */ | 12136 */ |
10385 Type2 _type; | 12137 Type2 _type; |
| 12138 |
10386 /** | 12139 /** |
10387 * Initialize a newly created type name. | 12140 * Initialize a newly created type name. |
10388 * @param name the name of the type | 12141 * @param name the name of the type |
10389 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are | 12142 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are |
10390 * no type arguments | 12143 * no type arguments |
10391 */ | 12144 */ |
10392 TypeName.full(Identifier name, TypeArgumentList typeArguments) { | 12145 TypeName.full(Identifier name, TypeArgumentList typeArguments) { |
10393 this._name = becomeParentOf(name); | 12146 this._name = becomeParentOf(name); |
10394 this._typeArguments = becomeParentOf(typeArguments); | 12147 this._typeArguments = becomeParentOf(typeArguments); |
10395 } | 12148 } |
| 12149 |
10396 /** | 12150 /** |
10397 * Initialize a newly created type name. | 12151 * Initialize a newly created type name. |
10398 * @param name the name of the type | 12152 * @param name the name of the type |
10399 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are | 12153 * @param typeArguments the type arguments associated with the type, or {@code
null} if there are |
10400 * no type arguments | 12154 * no type arguments |
10401 */ | 12155 */ |
10402 TypeName({Identifier name, TypeArgumentList typeArguments}) : this.full(name,
typeArguments); | 12156 TypeName({Identifier name, TypeArgumentList typeArguments}) : this.full(name,
typeArguments); |
10403 accept(ASTVisitor visitor) => visitor.visitTypeName(this); | 12157 accept(ASTVisitor visitor) => visitor.visitTypeName(this); |
10404 Token get beginToken => _name.beginToken; | 12158 Token get beginToken => _name.beginToken; |
10405 Token get endToken { | 12159 Token get endToken { |
10406 if (_typeArguments != null) { | 12160 if (_typeArguments != null) { |
10407 return _typeArguments.endToken; | 12161 return _typeArguments.endToken; |
10408 } | 12162 } |
10409 return _name.endToken; | 12163 return _name.endToken; |
10410 } | 12164 } |
| 12165 |
10411 /** | 12166 /** |
10412 * Return the name of the type. | 12167 * Return the name of the type. |
10413 * @return the name of the type | 12168 * @return the name of the type |
10414 */ | 12169 */ |
10415 Identifier get name => _name; | 12170 Identifier get name => _name; |
| 12171 |
10416 /** | 12172 /** |
10417 * Return the type being named, or {@code null} if the AST structure has not b
een resolved. | 12173 * Return the type being named, or {@code null} if the AST structure has not b
een resolved. |
10418 * @return the type being named | 12174 * @return the type being named |
10419 */ | 12175 */ |
10420 Type2 get type => _type; | 12176 Type2 get type => _type; |
| 12177 |
10421 /** | 12178 /** |
10422 * Return the type arguments associated with the type, or {@code null} if ther
e are no type | 12179 * Return the type arguments associated with the type, or {@code null} if ther
e are no type |
10423 * arguments. | 12180 * arguments. |
10424 * @return the type arguments associated with the type | 12181 * @return the type arguments associated with the type |
10425 */ | 12182 */ |
10426 TypeArgumentList get typeArguments => _typeArguments; | 12183 TypeArgumentList get typeArguments => _typeArguments; |
10427 bool isSynthetic() => _name.isSynthetic() && _typeArguments == null; | 12184 bool isSynthetic() => _name.isSynthetic() && _typeArguments == null; |
| 12185 |
10428 /** | 12186 /** |
10429 * Set the name of the type to the given identifier. | 12187 * Set the name of the type to the given identifier. |
10430 * @param identifier the name of the type | 12188 * @param identifier the name of the type |
10431 */ | 12189 */ |
10432 void set name(Identifier identifier) { | 12190 void set name(Identifier identifier) { |
10433 _name = becomeParentOf(identifier); | 12191 _name = becomeParentOf(identifier); |
10434 } | 12192 } |
| 12193 |
10435 /** | 12194 /** |
10436 * Set the type being named to the given type. | 12195 * Set the type being named to the given type. |
10437 * @param type the type being named | 12196 * @param type the type being named |
10438 */ | 12197 */ |
10439 void set type(Type2 type2) { | 12198 void set type(Type2 type2) { |
10440 this._type = type2; | 12199 this._type = type2; |
10441 } | 12200 } |
| 12201 |
10442 /** | 12202 /** |
10443 * Set the type arguments associated with the type to the given type arguments
. | 12203 * Set the type arguments associated with the type to the given type arguments
. |
10444 * @param typeArguments the type arguments associated with the type | 12204 * @param typeArguments the type arguments associated with the type |
10445 */ | 12205 */ |
10446 void set typeArguments(TypeArgumentList typeArguments2) { | 12206 void set typeArguments(TypeArgumentList typeArguments2) { |
10447 this._typeArguments = becomeParentOf(typeArguments2); | 12207 this._typeArguments = becomeParentOf(typeArguments2); |
10448 } | 12208 } |
10449 void visitChildren(ASTVisitor<Object> visitor) { | 12209 void visitChildren(ASTVisitor<Object> visitor) { |
10450 safelyVisitChild(_name, visitor); | 12210 safelyVisitChild(_name, visitor); |
10451 safelyVisitChild(_typeArguments, visitor); | 12211 safelyVisitChild(_typeArguments, visitor); |
10452 } | 12212 } |
10453 } | 12213 } |
| 12214 |
10454 /** | 12215 /** |
10455 * Instances of the class {@code TypeParameter} represent a type parameter. | 12216 * Instances of the class {@code TypeParameter} represent a type parameter. |
10456 * <pre> | 12217 * <pre> |
10457 * typeParameter ::={@link SimpleIdentifier name} ('extends' {@link TypeName bou
nd})? | 12218 * typeParameter ::={@link SimpleIdentifier name} ('extends' {@link TypeName bou
nd})? |
10458 * </pre> | 12219 * </pre> |
10459 * @coverage dart.engine.ast | 12220 * @coverage dart.engine.ast |
10460 */ | 12221 */ |
10461 class TypeParameter extends Declaration { | 12222 class TypeParameter extends Declaration { |
| 12223 |
10462 /** | 12224 /** |
10463 * The name of the type parameter. | 12225 * The name of the type parameter. |
10464 */ | 12226 */ |
10465 SimpleIdentifier _name; | 12227 SimpleIdentifier _name; |
| 12228 |
10466 /** | 12229 /** |
10467 * The token representing the 'extends' keyword, or {@code null} if there was
no explicit upper | 12230 * The token representing the 'extends' keyword, or {@code null} if there was
no explicit upper |
10468 * bound. | 12231 * bound. |
10469 */ | 12232 */ |
10470 Token _keyword; | 12233 Token _keyword; |
| 12234 |
10471 /** | 12235 /** |
10472 * The name of the upper bound for legal arguments, or {@code null} if there w
as no explicit upper | 12236 * The name of the upper bound for legal arguments, or {@code null} if there w
as no explicit upper |
10473 * bound. | 12237 * bound. |
10474 */ | 12238 */ |
10475 TypeName _bound; | 12239 TypeName _bound; |
| 12240 |
10476 /** | 12241 /** |
10477 * Initialize a newly created type parameter. | 12242 * Initialize a newly created type parameter. |
10478 * @param comment the documentation comment associated with the type parameter | 12243 * @param comment the documentation comment associated with the type parameter |
10479 * @param metadata the annotations associated with the type parameter | 12244 * @param metadata the annotations associated with the type parameter |
10480 * @param name the name of the type parameter | 12245 * @param name the name of the type parameter |
10481 * @param keyword the token representing the 'extends' keyword | 12246 * @param keyword the token representing the 'extends' keyword |
10482 * @param bound the name of the upper bound for legal arguments | 12247 * @param bound the name of the upper bound for legal arguments |
10483 */ | 12248 */ |
10484 TypeParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifie
r name, Token keyword, TypeName bound) : super.full(comment, metadata) { | 12249 TypeParameter.full(Comment comment, List<Annotation> metadata, SimpleIdentifie
r name, Token keyword, TypeName bound) : super.full(comment, metadata) { |
10485 this._name = becomeParentOf(name); | 12250 this._name = becomeParentOf(name); |
10486 this._keyword = keyword; | 12251 this._keyword = keyword; |
10487 this._bound = becomeParentOf(bound); | 12252 this._bound = becomeParentOf(bound); |
10488 } | 12253 } |
| 12254 |
10489 /** | 12255 /** |
10490 * Initialize a newly created type parameter. | 12256 * Initialize a newly created type parameter. |
10491 * @param comment the documentation comment associated with the type parameter | 12257 * @param comment the documentation comment associated with the type parameter |
10492 * @param metadata the annotations associated with the type parameter | 12258 * @param metadata the annotations associated with the type parameter |
10493 * @param name the name of the type parameter | 12259 * @param name the name of the type parameter |
10494 * @param keyword the token representing the 'extends' keyword | 12260 * @param keyword the token representing the 'extends' keyword |
10495 * @param bound the name of the upper bound for legal arguments | 12261 * @param bound the name of the upper bound for legal arguments |
10496 */ | 12262 */ |
10497 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na
me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword
, bound); | 12263 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na
me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword
, bound); |
10498 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); | 12264 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); |
| 12265 |
10499 /** | 12266 /** |
10500 * Return the name of the upper bound for legal arguments, or {@code null} if
there was no | 12267 * Return the name of the upper bound for legal arguments, or {@code null} if
there was no |
10501 * explicit upper bound. | 12268 * explicit upper bound. |
10502 * @return the name of the upper bound for legal arguments | 12269 * @return the name of the upper bound for legal arguments |
10503 */ | 12270 */ |
10504 TypeName get bound => _bound; | 12271 TypeName get bound => _bound; |
10505 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria
bleElement) : null; | 12272 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria
bleElement) : null; |
10506 Token get endToken { | 12273 Token get endToken { |
10507 if (_bound == null) { | 12274 if (_bound == null) { |
10508 return _name.endToken; | 12275 return _name.endToken; |
10509 } | 12276 } |
10510 return _bound.endToken; | 12277 return _bound.endToken; |
10511 } | 12278 } |
| 12279 |
10512 /** | 12280 /** |
10513 * Return the token representing the 'assert' keyword. | 12281 * Return the token representing the 'assert' keyword. |
10514 * @return the token representing the 'assert' keyword | 12282 * @return the token representing the 'assert' keyword |
10515 */ | 12283 */ |
10516 Token get keyword => _keyword; | 12284 Token get keyword => _keyword; |
| 12285 |
10517 /** | 12286 /** |
10518 * Return the name of the type parameter. | 12287 * Return the name of the type parameter. |
10519 * @return the name of the type parameter | 12288 * @return the name of the type parameter |
10520 */ | 12289 */ |
10521 SimpleIdentifier get name => _name; | 12290 SimpleIdentifier get name => _name; |
| 12291 |
10522 /** | 12292 /** |
10523 * Set the name of the upper bound for legal arguments to the given type name. | 12293 * Set the name of the upper bound for legal arguments to the given type name. |
10524 * @param typeName the name of the upper bound for legal arguments | 12294 * @param typeName the name of the upper bound for legal arguments |
10525 */ | 12295 */ |
10526 void set bound(TypeName typeName) { | 12296 void set bound(TypeName typeName) { |
10527 _bound = becomeParentOf(typeName); | 12297 _bound = becomeParentOf(typeName); |
10528 } | 12298 } |
| 12299 |
10529 /** | 12300 /** |
10530 * Set the token representing the 'assert' keyword to the given token. | 12301 * Set the token representing the 'assert' keyword to the given token. |
10531 * @param keyword the token representing the 'assert' keyword | 12302 * @param keyword the token representing the 'assert' keyword |
10532 */ | 12303 */ |
10533 void set keyword(Token keyword2) { | 12304 void set keyword(Token keyword2) { |
10534 this._keyword = keyword2; | 12305 this._keyword = keyword2; |
10535 } | 12306 } |
| 12307 |
10536 /** | 12308 /** |
10537 * Set the name of the type parameter to the given identifier. | 12309 * Set the name of the type parameter to the given identifier. |
10538 * @param identifier the name of the type parameter | 12310 * @param identifier the name of the type parameter |
10539 */ | 12311 */ |
10540 void set name(SimpleIdentifier identifier) { | 12312 void set name(SimpleIdentifier identifier) { |
10541 _name = becomeParentOf(identifier); | 12313 _name = becomeParentOf(identifier); |
10542 } | 12314 } |
10543 void visitChildren(ASTVisitor<Object> visitor) { | 12315 void visitChildren(ASTVisitor<Object> visitor) { |
10544 super.visitChildren(visitor); | 12316 super.visitChildren(visitor); |
10545 safelyVisitChild(_name, visitor); | 12317 safelyVisitChild(_name, visitor); |
10546 safelyVisitChild(_bound, visitor); | 12318 safelyVisitChild(_bound, visitor); |
10547 } | 12319 } |
10548 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; | 12320 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; |
10549 } | 12321 } |
| 12322 |
10550 /** | 12323 /** |
10551 * Instances of the class {@code TypeParameterList} represent type parameters wi
thin a declaration. | 12324 * Instances of the class {@code TypeParameterList} represent type parameters wi
thin a declaration. |
10552 * <pre> | 12325 * <pre> |
10553 * typeParameterList ::= | 12326 * typeParameterList ::= |
10554 * '<' {@link TypeParameter typeParameter} (',' {@link TypeParameter typeParamet
er})* '>' | 12327 * '<' {@link TypeParameter typeParameter} (',' {@link TypeParameter typeParamet
er})* '>' |
10555 * </pre> | 12328 * </pre> |
10556 * @coverage dart.engine.ast | 12329 * @coverage dart.engine.ast |
10557 */ | 12330 */ |
10558 class TypeParameterList extends ASTNode { | 12331 class TypeParameterList extends ASTNode { |
| 12332 |
10559 /** | 12333 /** |
10560 * The left angle bracket. | 12334 * The left angle bracket. |
10561 */ | 12335 */ |
10562 Token _leftBracket; | 12336 Token _leftBracket; |
| 12337 |
10563 /** | 12338 /** |
10564 * The type parameters in the list. | 12339 * The type parameters in the list. |
10565 */ | 12340 */ |
10566 NodeList<TypeParameter> _typeParameters; | 12341 NodeList<TypeParameter> _typeParameters; |
| 12342 |
10567 /** | 12343 /** |
10568 * The right angle bracket. | 12344 * The right angle bracket. |
10569 */ | 12345 */ |
10570 Token _rightBracket; | 12346 Token _rightBracket; |
| 12347 |
10571 /** | 12348 /** |
10572 * Initialize a newly created list of type parameters. | 12349 * Initialize a newly created list of type parameters. |
10573 * @param leftBracket the left angle bracket | 12350 * @param leftBracket the left angle bracket |
10574 * @param typeParameters the type parameters in the list | 12351 * @param typeParameters the type parameters in the list |
10575 * @param rightBracket the right angle bracket | 12352 * @param rightBracket the right angle bracket |
10576 */ | 12353 */ |
10577 TypeParameterList.full(Token leftBracket, List<TypeParameter> typeParameters,
Token rightBracket) { | 12354 TypeParameterList.full(Token leftBracket, List<TypeParameter> typeParameters,
Token rightBracket) { |
10578 this._typeParameters = new NodeList<TypeParameter>(this); | 12355 this._typeParameters = new NodeList<TypeParameter>(this); |
10579 this._leftBracket = leftBracket; | 12356 this._leftBracket = leftBracket; |
10580 this._typeParameters.addAll(typeParameters); | 12357 this._typeParameters.addAll(typeParameters); |
10581 this._rightBracket = rightBracket; | 12358 this._rightBracket = rightBracket; |
10582 } | 12359 } |
| 12360 |
10583 /** | 12361 /** |
10584 * Initialize a newly created list of type parameters. | 12362 * Initialize a newly created list of type parameters. |
10585 * @param leftBracket the left angle bracket | 12363 * @param leftBracket the left angle bracket |
10586 * @param typeParameters the type parameters in the list | 12364 * @param typeParameters the type parameters in the list |
10587 * @param rightBracket the right angle bracket | 12365 * @param rightBracket the right angle bracket |
10588 */ | 12366 */ |
10589 TypeParameterList({Token leftBracket, List<TypeParameter> typeParameters, Toke
n rightBracket}) : this.full(leftBracket, typeParameters, rightBracket); | 12367 TypeParameterList({Token leftBracket, List<TypeParameter> typeParameters, Toke
n rightBracket}) : this.full(leftBracket, typeParameters, rightBracket); |
10590 accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this); | 12368 accept(ASTVisitor visitor) => visitor.visitTypeParameterList(this); |
10591 Token get beginToken => _leftBracket; | 12369 Token get beginToken => _leftBracket; |
10592 Token get endToken => _rightBracket; | 12370 Token get endToken => _rightBracket; |
| 12371 |
10593 /** | 12372 /** |
10594 * Return the left angle bracket. | 12373 * Return the left angle bracket. |
10595 * @return the left angle bracket | 12374 * @return the left angle bracket |
10596 */ | 12375 */ |
10597 Token get leftBracket => _leftBracket; | 12376 Token get leftBracket => _leftBracket; |
| 12377 |
10598 /** | 12378 /** |
10599 * Return the right angle bracket. | 12379 * Return the right angle bracket. |
10600 * @return the right angle bracket | 12380 * @return the right angle bracket |
10601 */ | 12381 */ |
10602 Token get rightBracket => _rightBracket; | 12382 Token get rightBracket => _rightBracket; |
| 12383 |
10603 /** | 12384 /** |
10604 * Return the type parameters for the type. | 12385 * Return the type parameters for the type. |
10605 * @return the type parameters for the type | 12386 * @return the type parameters for the type |
10606 */ | 12387 */ |
10607 NodeList<TypeParameter> get typeParameters => _typeParameters; | 12388 NodeList<TypeParameter> get typeParameters => _typeParameters; |
10608 void visitChildren(ASTVisitor<Object> visitor) { | 12389 void visitChildren(ASTVisitor<Object> visitor) { |
10609 _typeParameters.accept(visitor); | 12390 _typeParameters.accept(visitor); |
10610 } | 12391 } |
10611 } | 12392 } |
| 12393 |
10612 /** | 12394 /** |
10613 * The abstract class {@code TypedLiteral} defines the behavior common to litera
ls that have a type | 12395 * The abstract class {@code TypedLiteral} defines the behavior common to litera
ls that have a type |
10614 * associated with them. | 12396 * associated with them. |
10615 * <pre> | 12397 * <pre> |
10616 * listLiteral ::={@link ListLiteral listLiteral}| {@link MapLiteral mapLiteral}
</pre> | 12398 * listLiteral ::={@link ListLiteral listLiteral}| {@link MapLiteral mapLiteral}
</pre> |
10617 * @coverage dart.engine.ast | 12399 * @coverage dart.engine.ast |
10618 */ | 12400 */ |
10619 abstract class TypedLiteral extends Literal { | 12401 abstract class TypedLiteral extends Literal { |
| 12402 |
10620 /** | 12403 /** |
10621 * The const modifier associated with this literal, or {@code null} if the lit
eral is not a | 12404 * The const modifier associated with this literal, or {@code null} if the lit
eral is not a |
10622 * constant. | 12405 * constant. |
10623 */ | 12406 */ |
10624 Token _modifier; | 12407 Token _modifier; |
| 12408 |
10625 /** | 12409 /** |
10626 * The type argument associated with this literal, or {@code null} if no type
arguments were | 12410 * The type argument associated with this literal, or {@code null} if no type
arguments were |
10627 * declared. | 12411 * declared. |
10628 */ | 12412 */ |
10629 TypeArgumentList _typeArguments; | 12413 TypeArgumentList _typeArguments; |
| 12414 |
10630 /** | 12415 /** |
10631 * Initialize a newly created typed literal. | 12416 * Initialize a newly created typed literal. |
10632 * @param modifier the const modifier associated with this literal | 12417 * @param modifier the const modifier associated with this literal |
10633 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 12418 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
10634 * arguments were declared | 12419 * arguments were declared |
10635 */ | 12420 */ |
10636 TypedLiteral.full(Token modifier, TypeArgumentList typeArguments) { | 12421 TypedLiteral.full(Token modifier, TypeArgumentList typeArguments) { |
10637 this._modifier = modifier; | 12422 this._modifier = modifier; |
10638 this._typeArguments = becomeParentOf(typeArguments); | 12423 this._typeArguments = becomeParentOf(typeArguments); |
10639 } | 12424 } |
| 12425 |
10640 /** | 12426 /** |
10641 * Initialize a newly created typed literal. | 12427 * Initialize a newly created typed literal. |
10642 * @param modifier the const modifier associated with this literal | 12428 * @param modifier the const modifier associated with this literal |
10643 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type | 12429 * @param typeArguments the type argument associated with this literal, or {@c
ode null} if no type |
10644 * arguments were declared | 12430 * arguments were declared |
10645 */ | 12431 */ |
10646 TypedLiteral({Token modifier, TypeArgumentList typeArguments}) : this.full(mod
ifier, typeArguments); | 12432 TypedLiteral({Token modifier, TypeArgumentList typeArguments}) : this.full(mod
ifier, typeArguments); |
| 12433 |
10647 /** | 12434 /** |
10648 * Return the const modifier associated with this literal. | 12435 * Return the const modifier associated with this literal. |
10649 * @return the const modifier associated with this literal | 12436 * @return the const modifier associated with this literal |
10650 */ | 12437 */ |
10651 Token get modifier => _modifier; | 12438 Token get modifier => _modifier; |
| 12439 |
10652 /** | 12440 /** |
10653 * Return the type argument associated with this literal, or {@code null} if n
o type arguments | 12441 * Return the type argument associated with this literal, or {@code null} if n
o type arguments |
10654 * were declared. | 12442 * were declared. |
10655 * @return the type argument associated with this literal | 12443 * @return the type argument associated with this literal |
10656 */ | 12444 */ |
10657 TypeArgumentList get typeArguments => _typeArguments; | 12445 TypeArgumentList get typeArguments => _typeArguments; |
| 12446 |
10658 /** | 12447 /** |
10659 * Set the modifiers associated with this literal to the given modifiers. | 12448 * Set the modifiers associated with this literal to the given modifiers. |
10660 * @param modifiers the modifiers associated with this literal | 12449 * @param modifiers the modifiers associated with this literal |
10661 */ | 12450 */ |
10662 void set modifier(Token modifier2) { | 12451 void set modifier(Token modifier2) { |
10663 this._modifier = modifier2; | 12452 this._modifier = modifier2; |
10664 } | 12453 } |
| 12454 |
10665 /** | 12455 /** |
10666 * Set the type argument associated with this literal to the given arguments. | 12456 * Set the type argument associated with this literal to the given arguments. |
10667 * @param typeArguments the type argument associated with this literal | 12457 * @param typeArguments the type argument associated with this literal |
10668 */ | 12458 */ |
10669 void set typeArguments(TypeArgumentList typeArguments2) { | 12459 void set typeArguments(TypeArgumentList typeArguments2) { |
10670 this._typeArguments = typeArguments2; | 12460 this._typeArguments = typeArguments2; |
10671 } | 12461 } |
10672 void visitChildren(ASTVisitor<Object> visitor) { | 12462 void visitChildren(ASTVisitor<Object> visitor) { |
10673 safelyVisitChild(_typeArguments, visitor); | 12463 safelyVisitChild(_typeArguments, visitor); |
10674 } | 12464 } |
10675 } | 12465 } |
| 12466 |
10676 /** | 12467 /** |
10677 * The abstract class {@code UriBasedDirective} defines the behavior common to n
odes that represent | 12468 * The abstract class {@code UriBasedDirective} defines the behavior common to n
odes that represent |
10678 * a directive that references a URI. | 12469 * a directive that references a URI. |
10679 * <pre> | 12470 * <pre> |
10680 * uriBasedDirective ::={@link ExportDirective exportDirective}| {@link ImportDi
rective importDirective}| {@link PartDirective partDirective}</pre> | 12471 * uriBasedDirective ::={@link ExportDirective exportDirective}| {@link ImportDi
rective importDirective}| {@link PartDirective partDirective}</pre> |
10681 * @coverage dart.engine.ast | 12472 * @coverage dart.engine.ast |
10682 */ | 12473 */ |
10683 abstract class UriBasedDirective extends Directive { | 12474 abstract class UriBasedDirective extends Directive { |
| 12475 |
10684 /** | 12476 /** |
10685 * The URI referenced by this directive. | 12477 * The URI referenced by this directive. |
10686 */ | 12478 */ |
10687 StringLiteral _uri; | 12479 StringLiteral _uri; |
| 12480 |
10688 /** | 12481 /** |
10689 * Initialize a newly create URI-based directive. | 12482 * Initialize a newly create URI-based directive. |
10690 * @param comment the documentation comment associated with this directive | 12483 * @param comment the documentation comment associated with this directive |
10691 * @param metadata the annotations associated with the directive | 12484 * @param metadata the annotations associated with the directive |
10692 * @param uri the URI referenced by this directive | 12485 * @param uri the URI referenced by this directive |
10693 */ | 12486 */ |
10694 UriBasedDirective.full(Comment comment, List<Annotation> metadata, StringLiter
al uri) : super.full(comment, metadata) { | 12487 UriBasedDirective.full(Comment comment, List<Annotation> metadata, StringLiter
al uri) : super.full(comment, metadata) { |
10695 this._uri = becomeParentOf(uri); | 12488 this._uri = becomeParentOf(uri); |
10696 } | 12489 } |
| 12490 |
10697 /** | 12491 /** |
10698 * Initialize a newly create URI-based directive. | 12492 * Initialize a newly create URI-based directive. |
10699 * @param comment the documentation comment associated with this directive | 12493 * @param comment the documentation comment associated with this directive |
10700 * @param metadata the annotations associated with the directive | 12494 * @param metadata the annotations associated with the directive |
10701 * @param uri the URI referenced by this directive | 12495 * @param uri the URI referenced by this directive |
10702 */ | 12496 */ |
10703 UriBasedDirective({Comment comment, List<Annotation> metadata, StringLiteral u
ri}) : this.full(comment, metadata, uri); | 12497 UriBasedDirective({Comment comment, List<Annotation> metadata, StringLiteral u
ri}) : this.full(comment, metadata, uri); |
| 12498 |
10704 /** | 12499 /** |
10705 * Return the URI referenced by this directive. | 12500 * Return the URI referenced by this directive. |
10706 * @return the URI referenced by this directive | 12501 * @return the URI referenced by this directive |
10707 */ | 12502 */ |
10708 StringLiteral get uri => _uri; | 12503 StringLiteral get uri => _uri; |
| 12504 |
| 12505 /** |
| 12506 * Return the element associated with the URI of this directive, or {@code nul
l} if the AST |
| 12507 * structure has not been resolved or if this URI could not be resolved. Examp
les of the latter |
| 12508 * case include a directive that contains an invalid URL or a URL that does no
t exist. |
| 12509 * @return the element associated with this directive |
| 12510 */ |
| 12511 Element get uriElement; |
| 12512 |
10709 /** | 12513 /** |
10710 * Set the URI referenced by this directive to the given URI. | 12514 * Set the URI referenced by this directive to the given URI. |
10711 * @param uri the URI referenced by this directive | 12515 * @param uri the URI referenced by this directive |
10712 */ | 12516 */ |
10713 void set uri(StringLiteral uri2) { | 12517 void set uri(StringLiteral uri2) { |
10714 this._uri = becomeParentOf(uri2); | 12518 this._uri = becomeParentOf(uri2); |
10715 } | 12519 } |
10716 void visitChildren(ASTVisitor<Object> visitor) { | 12520 void visitChildren(ASTVisitor<Object> visitor) { |
10717 super.visitChildren(visitor); | 12521 super.visitChildren(visitor); |
10718 safelyVisitChild(_uri, visitor); | 12522 safelyVisitChild(_uri, visitor); |
10719 } | 12523 } |
10720 } | 12524 } |
| 12525 |
10721 /** | 12526 /** |
10722 * Instances of the class {@code VariableDeclaration} represent an identifier th
at has an initial | 12527 * Instances of the class {@code VariableDeclaration} represent an identifier th
at has an initial |
10723 * value associated with it. Instances of this class are always children of the
class{@link VariableDeclarationList}. | 12528 * value associated with it. Instances of this class are always children of the
class{@link VariableDeclarationList}. |
10724 * <pre> | 12529 * <pre> |
10725 * variableDeclaration ::={@link SimpleIdentifier identifier} ('=' {@link Expres
sion initialValue})? | 12530 * variableDeclaration ::={@link SimpleIdentifier identifier} ('=' {@link Expres
sion initialValue})? |
10726 * </pre> | 12531 * </pre> |
10727 * @coverage dart.engine.ast | 12532 * @coverage dart.engine.ast |
10728 */ | 12533 */ |
10729 class VariableDeclaration extends Declaration { | 12534 class VariableDeclaration extends Declaration { |
| 12535 |
10730 /** | 12536 /** |
10731 * The name of the variable being declared. | 12537 * The name of the variable being declared. |
10732 */ | 12538 */ |
10733 SimpleIdentifier _name; | 12539 SimpleIdentifier _name; |
| 12540 |
10734 /** | 12541 /** |
10735 * The equal sign separating the variable name from the initial value, or {@co
de null} if the | 12542 * The equal sign separating the variable name from the initial value, or {@co
de null} if the |
10736 * initial value was not specified. | 12543 * initial value was not specified. |
10737 */ | 12544 */ |
10738 Token _equals; | 12545 Token _equals; |
| 12546 |
10739 /** | 12547 /** |
10740 * The expression used to compute the initial value for the variable, or {@cod
e null} if the | 12548 * The expression used to compute the initial value for the variable, or {@cod
e null} if the |
10741 * initial value was not specified. | 12549 * initial value was not specified. |
10742 */ | 12550 */ |
10743 Expression _initializer; | 12551 Expression _initializer; |
| 12552 |
10744 /** | 12553 /** |
10745 * Initialize a newly created variable declaration. | 12554 * Initialize a newly created variable declaration. |
10746 * @param comment the documentation comment associated with this declaration | 12555 * @param comment the documentation comment associated with this declaration |
10747 * @param metadata the annotations associated with this member | 12556 * @param metadata the annotations associated with this member |
10748 * @param name the name of the variable being declared | 12557 * @param name the name of the variable being declared |
10749 * @param equals the equal sign separating the variable name from the initial
value | 12558 * @param equals the equal sign separating the variable name from the initial
value |
10750 * @param initializer the expression used to compute the initial value for the
variable | 12559 * @param initializer the expression used to compute the initial value for the
variable |
10751 */ | 12560 */ |
10752 VariableDeclaration.full(Comment comment, List<Annotation> metadata, SimpleIde
ntifier name, Token equals, Expression initializer) : super.full(comment, metada
ta) { | 12561 VariableDeclaration.full(Comment comment, List<Annotation> metadata, SimpleIde
ntifier name, Token equals, Expression initializer) : super.full(comment, metada
ta) { |
10753 this._name = becomeParentOf(name); | 12562 this._name = becomeParentOf(name); |
10754 this._equals = equals; | 12563 this._equals = equals; |
10755 this._initializer = becomeParentOf(initializer); | 12564 this._initializer = becomeParentOf(initializer); |
10756 } | 12565 } |
| 12566 |
10757 /** | 12567 /** |
10758 * Initialize a newly created variable declaration. | 12568 * Initialize a newly created variable declaration. |
10759 * @param comment the documentation comment associated with this declaration | 12569 * @param comment the documentation comment associated with this declaration |
10760 * @param metadata the annotations associated with this member | 12570 * @param metadata the annotations associated with this member |
10761 * @param name the name of the variable being declared | 12571 * @param name the name of the variable being declared |
10762 * @param equals the equal sign separating the variable name from the initial
value | 12572 * @param equals the equal sign separating the variable name from the initial
value |
10763 * @param initializer the expression used to compute the initial value for the
variable | 12573 * @param initializer the expression used to compute the initial value for the
variable |
10764 */ | 12574 */ |
10765 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif
ier name, Token equals, Expression initializer}) : this.full(comment, metadata,
name, equals, initializer); | 12575 VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentif
ier name, Token equals, Expression initializer}) : this.full(comment, metadata,
name, equals, initializer); |
10766 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); | 12576 accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this); |
10767 VariableElement get element => _name != null ? (_name.element as VariableEleme
nt) : null; | 12577 VariableElement get element => _name != null ? (_name.element as VariableEleme
nt) : null; |
10768 Token get endToken { | 12578 Token get endToken { |
10769 if (_initializer != null) { | 12579 if (_initializer != null) { |
10770 return _initializer.endToken; | 12580 return _initializer.endToken; |
10771 } | 12581 } |
10772 return _name.endToken; | 12582 return _name.endToken; |
10773 } | 12583 } |
| 12584 |
10774 /** | 12585 /** |
10775 * Return the equal sign separating the variable name from the initial value,
or {@code null} if | 12586 * Return the equal sign separating the variable name from the initial value,
or {@code null} if |
10776 * the initial value was not specified. | 12587 * the initial value was not specified. |
10777 * @return the equal sign separating the variable name from the initial value | 12588 * @return the equal sign separating the variable name from the initial value |
10778 */ | 12589 */ |
10779 Token get equals => _equals; | 12590 Token get equals => _equals; |
| 12591 |
10780 /** | 12592 /** |
10781 * Return the expression used to compute the initial value for the variable, o
r {@code null} if | 12593 * Return the expression used to compute the initial value for the variable, o
r {@code null} if |
10782 * the initial value was not specified. | 12594 * the initial value was not specified. |
10783 * @return the expression used to compute the initial value for the variable | 12595 * @return the expression used to compute the initial value for the variable |
10784 */ | 12596 */ |
10785 Expression get initializer => _initializer; | 12597 Expression get initializer => _initializer; |
| 12598 |
10786 /** | 12599 /** |
10787 * Return the name of the variable being declared. | 12600 * Return the name of the variable being declared. |
10788 * @return the name of the variable being declared | 12601 * @return the name of the variable being declared |
10789 */ | 12602 */ |
10790 SimpleIdentifier get name => _name; | 12603 SimpleIdentifier get name => _name; |
| 12604 |
10791 /** | 12605 /** |
10792 * Return {@code true} if this variable was declared with the 'const' modifier
. | 12606 * Return {@code true} if this variable was declared with the 'const' modifier
. |
10793 * @return {@code true} if this variable was declared with the 'const' modifie
r | 12607 * @return {@code true} if this variable was declared with the 'const' modifie
r |
10794 */ | 12608 */ |
10795 bool isConst() { | 12609 bool isConst() { |
10796 ASTNode parent2 = parent; | 12610 ASTNode parent2 = parent; |
10797 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isConst(); | 12611 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isConst(); |
10798 } | 12612 } |
| 12613 |
10799 /** | 12614 /** |
10800 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are | 12615 * Return {@code true} if this variable was declared with the 'final' modifier
. Variables that are |
10801 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly | 12616 * declared with the 'const' modifier will return {@code false} even though th
ey are implicitly |
10802 * final. | 12617 * final. |
10803 * @return {@code true} if this variable was declared with the 'final' modifie
r | 12618 * @return {@code true} if this variable was declared with the 'final' modifie
r |
10804 */ | 12619 */ |
10805 bool isFinal() { | 12620 bool isFinal() { |
10806 ASTNode parent2 = parent; | 12621 ASTNode parent2 = parent; |
10807 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isFinal(); | 12622 return parent2 is VariableDeclarationList && ((parent2 as VariableDeclaratio
nList)).isFinal(); |
10808 } | 12623 } |
| 12624 |
10809 /** | 12625 /** |
10810 * Set the equal sign separating the variable name from the initial value to t
he given token. | 12626 * Set the equal sign separating the variable name from the initial value to t
he given token. |
10811 * @param equals the equal sign separating the variable name from the initial
value | 12627 * @param equals the equal sign separating the variable name from the initial
value |
10812 */ | 12628 */ |
10813 void set equals(Token equals2) { | 12629 void set equals(Token equals2) { |
10814 this._equals = equals2; | 12630 this._equals = equals2; |
10815 } | 12631 } |
| 12632 |
10816 /** | 12633 /** |
10817 * Set the expression used to compute the initial value for the variable to th
e given expression. | 12634 * Set the expression used to compute the initial value for the variable to th
e given expression. |
10818 * @param initializer the expression used to compute the initial value for the
variable | 12635 * @param initializer the expression used to compute the initial value for the
variable |
10819 */ | 12636 */ |
10820 void set initializer(Expression initializer2) { | 12637 void set initializer(Expression initializer2) { |
10821 this._initializer = becomeParentOf(initializer2); | 12638 this._initializer = becomeParentOf(initializer2); |
10822 } | 12639 } |
| 12640 |
10823 /** | 12641 /** |
10824 * Set the name of the variable being declared to the given identifier. | 12642 * Set the name of the variable being declared to the given identifier. |
10825 * @param name the name of the variable being declared | 12643 * @param name the name of the variable being declared |
10826 */ | 12644 */ |
10827 void set name(SimpleIdentifier name2) { | 12645 void set name(SimpleIdentifier name2) { |
10828 this._name = becomeParentOf(name2); | 12646 this._name = becomeParentOf(name2); |
10829 } | 12647 } |
10830 void visitChildren(ASTVisitor<Object> visitor) { | 12648 void visitChildren(ASTVisitor<Object> visitor) { |
10831 super.visitChildren(visitor); | 12649 super.visitChildren(visitor); |
10832 safelyVisitChild(_name, visitor); | 12650 safelyVisitChild(_name, visitor); |
10833 safelyVisitChild(_initializer, visitor); | 12651 safelyVisitChild(_initializer, visitor); |
10834 } | 12652 } |
10835 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; | 12653 Token get firstTokenAfterCommentAndMetadata => _name.beginToken; |
10836 } | 12654 } |
| 12655 |
10837 /** | 12656 /** |
10838 * Instances of the class {@code VariableDeclarationList} represent the declarat
ion of one or more | 12657 * Instances of the class {@code VariableDeclarationList} represent the declarat
ion of one or more |
10839 * variables of the same type. | 12658 * variables of the same type. |
10840 * <pre> | 12659 * <pre> |
10841 * variableDeclarationList ::= | 12660 * variableDeclarationList ::= |
10842 * finalConstVarOrType {@link VariableDeclaration variableDeclaration} (',' {@li
nk VariableDeclaration variableDeclaration}) | 12661 * finalConstVarOrType {@link VariableDeclaration variableDeclaration} (',' {@li
nk VariableDeclaration variableDeclaration}) |
10843 * finalConstVarOrType ::= | 12662 * finalConstVarOrType ::= |
10844 * | 'final' {@link TypeName type}? | 12663 * | 'final' {@link TypeName type}? |
10845 * | 'const' {@link TypeName type}? | 12664 * | 'const' {@link TypeName type}? |
10846 * | 'var' | 12665 * | 'var' |
10847 * | {@link TypeName type}</pre> | 12666 * | {@link TypeName type}</pre> |
10848 * @coverage dart.engine.ast | 12667 * @coverage dart.engine.ast |
10849 */ | 12668 */ |
10850 class VariableDeclarationList extends AnnotatedNode { | 12669 class VariableDeclarationList extends AnnotatedNode { |
| 12670 |
10851 /** | 12671 /** |
10852 * The token representing the 'final', 'const' or 'var' keyword, or {@code nul
l} if no keyword was | 12672 * The token representing the 'final', 'const' or 'var' keyword, or {@code nul
l} if no keyword was |
10853 * included. | 12673 * included. |
10854 */ | 12674 */ |
10855 Token _keyword; | 12675 Token _keyword; |
| 12676 |
10856 /** | 12677 /** |
10857 * The type of the variables being declared, or {@code null} if no type was pr
ovided. | 12678 * The type of the variables being declared, or {@code null} if no type was pr
ovided. |
10858 */ | 12679 */ |
10859 TypeName _type; | 12680 TypeName _type; |
| 12681 |
10860 /** | 12682 /** |
10861 * A list containing the individual variables being declared. | 12683 * A list containing the individual variables being declared. |
10862 */ | 12684 */ |
10863 NodeList<VariableDeclaration> _variables; | 12685 NodeList<VariableDeclaration> _variables; |
| 12686 |
10864 /** | 12687 /** |
10865 * Initialize a newly created variable declaration list. | 12688 * Initialize a newly created variable declaration list. |
10866 * @param comment the documentation comment associated with this declaration l
ist | 12689 * @param comment the documentation comment associated with this declaration l
ist |
10867 * @param metadata the annotations associated with this declaration list | 12690 * @param metadata the annotations associated with this declaration list |
10868 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 12691 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
10869 * @param type the type of the variables being declared | 12692 * @param type the type of the variables being declared |
10870 * @param variables a list containing the individual variables being declared | 12693 * @param variables a list containing the individual variables being declared |
10871 */ | 12694 */ |
10872 VariableDeclarationList.full(Comment comment, List<Annotation> metadata, Token
keyword, TypeName type, List<VariableDeclaration> variables) : super.full(comme
nt, metadata) { | 12695 VariableDeclarationList.full(Comment comment, List<Annotation> metadata, Token
keyword, TypeName type, List<VariableDeclaration> variables) : super.full(comme
nt, metadata) { |
10873 this._variables = new NodeList<VariableDeclaration>(this); | 12696 this._variables = new NodeList<VariableDeclaration>(this); |
10874 this._keyword = keyword; | 12697 this._keyword = keyword; |
10875 this._type = becomeParentOf(type); | 12698 this._type = becomeParentOf(type); |
10876 this._variables.addAll(variables); | 12699 this._variables.addAll(variables); |
10877 } | 12700 } |
| 12701 |
10878 /** | 12702 /** |
10879 * Initialize a newly created variable declaration list. | 12703 * Initialize a newly created variable declaration list. |
10880 * @param comment the documentation comment associated with this declaration l
ist | 12704 * @param comment the documentation comment associated with this declaration l
ist |
10881 * @param metadata the annotations associated with this declaration list | 12705 * @param metadata the annotations associated with this declaration list |
10882 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 12706 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
10883 * @param type the type of the variables being declared | 12707 * @param type the type of the variables being declared |
10884 * @param variables a list containing the individual variables being declared | 12708 * @param variables a list containing the individual variables being declared |
10885 */ | 12709 */ |
10886 VariableDeclarationList({Comment comment, List<Annotation> metadata, Token key
word, TypeName type, List<VariableDeclaration> variables}) : this.full(comment,
metadata, keyword, type, variables); | 12710 VariableDeclarationList({Comment comment, List<Annotation> metadata, Token key
word, TypeName type, List<VariableDeclaration> variables}) : this.full(comment,
metadata, keyword, type, variables); |
10887 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this); | 12711 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationList(this); |
10888 Token get endToken => _variables.endToken; | 12712 Token get endToken => _variables.endToken; |
| 12713 |
10889 /** | 12714 /** |
10890 * Return the token representing the 'final', 'const' or 'var' keyword, or {@c
ode null} if no | 12715 * Return the token representing the 'final', 'const' or 'var' keyword, or {@c
ode null} if no |
10891 * keyword was included. | 12716 * keyword was included. |
10892 * @return the token representing the 'final', 'const' or 'var' keyword | 12717 * @return the token representing the 'final', 'const' or 'var' keyword |
10893 */ | 12718 */ |
10894 Token get keyword => _keyword; | 12719 Token get keyword => _keyword; |
| 12720 |
10895 /** | 12721 /** |
10896 * Return the type of the variables being declared, or {@code null} if no type
was provided. | 12722 * Return the type of the variables being declared, or {@code null} if no type
was provided. |
10897 * @return the type of the variables being declared | 12723 * @return the type of the variables being declared |
10898 */ | 12724 */ |
10899 TypeName get type => _type; | 12725 TypeName get type => _type; |
| 12726 |
10900 /** | 12727 /** |
10901 * Return a list containing the individual variables being declared. | 12728 * Return a list containing the individual variables being declared. |
10902 * @return a list containing the individual variables being declared | 12729 * @return a list containing the individual variables being declared |
10903 */ | 12730 */ |
10904 NodeList<VariableDeclaration> get variables => _variables; | 12731 NodeList<VariableDeclaration> get variables => _variables; |
| 12732 |
10905 /** | 12733 /** |
10906 * Return {@code true} if the variables in this list were declared with the 'c
onst' modifier. | 12734 * Return {@code true} if the variables in this list were declared with the 'c
onst' modifier. |
10907 * @return {@code true} if the variables in this list were declared with the '
const' modifier | 12735 * @return {@code true} if the variables in this list were declared with the '
const' modifier |
10908 */ | 12736 */ |
10909 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); | 12737 bool isConst() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.CONST); |
| 12738 |
10910 /** | 12739 /** |
10911 * Return {@code true} if the variables in this list were declared with the 'f
inal' modifier. | 12740 * Return {@code true} if the variables in this list were declared with the 'f
inal' modifier. |
10912 * Variables that are declared with the 'const' modifier will return {@code fa
lse} even though | 12741 * Variables that are declared with the 'const' modifier will return {@code fa
lse} even though |
10913 * they are implicitly final. | 12742 * they are implicitly final. |
10914 * @return {@code true} if the variables in this list were declared with the '
final' modifier | 12743 * @return {@code true} if the variables in this list were declared with the '
final' modifier |
10915 */ | 12744 */ |
10916 bool isFinal() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.FINAL); | 12745 bool isFinal() => _keyword is KeywordToken && identical(((_keyword as KeywordT
oken)).keyword, Keyword.FINAL); |
| 12746 |
10917 /** | 12747 /** |
10918 * Set the token representing the 'final', 'const' or 'var' keyword to the giv
en token. | 12748 * Set the token representing the 'final', 'const' or 'var' keyword to the giv
en token. |
10919 * @param keyword the token representing the 'final', 'const' or 'var' keyword | 12749 * @param keyword the token representing the 'final', 'const' or 'var' keyword |
10920 */ | 12750 */ |
10921 void set keyword(Token keyword2) { | 12751 void set keyword(Token keyword2) { |
10922 this._keyword = keyword2; | 12752 this._keyword = keyword2; |
10923 } | 12753 } |
| 12754 |
10924 /** | 12755 /** |
10925 * Set the type of the variables being declared to the given type name. | 12756 * Set the type of the variables being declared to the given type name. |
10926 * @param typeName the type of the variables being declared | 12757 * @param typeName the type of the variables being declared |
10927 */ | 12758 */ |
10928 void set type(TypeName typeName) { | 12759 void set type(TypeName typeName) { |
10929 _type = becomeParentOf(typeName); | 12760 _type = becomeParentOf(typeName); |
10930 } | 12761 } |
10931 void visitChildren(ASTVisitor<Object> visitor) { | 12762 void visitChildren(ASTVisitor<Object> visitor) { |
10932 safelyVisitChild(_type, visitor); | 12763 safelyVisitChild(_type, visitor); |
10933 _variables.accept(visitor); | 12764 _variables.accept(visitor); |
10934 } | 12765 } |
10935 Token get firstTokenAfterCommentAndMetadata { | 12766 Token get firstTokenAfterCommentAndMetadata { |
10936 if (_keyword != null) { | 12767 if (_keyword != null) { |
10937 return _keyword; | 12768 return _keyword; |
10938 } else if (_type != null) { | 12769 } else if (_type != null) { |
10939 return _type.beginToken; | 12770 return _type.beginToken; |
10940 } | 12771 } |
10941 return _variables.beginToken; | 12772 return _variables.beginToken; |
10942 } | 12773 } |
10943 } | 12774 } |
| 12775 |
10944 /** | 12776 /** |
10945 * Instances of the class {@code VariableDeclarationStatement} represent a list
of variables that | 12777 * Instances of the class {@code VariableDeclarationStatement} represent a list
of variables that |
10946 * are being declared in a context where a statement is required. | 12778 * are being declared in a context where a statement is required. |
10947 * <pre> | 12779 * <pre> |
10948 * variableDeclarationStatement ::={@link VariableDeclarationList variableList}
';' | 12780 * variableDeclarationStatement ::={@link VariableDeclarationList variableList}
';' |
10949 * </pre> | 12781 * </pre> |
10950 * @coverage dart.engine.ast | 12782 * @coverage dart.engine.ast |
10951 */ | 12783 */ |
10952 class VariableDeclarationStatement extends Statement { | 12784 class VariableDeclarationStatement extends Statement { |
| 12785 |
10953 /** | 12786 /** |
10954 * The variables being declared. | 12787 * The variables being declared. |
10955 */ | 12788 */ |
10956 VariableDeclarationList _variableList; | 12789 VariableDeclarationList _variableList; |
| 12790 |
10957 /** | 12791 /** |
10958 * The semicolon terminating the statement. | 12792 * The semicolon terminating the statement. |
10959 */ | 12793 */ |
10960 Token _semicolon; | 12794 Token _semicolon; |
| 12795 |
10961 /** | 12796 /** |
10962 * Initialize a newly created variable declaration statement. | 12797 * Initialize a newly created variable declaration statement. |
10963 * @param variableList the fields being declared | 12798 * @param variableList the fields being declared |
10964 * @param semicolon the semicolon terminating the statement | 12799 * @param semicolon the semicolon terminating the statement |
10965 */ | 12800 */ |
10966 VariableDeclarationStatement.full(VariableDeclarationList variableList, Token
semicolon) { | 12801 VariableDeclarationStatement.full(VariableDeclarationList variableList, Token
semicolon) { |
10967 this._variableList = becomeParentOf(variableList); | 12802 this._variableList = becomeParentOf(variableList); |
10968 this._semicolon = semicolon; | 12803 this._semicolon = semicolon; |
10969 } | 12804 } |
| 12805 |
10970 /** | 12806 /** |
10971 * Initialize a newly created variable declaration statement. | 12807 * Initialize a newly created variable declaration statement. |
10972 * @param variableList the fields being declared | 12808 * @param variableList the fields being declared |
10973 * @param semicolon the semicolon terminating the statement | 12809 * @param semicolon the semicolon terminating the statement |
10974 */ | 12810 */ |
10975 VariableDeclarationStatement({VariableDeclarationList variableList, Token semi
colon}) : this.full(variableList, semicolon); | 12811 VariableDeclarationStatement({VariableDeclarationList variableList, Token semi
colon}) : this.full(variableList, semicolon); |
10976 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this); | 12812 accept(ASTVisitor visitor) => visitor.visitVariableDeclarationStatement(this); |
10977 Token get beginToken => _variableList.beginToken; | 12813 Token get beginToken => _variableList.beginToken; |
10978 Token get endToken => _semicolon; | 12814 Token get endToken => _semicolon; |
| 12815 |
10979 /** | 12816 /** |
10980 * Return the semicolon terminating the statement. | 12817 * Return the semicolon terminating the statement. |
10981 * @return the semicolon terminating the statement | 12818 * @return the semicolon terminating the statement |
10982 */ | 12819 */ |
10983 Token get semicolon => _semicolon; | 12820 Token get semicolon => _semicolon; |
| 12821 |
10984 /** | 12822 /** |
10985 * Return the variables being declared. | 12823 * Return the variables being declared. |
10986 * @return the variables being declared | 12824 * @return the variables being declared |
10987 */ | 12825 */ |
10988 VariableDeclarationList get variables => _variableList; | 12826 VariableDeclarationList get variables => _variableList; |
| 12827 |
10989 /** | 12828 /** |
10990 * Set the semicolon terminating the statement to the given token. | 12829 * Set the semicolon terminating the statement to the given token. |
10991 * @param semicolon the semicolon terminating the statement | 12830 * @param semicolon the semicolon terminating the statement |
10992 */ | 12831 */ |
10993 void set semicolon(Token semicolon2) { | 12832 void set semicolon(Token semicolon2) { |
10994 this._semicolon = semicolon2; | 12833 this._semicolon = semicolon2; |
10995 } | 12834 } |
| 12835 |
10996 /** | 12836 /** |
10997 * Set the variables being declared to the given list of variables. | 12837 * Set the variables being declared to the given list of variables. |
10998 * @param variableList the variables being declared | 12838 * @param variableList the variables being declared |
10999 */ | 12839 */ |
11000 void set variables(VariableDeclarationList variableList2) { | 12840 void set variables(VariableDeclarationList variableList2) { |
11001 this._variableList = becomeParentOf(variableList2); | 12841 this._variableList = becomeParentOf(variableList2); |
11002 } | 12842 } |
11003 void visitChildren(ASTVisitor<Object> visitor) { | 12843 void visitChildren(ASTVisitor<Object> visitor) { |
11004 safelyVisitChild(_variableList, visitor); | 12844 safelyVisitChild(_variableList, visitor); |
11005 } | 12845 } |
11006 } | 12846 } |
| 12847 |
11007 /** | 12848 /** |
11008 * Instances of the class {@code WhileStatement} represent a while statement. | 12849 * Instances of the class {@code WhileStatement} represent a while statement. |
11009 * <pre> | 12850 * <pre> |
11010 * whileStatement ::= | 12851 * whileStatement ::= |
11011 * 'while' '(' {@link Expression condition} ')' {@link Statement body}</pre> | 12852 * 'while' '(' {@link Expression condition} ')' {@link Statement body}</pre> |
11012 * @coverage dart.engine.ast | 12853 * @coverage dart.engine.ast |
11013 */ | 12854 */ |
11014 class WhileStatement extends Statement { | 12855 class WhileStatement extends Statement { |
| 12856 |
11015 /** | 12857 /** |
11016 * The token representing the 'while' keyword. | 12858 * The token representing the 'while' keyword. |
11017 */ | 12859 */ |
11018 Token _keyword; | 12860 Token _keyword; |
| 12861 |
11019 /** | 12862 /** |
11020 * The left parenthesis. | 12863 * The left parenthesis. |
11021 */ | 12864 */ |
11022 Token _leftParenthesis; | 12865 Token _leftParenthesis; |
| 12866 |
11023 /** | 12867 /** |
11024 * The expression used to determine whether to execute the body of the loop. | 12868 * The expression used to determine whether to execute the body of the loop. |
11025 */ | 12869 */ |
11026 Expression _condition; | 12870 Expression _condition; |
| 12871 |
11027 /** | 12872 /** |
11028 * The right parenthesis. | 12873 * The right parenthesis. |
11029 */ | 12874 */ |
11030 Token _rightParenthesis; | 12875 Token _rightParenthesis; |
| 12876 |
11031 /** | 12877 /** |
11032 * The body of the loop. | 12878 * The body of the loop. |
11033 */ | 12879 */ |
11034 Statement _body; | 12880 Statement _body; |
| 12881 |
11035 /** | 12882 /** |
11036 * Initialize a newly created while statement. | 12883 * Initialize a newly created while statement. |
11037 * @param keyword the token representing the 'while' keyword | 12884 * @param keyword the token representing the 'while' keyword |
11038 * @param leftParenthesis the left parenthesis | 12885 * @param leftParenthesis the left parenthesis |
11039 * @param condition the expression used to determine whether to execute the bo
dy of the loop | 12886 * @param condition the expression used to determine whether to execute the bo
dy of the loop |
11040 * @param rightParenthesis the right parenthesis | 12887 * @param rightParenthesis the right parenthesis |
11041 * @param body the body of the loop | 12888 * @param body the body of the loop |
11042 */ | 12889 */ |
11043 WhileStatement.full(Token keyword, Token leftParenthesis, Expression condition
, Token rightParenthesis, Statement body) { | 12890 WhileStatement.full(Token keyword, Token leftParenthesis, Expression condition
, Token rightParenthesis, Statement body) { |
11044 this._keyword = keyword; | 12891 this._keyword = keyword; |
11045 this._leftParenthesis = leftParenthesis; | 12892 this._leftParenthesis = leftParenthesis; |
11046 this._condition = becomeParentOf(condition); | 12893 this._condition = becomeParentOf(condition); |
11047 this._rightParenthesis = rightParenthesis; | 12894 this._rightParenthesis = rightParenthesis; |
11048 this._body = becomeParentOf(body); | 12895 this._body = becomeParentOf(body); |
11049 } | 12896 } |
| 12897 |
11050 /** | 12898 /** |
11051 * Initialize a newly created while statement. | 12899 * Initialize a newly created while statement. |
11052 * @param keyword the token representing the 'while' keyword | 12900 * @param keyword the token representing the 'while' keyword |
11053 * @param leftParenthesis the left parenthesis | 12901 * @param leftParenthesis the left parenthesis |
11054 * @param condition the expression used to determine whether to execute the bo
dy of the loop | 12902 * @param condition the expression used to determine whether to execute the bo
dy of the loop |
11055 * @param rightParenthesis the right parenthesis | 12903 * @param rightParenthesis the right parenthesis |
11056 * @param body the body of the loop | 12904 * @param body the body of the loop |
11057 */ | 12905 */ |
11058 WhileStatement({Token keyword, Token leftParenthesis, Expression condition, To
ken rightParenthesis, Statement body}) : this.full(keyword, leftParenthesis, con
dition, rightParenthesis, body); | 12906 WhileStatement({Token keyword, Token leftParenthesis, Expression condition, To
ken rightParenthesis, Statement body}) : this.full(keyword, leftParenthesis, con
dition, rightParenthesis, body); |
11059 accept(ASTVisitor visitor) => visitor.visitWhileStatement(this); | 12907 accept(ASTVisitor visitor) => visitor.visitWhileStatement(this); |
11060 Token get beginToken => _keyword; | 12908 Token get beginToken => _keyword; |
| 12909 |
11061 /** | 12910 /** |
11062 * Return the body of the loop. | 12911 * Return the body of the loop. |
11063 * @return the body of the loop | 12912 * @return the body of the loop |
11064 */ | 12913 */ |
11065 Statement get body => _body; | 12914 Statement get body => _body; |
| 12915 |
11066 /** | 12916 /** |
11067 * Return the expression used to determine whether to execute the body of the
loop. | 12917 * Return the expression used to determine whether to execute the body of the
loop. |
11068 * @return the expression used to determine whether to execute the body of the
loop | 12918 * @return the expression used to determine whether to execute the body of the
loop |
11069 */ | 12919 */ |
11070 Expression get condition => _condition; | 12920 Expression get condition => _condition; |
11071 Token get endToken => _body.endToken; | 12921 Token get endToken => _body.endToken; |
| 12922 |
11072 /** | 12923 /** |
11073 * Return the token representing the 'while' keyword. | 12924 * Return the token representing the 'while' keyword. |
11074 * @return the token representing the 'while' keyword | 12925 * @return the token representing the 'while' keyword |
11075 */ | 12926 */ |
11076 Token get keyword => _keyword; | 12927 Token get keyword => _keyword; |
| 12928 |
11077 /** | 12929 /** |
11078 * Return the left parenthesis. | 12930 * Return the left parenthesis. |
11079 * @return the left parenthesis | 12931 * @return the left parenthesis |
11080 */ | 12932 */ |
11081 Token get leftParenthesis => _leftParenthesis; | 12933 Token get leftParenthesis => _leftParenthesis; |
| 12934 |
11082 /** | 12935 /** |
11083 * Return the right parenthesis. | 12936 * Return the right parenthesis. |
11084 * @return the right parenthesis | 12937 * @return the right parenthesis |
11085 */ | 12938 */ |
11086 Token get rightParenthesis => _rightParenthesis; | 12939 Token get rightParenthesis => _rightParenthesis; |
| 12940 |
11087 /** | 12941 /** |
11088 * Set the body of the loop to the given statement. | 12942 * Set the body of the loop to the given statement. |
11089 * @param statement the body of the loop | 12943 * @param statement the body of the loop |
11090 */ | 12944 */ |
11091 void set body(Statement statement) { | 12945 void set body(Statement statement) { |
11092 _body = becomeParentOf(statement); | 12946 _body = becomeParentOf(statement); |
11093 } | 12947 } |
| 12948 |
11094 /** | 12949 /** |
11095 * Set the expression used to determine whether to execute the body of the loo
p to the given | 12950 * Set the expression used to determine whether to execute the body of the loo
p to the given |
11096 * expression. | 12951 * expression. |
11097 * @param expression the expression used to determine whether to execute the b
ody of the loop | 12952 * @param expression the expression used to determine whether to execute the b
ody of the loop |
11098 */ | 12953 */ |
11099 void set condition(Expression expression) { | 12954 void set condition(Expression expression) { |
11100 _condition = becomeParentOf(expression); | 12955 _condition = becomeParentOf(expression); |
11101 } | 12956 } |
| 12957 |
11102 /** | 12958 /** |
11103 * Set the token representing the 'while' keyword to the given token. | 12959 * Set the token representing the 'while' keyword to the given token. |
11104 * @param keyword the token representing the 'while' keyword | 12960 * @param keyword the token representing the 'while' keyword |
11105 */ | 12961 */ |
11106 void set keyword(Token keyword2) { | 12962 void set keyword(Token keyword2) { |
11107 this._keyword = keyword2; | 12963 this._keyword = keyword2; |
11108 } | 12964 } |
| 12965 |
11109 /** | 12966 /** |
11110 * Set the left parenthesis to the given token. | 12967 * Set the left parenthesis to the given token. |
11111 * @param leftParenthesis the left parenthesis | 12968 * @param leftParenthesis the left parenthesis |
11112 */ | 12969 */ |
11113 void set leftParenthesis(Token leftParenthesis2) { | 12970 void set leftParenthesis(Token leftParenthesis2) { |
11114 this._leftParenthesis = leftParenthesis2; | 12971 this._leftParenthesis = leftParenthesis2; |
11115 } | 12972 } |
| 12973 |
11116 /** | 12974 /** |
11117 * Set the right parenthesis to the given token. | 12975 * Set the right parenthesis to the given token. |
11118 * @param rightParenthesis the right parenthesis | 12976 * @param rightParenthesis the right parenthesis |
11119 */ | 12977 */ |
11120 void set rightParenthesis(Token rightParenthesis2) { | 12978 void set rightParenthesis(Token rightParenthesis2) { |
11121 this._rightParenthesis = rightParenthesis2; | 12979 this._rightParenthesis = rightParenthesis2; |
11122 } | 12980 } |
11123 void visitChildren(ASTVisitor<Object> visitor) { | 12981 void visitChildren(ASTVisitor<Object> visitor) { |
11124 safelyVisitChild(_condition, visitor); | 12982 safelyVisitChild(_condition, visitor); |
11125 safelyVisitChild(_body, visitor); | 12983 safelyVisitChild(_body, visitor); |
11126 } | 12984 } |
11127 } | 12985 } |
| 12986 |
11128 /** | 12987 /** |
11129 * Instances of the class {@code WithClause} represent the with clause in a clas
s declaration. | 12988 * Instances of the class {@code WithClause} represent the with clause in a clas
s declaration. |
11130 * <pre> | 12989 * <pre> |
11131 * withClause ::= | 12990 * withClause ::= |
11132 * 'with' {@link TypeName mixin} (',' {@link TypeName mixin}) | 12991 * 'with' {@link TypeName mixin} (',' {@link TypeName mixin}) |
11133 * </pre> | 12992 * </pre> |
11134 * @coverage dart.engine.ast | 12993 * @coverage dart.engine.ast |
11135 */ | 12994 */ |
11136 class WithClause extends ASTNode { | 12995 class WithClause extends ASTNode { |
| 12996 |
11137 /** | 12997 /** |
11138 * The token representing the 'with' keyword. | 12998 * The token representing the 'with' keyword. |
11139 */ | 12999 */ |
11140 Token _withKeyword; | 13000 Token _withKeyword; |
| 13001 |
11141 /** | 13002 /** |
11142 * The names of the mixins that were specified. | 13003 * The names of the mixins that were specified. |
11143 */ | 13004 */ |
11144 NodeList<TypeName> _mixinTypes; | 13005 NodeList<TypeName> _mixinTypes; |
| 13006 |
11145 /** | 13007 /** |
11146 * Initialize a newly created with clause. | 13008 * Initialize a newly created with clause. |
11147 * @param withKeyword the token representing the 'with' keyword | 13009 * @param withKeyword the token representing the 'with' keyword |
11148 * @param mixinTypes the names of the mixins that were specified | 13010 * @param mixinTypes the names of the mixins that were specified |
11149 */ | 13011 */ |
11150 WithClause.full(Token withKeyword, List<TypeName> mixinTypes) { | 13012 WithClause.full(Token withKeyword, List<TypeName> mixinTypes) { |
11151 this._mixinTypes = new NodeList<TypeName>(this); | 13013 this._mixinTypes = new NodeList<TypeName>(this); |
11152 this._withKeyword = withKeyword; | 13014 this._withKeyword = withKeyword; |
11153 this._mixinTypes.addAll(mixinTypes); | 13015 this._mixinTypes.addAll(mixinTypes); |
11154 } | 13016 } |
| 13017 |
11155 /** | 13018 /** |
11156 * Initialize a newly created with clause. | 13019 * Initialize a newly created with clause. |
11157 * @param withKeyword the token representing the 'with' keyword | 13020 * @param withKeyword the token representing the 'with' keyword |
11158 * @param mixinTypes the names of the mixins that were specified | 13021 * @param mixinTypes the names of the mixins that were specified |
11159 */ | 13022 */ |
11160 WithClause({Token withKeyword, List<TypeName> mixinTypes}) : this.full(withKey
word, mixinTypes); | 13023 WithClause({Token withKeyword, List<TypeName> mixinTypes}) : this.full(withKey
word, mixinTypes); |
11161 accept(ASTVisitor visitor) => visitor.visitWithClause(this); | 13024 accept(ASTVisitor visitor) => visitor.visitWithClause(this); |
11162 Token get beginToken => _withKeyword; | 13025 Token get beginToken => _withKeyword; |
11163 Token get endToken => _mixinTypes.endToken; | 13026 Token get endToken => _mixinTypes.endToken; |
| 13027 |
11164 /** | 13028 /** |
11165 * Return the names of the mixins that were specified. | 13029 * Return the names of the mixins that were specified. |
11166 * @return the names of the mixins that were specified | 13030 * @return the names of the mixins that were specified |
11167 */ | 13031 */ |
11168 NodeList<TypeName> get mixinTypes => _mixinTypes; | 13032 NodeList<TypeName> get mixinTypes => _mixinTypes; |
| 13033 |
11169 /** | 13034 /** |
11170 * Return the token representing the 'with' keyword. | 13035 * Return the token representing the 'with' keyword. |
11171 * @return the token representing the 'with' keyword | 13036 * @return the token representing the 'with' keyword |
11172 */ | 13037 */ |
11173 Token get withKeyword => _withKeyword; | 13038 Token get withKeyword => _withKeyword; |
| 13039 |
11174 /** | 13040 /** |
11175 * Set the token representing the 'with' keyword to the given token. | 13041 * Set the token representing the 'with' keyword to the given token. |
11176 * @param withKeyword the token representing the 'with' keyword | 13042 * @param withKeyword the token representing the 'with' keyword |
11177 */ | 13043 */ |
11178 void set mixinKeyword(Token withKeyword2) { | 13044 void set mixinKeyword(Token withKeyword2) { |
11179 this._withKeyword = withKeyword2; | 13045 this._withKeyword = withKeyword2; |
11180 } | 13046 } |
11181 void visitChildren(ASTVisitor<Object> visitor) { | 13047 void visitChildren(ASTVisitor<Object> visitor) { |
11182 _mixinTypes.accept(visitor); | 13048 _mixinTypes.accept(visitor); |
11183 } | 13049 } |
11184 } | 13050 } |
| 13051 |
| 13052 /** |
| 13053 * Instances of the class {@code BreadthFirstVisitor} implement an AST visitor t
hat will recursively |
| 13054 * visit all of the nodes in an AST structure, similar to {@link GeneralizingAST
Visitor}. This |
| 13055 * visitor uses a breadth-first ordering rather than the depth-first ordering of
{@link GeneralizingASTVisitor}. |
| 13056 * @coverage dart.engine.ast |
| 13057 */ |
| 13058 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> { |
| 13059 Queue<ASTNode> _queue = new Queue<ASTNode>(); |
| 13060 GeneralizingASTVisitor<Object> _childVisitor; |
| 13061 |
| 13062 /** |
| 13063 * Visit all nodes in the tree starting at the given {@code root} node, in dep
th-first order. |
| 13064 * @param root the root of the ASTNode tree |
| 13065 */ |
| 13066 void visitAllNodes(ASTNode root) { |
| 13067 _queue.add(root); |
| 13068 while (!_queue.isEmpty) { |
| 13069 ASTNode next = _queue.removeFirst(); |
| 13070 next.accept(this); |
| 13071 } |
| 13072 } |
| 13073 R visitNode(ASTNode node) { |
| 13074 node.visitChildren(_childVisitor); |
| 13075 return null; |
| 13076 } |
| 13077 BreadthFirstVisitor() { |
| 13078 this._childVisitor = new GeneralizingASTVisitor_1(this); |
| 13079 } |
| 13080 } |
| 13081 class GeneralizingASTVisitor_1 extends GeneralizingASTVisitor<Object> { |
| 13082 final BreadthFirstVisitor BreadthFirstVisitor_this; |
| 13083 GeneralizingASTVisitor_1(this.BreadthFirstVisitor_this) : super(); |
| 13084 Object visitNode(ASTNode node) { |
| 13085 BreadthFirstVisitor_this._queue.add(node); |
| 13086 return null; |
| 13087 } |
| 13088 } |
| 13089 |
11185 /** | 13090 /** |
11186 * Instances of the class {@code ConstantEvaluator} evaluate constant expression
s to produce their | 13091 * Instances of the class {@code ConstantEvaluator} evaluate constant expression
s to produce their |
11187 * compile-time value. According to the Dart Language Specification: <blockquote
> A constant | 13092 * compile-time value. According to the Dart Language Specification: <blockquote
> A constant |
11188 * expression is one of the following: | 13093 * expression is one of the following: |
11189 * <ul> | 13094 * <ul> |
11190 * <li>A literal number.</li> | 13095 * <li>A literal number.</li> |
11191 * <li>A literal boolean.</li> | 13096 * <li>A literal boolean.</li> |
11192 * <li>A literal string where any interpolated expression is a compile-time cons
tant that evaluates | 13097 * <li>A literal string where any interpolated expression is a compile-time cons
tant that evaluates |
11193 * to a numeric, string or boolean value or to {@code null}.</li> | 13098 * to a numeric, string or boolean value or to {@code null}.</li> |
11194 * <li>{@code null}.</li> | 13099 * <li>{@code null}.</li> |
(...skipping 13 matching lines...) Expand all Loading... |
11208 * </ul> | 13113 * </ul> |
11209 * </blockquote> The values returned by instances of this class are therefore {@
code null} and | 13114 * </blockquote> The values returned by instances of this class are therefore {@
code null} and |
11210 * instances of the classes {@code Boolean}, {@code BigInteger}, {@code Double},
{@code String}, and{@code DartObject}. | 13115 * instances of the classes {@code Boolean}, {@code BigInteger}, {@code Double},
{@code String}, and{@code DartObject}. |
11211 * <p> | 13116 * <p> |
11212 * In addition, this class defines several values that can be returned to indica
te various | 13117 * In addition, this class defines several values that can be returned to indica
te various |
11213 * conditions encountered during evaluation. These are documented with the stati
c field that define | 13118 * conditions encountered during evaluation. These are documented with the stati
c field that define |
11214 * those values. | 13119 * those values. |
11215 * @coverage dart.engine.ast | 13120 * @coverage dart.engine.ast |
11216 */ | 13121 */ |
11217 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { | 13122 class ConstantEvaluator extends GeneralizingASTVisitor<Object> { |
| 13123 |
11218 /** | 13124 /** |
11219 * The value returned for expressions (or non-expression nodes) that are not c
ompile-time constant | 13125 * The value returned for expressions (or non-expression nodes) that are not c
ompile-time constant |
11220 * expressions. | 13126 * expressions. |
11221 */ | 13127 */ |
11222 static Object NOT_A_CONSTANT = new Object(); | 13128 static Object NOT_A_CONSTANT = new Object(); |
11223 /** | |
11224 * Initialize a newly created constant evaluator. | |
11225 */ | |
11226 ConstantEvaluator() { | |
11227 } | |
11228 Object visitAdjacentStrings(AdjacentStrings node) { | 13129 Object visitAdjacentStrings(AdjacentStrings node) { |
11229 JavaStringBuilder builder = new JavaStringBuilder(); | 13130 JavaStringBuilder builder = new JavaStringBuilder(); |
11230 for (StringLiteral string in node.strings) { | 13131 for (StringLiteral string in node.strings) { |
11231 Object value = string.accept(this); | 13132 Object value = string.accept(this); |
11232 if (identical(value, NOT_A_CONSTANT)) { | 13133 if (identical(value, NOT_A_CONSTANT)) { |
11233 return value; | 13134 return value; |
11234 } | 13135 } |
11235 builder.append(value); | 13136 builder.append(value); |
11236 } | 13137 } |
11237 return builder.toString(); | 13138 return builder.toString(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11442 JavaStringBuilder builder = new JavaStringBuilder(); | 13343 JavaStringBuilder builder = new JavaStringBuilder(); |
11443 for (InterpolationElement element in node.elements) { | 13344 for (InterpolationElement element in node.elements) { |
11444 Object value = element.accept(this); | 13345 Object value = element.accept(this); |
11445 if (identical(value, NOT_A_CONSTANT)) { | 13346 if (identical(value, NOT_A_CONSTANT)) { |
11446 return value; | 13347 return value; |
11447 } | 13348 } |
11448 builder.append(value); | 13349 builder.append(value); |
11449 } | 13350 } |
11450 return builder.toString(); | 13351 return builder.toString(); |
11451 } | 13352 } |
| 13353 |
11452 /** | 13354 /** |
11453 * Return the constant value of the static constant represented by the given e
lement. | 13355 * Return the constant value of the static constant represented by the given e
lement. |
11454 * @param element the element whose value is to be returned | 13356 * @param element the element whose value is to be returned |
11455 * @return the constant value of the static constant | 13357 * @return the constant value of the static constant |
11456 */ | 13358 */ |
11457 Object getConstantValue(Element element) { | 13359 Object getConstantValue(Element element) { |
11458 if (element is FieldElement) { | 13360 if (element is FieldElement) { |
11459 FieldElement field = element as FieldElement; | 13361 FieldElement field = element as FieldElement; |
11460 if (field.isStatic() && field.isConst()) { | 13362 if (field.isStatic() && field.isConst()) { |
11461 } | 13363 } |
11462 } | 13364 } |
11463 return NOT_A_CONSTANT; | 13365 return NOT_A_CONSTANT; |
11464 } | 13366 } |
11465 } | 13367 } |
| 13368 |
11466 /** | 13369 /** |
11467 * Instances of the class {@code ElementLocator} locate the {@link Element Dart
model element}associated with a given {@link ASTNode AST node}. | 13370 * Instances of the class {@code ElementLocator} locate the {@link Element Dart
model element}associated with a given {@link ASTNode AST node}. |
11468 * @coverage dart.engine.ast | 13371 * @coverage dart.engine.ast |
11469 */ | 13372 */ |
11470 class ElementLocator { | 13373 class ElementLocator { |
| 13374 |
11471 /** | 13375 /** |
11472 * Locate the {@link Element Dart model element} associated with the given {@l
ink ASTNode AST | 13376 * Locate the {@link Element Dart model element} associated with the given {@l
ink ASTNode AST |
11473 * node}. | 13377 * node}. |
11474 * @param node the node (not {@code null}) | 13378 * @param node the node (not {@code null}) |
11475 * @return the associated element, or {@code null} if none is found | 13379 * @return the associated element, or {@code null} if none is found |
11476 */ | 13380 */ |
11477 static Element locate(ASTNode node) { | 13381 static Element locate(ASTNode node) { |
11478 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); | 13382 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); |
11479 return node.accept(mapper); | 13383 return node.accept(mapper); |
11480 } | 13384 } |
11481 /** | |
11482 * Clients should use {@link #locate(ASTNode)}. | |
11483 */ | |
11484 ElementLocator() { | |
11485 } | |
11486 } | 13385 } |
| 13386 |
11487 /** | 13387 /** |
11488 * Visitor that maps nodes to elements. | 13388 * Visitor that maps nodes to elements. |
11489 */ | 13389 */ |
11490 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { | 13390 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { |
11491 Element visitBinaryExpression(BinaryExpression node) => node.element; | 13391 Element visitBinaryExpression(BinaryExpression node) => node.element; |
11492 Element visitClassDeclaration(ClassDeclaration node) => node.element; | 13392 Element visitClassDeclaration(ClassDeclaration node) => node.element; |
11493 Element visitCompilationUnit(CompilationUnit node) => node.element; | 13393 Element visitCompilationUnit(CompilationUnit node) => node.element; |
11494 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme
nt; | 13394 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme
nt; |
11495 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; | 13395 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; |
11496 Element visitIdentifier(Identifier node) { | 13396 Element visitIdentifier(Identifier node) { |
11497 ASTNode parent2 = node.parent; | 13397 ASTNode parent2 = node.parent; |
11498 if (parent2 is ConstructorDeclaration) { | 13398 if (parent2 is ConstructorDeclaration) { |
11499 ConstructorDeclaration decl = parent2 as ConstructorDeclaration; | 13399 ConstructorDeclaration decl = parent2 as ConstructorDeclaration; |
11500 Identifier returnType2 = decl.returnType; | 13400 Identifier returnType2 = decl.returnType; |
11501 if (identical(returnType2, node)) { | 13401 if (identical(returnType2, node)) { |
11502 SimpleIdentifier name2 = decl.name; | 13402 SimpleIdentifier name2 = decl.name; |
11503 if (name2 != null) { | 13403 if (name2 != null) { |
11504 return name2.element; | 13404 return name2.element; |
11505 } | 13405 } |
11506 Element element2 = node.element; | 13406 Element element2 = node.element; |
11507 if (element2 is ClassElement) { | 13407 if (element2 is ClassElement) { |
11508 return ((element2 as ClassElement)).unnamedConstructor; | 13408 return ((element2 as ClassElement)).unnamedConstructor; |
11509 } | 13409 } |
11510 } | 13410 } |
11511 } | 13411 } |
| 13412 if (parent2 is LibraryIdentifier) { |
| 13413 ASTNode grandParent = ((parent2 as LibraryIdentifier)).parent; |
| 13414 if (grandParent is PartOfDirective) { |
| 13415 Element element3 = ((grandParent as PartOfDirective)).element; |
| 13416 if (element3 is LibraryElement) { |
| 13417 return ((element3 as LibraryElement)).definingCompilationUnit; |
| 13418 } |
| 13419 } |
| 13420 } |
11512 return node.element; | 13421 return node.element; |
11513 } | 13422 } |
11514 Element visitImportDirective(ImportDirective node) => node.element; | 13423 Element visitImportDirective(ImportDirective node) => node.element; |
11515 Element visitIndexExpression(IndexExpression node) => node.element; | 13424 Element visitIndexExpression(IndexExpression node) => node.element; |
11516 Element visitInstanceCreationExpression(InstanceCreationExpression node) => no
de.element; | 13425 Element visitInstanceCreationExpression(InstanceCreationExpression node) => no
de.element; |
11517 Element visitLibraryDirective(LibraryDirective node) => node.element; | 13426 Element visitLibraryDirective(LibraryDirective node) => node.element; |
11518 Element visitMethodDeclaration(MethodDeclaration node) => node.element; | 13427 Element visitMethodDeclaration(MethodDeclaration node) => node.element; |
11519 Element visitMethodInvocation(MethodInvocation node) => node.methodName.elemen
t; | 13428 Element visitMethodInvocation(MethodInvocation node) => node.methodName.elemen
t; |
11520 Element visitPostfixExpression(PostfixExpression node) => node.element; | 13429 Element visitPostfixExpression(PostfixExpression node) => node.element; |
11521 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element; | 13430 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element; |
11522 Element visitPrefixExpression(PrefixExpression node) => node.element; | 13431 Element visitPrefixExpression(PrefixExpression node) => node.element; |
11523 Element visitStringLiteral(StringLiteral node) { | 13432 Element visitStringLiteral(StringLiteral node) { |
11524 ASTNode parent2 = node.parent; | 13433 ASTNode parent2 = node.parent; |
11525 if (parent2 is UriBasedDirective) { | 13434 if (parent2 is UriBasedDirective) { |
11526 return ((parent2 as UriBasedDirective)).element; | 13435 return ((parent2 as UriBasedDirective)).uriElement; |
11527 } | 13436 } |
11528 return null; | 13437 return null; |
11529 } | 13438 } |
11530 Element visitVariableDeclaration(VariableDeclaration node) => node.element; | 13439 Element visitVariableDeclaration(VariableDeclaration node) => node.element; |
11531 } | 13440 } |
| 13441 |
11532 /** | 13442 /** |
11533 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito
r that will | 13443 * Instances of the class {@code GeneralizingASTVisitor} implement an AST visito
r that will |
11534 * recursively visit all of the nodes in an AST structure (like instances of the
class{@link RecursiveASTVisitor}). In addition, when a node of a specific type
is visited not only | 13444 * recursively visit all of the nodes in an AST structure (like instances of the
class{@link RecursiveASTVisitor}). In addition, when a node of a specific type
is visited not only |
11535 * will the visit method for that specific type of node be invoked, but addition
al methods for the | 13445 * will the visit method for that specific type of node be invoked, but addition
al methods for the |
11536 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to | 13446 * superclasses of that node will also be invoked. For example, using an instanc
e of this class to |
11537 * visit a {@link Block} will cause the method {@link #visitBlock(Block)} to be
invoked but will | 13447 * visit a {@link Block} will cause the method {@link #visitBlock(Block)} to be
invoked but will |
11538 * also cause the methods {@link #visitStatement(Statement)} and {@link #visitNo
de(ASTNode)} to be | 13448 * also cause the methods {@link #visitStatement(Statement)} and {@link #visitNo
de(ASTNode)} to be |
11539 * subsequently invoked. This allows visitors to be written that visit all state
ments without | 13449 * subsequently invoked. This allows visitors to be written that visit all state
ments without |
11540 * needing to override the visit method for each of the specific subclasses of {
@link Statement}. | 13450 * needing to override the visit method for each of the specific subclasses of {
@link Statement}. |
11541 * <p> | 13451 * <p> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11588 R visitExpressionFunctionBody(ExpressionFunctionBody node) => visitFunctionBod
y(node); | 13498 R visitExpressionFunctionBody(ExpressionFunctionBody node) => visitFunctionBod
y(node); |
11589 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); | 13499 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); |
11590 R visitExtendsClause(ExtendsClause node) => visitNode(node); | 13500 R visitExtendsClause(ExtendsClause node) => visitNode(node); |
11591 R visitFieldDeclaration(FieldDeclaration node) => visitClassMember(node); | 13501 R visitFieldDeclaration(FieldDeclaration node) => visitClassMember(node); |
11592 R visitFieldFormalParameter(FieldFormalParameter node) => visitNormalFormalPar
ameter(node); | 13502 R visitFieldFormalParameter(FieldFormalParameter node) => visitNormalFormalPar
ameter(node); |
11593 R visitForEachStatement(ForEachStatement node) => visitStatement(node); | 13503 R visitForEachStatement(ForEachStatement node) => visitStatement(node); |
11594 R visitFormalParameter(FormalParameter node) => visitNode(node); | 13504 R visitFormalParameter(FormalParameter node) => visitNode(node); |
11595 R visitFormalParameterList(FormalParameterList node) => visitNode(node); | 13505 R visitFormalParameterList(FormalParameterList node) => visitNode(node); |
11596 R visitForStatement(ForStatement node) => visitStatement(node); | 13506 R visitForStatement(ForStatement node) => visitStatement(node); |
11597 R visitFunctionBody(FunctionBody node) => visitNode(node); | 13507 R visitFunctionBody(FunctionBody node) => visitNode(node); |
11598 R visitFunctionDeclaration(FunctionDeclaration node) => visitNode(node); | 13508 R visitFunctionDeclaration(FunctionDeclaration node) => visitCompilationUnitMe
mber(node); |
11599 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) => visi
tStatement(node); | 13509 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) => visi
tStatement(node); |
11600 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); | 13510 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); |
11601 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => visi
tExpression(node); | 13511 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => visi
tExpression(node); |
11602 R visitFunctionTypeAlias(FunctionTypeAlias node) => visitTypeAlias(node); | 13512 R visitFunctionTypeAlias(FunctionTypeAlias node) => visitTypeAlias(node); |
11603 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) => visi
tNormalFormalParameter(node); | 13513 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) => visi
tNormalFormalParameter(node); |
11604 R visitHideCombinator(HideCombinator node) => visitCombinator(node); | 13514 R visitHideCombinator(HideCombinator node) => visitCombinator(node); |
11605 R visitIdentifier(Identifier node) => visitExpression(node); | 13515 R visitIdentifier(Identifier node) => visitExpression(node); |
11606 R visitIfStatement(IfStatement node) => visitStatement(node); | 13516 R visitIfStatement(IfStatement node) => visitStatement(node); |
11607 R visitImplementsClause(ImplementsClause node) => visitNode(node); | 13517 R visitImplementsClause(ImplementsClause node) => visitNode(node); |
11608 R visitImportDirective(ImportDirective node) => visitNamespaceDirective(node); | 13518 R visitImportDirective(ImportDirective node) => visitNamespaceDirective(node); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11666 R visitTypeName(TypeName node) => visitNode(node); | 13576 R visitTypeName(TypeName node) => visitNode(node); |
11667 R visitTypeParameter(TypeParameter node) => visitNode(node); | 13577 R visitTypeParameter(TypeParameter node) => visitNode(node); |
11668 R visitTypeParameterList(TypeParameterList node) => visitNode(node); | 13578 R visitTypeParameterList(TypeParameterList node) => visitNode(node); |
11669 R visitUriBasedDirective(UriBasedDirective node) => visitDirective(node); | 13579 R visitUriBasedDirective(UriBasedDirective node) => visitDirective(node); |
11670 R visitVariableDeclaration(VariableDeclaration node) => visitDeclaration(node)
; | 13580 R visitVariableDeclaration(VariableDeclaration node) => visitDeclaration(node)
; |
11671 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node
); | 13581 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node
); |
11672 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi
tStatement(node); | 13582 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi
tStatement(node); |
11673 R visitWhileStatement(WhileStatement node) => visitStatement(node); | 13583 R visitWhileStatement(WhileStatement node) => visitStatement(node); |
11674 R visitWithClause(WithClause node) => visitNode(node); | 13584 R visitWithClause(WithClause node) => visitNode(node); |
11675 } | 13585 } |
| 13586 |
11676 /** | 13587 /** |
11677 * Instances of the class {@code NodeLocator} locate the {@link ASTNode AST node
} associated with a | 13588 * Instances of the class {@code NodeLocator} locate the {@link ASTNode AST node
} associated with a |
11678 * source range, given the AST structure built from the source. More specificall
y, they will return | 13589 * source range, given the AST structure built from the source. More specificall
y, they will return |
11679 * the {@link ASTNode AST node} with the shortest length whose source range comp
letely encompasses | 13590 * the {@link ASTNode AST node} with the shortest length whose source range comp
letely encompasses |
11680 * the specified range. | 13591 * the specified range. |
11681 * @coverage dart.engine.ast | 13592 * @coverage dart.engine.ast |
11682 */ | 13593 */ |
11683 class NodeLocator extends GeneralizingASTVisitor<Object> { | 13594 class NodeLocator extends GeneralizingASTVisitor<Object> { |
| 13595 |
11684 /** | 13596 /** |
11685 * The start offset of the range used to identify the node. | 13597 * The start offset of the range used to identify the node. |
11686 */ | 13598 */ |
11687 int _startOffset = 0; | 13599 int _startOffset = 0; |
| 13600 |
11688 /** | 13601 /** |
11689 * The end offset of the range used to identify the node. | 13602 * The end offset of the range used to identify the node. |
11690 */ | 13603 */ |
11691 int _endOffset = 0; | 13604 int _endOffset = 0; |
| 13605 |
11692 /** | 13606 /** |
11693 * The element that was found that corresponds to the given source range, or {
@code null} if there | 13607 * The element that was found that corresponds to the given source range, or {
@code null} if there |
11694 * is no such element. | 13608 * is no such element. |
11695 */ | 13609 */ |
11696 ASTNode _foundNode; | 13610 ASTNode _foundNode; |
| 13611 |
11697 /** | 13612 /** |
11698 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating | 13613 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating |
11699 * the node within an AST structure that corresponds to the given offset in th
e source. | 13614 * the node within an AST structure that corresponds to the given offset in th
e source. |
11700 * @param offset the offset used to identify the node | 13615 * @param offset the offset used to identify the node |
11701 */ | 13616 */ |
11702 NodeLocator.con1(int offset) { | 13617 NodeLocator.con1(int offset) { |
11703 _jtd_constructor_120_impl(offset); | 13618 _jtd_constructor_120_impl(offset); |
11704 } | 13619 } |
11705 _jtd_constructor_120_impl(int offset) { | 13620 _jtd_constructor_120_impl(int offset) { |
11706 _jtd_constructor_121_impl(offset, offset); | 13621 _jtd_constructor_121_impl(offset, offset); |
11707 } | 13622 } |
| 13623 |
11708 /** | 13624 /** |
11709 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating | 13625 * Initialize a newly created locator to locate one or more {@link ASTNode AST
nodes} by locating |
11710 * the node within an AST structure that corresponds to the given range of cha
racters in the | 13626 * the node within an AST structure that corresponds to the given range of cha
racters in the |
11711 * source. | 13627 * source. |
11712 * @param start the start offset of the range used to identify the node | 13628 * @param start the start offset of the range used to identify the node |
11713 * @param end the end offset of the range used to identify the node | 13629 * @param end the end offset of the range used to identify the node |
11714 */ | 13630 */ |
11715 NodeLocator.con2(int start, int end) { | 13631 NodeLocator.con2(int start, int end) { |
11716 _jtd_constructor_121_impl(start, end); | 13632 _jtd_constructor_121_impl(start, end); |
11717 } | 13633 } |
11718 _jtd_constructor_121_impl(int start, int end) { | 13634 _jtd_constructor_121_impl(int start, int end) { |
11719 this._startOffset = start; | 13635 this._startOffset = start; |
11720 this._endOffset = end; | 13636 this._endOffset = end; |
11721 } | 13637 } |
| 13638 |
11722 /** | 13639 /** |
11723 * Return the node that was found that corresponds to the given source range,
or {@code null} if | 13640 * Return the node that was found that corresponds to the given source range,
or {@code null} if |
11724 * there is no such node. | 13641 * there is no such node. |
11725 * @return the node that was found | 13642 * @return the node that was found |
11726 */ | 13643 */ |
11727 ASTNode get foundNode => _foundNode; | 13644 ASTNode get foundNode => _foundNode; |
| 13645 |
11728 /** | 13646 /** |
11729 * Search within the given AST node for an identifier representing a {@link Da
rtElement Dart | 13647 * Search within the given AST node for an identifier representing a {@link Da
rtElement Dart |
11730 * element} in the specified source range. Return the element that was found,
or {@code null} if | 13648 * element} in the specified source range. Return the element that was found,
or {@code null} if |
11731 * no element was found. | 13649 * no element was found. |
11732 * @param node the AST node within which to search | 13650 * @param node the AST node within which to search |
11733 * @return the element that was found | 13651 * @return the element that was found |
11734 */ | 13652 */ |
11735 ASTNode searchWithin(ASTNode node) { | 13653 ASTNode searchWithin(ASTNode node) { |
11736 try { | 13654 try { |
11737 node.accept(this); | 13655 node.accept(this); |
(...skipping 20 matching lines...) Expand all Loading... |
11758 } catch (exception) { | 13676 } catch (exception) { |
11759 AnalysisEngine.instance.logger.logInformation2("Exception caught while tra
versing an AST structure.", exception); | 13677 AnalysisEngine.instance.logger.logInformation2("Exception caught while tra
versing an AST structure.", exception); |
11760 } | 13678 } |
11761 if (start <= _startOffset && _endOffset <= end) { | 13679 if (start <= _startOffset && _endOffset <= end) { |
11762 _foundNode = node; | 13680 _foundNode = node; |
11763 throw new NodeLocator_NodeFoundException(); | 13681 throw new NodeLocator_NodeFoundException(); |
11764 } | 13682 } |
11765 return null; | 13683 return null; |
11766 } | 13684 } |
11767 } | 13685 } |
| 13686 |
11768 /** | 13687 /** |
11769 * Instances of the class {@code NodeFoundException} are used to cancel visiting
after a node has | 13688 * Instances of the class {@code NodeFoundException} are used to cancel visiting
after a node has |
11770 * been found. | 13689 * been found. |
11771 */ | 13690 */ |
11772 class NodeLocator_NodeFoundException extends RuntimeException { | 13691 class NodeLocator_NodeFoundException extends RuntimeException { |
11773 static int _serialVersionUID = 1; | 13692 static int _serialVersionUID = 1; |
11774 } | 13693 } |
| 13694 |
11775 /** | 13695 /** |
11776 * Instances of the class {@code RecursiveASTVisitor} implement an AST visitor t
hat will recursively | 13696 * Instances of the class {@code RecursiveASTVisitor} implement an AST visitor t
hat will recursively |
11777 * visit all of the nodes in an AST structure. For example, using an instance of
this class to visit | 13697 * visit all of the nodes in an AST structure. For example, using an instance of
this class to visit |
11778 * a {@link Block} will also cause all of the statements in the block to be visi
ted. | 13698 * a {@link Block} will also cause all of the statements in the block to be visi
ted. |
11779 * <p> | 13699 * <p> |
11780 * Subclasses that override a visit method must either invoke the overridden vis
it method or must | 13700 * Subclasses that override a visit method must either invoke the overridden vis
it method or must |
11781 * explicitly ask the visited node to visit its children. Failure to do so will
cause the children | 13701 * explicitly ask the visited node to visit its children. Failure to do so will
cause the children |
11782 * of the visited node to not be visited. | 13702 * of the visited node to not be visited. |
11783 * @coverage dart.engine.ast | 13703 * @coverage dart.engine.ast |
11784 */ | 13704 */ |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12181 } | 14101 } |
12182 R visitWhileStatement(WhileStatement node) { | 14102 R visitWhileStatement(WhileStatement node) { |
12183 node.visitChildren(this); | 14103 node.visitChildren(this); |
12184 return null; | 14104 return null; |
12185 } | 14105 } |
12186 R visitWithClause(WithClause node) { | 14106 R visitWithClause(WithClause node) { |
12187 node.visitChildren(this); | 14107 node.visitChildren(this); |
12188 return null; | 14108 return null; |
12189 } | 14109 } |
12190 } | 14110 } |
| 14111 |
12191 /** | 14112 /** |
12192 * Instances of the class {@code SimpleASTVisitor} implement an AST visitor that
will do nothing | 14113 * Instances of the class {@code SimpleASTVisitor} implement an AST visitor that
will do nothing |
12193 * when visiting an AST node. It is intended to be a superclass for classes that
use the visitor | 14114 * when visiting an AST node. It is intended to be a superclass for classes that
use the visitor |
12194 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel
y visit a whole | 14115 * pattern primarily as a dispatch mechanism (and hence don't need to recursivel
y visit a whole |
12195 * structure) and that only need to visit a small number of node types. | 14116 * structure) and that only need to visit a small number of node types. |
12196 * @coverage dart.engine.ast | 14117 * @coverage dart.engine.ast |
12197 */ | 14118 */ |
12198 class SimpleASTVisitor<R> implements ASTVisitor<R> { | 14119 class SimpleASTVisitor<R> implements ASTVisitor<R> { |
12199 R visitAdjacentStrings(AdjacentStrings node) => null; | 14120 R visitAdjacentStrings(AdjacentStrings node) => null; |
12200 R visitAnnotation(Annotation node) => null; | 14121 R visitAnnotation(Annotation node) => null; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12291 R visitTypeArgumentList(TypeArgumentList node) => null; | 14212 R visitTypeArgumentList(TypeArgumentList node) => null; |
12292 R visitTypeName(TypeName node) => null; | 14213 R visitTypeName(TypeName node) => null; |
12293 R visitTypeParameter(TypeParameter node) => null; | 14214 R visitTypeParameter(TypeParameter node) => null; |
12294 R visitTypeParameterList(TypeParameterList node) => null; | 14215 R visitTypeParameterList(TypeParameterList node) => null; |
12295 R visitVariableDeclaration(VariableDeclaration node) => null; | 14216 R visitVariableDeclaration(VariableDeclaration node) => null; |
12296 R visitVariableDeclarationList(VariableDeclarationList node) => null; | 14217 R visitVariableDeclarationList(VariableDeclarationList node) => null; |
12297 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null
; | 14218 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => null
; |
12298 R visitWhileStatement(WhileStatement node) => null; | 14219 R visitWhileStatement(WhileStatement node) => null; |
12299 R visitWithClause(WithClause node) => null; | 14220 R visitWithClause(WithClause node) => null; |
12300 } | 14221 } |
| 14222 |
12301 /** | 14223 /** |
12302 * Instances of the class {@code ToSourceVisitor} write a source representation
of a visited AST | 14224 * Instances of the class {@code ToSourceVisitor} write a source representation
of a visited AST |
12303 * node (and all of it's children) to a writer. | 14225 * node (and all of it's children) to a writer. |
12304 * @coverage dart.engine.ast | 14226 * @coverage dart.engine.ast |
12305 */ | 14227 */ |
12306 class ToSourceVisitor implements ASTVisitor<Object> { | 14228 class ToSourceVisitor implements ASTVisitor<Object> { |
| 14229 |
12307 /** | 14230 /** |
12308 * The writer to which the source is to be written. | 14231 * The writer to which the source is to be written. |
12309 */ | 14232 */ |
12310 PrintWriter _writer; | 14233 PrintWriter _writer; |
| 14234 |
12311 /** | 14235 /** |
12312 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the | 14236 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the |
12313 * given writer. | 14237 * given writer. |
12314 * @param writer the writer to which the source is to be written | 14238 * @param writer the writer to which the source is to be written |
12315 */ | 14239 */ |
12316 ToSourceVisitor(PrintWriter writer) { | 14240 ToSourceVisitor(PrintWriter writer) { |
12317 this._writer = writer; | 14241 this._writer = writer; |
12318 } | 14242 } |
12319 Object visitAdjacentStrings(AdjacentStrings node) { | 14243 Object visitAdjacentStrings(AdjacentStrings node) { |
12320 visitList2(node.strings, " "); | 14244 visitList2(node.strings, " "); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12992 visit(node.condition); | 14916 visit(node.condition); |
12993 _writer.print(") "); | 14917 _writer.print(") "); |
12994 visit(node.body); | 14918 visit(node.body); |
12995 return null; | 14919 return null; |
12996 } | 14920 } |
12997 Object visitWithClause(WithClause node) { | 14921 Object visitWithClause(WithClause node) { |
12998 _writer.print("with "); | 14922 _writer.print("with "); |
12999 visitList2(node.mixinTypes, ", "); | 14923 visitList2(node.mixinTypes, ", "); |
13000 return null; | 14924 return null; |
13001 } | 14925 } |
| 14926 |
13002 /** | 14927 /** |
13003 * Safely visit the given node. | 14928 * Safely visit the given node. |
13004 * @param node the node to be visited | 14929 * @param node the node to be visited |
13005 */ | 14930 */ |
13006 void visit(ASTNode node) { | 14931 void visit(ASTNode node) { |
13007 if (node != null) { | 14932 if (node != null) { |
13008 node.accept(this); | 14933 node.accept(this); |
13009 } | 14934 } |
13010 } | 14935 } |
| 14936 |
13011 /** | 14937 /** |
13012 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. | 14938 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. |
13013 * @param suffix the suffix to be printed if there is a node to visit | 14939 * @param suffix the suffix to be printed if there is a node to visit |
13014 * @param node the node to be visited | 14940 * @param node the node to be visited |
13015 */ | 14941 */ |
13016 void visit2(ASTNode node, String suffix) { | 14942 void visit2(ASTNode node, String suffix) { |
13017 if (node != null) { | 14943 if (node != null) { |
13018 node.accept(this); | 14944 node.accept(this); |
13019 _writer.print(suffix); | 14945 _writer.print(suffix); |
13020 } | 14946 } |
13021 } | 14947 } |
| 14948 |
13022 /** | 14949 /** |
13023 * Safely visit the given node, printing the prefix before the node if it is n
on-{@code null}. | 14950 * Safely visit the given node, printing the prefix before the node if it is n
on-{@code null}. |
13024 * @param prefix the prefix to be printed if there is a node to visit | 14951 * @param prefix the prefix to be printed if there is a node to visit |
13025 * @param node the node to be visited | 14952 * @param node the node to be visited |
13026 */ | 14953 */ |
13027 void visit3(String prefix, ASTNode node) { | 14954 void visit3(String prefix, ASTNode node) { |
13028 if (node != null) { | 14955 if (node != null) { |
13029 _writer.print(prefix); | 14956 _writer.print(prefix); |
13030 node.accept(this); | 14957 node.accept(this); |
13031 } | 14958 } |
13032 } | 14959 } |
| 14960 |
13033 /** | 14961 /** |
13034 * Visit the given function body, printing the prefix before if given body is
not empty. | 14962 * Visit the given function body, printing the prefix before if given body is
not empty. |
13035 * @param prefix the prefix to be printed if there is a node to visit | 14963 * @param prefix the prefix to be printed if there is a node to visit |
13036 * @param body the function body to be visited | 14964 * @param body the function body to be visited |
13037 */ | 14965 */ |
13038 void visit4(String prefix, FunctionBody body) { | 14966 void visit4(String prefix, FunctionBody body) { |
13039 if (body is! EmptyFunctionBody) { | 14967 if (body is! EmptyFunctionBody) { |
13040 _writer.print(prefix); | 14968 _writer.print(prefix); |
13041 } | 14969 } |
13042 visit(body); | 14970 visit(body); |
13043 } | 14971 } |
| 14972 |
13044 /** | 14973 /** |
13045 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. | 14974 * Safely visit the given node, printing the suffix after the node if it is no
n-{@code null}. |
13046 * @param suffix the suffix to be printed if there is a node to visit | 14975 * @param suffix the suffix to be printed if there is a node to visit |
13047 * @param node the node to be visited | 14976 * @param node the node to be visited |
13048 */ | 14977 */ |
13049 void visit5(Token token, String suffix) { | 14978 void visit5(Token token, String suffix) { |
13050 if (token != null) { | 14979 if (token != null) { |
13051 _writer.print(token.lexeme); | 14980 _writer.print(token.lexeme); |
13052 _writer.print(suffix); | 14981 _writer.print(suffix); |
13053 } | 14982 } |
13054 } | 14983 } |
| 14984 |
13055 /** | 14985 /** |
13056 * Print a list of nodes without any separation. | 14986 * Print a list of nodes without any separation. |
13057 * @param nodes the nodes to be printed | 14987 * @param nodes the nodes to be printed |
13058 * @param separator the separator to be printed between adjacent nodes | 14988 * @param separator the separator to be printed between adjacent nodes |
13059 */ | 14989 */ |
13060 void visitList(NodeList<ASTNode> nodes) { | 14990 void visitList(NodeList<ASTNode> nodes) { |
13061 visitList2(nodes, ""); | 14991 visitList2(nodes, ""); |
13062 } | 14992 } |
| 14993 |
13063 /** | 14994 /** |
13064 * Print a list of nodes, separated by the given separator. | 14995 * Print a list of nodes, separated by the given separator. |
13065 * @param nodes the nodes to be printed | 14996 * @param nodes the nodes to be printed |
13066 * @param separator the separator to be printed between adjacent nodes | 14997 * @param separator the separator to be printed between adjacent nodes |
13067 */ | 14998 */ |
13068 void visitList2(NodeList<ASTNode> nodes, String separator) { | 14999 void visitList2(NodeList<ASTNode> nodes, String separator) { |
13069 if (nodes != null) { | 15000 if (nodes != null) { |
13070 int size2 = nodes.length; | 15001 int size2 = nodes.length; |
13071 for (int i = 0; i < size2; i++) { | 15002 for (int i = 0; i < size2; i++) { |
13072 if (i > 0) { | 15003 if (i > 0) { |
13073 _writer.print(separator); | 15004 _writer.print(separator); |
13074 } | 15005 } |
13075 nodes[i].accept(this); | 15006 nodes[i].accept(this); |
13076 } | 15007 } |
13077 } | 15008 } |
13078 } | 15009 } |
| 15010 |
13079 /** | 15011 /** |
13080 * Print a list of nodes, separated by the given separator. | 15012 * Print a list of nodes, separated by the given separator. |
13081 * @param nodes the nodes to be printed | 15013 * @param nodes the nodes to be printed |
13082 * @param separator the separator to be printed between adjacent nodes | 15014 * @param separator the separator to be printed between adjacent nodes |
13083 * @param suffix the suffix to be printed if the list is not empty | 15015 * @param suffix the suffix to be printed if the list is not empty |
13084 */ | 15016 */ |
13085 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { | 15017 void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) { |
13086 if (nodes != null) { | 15018 if (nodes != null) { |
13087 int size2 = nodes.length; | 15019 int size2 = nodes.length; |
13088 if (size2 > 0) { | 15020 if (size2 > 0) { |
13089 for (int i = 0; i < size2; i++) { | 15021 for (int i = 0; i < size2; i++) { |
13090 if (i > 0) { | 15022 if (i > 0) { |
13091 _writer.print(separator); | 15023 _writer.print(separator); |
13092 } | 15024 } |
13093 nodes[i].accept(this); | 15025 nodes[i].accept(this); |
13094 } | 15026 } |
13095 _writer.print(suffix); | 15027 _writer.print(suffix); |
13096 } | 15028 } |
13097 } | 15029 } |
13098 } | 15030 } |
| 15031 |
13099 /** | 15032 /** |
13100 * Print a list of nodes, separated by the given separator. | 15033 * Print a list of nodes, separated by the given separator. |
13101 * @param prefix the prefix to be printed if the list is not empty | 15034 * @param prefix the prefix to be printed if the list is not empty |
13102 * @param nodes the nodes to be printed | 15035 * @param nodes the nodes to be printed |
13103 * @param separator the separator to be printed between adjacent nodes | 15036 * @param separator the separator to be printed between adjacent nodes |
13104 */ | 15037 */ |
13105 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { | 15038 void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) { |
13106 if (nodes != null) { | 15039 if (nodes != null) { |
13107 int size2 = nodes.length; | 15040 int size2 = nodes.length; |
13108 if (size2 > 0) { | 15041 if (size2 > 0) { |
13109 _writer.print(prefix); | 15042 _writer.print(prefix); |
13110 for (int i = 0; i < size2; i++) { | 15043 for (int i = 0; i < size2; i++) { |
13111 if (i > 0) { | 15044 if (i > 0) { |
13112 _writer.print(separator); | 15045 _writer.print(separator); |
13113 } | 15046 } |
13114 nodes[i].accept(this); | 15047 nodes[i].accept(this); |
13115 } | 15048 } |
13116 } | 15049 } |
13117 } | 15050 } |
13118 } | 15051 } |
13119 } | 15052 } |
| 15053 |
13120 /** | 15054 /** |
13121 * Instances of the class {@code ASTCloner} implement an object that will clone
any AST structure | 15055 * Instances of the class {@code ASTCloner} implement an object that will clone
any AST structure |
13122 * that it visits. The cloner will only clone the structure, it will not preserv
e any resolution | 15056 * that it visits. The cloner will only clone the structure, it will not preserv
e any resolution |
13123 * results or properties associated with the nodes. | 15057 * results or properties associated with the nodes. |
13124 */ | 15058 */ |
13125 class ASTCloner implements ASTVisitor<ASTNode> { | 15059 class ASTCloner implements ASTVisitor<ASTNode> { |
13126 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri
ngs.full(clone3(node.strings)); | 15060 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri
ngs.full(clone3(node.strings)); |
13127 Annotation visitAnnotation(Annotation node) => new Annotation.full(node.atSign
, clone2(node.name), node.period, clone2(node.constructorName), clone2(node.argu
ments)); | 15061 Annotation visitAnnotation(Annotation node) => new Annotation.full(node.atSign
, clone2(node.name), node.period, clone2(node.constructorName), clone2(node.argu
ments)); |
13128 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node
) => new ArgumentDefinitionTest.full(node.question, clone2(node.identifier)); | 15062 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node
) => new ArgumentDefinitionTest.full(node.question, clone2(node.identifier)); |
13129 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList.full(nod
e.leftParenthesis, clone3(node.arguments), node.rightParenthesis); | 15063 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList.full(nod
e.leftParenthesis, clone3(node.arguments), node.rightParenthesis); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13251 return node.accept(this) as ASTNode; | 15185 return node.accept(this) as ASTNode; |
13252 } | 15186 } |
13253 List clone3(NodeList nodes) { | 15187 List clone3(NodeList nodes) { |
13254 List clonedNodes = new List(); | 15188 List clonedNodes = new List(); |
13255 for (ASTNode node in nodes) { | 15189 for (ASTNode node in nodes) { |
13256 clonedNodes.add((node.accept(this) as ASTNode)); | 15190 clonedNodes.add((node.accept(this) as ASTNode)); |
13257 } | 15191 } |
13258 return clonedNodes; | 15192 return clonedNodes; |
13259 } | 15193 } |
13260 } | 15194 } |
| 15195 |
| 15196 /** |
| 15197 * Traverse the AST from initial child node to successive parents, building a co
llection of local |
| 15198 * variable and parameter names visible to the initial child node. In case of na
me shadowing, the |
| 15199 * first name seen is the most specific one so names are not redefined. |
| 15200 * <p> |
| 15201 * Completion test code coverage is 95%. The two basic blocks that are not execu
ted cannot be |
| 15202 * executed. They are included for future reference. |
| 15203 * @coverage com.google.dart.engine.services.completion |
| 15204 */ |
| 15205 class ScopedNameFinder extends GeneralizingASTVisitor<Object> { |
| 15206 Declaration _declarationNode; |
| 15207 ASTNode _immediateChild; |
| 15208 Map<String, SimpleIdentifier> _locals = new Map<String, SimpleIdentifier>(); |
| 15209 int _position = 0; |
| 15210 bool _referenceIsWithinLocalFunction = false; |
| 15211 ScopedNameFinder(int position) { |
| 15212 this._position = position; |
| 15213 } |
| 15214 Declaration get declaration => _declarationNode; |
| 15215 Map<String, SimpleIdentifier> get locals => _locals; |
| 15216 Object visitBlock(Block node) { |
| 15217 checkStatements(node.statements); |
| 15218 return super.visitBlock(node); |
| 15219 } |
| 15220 Object visitCatchClause(CatchClause node) { |
| 15221 addToScope(node.exceptionParameter); |
| 15222 addToScope(node.stackTraceParameter); |
| 15223 return super.visitCatchClause(node); |
| 15224 } |
| 15225 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 15226 if (_immediateChild != node.parameters) { |
| 15227 addParameters(node.parameters.parameters); |
| 15228 } |
| 15229 _declarationNode = node; |
| 15230 return null; |
| 15231 } |
| 15232 Object visitFieldDeclaration(FieldDeclaration node) { |
| 15233 _declarationNode = node; |
| 15234 return null; |
| 15235 } |
| 15236 Object visitForEachStatement(ForEachStatement node) { |
| 15237 addToScope(node.loopVariable.identifier); |
| 15238 return super.visitForEachStatement(node); |
| 15239 } |
| 15240 Object visitForStatement(ForStatement node) { |
| 15241 if (_immediateChild != node.variables && node.variables != null) { |
| 15242 addVariables(node.variables.variables); |
| 15243 } |
| 15244 return super.visitForStatement(node); |
| 15245 } |
| 15246 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| 15247 if (node.parent is! FunctionDeclarationStatement) { |
| 15248 _declarationNode = node; |
| 15249 return null; |
| 15250 } |
| 15251 return super.visitFunctionDeclaration(node); |
| 15252 } |
| 15253 Object visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { |
| 15254 _referenceIsWithinLocalFunction = true; |
| 15255 return super.visitFunctionDeclarationStatement(node); |
| 15256 } |
| 15257 Object visitFunctionExpression(FunctionExpression node) { |
| 15258 if (_immediateChild != node.parameters) { |
| 15259 addParameters(node.parameters.parameters); |
| 15260 } |
| 15261 return super.visitFunctionExpression(node); |
| 15262 } |
| 15263 Object visitMethodDeclaration(MethodDeclaration node) { |
| 15264 if (node.parameters == null) { |
| 15265 return null; |
| 15266 } |
| 15267 if (_immediateChild != node.parameters) { |
| 15268 addParameters(node.parameters.parameters); |
| 15269 } |
| 15270 _declarationNode = node; |
| 15271 return null; |
| 15272 } |
| 15273 Object visitNode(ASTNode node) { |
| 15274 _immediateChild = node; |
| 15275 ASTNode parent2 = node.parent; |
| 15276 if (parent2 != null) { |
| 15277 parent2.accept(this); |
| 15278 } |
| 15279 return null; |
| 15280 } |
| 15281 Object visitSwitchMember(SwitchMember node) { |
| 15282 checkStatements(node.statements); |
| 15283 return super.visitSwitchMember(node); |
| 15284 } |
| 15285 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { |
| 15286 _declarationNode = node; |
| 15287 return null; |
| 15288 } |
| 15289 Object visitTypeAlias(TypeAlias node) { |
| 15290 _declarationNode = node; |
| 15291 return null; |
| 15292 } |
| 15293 void addParameters(NodeList<FormalParameter> vars) { |
| 15294 for (FormalParameter var2 in vars) { |
| 15295 addToScope(var2.identifier); |
| 15296 } |
| 15297 } |
| 15298 void addToScope(SimpleIdentifier identifier) { |
| 15299 if (identifier != null && isInRange(identifier)) { |
| 15300 String name2 = identifier.name; |
| 15301 if (!_locals.containsKey(name2)) { |
| 15302 _locals[name2] = identifier; |
| 15303 } |
| 15304 } |
| 15305 } |
| 15306 void addVariables(NodeList<VariableDeclaration> vars) { |
| 15307 for (VariableDeclaration var2 in vars) { |
| 15308 addToScope(var2.name); |
| 15309 } |
| 15310 } |
| 15311 |
| 15312 /** |
| 15313 * Some statements define names that are visible downstream. There aren't many
of these. |
| 15314 * @param statements the list of statements to check for name definitions |
| 15315 */ |
| 15316 void checkStatements(List<Statement> statements) { |
| 15317 for (Statement stmt in statements) { |
| 15318 if (identical(stmt, _immediateChild)) { |
| 15319 return; |
| 15320 } |
| 15321 if (stmt is VariableDeclarationStatement) { |
| 15322 addVariables(((stmt as VariableDeclarationStatement)).variables.variable
s); |
| 15323 } else if (stmt is FunctionDeclarationStatement && !_referenceIsWithinLoca
lFunction) { |
| 15324 addToScope(((stmt as FunctionDeclarationStatement)).functionDeclaration.
name); |
| 15325 } |
| 15326 } |
| 15327 } |
| 15328 bool isInRange(ASTNode node) { |
| 15329 if (_position < 0) { |
| 15330 return true; |
| 15331 } |
| 15332 return node.end < _position; |
| 15333 } |
| 15334 } |
13261 /** | 15335 /** |
13262 * Instances of the class {@code NodeList} represent a list of AST nodes that ha
ve a common parent. | 15336 * Instances of the class {@code NodeList} represent a list of AST nodes that ha
ve a common parent. |
13263 */ | 15337 */ |
13264 class NodeList<E extends ASTNode> extends ListWrapper<E> { | 15338 class NodeList<E extends ASTNode> extends ListWrapper<E> { |
13265 /** | 15339 /** |
13266 * The node that is the parent of each of the elements in the list. | 15340 * The node that is the parent of each of the elements in the list. |
13267 */ | 15341 */ |
13268 ASTNode owner; | 15342 ASTNode owner; |
13269 /** | 15343 /** |
13270 * The elements of the list. | 15344 * The elements of the list. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13318 return elements[elements.length - 1].endToken; | 15392 return elements[elements.length - 1].endToken; |
13319 } | 15393 } |
13320 /** | 15394 /** |
13321 * Return the node that is the parent of each of the elements in the list. | 15395 * Return the node that is the parent of each of the elements in the list. |
13322 * @return the node that is the parent of each of the elements in the list | 15396 * @return the node that is the parent of each of the elements in the list |
13323 */ | 15397 */ |
13324 ASTNode getOwner() { | 15398 ASTNode getOwner() { |
13325 return owner; | 15399 return owner; |
13326 } | 15400 } |
13327 } | 15401 } |
OLD | NEW |