Index: runtime/lib/mirrors.cc |
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc |
index 3b7391caf42238dba40a43e93faefaf52a13fafe..61d37b4bb6333d3903f08fc56fea25ce6cbeea52 100644 |
--- a/runtime/lib/mirrors.cc |
+++ b/runtime/lib/mirrors.cc |
@@ -1301,6 +1301,31 @@ DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) { |
} |
+DEFINE_NATIVE_ENTRY(Mirrors_evalInLibraryWithPrivateKey, 2) { |
+ GET_NON_NULL_NATIVE_ARGUMENT(String, expression, arguments->NativeArgAt(0)); |
+ GET_NATIVE_ARGUMENT(String, private_key, arguments->NativeArgAt(1)); |
+ |
+ const GrowableObjectArray& libraries = |
+ GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
+ const int num_libraries = libraries.Length(); |
+ Library& each_library = Library::Handle(); |
+ Library& ctxt_library = Library::Handle(); |
+ String& library_key = String::Handle(); |
+ |
+ for (int i = 0; i < num_libraries; i++) { |
Ivan Posva
2014/02/05 22:23:44
If the private_key is null coming in, then you wil
|
+ each_library ^= libraries.At(i); |
+ library_key = each_library.private_key(); |
+ if (library_key.Equals(private_key)) { |
+ ctxt_library = each_library.raw(); |
+ break; |
+ } |
+ } |
Ivan Posva
2014/02/05 22:23:44
With the current setup I would think that you can
rmacnak
2014/02/05 22:56:31
Yes, added.
|
+ if (ctxt_library.IsNull()) { |
+ ctxt_library = Library::CoreLibrary(); |
+ } |
+ return ctxt_library.Evaluate(expression); |
+} |
+ |
DEFINE_NATIVE_ENTRY(TypedefMirror_declaration, 1) { |
GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0)); |
const Class& cls = Class::Handle(type.type_class()); |