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

Unified 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: mjsunit/debug-scopes: Skip "this" the same as "arguments" Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index a4735520366b9f91e98dcc592fc6929fd7de72a7..c1841c94cda942309a4dfbc99508ea74b0497cc4 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -675,7 +675,10 @@ 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,
+ ast_value_factory()->this_string(),
wingo 2015/02/06 17:31:19 here probably we will have to pass in Variable::TH
aperez 2015/02/09 16:08:14 Acknowledged.
+ Interface::NewValue(),
+ RelocInfo::kNoPosition);
}
Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory,
@@ -729,7 +732,7 @@ Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name,
// for Traits::DeclareArrowParametersFromExpression() to be able to
// pick the names of the parameters.
return parser_->parsing_lazy_arrow_parameters_
- ? factory->NewVariableProxy(name, false, interface, pos)
+ ? factory->NewVariableProxy(name, interface, pos)
wingo 2015/02/06 17:31:19 instead of removing false, replace with Variable::
aperez 2015/02/09 16:08:14 Acknowledged.
: scope->NewUnresolved(factory, name, interface, pos);
}
@@ -1852,7 +1855,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
DCHECK(resolve); // should be set by all callers
Variable::Kind kind = Variable::NORMAL;
var = new (zone())
- Variable(declaration_scope, name, mode, true, kind,
+ Variable(declaration_scope, name, mode, kind,
kNeedsInitialization, kNotAssigned, proxy->interface());
} else if (declaration_scope->is_eval_scope() &&
declaration_scope->strict_mode() == SLOPPY) {
@@ -1861,7 +1864,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
// DeclareLookupSlot runtime function.
Variable::Kind kind = Variable::NORMAL;
// TODO(sigurds) figure out if kNotAssigned is OK here
- var = new (zone()) Variable(declaration_scope, name, mode, true, kind,
+ var = new (zone()) Variable(declaration_scope, name, mode, kind,
declaration->initialization(), kNotAssigned,
proxy->interface());
var->AllocateTo(Variable::LOOKUP, -1);
@@ -3748,9 +3751,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
? CONST : CONST_LEGACY;
DCHECK(function_name != NULL);
fvar = new (zone())
- Variable(scope_, function_name, fvar_mode, true /* is valid LHS */,
- Variable::NORMAL, kCreatedInitialized, kNotAssigned,
- Interface::NewConst());
+ Variable(scope_, function_name, fvar_mode, Variable::NORMAL,
+ kCreatedInitialized, kNotAssigned, Interface::NewConst());
VariableProxy* proxy = factory()->NewVariableProxy(fvar);
VariableDeclaration* fvar_declaration = factory()->NewVariableDeclaration(
proxy, fvar_mode, scope_, RelocInfo::kNoPosition);

Powered by Google App Engine
This is Rietveld 408576698