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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 16780008: Reified metadata in the VM (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | « runtime/include/dart_api.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 23883)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -4348,6 +4348,28 @@
}
+// --- Metadata ----
+
+DART_EXPORT Dart_Handle Dart_GetMetadata(Dart_Handle object) {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ DARTSCOPE(isolate);
+ const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
+ Class& cls = Class::Handle(isolate);
+ if (obj.IsClass()) {
+ cls ^= obj.raw();
+ } else if (obj.IsFunction()) {
+ cls = Function::Cast(obj).origin();
+ } else if (obj.IsField()) {
+ cls = Field::Cast(obj).origin();
+ } else {
+ return Api::NewHandle(isolate, Object::empty_array().raw());
+ }
+ const Library& lib = Library::Handle(cls.library());
+ return Api::NewHandle(isolate, lib.GetMetadata(obj));
+}
+
+
// --- Scripts and Libraries ---
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698