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

Side by Side Diff: src/parser.cc

Issue 883823002: Implement proper scoping for "this" in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make sure an unresolved VariableProxy for "this" is not considered a valid LHS Created 5 years, 11 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 667 }
668 668
669 669
670 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) { 670 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) {
671 return parser_->scanner()->NextSymbol(parser_->ast_value_factory()); 671 return parser_->scanner()->NextSymbol(parser_->ast_value_factory());
672 } 672 }
673 673
674 674
675 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, 675 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory,
676 int pos) { 676 int pos) {
677 return factory->NewVariableProxy(scope->receiver(), pos); 677 return scope->NewUnresolved(factory,
678 ast_value_factory()->this_string(),
679 Interface::NewValue(),
680 RelocInfo::kNoPosition,
681 true);
678 } 682 }
679 683
680 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, 684 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory,
681 int pos) { 685 int pos) {
682 return factory->NewSuperReference( 686 return factory->NewSuperReference(
683 ThisExpression(scope, factory, pos)->AsVariableProxy(), 687 ThisExpression(scope, factory, pos)->AsVariableProxy(),
684 pos); 688 pos);
685 } 689 }
686 690
687 691
(...skipping 4657 matching lines...) Expand 10 before | Expand all | Expand 10 after
5345 } else { 5349 } else {
5346 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); 5350 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data());
5347 running_hash = StringHasher::ComputeRunningHash(running_hash, data, 5351 running_hash = StringHasher::ComputeRunningHash(running_hash, data,
5348 raw_string->length()); 5352 raw_string->length());
5349 } 5353 }
5350 } 5354 }
5351 5355
5352 return running_hash; 5356 return running_hash;
5353 } 5357 }
5354 } } // namespace v8::internal 5358 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698