| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index b1f7c667ef9ac4b5c115bdab0cbef30de7ae5e90..29b26055c3d8e7519e097c6fe912437c63712242 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -2842,10 +2842,6 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
|
|
| // Parsing the body may change the language mode in our scope.
|
| language_mode = scope->language_mode();
|
| - scope->DeclareArguments(ast_value_factory());
|
| - if (main_scope != scope) {
|
| - main_scope->DeclareArguments(ast_value_factory());
|
| - }
|
|
|
| // Validate name and parameter names. We can do this only after parsing the
|
| // function, since the function can declare itself strict.
|
| @@ -3434,6 +3430,13 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody(
|
| }
|
| }
|
|
|
| + if (!IsArrowFunction(kind)) {
|
| + // Declare arguments after parsing the function since lexical 'arguments'
|
| + // masks the arguments object. Declare arguments before declaring the
|
| + // function var since the arguments object masks 'function arguments'.
|
| + function_scope->DeclareArguments(ast_value_factory());
|
| + }
|
| +
|
| if (function_type == FunctionLiteral::kNamedExpression) {
|
| Statement* statement;
|
| if (function_scope->LookupLocal(function_name) == nullptr) {
|
|
|