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

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..e6136f2cade277e7ac5247227fb4a1bc24c5978f 100644
--- a/lib/compiler/implementation/tree/unparser.dart
+++ b/lib/compiler/implementation/tree/unparser.dart
@@ -194,6 +194,23 @@ class Unparser implements Visitor {
}
visitSend(Send node) {
+ // Special case. Simple expr is T is represented as Send(expr, 'is', T),
Anton Muhin 2012/05/23 19:41:11 this is rather ugly. I try to emit expr is! Type
ahe 2012/05/24 09:30:52 This is the result of an allergic reaction to http
ahe 2012/05/24 09:30:52 Extra space after period.
ahe 2012/05/24 09:30:52 I suggest that you put code snippets in [:...:], f
Anton Muhin 2012/05/24 14:15:12 I see, still prefixing a type with negation looks
Anton Muhin 2012/05/24 14:15:12 Now obsolete. So you don't use two spaces after p
Anton Muhin 2012/05/24 14:15:12 Now obsolete, but will do next time. On 2012/05/2
+ // while expr is! T is represented as Send(expr, 'is', Send.prefix('!', T)).
+ if (node.isOperator && node.selector.token.value.stringValue == 'is') {
+ visit(node.receiver);
+ sb.add(' is');
+ bool notForm = node.arguments.head is Send;
+ if (notForm) sb.add('!');
+ sb.add(' ');
+ if (notForm) {
+ visit(node.arguments.head.receiver);
+ } else {
+ visit(node.argumentsNode);
+ }
+
+ return;
+ }
+
unparseSendPart(node);
visit(node.argumentsNode);
}
« 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