Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/tree/nodes.dart

Issue 21511003: Support symbol literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 nameString => '${identifiers}';
ahe 2013/09/03 17:53:34 What is this for? Looks like a method that should
Johnni Winther 2013/09/10 09:09:07 Renamed to slowNameString. It doesn't include # so
970 }
971
972
ahe 2013/09/03 17:53:34 Extra line.
Johnni Winther 2013/09/10 09:09:07 Done.
950 class Identifier extends Expression { 973 class Identifier extends Expression {
951 final Token token; 974 final Token token;
952 975
953 SourceString get source => token.value; 976 SourceString get source => token.value;
954 977
955 Identifier(Token this.token); 978 Identifier(Token this.token);
956 979
957 bool isThis() => identical(source.stringValue, 'this'); 980 bool isThis() => identical(source.stringValue, 'this');
958 981
959 bool isSuper() => identical(source.stringValue, 'super'); 982 bool isSuper() => identical(source.stringValue, 'super');
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 * argument). 2075 * argument).
2053 * 2076 *
2054 * TODO(ahe): This method is controversial, the team needs to discuss 2077 * TODO(ahe): This method is controversial, the team needs to discuss
2055 * if top-level methods are acceptable and what naming conventions to 2078 * if top-level methods are acceptable and what naming conventions to
2056 * use. 2079 * use.
2057 */ 2080 */
2058 initializerDo(Node node, f(Node node)) { 2081 initializerDo(Node node, f(Node node)) {
2059 SendSet send = node.asSendSet(); 2082 SendSet send = node.asSendSet();
2060 if (send != null) return f(send.arguments.head); 2083 if (send != null) return f(send.arguments.head);
2061 } 2084 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698