| Summary: | Order between tdz error and others in `for` statement or class | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Kanguk Lee <p51lee> |
| Component: | JavaScriptCore | Assignee: | David Degazio <d_degazio> |
| 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/6532 Committed 256743@main (876accfa73f6): <https://commits.webkit.org/256743@main> Reviewed commits have been landed. Closing PR #6532 and removing active labels. |
// case 1 // input1.js for ( let x in x = new 0 ) ; // case 2 // input2.js class x { [ x = new 0 ] ; } ____________________________ Hello, Executing the input.js using JSC throws ReferenceError, but TypeError is expected. Running the input1.js and input2.js with JSC results in: --- $ jsc input1.js Exception: ReferenceError: Cannot access uninitialized variable. global code@input1.js:1:25 $ jsc input2.js Exception: ReferenceError: Cannot access uninitialized variable. global code@input2.js:1:1 --- while other engines behave like: --- # V8 (used console.log) $ node input1.js input1.js:1 for ( let x in x = new 0 ) ; ^ TypeError: 0 is not a constructor ... $ node input2.js input2.js:1 class x { [ x = new 0 ] ; } ^ TypeError: number 0 is not a constructor ... Node.js v18.11.0 # GraalJS $ js input1.js TypeError: 0 is not a constructor at <js> :program(input1.js:1:19-23) $ js input2.js TypeError: 0 is not a constructor at <js> :program(input2.js:1:16-20) --- WebKit version: 615.1.10