Chromium Code Reviews| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 8694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8705 | 8705 |
| 8706 | 8706 |
| 8707 bool Type::HasResolvedTypeClass() const { | 8707 bool Type::HasResolvedTypeClass() const { |
| 8708 const Object& type_class = Object::Handle(raw_ptr()->type_class_); | 8708 const Object& type_class = Object::Handle(raw_ptr()->type_class_); |
| 8709 return !type_class.IsNull() && type_class.IsClass(); | 8709 return !type_class.IsNull() && type_class.IsClass(); |
| 8710 } | 8710 } |
| 8711 | 8711 |
| 8712 | 8712 |
| 8713 RawClass* Type::type_class() const { | 8713 RawClass* Type::type_class() const { |
| 8714 ASSERT(HasResolvedTypeClass()); | 8714 ASSERT(HasResolvedTypeClass()); |
| 8715 Class& type_class = Class::Handle(); | 8715 return reinterpret_cast<RawClass*>(raw_ptr()->type_class_); |
|
Ivan Posva
2012/12/07 17:17:31
I do not like the approach taken here. It should b
Florian Schneider
2012/12/10 16:11:27
What protection do you want here? The caller has t
Ivan Posva
2012/12/10 17:13:42
Please note that since you are returning a RawClas
| |
| 8716 type_class ^= raw_ptr()->type_class_; | |
| 8717 return type_class.raw(); | |
| 8718 } | 8716 } |
| 8719 | 8717 |
| 8720 | 8718 |
| 8721 RawUnresolvedClass* Type::unresolved_class() const { | 8719 RawUnresolvedClass* Type::unresolved_class() const { |
| 8722 ASSERT(!HasResolvedTypeClass()); | 8720 ASSERT(!Object::Handle(raw_ptr()->type_class_).IsNull()); |
| 8723 UnresolvedClass& unresolved_class = UnresolvedClass::Handle(); | 8721 ASSERT(Object::Handle(raw_ptr()->type_class_).IsUnresolvedClass()); |
| 8724 unresolved_class ^= raw_ptr()->type_class_; | 8722 return reinterpret_cast<RawUnresolvedClass*>(raw_ptr()->type_class_); |
|
Ivan Posva
2012/12/07 17:17:31
ditto + the check for HasResolvedTypeClass() has d
Florian Schneider
2012/12/10 16:11:27
Sure, I can re-insert the assert, but it is redund
Ivan Posva
2012/12/10 17:13:42
Type::HasResolvedType() conveys a completely diffe
| |
| 8725 ASSERT(!unresolved_class.IsNull()); | |
| 8726 return unresolved_class.raw(); | |
| 8727 } | 8723 } |
| 8728 | 8724 |
| 8729 | 8725 |
| 8730 RawString* Type::TypeClassName() const { | 8726 RawString* Type::TypeClassName() const { |
| 8731 if (HasResolvedTypeClass()) { | 8727 if (HasResolvedTypeClass()) { |
| 8732 const Class& cls = Class::Handle(type_class()); | 8728 const Class& cls = Class::Handle(type_class()); |
| 8733 return cls.Name(); | 8729 return cls.Name(); |
| 8734 } else { | 8730 } else { |
| 8735 const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class()); | 8731 const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class()); |
| 8736 return cls.Name(); | 8732 return cls.Name(); |
| (...skipping 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12119 } | 12115 } |
| 12120 return result.raw(); | 12116 return result.raw(); |
| 12121 } | 12117 } |
| 12122 | 12118 |
| 12123 | 12119 |
| 12124 const char* WeakProperty::ToCString() const { | 12120 const char* WeakProperty::ToCString() const { |
| 12125 return "_WeakProperty"; | 12121 return "_WeakProperty"; |
| 12126 } | 12122 } |
| 12127 | 12123 |
| 12128 } // namespace dart | 12124 } // namespace dart |
| OLD | NEW |