Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: runtime/lib/mirrors.cc

Issue 19299003: Moved some MethodMirror properties from embedded API to native calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | tests/lib/mirrors/method_mirror_name_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 89774e53c8961ac7be513c967907856c5ba3b48e..1cb1c748c48bd91f39c824440b14fdc3cab93de1 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -559,69 +559,37 @@ static Dart_Handle CreateClassMirror(Dart_Handle intf,
static Dart_Handle CreateMethodMirror(Dart_Handle func,
Dart_Handle owner_mirror) {
- ASSERT(Dart_IsFunction(func));
+ // TODO(11742): Unwrapping is needed until the whole method is converted.
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ const Function& func_obj = Api::UnwrapFunctionHandle(isolate, func);
+
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(),
+ func_obj.is_static() ? Api::True() : Api::False(),
+ func_obj.is_abstract() ? Api::True() : Api::False(),
+ func_obj.IsGetterFunction() ? Api::True() : Api::False(),
+ func_obj.IsSetterFunction() ? Api::True() : Api::False(),
+ func_obj.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);
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | tests/lib/mirrors/method_mirror_name_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698