Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index beb572114451214ef6ee12a4ddbb54347e78c314..ed38ab98f86fd2800d17f93009098553fc4f6ccc 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -7,6 +7,7 @@ |
#include <set> |
#include "src/accessors.h" |
+#include "src/ast/ast.h" |
#include "src/bootstrapper.h" |
#include "src/messages.h" |
#include "src/parsing/parse-info.h" |
@@ -840,6 +841,29 @@ Variable* Scope::DeclareVariable( |
return var; |
} |
+VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory, |
+ const AstRawString* name, |
+ int start_position, int end_position, |
+ Variable::Kind kind) { |
+ // Note that we must not share the unresolved variables with |
+ // the same name because they may be removed selectively via |
+ // RemoveUnresolved(). |
+ DCHECK(!already_resolved_); |
+ DCHECK_EQ(factory->zone(), zone()); |
+ VariableProxy* proxy = |
+ factory->NewVariableProxy(name, kind, start_position, end_position); |
+ proxy->set_next_unresolved(unresolved_); |
+ unresolved_ = proxy; |
+ return proxy; |
+} |
+ |
+void Scope::AddUnresolved(VariableProxy* proxy) { |
+ DCHECK(!already_resolved_); |
+ DCHECK(!proxy->is_resolved()); |
+ proxy->set_next_unresolved(unresolved_); |
+ unresolved_ = proxy; |
+} |
+ |
Variable* DeclarationScope::DeclareDynamicGlobal(const AstRawString* name, |
Variable::Kind kind) { |
DCHECK(is_script_scope()); |