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

Unified Diff: runtime/vm/object.cc

Issue 3007603002: [VM generic function reification] Support generic functions in Invocation class. (Closed)
Patch Set: Created 3 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/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());
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | runtime/vm/raw_object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698