diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc index 52cf2f06a8..4847c11214 100644 --- a/src/ast/scopes.cc +++ b/src/ast/scopes.cc @@ -180,7 +180,6 @@ void Scope::SetDefaults() { this_function_ = nullptr; scope_inside_with_ = false; scope_calls_eval_ = false; - scope_uses_arguments_ = false; has_arguments_parameter_ = false; scope_uses_super_property_ = false; asm_module_ = false; @@ -429,7 +428,6 @@ void Scope::PropagateUsageFlagsToScope(Scope* other) { DCHECK_NOT_NULL(other); DCHECK(!already_resolved()); DCHECK(!other->already_resolved()); - if (uses_arguments()) other->RecordArgumentsUsage(); if (uses_super_property()) other->RecordSuperPropertyUsage(); if (calls_eval()) other->RecordEvalCall(); } @@ -1030,7 +1028,6 @@ void Scope::Print(int n) { if (asm_function_) Indent(n1, "// scope is an asm function\n"); if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n"); if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n"); - if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n"); if (scope_uses_super_property_) Indent(n1, "// scope uses 'super' property\n"); if (outer_scope_calls_sloppy_eval_) { diff --git a/src/ast/scopes.h b/src/ast/scopes.h index e014af7bba..d8edf9148f 100644 --- a/src/ast/scopes.h +++ b/src/ast/scopes.h @@ -270,9 +270,6 @@ class Scope: public ZoneObject { // Inform the scope that the corresponding code contains an eval call. void RecordEvalCall() { scope_calls_eval_ = true; } - // Inform the scope that the corresponding code uses "arguments". - void RecordArgumentsUsage() { scope_uses_arguments_ = true; } - // Inform the scope that the corresponding code uses "super". void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } @@ -376,8 +373,6 @@ class Scope: public ZoneObject { // Is this scope inside a with statement. bool inside_with() const { return scope_inside_with_; } - // Does this scope access "arguments". - bool uses_arguments() const { return scope_uses_arguments_; } // Does this scope access "super" property (super.foo). bool uses_super_property() const { return scope_uses_super_property_; } // Does this scope have the potential to execute declarations non-linearly? @@ -681,8 +676,6 @@ class Scope: public ZoneObject { // This scope or a nested catch scope or with scope contain an 'eval' call. At // the 'eval' call site this scope is the declaration scope. bool scope_calls_eval_; - // This scope uses "arguments". - bool scope_uses_arguments_; // This scope uses "super" property ('super.foo'). bool scope_uses_super_property_; // This scope has a parameter called "arguments". diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h index ffb481134a..000b606a95 100644 --- a/src/parsing/parser-base.h +++ b/src/parsing/parser-base.h @@ -1367,7 +1367,6 @@ ParserBase::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, } } if (this->IsArguments(name)) { - scope()->RecordArgumentsUsage(); classifier->RecordStrictModeFormalParameterError( scanner()->location(), MessageTemplate::kStrictEvalArguments); if (is_strict(language_mode())) { @@ -1434,9 +1433,7 @@ ParserBase::ParseIdentifierOrStrictReservedWord( return Traits::EmptyIdentifier(); } - IdentifierT name = this->GetSymbol(scanner()); - if (this->IsArguments(name)) scope()->RecordArgumentsUsage(); - return name; + return this->GetSymbol(scanner()); } template @@ -1454,9 +1451,7 @@ ParserBase::ParseIdentifierName(bool* ok) { return Traits::EmptyIdentifier(); } - IdentifierT name = this->GetSymbol(scanner()); - if (this->IsArguments(name)) scope()->RecordArgumentsUsage(); - return name; + return this->GetSymbol(scanner()); } diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index 4d14da4604..e10feab72c 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -1104,8 +1104,11 @@ TEST(ScopeUsesArgumentsSuperThis) { DCHECK_NOT_NULL(scope); DCHECK_NULL(scope->sibling()); } - CHECK_EQ((source_data[i].expected & ARGUMENTS) != 0, - scope->uses_arguments()); + // Arrows themselves never get an arguments object. + if ((source_data[i].expected & ARGUMENTS) != 0 && + !scope->is_arrow_scope()) { + CHECK_NOT_NULL(scope->arguments()); + } CHECK_EQ((source_data[i].expected & SUPER_PROPERTY) != 0, scope->uses_super_property()); if ((source_data[i].expected & THIS) != 0) {