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

Unified Diff: src/preparser.cc

Issue 899363002: Allow eval and arguments as property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: expand test Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 170c9e725135818e3ff81a9914b16429b387dfa1..861011346355b40c5e2465d39ee4d8f717596a91 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -940,33 +940,22 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
// Validate strict mode. We can do this only after parsing the function,
// since the function can declare itself strict.
// Concise methods use StrictFormalParameters.
- if (is_strict(language_mode()) || IsConciseMethod(kind) || is_rest) {
- if (function_name.IsEvalOrArguments()) {
- ReportMessageAt(function_name_location, "strict_eval_arguments");
- *ok = false;
- return Expression::Default();
- }
- if (name_is_strict_reserved) {
- ReportMessageAt(function_name_location, "unexpected_strict_reserved");
- *ok = false;
- return Expression::Default();
- }
- if (eval_args_error_loc.IsValid()) {
- ReportMessageAt(eval_args_error_loc, "strict_eval_arguments");
- *ok = false;
- return Expression::Default();
- }
- if (dupe_error_loc.IsValid()) {
- ReportMessageAt(dupe_error_loc, "strict_param_dupe");
- *ok = false;
- return Expression::Default();
- }
- if (reserved_error_loc.IsValid()) {
- ReportMessageAt(reserved_error_loc, "unexpected_strict_reserved");
- *ok = false;
- return Expression::Default();
+ bool check_params =
+ is_strict(language_mode()) || IsConciseMethod(kind) || is_rest;
+ if (check_params) {
+ bool check_name = is_strict(language_mode()) && !IsConciseMethod(kind) &&
+ !IsAccessorFunction(kind);
+ if (!check_name) {
+ CheckStrictFunctionParameters(eval_args_error_loc, dupe_error_loc,
arv (Not doing code reviews) 2015/02/06 00:03:55 Another option might be to pass in language_mode()
adamk 2015/02/06 00:23:58 Yeah, I think that's a better move than having to
+ reserved_error_loc, CHECK_OK);
+ } else {
+ CheckStrictFunctionNameAndParameters(
+ function_name, name_is_strict_reserved, function_name_location,
+ eval_args_error_loc, dupe_error_loc, reserved_error_loc, CHECK_OK);
}
+ }
+ if (is_strict(language_mode())) {
int end_position = scanner()->location().end_pos;
CheckStrictOctalLiteral(start_position, end_position, CHECK_OK);
}
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698