OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 | 6 |
7 #include "vm/exceptions.h" | 7 #include "vm/exceptions.h" |
8 #include "vm/native_entry.h" | 8 #include "vm/native_entry.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // found. | 36 // found. |
37 Class& instance_class = Class::Handle(instance.clazz()); | 37 Class& instance_class = Class::Handle(instance.clazz()); |
38 Function& function = | 38 Function& function = |
39 Function::Handle(instance_class.LookupDynamicFunction(function_name)); | 39 Function::Handle(instance_class.LookupDynamicFunction(function_name)); |
40 while (function.IsNull()) { | 40 while (function.IsNull()) { |
41 instance_class = instance_class.SuperClass(); | 41 instance_class = instance_class.SuperClass(); |
42 if (instance_class.IsNull()) break; | 42 if (instance_class.IsNull()) break; |
43 function = instance_class.LookupDynamicFunction(function_name); | 43 function = instance_class.LookupDynamicFunction(function_name); |
44 } | 44 } |
45 if (!function.IsNull()) { | 45 if (!function.IsNull()) { |
46 const int total_num_parameters = | 46 const int total_num_parameters = function.NumberOfParameters(); |
47 function.num_fixed_parameters() + function.num_optional_parameters(); | |
48 const Array& array = Array::Handle(Array::New(total_num_parameters - 1)); | 47 const Array& array = Array::Handle(Array::New(total_num_parameters - 1)); |
49 // Skip receiver. | 48 // Skip receiver. |
50 for (int i = 1; i < total_num_parameters; i++) { | 49 for (int i = 1; i < total_num_parameters; i++) { |
51 array.SetAt(i - 1, String::Handle(function.ParameterNameAt(i))); | 50 array.SetAt(i - 1, String::Handle(function.ParameterNameAt(i))); |
52 } | 51 } |
53 dart_arguments.Add(&array); | 52 dart_arguments.Add(&array); |
54 } | 53 } |
55 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); | 54 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); |
56 return Object::null(); | 55 return Object::null(); |
57 } | 56 } |
58 | 57 |
59 } // namespace dart | 58 } // namespace dart |
OLD | NEW |