Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a848db678203eb1563820cc1aae9ae0dd6cb3e0a
      
https://github.com/WebKit/WebKit/commit/a848db678203eb1563820cc1aae9ae0dd6cb3e0a
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-09-17 (Thu, 17 Sep 2026)

  Changed paths:
    A JSTests/stress/function-name-inference-parenthesized-assignment-target.js
    M JSTests/test262/expectations.yaml
    M Source/JavaScriptCore/parser/ASTBuilder.h
    M Source/JavaScriptCore/parser/Nodes.h
    M Source/JavaScriptCore/parser/Parser.cpp
    M Source/JavaScriptCore/parser/SyntaxChecker.h

  Log Message:
  -----------
  [JSC] Record expression is parenthesized or not
https://bugs.webkit.org/show_bug.cgi?id=324430
rdar://187662339

Reviewed by Sosuke Suzuki.

When expression is parenthesized, ECMAScript SetName does not happen.
This means,

    var fn;
    (fn) = function() { }
    fn.name !== "fn" // => true

We do not propagate "fn" as a name to this function since (fn) is
parenthesized. This patch records parenthesized or not in ExpressionNode
and use it when inferring a name.

Test: JSTests/stress/function-name-inference-parenthesized-assignment-target.js

* JSTests/stress/function-name-inference-parenthesized-assignment-target.js: 
Added.
(shouldBe):
(prototype.async shouldBe):
(fn):
(coalesce):
(array):
(p.object):
(let.declaration):
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/parser/ASTBuilder.h:
(JSC::ASTBuilder::setIsParenthesized):
(JSC::ASTBuilder::tryInferNameInPattern):
(JSC::ASTBuilder::makeAssignNode):
* Source/JavaScriptCore/parser/Nodes.h:
(JSC::ExpressionNode::isParenthesized const):
(JSC::ExpressionNode::setIsParenthesized):
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parsePrimaryExpression):
* Source/JavaScriptCore/parser/SyntaxChecker.h:
(JSC::SyntaxChecker::setIsParenthesized):

Canonical link: https://commits.webkit.org/321326@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to