Commit 2fbbf7eb authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Fix error message for invalid property reference

This rethrows the underlying expression error if there is one.

Bug: v8:8409
Change-Id: Icc8253e4006c554df9f6a6d850b087b03d88de2d
Reviewed-on: https://chromium-review.googlesource.com/c/1319570Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57264}
parent bd99d02f
......@@ -4528,6 +4528,7 @@ void ParserBase<Impl>::CheckDestructuringElement(ExpressionT expression,
int begin, int end) {
if (!IsValidPattern(expression) && !expression->IsAssignment() &&
!IsValidReferenceExpression(expression)) {
if (expression->IsProperty()) ValidateExpression();
classifier()->RecordAssignmentPatternError(
Scanner::Location(begin, end),
MessageTemplate::kInvalidDestructuringTarget);
......
*%(basename)s:5: SyntaxError: Unexpected token (
*%(basename)s:5: SyntaxError: Unexpected token )
[().x] = 1
^
SyntaxError: Unexpected token (
^
SyntaxError: Unexpected token )
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