Commit 55ecf51e authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Don't resolve preparser variables for arrow functions

I moved AnalyzePartially from ParseFunctionLiteral to SkipFunction, but arrow
functions only used the ResetAfterPreparsing part.

Bug: chromium:888825

Change-Id: I08de99af128b28031df6ed86a725e4dc918078f8
Reviewed-on: https://chromium-review.googlesource.com/1243383Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56218}
parent bcb8d49b
......@@ -1534,10 +1534,11 @@ void DeclarationScope::SavePreParsedScopeDataForDeclarationScope() {
void DeclarationScope::AnalyzePartially(AstNodeFactory* ast_node_factory) {
DCHECK(!force_eager_compilation_);
ThreadedList<VariableProxy> new_unresolved_list;
if (!outer_scope_->is_script_scope() ||
(FLAG_preparser_scope_analysis &&
preparsed_scope_data_builder_ != nullptr &&
preparsed_scope_data_builder_->ContainsInnerFunctions())) {
if (!IsArrowFunction(function_kind_) &&
(!outer_scope_->is_script_scope() ||
(FLAG_preparser_scope_analysis &&
preparsed_scope_data_builder_ != nullptr &&
preparsed_scope_data_builder_->ContainsInnerFunctions()))) {
// Try to resolve unresolved variables for this Scope and migrate those
// which cannot be resolved inside. It doesn't make sense to try to resolve
// them in the outer Scopes here, because they are incomplete.
......
......@@ -4398,8 +4398,6 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
DCHECK(parse_result);
USE(parse_result);
DCHECK_NULL(produced_preparsed_scope_data);
formal_parameters.scope->ResetAfterPreparsing(ast_value_factory_,
false);
// Discard any queued destructuring assignments which appeared
// in this function's parameter list, and which were adopted
// into this function state, above.
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
eval("((a=function g() { function g() {}}) => {})();");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment