| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index d24da8ab9097cb075313ea7d99f958cd0f05216a..1e61754b0c0fd0cf31c225b9f38266827017a574 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -742,6 +742,16 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
|
| int beg_pos = scanner()->location().beg_pos;
|
| parsing_module_ = info->is_module();
|
| if (parsing_module_) {
|
| + // Declare the special module parameter.
|
| + auto name = ast_value_factory()->empty_string();
|
| + bool is_duplicate;
|
| + bool is_rest = false;
|
| + bool is_optional = false;
|
| + auto var = scope->DeclareParameter(name, VAR, is_optional, is_rest,
|
| + &is_duplicate, ast_value_factory());
|
| + DCHECK(!is_duplicate);
|
| + var->AllocateTo(VariableLocation::PARAMETER, 0);
|
| +
|
| ParseModuleItemList(body, &ok);
|
| ok = ok &&
|
| module()->Validate(this->scope()->AsModuleScope(),
|
| @@ -785,9 +795,10 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
|
|
|
| if (ok) {
|
| RewriteDestructuringAssignments();
|
| + int parameter_count = parsing_module_ ? 1 : 0;
|
| result = factory()->NewScriptOrEvalFunctionLiteral(
|
| scope, body, function_state.materialized_literal_count(),
|
| - function_state.expected_property_count());
|
| + function_state.expected_property_count(), parameter_count);
|
| }
|
| }
|
|
|
|
|