Make let/const outside of the extended mode early errors (under harmony flag).
authorkeuchel@chromium.org <keuchel@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 29 Nov 2011 06:38:04 +0000 (06:38 +0000)
committerkeuchel@chromium.org <keuchel@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 29 Nov 2011 06:38:04 +0000 (06:38 +0000)
commite26093f3d827a748e27f66fd404adb3f9560e685
tree9857aa7f604dfe8451733bf0e32398844bcd9bb1
parentf35e53ff50e7052ba75d993a1ee7bd8651c32d7d
Make let/const outside of the extended mode early errors (under harmony flag).

The ES.next drafts require that source code that matches the productions for
let and const bindings outside the extended mode trigger early syntax
errors. This CL adapts the parser / preparser accordingly under the harmony
scoping flag.

Summary:
* Harmony scoping flag not set: Old semantics allowing const in classic mode
with function level scope. Const binding in strict mode and let bindings in
classic and strict mode trigger early syntax errors.
* Harmony scoping is set: Use new harmony const and let in
extended mode and old const in classic mode. This is to preserve
compatibility with current web pages that already use
non-standard implementations of const. An early syntax error is
thrown on const in strict mode and on let in classic and strict
mode.

This depends on:
http://codereview.chromium.org/8562002/

TEST=mjsunit/harmony/block-early-errors.js

Review URL: http://codereview.chromium.org/8564001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10079 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
src/messages.js
src/parser.cc
src/preparser.cc
test/mjsunit/harmony/block-early-errors.js [new file with mode: 0644]