We allow assignments to const variables when in a for-in/for-of loop
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Aug 2016 23:57:03 +0000 (23:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Aug 2016 23:57:03 +0000 (23:57 +0000)
commite8584fe88ab351545cdbeb3c3130a72f3a925efb
treea59bc438367aba52a32617aa0c1088820b7e6eb0
parent31b2c82836d6d13981d93fa035f40826e405bfa8
We allow assignments to const variables when in a for-in/for-of loop
https://bugs.webkit.org/show_bug.cgi?id=156673

Patch by JF Bastien <jfbastien@apple.com> on 2016-08-17
Reviewed by Filip Pizlo.

JSTests:

* stress/for-in-of-const.js: Added.
(expect_nothrow):
(expect_throw):
(capture):

Source/JavaScriptCore:

for-in and for-of weren't checking whether iteration variable from
parent scopes were const. Assigning to such variables should
throw, but used not to.

* bytecompiler/NodesCodegen.cpp:
(JSC::ForInNode::emitLoopHeader):
(JSC::ForOfNode::emitBytecode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/for-in-of-const.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp