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 17218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17229 this_bound.Equals(other_bound); // Different graph, do not pass trail. | 17229 this_bound.Equals(other_bound); // Different graph, do not pass trail. |
17230 } | 17230 } |
17231 | 17231 |
17232 | 17232 |
17233 bool BoundedType::IsRecursive() const { | 17233 bool BoundedType::IsRecursive() const { |
17234 return AbstractType::Handle(type()).IsRecursive(); | 17234 return AbstractType::Handle(type()).IsRecursive(); |
17235 } | 17235 } |
17236 | 17236 |
17237 | 17237 |
17238 void BoundedType::set_type(const AbstractType& value) const { | 17238 void BoundedType::set_type(const AbstractType& value) const { |
17239 ASSERT(value.IsFinalized() || value.IsBeingFinalized()); | 17239 ASSERT(value.IsFinalized() || |
| 17240 value.IsBeingFinalized() || |
| 17241 value.IsTypeParameter()); |
17240 ASSERT(!value.IsMalformed()); | 17242 ASSERT(!value.IsMalformed()); |
17241 StorePointer(&raw_ptr()->type_, value.raw()); | 17243 StorePointer(&raw_ptr()->type_, value.raw()); |
17242 } | 17244 } |
17243 | 17245 |
17244 | 17246 |
17245 void BoundedType::set_bound(const AbstractType& value) const { | 17247 void BoundedType::set_bound(const AbstractType& value) const { |
17246 // The bound may still be unfinalized because of legal cycles. | 17248 // The bound may still be unfinalized because of legal cycles. |
17247 // It must be finalized before it is checked at run time, though. | 17249 // It must be finalized before it is checked at run time, though. |
17248 ASSERT(value.IsFinalized() || value.IsBeingFinalized()); | 17250 ASSERT(value.IsFinalized() || value.IsBeingFinalized()); |
17249 StorePointer(&raw_ptr()->bound_, value.raw()); | 17251 StorePointer(&raw_ptr()->bound_, value.raw()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17298 // The instantiated_upper_bound may not be finalized or instantiated. | 17300 // The instantiated_upper_bound may not be finalized or instantiated. |
17299 // See comment above. | 17301 // See comment above. |
17300 } | 17302 } |
17301 if (bound_error->IsNull()) { | 17303 if (bound_error->IsNull()) { |
17302 // Shortcut the F-bounded case where we have reached a fixpoint. | 17304 // Shortcut the F-bounded case where we have reached a fixpoint. |
17303 if (instantiated_bounded_type.Equals(bounded_type) && | 17305 if (instantiated_bounded_type.Equals(bounded_type) && |
17304 instantiated_upper_bound.Equals(upper_bound)) { | 17306 instantiated_upper_bound.Equals(upper_bound)) { |
17305 return bounded_type.raw(); | 17307 return bounded_type.raw(); |
17306 } | 17308 } |
17307 const TypeParameter& type_param = TypeParameter::Handle(type_parameter()); | 17309 const TypeParameter& type_param = TypeParameter::Handle(type_parameter()); |
17308 if (instantiated_bounded_type.IsBeingFinalized() || | 17310 if (!instantiated_bounded_type.IsFinalized() || |
17309 instantiated_upper_bound.IsBeingFinalized() || | 17311 !instantiated_upper_bound.IsFinalized() || |
17310 (!type_param.CheckBound(instantiated_bounded_type, | 17312 (!type_param.CheckBound(instantiated_bounded_type, |
17311 instantiated_upper_bound, | 17313 instantiated_upper_bound, |
17312 bound_error, | 17314 bound_error, |
17313 bound_trail, | 17315 bound_trail, |
17314 space) && | 17316 space) && |
17315 bound_error->IsNull())) { | 17317 bound_error->IsNull())) { |
17316 // We cannot determine yet whether the bounded_type is below the | 17318 // We cannot determine yet whether the bounded_type is below the |
17317 // upper_bound, because one or both of them is still being finalized or | 17319 // upper_bound, because one or both of them is still being finalized or |
17318 // uninstantiated. | 17320 // uninstantiated. For example, instantiated_bounded_type may be the |
| 17321 // still unfinalized cloned type parameter of a mixin application class. |
17319 ASSERT(instantiated_bounded_type.IsBeingFinalized() || | 17322 ASSERT(instantiated_bounded_type.IsBeingFinalized() || |
17320 instantiated_upper_bound.IsBeingFinalized() || | 17323 instantiated_upper_bound.IsBeingFinalized() || |
17321 !instantiated_bounded_type.IsInstantiated() || | 17324 !instantiated_bounded_type.IsInstantiated() || |
17322 !instantiated_upper_bound.IsInstantiated()); | 17325 !instantiated_upper_bound.IsInstantiated()); |
17323 // Postpone bound check by returning a new BoundedType with unfinalized | 17326 // Postpone bound check by returning a new BoundedType with unfinalized |
17324 // or partially instantiated bounded_type and upper_bound, but keeping | 17327 // or partially instantiated bounded_type and upper_bound, but keeping |
17325 // type_param. | 17328 // type_param. |
17326 instantiated_bounded_type = BoundedType::New(instantiated_bounded_type, | 17329 instantiated_bounded_type = BoundedType::New(instantiated_bounded_type, |
17327 instantiated_upper_bound, | 17330 instantiated_upper_bound, |
17328 type_param); | 17331 type_param); |
(...skipping 4693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22022 return UserTag::null(); | 22025 return UserTag::null(); |
22023 } | 22026 } |
22024 | 22027 |
22025 | 22028 |
22026 const char* UserTag::ToCString() const { | 22029 const char* UserTag::ToCString() const { |
22027 const String& tag_label = String::Handle(label()); | 22030 const String& tag_label = String::Handle(label()); |
22028 return tag_label.ToCString(); | 22031 return tag_label.ToCString(); |
22029 } | 22032 } |
22030 | 22033 |
22031 } // namespace dart | 22034 } // namespace dart |
OLD | NEW |