[Webkit-unassigned] [Bug 247432] New: TypeError is expected when reassigning to `const` during destructuring in for statement

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 3 09:06:03 PDT 2022


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

            Bug ID: 247432
           Summary: TypeError is expected when reassigning to `const`
                    during destructuring in for statement
           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

// input.js
const x = 0 ; for ( { x } in { x } ) ;
__________________________________________

Hello,

Executing the input.js using JSC, it is terminated normally.
However, it is expected to throw TypeError since there is an assignment to constant variable.

Running the input.js with JSC results in:

---
$ jsc input.js
// no error
---

while other engines behave like:

---
# V8
$ node input.js
input.js:1: TypeError: Assignment to constant variable.
const x = 0 ; for ( { x } in { x } ) ;
                      ^
TypeError: Assignment to constant variable.
    at input.js:1:23

# GraalJS
$ js input.js
TypeError: Assignment to constant "x"
        at <js> :program(input.js:1:22)
---


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/20221103/651ab32b/attachment.htm>


More information about the webkit-unassigned mailing list