| Index: src/scopes.cc
|
| diff --git a/src/scopes.cc b/src/scopes.cc
|
| index 859cbd1ae61c8323c4f9edfb215ac1b8bfd53cc8..70a52c05dc1a529d48bf4c9edfb543e88b2e8078 100644
|
| --- a/src/scopes.cc
|
| +++ b/src/scopes.cc
|
| @@ -412,14 +412,20 @@ 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 /* is valid LHS */,
|
| + Variable::NORMAL, kCreatedInitialized);
|
| + VariableProxy* proxy = factory->NewVariableProxy(var);
|
| + VariableDeclaration* declaration =
|
| + factory->NewVariableDeclaration(proxy, mode, this);
|
| + DeclareFunctionVar(declaration);
|
| var->AllocateTo(Variable::CONTEXT, index);
|
| return var;
|
| } else {
|
| @@ -791,7 +797,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 +830,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 +1210,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 +1252,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
|
|
|