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

Unified Diff: runtime/vm/parser.cc

Issue 2187433006: RELOAD: Check if an implicit closure needs rebinding at compile time and adjust closure equality. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/isolate_reload_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 9e7dcbd1018e1dc13c38c4658be6dc6e8392012b..0d013c5491aafd3c2fbbd18156d50504eb70888b 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -1547,12 +1547,25 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
&Symbols::ClosureParameter(),
&Object::dynamic_type());
- const Function& parent = Function::ZoneHandle(func.parent_function());
- if (parent.IsImplicitSetterFunction()) {
+ const Function& parent = Function::Handle(func.parent_function());
+ const String& target_name = String::Handle(parent.name());
+ const Class& owner = Class::Handle(parent.Owner());
+ Function& target = Function::ZoneHandle(owner.LookupFunction(target_name));
+ if (target.raw() != parent.raw()) {
+ ASSERT(Isolate::Current()->HasAttemptedReload());
+ if (target.IsNull() ||
+ (target.is_static() != parent.is_static()) ||
+ (target.kind() != parent.kind())) {
+ // TODO(26977): call noSuchMethod/throw NSME instead.
+ target = parent.raw();
+ }
+ }
+
+ if (target.IsImplicitSetterFunction()) {
const TokenPosition ident_pos = func.token_pos();
ASSERT(IsIdentifier());
const String& field_name = *CurrentLiteral();
- const Class& field_class = Class::ZoneHandle(Z, parent.Owner());
+ const Class& field_class = Class::ZoneHandle(Z, target.Owner());
const Field& field =
Field::ZoneHandle(Z, field_class.LookupInstanceField(field_name));
const AbstractType& field_type = AbstractType::ZoneHandle(Z, field.type());
@@ -1560,7 +1573,7 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
&Symbols::Value(),
&field_type);
ASSERT(func.num_fixed_parameters() == 2); // closure, value.
- } else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) {
+ } else if (!target.IsGetterFunction() && !target.IsImplicitGetterFunction()) {
const bool allow_explicit_default_values = true;
SkipFunctionPreamble();
ParseFormalParameterList(allow_explicit_default_values, false, &params);
@@ -1591,7 +1604,7 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
}
func_args->set_names(arg_names);
}
- StaticCallNode* call = new StaticCallNode(token_pos, parent, func_args);
+ StaticCallNode* call = new StaticCallNode(token_pos, target, func_args);
ReturnNode* return_node = new ReturnNode(token_pos, call);
current_block_->statements->Add(return_node);
return CloseBlock();
« no previous file with comments | « runtime/vm/isolate_reload_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698