| Index: runtime/lib/mirrors.cc
|
| ===================================================================
|
| --- runtime/lib/mirrors.cc (revision 25060)
|
| +++ runtime/lib/mirrors.cc (working copy)
|
| @@ -631,7 +631,7 @@
|
|
|
| static Dart_Handle CreateVariableMirror(Dart_Handle var,
|
| Dart_Handle var_name,
|
| - Dart_Handle lib_mirror) {
|
| + Dart_Handle owner_mirror) {
|
| ASSERT(Dart_IsVariable(var));
|
| Dart_Handle cls_name = NewString("_LocalVariableMirrorImpl");
|
| Dart_Handle type = Dart_GetType(MirrorLib(), cls_name, 0, NULL);
|
| @@ -657,8 +657,9 @@
|
| }
|
|
|
| Dart_Handle args[] = {
|
| + CreateMirrorReference(var),
|
| var_name,
|
| - lib_mirror,
|
| + owner_mirror,
|
| CreateLazyMirror(var_type),
|
| Dart_NewBoolean(is_static),
|
| Dart_NewBoolean(is_final),
|
| @@ -1112,18 +1113,25 @@
|
| Dart_ExitScope();
|
| }
|
|
|
| -void NATIVE_ENTRY_FUNCTION(Mirrors_metadata)(Dart_NativeArguments args) {
|
| - Dart_EnterScope();
|
| - Dart_Handle mirror = Dart_GetNativeArgument(args, 0);
|
|
|
| - Dart_Handle reflectee = UnwrapMirror(mirror);
|
| - Dart_Handle result = Dart_GetMetadata(reflectee);
|
| - if (Dart_IsError(result)) {
|
| - Dart_PropagateError(result);
|
| +DEFINE_NATIVE_ENTRY(DeclarationMirror_metadata, 1) {
|
| + const MirrorReference& decl_ref =
|
| + MirrorReference::CheckedHandle(arguments->NativeArgAt(0));
|
| + const Object& decl = Object::Handle(decl_ref.referent());
|
| +
|
| + Class& klass = Class::Handle();
|
| + if (decl.IsClass()) {
|
| + klass ^= decl.raw();
|
| + } else if (decl.IsFunction()) {
|
| + klass = Function::Cast(decl).origin();
|
| + } else if (decl.IsField()) {
|
| + klass = Field::Cast(decl).origin();
|
| + } else {
|
| + return Object::empty_array().raw();
|
| }
|
| - ASSERT(Dart_IsList(result));
|
| - Dart_SetReturnValue(args, result);
|
| - Dart_ExitScope();
|
| +
|
| + const Library& library = Library::Handle(klass.library());
|
| + return library.GetMetadata(decl);
|
| }
|
|
|
|
|
|
|