| Index: runtime/lib/mirrors.cc
|
| diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
|
| index ebd9517553d3085d1fbd4520d6e79d4ac9b4340c..d56bc320c5ee781c3a1255b44ad1840ca726c0cb 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,
|
| @@ -258,12 +259,9 @@ static Dart_Handle CreateParameterMirrorList(Dart_Handle 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),
|
| + CreateMirrorReference(func),
|
| + Dart_NewInteger(i),
|
| Dart_NewBoolean(i >= fixed_param_count), // optional param?
|
| };
|
| Dart_Handle param =
|
| @@ -1918,4 +1916,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
|
|
|