Commit 1efaf460 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Only parse async parenthesized arrow if current_token == ASYNC

Checking impl()->IsAsync(identifier) is insufficient since it could be
parenthesized. By checking the token in addition to IsIdentifier guarantees
that we've only seen the single token ASYNC.

Bug: chromium:898812
Change-Id: Id94dd607381050b4bd8cd6d8672a5d11256db7da
Reviewed-on: https://chromium-review.googlesource.com/c/1300134Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57013}
parent 1b82149e
......@@ -3213,8 +3213,9 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) {
bool has_spread;
ExpressionListT args(pointer_buffer());
if (impl()->IsIdentifier(result) &&
impl()->IsAsync(impl()->AsIdentifier(result)) &&
scanner()->current_token() == Token::ASYNC &&
!scanner()->HasLineTerminatorBeforeNext()) {
DCHECK(impl()->IsAsync(impl()->AsIdentifier(result)));
ExpressionClassifier async_classifier(this);
ParseArguments(&args, &has_spread, true);
RETURN_IF_PARSE_ERROR;
......
// Copyright 2015 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.
assertThrows("(async)(a)=>{}", SyntaxError);
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