Reviewers: ulan,

Message:
Thanks for comments!



https://codereview.chromium.org/152813005/diff/10007/src/parser.cc
File src/parser.cc (right):

https://codereview.chromium.org/152813005/diff/10007/src/parser.cc#newcode986
src/parser.cc:986: Handle<String> name = ParseIdentifier(false,
CHECK_OK);
On 2014/02/05 16:05:42, ulan wrote:
I prefer enums to flags, because they are more readable, like:
ParseIdentifier(STRICT_EVAL_ARGUMENTS, CHECK_OK);
ParseIdentifier(CLASSIC_EVAL_ARGUMENTS, CHECK_OK);
but you may disagree.

Done: kDontAllowEnumOrArguments and kAllowEnumOrArguments. (This is
independent of the strict vs. classic mode; even in strict mode we allow
them in some contexts ("var foo = eval;"))

Description:
Make strict more error messages about "eval" and "arguments" less specific.

We used to have error messages which provide context, like "Variable name may not be eval or arguments in strict mode", but for other illegal words we only
have non-context specific error messages like "Unexpected reserved word".

Providing the context makes the code unnecessarily complex, since every
individual place must remember to check for eval or arguments. This CL produces
a unified error message ("Unexpected eval or arguments in strict mode"), and
puts
the error reporting to (Pre)Parser::ParseIdentifier.

Notes:

- The module feature is so experimental, that I decided to not allow "eval" or "arguments" as module-related identifiers in the strict mode (even though this
check wasn't there before).

- Unfortunately, there were some inconsistencies, since it was the
responsibility of the caller of ParseIdentifier to check "eval" and "arguments" and some places didn't have the check for no good reason. This CL is supposed to
keep backward compatibility and *not* introduce any new errors.

- ECMA allows "eval" and "arguments" as labels even in strict mode. (Syntax:
"LabelledStatement: Identifier : Statement", and no strict mode restrictions on
Identifier are listed.)

- Tests which compare error message strings will fail, and need to be updated.

BUG=3126
LOG=N
[email protected]

Please review this at https://codereview.chromium.org/152813005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+136, -130 lines):
  M src/messages.js
  M src/parser.h
  M src/parser.cc
  M src/preparser.h
  M src/preparser.cc
  M test/webkit/fast/js/basic-strict-mode-expected.txt


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to