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

Unified Diff: runtime/vm/object.cc

Issue 2719603002: Rename Closure instance field type_arguments_ to instantiator_. (Closed)
Patch Set: work in progress Created 3 years, 10 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index b9521e685f9797e196d6920253283e7dd1bff946..7896e0c93b6ddaf619a2fde424b89e80f12fb620 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -1432,12 +1432,10 @@ RawError* Object::Init(Isolate* isolate, kernel::Program* kernel_program) {
// Class that represents the Dart class _Closure and C++ class Closure.
cls = Class::New<Closure>();
- cls.set_type_arguments_field_offset(Closure::type_arguments_offset());
- cls.set_num_type_arguments(0); // Although a closure has type_arguments_.
- cls.set_num_own_type_arguments(0);
+ object_store->set_closure_class(cls);
+ cls.ResetFinalization(); // To calculate field offsets from Dart source.
RegisterPrivateClass(cls, Symbols::_Closure(), core_lib);
pending_classes.Add(cls);
- object_store->set_closure_class(cls);
cls = Class::New<WeakProperty>();
object_store->set_weak_property_class(cls);
@@ -2530,7 +2528,6 @@ RawTypeParameter* Class::LookupTypeParameter(const String& type_name) const {
void Class::CalculateFieldOffsets() const {
- ASSERT(id() != kClosureCid); // Class _Closure is prefinalized.
Array& flds = Array::Handle(fields());
const Class& super = Class::Handle(SuperClass());
intptr_t offset = 0;
@@ -3634,7 +3631,7 @@ void Class::SetRefinalizeAfterPatch() const {
void Class::ResetFinalization() const {
- ASSERT(IsTopLevel());
+ ASSERT(IsTopLevel() || IsClosureClass());
set_state_bits(
ClassFinalizedBits::update(RawClass::kAllocated, raw_ptr()->state_bits_));
set_state_bits(TypeFinalizedBit::update(false, raw_ptr()->state_bits_));
@@ -15570,7 +15567,8 @@ RawAbstractType* Instance::GetType(Heap::Space space) const {
}
const Class& scope_cls = Class::Handle(type.type_class());
ASSERT(scope_cls.NumTypeArguments() > 0);
- TypeArguments& type_arguments = TypeArguments::Handle(GetTypeArguments());
+ TypeArguments& type_arguments =
+ TypeArguments::Handle(Closure::Cast(*this).instantiator());
type =
Type::New(scope_cls, type_arguments, TokenPosition::kNoSource, space);
type.set_signature(signature);
@@ -15666,7 +15664,7 @@ bool Instance::IsInstanceOf(const AbstractType& other,
const Function& signature =
Function::Handle(zone, Closure::Cast(*this).function());
const TypeArguments& type_arguments =
- TypeArguments::Handle(zone, GetTypeArguments());
+ TypeArguments::Handle(zone, Closure::Cast(*this).instantiator());
// TODO(regis): If signature function is generic, pass its type parameters
// as function instantiator, otherwise pass null.
// Pass the closure context as well to the the IsSubtypeOf call.
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698