Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Issue 8564001: Make let/const outside of the extended mode early errors (under harmony flag). (Closed)

Created:
9 years, 1 month ago by Steven
Modified:
9 years ago
CC:
v8-dev
Visibility:
Public.

Description

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 Committed: http://code.google.com/p/v8/source/detail?r=10079

Patch Set 1 #

Patch Set 2 : Address comments and adapt preparser. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+105 lines, -4 lines) Patch
M src/messages.js View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/parser.cc View 1 3 chunks +22 lines, -1 line 0 comments Download
M src/preparser.cc View 1 4 chunks +26 lines, -3 lines 0 comments Download
A test/mjsunit/harmony/block-early-errors.js View 1 1 chunk +56 lines, -0 lines 1 comment Download

Messages

Total messages: 7 (0 generated)
Steven
PTAL.
9 years, 1 month ago (2011-11-14 08:49:05 UTC) #1
Jakob Kummerow
LGTM
9 years, 1 month ago (2011-11-14 10:43:47 UTC) #2
Erik Corry
Does this make 'const' into a syntax error in classic mode? That would seem to ...
9 years, 1 month ago (2011-11-14 20:25:03 UTC) #3
Steven
I've updated the description with more thorough information. The CL preserves the old semantics for ...
9 years, 1 month ago (2011-11-14 22:14:50 UTC) #4
Erik Corry
This confuses user-level opt-in and developer-level opt in. As I understand it, the --harmony flag ...
9 years, 1 month ago (2011-11-15 08:05:20 UTC) #5
Steven
@Erik: Yes I can see that you would want to preserve compatibility. I have changed ...
9 years, 1 month ago (2011-11-15 09:54:26 UTC) #6
Jakob Kummerow
9 years, 1 month ago (2011-11-15 12:59:23 UTC) #7
LGTM with a nit.

http://codereview.chromium.org/8564001/diff/2002/test/mjsunit/harmony/block-e...
File test/mjsunit/harmony/block-early-errors.js (right):

http://codereview.chromium.org/8564001/diff/2002/test/mjsunit/harmony/block-e...
test/mjsunit/harmony/block-early-errors.js:34: string.indexOf("Illegal const")
>= 0);
This line is no longer necessary.

Powered by Google App Engine
This is Rietveld 408576698