Chromium Code Reviews| Index: runtime/lib/mirrors.cc |
| =================================================================== |
| --- runtime/lib/mirrors.cc (revision 24815) |
| +++ runtime/lib/mirrors.cc (working copy) |
| @@ -6,6 +6,7 @@ |
| #include "include/dart_debugger_api.h" |
| #include "include/dart_mirrors_api.h" |
| #include "vm/dart_api_impl.h" |
| +#include "vm/dart_api_state.h" // TODO(rmacnak): Remove with CreateMirrorRef. |
|
siva
2013/07/08 21:29:23
Create a new bug (issue) in https://code.google.co
rmacnak
2013/07/08 22:01:11
Issue 11742
|
| #include "vm/bootstrap_natives.h" |
| #include "vm/dart_entry.h" |
| #include "vm/exceptions.h" |
| @@ -160,6 +161,20 @@ |
| return vm_ref; |
| } |
| + |
| +// TODO(rmacnak): Remove once there are no more users of the Dart_Handle-based |
| +// VMReferences. |
| +static Dart_Handle CreateMirrorReference(Dart_Handle handle) { |
| + Isolate* isolate = Isolate::Current(); |
| + DARTSCOPE(isolate); |
| + const Object& referent = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
| + const MirrorReference& reference = |
| + MirrorReference::Handle(MirrorReference::New()); |
| + reference.set_referent(referent); |
| + return Api::NewHandle(isolate, reference.raw()); |
| +} |
| + |
| + |
| static Dart_Handle StringFromSymbol(Dart_Handle symbol) { |
| Dart_Handle result = Dart_Invoke(MirrorLib(), NewString("_n"), 1, &symbol); |
| return result; |
| @@ -597,8 +612,9 @@ |
| } |
| Dart_Handle args[] = { |
| + CreateMirrorReference(intf), |
| CreateVMReference(intf), |
| - intf_name, |
| + Dart_Null(), // "name" |
|
siva
2013/07/08 21:29:23
What is the point of not using the intf_name that
rmacnak
2013/07/08 22:01:11
The name parameter is still used by typedefs. The
|
| Dart_NewBoolean(Dart_IsClass(intf)), |
| lib_mirror, |
| CreateLazyMirror(super_class), |
| @@ -1398,10 +1414,20 @@ |
| Dart_ExitScope(); |
| } |
| + |
| void HandleMirrorsMessage(Isolate* isolate, |
| Dart_Port reply_port, |
| const Instance& message) { |
| UNIMPLEMENTED(); |
| } |
| + |
| +DEFINE_NATIVE_ENTRY(ClassMirror_name, 1) { |
| + const MirrorReference& klass_ref = |
| + MirrorReference::CheckedHandle(arguments->NativeArgAt(0)); |
| + Class& klass = Class::Handle(); |
| + klass ^= klass_ref.referent(); |
| + return klass.Name(); |
| +} |
| + |
| } // namespace dart |