| Index: runtime/lib/mirrors.cc
|
| diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
|
| index c3d41173abe52333f770705303d5dd055a4bf9ac..f9a1dcfe72601c6914be68b8b67fe7fb1a8efcd5 100644
|
| --- a/runtime/lib/mirrors.cc
|
| +++ b/runtime/lib/mirrors.cc
|
| @@ -85,33 +85,6 @@ static Dart_Handle MirrorLib() {
|
| }
|
|
|
|
|
| -static Dart_Handle IsMethodMirror(Dart_Handle object, bool* is_mirror) {
|
| - Dart_Handle cls_name = NewString("MethodMirror");
|
| - Dart_Handle type = Dart_GetType(MirrorLib(), cls_name, 0, NULL);
|
| - if (Dart_IsError(type)) {
|
| - return type;
|
| - }
|
| - Dart_Handle result = Dart_ObjectIsType(object, type, is_mirror);
|
| - if (Dart_IsError(result)) {
|
| - return result;
|
| - }
|
| - return Dart_True(); // Indicates success. Result is in is_mirror.
|
| -}
|
| -
|
| -static Dart_Handle IsVariableMirror(Dart_Handle object, bool* is_mirror) {
|
| - Dart_Handle cls_name = NewString("VariableMirror");
|
| - Dart_Handle type = Dart_GetType(MirrorLib(), cls_name, 0, NULL);
|
| - if (Dart_IsError(type)) {
|
| - return type;
|
| - }
|
| - Dart_Handle result = Dart_ObjectIsType(object, type, is_mirror);
|
| - if (Dart_IsError(result)) {
|
| - return result;
|
| - }
|
| - return Dart_True(); // Indicates success. Result is in is_mirror.
|
| -}
|
| -
|
| -
|
| // TODO(11742): Remove once there are no more users of the Dart_Handle-based
|
| // VMReferences.
|
| static Dart_Handle CreateMirrorReference(Dart_Handle handle) {
|
| @@ -124,114 +97,6 @@ static Dart_Handle CreateMirrorReference(Dart_Handle handle) {
|
| }
|
|
|
|
|
| -static Dart_Handle StringFromSymbol(Dart_Handle symbol) {
|
| - Dart_Handle result = Dart_Invoke(MirrorLib(), NewString("_n"), 1, &symbol);
|
| - return result;
|
| -}
|
| -
|
| -
|
| -static Dart_Handle UnwrapVMReference(Dart_Handle vm_ref) {
|
| - // Retrieve the persistent handle from the VMReference
|
| - intptr_t perm_handle_value = 0;
|
| - Dart_Handle result =
|
| - Dart_GetNativeInstanceField(vm_ref, 0, &perm_handle_value);
|
| - if (Dart_IsError(result)) {
|
| - return result;
|
| - }
|
| - Dart_PersistentHandle perm_handle =
|
| - reinterpret_cast<Dart_PersistentHandle>(perm_handle_value);
|
| - ASSERT(perm_handle != NULL);
|
| - Dart_Handle handle = Dart_HandleFromPersistent(perm_handle);
|
| - ASSERT(handle != NULL);
|
| - ASSERT(!Dart_IsError(handle));
|
| - return handle;
|
| -}
|
| -
|
| -static Dart_Handle UnwrapMirror(Dart_Handle mirror);
|
| -
|
| -static Dart_Handle UnwrapObjectMirror(Dart_Handle mirror) {
|
| - Dart_Handle field_name = NewString("_reference");
|
| - Dart_Handle vm_ref = Dart_GetField(mirror, field_name);
|
| - if (Dart_IsError(vm_ref)) {
|
| - return vm_ref;
|
| - }
|
| - return UnwrapVMReference(vm_ref);
|
| -}
|
| -
|
| -
|
| -static Dart_Handle UnwrapMethodMirror(Dart_Handle methodMirror) {
|
| - Dart_Handle namefield_name = NewString("simpleName");
|
| - Dart_Handle name_ref = Dart_GetField(methodMirror, namefield_name);
|
| - if (Dart_IsError(name_ref)) {
|
| - return name_ref;
|
| - }
|
| - Dart_Handle ownerfield_name = NewString("_owner");
|
| - Dart_Handle owner_mirror = Dart_GetField(methodMirror, ownerfield_name);
|
| - if (Dart_IsError(owner_mirror)) {
|
| - return owner_mirror;
|
| - }
|
| - Dart_Handle owner = UnwrapMirror(owner_mirror);
|
| - if (Dart_IsError(owner)) {
|
| - return owner;
|
| - }
|
| - Dart_Handle func = Dart_LookupFunction(owner, StringFromSymbol(name_ref));
|
| - if (Dart_IsError(func)) {
|
| - return func;
|
| - }
|
| - ASSERT(!Dart_IsNull(func));
|
| - return func;
|
| -}
|
| -
|
| -static Dart_Handle UnwrapVariableMirror(Dart_Handle variableMirror) {
|
| - Dart_Handle namefield_name = NewString("simpleName");
|
| - Dart_Handle name_ref = Dart_GetField(variableMirror, namefield_name);
|
| - if (Dart_IsError(name_ref)) {
|
| - return name_ref;
|
| - }
|
| - Dart_Handle ownerfield_name = NewString("_owner");
|
| - Dart_Handle owner_mirror = Dart_GetField(variableMirror, ownerfield_name);
|
| - ASSERT(!Dart_IsNull(owner_mirror));
|
| - if (Dart_IsError(owner_mirror)) {
|
| - return owner_mirror;
|
| - }
|
| - Dart_Handle owner = UnwrapMirror(owner_mirror);
|
| - if (Dart_IsError(owner)) {
|
| - return owner;
|
| - }
|
| - Dart_Handle variable =
|
| - Dart_LookupVariable(owner, StringFromSymbol(name_ref));
|
| - if (Dart_IsError(variable)) {
|
| - return variable;
|
| - }
|
| - ASSERT(!Dart_IsNull(variable));
|
| - return variable;
|
| -}
|
| -
|
| -static Dart_Handle UnwrapMirror(Dart_Handle mirror) {
|
| - // Caveat Emptor:
|
| - // only works for ObjectMirrors, VariableMirrors and MethodMirrors
|
| - // and their subtypes
|
| - bool is_method_mirror = false;
|
| - Dart_Handle result = IsMethodMirror(mirror, &is_method_mirror);
|
| - if (Dart_IsError(result)) {
|
| - return result;
|
| - }
|
| - if (is_method_mirror) {
|
| - return UnwrapMethodMirror(mirror);
|
| - }
|
| - bool is_variable_mirror = false;
|
| - result = IsVariableMirror(mirror, &is_variable_mirror);
|
| - if (Dart_IsError(result)) {
|
| - return result;
|
| - }
|
| - if (is_variable_mirror) {
|
| - return UnwrapVariableMirror(mirror);
|
| - }
|
| - return UnwrapObjectMirror(mirror);
|
| - // will return nonsense if mirror is not an ObjectMirror
|
| -}
|
| -
|
| -
|
| static Dart_Handle CreateLazyMirror(Dart_Handle target);
|
|
|
|
|
|
|