Commit fbd4cc9a authored by neis's avatar neis Committed by Commit bot

[ast] Minor cleanup in scopes.cc.

- Remove TODO concerning maybe-assigned. For LOOKUP variables, the flag
  doesn't really matter, so let's just set it to true to avoid confusion.

- Simplify a condition.

R=adamk@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2677653003
Cr-Commit-Position: refs/heads/master@{#42947}
parent a0b7db1b
......@@ -994,9 +994,8 @@ Variable* Scope::DeclareVariable(
// with this new binding by doing the following:
// The proxy is bound to a lookup variable to force a dynamic declaration
// using the DeclareEvalVar or DeclareEvalFunction runtime functions.
VariableKind kind = NORMAL_VARIABLE;
// TODO(sigurds) figure out if kNotAssigned is OK here
var = new (zone()) Variable(this, name, mode, kind, init, kNotAssigned);
var = new (zone())
Variable(this, name, mode, NORMAL_VARIABLE, init, kMaybeAssigned);
var->AllocateTo(VariableLocation::LOOKUP, -1);
} else {
// Declare the variable in the declaration scope.
......@@ -1096,9 +1095,8 @@ Variable* Scope::DeclareVariableName(const AstRawString* name,
DCHECK_NE(var, kDummyPreParserVariable);
if (var == nullptr) {
var = DeclareLocal(name, mode);
} else if (!IsLexicalVariableMode(var->mode()) &&
!IsLexicalVariableMode(mode)) {
DCHECK_EQ(mode, VAR);
} else if (mode == VAR) {
DCHECK_EQ(var->mode(), VAR);
var->set_maybe_assigned();
}
var->set_is_used();
......
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