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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_debugger_api.h" | 6 #include "include/dart_debugger_api.h" |
7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/dart_api_state.h" // TODO(11742): Remove with CreateMirrorRef. | 9 #include "vm/dart_api_state.h" // TODO(11742): Remove with CreateMirrorRef. |
10 #include "vm/bootstrap_natives.h" | 10 #include "vm/bootstrap_natives.h" |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 Array::Handle(Array::New(number_of_arguments + 1)); // Plus receiver. | 726 Array::Handle(Array::New(number_of_arguments + 1)); // Plus receiver. |
727 Object& arg = Object::Handle(); | 727 Object& arg = Object::Handle(); |
728 args.SetAt(0, reflectee); | 728 args.SetAt(0, reflectee); |
729 for (int i = 0; i < number_of_arguments; i++) { | 729 for (int i = 0; i < number_of_arguments; i++) { |
730 arg = positional_args.At(i); | 730 arg = positional_args.At(i); |
731 args.SetAt(i + 1, arg); // Plus receiver. | 731 args.SetAt(i + 1, arg); // Plus receiver. |
732 } | 732 } |
733 | 733 |
734 ArgumentsDescriptor args_desc( | 734 ArgumentsDescriptor args_desc( |
735 Array::Handle(ArgumentsDescriptor::New(args.Length()))); | 735 Array::Handle(ArgumentsDescriptor::New(args.Length()))); |
736 // TODO(11771): This won't find private members. | 736 |
737 const Function& function = Function::Handle( | 737 Class& klass = Class::Handle(reflectee.clazz()); |
738 Resolver::ResolveDynamic(reflectee, | 738 Function& function = Function::Handle(); |
739 function_name, | 739 while (!klass.IsNull()) { |
740 args_desc)); | 740 function = klass.LookupDynamicFunctionAllowPrivate(function_name); |
| 741 if (!function.IsNull()) { |
| 742 break; |
| 743 } |
| 744 klass = klass.SuperClass(); |
| 745 } |
| 746 |
| 747 if (!function.IsNull() && |
| 748 !function.AreValidArguments(args_desc, NULL)) { |
| 749 function = Function::null(); |
| 750 } |
741 | 751 |
742 return ReflectivelyInvokeDynamicFunction(reflectee, | 752 return ReflectivelyInvokeDynamicFunction(reflectee, |
743 function, | 753 function, |
744 function_name, | 754 function_name, |
745 args); | 755 args); |
746 } | 756 } |
747 | 757 |
748 | 758 |
749 DEFINE_NATIVE_ENTRY(InstanceMirror_invokeGetter, 3) { | 759 DEFINE_NATIVE_ENTRY(InstanceMirror_invokeGetter, 3) { |
750 // Argument 0 is the mirror, which is unused by the native. It exists | 760 // Argument 0 is the mirror, which is unused by the native. It exists |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 | 1324 |
1315 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1325 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
1316 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1326 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1317 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1327 const Field& field = Field::Handle(ref.GetFieldReferent()); |
1318 | 1328 |
1319 const AbstractType& type = AbstractType::Handle(field.type()); | 1329 const AbstractType& type = AbstractType::Handle(field.type()); |
1320 return CreateTypeMirror(type); | 1330 return CreateTypeMirror(type); |
1321 } | 1331 } |
1322 | 1332 |
1323 } // namespace dart | 1333 } // namespace dart |
OLD | NEW |