Index: src/scopes.cc |
diff --git a/src/scopes.cc b/src/scopes.cc |
index 859cbd1ae61c8323c4f9edfb215ac1b8bfd53cc8..80c7eb2ae93bd8f49d8d885f4976c11c4229c620 100644 |
--- a/src/scopes.cc |
+++ b/src/scopes.cc |
@@ -412,14 +412,19 @@ Variable* Scope::LocalLookup(Handle<String> name) { |
Variable* Scope::LookupFunctionVar(Handle<String> name, |
AstNodeFactory<AstNullVisitor>* factory) { |
- if (function_ != NULL && function_->name().is_identical_to(name)) { |
- return function_->var(); |
+ if (function_ != NULL && function_->proxy()->name().is_identical_to(name)) { |
+ return function_->proxy()->var(); |
} else if (!scope_info_.is_null()) { |
// If we are backed by a scope info, try to lookup the variable there. |
VariableMode mode; |
int index = scope_info_->FunctionContextSlotIndex(*name, &mode); |
if (index < 0) return NULL; |
- Variable* var = DeclareFunctionVar(name, mode, factory); |
+ Variable* var = new Variable( |
+ this, name, mode, true, Variable::NORMAL, kCreatedInitialized); |
fschneider
2012/04/11 11:00:42
Boolean parameter should have a comment.
rossberg
2012/04/16 11:25:13
Done.
|
+ VariableProxy* proxy = factory->NewVariableProxy(var); |
+ VariableDeclaration* declaration = |
+ factory->NewVariableDeclaration(proxy, mode, this); |
+ DeclareFunctionVar(declaration); |
var->AllocateTo(Variable::CONTEXT, index); |
return var; |
} else { |
@@ -791,7 +796,7 @@ void Scope::Print(int n) { |
// Function name, if any (named function literals, only). |
if (function_ != NULL) { |
Indent(n1, "// (local) function name: "); |
- PrintName(function_->name()); |
+ PrintName(function_->proxy()->name()); |
PrintF("\n"); |
} |
@@ -824,7 +829,7 @@ void Scope::Print(int n) { |
// Print locals. |
Indent(n1, "// function var\n"); |
if (function_ != NULL) { |
- PrintVar(n1, function_->var()); |
+ PrintVar(n1, function_->proxy()->var()); |
} |
Indent(n1, "// temporary vars\n"); |
@@ -1204,7 +1209,7 @@ void Scope::AllocateNonParameterLocals() { |
// because of the current ScopeInfo implementation (see |
// ScopeInfo::ScopeInfo(FunctionScope* scope) constructor). |
if (function_ != NULL) { |
- AllocateNonParameterLocal(function_->var()); |
+ AllocateNonParameterLocal(function_->proxy()->var()); |
} |
} |
@@ -1246,14 +1251,14 @@ void Scope::AllocateVariablesRecursively() { |
int Scope::StackLocalCount() const { |
return num_stack_slots() - |
- (function_ != NULL && function_->var()->IsStackLocal() ? 1 : 0); |
+ (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); |
} |
int Scope::ContextLocalCount() const { |
if (num_heap_slots() == 0) return 0; |
return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
- (function_ != NULL && function_->var()->IsContextSlot() ? 1 : 0); |
+ (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
} |
} } // namespace v8::internal |