| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 | 657 |
| 658 class LiteralInt extends Literal<int> { | 658 class LiteralInt extends Literal<int> { |
| 659 LiteralInt(Token token, DecodeErrorHandler handler) : super(token, handler); | 659 LiteralInt(Token token, DecodeErrorHandler handler) : super(token, handler); |
| 660 | 660 |
| 661 LiteralInt asLiteralInt() => this; | 661 LiteralInt asLiteralInt() => this; |
| 662 | 662 |
| 663 int get value { | 663 int get value { |
| 664 try { | 664 try { |
| 665 Token valueToken = token; | 665 Token valueToken = token; |
| 666 if (valueToken.kind === PLUS_TOKEN) valueToken = valueToken.next; | 666 if (valueToken.kind === PLUS_TOKEN) valueToken = valueToken.next; |
| 667 return Math.parseInt(valueToken.value.slowToString()); | 667 return parseInt(valueToken.value.slowToString()); |
| 668 } catch (FormatException ex) { | 668 } catch (FormatException ex) { |
| 669 (this.handler)(token, ex); | 669 (this.handler)(token, ex); |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 | 672 |
| 673 accept(Visitor visitor) => visitor.visitLiteralInt(this); | 673 accept(Visitor visitor) => visitor.visitLiteralInt(this); |
| 674 } | 674 } |
| 675 | 675 |
| 676 class LiteralDouble extends Literal<double> { | 676 class LiteralDouble extends Literal<double> { |
| 677 LiteralDouble(Token token, DecodeErrorHandler handler) | 677 LiteralDouble(Token token, DecodeErrorHandler handler) |
| 678 : super(token, handler); | 678 : super(token, handler); |
| 679 | 679 |
| 680 LiteralDouble asLiteralDouble() => this; | 680 LiteralDouble asLiteralDouble() => this; |
| 681 | 681 |
| 682 double get value { | 682 double get value { |
| 683 try { | 683 try { |
| 684 Token valueToken = token; | 684 Token valueToken = token; |
| 685 if (valueToken.kind === PLUS_TOKEN) valueToken = valueToken.next; | 685 if (valueToken.kind === PLUS_TOKEN) valueToken = valueToken.next; |
| 686 return Math.parseDouble(valueToken.value.slowToString()); | 686 return parseDouble(valueToken.value.slowToString()); |
| 687 } catch (FormatException ex) { | 687 } catch (FormatException ex) { |
| 688 (this.handler)(token, ex); | 688 (this.handler)(token, ex); |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 | 691 |
| 692 accept(Visitor visitor) => visitor.visitLiteralDouble(this); | 692 accept(Visitor visitor) => visitor.visitLiteralDouble(this); |
| 693 } | 693 } |
| 694 | 694 |
| 695 class LiteralBool extends Literal<bool> { | 695 class LiteralBool extends Literal<bool> { |
| 696 LiteralBool(Token token, DecodeErrorHandler handler) : super(token, handler); | 696 LiteralBool(Token token, DecodeErrorHandler handler) : super(token, handler); |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 * argument). | 1756 * argument). |
| 1757 * | 1757 * |
| 1758 * TODO(ahe): This method is controversial, the team needs to discuss | 1758 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1759 * if top-level methods are acceptable and what naming conventions to | 1759 * if top-level methods are acceptable and what naming conventions to |
| 1760 * use. | 1760 * use. |
| 1761 */ | 1761 */ |
| 1762 initializerDo(Node node, f(Node node)) { | 1762 initializerDo(Node node, f(Node node)) { |
| 1763 SendSet send = node.asSendSet(); | 1763 SendSet send = node.asSendSet(); |
| 1764 if (send !== null) return f(send.arguments.head); | 1764 if (send !== null) return f(send.arguments.head); |
| 1765 } | 1765 } |
| OLD | NEW |