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

Unified Diff: runtime/lib/mirrors.cc

Issue 52953002: Hide ClosureMirror.findInContext behind a flag for 1.0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 2 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
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index ae57b6521044c5a9db7f5f48799d524a350af1b8..22b2d47fa4b2ea1c81d9c35b3526026b3b24293d 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -20,6 +20,9 @@ DEFINE_FLAG(bool, use_mirrored_compilation_error, false,
"Wrap compilation errors that occur during reflective access in a "
"MirroredCompilationError, rather than suspending the isolate.");
+DEFINE_FLAG(bool, support_find_in_context, false,
+ "Experimental support for ClosureMirror.findInContext.");
+
static RawInstance* CreateMirror(const String& mirror_class_name,
const Array& constructor_arguments) {
const Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary());
@@ -721,12 +724,8 @@ static RawInstance* LookupStaticFunctionOrFieldInClass(
return result.raw();
}
- Function& func = Function::Handle();
- Class& lookup_class = Class::Handle(klass.raw());
- while (func.IsNull() && !lookup_class.IsNull()) {
- func ^= lookup_class.LookupStaticFunction(lookup_name);
- lookup_class = lookup_class.SuperClass();
- }
+ const Function& func =
+ Function::Handle(klass.LookupStaticFunction(lookup_name));
if (!func.IsNull()) {
const Function& closure_function = Function::Handle(
func.ImplicitClosureFunction());
@@ -1424,6 +1423,10 @@ DEFINE_NATIVE_ENTRY(ClosureMirror_apply, 2) {
DEFINE_NATIVE_ENTRY(ClosureMirror_find_in_context, 2) {
+ if (!FLAG_support_find_in_context) {
+ return Object::empty_array().raw();
+ }
+
GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Array, lookup_parts, arguments->NativeArgAt(1));
ASSERT(lookup_parts.Length() >= 1 && lookup_parts.Length() <= 3);
« 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