| 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 visitClassNode(ClassNode node); | 7 R visitClassNode(ClassNode node); |
| 8 R visitConditional(Conditional node); | 8 R visitConditional(Conditional node); |
| 9 R visitDoWhile(DoWhile node); | 9 R visitDoWhile(DoWhile node); |
| 10 R visitExpressionStatement(ExpressionStatement node); | 10 R visitExpressionStatement(ExpressionStatement node); |
| 11 R visitFor(For node); | 11 R visitFor(For node); |
| 12 R visitFunctionExpression(FunctionExpression node); | 12 R visitFunctionExpression(FunctionExpression node); |
| 13 R visitIdentifier(Identifier node); | 13 R visitIdentifier(Identifier node); |
| 14 R visitIf(If node); | 14 R visitIf(If node); |
| 15 R visitLiteralBool(LiteralBool node); | 15 R visitLiteralBool(LiteralBool node); |
| 16 R visitLiteralDouble(LiteralDouble node); | 16 R visitLiteralDouble(LiteralDouble node); |
| 17 R visitLiteralInt(LiteralInt node); | 17 R visitLiteralInt(LiteralInt node); |
| 18 R visitLiteralList(LiteralList node); | 18 R visitLiteralList(LiteralList node); |
| 19 R visitLiteralNull(LiteralNull node); | 19 R visitLiteralNull(LiteralNull node); |
| 20 R visitLiteralString(LiteralString node); | 20 R visitLiteralString(LiteralString node); |
| 21 R visitModifiers(Modifiers node); | 21 R visitModifiers(Modifiers node); |
| 22 R visitNewExpression(NewExpression node); | 22 R visitNewExpression(NewExpression node); |
| 23 R visitNodeList(NodeList node); | 23 R visitNodeList(NodeList node); |
| 24 R visitOperator(Operator node); | 24 R visitOperator(Operator node); |
| 25 R visitParenthesizedExpression(ParenthesizedExpression node); | 25 R visitParenthesizedExpression(ParenthesizedExpression node); |
| 26 R visitReturn(Return node); | 26 R visitReturn(Return node); |
| 27 R visitSend(Send node); | 27 R visitSend(Send node); |
| 28 R visitSendSet(SendSet node); | 28 R visitSendSet(SendSet node); |
| 29 R visitStringInterpolation(StringInterpolation node); |
| 30 R visitStringInterpolationPart(StringInterpolationPart node); |
| 29 R visitThrow(Throw node); | 31 R visitThrow(Throw node); |
| 30 R visitTypeAnnotation(TypeAnnotation node); | 32 R visitTypeAnnotation(TypeAnnotation node); |
| 31 R visitVariableDefinitions(VariableDefinitions node); | 33 R visitVariableDefinitions(VariableDefinitions node); |
| 32 R visitWhile(While node); | 34 R visitWhile(While node); |
| 33 } | 35 } |
| 34 | 36 |
| 35 Token firstBeginToken(Node first, Node second) { | 37 Token firstBeginToken(Node first, Node second) { |
| 36 return (first !== null) ? first.getBeginToken() | 38 return (first !== null) ? first.getBeginToken() |
| 37 : second.getBeginToken(); | 39 : second.getBeginToken(); |
| 38 } | 40 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 LiteralNull asLiteralNull() => null; | 94 LiteralNull asLiteralNull() => null; |
| 93 LiteralString asLiteralString() => null; | 95 LiteralString asLiteralString() => null; |
| 94 LiteralList asLiteralList() => null; | 96 LiteralList asLiteralList() => null; |
| 95 Modifiers asModifiers() => null; | 97 Modifiers asModifiers() => null; |
| 96 NodeList asNodeList() => null; | 98 NodeList asNodeList() => null; |
| 97 Operator asOperator() => null; | 99 Operator asOperator() => null; |
| 98 ParenthesizedExpression asParenthesizedExpression() => null; | 100 ParenthesizedExpression asParenthesizedExpression() => null; |
| 99 Return asReturn() => null; | 101 Return asReturn() => null; |
| 100 Send asSend() => null; | 102 Send asSend() => null; |
| 101 SendSet asSendSet() => null; | 103 SendSet asSendSet() => null; |
| 104 StringInterpolation asStringInterpolation() => null; |
| 105 StringInterpolationPart asStringInterpolationPart() => null; |
| 102 Throw asThrow() => null; | 106 Throw asThrow() => null; |
| 103 TypeAnnotation asTypeAnnotation() => null; | 107 TypeAnnotation asTypeAnnotation() => null; |
| 104 VariableDefinitions asVariableDefinitions() => null; | 108 VariableDefinitions asVariableDefinitions() => null; |
| 105 While asWhile() => null; | 109 While asWhile() => null; |
| 106 } | 110 } |
| 107 | 111 |
| 108 class ClassNode extends Node { | 112 class ClassNode extends Node { |
| 109 final Identifier name; | 113 final Identifier name; |
| 110 final TypeAnnotation superclass; | 114 final TypeAnnotation superclass; |
| 111 final NodeList interfaces; | 115 final NodeList interfaces; |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 accept(Visitor visitor) => visitor.visitModifiers(this); | 813 accept(Visitor visitor) => visitor.visitModifiers(this); |
| 810 visitChilren(Visitor visitor) => nodes.accept(visitor); | 814 visitChilren(Visitor visitor) => nodes.accept(visitor); |
| 811 | 815 |
| 812 bool isStatic() => (flags & FLAG_STATIC) != 0; | 816 bool isStatic() => (flags & FLAG_STATIC) != 0; |
| 813 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0; | 817 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0; |
| 814 bool isFinal() => (flags & FLAG_FINAL) != 0; | 818 bool isFinal() => (flags & FLAG_FINAL) != 0; |
| 815 bool isVar() => (flags & FLAG_VAR) != 0; | 819 bool isVar() => (flags & FLAG_VAR) != 0; |
| 816 bool isConst() => (flags & FLAG_CONST) != 0; | 820 bool isConst() => (flags & FLAG_CONST) != 0; |
| 817 } | 821 } |
| 818 | 822 |
| 823 class StringInterpolation extends Expression { |
| 824 final LiteralString string; |
| 825 final NodeList parts; |
| 826 |
| 827 StringInterpolation(this.string, this.parts); |
| 828 |
| 829 StringInterpolation asStringInterpolation() => this; |
| 830 |
| 831 accept(Visitor visitor) => visitor.visitStringInterpolation(this); |
| 832 |
| 833 visitChildren(Visitor visitor) { |
| 834 string.accept(visitor); |
| 835 parts.accept(visitor); |
| 836 } |
| 837 |
| 838 Token getBeginToken() => string.getBeginToken(); |
| 839 |
| 840 Token getEndToken() => parts.getEndToken(); |
| 841 } |
| 842 |
| 843 class StringInterpolationPart extends Node { |
| 844 final Expression expression; |
| 845 final LiteralString string; |
| 846 |
| 847 StringInterpolationPart(this.expression, this.string); |
| 848 |
| 849 StringInterpolationPart asStringInterpolationPart() => this; |
| 850 |
| 851 accept(Visitor visitor) => visitor.visitStringInterpolationPart(this); |
| 852 |
| 853 visitChildren(Visitor visitor) { |
| 854 expression.accept(visitor); |
| 855 string.accept(visitor); |
| 856 } |
| 857 |
| 858 Token getBeginToken() => expression.getBeginToken(); |
| 859 |
| 860 Token getEndToken() => string.getEndToken(); |
| 861 } |
| 862 |
| 819 class UnimplementedExpression extends Expression { | 863 class UnimplementedExpression extends Expression { |
| 820 final String description; | 864 final String description; |
| 821 final NodeList nodes; | 865 final NodeList nodes; |
| 822 | 866 |
| 823 UnimplementedExpression(this.description, List<Node> nodes) | 867 UnimplementedExpression(this.description, List<Node> nodes) |
| 824 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes)); | 868 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes)); |
| 825 | 869 |
| 826 toString() => '$description($nodes)'; | 870 toString() => '$description($nodes)'; |
| 827 | 871 |
| 828 Token getBeginToken() => nodes.getBeginToken(); | 872 Token getBeginToken() => nodes.getBeginToken(); |
| 829 | 873 |
| 830 Token getEndToken() => nodes.getEndToken(); | 874 Token getEndToken() => nodes.getEndToken(); |
| 831 } | 875 } |
| 832 | 876 |
| 833 class UnimplementedStatement extends Statement { | 877 class UnimplementedStatement extends Statement { |
| 834 final String description; | 878 final String description; |
| 835 final NodeList nodes; | 879 final NodeList nodes; |
| 836 | 880 |
| 837 UnimplementedStatement(this.description, List<Node> nodes) | 881 UnimplementedStatement(this.description, List<Node> nodes) |
| 838 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes)); | 882 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes)); |
| 839 | 883 |
| 840 toString() => '$description($nodes)'; | 884 toString() => '$description($nodes)'; |
| 841 | 885 |
| 842 Token getBeginToken() => nodes.getBeginToken(); | 886 Token getBeginToken() => nodes.getBeginToken(); |
| 843 | 887 |
| 844 Token getEndToken() => nodes.getEndToken(); | 888 Token getEndToken() => nodes.getEndToken(); |
| 845 } | 889 } |
| OLD | NEW |