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

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

Issue 10383311: Support proper unparse of is and is!. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Next iteration Created 8 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
« no previous file with comments | « no previous file | no next file » | 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 fa19630a860ee9e590921410978c94d96d0c65a7..88cd27dee157f55aa266620a346e7e5114268b97 100644
--- a/lib/compiler/implementation/tree/unparser.dart
+++ b/lib/compiler/implementation/tree/unparser.dart
@@ -187,16 +187,26 @@ class Unparser implements Visitor {
}
unparseSendPart(Send node) {
+ Operator op = node.selector.asOperator();
+ bool isCheck = op !== null && op.source.stringValue == 'is';
+
if (node.isPrefix) {
visit(node.selector);
}
if (node.receiver !== null) {
visit(node.receiver);
- if (node.selector is !Operator) sb.add('.');
+ if (op === null) {
+ sb.add('.');
+ } else if (isCheck) {
+ sb.add(' ');
+ }
}
if (!node.isPrefix && !node.isIndex) {
visit(node.selector);
}
+ if (isCheck) {
+ sb.add(' ');
+ }
}
visitSend(Send node) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698