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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 bool get isFunctionObjectInvocation => selector === null; | 275 bool get isFunctionObjectInvocation => selector === null; |
276 bool get isPrefix => argumentsNode is Prefix; | 276 bool get isPrefix => argumentsNode is Prefix; |
277 bool get isPostfix => argumentsNode is Postfix; | 277 bool get isPostfix => argumentsNode is Postfix; |
278 bool get isCall => !isOperator && !isPropertyAccess; | 278 bool get isCall => !isOperator && !isPropertyAccess; |
279 bool get isIndex => | 279 bool get isIndex => |
280 isOperator && selector.asOperator().source.stringValue === '[]'; | 280 isOperator && selector.asOperator().source.stringValue === '[]'; |
281 bool get isLogicalAnd => | 281 bool get isLogicalAnd => |
282 isOperator && selector.asOperator().source.stringValue === '&&'; | 282 isOperator && selector.asOperator().source.stringValue === '&&'; |
283 bool get isLogicalOr => | 283 bool get isLogicalOr => |
284 isOperator && selector.asOperator().source.stringValue === '||'; | 284 isOperator && selector.asOperator().source.stringValue === '||'; |
| 285 bool get isParameterCheck => |
| 286 isOperator && selector.asOperator().source.stringValue === '?'; |
285 | 287 |
286 Token getBeginToken() { | 288 Token getBeginToken() { |
287 if (isPrefix && !isIndex) return selector.getBeginToken(); | 289 if (isPrefix && !isIndex) return selector.getBeginToken(); |
288 return firstBeginToken(receiver, selector); | 290 return firstBeginToken(receiver, selector); |
289 } | 291 } |
290 | 292 |
291 Token getEndToken() { | 293 Token getEndToken() { |
292 if (isPrefix) { | 294 if (isPrefix) { |
293 if (receiver !== null) return receiver.getEndToken(); | 295 if (receiver !== null) return receiver.getEndToken(); |
294 if (selector !== null) return selector.getEndToken(); | 296 if (selector !== null) return selector.getEndToken(); |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 * argument). | 1769 * argument). |
1768 * | 1770 * |
1769 * TODO(ahe): This method is controversial, the team needs to discuss | 1771 * TODO(ahe): This method is controversial, the team needs to discuss |
1770 * if top-level methods are acceptable and what naming conventions to | 1772 * if top-level methods are acceptable and what naming conventions to |
1771 * use. | 1773 * use. |
1772 */ | 1774 */ |
1773 initializerDo(Node node, f(Node node)) { | 1775 initializerDo(Node node, f(Node node)) { |
1774 SendSet send = node.asSendSet(); | 1776 SendSet send = node.asSendSet(); |
1775 if (send !== null) return f(send.arguments.head); | 1777 if (send !== null) return f(send.arguments.head); |
1776 } | 1778 } |
OLD | NEW |