Chromium Code Reviews| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 receiver.asIdentifier() !== null && | 263 receiver.asIdentifier() !== null && |
| 264 receiver.asIdentifier().isSuper(); | 264 receiver.asIdentifier().isSuper(); |
| 265 } | 265 } |
| 266 bool get isOperator() => selector is Operator; | 266 bool get isOperator() => selector is Operator; |
| 267 bool get isPropertyAccess() => argumentsNode === null; | 267 bool get isPropertyAccess() => argumentsNode === null; |
| 268 bool get isFunctionObjectInvocation() => selector === null; | 268 bool get isFunctionObjectInvocation() => selector === null; |
| 269 bool get isPrefix() => argumentsNode is Prefix; | 269 bool get isPrefix() => argumentsNode is Prefix; |
| 270 bool get isPostfix() => argumentsNode is Postfix; | 270 bool get isPostfix() => argumentsNode is Postfix; |
| 271 bool get isIndex() => | 271 bool get isIndex() => |
| 272 isOperator && selector.asOperator().source.stringValue === '[]'; | 272 isOperator && selector.asOperator().source.stringValue === '[]'; |
| 273 bool get isCall() { | |
| 274 Token end = getEndToken(); | |
|
ahe
2012/06/08 06:56:16
I don't like calling getEndToken to determine this
ngeoffray
2012/06/08 09:40:58
As discussed, changed the code to !isPropertyAcces
| |
| 275 return end !== null && end.stringValue === ')'; | |
| 276 } | |
| 273 | 277 |
| 274 Token getBeginToken() { | 278 Token getBeginToken() { |
| 275 if (isPrefix && !isIndex) return selector.getBeginToken(); | 279 if (isPrefix && !isIndex) return selector.getBeginToken(); |
| 276 return firstBeginToken(receiver, selector); | 280 return firstBeginToken(receiver, selector); |
| 277 } | 281 } |
| 278 | 282 |
| 279 Token getEndToken() { | 283 Token getEndToken() { |
| 280 if (isPrefix) { | 284 if (isPrefix) { |
| 281 if (receiver !== null) return receiver.getEndToken(); | 285 if (receiver !== null) return receiver.getEndToken(); |
| 282 if (selector !== null) return selector.getEndToken(); | 286 if (selector !== null) return selector.getEndToken(); |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1700 * argument). | 1704 * argument). |
| 1701 * | 1705 * |
| 1702 * TODO(ahe): This method is controversial, the team needs to discuss | 1706 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1703 * if top-level methods are acceptable and what naming conventions to | 1707 * if top-level methods are acceptable and what naming conventions to |
| 1704 * use. | 1708 * use. |
| 1705 */ | 1709 */ |
| 1706 initializerDo(Node node, f(Node node)) { | 1710 initializerDo(Node node, f(Node node)) { |
| 1707 SendSet send = node.asSendSet(); | 1711 SendSet send = node.asSendSet(); |
| 1708 if (send !== null) return f(send.arguments.head); | 1712 if (send !== null) return f(send.arguments.head); |
| 1709 } | 1713 } |
| OLD | NEW |