| 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 } | 639 } |
| 640 | 640 |
| 641 typedef void DecodeErrorHandler(Token token, var error); | 641 typedef void DecodeErrorHandler(Token token, var error); |
| 642 | 642 |
| 643 class Literal<T> extends Expression { | 643 class Literal<T> extends Expression { |
| 644 final Token token; | 644 final Token token; |
| 645 final DecodeErrorHandler handler; | 645 final DecodeErrorHandler handler; |
| 646 | 646 |
| 647 Literal(Token this.token, DecodeErrorHandler this.handler); | 647 Literal(Token this.token, DecodeErrorHandler this.handler); |
| 648 | 648 |
| 649 abstract T get value(); | 649 abstract T get value; |
| 650 | 650 |
| 651 visitChildren(Visitor visitor) {} | 651 visitChildren(Visitor visitor) {} |
| 652 | 652 |
| 653 Token getBeginToken() => token; | 653 Token getBeginToken() => token; |
| 654 | 654 |
| 655 Token getEndToken() => token; | 655 Token getEndToken() => token; |
| 656 } | 656 } |
| 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); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 int index = quoteLength - 1; | 773 int index = quoteLength - 1; |
| 774 if (quoteLength > 2) index -= 1; | 774 if (quoteLength > 2) index -= 1; |
| 775 return mapping[(raw ? 1 : 0) + index * 2 + (quote === $SQ ? 8 : 0)]; | 775 return mapping[(raw ? 1 : 0) + index * 2 + (quote === $SQ ? 8 : 0)]; |
| 776 } | 776 } |
| 777 } | 777 } |
| 778 | 778 |
| 779 /** | 779 /** |
| 780 * Superclass for classes representing string literals. | 780 * Superclass for classes representing string literals. |
| 781 */ | 781 */ |
| 782 class StringNode extends Expression { | 782 class StringNode extends Expression { |
| 783 abstract DartString get dartString(); | 783 abstract DartString get dartString; |
| 784 abstract bool get isInterpolation(); | 784 abstract bool get isInterpolation; |
| 785 | 785 |
| 786 StringNode asStringNode() => this; | 786 StringNode asStringNode() => this; |
| 787 } | 787 } |
| 788 | 788 |
| 789 class LiteralString extends StringNode { | 789 class LiteralString extends StringNode { |
| 790 final Token token; | 790 final Token token; |
| 791 /** Non-null on validated string literals. */ | 791 /** Non-null on validated string literals. */ |
| 792 final DartString dartString; | 792 final DartString dartString; |
| 793 | 793 |
| 794 LiteralString(this.token, this.dartString); | 794 LiteralString(this.token, this.dartString); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 if (token === null) { | 1002 if (token === null) { |
| 1003 token = definitions.getBeginToken(); | 1003 token = definitions.getBeginToken(); |
| 1004 } | 1004 } |
| 1005 return token; | 1005 return token; |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 Token getEndToken() => endToken; | 1008 Token getEndToken() => endToken; |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 class Loop extends Statement { | 1011 class Loop extends Statement { |
| 1012 abstract Expression get condition(); | 1012 abstract Expression get condition; |
| 1013 final Statement body; | 1013 final Statement body; |
| 1014 | 1014 |
| 1015 Loop(this.body); | 1015 Loop(this.body); |
| 1016 | 1016 |
| 1017 bool isValidContinueTarget() => true; | 1017 bool isValidContinueTarget() => true; |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 class DoWhile extends Loop { | 1020 class DoWhile extends Loop { |
| 1021 final Token doKeyword; | 1021 final Token doKeyword; |
| 1022 final Token whileKeyword; | 1022 final Token whileKeyword; |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 * argument). | 1762 * argument). |
| 1763 * | 1763 * |
| 1764 * TODO(ahe): This method is controversial, the team needs to discuss | 1764 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1765 * if top-level methods are acceptable and what naming conventions to | 1765 * if top-level methods are acceptable and what naming conventions to |
| 1766 * use. | 1766 * use. |
| 1767 */ | 1767 */ |
| 1768 initializerDo(Node node, f(Node node)) { | 1768 initializerDo(Node node, f(Node node)) { |
| 1769 SendSet send = node.asSendSet(); | 1769 SendSet send = node.asSendSet(); |
| 1770 if (send !== null) return f(send.arguments.head); | 1770 if (send !== null) return f(send.arguments.head); |
| 1771 } | 1771 } |
| OLD | NEW |