Commit 7743e499 authored by neis's avatar neis Committed by Commit bot

[ast] Simplify FetchFreeVariables.

This CL removes the ParseInfo argument from FetchFreeVariables, since it seems
to have become unnecessary.

R=verwaest@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2491373004
Cr-Commit-Position: refs/heads/master@{#40933}
parent 135b9f93
...@@ -1247,7 +1247,7 @@ Scope* Scope::GetOuterScopeWithContext() { ...@@ -1247,7 +1247,7 @@ Scope* Scope::GetOuterScopeWithContext() {
Handle<StringSet> DeclarationScope::CollectNonLocals( Handle<StringSet> DeclarationScope::CollectNonLocals(
ParseInfo* info, Handle<StringSet> non_locals) { ParseInfo* info, Handle<StringSet> non_locals) {
VariableProxy* free_variables = FetchFreeVariables(this, true, info); VariableProxy* free_variables = FetchFreeVariables(this, true);
for (VariableProxy* proxy = free_variables; proxy != nullptr; for (VariableProxy* proxy = free_variables; proxy != nullptr;
proxy = proxy->next_unresolved()) { proxy = proxy->next_unresolved()) {
non_locals = StringSet::Add(non_locals, proxy->name()); non_locals = StringSet::Add(non_locals, proxy->name());
...@@ -1734,7 +1734,7 @@ void Scope::ResolveVariablesRecursively(ParseInfo* info) { ...@@ -1734,7 +1734,7 @@ void Scope::ResolveVariablesRecursively(ParseInfo* info) {
} }
VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope, VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope,
bool try_to_resolve, ParseInfo* info, bool try_to_resolve,
VariableProxy* stack) { VariableProxy* stack) {
for (VariableProxy *proxy = unresolved_, *next = nullptr; proxy != nullptr; for (VariableProxy *proxy = unresolved_, *next = nullptr; proxy != nullptr;
proxy = next) { proxy = next) {
...@@ -1747,8 +1747,6 @@ VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope, ...@@ -1747,8 +1747,6 @@ VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope,
if (var == nullptr) { if (var == nullptr) {
proxy->set_next_unresolved(stack); proxy->set_next_unresolved(stack);
stack = proxy; stack = proxy;
} else if (info != nullptr) {
ResolveTo(info, proxy, var);
} else { } else {
var->set_is_used(); var->set_is_used();
} }
...@@ -1758,8 +1756,7 @@ VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope, ...@@ -1758,8 +1756,7 @@ VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope,
unresolved_ = nullptr; unresolved_ = nullptr;
for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
stack = stack = scope->FetchFreeVariables(max_outer_scope, try_to_resolve, stack);
scope->FetchFreeVariables(max_outer_scope, try_to_resolve, info, stack);
} }
return stack; return stack;
......
...@@ -520,10 +520,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -520,10 +520,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
// Finds free variables of this scope. This mutates the unresolved variables // Finds free variables of this scope. This mutates the unresolved variables
// list along the way, so full resolution cannot be done afterwards. // list along the way, so full resolution cannot be done afterwards.
// If a ParseInfo* is passed, non-free variables will be resolved.
VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope, VariableProxy* FetchFreeVariables(DeclarationScope* max_outer_scope,
bool try_to_resolve = true, bool try_to_resolve = true,
ParseInfo* info = nullptr,
VariableProxy* stack = nullptr); VariableProxy* stack = nullptr);
// Predicates. // Predicates.
......
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