Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1390)

Unified Diff: src/parsing/parser.cc

Issue 2362463003: Declare the arguments object before creating the function var, to make sure it masks it (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | test/mjsunit/regress/regress-649067.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/ast/scopes.cc ('k') | test/mjsunit/regress/regress-649067.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698