Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5d6747ef60d4327f25547d55277cb7735a623854
      
https://github.com/WebKit/WebKit/commit/5d6747ef60d4327f25547d55277cb7735a623854
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-08-02 (Sun, 02 Aug 2026)

  Changed paths:
    A 
JSTests/stress/arrow-function-object-literal-shorthand-should-not-capture-arguments.js
    M Source/JavaScriptCore/parser/Parser.cpp

  Log Message:
  -----------
  [JSC] Object-literal shorthand in an arrow function should not force the 
enclosing function to capture arguments
https://bugs.webkit.org/show_bug.cgi?id=320789

Reviewed by Yusuke Suzuki.

Since 172894@main, parseProperty calls setInnerArrowFunctionUsesEval() for every
shorthand property inside an arrow function, so the enclosing function 
materializes
`arguments` into its lexical environment and closures returned from it retain 
all
call arguments.

    function make(opts) {
        const worker = (r) => ({ r });
        return { worker };
    }
    // `make` emits create_direct_arguments + put_to_scope; `opts` stays alive

useVariable() already sets m_usesEval for `{ eval }`, which
setInnerArrowFunctionUsesEvalAndUseArgumentsIfNeeded() propagates at scope pop,
so drop the unconditional call.

Test: 
JSTests/stress/arrow-function-object-literal-shorthand-should-not-capture-arguments.js

* 
JSTests/stress/arrow-function-object-literal-shorthand-should-not-capture-arguments.js:
 Added.
(shouldBe):
(make.inner):
(make):
(shorthandEvalAndArguments):
(shorthandWithDirectEval):
(setTimeout):
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseProperty):

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



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

Reply via email to