OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of tree; | 5 part of tree; |
6 | 6 |
7 abstract class Visitor<R> { | 7 abstract class Visitor<R> { |
8 const Visitor(); | 8 const Visitor(); |
9 | 9 |
10 R visitNode(Node node); | 10 R visitNode(Node node); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 LiteralInt asLiteralInt() => null; | 167 LiteralInt asLiteralInt() => null; |
168 LiteralList asLiteralList() => null; | 168 LiteralList asLiteralList() => null; |
169 LiteralMap asLiteralMap() => null; | 169 LiteralMap asLiteralMap() => null; |
170 LiteralMapEntry asLiteralMapEntry() => null; | 170 LiteralMapEntry asLiteralMapEntry() => null; |
171 LiteralNull asLiteralNull() => null; | 171 LiteralNull asLiteralNull() => null; |
172 LiteralString asLiteralString() => null; | 172 LiteralString asLiteralString() => null; |
173 MixinApplication asMixinApplication() => null; | 173 MixinApplication asMixinApplication() => null; |
174 Modifiers asModifiers() => null; | 174 Modifiers asModifiers() => null; |
175 NamedArgument asNamedArgument() => null; | 175 NamedArgument asNamedArgument() => null; |
176 NamedMixinApplication asNamedMixinApplication() => null; | 176 NamedMixinApplication asNamedMixinApplication() => null; |
| 177 NewExpression asNewExpression() => null; |
177 NodeList asNodeList() => null; | 178 NodeList asNodeList() => null; |
178 Operator asOperator() => null; | 179 Operator asOperator() => null; |
179 ParenthesizedExpression asParenthesizedExpression() => null; | 180 ParenthesizedExpression asParenthesizedExpression() => null; |
180 Part asPart() => null; | 181 Part asPart() => null; |
181 PartOf asPartOf() => null; | 182 PartOf asPartOf() => null; |
182 Rethrow asRethrow() => null; | 183 Rethrow asRethrow() => null; |
183 Return asReturn() => null; | 184 Return asReturn() => null; |
184 Send asSend() => null; | 185 Send asSend() => null; |
185 SendSet asSendSet() => null; | 186 SendSet asSendSet() => null; |
186 Statement asStatement() => null; | 187 Statement asStatement() => null; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 467 |
467 class NewExpression extends Expression { | 468 class NewExpression extends Expression { |
468 /** The token NEW or CONST */ | 469 /** The token NEW or CONST */ |
469 final Token newToken; | 470 final Token newToken; |
470 | 471 |
471 // Note: we expect that send.receiver is null. | 472 // Note: we expect that send.receiver is null. |
472 final Send send; | 473 final Send send; |
473 | 474 |
474 NewExpression([this.newToken, this.send]); | 475 NewExpression([this.newToken, this.send]); |
475 | 476 |
| 477 NewExpression asNewExpression() => this; |
| 478 |
476 accept(Visitor visitor) => visitor.visitNewExpression(this); | 479 accept(Visitor visitor) => visitor.visitNewExpression(this); |
477 | 480 |
478 visitChildren(Visitor visitor) { | 481 visitChildren(Visitor visitor) { |
479 if (send != null) send.accept(visitor); | 482 if (send != null) send.accept(visitor); |
480 } | 483 } |
481 | 484 |
482 bool isConst() { | 485 bool isConst() { |
483 return identical(newToken.stringValue, 'const') | 486 return identical(newToken.stringValue, 'const') |
484 || identical(newToken.stringValue, '@'); | 487 || identical(newToken.stringValue, '@'); |
485 } | 488 } |
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 * argument). | 2077 * argument). |
2075 * | 2078 * |
2076 * TODO(ahe): This method is controversial, the team needs to discuss | 2079 * TODO(ahe): This method is controversial, the team needs to discuss |
2077 * if top-level methods are acceptable and what naming conventions to | 2080 * if top-level methods are acceptable and what naming conventions to |
2078 * use. | 2081 * use. |
2079 */ | 2082 */ |
2080 initializerDo(Node node, f(Node node)) { | 2083 initializerDo(Node node, f(Node node)) { |
2081 SendSet send = node.asSendSet(); | 2084 SendSet send = node.asSendSet(); |
2082 if (send != null) return f(send.arguments.head); | 2085 if (send != null) return f(send.arguments.head); |
2083 } | 2086 } |
OLD | NEW |