| Index: runtime/vm/object.cc
|
| ===================================================================
|
| --- runtime/vm/object.cc (revision 18475)
|
| +++ runtime/vm/object.cc (working copy)
|
| @@ -2075,6 +2075,13 @@
|
| }
|
|
|
|
|
| +void Class::set_mixin(const Type& value) const {
|
| + // Resolution and application of mixin type occurs in finalizer.
|
| + ASSERT(!value.IsNull());
|
| + StorePointer(&raw_ptr()->mixin_, value.raw());
|
| +}
|
| +
|
| +
|
| void Class::AddDirectSubclass(const Class& subclass) const {
|
| ASSERT(!subclass.IsNull());
|
| ASSERT(subclass.SuperClass() == raw());
|
| @@ -4082,6 +4089,15 @@
|
| }
|
|
|
|
|
| +// The compiler generates an implicit constructor if a class definition
|
| +// does not contain an explicit constructor or factory. The implicit
|
| +// constructor has the same token position as the owner class.
|
| +bool Function::IsImplicitConstructor() const {
|
| + return IsConstructor() &&
|
| + (token_pos() == Class::Handle(Owner()).token_pos());
|
| +}
|
| +
|
| +
|
| bool Function::IsImplicitClosureFunction() const {
|
| if (!IsClosureFunction()) {
|
| return false;
|
| @@ -4141,6 +4157,24 @@
|
| }
|
|
|
|
|
| +RawFunction* Function::Clone(const Class& new_owner) const {
|
| + ASSERT(!IsConstructor());
|
| + Function& clone = Function::Handle();
|
| + clone ^= Object::Clone(*this, Heap::kOld);
|
| + const Class& owner = Class::Handle(this->Owner());
|
| + const PatchClass& clone_owner =
|
| + PatchClass::Handle(PatchClass::New(new_owner, owner));
|
| + clone.set_owner(clone_owner);
|
| + clone.StorePointer(&clone.raw_ptr()->code_, Code::null());
|
| + clone.StorePointer(&clone.raw_ptr()->unoptimized_code_, Code::null());
|
| + clone.set_usage_counter(0);
|
| + clone.set_deoptimization_counter(0);
|
| + clone.set_optimized_instruction_count(0);
|
| + clone.set_optimized_call_site_count(0);
|
| + return clone.raw();
|
| +}
|
| +
|
| +
|
| RawFunction* Function::NewClosureFunction(const String& name,
|
| const Function& parent,
|
| intptr_t token_pos) {
|
| @@ -4379,6 +4413,16 @@
|
| }
|
|
|
|
|
| +RawClass* Function::origin() const {
|
| + const Object& obj = Object::Handle(raw_ptr()->owner_);
|
| + if (obj.IsClass()) {
|
| + return Class::Cast(obj).raw();
|
| + }
|
| + ASSERT(obj.IsPatchClass());
|
| + return PatchClass::Cast(obj).source_class();
|
| +}
|
| +
|
| +
|
| RawScript* Function::script() const {
|
| const Object& obj = Object::Handle(raw_ptr()->owner_);
|
| if (obj.IsClass()) {
|
| @@ -4638,6 +4682,26 @@
|
| }
|
|
|
|
|
| +RawClass* Field::owner() const {
|
| + const Object& obj = Object::Handle(raw_ptr()->owner_);
|
| + if (obj.IsClass()) {
|
| + return Class::Cast(obj).raw();
|
| + }
|
| + ASSERT(obj.IsPatchClass());
|
| + return PatchClass::Cast(obj).patched_class();
|
| +}
|
| +
|
| +
|
| +RawClass* Field::origin() const {
|
| + const Object& obj = Object::Handle(raw_ptr()->owner_);
|
| + if (obj.IsClass()) {
|
| + return Class::Cast(obj).raw();
|
| + }
|
| + ASSERT(obj.IsPatchClass());
|
| + return PatchClass::Cast(obj).source_class();
|
| +}
|
| +
|
| +
|
| RawInstance* Field::value() const {
|
| ASSERT(is_static()); // Valid only for static dart fields.
|
| return raw_ptr()->value_;
|
| @@ -4689,6 +4753,21 @@
|
| }
|
|
|
|
|
| +
|
| +RawField* Field::Clone(const Class& new_owner) const {
|
| + Field& clone = Field::Handle();
|
| + clone ^= Object::Clone(*this, Heap::kOld);
|
| + const Class& owner = Class::Handle(this->owner());
|
| + const PatchClass& clone_owner =
|
| + PatchClass::Handle(PatchClass::New(new_owner, owner));
|
| + clone.set_owner(clone_owner);
|
| + if (!clone.is_static()) {
|
| + clone.SetOffset(0);
|
| + }
|
| + return clone.raw();
|
| +}
|
| +
|
| +
|
| RawString* Field::UserVisibleName() const {
|
| const String& str = String::Handle(name());
|
| return IdentifierPrettyName(str);
|
|
|