| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index aec87ca253fa727009930144feb4d8b6b2acf92a..374b59c7a7e9b4e78707bd57d0ce94ad266e6bdf 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -742,7 +742,9 @@ const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) {
|
|
|
| Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory,
|
| int pos) {
|
| - return factory->NewVariableProxy(scope->receiver(), pos);
|
| + return scope->NewUnresolved(factory,
|
| + parser_->ast_value_factory()->this_string(),
|
| + Variable::THIS, pos, pos + 4);
|
| }
|
|
|
| Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory,
|
| @@ -790,7 +792,8 @@ Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name,
|
| Scope* scope,
|
| AstNodeFactory* factory) {
|
| if (parser_->fni_ != NULL) parser_->fni_->PushVariableName(name);
|
| - return scope->NewUnresolved(factory, name, start_position, end_position);
|
| + return scope->NewUnresolved(factory, name, Variable::NORMAL, start_position,
|
| + end_position);
|
| }
|
|
|
|
|
| @@ -969,6 +972,8 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
|
|
|
| FunctionLiteral* result = NULL;
|
| {
|
| + // TODO(wingo): Add an outer GLOBAL_SCOPE corresponding to the native
|
| + // context, which will have the "this" binding for script scopes.
|
| Scope* scope = NewScope(scope_, SCRIPT_SCOPE);
|
| info->set_script_scope(scope);
|
| if (!info->context().is_null() && !info->context()->IsNativeContext()) {
|
| @@ -1923,9 +1928,9 @@ VariableProxy* Parser::NewUnresolved(const AstRawString* name,
|
| // scope.
|
| // Let/const variables in harmony mode are always added to the immediately
|
| // enclosing scope.
|
| - return DeclarationScope(mode)->NewUnresolved(factory(), name,
|
| - scanner()->location().beg_pos,
|
| - scanner()->location().end_pos);
|
| + return DeclarationScope(mode)->NewUnresolved(
|
| + factory(), name, Variable::NORMAL, scanner()->location().beg_pos,
|
| + scanner()->location().end_pos);
|
| }
|
|
|
|
|
| @@ -3446,8 +3451,9 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
|
| Expression* enumerable = ParseExpression(true, CHECK_OK);
|
| Expect(Token::RPAREN, CHECK_OK);
|
|
|
| - VariableProxy* each = scope_->NewUnresolved(
|
| - factory(), parsing_result.SingleName(), each_beg_pos, each_end_pos);
|
| + VariableProxy* each =
|
| + scope_->NewUnresolved(factory(), parsing_result.SingleName(),
|
| + Variable::NORMAL, each_beg_pos, each_end_pos);
|
| Statement* body = ParseSubStatement(NULL, CHECK_OK);
|
| InitializeForEachStatement(loop, each, enumerable, body);
|
| Block* result =
|
| @@ -3530,8 +3536,9 @@ Statement* Parser::ParseForStatement(ZoneList<const AstRawString*>* labels,
|
| scope_ = for_scope;
|
| Expect(Token::RPAREN, CHECK_OK);
|
|
|
| - VariableProxy* each = scope_->NewUnresolved(
|
| - factory(), parsing_result.SingleName(), each_end_pos);
|
| + VariableProxy* each =
|
| + scope_->NewUnresolved(factory(), parsing_result.SingleName(),
|
| + Variable::NORMAL, each_end_pos);
|
| Statement* body = ParseSubStatement(NULL, CHECK_OK);
|
| Block* body_block =
|
| factory()->NewBlock(NULL, 3, false, RelocInfo::kNoPosition);
|
| @@ -5754,9 +5761,8 @@ Expression* Parser::SpreadCall(Expression* function,
|
| if (function->IsProperty()) {
|
| // Method calls
|
| if (function->AsProperty()->IsSuperAccess()) {
|
| - VariableProxy* original_home =
|
| - function->AsProperty()->obj()->AsSuperReference()->this_var();
|
| - VariableProxy* home = factory()->NewVariableProxy(original_home->var());
|
| + Expression* home =
|
| + ThisExpression(scope_, factory(), RelocInfo::kNoPosition);
|
| args->InsertAt(0, function, zone());
|
| args->InsertAt(1, home, zone());
|
| } else {
|
|
|