Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index f339a50fa24771b5cc7a3bda7757e2c88af0b788..0e18fce07c73c3db8b4330c71df6207530101444 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -913,6 +913,15 @@ void Object::InitOnce(Isolate* isolate) { |
cls = vector_class_; |
*vector_type_ = Type::NewNonParameterizedType(cls); |
+ // Since TypeArguments objects are passed as function arguments, make them |
+ // behave as Dart instances, although they are just VM objects. |
+ // Note that we cannot set the super type to ObjectType, which does not live |
+ // in the vm isolate. See special handling in Class::SuperClass(). |
+ cls = type_arguments_class_; |
+ cls.set_interfaces(Object::empty_array()); |
+ cls.SetFields(Object::empty_array()); |
+ cls.SetFunctions(Object::empty_array()); |
+ |
// Allocate and initialize singleton true and false boolean objects. |
cls = Class::New<Bool>(); |
isolate->object_store()->set_bool_class(cls); |
@@ -2514,6 +2523,10 @@ RawClass* Class::SuperClass(bool original_classes) const { |
Zone* zone = thread->zone(); |
Isolate* isolate = thread->isolate(); |
if (super_type() == AbstractType::null()) { |
+ if (id() == kTypeArgumentsCid) { |
+ // Pretend TypeArguments objects are Dart instances. |
+ return isolate->class_table()->At(kInstanceCid); |
+ } |
return Class::null(); |
} |
const AbstractType& sup_type = AbstractType::Handle(zone, super_type()); |