Commit 0c92a6eb authored by marja's avatar marja Committed by Commit bot

Scope cleanup: remove unneeded params.

BUG=

Review-Url: https://codereview.chromium.org/2517993002
Cr-Commit-Position: refs/heads/master@{#41145}
parent 2e5a90fd
......@@ -243,8 +243,8 @@ Scope::Scope(Zone* zone, const AstRawString* catch_variable_name,
// Cache the catch variable, even though it's also available via the
// scope_info, as the parser expects that a catch scope always has the catch
// variable as first and only variable.
Variable* variable = Declare(zone, this, catch_variable_name, VAR,
NORMAL_VARIABLE, kCreatedInitialized);
Variable* variable = Declare(zone, catch_variable_name, VAR, NORMAL_VARIABLE,
kCreatedInitialized);
AllocateHeapSlot(variable);
}
......@@ -579,7 +579,7 @@ void DeclarationScope::DeclareThis(AstValueFactory* ast_value_factory) {
bool subclass_constructor = IsSubclassConstructor(function_kind_);
Variable* var = Declare(
zone(), this, ast_value_factory->this_string(),
zone(), ast_value_factory->this_string(),
subclass_constructor ? CONST : VAR, THIS_VARIABLE,
subclass_constructor ? kNeedsInitialization : kCreatedInitialized);
receiver_ = var;
......@@ -594,8 +594,8 @@ void DeclarationScope::DeclareArguments(AstValueFactory* ast_value_factory) {
// 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, NORMAL_VARIABLE, kCreatedInitialized);
arguments_ = Declare(zone(), ast_value_factory->arguments_string(), VAR,
NORMAL_VARIABLE, kCreatedInitialized);
} else if (IsLexicalVariableMode(arguments_->mode())) {
// Check if there's lexically declared variable named arguments to avoid
// redeclaration. See ES#sec-functiondeclarationinstantiation, step 20.
......@@ -609,14 +609,13 @@ void DeclarationScope::DeclareDefaultFunctionVariables(
DCHECK(!is_arrow_scope());
DeclareThis(ast_value_factory);
new_target_ = Declare(zone(), this, ast_value_factory->new_target_string(),
CONST, NORMAL_VARIABLE, kCreatedInitialized);
new_target_ = Declare(zone(), ast_value_factory->new_target_string(), CONST,
NORMAL_VARIABLE, kCreatedInitialized);
if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) ||
IsAccessorFunction(function_kind_)) {
this_function_ =
Declare(zone(), this, ast_value_factory->this_function_string(), CONST,
NORMAL_VARIABLE, kCreatedInitialized);
this_function_ = Declare(zone(), ast_value_factory->this_function_string(),
CONST, NORMAL_VARIABLE, kCreatedInitialized);
}
}
......@@ -686,13 +685,13 @@ void DeclarationScope::AddLocal(Variable* var) {
locals_.Add(var);
}
Variable* Scope::Declare(Zone* zone, Scope* scope, const AstRawString* name,
Variable* Scope::Declare(Zone* zone, const AstRawString* name,
VariableMode mode, VariableKind kind,
InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag) {
bool added;
Variable* var =
variables_.Declare(zone, scope, name, mode, kind, initialization_flag,
variables_.Declare(zone, this, name, mode, kind, initialization_flag,
maybe_assigned_flag, &added);
if (added) locals_.Add(var);
return var;
......@@ -844,8 +843,7 @@ Variable* DeclarationScope::DeclareParameter(
if (mode == TEMPORARY) {
var = NewTemporary(name);
} else {
var =
Declare(zone(), this, name, mode, NORMAL_VARIABLE, kCreatedInitialized);
var = Declare(zone(), name, mode, NORMAL_VARIABLE, kCreatedInitialized);
// TODO(wingo): Avoid O(n^2) check.
*is_duplicate = IsDeclaredParameter(name);
}
......@@ -865,8 +863,7 @@ Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
// introduced during variable allocation, and TEMPORARY variables are
// allocated via NewTemporary().
DCHECK(IsDeclaredVariableMode(mode));
return Declare(zone(), this, name, mode, kind, init_flag,
maybe_assigned_flag);
return Declare(zone(), name, mode, kind, init_flag, maybe_assigned_flag);
}
Variable* Scope::DeclareVariable(
......
......@@ -426,9 +426,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
}
private:
Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name,
VariableMode mode, VariableKind kind,
InitializationFlag initialization_flag,
Variable* Declare(Zone* zone, const AstRawString* name, VariableMode mode,
VariableKind kind, InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
// This method should only be invoked on scopes created during parsing (i.e.,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment