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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 Send asSend() => this; | 249 Send asSend() => this; |
250 | 250 |
251 accept(Visitor visitor) => visitor.visitSend(this); | 251 accept(Visitor visitor) => visitor.visitSend(this); |
252 | 252 |
253 visitChildren(Visitor visitor) { | 253 visitChildren(Visitor visitor) { |
254 if (receiver !== null) receiver.accept(visitor); | 254 if (receiver !== null) receiver.accept(visitor); |
255 if (selector !== null) selector.accept(visitor); | 255 if (selector !== null) selector.accept(visitor); |
256 if (argumentsNode !== null) argumentsNode.accept(visitor); | 256 if (argumentsNode !== null) argumentsNode.accept(visitor); |
257 } | 257 } |
258 | 258 |
259 int argumentCount() => argumentsNode.length(); | 259 int argumentCount() { |
260 if (argumentsNode === null) return -1; | |
kasperl
2012/06/12 05:50:12
return (argumentsNode === null) ? -1 : argumentsNo
ahe
2012/06/12 10:56:11
Done.
| |
261 return argumentsNode.length(); | |
262 } | |
260 | 263 |
261 bool get isSuperCall() { | 264 bool get isSuperCall() { |
262 return receiver !== null && | 265 return receiver !== null && |
263 receiver.asIdentifier() !== null && | 266 receiver.asIdentifier() !== null && |
264 receiver.asIdentifier().isSuper(); | 267 receiver.asIdentifier().isSuper(); |
265 } | 268 } |
266 bool get isOperator() => selector is Operator; | 269 bool get isOperator() => selector is Operator; |
267 bool get isPropertyAccess() => argumentsNode === null; | 270 bool get isPropertyAccess() => argumentsNode === null; |
268 bool get isFunctionObjectInvocation() => selector === null; | 271 bool get isFunctionObjectInvocation() => selector === null; |
269 bool get isPrefix() => argumentsNode is Prefix; | 272 bool get isPrefix() => argumentsNode is Prefix; |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1701 * argument). | 1704 * argument). |
1702 * | 1705 * |
1703 * TODO(ahe): This method is controversial, the team needs to discuss | 1706 * TODO(ahe): This method is controversial, the team needs to discuss |
1704 * if top-level methods are acceptable and what naming conventions to | 1707 * if top-level methods are acceptable and what naming conventions to |
1705 * use. | 1708 * use. |
1706 */ | 1709 */ |
1707 initializerDo(Node node, f(Node node)) { | 1710 initializerDo(Node node, f(Node node)) { |
1708 SendSet send = node.asSendSet(); | 1711 SendSet send = node.asSendSet(); |
1709 if (send !== null) return f(send.arguments.head); | 1712 if (send !== null) return f(send.arguments.head); |
1710 } | 1713 } |
OLD | NEW |