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

Issue 7207007: Proper handling of future reserved words in strict and normal mode. (Closed)

Created:
9 years, 6 months ago by Steven
Modified:
9 years, 6 months ago
Reviewers:
Lasse Reichstein, MarkM
CC:
v8-dev, Mads Ager (chromium)
Visibility:
Public.

Description

Proper handling of future reserved words in strict and normal mode. BUG=86442 TEST=mjsunit/keywords-and-reserved_words.js Committed: http://code.google.com/p/v8/source/detail?r=8421

Patch Set 1 #

Total comments: 38

Patch Set 2 : addressed comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+350 lines, -87 lines) Patch
M src/messages.js View 1 chunk +1 line, -0 lines 0 comments Download
M src/parser.h View 1 chunk +5 lines, -4 lines 0 comments Download
M src/parser.cc View 1 14 chunks +43 lines, -32 lines 0 comments Download
M src/preparser.h View 2 chunks +8 lines, -1 line 0 comments Download
M src/preparser.cc View 10 chunks +48 lines, -15 lines 0 comments Download
M src/scanner-base.h View 1 1 chunk +9 lines, -3 lines 0 comments Download
M src/scanner-base.cc View 1 6 chunks +16 lines, -16 lines 0 comments Download
M src/token.h View 1 chunk +1 line, -0 lines 0 comments Download
A test/mjsunit/keywords-and-reserved_words.js View 1 1 chunk +180 lines, -0 lines 0 comments Download
M test/mjsunit/strict-mode.js View 1 5 chunks +13 lines, -14 lines 0 comments Download
M test/preparser/strict-identifiers.pyt View 3 chunks +26 lines, -2 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Steven
Some parser patches for you to review. I changed both the parser and the preparser. ...
9 years, 6 months ago (2011-06-22 15:06:37 UTC) #1
Lasse Reichstein
I like the consistent renaming of functions and variables. I think the code works. However, ...
9 years, 6 months ago (2011-06-22 20:29:32 UTC) #2
MarkM
On 2011/06/22 20:29:32, Lasse Reichstein wrote: > However, I'm not sure I'd recommend committing it ...
9 years, 6 months ago (2011-06-22 21:26:07 UTC) #3
Lasse Reichstein
The CL description is a little off. We are already handling strict mode future reserved ...
9 years, 6 months ago (2011-06-23 07:57:50 UTC) #4
Lasse Reichstein
Ok, we have the canary channel for a reason, so let's do this. It's probably ...
9 years, 6 months ago (2011-06-23 08:07:28 UTC) #5
Steven
PTAL http://codereview.chromium.org/7207007/diff/1/src/parser.cc File src/parser.cc (right): http://codereview.chromium.org/7207007/diff/1/src/parser.cc#newcode2921 src/parser.cc:2921: Handle<String> name = ParseIdentifierName(CHECK_OK); Better still: revert the ...
9 years, 6 months ago (2011-06-24 11:34:59 UTC) #6
Lasse Reichstein
9 years, 6 months ago (2011-06-24 12:38:04 UTC) #7
LGTM

http://codereview.chromium.org/7207007/diff/1/src/parser.cc
File src/parser.cc (right):

http://codereview.chromium.org/7207007/diff/1/src/parser.cc#newcode3861
src/parser.cc:3861: Handle<String> Parser::ParseIdentifier(bool* ok) {
Makes sense when explained :)

http://codereview.chromium.org/7207007/diff/1/test/mjsunit/keywords-and-reser...
File test/mjsunit/keywords-and-reserved_words.js (right):

http://codereview.chromium.org/7207007/diff/1/test/mjsunit/keywords-and-reser...
test/mjsunit/keywords-and-reserved_words.js:101: assertThrows("var x = { get
foo(" + word + ") { } };", SyntaxError);
Most likely a bad cut-n-paste :).

http://codereview.chromium.org/7207007/diff/1/test/mjsunit/keywords-and-reser...
test/mjsunit/keywords-and-reserved_words.js:137: "if",           "with" ];
On 2011/06/24 11:34:59, Steven wrote:
> This one is nasty. 'var \u0069f;' works but 'eval("var \u0069f;");' does not.
> What exactly would you like to test here?

You have string-escaping to account for, so it should be eval("var \\u0069f").

Perhaps check that 
  "\\u" + ToHexQuad(keyword.charCodeAt(0)) + keyword.substring(1)
(with a suitable implementation of ToHexQuad) is an identifier, not a keyword.

(But it's not important to do it now, save it for a different CL).

http://codereview.chromium.org/7207007/diff/1/test/mjsunit/strict-mode.js
File test/mjsunit/strict-mode.js (right):

http://codereview.chromium.org/7207007/diff/1/test/mjsunit/strict-mode.js#new...
test/mjsunit/strict-mode.js:374: eval("var x = { set " + word + " (value) { 'use
strict'; } };");
Sounds fine.

Powered by Google App Engine
This is Rietveld 408576698