| 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 2827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 // Check for 'direct super type' specified in the implements clause | 2838 // Check for 'direct super type' specified in the implements clause |
| 2839 // and check for transitivity at the same time. | 2839 // and check for transitivity at the same time. |
| 2840 Array& interfaces = Array::Handle(thsi.interfaces()); | 2840 Array& interfaces = Array::Handle(thsi.interfaces()); |
| 2841 AbstractType& interface = AbstractType::Handle(); | 2841 AbstractType& interface = AbstractType::Handle(); |
| 2842 Class& interface_class = Class::Handle(); | 2842 Class& interface_class = Class::Handle(); |
| 2843 AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); | 2843 AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); |
| 2844 Error& error = Error::Handle(); | 2844 Error& error = Error::Handle(); |
| 2845 for (intptr_t i = 0; i < interfaces.Length(); i++) { | 2845 for (intptr_t i = 0; i < interfaces.Length(); i++) { |
| 2846 interface ^= interfaces.At(i); | 2846 interface ^= interfaces.At(i); |
| 2847 if (!interface.IsFinalized()) { | 2847 if (!interface.IsFinalized()) { |
| 2848 // We may be checking bounds at finalization time. Skipping this | 2848 // We may be checking bounds at finalization time and can encounter |
| 2849 // unfinalized interface will postpone bound checking to run time. | 2849 // a still unfinalized interface. |
| 2850 continue; | 2850 ClassFinalizer::FinalizeType( |
| 2851 thsi, interface, ClassFinalizer::kCanonicalize); |
| 2852 interfaces.SetAt(i, interface); |
| 2851 } | 2853 } |
| 2852 error = Error::null(); | 2854 error = Error::null(); |
| 2853 if (interface.IsMalboundedWithError(&error)) { | 2855 if (interface.IsMalboundedWithError(&error)) { |
| 2854 // Return the first bound error to the caller if it requests it. | 2856 // Return the first bound error to the caller if it requests it. |
| 2855 if ((bound_error != NULL) && bound_error->IsNull()) { | 2857 if ((bound_error != NULL) && bound_error->IsNull()) { |
| 2856 ASSERT(!error.IsNull()); | 2858 ASSERT(!error.IsNull()); |
| 2857 *bound_error = error.raw(); | 2859 *bound_error = error.raw(); |
| 2858 } | 2860 } |
| 2859 continue; // Another interface may work better. | 2861 continue; // Another interface may work better. |
| 2860 } | 2862 } |
| (...skipping 9536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12397 const BoundedType& result = BoundedType::Handle(BoundedType::New()); | 12399 const BoundedType& result = BoundedType::Handle(BoundedType::New()); |
| 12398 result.set_type(type); | 12400 result.set_type(type); |
| 12399 result.set_bound(bound); | 12401 result.set_bound(bound); |
| 12400 result.set_type_parameter(type_parameter); | 12402 result.set_type_parameter(type_parameter); |
| 12401 result.set_is_being_checked(false); | 12403 result.set_is_being_checked(false); |
| 12402 return result.raw(); | 12404 return result.raw(); |
| 12403 } | 12405 } |
| 12404 | 12406 |
| 12405 | 12407 |
| 12406 const char* BoundedType::ToCString() const { | 12408 const char* BoundedType::ToCString() const { |
| 12407 const char* format = "BoundedType: type %s; bound: %s; type param: %s of %s"; | 12409 const char* format = "BoundedType: type %s; bound: %s; type param: %s%s%s"; |
| 12408 const char* type_cstr = String::Handle(AbstractType::Handle( | 12410 const char* type_cstr = String::Handle(AbstractType::Handle( |
| 12409 type()).Name()).ToCString(); | 12411 type()).Name()).ToCString(); |
| 12410 const char* bound_cstr = String::Handle(AbstractType::Handle( | 12412 const char* bound_cstr = String::Handle(AbstractType::Handle( |
| 12411 bound()).Name()).ToCString(); | 12413 bound()).Name()).ToCString(); |
| 12412 const char* type_param_cstr = String::Handle(TypeParameter::Handle( | 12414 const TypeParameter& type_param = TypeParameter::Handle(type_parameter()); |
| 12413 type_parameter()).name()).ToCString(); | 12415 const char* type_param_cstr = "null"; |
| 12414 const Class& cls = Class::Handle(TypeParameter::Handle( | 12416 const char* of_cstr = ""; |
| 12415 type_parameter()).parameterized_class()); | 12417 const char* cls_cstr = ""; |
| 12416 const char* cls_cstr = | 12418 if (!type_param.IsNull()) { |
| 12417 cls.IsNull() ? " null" : String::Handle(cls.Name()).ToCString(); | 12419 type_param_cstr = String::Handle(type_param.name()).ToCString(); |
| 12418 intptr_t len = OS::SNPrint( | 12420 const Class& cls = Class::Handle(type_param.parameterized_class()); |
| 12419 NULL, 0, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr) + 1; | 12421 if (!cls.IsNull()) { |
| 12422 of_cstr = " of "; |
| 12423 cls_cstr = String::Handle(cls.Name()).ToCString(); |
| 12424 } |
| 12425 } |
| 12426 intptr_t len = OS::SNPrint(NULL, 0, format, type_cstr, bound_cstr, |
| 12427 type_param_cstr, of_cstr, cls_cstr) + 1; |
| 12420 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 12428 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 12421 OS::SNPrint( | 12429 OS::SNPrint(chars, len, format, type_cstr, bound_cstr, type_param_cstr, |
| 12422 chars, len, format, type_cstr, bound_cstr, type_param_cstr, cls_cstr); | 12430 of_cstr, cls_cstr); |
| 12423 return chars; | 12431 return chars; |
| 12424 } | 12432 } |
| 12425 | 12433 |
| 12426 | 12434 |
| 12427 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { | 12435 void BoundedType::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 12428 JSONObject jsobj(stream); | 12436 JSONObject jsobj(stream); |
| 12429 } | 12437 } |
| 12430 | 12438 |
| 12431 | 12439 |
| 12432 intptr_t MixinAppType::token_pos() const { | 12440 intptr_t MixinAppType::token_pos() const { |
| (...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15781 return "_MirrorReference"; | 15789 return "_MirrorReference"; |
| 15782 } | 15790 } |
| 15783 | 15791 |
| 15784 | 15792 |
| 15785 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15793 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 15786 JSONObject jsobj(stream); | 15794 JSONObject jsobj(stream); |
| 15787 } | 15795 } |
| 15788 | 15796 |
| 15789 | 15797 |
| 15790 } // namespace dart | 15798 } // namespace dart |
| OLD | NEW |