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

Unified Diff: dart/frog/leg/ssa/codegen.dart

Issue 9358055: Fix 'is' for null. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 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 | dart/tests/language/src/NullIsTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/ssa/codegen.dart
===================================================================
--- dart/frog/leg/ssa/codegen.dart (revision 4224)
+++ dart/frog/leg/ssa/codegen.dart (working copy)
@@ -814,6 +814,12 @@
buffer.add(" $cmp 'boolean'");
}
+ void checkObject(HInstruction input, String cmp) {
+ buffer.add('typeof ');
+ use(input);
+ buffer.add(" $cmp 'object'");
+ }
+
void checkArray(HInstruction input, String cmp) {
use(input);
buffer.add('.constructor $cmp Array');
@@ -840,6 +846,8 @@
buffer.add(' && ');
checkInt(input, '===');
} else {
+ checkObject(input, '===');
+ buffer.add(' && (');
if (element == coreLibrary.find(const SourceString('List'))) {
checkArray(input, '===');
buffer.add(' || ');
@@ -848,7 +856,7 @@
use(input);
buffer.add('.');
buffer.add(compiler.namer.operatorIs(node.typeExpression));
- buffer.add(')');
+ buffer.add('))');
}
buffer.add(')');
}
« no previous file with comments | « no previous file | dart/tests/language/src/NullIsTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698