[Webkit-unassigned] [Bug 247787] New: Order between tdz error and others in `for` statement or class

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 11 01:13:07 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=247787

            Bug ID: 247787
           Summary: Order between tdz error and others in `for` statement
                    or class
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: p51lee at kaist.ac.kr

// 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 at input1.js:1:25

$ jsc input2.js
Exception: ReferenceError: Cannot access uninitialized variable.
global code at 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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221111/cc4b97dc/attachment.htm>


More information about the webkit-unassigned mailing list