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

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: Cleanup based on code review 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..6889e71d25010e1d31008df346a1295a1da2147f 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -937,36 +937,16 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
}
Expect(Token::RBRACE, CHECK_OK);
- // 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();
- }
+ // Validate name and parameter names. We can do this only after parsing the
+ // function, since the function can declare itself strict.
+ CheckFunctionName(language_mode(), kind, function_name,
+ name_is_strict_reserved, function_name_location, CHECK_OK);
+ const bool use_strict_params = is_rest || IsConciseMethod(kind);
+ CheckFunctionParameterNames(language_mode(), use_strict_params,
+ 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