 Chromium Code Reviews
 Chromium Code Reviews Issue 2362463003:
  Declare the arguments object before creating the function var, to make sure it masks it  (Closed)
    
  
    Issue 2362463003:
  Declare the arguments object before creating the function var, to make sure it masks it  (Closed) 
  | Index: src/parsing/parser.cc | 
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc | 
| index b1f7c667ef9ac4b5c115bdab0cbef30de7ae5e90..f7965096f9e3a85a989fb00901149ec11e2917e4 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,10 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody( | 
| } | 
| } | 
| + if (!IsArrowFunction(kind)) { | 
| + function_scope->DeclareArguments(ast_value_factory()); | 
| 
adamk
2016/09/22 18:16:57
Please add a comment here about why this must be d
 | 
| + } | 
| + | 
| if (function_type == FunctionLiteral::kNamedExpression) { | 
| Statement* statement; | 
| if (function_scope->LookupLocal(function_name) == nullptr) { |