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

Unified Diff: src/parsing/parser.cc

Issue 1976813002: [esnext] Fix super in async arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix dependencies Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 00d126d70eeeefdc51d31f913ee2f676ab4c8693..8bf920f2d3763b8a22d794c137850caa64d3d643 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -3988,7 +3988,7 @@ void Parser::DesugarAsyncFunctionBody(const AstRawString* function_name,
Expression* init_generator_variable = factory()->NewAssignment(
Token::INIT, factory()->NewVariableProxy(temp),
- BuildCreateJSGeneratorObject(pos), RelocInfo::kNoPosition);
+ BuildCreateJSGeneratorObject(pos, kind), RelocInfo::kNoPosition);
body->Add(factory()->NewExpressionStatement(init_generator_variable,
RelocInfo::kNoPosition),
zone());
@@ -4592,11 +4592,14 @@ Block* Parser::BuildRejectPromiseOnException(Block* block) {
return block;
}
-Expression* Parser::BuildCreateJSGeneratorObject(int pos) {
+Expression* Parser::BuildCreateJSGeneratorObject(int pos, FunctionKind kind) {
DCHECK_NOT_NULL(function_state_->generator_object_variable());
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
args->Add(factory()->NewThisFunction(pos), zone());
- args->Add(ThisExpression(scope_, factory(), RelocInfo::kNoPosition), zone());
+ args->Add(IsArrowFunction(kind)
+ ? GetLiteralUndefined(pos)
+ : ThisExpression(scope_, factory(), RelocInfo::kNoPosition),
+ zone());
return factory()->NewCallRuntime(Runtime::kCreateJSGeneratorObject, args,
pos);
}
@@ -4667,7 +4670,7 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody(
factory()->NewBlock(nullptr, 3, false, RelocInfo::kNoPosition);
{
- Expression* allocation = BuildCreateJSGeneratorObject(pos);
+ Expression* allocation = BuildCreateJSGeneratorObject(pos, kind);
VariableProxy* init_proxy = factory()->NewVariableProxy(
function_state_->generator_object_variable());
Assignment* assignment = factory()->NewAssignment(
« no previous file with comments | « src/parsing/parser.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698