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

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: Addressed comments. Marked test failing due to new dart2js mirror bug. 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 c1717ecc5e777ea073ce2d75e0ee0183f6cdee46..e818aa2b1e9e5a553523ae2b07d102e33b3c7432 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -1222,27 +1222,20 @@ void ValueGraphVisitor::BuildTypeTest(ComparisonNode* node) {
node->left()->IsLiteralNode() &&
type.IsInstantiated()) {
const Instance& literal_value = node->left()->AsLiteralNode()->literal();
- 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
- // instantiated).
- result = new ConstantInstr(negate_result ? Bool::True() : Bool::False());
+
+ Error& malformed_error = Error::Handle();
+ if (literal_value.IsInstanceOf(type,
+ TypeArguments::Handle(),
+ &malformed_error)) {
+ result = new ConstantInstr(negate_result ?
+ Bool::False() : Bool::True());
} else {
- Error& malformed_error = Error::Handle();
- if (literal_value.IsInstanceOf(type,
- TypeArguments::Handle(),
- &malformed_error)) {
- result = new ConstantInstr(negate_result ?
- Bool::False() : Bool::True());
- } else {
- result = new ConstantInstr(negate_result ?
- Bool::True() : Bool::False());
- }
- ASSERT(malformed_error.IsNull());
+ result = new ConstantInstr(negate_result ?
+ Bool::True() : Bool::False());
}
+ ASSERT(malformed_error.IsNull());
+
ReturnDefinition(result);
return;
}

Powered by Google App Engine
This is Rietveld 408576698