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

Unified 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: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/tree/nodes.dart
diff --git a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
index 210ebe52563b6e17541b614e1c3b0ff8372c1f57..7fc23a459ce4e0e5de7c5be6a1eee5d9ecfb52b7 100644
--- a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
@@ -76,6 +76,7 @@ abstract class Visitor<R> {
}
R visitSwitchCase(SwitchCase node) => visitNode(node);
R visitSwitchStatement(SwitchStatement node) => visitStatement(node);
+ R visitSymbolLiteral(SymbolLiteral node) => visitExpression(node);
R visitThrow(Throw node) => visitExpression(node);
R visitTryStatement(TryStatement node) => visitStatement(node);
R visitTypeAnnotation(TypeAnnotation node) => visitNode(node);
@@ -947,6 +948,39 @@ class LiteralList extends Expression {
Token getEndToken() => elements.getEndToken();
}
+class SymbolLiteral extends Expression {
ahe 2013/08/06 12:20:55 This should be LiteralSymbol and it probably shoul
Johnni Winther 2013/09/03 12:27:50 Changed to LiteralSymbol. Don't think it should ex
+ final Token hashToken;
+ final Operator operator;
+ final NodeList identifiers;
ahe 2013/08/06 12:20:55 Feels to me like the natural way to represent this
Johnni Winther 2013/09/03 12:27:50 Done.
+
+ SymbolLiteral(this.hashToken, this.operator, this.identifiers);
+
+ SymbolLiteral asSymbolLiteral() => this;
+
+ void visitChildren(Visitor visitor) {
+ if (operator != null) operator.accept(visitor);
+ if (identifiers != null) identifiers.accept(visitor);
+ }
+
+ accept(Visitor visitor) => visitor.visitSymbolLiteral(this);
+
+ Token getBeginToken() => hashToken;
+
+ Token getEndToken() {
+ if (operator != null) return operator.getEndToken();
+ return identifiers.getEndToken();
+ }
+
+ String get nameString {
+ if (operator != null) {
+ return '${operator}';
+ } else {
+ return '${identifiers}';
+ }
+ }
+}
+
+
class Identifier extends Expression {
final Token token;

Powered by Google App Engine
This is Rietveld 408576698