71f59a23fc
Instead, simply track it as a valid binding pattern. To do this in the case of parenthesized formals, we delay throwing the binding pattern error for parenthesized (and async "calls") until we know it's not an arrow function head by itself. This guarantees that if an arrow head is a valid binding pattern, it's either a valid parenthesized head or a valid identifier, or invalid pattern ("array" or "object" literal style). We can detect the latter case by checking that the current token is not a RPAREN and the expression isn't an identifier. (Alternatively we could check that the curren token is RBRACE or RBRACK...) Bug: chromium:907575 Change-Id: Ie40cc3235d3188f2620b6c089a0f49d93604dda6 Reviewed-on: https://chromium-review.googlesource.com/c/1348078 Reviewed-by: Igor Sheludko <ishell@chromium.org> Commit-Queue: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#57743}
7 lines
248 B
JavaScript
7 lines
248 B
JavaScript
// 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.
|
|
|
|
assertThrows("0 || () =>", SyntaxError);
|
|
assertThrows("++(a) =>", SyntaxError);
|