Chromium Code Reviews| 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); |
| } |