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

Side by Side Diff: src/parser.cc

Issue 1097283003: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Statically resolve "this" even inside "with" Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 733 }
734 734
735 735
736 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) { 736 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) {
737 return parser_->scanner()->NextSymbol(parser_->ast_value_factory()); 737 return parser_->scanner()->NextSymbol(parser_->ast_value_factory());
738 } 738 }
739 739
740 740
741 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, 741 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory,
742 int pos) { 742 int pos) {
743 return factory->NewVariableProxy(scope->receiver(), pos); 743 return scope->NewUnresolved(factory,
744 parser_->ast_value_factory()->this_string(), pos,
745 pos + 4, Variable::THIS);
744 } 746 }
745 747
746 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, 748 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory,
747 int pos) { 749 int pos) {
748 return factory->NewSuperReference( 750 return factory->NewSuperReference(
749 ThisExpression(scope, factory, pos)->AsVariableProxy(), 751 ThisExpression(scope, factory, pos)->AsVariableProxy(),
750 pos); 752 pos);
751 } 753 }
752 754
753 755
(...skipping 5068 matching lines...) Expand 10 before | Expand all | Expand 10 after
5822 5824
5823 Expression* Parser::SpreadCallNew(Expression* function, 5825 Expression* Parser::SpreadCallNew(Expression* function,
5824 ZoneList<v8::internal::Expression*>* args, 5826 ZoneList<v8::internal::Expression*>* args,
5825 int pos) { 5827 int pos) {
5826 args->InsertAt(0, function, zone()); 5828 args->InsertAt(0, function, zone());
5827 5829
5828 return factory()->NewCallRuntime( 5830 return factory()->NewCallRuntime(
5829 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5831 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5830 } 5832 }
5831 } } // namespace v8::internal 5833 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/runtime/runtime-debug.cc » ('j') | src/scopeinfo.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698