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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 23012003: Add Null class to dart:core. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made VM not fail on x is Null tests. Created 7 years, 4 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
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index f9c395cd0c2c224f935a90ec88a342ab2295b797..fc39e60a527469ec36bf2b741edc437de63521fd 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -1176,11 +1176,12 @@ void ValueGraphVisitor::BuildTypeTest(ComparisonNode* node) {
const Class& cls = Class::Handle(literal_value.clazz());
ConstantInstr* result = NULL;
if (cls.IsNullClass()) {
- // A null object is only an instance of Object and dynamic, which has
- // already been checked above (if the type is instantiated). So we can
- // return false here if the instance is null (and if the type is
+ // A null object is only an instance of Object, dynamic and Null, the
+ // first two of which has already been checked above (if the type is
// instantiated).
- result = new ConstantInstr(negate_result ? Bool::True() : Bool::False());
+ const bool is_type = type.IsNullType();
+ result = new ConstantInstr((is_type != negate_result) ? Bool::True()
+ : Bool::False());
} else {
Error& malformed_error = Error::Handle();
if (literal_value.IsInstanceOf(type,
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698