Index: runtime/lib/mirrors.cc |
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc |
index 89774e53c8961ac7be513c967907856c5ba3b48e..ac03ba2a04c9184de9e0019511ad4cabe06ac355 100644 |
--- a/runtime/lib/mirrors.cc |
+++ b/runtime/lib/mirrors.cc |
@@ -560,68 +560,37 @@ static Dart_Handle CreateClassMirror(Dart_Handle intf, |
static Dart_Handle CreateMethodMirror(Dart_Handle func, |
Dart_Handle owner_mirror) { |
ASSERT(Dart_IsFunction(func)); |
siva
2013/07/16 22:48:42
Api::UnwrapFunctionHandle has a check to ensure it
Michael Lippautz (Google)
2013/07/17 00:42:15
Done.
|
+ // TODO(11742): Unwrapping is needed until the whole method is converted. |
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ const Function& f = Api::UnwrapFunctionHandle(isolate, func); |
siva
2013/07/16 22:48:42
'f' seems like a cryptic name, maybe 'func_obj' la
Michael Lippautz (Google)
2013/07/17 00:42:15
Done.
|
+ |
Dart_Handle mirror_cls_name = NewString("_LocalMethodMirrorImpl"); |
Dart_Handle mirror_type = Dart_GetType(MirrorLib(), mirror_cls_name, 0, NULL); |
if (Dart_IsError(mirror_type)) { |
return mirror_type; |
} |
- bool is_static = false; |
- bool is_abstract = false; |
- bool is_getter = false; |
- bool is_setter = false; |
- bool is_constructor = false; |
- |
- Dart_Handle result = Dart_FunctionIsStatic(func, &is_static); |
- if (Dart_IsError(result)) { |
- return result; |
- } |
- result = Dart_FunctionIsAbstract(func, &is_abstract); |
- if (Dart_IsError(result)) { |
- return result; |
- } |
- result = Dart_FunctionIsGetter(func, &is_getter); |
- if (Dart_IsError(result)) { |
- return result; |
- } |
- result = Dart_FunctionIsSetter(func, &is_setter); |
- if (Dart_IsError(result)) { |
- return result; |
- } |
- result = Dart_FunctionIsConstructor(func, &is_constructor); |
- if (Dart_IsError(result)) { |
- return result; |
- } |
- |
Dart_Handle return_type = Dart_FunctionReturnType(func); |
if (Dart_IsError(return_type)) { |
return return_type; |
} |
- int64_t fixed_param_count; |
- int64_t opt_param_count; |
- result = Dart_FunctionParameterCounts(func, |
- &fixed_param_count, |
- &opt_param_count); |
- if (Dart_IsError(result)) { |
- return result; |
- } |
- |
// TODO(turnidge): Implement constructor kinds (arguments 7 - 10). |
Dart_Handle args[] = { |
CreateMirrorReference(func), |
owner_mirror, |
CreateParameterMirrorList(func), |
CreateLazyMirror(return_type), |
- Dart_NewBoolean(is_static), |
- Dart_NewBoolean(is_abstract), |
- Dart_NewBoolean(is_getter), |
- Dart_NewBoolean(is_setter), |
- Dart_NewBoolean(is_constructor), |
- Dart_False(), |
- Dart_False(), |
- Dart_False(), |
- Dart_False(), |
+ f.is_static() ? Api::True() : Api::False(), |
+ f.is_abstract() ? Api::True() : Api::False(), |
+ f.IsGetterFunction() ? Api::True() : Api::False(), |
+ f.IsSetterFunction() ? Api::True() : Api::False(), |
+ f.IsConstructor() ? Api::True() : Api::False(), |
+ Api::False(), |
+ Api::False(), |
+ Api::False(), |
+ Api::False() |
}; |
Dart_Handle mirror = |
Dart_New(mirror_type, Dart_Null(), ARRAY_SIZE(args), args); |