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

Unified Diff: lib/src/js/printer.dart

Issue 1138793002: Tag closures with their types (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase 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: lib/src/js/printer.dart
diff --git a/lib/src/js/printer.dart b/lib/src/js/printer.dart
index f95a64d976700c0dd8e53d18230015aaf9fb1781..3129ff7f2cc1471d0e4f0fd88094acc303d97e18 100644
--- a/lib/src/js/printer.dart
+++ b/lib/src/js/printer.dart
@@ -861,8 +861,10 @@ class Printer implements NodeVisitor {
out("=>");
if (fun.body is Expression) {
spaceOut();
+ if (fun.body is ObjectInitializer) out("(");
Jennifer Messerly 2015/05/19 18:19:01 Lovely fix! Small suggestion: // Object initiali
Leaf 2015/05/19 22:31:13 Done.
visitNestedExpression(fun.body, ASSIGNMENT,
newInForInit: false, newAtStatementBegin: false);
+ if (fun.body is ObjectInitializer) out(")");
} else {
blockBody(fun.body, needsSeparation: false, needsNewline: false);
}
@@ -927,7 +929,8 @@ class Printer implements NodeVisitor {
out("{");
indentMore();
- var isOneLiner = !properties.any((p) => p.value is FunctionExpression);
+ var isOneLiner = !(node.vertical ||
+ properties.any((p) => p.value is FunctionExpression));
for (int i = 0; i < properties.length; i++) {
if (i != 0) {
out(",");

Powered by Google App Engine
This is Rietveld 408576698