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

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

Issue 1153243003: dart2js: Use frequency of occurence to sort metadata indices. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 57b35cfae4ce9cf8ae1e9175ffbac7165d61a1f1..e2df74393d4b17319893b3d8864f99840df24990 100644
--- a/pkg/js_ast/lib/src/printer.dart
+++ b/pkg/js_ast/lib/src/printer.dart
@@ -952,7 +952,28 @@ class Printer implements NodeVisitor {
}
@override
- void visitLiteralBool(LiteralBool node) {
+ visitTokenExpression(TokenExpression node) {
+ // Continue printing with the expression value.
+ node.value.accept(this);
sra1 2015/05/27 19:38:51 Either the precedence needs to be fixed or this co
herhut 2015/06/09 11:10:00 Done.
+ }
+
+ @override
+ visitTokenNumber(TokenNumber node) {
+ String value = "${node.value}";
+ int charCode = value.codeUnitAt(0);
+ if (charCode == charCodes.$MINUS && lastCharCode == charCodes.$MINUS) {
+ out(" ");
sra1 2015/05/27 20:30:15 I'd like to see a test that covers this case.
herhut 2015/06/09 11:10:00 I have factored out the logic from visitLiteralNum
+ }
+ out(value);
+ }
+
+ @override
+ visitTokenString(TokenString node) {
+ out(node.value);
+ }
+
+ @override
+ visitLiteralBool(LiteralBool node) {
out(node.value ? "true" : "false");
}
@@ -962,7 +983,12 @@ class Printer implements NodeVisitor {
}
@override
- void visitLiteralNumber(LiteralNumber node) {
+ visitStringConcatenation(StringConcatenation node) {
+ node.visitChildren(this);
+ }
+
+ @override
+ visitLiteralNumber(LiteralNumber node) {
int charCode = node.value.codeUnitAt(0);
if (charCode == charCodes.$MINUS && lastCharCode == charCodes.$MINUS) {
out(" ", isWhitespace: true);
@@ -1013,7 +1039,6 @@ class Printer implements NodeVisitor {
out("{");
indentMore();
for (int i = 0; i < properties.length; i++) {
- Expression value = properties[i].value;
if (i != 0) {
out(",");
if (node.isOneLiner) spaceOut();

Powered by Google App Engine
This is Rietveld 408576698