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 interface Visitor<R> { | 5 interface Visitor<R> { |
6 R visitBlock(Block node); | 6 R visitBlock(Block node); |
7 R visitBreakStatement(BreakStatement node); | 7 R visitBreakStatement(BreakStatement node); |
8 R visitCascade(Cascade node); | 8 R visitCascade(Cascade node); |
9 R visitCascadeReceiver(CascadeReceiver node); | 9 R visitCascadeReceiver(CascadeReceiver node); |
10 R visitCaseMatch(CaseMatch node); | 10 R visitCaseMatch(CaseMatch node); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 Send asSend() => this; | 257 Send asSend() => this; |
258 | 258 |
259 accept(Visitor visitor) => visitor.visitSend(this); | 259 accept(Visitor visitor) => visitor.visitSend(this); |
260 | 260 |
261 visitChildren(Visitor visitor) { | 261 visitChildren(Visitor visitor) { |
262 if (receiver !== null) receiver.accept(visitor); | 262 if (receiver !== null) receiver.accept(visitor); |
263 if (selector !== null) selector.accept(visitor); | 263 if (selector !== null) selector.accept(visitor); |
264 if (argumentsNode !== null) argumentsNode.accept(visitor); | 264 if (argumentsNode !== null) argumentsNode.accept(visitor); |
265 } | 265 } |
266 | 266 |
267 int argumentCount() => argumentsNode.length(); | 267 int argumentCount() => (argumentsNode === null) ? -1 : argumentsNode.length(); |
268 | 268 |
269 bool get isSuperCall() { | 269 bool get isSuperCall() { |
270 return receiver !== null && | 270 return receiver !== null && |
271 receiver.asIdentifier() !== null && | 271 receiver.asIdentifier() !== null && |
272 receiver.asIdentifier().isSuper(); | 272 receiver.asIdentifier().isSuper(); |
273 } | 273 } |
274 bool get isOperator() => selector is Operator; | 274 bool get isOperator() => selector is Operator; |
275 bool get isPropertyAccess() => argumentsNode === null; | 275 bool get isPropertyAccess() => argumentsNode === null; |
276 bool get isFunctionObjectInvocation() => selector === null; | 276 bool get isFunctionObjectInvocation() => selector === null; |
277 bool get isPrefix() => argumentsNode is Prefix; | 277 bool get isPrefix() => argumentsNode is Prefix; |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 * argument). | 1709 * argument). |
1710 * | 1710 * |
1711 * TODO(ahe): This method is controversial, the team needs to discuss | 1711 * TODO(ahe): This method is controversial, the team needs to discuss |
1712 * if top-level methods are acceptable and what naming conventions to | 1712 * if top-level methods are acceptable and what naming conventions to |
1713 * use. | 1713 * use. |
1714 */ | 1714 */ |
1715 initializerDo(Node node, f(Node node)) { | 1715 initializerDo(Node node, f(Node node)) { |
1716 SendSet send = node.asSendSet(); | 1716 SendSet send = node.asSendSet(); |
1717 if (send !== null) return f(send.arguments.head); | 1717 if (send !== null) return f(send.arguments.head); |
1718 } | 1718 } |
OLD | NEW |