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 "lib/mirrors.h" | 5 #include "lib/mirrors.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 | 509 |
510 | 510 |
511 static RawInstance* CreateTypeMirror(const AbstractType& type) { | 511 static RawInstance* CreateTypeMirror(const AbstractType& type) { |
512 if (type.IsTypeRef()) { | 512 if (type.IsTypeRef()) { |
513 AbstractType& ref_type = AbstractType::Handle(TypeRef::Cast(type).type()); | 513 AbstractType& ref_type = AbstractType::Handle(TypeRef::Cast(type).type()); |
514 ASSERT(!ref_type.IsTypeRef()); | 514 ASSERT(!ref_type.IsTypeRef()); |
515 ASSERT(ref_type.IsCanonical()); | 515 ASSERT(ref_type.IsCanonical()); |
516 return CreateTypeMirror(ref_type); | 516 return CreateTypeMirror(ref_type); |
517 } | 517 } |
518 ASSERT(type.IsFinalized()); | 518 ASSERT(type.IsFinalized()); |
519 PROPOGATE_IF_MALFOMRED(type); | 519 PROPOGATE_IF_MALFOMRED(type); |
regis
2015/05/29 22:16:50
Raelly? :-)
rmacnak
2015/05/29 22:22:01
'merikens can not spel.
| |
520 ASSERT(type.IsCanonical() || type.IsTypeParameter() || type.IsBoundedType()); | |
520 | 521 |
521 if (type.HasResolvedTypeClass()) { | 522 if (type.HasResolvedTypeClass()) { |
522 const Class& cls = Class::Handle(type.type_class()); | 523 const Class& cls = Class::Handle(type.type_class()); |
523 // Handle void and dynamic types. | 524 // Handle void and dynamic types. |
524 if (cls.IsVoidClass()) { | 525 if (cls.IsVoidClass()) { |
525 Array& args = Array::Handle(Array::New(1)); | 526 Array& args = Array::Handle(Array::New(1)); |
526 args.SetAt(0, Symbols::Void()); | 527 args.SetAt(0, Symbols::Void()); |
527 return CreateMirror(Symbols::_SpecialTypeMirror(), args); | 528 return CreateMirror(Symbols::_SpecialTypeMirror(), args); |
528 } else if (cls.IsDynamicClass()) { | 529 } else if (cls.IsDynamicClass()) { |
529 Array& args = Array::Handle(Array::New(1)); | 530 Array& args = Array::Handle(Array::New(1)); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 // a special null instance. This is different from a field being null. Callers | 757 // a special null instance. This is different from a field being null. Callers |
757 // make sure that this null does not leak into Dartland. | 758 // make sure that this null does not leak into Dartland. |
758 return Object::sentinel().raw(); | 759 return Object::sentinel().raw(); |
759 } | 760 } |
760 | 761 |
761 | 762 |
762 static RawAbstractType* InstantiateType(const AbstractType& type, | 763 static RawAbstractType* InstantiateType(const AbstractType& type, |
763 const AbstractType& instantiator) { | 764 const AbstractType& instantiator) { |
764 ASSERT(type.IsFinalized()); | 765 ASSERT(type.IsFinalized()); |
765 PROPOGATE_IF_MALFOMRED(type); | 766 PROPOGATE_IF_MALFOMRED(type); |
767 ASSERT(type.IsCanonical() || type.IsTypeParameter() || type.IsBoundedType()); | |
766 | 768 |
767 if (type.IsInstantiated() || instantiator.IsNull()) { | 769 if (type.IsInstantiated() || instantiator.IsNull()) { |
768 return type.Canonicalize(); | 770 return type.Canonicalize(); |
769 } | 771 } |
770 | 772 |
771 ASSERT(!instantiator.IsNull()); | 773 ASSERT(!instantiator.IsNull()); |
772 ASSERT(instantiator.IsFinalized()); | 774 ASSERT(instantiator.IsFinalized()); |
773 PROPOGATE_IF_MALFOMRED(instantiator); | 775 PROPOGATE_IF_MALFOMRED(instantiator); |
774 | 776 |
775 const TypeArguments& type_args = | 777 const TypeArguments& type_args = |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2071 } | 2073 } |
2072 | 2074 |
2073 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { | 2075 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { |
2074 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2076 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2075 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2077 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2076 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); | 2078 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); |
2077 } | 2079 } |
2078 | 2080 |
2079 | 2081 |
2080 } // namespace dart | 2082 } // namespace dart |
OLD | NEW |