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

Unified Diff: src/parsing/preparser.cc

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: remove weird arrow-generator thing 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
Index: src/parsing/preparser.cc
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc
index 0544b9feb241c9883fac4aed91911135ecb0f2d0..41d42b6101bc3c89830b5d05051dcaf9f4856723 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -121,6 +121,7 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction(
DCHECK_EQ(Token::LBRACE, scanner()->current_token());
bool ok = true;
int start_position = peek_position();
+ function_state.set_parse_phase(FunctionParsePhase::FunctionBody);
ParseLazyFunctionLiteralBody(&ok, bookmark);
use_counts_ = nullptr;
if (bookmark && bookmark->HasBeenReset()) {
@@ -1105,6 +1106,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
int start_position = scanner()->location().beg_pos;
function_scope->set_start_position(start_position);
PreParserFormalParameters formals(function_scope);
+ function_state.set_parse_phase(FunctionParsePhase::FormalParameters);
ParseFormalParameterList(&formals, &formals_classifier, CHECK_OK);
Expect(Token::RPAREN, CHECK_OK);
int formals_end_position = scanner()->location().end_pos;
@@ -1117,6 +1119,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
bool is_lazily_parsed = (outer_is_script_scope && allow_lazy() &&
!function_state_->this_function_is_parenthesized());
+ function_state.set_parse_phase(FunctionParsePhase::FunctionBody);
Expect(Token::LBRACE, CHECK_OK);
if (is_lazily_parsed) {
ParseLazyFunctionLiteralBody(CHECK_OK);
@@ -1291,6 +1294,19 @@ PreParserExpression PreParser::ParseDoExpression(bool* ok) {
return PreParserExpression::Default();
}
+void PreParserTraits::ParseAsyncArrowSingleExpressionBody(
+ PreParserStatementList body, bool accept_IN,
+ Type::ExpressionClassifier* classifier, int pos, bool* ok) {
+ Scope* scope = pre_parser_->scope_;
+ scope->ForceContextAllocation();
+
+ PreParserExpression return_value =
+ pre_parser_->ParseAssignmentExpression(accept_IN, classifier, ok);
+ if (!*ok) return;
+
+ body->Add(PreParserStatement::ExpressionStatement(return_value), zone());
+}
+
#undef CHECK_OK

Powered by Google App Engine
This is Rietveld 408576698