Bug 247432
| Summary: | TypeError is expected when reassigning to `const` during destructuring in for statement | ||
|---|---|---|---|
| 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 | ||
Kanguk Lee
// 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
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/102064568>
Yijia Huang
Pull request: https://github.com/WebKit/WebKit/pull/6390
EWS
Committed 256580@main (c228e7cdd637): <https://commits.webkit.org/256580@main>
Reviewed commits have been landed. Closing PR #6390 and removing active labels.
Yijia Huang
*** Bug 247786 has been marked as a duplicate of this bug. ***