| 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 NodeVisitor<T> { | 5 interface NodeVisitor<T> { |
| 6 T visitProgram(Program node); | 6 T visitProgram(Program node); |
| 7 | 7 |
| 8 T visitBlock(Block node); | 8 T visitBlock(Block node); |
| 9 T visitExpressionStatement(ExpressionStatement node); | 9 T visitExpressionStatement(ExpressionStatement node); |
| 10 T visitEmptyStatement(EmptyStatement node); | 10 T visitEmptyStatement(EmptyStatement node); |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 class New extends Call { | 550 class New extends Call { |
| 551 New(Expression cls, List<Expression> arguments) : super(cls, arguments); | 551 New(Expression cls, List<Expression> arguments) : super(cls, arguments); |
| 552 | 552 |
| 553 accept(NodeVisitor visitor) => visitor.visitNew(this); | 553 accept(NodeVisitor visitor) => visitor.visitNew(this); |
| 554 } | 554 } |
| 555 | 555 |
| 556 class Binary extends Call { | 556 class Binary extends Call { |
| 557 Binary(String op, Expression left, Expression right) | 557 Binary(String op, Expression left, Expression right) |
| 558 : super(new VariableUse(op), <Expression>[left, right]); | 558 : super(new VariableUse(op), <Expression>[left, right]); |
| 559 | 559 |
| 560 String get op() => (target as VariableUse).name; | 560 String get op() { |
| 561 VariableUse use = target; |
| 562 return use.name; |
| 563 } |
| 564 |
| 561 Expression get left() => arguments[0]; | 565 Expression get left() => arguments[0]; |
| 562 Expression get right() => arguments[1]; | 566 Expression get right() => arguments[1]; |
| 563 | 567 |
| 564 accept(NodeVisitor visitor) => visitor.visitBinary(this); | 568 accept(NodeVisitor visitor) => visitor.visitBinary(this); |
| 565 | 569 |
| 566 int get precedenceLevel() { | 570 int get precedenceLevel() { |
| 567 // TODO(floitsch): switch to constant map. | 571 // TODO(floitsch): switch to constant map. |
| 568 switch (op) { | 572 switch (op) { |
| 569 case "*": | 573 case "*": |
| 570 case "/": | 574 case "/": |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 /** Contains the pattern and the flags.*/ | 828 /** Contains the pattern and the flags.*/ |
| 825 String pattern; | 829 String pattern; |
| 826 | 830 |
| 827 RegExpLiteral(this.pattern); | 831 RegExpLiteral(this.pattern); |
| 828 | 832 |
| 829 accept(NodeVisitor visitor) => visitor.visitRegExpLiteral(this); | 833 accept(NodeVisitor visitor) => visitor.visitRegExpLiteral(this); |
| 830 void visitChildren(NodeVisitor visitor) {} | 834 void visitChildren(NodeVisitor visitor) {} |
| 831 | 835 |
| 832 int get precedenceLevel() => PRIMARY; | 836 int get precedenceLevel() => PRIMARY; |
| 833 } | 837 } |
| OLD | NEW |