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

Unified Diff: lib/compiler/implementation/tree/unparser.dart

Issue 10692186: Fix factory constructors unparse: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
« no previous file with comments | « lib/compiler/implementation/dart_backend/emitter.dart ('k') | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/tree/unparser.dart
diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart
index 78d11c4ae490fec06b1bffc90f0f1216fae37540..8b3f03ad9df71e9609fec31fcbafdd89b8f78962 100644
--- a/lib/compiler/implementation/tree/unparser.dart
+++ b/lib/compiler/implementation/tree/unparser.dart
@@ -82,6 +82,11 @@ class Unparser implements Visitor {
}
visitFunctionExpression(FunctionExpression node) {
+ // Check length to not print unnecessary whitespace.
+ if (node.modifiers !== null && node.modifiers.nodes.length() > 0) {
Anton Muhin 2012/07/13 07:07:21 are both cases possible, both null and empty list?
Roman 2012/07/13 08:14:57 I added null check after I got "noSuchMethod" erro
Anton Muhin 2012/07/13 08:15:47 Thanks a lot for explanations, Roma. On 2012/07/1
+ visit(node.modifiers);
+ sb.add(' ');
+ }
if (node.returnType !== null) {
visit(node.returnType);
sb.add(' ');
@@ -98,11 +103,16 @@ class Unparser implements Visitor {
Send send = node.name;
assert(send is !SendSet);
visit(send.receiver);
+ if (!send.isOperator) {
+ // Looks like a factory method.
+ sb.add('.');
+ }
visit(send.selector);
} else {
visit(node.name);
}
visit(node.parameters);
+ visit(node.initializers);
visit(node.body);
}
« no previous file with comments | « lib/compiler/implementation/dart_backend/emitter.dart ('k') | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698