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

Unified Diff: runtime/vm/resolver.cc

Issue 1234883005: Implement tear-off closure operator # (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
Index: runtime/vm/resolver.cc
diff --git a/runtime/vm/resolver.cc b/runtime/vm/resolver.cc
index 954f34076d069794050032ec65bd8c87f0e6a889..9d6972876468ae95f240f49e6af60904ace112ce 100644
--- a/runtime/vm/resolver.cc
+++ b/runtime/vm/resolver.cc
@@ -114,6 +114,32 @@ RawFunction* Resolver::ResolveDynamicAnyArgs(
String& field_name = String::Handle();
if (is_getter) {
field_name ^= Field::NameFromGetter(function_name);
+
+ if (field_name.CharAt(0) == '#') {
Ivan Posva 2015/07/17 08:35:42 Please add explanation here how we generate the cl
hausner 2015/07/17 17:53:51 Correct. I will add a comment. The # in the getter
+ String& property_name = String::Handle(String::SubString(field_name, 1));
+
+ ASSERT(!Field::IsGetterName(property_name));
+ String& method_name = String::Handle();
+ if (!Field::IsSetterName(property_name)) {
Ivan Posva 2015/07/17 08:35:42 Please add comment why the property name needs to
hausner 2015/07/17 17:53:51 Will do.
+ method_name = Field::GetterName(property_name);
+ }
+
+ Function& function = Function::Handle();
+ while (!cls.IsNull()) {
+ function = cls.LookupDynamicFunction(property_name);
+ if (!function.IsNull()) {
+ return CreateMethodExtractor(function_name, function);
+ }
+ if (!method_name.IsNull()) {
+ function = cls.LookupDynamicFunction(method_name);
+ if (!function.IsNull()) {
+ return CreateMethodExtractor(function_name, function);
+ }
+ }
+ cls = cls.SuperClass();
+ }
+ return Function::null();
+ }
}
// Now look for an instance function whose name matches function_name
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698