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

Unified Diff: runtime/vm/parser.cc

Issue 2241603004: Reload: Don't crash when a tearoff adds arguments and is called with too few. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 6c64bad199efbb403453bb55897d75a67cb90cfe..3dc119a778d705830b1b8e7dc15161bc0b160140 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -1614,14 +1614,19 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
}
AstNode* call = NULL;
- if (!target.IsNull()) {
+ // Check the target still exists and has compatible parameters. If not,
+ // throw NSME/call nSM instead of forwarding the call. Note we compare the
+ // parent not func because func has an extra parameter for the closure
+ // receiver.
+ if (!target.IsNull() &&
+ (parent.num_fixed_parameters() == target.num_fixed_parameters())) {
call = new StaticCallNode(token_pos, target, func_args);
} else if (!parent.is_static()) {
ASSERT(Isolate::Current()->HasAttemptedReload());
// If a subsequent reload reintroduces the target in the middle of the
// Invocation object being constructed, we won't be able to successfully
// deopt because the generated AST will change.
- current_function().SetIsOptimizable(false);
+ func.SetIsOptimizable(false);
ArgumentListNode* arguments = BuildNoSuchMethodArguments(
token_pos, func_name, *func_args, NULL, false);
@@ -1645,7 +1650,7 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
// If a subsequent reload reintroduces the target in the middle of the
// arguments array being constructed, we won't be able to successfully
// deopt because the generated AST will change.
- current_function().SetIsOptimizable(false);
+ func.SetIsOptimizable(false);
InvocationMirror::Type im_type;
if (parent.IsImplicitGetterFunction()) {
« 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