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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 Bool::True(), // is_declaration | 886 Bool::True(), // is_declaration |
887 Object::null_instance()); | 887 Object::null_instance()); |
888 } | 888 } |
889 | 889 |
890 | 890 |
891 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) { | 891 DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) { |
892 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); | 892 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0)); |
893 return CreateTypeMirror(type); | 893 return CreateTypeMirror(type); |
894 } | 894 } |
895 | 895 |
| 896 |
896 DEFINE_NATIVE_ENTRY(Mirrors_mangleName, 2) { | 897 DEFINE_NATIVE_ENTRY(Mirrors_mangleName, 2) { |
897 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); | 898 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); |
898 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); | 899 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); |
899 const Library& lib = Library::Handle(ref.GetLibraryReferent()); | 900 const Library& lib = Library::Handle(ref.GetLibraryReferent()); |
900 return lib.IsPrivate(name) ? lib.PrivateName(name) : name.raw(); | 901 return lib.IsPrivate(name) ? lib.PrivateName(name) : name.raw(); |
901 } | 902 } |
902 | 903 |
903 DEFINE_NATIVE_ENTRY(Mirrors_unmangleName, 1) { | |
904 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); | |
905 // It would be nice to unconditionally use IdentifierPrettyName, alas it | |
906 // cannot cope with the symbols for the names of anonymous mixin applications. | |
907 if (Library::IsPrivate(name) || | |
908 Field::IsGetterName(name) || | |
909 Field::IsSetterName(name)) { | |
910 return String::IdentifierPrettyName(name); | |
911 } | |
912 return name.raw(); | |
913 } | |
914 | |
915 | 904 |
916 DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) { | 905 DEFINE_NATIVE_ENTRY(MirrorReference_equals, 2) { |
917 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0)); | 906 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0)); |
918 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1)); | 907 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1)); |
919 return Bool::Get(a.referent() == b.referent()).raw(); | 908 return Bool::Get(a.referent() == b.referent()).raw(); |
920 } | 909 } |
921 | 910 |
922 | 911 |
923 DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) { | 912 DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) { |
924 GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); | 913 GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0)); |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 } | 1949 } |
1961 | 1950 |
1962 | 1951 |
1963 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1952 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
1964 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1953 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1965 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1954 const Field& field = Field::Handle(ref.GetFieldReferent()); |
1966 return field.type(); | 1955 return field.type(); |
1967 } | 1956 } |
1968 | 1957 |
1969 } // namespace dart | 1958 } // namespace dart |
OLD | NEW |