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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 11968022: Lookup functions by name that contains the private key, except for dart_api which allows ignoring t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/lib/isolate.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('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 17175)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -1104,15 +1104,19 @@
ASSERT(!isolate_lib.IsNull());
const String& class_name = String::Handle(
isolate, isolate_lib.PrivateName(Symbols::_ReceivePortImpl()));
+ // TODO(asiva): Symbols should contain private keys.
+ const String& function_name =
+ String::Handle(isolate_lib.PrivateName(Symbols::_get_or_create()));
const int kNumArguments = 1;
const Function& function = Function::Handle(
isolate,
Resolver::ResolveStatic(isolate_lib,
class_name,
- Symbols::_get_or_create(),
+ function_name,
kNumArguments,
Object::empty_array(),
Resolver::kIsQualified));
+ ASSERT(!function.IsNull());
const Array& args = Array::Handle(isolate, Array::New(kNumArguments));
args.SetAt(0, Integer::Handle(isolate, Integer::New(port_id)));
return Api::NewHandle(isolate, DartEntry::InvokeStatic(function, args));
@@ -2783,7 +2787,7 @@
const Class& cls = Class::Cast(obj);
// Case 1. Lookup the unmodified function name.
- func = cls.LookupFunction(func_name);
+ func = cls.LookupFunctionAllowPrivate(func_name);
// Case 2. Lookup the function without the external setter suffix
// '='. Make sure to do this check after the regular lookup, so
@@ -2791,20 +2795,20 @@
if (func.IsNull() && HasExternalSetterSuffix(func_name)) {
tmp_name = RemoveExternalSetterSuffix(func_name);
tmp_name = Field::SetterName(tmp_name);
- func = cls.LookupFunction(tmp_name);
+ func = cls.LookupFunctionAllowPrivate(tmp_name);
}
// Case 3. Lookup the funciton with the getter prefix prepended.
if (func.IsNull()) {
tmp_name = Field::GetterName(func_name);
- func = cls.LookupFunction(tmp_name);
+ func = cls.LookupFunctionAllowPrivate(tmp_name);
}
// Case 4. Lookup the function with a . appended to find the
// unnamed constructor.
if (func.IsNull()) {
tmp_name = String::Concat(func_name, Symbols::Dot());
- func = cls.LookupFunction(tmp_name);
+ func = cls.LookupFunctionAllowPrivate(tmp_name);
}
} else if (obj.IsLibrary()) {
const Library& lib = Library::Cast(obj);
@@ -3299,7 +3303,7 @@
// The constructor must be present in the interface.
String& constr_name = String::Handle(String::Concat(class_name, dotted_name));
const Function& constructor =
- Function::Handle(cls.LookupFunction(constr_name));
+ Function::Handle(cls.LookupFunctionAllowPrivate(constr_name));
if (constructor.IsNull() ||
(!constructor.IsConstructor() && !constructor.IsFactory())) {
const String& lookup_class_name = String::Handle(cls.Name());
@@ -3611,7 +3615,7 @@
while (!cls.IsNull()) {
String& getter_name =
String::Handle(isolate, Field::GetterName(field_name));
- getter = cls.LookupDynamicFunction(getter_name);
+ getter = cls.LookupDynamicFunctionAllowPrivate(getter_name);
if (!getter.IsNull()) {
break;
}
@@ -3642,7 +3646,7 @@
if (field.IsNull() || FieldIsUninitialized(isolate, field)) {
const String& getter_name =
String::Handle(isolate, Field::GetterName(field_name));
- getter = cls.LookupStaticFunction(getter_name);
+ getter = cls.LookupStaticFunctionAllowPrivate(getter_name);
}
if (!getter.IsNull()) {
@@ -3674,7 +3678,7 @@
const Class& cls = Class::Handle(isolate, field.owner());
const String& getter_name =
String::Handle(isolate, Field::GetterName(field_name));
- getter = cls.LookupStaticFunction(getter_name);
+ getter = cls.LookupStaticFunctionAllowPrivate(getter_name);
}
if (!getter.IsNull()) {
@@ -3737,7 +3741,7 @@
}
String& setter_name =
String::Handle(isolate, Field::SetterName(field_name));
- setter = cls.LookupDynamicFunction(setter_name);
+ setter = cls.LookupDynamicFunctionAllowPrivate(setter_name);
if (!setter.IsNull()) {
break;
}
@@ -3764,7 +3768,7 @@
if (field.IsNull()) {
String& setter_name =
String::Handle(isolate, Field::SetterName(field_name));
- setter = cls.LookupStaticFunction(setter_name);
+ setter = cls.LookupStaticFunctionAllowPrivate(setter_name);
}
if (!setter.IsNull()) {
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698