Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a44c9c47f63f8455977a48b81f07ef1dc0e2fef7
      
https://github.com/WebKit/WebKit/commit/a44c9c47f63f8455977a48b81f07ef1dc0e2fef7
  Author: Vassili Bykov <[email protected]>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    M Source/JavaScriptCore/parser/Parser.cpp
    M Source/JavaScriptCore/parser/Parser.h

  Log Message:
  -----------
  [JSC] Fix IIFE detection to avoid false positives on '('
https://bugs.webkit.org/show_bug.cgi?id=314172
rdar://176331122

Reviewed by Keith Miller.

The existing detection of IIFEs incorrectly identifies any function following 
the '('
token as an IIFE because it relies on the m_lastTokenType field. Instead, the 
check should
be context-dependent in parsePrimaryExpression, setting a flag if '(' is seen 
in that
context followed by the function keyword.

The '!' heuristic does not need a similar treatment, and is more efficient the 
way it is
done now by checking m_lastTokenType.

Testing: IIFE detection cannot be tested at JS level in stress tests. This 
patch was
tested by running a parser instrumented to trace IIFE detection, on a file 
containing a
variety of function expressions, including those that caused false positives 
before the
change.

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



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

Reply via email to