[es6] emit error when for-in loop declarations are initialized in strict mode
authorcaitpotter88 <caitpotter88@gmail.com>
Tue, 7 Apr 2015 19:28:33 +0000 (12:28 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 7 Apr 2015 19:28:42 +0000 (19:28 +0000)
commit1fb76f055a4a0d0a2f5e5d2784b0f070fc279b2b
tree43ed1cc6620254326683e17e02285e417883a69c
parentf089e5c8467047a1571ecbbfc5556a7e619c6b1d
[es6] emit error when for-in loop declarations are initialized in strict mode

The ES6 grammar forbids the initialization of variable declarations in IterationStatements.

This CL will report `for (var x = y in z)` as a SyntaxError in strict mode (as done in JSC). It is possible that this could break sites in sloppy mode, and so that change can wait.

BUG=
R=
LOG=N

Review URL: https://codereview.chromium.org/1033823002

Cr-Commit-Position: refs/heads/master@{#27639}
15 files changed:
src/messages.js
src/parser.cc
src/parser.h
src/preparser.cc
src/preparser.h
test/message/for-in-let-loop-initializers-strict.js [new file with mode: 0644]
test/message/for-in-let-loop-initializers-strict.out [new file with mode: 0644]
test/message/for-in-loop-initializers-strict.js [new file with mode: 0644]
test/message/for-in-loop-initializers-strict.out [new file with mode: 0644]
test/message/for-of-let-loop-initializers.js [new file with mode: 0644]
test/message/for-of-let-loop-initializers.out [new file with mode: 0644]
test/message/for-of-loop-initializers-sloppy.js [new file with mode: 0644]
test/message/for-of-loop-initializers-sloppy.out [new file with mode: 0644]
test/message/for-of-loop-initializers-strict.js [new file with mode: 0644]
test/message/for-of-loop-initializers-strict.out [new file with mode: 0644]