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

Unified Diff: src/preparser.cc

Issue 1083623002: Refactor formal parameter error locations into a class (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 8 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
« src/preparser.h ('K') | « src/preparser.h ('k') | no next file » | 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 5db11dd34d75d3578a2e78c3113baab357d3e46f..1685724fe4482780d2ae64e820ce3773f894dcb9 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -908,22 +908,13 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
PreParserFactory factory(NULL);
FunctionState function_state(&function_state_, &scope_, function_scope, kind,
&factory);
- // We don't yet know if the function will be strict, so we cannot yet produce
- // errors for parameter names or duplicates. However, we remember the
- // locations of these errors if they occur and produce the errors later.
- Scanner::Location eval_args_loc = Scanner::Location::invalid();
- Scanner::Location dupe_loc = Scanner::Location::invalid();
- Scanner::Location reserved_loc = Scanner::Location::invalid();
-
- // Similarly for strong mode.
- Scanner::Location undefined_loc = Scanner::Location::invalid();
+ FormalParameterErrorLocations error_locs;
bool is_rest = false;
Expect(Token::LPAREN, CHECK_OK);
int start_position = scanner()->location().beg_pos;
PreParserFormalParameterList params =
- ParseFormalParameterList(&eval_args_loc, &undefined_loc, &dupe_loc,
- &reserved_loc, &is_rest, CHECK_OK);
+ ParseFormalParameterList(&error_locs, &is_rest, CHECK_OK);
Expect(Token::RPAREN, CHECK_OK);
int formals_end_position = scanner()->location().end_pos;
@@ -950,8 +941,8 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
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_loc,
- undefined_loc, dupe_loc, reserved_loc, CHECK_OK);
+ CheckFunctionParameterNames(language_mode(), use_strict_params, error_locs,
+ CHECK_OK);
if (is_strict(language_mode())) {
int end_position = scanner()->location().end_pos;
« src/preparser.h ('K') | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698