Bug 298927

Summary: [JSC] Improve error message for calling constructor without `new`
Product: WebKit Reporter: Sosuke Suzuki <aosukeke>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Sosuke Suzuki
Reported 2025-09-16 00:12:12 PDT
Calling constructors without `new` is invalid: class Foo {} Foo(); Current JSC throws a TypeError with the message "Cannot call a class constructor without |new|" for such code. This patch changes this error message to include the constructor name for debugging experience.
Attachments
Sosuke Suzuki
Comment 1 2025-09-16 00:20:56 PDT
Radar WebKit Bug Importer
Comment 2 2025-09-23 00:13:36 PDT
Radar WebKit Bug Importer
Comment 3 2025-09-23 00:13:37 PDT
EWS
Comment 4 2025-10-05 06:23:38 PDT
Committed 301023@main (dabbab2ba61e): <https://commits.webkit.org/301023@main> Reviewed commits have been landed. Closing PR #50792 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.