Commit 4921821b authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[parser] Prevent lazy parsing of arrow functions

Change Parser::AllowsLazyParsingWithoutUnresolvedVariables to return
false if it may be parsing an arrow function.

Bug: v8:9758, v8:8510
Change-Id: Ic5d213d4358ff954a169c03e449197c3f050880c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1816510Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63920}
parent 8d7c581a
......@@ -172,8 +172,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
parsing::ReportErrorsAndStatisticsMode stats_mode);
bool AllowsLazyParsingWithoutUnresolvedVariables() const {
return scope()->AllowsLazyParsingWithoutUnresolvedVariables(
original_scope_);
return !MaybeParsingArrowhead() &&
scope()->AllowsLazyParsingWithoutUnresolvedVariables(
original_scope_);
}
bool parse_lazily() const { return mode_ == PARSE_LAZILY; }
......
// Copyright 2019 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.
// Flags: --throws
// Can't put this in a try-catch as that changes the parsing so the crash
// doesn't reproduce.
((a = ((b = a) => {})()) => 1)();
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