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

Unified Diff: runtime/vm/object.cc

Issue 8592004: null is an instance of Dynamic (fix issue 443). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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/object.cc
===================================================================
--- runtime/vm/object.cc (revision 1713)
+++ runtime/vm/object.cc (working copy)
@@ -5038,14 +5038,19 @@
ASSERT(!other.IsVoidType());
if (IsNull()) {
if (test == Type::kIsSubtypeOf) {
- const Type& object_type =
- Type::Handle(Isolate::Current()->object_store()->object_type());
- if (other.IsInstantiated() && object_type.IsSubtypeOf(other)) {
- ASSERT(other_instantiator.IsNull());
- // null is an instance of the Object class.
- return true;
+ Class& other_class = Class::Handle();
+ if (other.IsTypeParameter()) {
+ if (other_instantiator.IsNull()) {
+ return true; // Other type is uninstantiated, i.e. Dynamic.
+ }
+ const Type& instantiated_other =
+ Type::Handle(other_instantiator.TypeAt(other.Index()));
+ ASSERT(instantiated_other.IsInstantiated());
+ other_class = instantiated_other.type_class();
+ } else {
+ other_class = other.type_class();
}
- return false;
+ return other_class.IsObjectClass() || other_class.IsDynamicClass();
} else {
ASSERT(test == Type::kIsAssignableTo);
return true;

Powered by Google App Engine
This is Rietveld 408576698