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

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

Issue 1138793002: Tag closures with their types (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Address jmesserly's comments 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/nodes.dart
diff --git a/lib/src/js/nodes.dart b/lib/src/js/nodes.dart
index edad282582a57ecb9f196b444fd4e11ef46b39c7..34d1618b4d76e1159d12096344ea15e416dea486 100644
--- a/lib/src/js/nodes.dart
+++ b/lib/src/js/nodes.dart
@@ -1134,11 +1134,20 @@ class ArrayHole extends Expression {
class ObjectInitializer extends Expression {
final List<Property> properties;
+ /**
+ * If set to true, forces a vertical layout when using the [Printer].
+ * Otherwise, layout will be vertical if and only if any [properties]
+ * are [FunctionExpression]s.
+ */
+ final bool _vertical;
+ bool get vertical {
+ return _vertical || properties.any((p) => p.value is FunctionExpression);
+ }
/**
* Constructs a new object-initializer containing the given [properties].
*/
- ObjectInitializer(this.properties);
+ ObjectInitializer(this.properties, {vertical: false}) : _vertical = vertical;
accept(NodeVisitor visitor) => visitor.visitObjectInitializer(this);

Powered by Google App Engine
This is Rietveld 408576698