| 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 14183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14194 bool TypeParameter::CheckBound(const AbstractType& bounded_type, | 14194 bool TypeParameter::CheckBound(const AbstractType& bounded_type, |
| 14195 const AbstractType& upper_bound, | 14195 const AbstractType& upper_bound, |
| 14196 Error* bound_error) const { | 14196 Error* bound_error) const { |
| 14197 ASSERT((bound_error != NULL) && bound_error->IsNull()); | 14197 ASSERT((bound_error != NULL) && bound_error->IsNull()); |
| 14198 ASSERT(bounded_type.IsFinalized()); | 14198 ASSERT(bounded_type.IsFinalized()); |
| 14199 ASSERT(upper_bound.IsFinalized()); | 14199 ASSERT(upper_bound.IsFinalized()); |
| 14200 ASSERT(!bounded_type.IsMalformed()); | 14200 ASSERT(!bounded_type.IsMalformed()); |
| 14201 if (bounded_type.IsSubtypeOf(upper_bound, bound_error)) { | 14201 if (bounded_type.IsSubtypeOf(upper_bound, bound_error)) { |
| 14202 return true; | 14202 return true; |
| 14203 } | 14203 } |
| 14204 if (bound_error->IsNull()) { | 14204 // Set bound_error if the caller is interested and if this is the first error. |
| 14205 if ((bound_error != NULL) && bound_error->IsNull()) { |
| 14205 // Report the bound error only if both the bounded type and the upper bound | 14206 // Report the bound error only if both the bounded type and the upper bound |
| 14206 // are instantiated. Otherwise, we cannot tell yet it is a bound error. | 14207 // are instantiated. Otherwise, we cannot tell yet it is a bound error. |
| 14207 if (bounded_type.IsInstantiated() && upper_bound.IsInstantiated()) { | 14208 if (bounded_type.IsInstantiated() && upper_bound.IsInstantiated()) { |
| 14208 const String& bounded_type_name = String::Handle( | 14209 const String& bounded_type_name = String::Handle( |
| 14209 bounded_type.UserVisibleName()); | 14210 bounded_type.UserVisibleName()); |
| 14210 const String& upper_bound_name = String::Handle( | 14211 const String& upper_bound_name = String::Handle( |
| 14211 upper_bound.UserVisibleName()); | 14212 upper_bound.UserVisibleName()); |
| 14212 const AbstractType& declared_bound = AbstractType::Handle(bound()); | 14213 const AbstractType& declared_bound = AbstractType::Handle(bound()); |
| 14213 const String& declared_bound_name = String::Handle( | 14214 const String& declared_bound_name = String::Handle( |
| 14214 declared_bound.UserVisibleName()); | 14215 declared_bound.UserVisibleName()); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14423 const TypeArguments& instantiator_type_arguments, | 14424 const TypeArguments& instantiator_type_arguments, |
| 14424 Error* bound_error, | 14425 Error* bound_error, |
| 14425 GrowableObjectArray* trail) const { | 14426 GrowableObjectArray* trail) const { |
| 14426 ASSERT(IsFinalized()); | 14427 ASSERT(IsFinalized()); |
| 14427 AbstractType& bounded_type = AbstractType::Handle(type()); | 14428 AbstractType& bounded_type = AbstractType::Handle(type()); |
| 14428 if (!bounded_type.IsInstantiated()) { | 14429 if (!bounded_type.IsInstantiated()) { |
| 14429 bounded_type = bounded_type.InstantiateFrom(instantiator_type_arguments, | 14430 bounded_type = bounded_type.InstantiateFrom(instantiator_type_arguments, |
| 14430 bound_error, | 14431 bound_error, |
| 14431 trail); | 14432 trail); |
| 14432 } | 14433 } |
| 14433 if (FLAG_enable_type_checks && bound_error->IsNull()) { | 14434 if (FLAG_enable_type_checks && |
| 14435 (bound_error != NULL) && bound_error->IsNull()) { |
| 14434 AbstractType& upper_bound = AbstractType::Handle(bound()); | 14436 AbstractType& upper_bound = AbstractType::Handle(bound()); |
| 14435 ASSERT(!upper_bound.IsObjectType() && !upper_bound.IsDynamicType()); | 14437 ASSERT(!upper_bound.IsObjectType() && !upper_bound.IsDynamicType()); |
| 14436 const TypeParameter& type_param = TypeParameter::Handle(type_parameter()); | 14438 const TypeParameter& type_param = TypeParameter::Handle(type_parameter()); |
| 14437 if (!upper_bound.IsInstantiated()) { | 14439 if (!upper_bound.IsInstantiated()) { |
| 14438 upper_bound = upper_bound.InstantiateFrom(instantiator_type_arguments, | 14440 upper_bound = upper_bound.InstantiateFrom(instantiator_type_arguments, |
| 14439 bound_error, | 14441 bound_error, |
| 14440 trail); | 14442 trail); |
| 14441 } | 14443 } |
| 14442 if (bound_error->IsNull()) { | 14444 if (bound_error->IsNull()) { |
| 14443 if (!type_param.CheckBound(bounded_type, upper_bound, bound_error) && | 14445 if (!type_param.CheckBound(bounded_type, upper_bound, bound_error) && |
| (...skipping 4018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18462 return tag_label.ToCString(); | 18464 return tag_label.ToCString(); |
| 18463 } | 18465 } |
| 18464 | 18466 |
| 18465 | 18467 |
| 18466 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { | 18468 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 18467 Instance::PrintToJSONStream(stream, ref); | 18469 Instance::PrintToJSONStream(stream, ref); |
| 18468 } | 18470 } |
| 18469 | 18471 |
| 18470 | 18472 |
| 18471 } // namespace dart | 18473 } // namespace dart |
| OLD | NEW |