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

Unified Diff: src/parser.cc

Issue 332053004: Parser: Refactor strict mode checks for functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 722ed8beaf470288df7de99157ea58a191ec7c23..cb8e4d747d2bfae97046030a27ce96d7e2960dfb 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -3506,34 +3506,15 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
handler_count = function_state.handler_count();
}
- // Validate strict mode. We can do this only after parsing the function,
- // since the function can declare itself strict.
+ // Validate strict mode.
if (strict_mode() == STRICT) {
- if (IsEvalOrArguments(function_name)) {
- ReportMessageAt(function_name_location, "strict_eval_arguments");
- *ok = false;
- return NULL;
- }
- if (name_is_strict_reserved) {
- ReportMessageAt(function_name_location, "unexpected_strict_reserved");
- *ok = false;
- return NULL;
- }
- if (eval_args_error_log.IsValid()) {
- ReportMessageAt(eval_args_error_log, "strict_eval_arguments");
- *ok = false;
- return NULL;
- }
- if (dupe_error_loc.IsValid()) {
- ReportMessageAt(dupe_error_loc, "strict_param_dupe");
- *ok = false;
- return NULL;
- }
- if (reserved_loc.IsValid()) {
- ReportMessageAt(reserved_loc, "unexpected_strict_reserved");
- *ok = false;
- return NULL;
- }
+ CheckStrictFunctionNameAndParameters(function_name,
+ name_is_strict_reserved,
+ function_name_location,
+ eval_args_error_log,
+ dupe_error_loc,
+ reserved_loc,
+ CHECK_OK);
CheckOctalLiteral(scope->start_position(),
scope->end_position(),
CHECK_OK);
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698