| Summary: | Reassigning to class name during static field initialization | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Kanguk Lee <p51lee> |
| Component: | JavaScriptCore | Assignee: | Yijia Huang <yijia_huang> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | mark.lam, webkit-bug-importer, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Local Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Pull request: https://github.com/WebKit/WebKit/pull/6381 Committed 256663@main (68f502ba813d): <https://commits.webkit.org/256663@main> Reviewed commits have been landed. Closing PR #6381 and removing active labels. |
// input.js class x { static #y = { x = 0 } = 0 ; } __________________________________________ Hello, Executing the input.js using JSC throws ReferenceError. However, it is expected to throw TypeError. Running the input.js with JSC results in: --- $ jsc input.js Exception: ReferenceError: Cannot access uninitialized variable. global code@input.js:1:1 --- while other engines behave like: --- # V8 $ node input.js input.js:1: TypeError: Assignment to constant variable. class x { static #y = { x = 0 } = 0 ; } ^ TypeError: Assignment to constant variable. at <static_initializer> (input.js:1:25) at input.js:1:1 # GraalJS $ js input.js TypeError: Assignment to constant "x" at <js> :initializer(input.js:1:24) at <js> :program(input.js:1:0-38) --- WebKit version: 615.1.10