| Index: src/ast/scopes.cc
|
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
|
| index 635fec817740b317f8e948d29c4c457c74c2794e..02b34335265bf72633fe0dc1486141b8d1aeae00 100644
|
| --- a/src/ast/scopes.cc
|
| +++ b/src/ast/scopes.cc
|
| @@ -492,32 +492,15 @@
|
| receiver_ = var;
|
| }
|
|
|
| -void DeclarationScope::DeclareArguments(AstValueFactory* ast_value_factory) {
|
| - DCHECK(is_function_scope());
|
| - DCHECK(!is_arrow_scope());
|
| -
|
| - // Check if there's lexically declared variable named arguments to avoid
|
| - // redeclaration. See ES#sec-functiondeclarationinstantiation, step 20.
|
| - Variable* arg_variable = LookupLocal(ast_value_factory->arguments_string());
|
| - if (arg_variable != nullptr && IsLexicalVariableMode(arg_variable->mode())) {
|
| - return;
|
| - }
|
| -
|
| - // Declare 'arguments' variable which exists in all non arrow functions.
|
| - // Note that it might never be accessed, in which case it won't be
|
| - // allocated during variable allocation.
|
| - if (arg_variable == nullptr) {
|
| - arguments_ = Declare(zone(), this, ast_value_factory->arguments_string(),
|
| - VAR, Variable::ARGUMENTS, kCreatedInitialized);
|
| - } else {
|
| - arguments_ = arg_variable;
|
| - }
|
| -}
|
| -
|
| void DeclarationScope::DeclareDefaultFunctionVariables(
|
| AstValueFactory* ast_value_factory) {
|
| DCHECK(is_function_scope());
|
| DCHECK(!is_arrow_scope());
|
| + // Declare 'arguments' variable which exists in all non arrow functions.
|
| + // Note that it might never be accessed, in which case it won't be
|
| + // allocated during variable allocation.
|
| + arguments_ = Declare(zone(), this, ast_value_factory->arguments_string(), VAR,
|
| + Variable::ARGUMENTS, kCreatedInitialized);
|
|
|
| new_target_ = Declare(zone(), this, ast_value_factory->new_target_string(),
|
| CONST, Variable::NORMAL, kCreatedInitialized);
|
| @@ -1525,8 +1508,8 @@
|
|
|
| bool uses_sloppy_arguments = false;
|
|
|
| + // Functions have 'arguments' declared implicitly in all non arrow functions.
|
| if (arguments_ != nullptr) {
|
| - DCHECK(!is_arrow_scope());
|
| // 'arguments' is used. Unless there is also a parameter called
|
| // 'arguments', we must be conservative and allocate all parameters to
|
| // the context assuming they will be captured by the arguments object.
|
| @@ -1547,6 +1530,9 @@
|
| // allocate the arguments object by nulling out arguments_.
|
| arguments_ = nullptr;
|
| }
|
| +
|
| + } else {
|
| + DCHECK(is_arrow_scope());
|
| }
|
|
|
| // The same parameter may occur multiple times in the parameters_ list.
|
|
|