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