[parser] Ignore parenthesized identifiers when setting function name

Code such as

    var a;
    (a) = function() {};

should not lead to a.name being set to "a".

This fixes the last of the anonymous function naming bugs.

Bug: v8:4709
Change-Id: I70c2fcbcec1a57752fd58038262d02aefe26e28a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2970705
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75321}
This commit is contained in:
Timothy Gu 2021-06-17 14:45:44 -07:00 committed by V8 LUCI CQ
parent 5e275b580f
commit 528a01042d
2 changed files with 2 additions and 3 deletions

View File

@ -3466,6 +3466,8 @@ void Parser::SetFunctionNameFromPropertyName(ObjectLiteralProperty* property,
void Parser::SetFunctionNameFromIdentifierRef(Expression* value,
Expression* identifier) {
if (!identifier->IsVariableProxy()) return;
// IsIdentifierRef of parenthesized expressions is false.
if (identifier->is_parenthesized()) return;
SetFunctionName(value, identifier->AsVariableProxy()->raw_name());
}

View File

@ -59,9 +59,6 @@
'language/expressions/assignment/S11.13.1_A5*': [FAIL],
'language/expressions/assignment/S11.13.1_A6*': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4709
'language/expressions/assignment/fn-name-lhs-cover': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4251
'language/expressions/postfix-increment/S11.3.1_A5_T1': [FAIL],
'language/expressions/postfix-increment/S11.3.1_A5_T2': [FAIL],