Chromium Code Reviews| Index: runtime/lib/mirrors.cc |
| diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc |
| index 2e6f6afecb254018d482d81f3606d9e3a8494384..7e4770e3a5355ecf875f800741ed51195caafb6e 100644 |
| --- a/runtime/lib/mirrors.cc |
| +++ b/runtime/lib/mirrors.cc |
| @@ -236,6 +236,7 @@ static Dart_Handle CreateLazyMirror(Dart_Handle target); |
| static Dart_Handle CreateParameterMirrorList(Dart_Handle func) { |
| + ASSERT(Dart_IsFunction(func)); |
| int64_t fixed_param_count; |
| int64_t opt_param_count; |
| Dart_Handle result = Dart_FunctionParameterCounts(func, |
| @@ -257,13 +258,11 @@ static Dart_Handle CreateParameterMirrorList(Dart_Handle func) { |
| return param_type; |
| } |
| + Dart_Handle reflectee = CreateMirrorReference(func); |
| for (int64_t i = 0; i < param_count; i++) { |
| - Dart_Handle arg_type = Dart_FunctionParameterType(func, i); |
| - if (Dart_IsError(arg_type)) { |
| - return arg_type; |
| - } |
| Dart_Handle args[] = { |
| - CreateLazyMirror(arg_type), |
| + reflectee, |
| + Dart_NewInteger(i), |
| Dart_NewBoolean(i >= fixed_param_count), // optional param? |
|
siva
2013/07/23 00:02:29
(i >= fixed_param_count) ? Api::True() : Api::Fals
Michael Lippautz (Google)
2013/07/23 00:39:11
Done.
|
| }; |
| Dart_Handle param = |
| @@ -1863,4 +1862,14 @@ DEFINE_NATIVE_ENTRY(MethodMirror_return_type, 1) { |
| return CreateTypeMirror(return_type); |
| } |
| + |
| +DEFINE_NATIVE_ENTRY(ParameterMirror_type, 2) { |
| + GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| + GET_NON_NULL_NATIVE_ARGUMENT(Smi, pos, arguments->NativeArgAt(1)); |
| + const Function& func = Function::Handle(ref.GetFunctionReferent()); |
| + const AbstractType& param_type = AbstractType::Handle(func.ParameterTypeAt( |
| + func.NumImplicitParameters() + pos.Value())); |
| + return CreateTypeMirror(param_type); |
| +} |
| + |
| } // namespace dart |