Chromium Code Reviews| Index: runtime/vm/object.cc |
| =================================================================== |
| --- runtime/vm/object.cc (revision 20045) |
| +++ runtime/vm/object.cc (working copy) |
| @@ -705,6 +705,9 @@ |
| cls = Class::New<BoundedType>(); |
| object_store->set_bounded_type_class(cls); |
| + cls = Class::New<MixinAppType>(); |
| + object_store->set_mixin_app_type_class(cls); |
| + |
| // Pre-allocate the OneByteString class needed by the symbol table. |
| cls = Class::NewStringClass(kOneByteStringCid); |
| object_store->set_one_byte_string_class(cls); |
| @@ -1050,6 +1053,9 @@ |
| cls = Class::New<BoundedType>(); |
| object_store->set_bounded_type_class(cls); |
| + cls = Class::New<MixinAppType>(); |
| + object_store->set_mixin_app_type_class(cls); |
| + |
| cls = Class::New<Array>(); |
| object_store->set_array_class(cls); |
| @@ -1593,7 +1599,10 @@ |
| void Class::set_super_type(const AbstractType& value) const { |
| - ASSERT(value.IsNull() || value.IsType() || value.IsBoundedType()); |
| + ASSERT(value.IsNull() || |
| + value.IsType() || |
| + value.IsBoundedType() || |
| + value.IsMixinAppType()); |
| StorePointer(&raw_ptr()->super_type_, value.raw()); |
| } |
| @@ -9878,6 +9887,66 @@ |
| } |
| + |
| +RawString* MixinAppType::Name() const { |
| + return String::New("MixinApplication"); |
| +} |
| + |
| + |
| +// The mixin type is resolved if the super type and all mixin |
| +// types are resolved. |
| +bool MixinAppType::IsResolved() const { |
|
regis
2013/03/14 23:40:34
I do not think this call is necessary. By definiti
hausner
2013/03/15 00:36:32
Done.
|
| + AbstractType& type = AbstractType::Handle(super_type()); |
| + if (!type.IsResolved()) { |
| + return false; |
| + } |
| + const Array& mixins = Array::Handle(mixin_types()); |
| + for (int i = 0; i < mixins.Length(); i++) { |
| + type ^= mixins.At(i); |
| + if (!type.IsResolved()) { |
| + return false; |
| + } |
| + } |
| + return true; |
| +} |
| + |
| + |
| +const char* MixinAppType::ToCString() const { |
| + return "MixinAppType"; |
| +} |
| + |
| + |
| +void MixinAppType::set_super_type(const AbstractType& value) const { |
| + StorePointer(&raw_ptr()->super_type_, value.raw()); |
| +} |
| + |
| + |
| +void MixinAppType::set_mixin_types(const Array& value) const { |
| + StorePointer(&raw_ptr()->mixin_types_, value.raw()); |
| +} |
| + |
| + |
| +RawMixinAppType* MixinAppType::New() { |
| + ASSERT(Isolate::Current()->object_store()->mixin_app_type_class() != |
| + Class::null()); |
| + // MixinAppType objects do not survive finalization, so allocate |
| + // on new heap. |
| + RawObject* raw = Object::Allocate(MixinAppType::kClassId, |
| + MixinAppType::InstanceSize(), |
| + Heap::kNew); |
| + return reinterpret_cast<RawMixinAppType*>(raw); |
| +} |
| + |
| + |
| +RawMixinAppType* MixinAppType::New(const AbstractType& super_type, |
| + const Array& mixin_types) { |
| + const MixinAppType& result = MixinAppType::Handle(MixinAppType::New()); |
| + result.set_super_type(super_type); |
| + result.set_mixin_types(mixin_types); |
| + return result.raw(); |
| +} |
| + |
| + |
| const char* Number::ToCString() const { |
| // Number is an interface. No instances of Number should exist. |
| UNREACHABLE(); |