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

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: 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 05b24260254451bb67f314f740ba13b5e4956b95..dc922882d01240cd834b166bfdad765f3255d26a 100644
--- a/lib/compiler/implementation/tree/unparser.dart
+++ b/lib/compiler/implementation/tree/unparser.dart
@@ -181,16 +181,28 @@ class Unparser implements Visitor {
unparseSendPart(Send node) {
+ Operator op = node.selector.asOperator();
+ bool isCheck = op !== null && op.source.stringValue == 'is';
+ // is check requires trailing space if it's not is! form.
ahe 2012/05/29 13:40:07 Not a proper sentence. First word should be capita
Anton Muhin 2012/05/31 14:44:44 Now obsolete.
+ bool requiresSpace = isCheck && node.arguments.head is! Send;
ahe 2012/05/29 13:40:07 The style we use is this: node.arguments.head is
Bob Nystrom 2012/05/30 21:46:51 This was a surprise to me. In SEA I think we all u
Anton Muhin 2012/05/31 14:44:44 That was a surprise for me as well. On 2012/05/30
+
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) {
visit(node.selector);
}
+ if (requiresSpace) {
ahe 2012/05/29 13:40:07 This expression: 1 is !Object Is printed as: 1
Anton Muhin 2012/05/31 14:44:44 Yes, that was planned as I thought that preferred
+ 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