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

Unified Diff: src/ast/scopes.cc

Issue 2349193002: Don't make immediately resolved proxies unresolved (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 | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 87ffb9dd7a529969e4667b51f0ae0f3bf74d9b35..86f87b15f26d575f9929752c1625978f0f9db78a 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -478,7 +478,7 @@ void DeclarationScope::HoistSloppyBlockFunctions(AstNodeFactory* factory) {
// Declare a var-style binding for the function in the outer scope
if (!var_created) {
var_created = true;
- VariableProxy* proxy = NewUnresolved(factory, name);
+ VariableProxy* proxy = factory->NewVariableProxy(name, NORMAL_VARIABLE);
Declaration* declaration =
factory->NewVariableDeclaration(proxy, this, kNoSourcePosition);
// Based on the preceding check, it doesn't matter what we pass as
@@ -1490,14 +1490,8 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy, Scope* outer_scope_end) {
void Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy) {
DCHECK(info->script_scope()->is_script_scope());
-
- // If the proxy is already resolved there's nothing to do
- // (functions and consts may be resolved by the parser).
- if (proxy->is_resolved()) return;
-
- // Otherwise, try to resolve the variable.
+ DCHECK(!proxy->is_resolved());
Variable* var = LookupRecursive(proxy, nullptr);
-
ResolveTo(info, proxy, var);
}
@@ -1549,7 +1543,7 @@ VariableProxy* Scope::FetchFreeVariables(DeclarationScope* max_outer_scope,
for (VariableProxy *proxy = unresolved_, *next = nullptr; proxy != nullptr;
proxy = next) {
next = proxy->next_unresolved();
- if (proxy->is_resolved()) continue;
+ DCHECK(!proxy->is_resolved());
Variable* var = LookupRecursive(proxy, max_outer_scope->outer_scope());
if (var == nullptr) {
proxy->set_next_unresolved(stack);
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698