| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 visitCatchBlock(CatchBlock node); | 8 R visitCatchBlock(CatchBlock node); |
| 9 R visitClassNode(ClassNode node); | 9 R visitClassNode(ClassNode node); |
| 10 R visitConditional(Conditional node); | 10 R visitConditional(Conditional node); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 accept(Visitor visitor) => visitor.visitSend(this); | 213 accept(Visitor visitor) => visitor.visitSend(this); |
| 214 | 214 |
| 215 visitChildren(Visitor visitor) { | 215 visitChildren(Visitor visitor) { |
| 216 if (receiver !== null) receiver.accept(visitor); | 216 if (receiver !== null) receiver.accept(visitor); |
| 217 if (selector !== null) selector.accept(visitor); | 217 if (selector !== null) selector.accept(visitor); |
| 218 if (argumentsNode !== null) argumentsNode.accept(visitor); | 218 if (argumentsNode !== null) argumentsNode.accept(visitor); |
| 219 } | 219 } |
| 220 | 220 |
| 221 int argumentCount() => argumentsNode.length(); | 221 int argumentCount() => argumentsNode.length(); |
| 222 | 222 |
| 223 bool get isSuperCall() { |
| 224 return receiver !== null && |
| 225 receiver.asIdentifier() !== null && |
| 226 receiver.asIdentifier().isSuper(); |
| 227 } |
| 223 bool get isOperator() => selector is Operator; | 228 bool get isOperator() => selector is Operator; |
| 224 bool get isPropertyAccess() => argumentsNode === null; | 229 bool get isPropertyAccess() => argumentsNode === null; |
| 225 bool get isFunctionObjectInvocation() => selector === null; | 230 bool get isFunctionObjectInvocation() => selector === null; |
| 226 bool get isPrefix() => argumentsNode is Prefix; | 231 bool get isPrefix() => argumentsNode is Prefix; |
| 227 bool get isPostfix() => argumentsNode is Postfix; | 232 bool get isPostfix() => argumentsNode is Postfix; |
| 228 bool get isIndex() => | 233 bool get isIndex() => |
| 229 isOperator && selector.asOperator().source.stringValue === '[]'; | 234 isOperator && selector.asOperator().source.stringValue === '[]'; |
| 230 | 235 |
| 231 Token getBeginToken() { | 236 Token getBeginToken() { |
| 232 return firstBeginToken(receiver, selector); | 237 return firstBeginToken(receiver, selector); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 class Identifier extends Expression { | 654 class Identifier extends Expression { |
| 650 final Token token; | 655 final Token token; |
| 651 | 656 |
| 652 SourceString get source() => token.value; | 657 SourceString get source() => token.value; |
| 653 | 658 |
| 654 Identifier(Token this.token); | 659 Identifier(Token this.token); |
| 655 Identifier.synthetic(String name) : token = new StringToken(null, name, null); | 660 Identifier.synthetic(String name) : token = new StringToken(null, name, null); |
| 656 | 661 |
| 657 bool isThis() => source.stringValue == 'this'; | 662 bool isThis() => source.stringValue == 'this'; |
| 658 | 663 |
| 664 bool isSuper() => source.stringValue == 'super'; |
| 665 |
| 659 Identifier asIdentifier() => this; | 666 Identifier asIdentifier() => this; |
| 660 | 667 |
| 661 accept(Visitor visitor) => visitor.visitIdentifier(this); | 668 accept(Visitor visitor) => visitor.visitIdentifier(this); |
| 662 | 669 |
| 663 visitChildren(Visitor visitor) {} | 670 visitChildren(Visitor visitor) {} |
| 664 | 671 |
| 665 Token getBeginToken() => token; | 672 Token getBeginToken() => token; |
| 666 | 673 |
| 667 Token getEndToken() => token; | 674 Token getEndToken() => token; |
| 668 } | 675 } |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 | 1242 |
| 1236 visitChildren(Visitor visitor) { | 1243 visitChildren(Visitor visitor) { |
| 1237 formals.accept(visitor); | 1244 formals.accept(visitor); |
| 1238 block.accept(visitor); | 1245 block.accept(visitor); |
| 1239 } | 1246 } |
| 1240 | 1247 |
| 1241 Token getBeginToken() => catchKeyword; | 1248 Token getBeginToken() => catchKeyword; |
| 1242 | 1249 |
| 1243 Token getEndToken() => block.getEndToken(); | 1250 Token getEndToken() => block.getEndToken(); |
| 1244 } | 1251 } |
| OLD | NEW |