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/invocation_mirror.h" | 5 #include "lib/invocation_mirror.h" |
6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 Bool::True(), // is_declaration | 887 Bool::True(), // is_declaration |
888 Object::null_instance()); | 888 Object::null_instance()); |
889 } | 889 } |
890 | 890 |
891 | 891 |
892 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) { | 892 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) { |
893 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); | 893 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); |
894 return CreateTypeMirror(type); | 894 return CreateTypeMirror(type); |
895 } | 895 } |
896 | 896 |
| 897 |
897 DEFINE_NATIVE_ENTRY(Mirrors_mangleName, 2) { | 898 DEFINE_NATIVE_ENTRY(Mirrors_mangleName, 2) { |
898 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); | 899 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); |
899 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); | 900 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); |
900 const Library& lib = Library::Handle(ref.GetLibraryReferent()); | 901 const Library& lib = Library::Handle(ref.GetLibraryReferent()); |
901 return lib.IsPrivate(name) ? lib.PrivateName(name) : name.raw(); | 902 return lib.IsPrivate(name) ? lib.PrivateName(name) : name.raw(); |
902 } | 903 } |
903 | 904 |
904 DEFINE_NATIVE_ENTRY(Mirrors_unmangleName, 1) { | |
905 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); | |
906 // It would be nice to unconditionally use IdentifierPrettyName, alas it | |
907 // cannot cope with the symbols for the names of anonymous mixin applications. | |
908 if (Library::IsPrivate(name) || | |
909 Field::IsGetterName(name) || | |
910 Field::IsSetterName(name)) { | |
911 return String::IdentifierPrettyName(name); | |
912 } | |
913 return name.raw(); | |
914 } | |
915 | |
916 | 905 |
917 DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) { | 906 DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) { |
918 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0)); | 907 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0)); |
919 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1)); | 908 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1)); |
920 return Bool::Get(a.referent() == b.referent()).raw(); | 909 return Bool::Get(a.referent() == b.referent()).raw(); |
921 } | 910 } |
922 | 911 |
923 | 912 |
924 DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) { | 913 DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) { |
925 GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); | 914 GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 } | 1963 } |
1975 | 1964 |
1976 | 1965 |
1977 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1966 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
1978 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1967 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1979 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1968 const Field& field = Field::Handle(ref.GetFieldReferent()); |
1980 return field.type(); | 1969 return field.type(); |
1981 } | 1970 } |
1982 | 1971 |
1983 } // namespace dart | 1972 } // namespace dart |
OLD | NEW |