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

Unified Diff: src/parsing/parser.h

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: fix some nits 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/objects.cc ('k') | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.h
diff --git a/src/parsing/parser.h b/src/parsing/parser.h
index e91ad7741aa298c40ae7fbe505286289905f2748..02feecf2a09454a8fa760f6926a02aa8428b16f6 100644
--- a/src/parsing/parser.h
+++ b/src/parsing/parser.h
@@ -535,7 +535,11 @@ class ParserTraits {
V8_INLINE void AddParameterInitializationBlock(
const ParserFormalParameters& parameters,
- ZoneList<v8::internal::Statement*>* body, bool* ok);
+ ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok);
+
+ void ParseAsyncArrowSingleExpressionBody(
+ ZoneList<Statement*>* body, bool accept_IN,
+ Type::ExpressionClassifier* classifier, int pos, bool* ok);
V8_INLINE Scope* NewScope(Scope* parent_scope, ScopeType scope_type,
FunctionKind kind = kNormalFunction);
@@ -971,6 +975,12 @@ class Parser : public ParserBase<ParserTraits> {
ZoneList<const AstRawString*>* names, ForStatement* loop, Statement* init,
Expression* cond, Statement* next, Statement* body, bool* ok);
+ void DesugarAsyncFunctionBody(const AstRawString* function_name, Scope* scope,
+ ZoneList<Statement*>* body,
+ Type::ExpressionClassifier* classifier,
+ FunctionKind kind, FunctionBody type,
+ bool accept_IN, int pos, bool* ok);
+
void RewriteDoExpression(Expression* expr, bool* ok);
FunctionLiteral* ParseFunctionLiteral(
@@ -1041,6 +1051,7 @@ class Parser : public ParserBase<ParserTraits> {
Block* BuildParameterInitializationBlock(
const ParserFormalParameters& parameters, bool* ok);
+ Block* BuildRejectPromiseOnException(Block* block);
// Consumes the ending }.
ZoneList<Statement*>* ParseEagerFunctionBody(
@@ -1085,6 +1096,10 @@ class Parser : public ParserBase<ParserTraits> {
friend class InitializerRewriter;
void RewriteParameterInitializer(Expression* expr, Scope* scope);
+ Expression* BuildCreateJSGeneratorObject(int pos);
+ Expression* BuildPromiseResolve(Expression* value, int pos);
+ Expression* BuildPromiseReject(Expression* value, int pos);
+
Scanner scanner_;
PreParser* reusable_preparser_;
Scope* original_scope_; // for ES5 function declarations in sloppy eval
@@ -1254,14 +1269,18 @@ void ParserTraits::DeclareFormalParameter(
}
}
-
void ParserTraits::AddParameterInitializationBlock(
const ParserFormalParameters& parameters,
- ZoneList<v8::internal::Statement*>* body, bool* ok) {
+ ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) {
if (!parameters.is_simple) {
auto* init_block =
parser_->BuildParameterInitializationBlock(parameters, ok);
if (!*ok) return;
+
+ if (is_async) {
+ init_block = parser_->BuildRejectPromiseOnException(init_block);
+ }
+
if (init_block != nullptr) {
body->Add(init_block, parser_->zone());
}
« no previous file with comments | « src/objects.cc ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698