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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 Function::Handle(getter.ImplicitClosureFunction()); | 682 Function::Handle(getter.ImplicitClosureFunction()); |
683 return closure_function.ImplicitStaticClosure(); | 683 return closure_function.ImplicitStaticClosure(); |
684 } | 684 } |
685 } | 685 } |
686 } else { | 686 } else { |
687 if (!field.IsUninitialized()) { | 687 if (!field.IsUninitialized()) { |
688 return field.StaticValue(); | 688 return field.StaticValue(); |
689 } | 689 } |
690 // An uninitialized field was found. Check for a getter in the field's | 690 // An uninitialized field was found. Check for a getter in the field's |
691 // owner classs. | 691 // owner classs. |
692 const Class& klass = Class::Handle(field.owner()); | 692 const Class& klass = Class::Handle(field.Owner()); |
693 const String& internal_getter_name = | 693 const String& internal_getter_name = |
694 String::Handle(Field::GetterName(getter_name)); | 694 String::Handle(Field::GetterName(getter_name)); |
695 getter = klass.LookupStaticFunction(internal_getter_name); | 695 getter = klass.LookupStaticFunction(internal_getter_name); |
696 } | 696 } |
697 | 697 |
698 if (!getter.IsNull() && getter.is_reflectable()) { | 698 if (!getter.IsNull() && getter.is_reflectable()) { |
699 // Invoke the getter and return the result. | 699 // Invoke the getter and return the result. |
700 const Object& result = Object::Handle( | 700 const Object& result = Object::Handle( |
701 DartEntry::InvokeFunction(getter, Object::empty_array())); | 701 DartEntry::InvokeFunction(getter, Object::empty_array())); |
702 return ReturnResult(result); | 702 return ReturnResult(result); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 Class& klass = Class::Handle(); | 876 Class& klass = Class::Handle(); |
877 Library& library = Library::Handle(); | 877 Library& library = Library::Handle(); |
878 | 878 |
879 if (decl.IsClass()) { | 879 if (decl.IsClass()) { |
880 klass ^= decl.raw(); | 880 klass ^= decl.raw(); |
881 library = klass.library(); | 881 library = klass.library(); |
882 } else if (decl.IsFunction()) { | 882 } else if (decl.IsFunction()) { |
883 klass = Function::Cast(decl).origin(); | 883 klass = Function::Cast(decl).origin(); |
884 library = klass.library(); | 884 library = klass.library(); |
885 } else if (decl.IsField()) { | 885 } else if (decl.IsField()) { |
886 klass = Field::Cast(decl).origin(); | 886 klass = Field::Cast(decl).Origin(); |
887 library = klass.library(); | 887 library = klass.library(); |
888 } else if (decl.IsLibrary()) { | 888 } else if (decl.IsLibrary()) { |
889 library ^= decl.raw(); | 889 library ^= decl.raw(); |
890 } else if (decl.IsTypeParameter()) { | 890 } else if (decl.IsTypeParameter()) { |
891 klass ^= TypeParameter::Cast(decl).parameterized_class(); | 891 klass ^= TypeParameter::Cast(decl).parameterized_class(); |
892 library = klass.library(); | 892 library = klass.library(); |
893 } else { | 893 } else { |
894 return Object::empty_array().raw(); | 894 return Object::empty_array().raw(); |
895 } | 895 } |
896 | 896 |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 if (cls.is_synthesized_class() && | 1986 if (cls.is_synthesized_class() && |
1987 !is_typedef && | 1987 !is_typedef && |
1988 !cls.is_mixin_app_alias() && | 1988 !cls.is_mixin_app_alias() && |
1989 !cls.is_enum_class()) { | 1989 !cls.is_enum_class()) { |
1990 return Instance::null(); // Synthetic. | 1990 return Instance::null(); // Synthetic. |
1991 } | 1991 } |
1992 script = cls.script(); | 1992 script = cls.script(); |
1993 token_pos = cls.token_pos(); | 1993 token_pos = cls.token_pos(); |
1994 } else if (decl.IsField()) { | 1994 } else if (decl.IsField()) { |
1995 const Field& field = Field::Cast(decl); | 1995 const Field& field = Field::Cast(decl); |
1996 script = field.script(); | 1996 script = field.Script(); |
1997 token_pos = field.token_pos(); | 1997 token_pos = field.token_pos(); |
1998 } else if (decl.IsTypeParameter()) { | 1998 } else if (decl.IsTypeParameter()) { |
1999 const TypeParameter& type_var = TypeParameter::Cast(decl); | 1999 const TypeParameter& type_var = TypeParameter::Cast(decl); |
2000 const Class& owner = Class::Handle(type_var.parameterized_class()); | 2000 const Class& owner = Class::Handle(type_var.parameterized_class()); |
2001 script = owner.script(); | 2001 script = owner.script(); |
2002 token_pos = type_var.token_pos(); | 2002 token_pos = type_var.token_pos(); |
2003 } else if (decl.IsLibrary()) { | 2003 } else if (decl.IsLibrary()) { |
2004 const Library& lib = Library::Cast(decl); | 2004 const Library& lib = Library::Cast(decl); |
2005 if (lib.raw() == Library::NativeWrappersLibrary()) { | 2005 if (lib.raw() == Library::NativeWrappersLibrary()) { |
2006 return Instance::null(); // No source. | 2006 return Instance::null(); // No source. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 | 2086 |
2087 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { | 2087 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { |
2088 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2088 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2089 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2089 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2090 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); | 2090 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); |
2091 } | 2091 } |
2092 | 2092 |
2093 #endif // !PRODUCT | 2093 #endif // !PRODUCT |
2094 | 2094 |
2095 } // namespace dart | 2095 } // namespace dart |
OLD | NEW |