| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 return Class::null(); | 2153 return Class::null(); |
| 2154 } | 2154 } |
| 2155 const AbstractType& sup_type = AbstractType::Handle(super_type()); | 2155 const AbstractType& sup_type = AbstractType::Handle(super_type()); |
| 2156 return sup_type.type_class(); | 2156 return sup_type.type_class(); |
| 2157 } | 2157 } |
| 2158 | 2158 |
| 2159 | 2159 |
| 2160 void Class::set_super_type(const AbstractType& value) const { | 2160 void Class::set_super_type(const AbstractType& value) const { |
| 2161 ASSERT(value.IsNull() || | 2161 ASSERT(value.IsNull() || |
| 2162 (value.IsType() && !value.IsDynamicType()) || | 2162 (value.IsType() && !value.IsDynamicType()) || |
| 2163 value.IsTypeRef() || | |
| 2164 value.IsBoundedType() || | |
| 2165 value.IsMixinAppType()); | 2163 value.IsMixinAppType()); |
| 2166 StorePointer(&raw_ptr()->super_type_, value.raw()); | 2164 StorePointer(&raw_ptr()->super_type_, value.raw()); |
| 2167 } | 2165 } |
| 2168 | 2166 |
| 2169 | 2167 |
| 2170 // Return a TypeParameter if the type_name is a type parameter of this class. | 2168 // Return a TypeParameter if the type_name is a type parameter of this class. |
| 2171 // Return null otherwise. | 2169 // Return null otherwise. |
| 2172 RawTypeParameter* Class::LookupTypeParameter(const String& type_name) const { | 2170 RawTypeParameter* Class::LookupTypeParameter(const String& type_name) const { |
| 2173 ASSERT(!type_name.IsNull()); | 2171 ASSERT(!type_name.IsNull()); |
| 2174 Isolate* isolate = Isolate::Current(); | 2172 Isolate* isolate = Isolate::Current(); |
| (...skipping 10874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13049 | 13047 |
| 13050 void TypeParameter::set_type_state(int8_t state) const { | 13048 void TypeParameter::set_type_state(int8_t state) const { |
| 13051 ASSERT((state == RawTypeParameter::kAllocated) || | 13049 ASSERT((state == RawTypeParameter::kAllocated) || |
| 13052 (state == RawTypeParameter::kBeingFinalized) || | 13050 (state == RawTypeParameter::kBeingFinalized) || |
| 13053 (state == RawTypeParameter::kFinalizedUninstantiated)); | 13051 (state == RawTypeParameter::kFinalizedUninstantiated)); |
| 13054 raw_ptr()->type_state_ = state; | 13052 raw_ptr()->type_state_ = state; |
| 13055 } | 13053 } |
| 13056 | 13054 |
| 13057 | 13055 |
| 13058 const char* TypeParameter::ToCString() const { | 13056 const char* TypeParameter::ToCString() const { |
| 13059 const char* format = "TypeParameter: name %s; index: %d; class: %s"; | 13057 const char* format = |
| 13058 "TypeParameter: name %s; index: %d; class: %s; bound: %s"; |
| 13060 const char* name_cstr = String::Handle(Name()).ToCString(); | 13059 const char* name_cstr = String::Handle(Name()).ToCString(); |
| 13061 const Class& cls = Class::Handle(parameterized_class()); | 13060 const Class& cls = Class::Handle(parameterized_class()); |
| 13062 const char* cls_cstr = | 13061 const char* cls_cstr = |
| 13063 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 13062 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); |
| 13064 intptr_t len = OS::SNPrint(NULL, 0, format, name_cstr, index(), cls_cstr) + 1; | 13063 const AbstractType& upper_bound = AbstractType::Handle(bound()); |
| 13064 const char* bound_cstr = String::Handle(upper_bound.Name()).ToCString(); |
| 13065 intptr_t len = OS::SNPrint( |
| 13066 NULL, 0, format, name_cstr, index(), cls_cstr, bound_cstr) + 1; |
| 13065 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 13067 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 13066 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr); | 13068 OS::SNPrint(chars, len, format, name_cstr, index(), cls_cstr, bound_cstr); |
| 13067 return chars; | 13069 return chars; |
| 13068 } | 13070 } |
| 13069 | 13071 |
| 13070 | 13072 |
| 13071 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { | 13073 void TypeParameter::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 13072 JSONObject jsobj(stream); | 13074 JSONObject jsobj(stream); |
| 13073 } | 13075 } |
| 13074 | 13076 |
| 13075 | 13077 |
| 13076 bool BoundedType::IsMalformed() const { | 13078 bool BoundedType::IsMalformed() const { |
| (...skipping 3897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16974 return "_MirrorReference"; | 16976 return "_MirrorReference"; |
| 16975 } | 16977 } |
| 16976 | 16978 |
| 16977 | 16979 |
| 16978 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 16980 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 16979 Instance::PrintToJSONStream(stream, ref); | 16981 Instance::PrintToJSONStream(stream, ref); |
| 16980 } | 16982 } |
| 16981 | 16983 |
| 16982 | 16984 |
| 16983 } // namespace dart | 16985 } // namespace dart |
| OLD | NEW |