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

Unified Diff: pkg/js_ast/lib/src/printer.dart

Issue 1198293002: dart2js: Use an abstract Name class for names in the generated JavaScript ast. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix tests Created 5 years, 6 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: pkg/js_ast/lib/src/printer.dart
diff --git a/pkg/js_ast/lib/src/printer.dart b/pkg/js_ast/lib/src/printer.dart
index c2deb1eefc2d591c29d19d193ba37b8e1c87e7f8..ff757b4cbd90d87ec1863be0751e3c695f2e6ad4 100644
--- a/pkg/js_ast/lib/src/printer.dart
+++ b/pkg/js_ast/lib/src/printer.dart
@@ -927,6 +927,11 @@ class Printer implements NodeVisitor {
out(fieldWithQuotes.substring(1, fieldWithQuotes.length - 1));
return;
}
+ } else if (selector is Name) {
+ if (access.receiver is LiteralNumber) out(" ", isWhitespace: true);
+ out(".");
+ out(selector.name);
+ return;
}
out("[");
visitNestedExpression(selector, EXPRESSION,
@@ -992,6 +997,11 @@ class Printer implements NodeVisitor {
}
@override
+ visitName(Name node) {
+ out(node.name);
+ }
+
+ @override
visitLiteralNumber(LiteralNumber node) {
outputNumberWithRequiredWhitespace(node.value);
}
@@ -1067,6 +1077,8 @@ class Printer implements NodeVisitor {
} else {
out(name);
}
+ } else if (node.name is Name) {
+ node.name.accept(this);
} else {
assert(node.name is LiteralNumber);
LiteralNumber nameNumber = node.name;

Powered by Google App Engine
This is Rietveld 408576698