[parser] Fix IsValidReferenceExpression

A Property access is only a valid reference expression if the accessed object
is a valid expression.

Bug: v8:8409
Change-Id: I9bc9ac60ca3bf4e261d10af97aba18e9db2085ea
Reviewed-on: https://chromium-review.googlesource.com/c/1317816
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57244}
This commit is contained in:
Toon Verwaest 2018-11-05 16:07:15 +01:00 committed by Commit Bot
parent fc755be9da
commit c28ecb1a86
3 changed files with 11 additions and 1 deletions

View File

@ -4524,7 +4524,8 @@ ParserBase<Impl>::CheckAndRewriteReferenceExpression(ExpressionT expression,
template <typename Impl>
bool ParserBase<Impl>::IsValidReferenceExpression(ExpressionT expression) {
return IsAssignableIdentifier(expression) || expression->IsProperty();
return IsAssignableIdentifier(expression) ||
(expression->IsProperty() && classifier()->is_valid_expression());
}
template <typename Impl>

View File

@ -0,0 +1,5 @@
// 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.
[().x] = 1

View File

@ -0,0 +1,4 @@
*%(basename)s:5: SyntaxError: Unexpected token (
[().x] = 1
^
SyntaxError: Unexpected token (