Commit 528a0104 authored by Timothy Gu's avatar Timothy Gu Committed by V8 LUCI CQ

[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/+/2970705Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75321}
parent 5e275b58
......@@ -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());
}
......
......@@ -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],
......
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