| 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 part of tree; | 5 part of tree; |
| 6 | 6 |
| 7 abstract class Visitor<R> { | 7 abstract class Visitor<R> { |
| 8 const Visitor(); | 8 const Visitor(); |
| 9 | 9 |
| 10 R visitNode(Node node); | 10 R visitNode(Node node); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 R visitSend(Send node) => visitExpression(node); | 69 R visitSend(Send node) => visitExpression(node); |
| 70 R visitSendSet(SendSet node) => visitSend(node); | 70 R visitSendSet(SendSet node) => visitSend(node); |
| 71 R visitStatement(Statement node) => visitNode(node); | 71 R visitStatement(Statement node) => visitNode(node); |
| 72 R visitStringNode(StringNode node) => visitExpression(node); | 72 R visitStringNode(StringNode node) => visitExpression(node); |
| 73 R visitStringInterpolation(StringInterpolation node) => visitStringNode(node); | 73 R visitStringInterpolation(StringInterpolation node) => visitStringNode(node); |
| 74 R visitStringInterpolationPart(StringInterpolationPart node) { | 74 R visitStringInterpolationPart(StringInterpolationPart node) { |
| 75 return visitNode(node); | 75 return visitNode(node); |
| 76 } | 76 } |
| 77 R visitSwitchCase(SwitchCase node) => visitNode(node); | 77 R visitSwitchCase(SwitchCase node) => visitNode(node); |
| 78 R visitSwitchStatement(SwitchStatement node) => visitStatement(node); | 78 R visitSwitchStatement(SwitchStatement node) => visitStatement(node); |
| 79 R visitLiteralSymbol(LiteralSymbol node) => visitExpression(node); |
| 79 R visitThrow(Throw node) => visitExpression(node); | 80 R visitThrow(Throw node) => visitExpression(node); |
| 80 R visitTryStatement(TryStatement node) => visitStatement(node); | 81 R visitTryStatement(TryStatement node) => visitStatement(node); |
| 81 R visitTypeAnnotation(TypeAnnotation node) => visitNode(node); | 82 R visitTypeAnnotation(TypeAnnotation node) => visitNode(node); |
| 82 R visitTypedef(Typedef node) => visitNode(node); | 83 R visitTypedef(Typedef node) => visitNode(node); |
| 83 R visitTypeVariable(TypeVariable node) => visitNode(node); | 84 R visitTypeVariable(TypeVariable node) => visitNode(node); |
| 84 R visitVariableDefinitions(VariableDefinitions node) => visitStatement(node); | 85 R visitVariableDefinitions(VariableDefinitions node) => visitStatement(node); |
| 85 R visitWhile(While node) => visitLoop(node); | 86 R visitWhile(While node) => visitLoop(node); |
| 86 } | 87 } |
| 87 | 88 |
| 88 Token firstBeginToken(Node first, Node second) { | 89 Token firstBeginToken(Node first, Node second) { |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 } | 941 } |
| 941 | 942 |
| 942 Token getBeginToken() { | 943 Token getBeginToken() { |
| 943 if (constKeyword != null) return constKeyword; | 944 if (constKeyword != null) return constKeyword; |
| 944 return firstBeginToken(typeArguments, elements); | 945 return firstBeginToken(typeArguments, elements); |
| 945 } | 946 } |
| 946 | 947 |
| 947 Token getEndToken() => elements.getEndToken(); | 948 Token getEndToken() => elements.getEndToken(); |
| 948 } | 949 } |
| 949 | 950 |
| 951 class LiteralSymbol extends Expression { |
| 952 final Token hashToken; |
| 953 final NodeList identifiers; |
| 954 |
| 955 LiteralSymbol(this.hashToken, this.identifiers); |
| 956 |
| 957 LiteralSymbol asLiteralSymbol() => this; |
| 958 |
| 959 void visitChildren(Visitor visitor) { |
| 960 if (identifiers != null) identifiers.accept(visitor); |
| 961 } |
| 962 |
| 963 accept(Visitor visitor) => visitor.visitLiteralSymbol(this); |
| 964 |
| 965 Token getBeginToken() => hashToken; |
| 966 |
| 967 Token getEndToken() => identifiers.getEndToken(); |
| 968 |
| 969 String get slowNameString => '${identifiers}'; |
| 970 } |
| 971 |
| 950 class Identifier extends Expression { | 972 class Identifier extends Expression { |
| 951 final Token token; | 973 final Token token; |
| 952 | 974 |
| 953 SourceString get source => token.value; | 975 SourceString get source => token.value; |
| 954 | 976 |
| 955 Identifier(Token this.token); | 977 Identifier(Token this.token); |
| 956 | 978 |
| 957 bool isThis() => identical(source.stringValue, 'this'); | 979 bool isThis() => identical(source.stringValue, 'this'); |
| 958 | 980 |
| 959 bool isSuper() => identical(source.stringValue, 'super'); | 981 bool isSuper() => identical(source.stringValue, 'super'); |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 * argument). | 2074 * argument). |
| 2053 * | 2075 * |
| 2054 * TODO(ahe): This method is controversial, the team needs to discuss | 2076 * TODO(ahe): This method is controversial, the team needs to discuss |
| 2055 * if top-level methods are acceptable and what naming conventions to | 2077 * if top-level methods are acceptable and what naming conventions to |
| 2056 * use. | 2078 * use. |
| 2057 */ | 2079 */ |
| 2058 initializerDo(Node node, f(Node node)) { | 2080 initializerDo(Node node, f(Node node)) { |
| 2059 SendSet send = node.asSendSet(); | 2081 SendSet send = node.asSendSet(); |
| 2060 if (send != null) return f(send.arguments.head); | 2082 if (send != null) return f(send.arguments.head); |
| 2061 } | 2083 } |
| OLD | NEW |