| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index 0c0fdf08d669470010869e078897bf6eec443175..384f2ed0dc319d386ba0176bf76c2a69aa0a3b2f 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -596,6 +596,7 @@ Parser::Parser(ParseInfo* info)
|
| compile_options_(info->compile_options()),
|
| cached_parse_data_(nullptr),
|
| total_preparse_skipped_(0),
|
| + parameters_end_pos_(info->parameters_end_pos()),
|
| parsing_on_main_thread_(true) {
|
| // Even though we were passed ParseInfo, we should not store it in
|
| // Parser - this makes sure that Isolate is not accidentally accessed via
|
| @@ -2530,6 +2531,14 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
| : function_token_pos;
|
|
|
| bool is_generator = IsGeneratorFunction(kind);
|
| + int expected_parameters_end_pos = parameters_end_pos_;
|
| + if (expected_parameters_end_pos != kNoSourcePosition) {
|
| + // This is the first function literal encountered in an only-single-function
|
| + // eval.
|
| + parameters_end_pos_ = kNoSourcePosition;
|
| + // The function name should have been ignored, giving us null here.
|
| + DCHECK_NULL(function_name);
|
| + }
|
|
|
| // Anonymous functions were passed either the empty symbol or a null
|
| // handle as the function name. Remember if we were passed a non-empty
|
| @@ -2642,6 +2651,17 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
| this->scope()->set_start_position(start_position);
|
| ParserFormalParameters formals(scope);
|
| ParseFormalParameterList(&formals, CHECK_OK);
|
| + if (expected_parameters_end_pos != kNoSourcePosition) {
|
| + // Check for '(' or ')' shenanigans in the parameter string for dynamic
|
| + // functions.
|
| + if (peek_position() != expected_parameters_end_pos) {
|
| + ReportMessageAt(Scanner::Location(expected_parameters_end_pos,
|
| + expected_parameters_end_pos + 1),
|
| + MessageTemplate::kExpectedEndOfParameters);
|
| + *ok = false;
|
| + return nullptr;
|
| + }
|
| + }
|
| Expect(Token::RPAREN, CHECK_OK);
|
| int formals_end_position = scanner()->location().end_pos;
|
|
|
|
|