Index: pkg/js_ast/lib/src/nodes.dart |
diff --git a/pkg/js_ast/lib/src/nodes.dart b/pkg/js_ast/lib/src/nodes.dart |
index 8dc7f8f637ed121298fb3a59cf3d84c93002dee4..33b5c58431e6bbe5512a9d1bbb3edfa2a38bb6af 100644 |
--- a/pkg/js_ast/lib/src/nodes.dart |
+++ b/pkg/js_ast/lib/src/nodes.dart |
@@ -60,6 +60,8 @@ abstract class NodeVisitor<T> { |
T visitStringConcatenation(StringConcatenation node); |
+ T visitName(Name node); |
+ |
T visitArrayInitializer(ArrayInitializer node); |
T visitArrayHole(ArrayHole node); |
T visitObjectInitializer(ObjectInitializer node); |
@@ -160,6 +162,8 @@ class BaseVisitor<T> implements NodeVisitor<T> { |
T visitStringConcatenation(StringConcatenation node) => visitLiteral(node); |
+ T visitName(Name node) => visitNode(node); |
+ |
T visitArrayInitializer(ArrayInitializer node) => visitExpression(node); |
T visitArrayHole(ArrayHole node) => visitExpression(node); |
T visitObjectInitializer(ObjectInitializer node) => visitExpression(node); |
@@ -573,6 +577,28 @@ abstract class Declaration implements VariableReference { |
} |
+/// An implementation of [Name] represents a potentially late bound name in |
+/// the generated ast. |
+/// |
+/// While [Name] implements comparable, there is no requirement on the actual |
+/// implementation of [compareTo] other than that it needs to be stable. |
+/// In particular, there is no guarantee that implementations of [compareTo] |
+/// will implement some form of lexicographic ordering like [String.compareTo]. |
+abstract class Name extends Literal |
+ implements Declaration, Parameter, Comparable { |
+ accept(NodeVisitor visitor) => visitor.visitName(this); |
+ |
+ bool get allowRename => false; |
+} |
+ |
+class LiteralStringFromName extends LiteralString { |
+ Name name; |
+ |
+ LiteralStringFromName(this.name) : super(null); |
+ |
+ String get value => '"${name.name}"'; |
+} |
+ |
class LiteralExpression extends Expression { |
final String template; |
final List<Expression> inputs; |