Bug 251760 - Functions are lexically scoped inside static blocks where variable declarations are allowed, ASSERT_WITH_MESSAGE(!m_declaredVariables.size(), "...");
Summary: Functions are lexically scoped inside static blocks where variable declaratio...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Trivial
Assignee: Yijia Huang
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-02-05 11:48 PST by Corban Amouzou
Modified: 2023-02-07 13:44 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Corban Amouzou 2023-02-05 11:48:11 PST
In Source/JavaScriptCore/parser/Parser.h we hit the assertion: ASSERT_WITH_MESSAGE(!m_declaredVariables.size(), "...");

This is triggered by a simple case where a class function is declared inside of a static scope:

class A {
  static {
    var B;
    function C() {}
  }
}

What's interesting is that I would assume the variables inside that block would be scoped to that class statically, IE the variable B would be accessible through A.B, but that simply is not the case.
It's not a pressing concern, but it seems like a possible regression of https://bugs.webkit.org/show_bug.cgi?id=168844
Comment 1 Radar WebKit Bug Importer 2023-02-06 16:29:15 PST
<rdar://problem/105104494>
Comment 2 Yijia Huang 2023-02-06 18:05:01 PST
Pull request: https://github.com/WebKit/WebKit/pull/9729
Comment 3 EWS 2023-02-07 13:44:16 PST
Committed 259981@main (b9e63fd65e32): <https://commits.webkit.org/259981@main>

Reviewed commits have been landed. Closing PR #9729 and removing active labels.