Chromium Code Reviews| Index: runtime/lib/mirrors.cc |
| diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc |
| index 89774e53c8961ac7be513c967907856c5ba3b48e..d06360c2c619b158e4192eb006d7219a82231340 100644 |
| --- a/runtime/lib/mirrors.cc |
| +++ b/runtime/lib/mirrors.cc |
| @@ -566,62 +566,16 @@ static Dart_Handle CreateMethodMirror(Dart_Handle func, |
| 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(), |
| }; |
| Dart_Handle mirror = |
| Dart_New(mirror_type, Dart_Null(), ARRAY_SIZE(args), args); |
| @@ -1814,7 +1768,6 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invokeSetter, 4) { |
| return value.raw(); |
| } |
| - |
| DEFINE_NATIVE_ENTRY(MethodMirror_name, 1) { |
| const MirrorReference& func_ref = |
| MirrorReference::CheckedHandle(arguments->NativeArgAt(0)); |
| @@ -1823,4 +1776,38 @@ DEFINE_NATIVE_ENTRY(MethodMirror_name, 1) { |
| return func.UserVisibleName(); |
| } |
| +// Keep in sync with _propertyIsXXX in mirrors_impl.dart. |
| +enum MethodMirrorProperty { |
| + isStatic = 0, |
|
rmacnak
2013/07/16 20:44:53
VM code tends to prefix constants like these with
Michael Lippautz (Google)
2013/07/16 21:14:00
Done.
|
| + isAbstract, |
| + isGetter, |
| + isSetter, |
| + isConstructor, |
| +}; |
| + |
| +DEFINE_NATIVE_ENTRY(MethodMirror_get_property, 2) { |
| + const MirrorReference& func_ref = |
| + MirrorReference::CheckedHandle(arguments->NativeArgAt(0)); |
| + const Smi& property = |
| + Smi::CheckedHandle(arguments->NativeArgAt(1)); |
| + Function& func = Function::Handle(); |
| + func ^= func_ref.referent(); |
| + switch (property.Value()) { |
| + case isStatic: |
| + return Bool::Get(func.is_static()); |
| + case isAbstract: |
| + return Bool::Get(func.is_abstract()); |
| + case isGetter: |
| + return Bool::Get(func.IsGetterFunction()); |
| + case isSetter: |
| + return Bool::Get(func.IsSetterFunction()); |
| + case isConstructor: |
| + return Bool::Get(func.IsConstructor()); |
| + default: |
| + UNREACHABLE(); |
| + } |
| + UNREACHABLE(); |
| + return NULL; |
|
rmacnak
2013/07/16 20:44:53
Instance::null()
Michael Lippautz (Google)
2013/07/16 21:14:00
Done.
|
| +} |
| + |
| } // namespace dart |