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

Unified Diff: runtime/lib/mirrors.cc

Issue 18465006: Add a MirrorReference reflectee for ClassMirrors. Rewrite the name accessor in terms of it, at leas… (Closed) Base URL: http://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 | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
===================================================================
--- runtime/lib/mirrors.cc (revision 24825)
+++ 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(11742): Remove with CreateMirrorRef.
#include "vm/bootstrap_natives.h"
#include "vm/dart_entry.h"
#include "vm/exceptions.h"
@@ -160,6 +161,20 @@
return vm_ref;
}
+
+// TODO(11742): 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"
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
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698