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

Unified Diff: src/globals.h

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index 5ccd40757da07b611c3a1dc12f16bbd0b831109d..79fb98c88c44733544dd570ee45d5310edc4a8d5 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1097,7 +1097,11 @@ enum FunctionKind : uint16_t {
kClassConstructor =
kBaseConstructor | kDerivedConstructor | kDefaultConstructor,
kAsyncArrowFunction = kArrowFunction | kAsyncFunction,
- kAsyncConciseMethod = kAsyncFunction | kConciseMethod
+ kAsyncConciseMethod = kAsyncFunction | kConciseMethod,
+
+ // https://tc39.github.io/proposal-async-iteration/
+ kAsyncConciseGeneratorMethod = kAsyncFunction | kConciseGeneratorMethod,
+ kAsyncGeneratorFunction = kAsyncFunction | kGeneratorFunction,
};
inline bool IsValidFunctionKind(FunctionKind kind) {
@@ -1116,7 +1120,9 @@ inline bool IsValidFunctionKind(FunctionKind kind) {
kind == FunctionKind::kDerivedConstructor ||
kind == FunctionKind::kAsyncFunction ||
kind == FunctionKind::kAsyncArrowFunction ||
- kind == FunctionKind::kAsyncConciseMethod;
+ kind == FunctionKind::kAsyncConciseMethod ||
+ kind == FunctionKind::kAsyncConciseGeneratorMethod ||
+ kind == FunctionKind::kAsyncGeneratorFunction;
}
@@ -1141,6 +1147,12 @@ inline bool IsAsyncFunction(FunctionKind kind) {
return kind & FunctionKind::kAsyncFunction;
}
+inline bool IsAsyncGeneratorFunction(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ const FunctionKind kMask = FunctionKind::kAsyncGeneratorFunction;
+ return (kind & kMask) == kMask;
+}
+
inline bool IsResumableFunction(FunctionKind kind) {
return IsGeneratorFunction(kind) || IsAsyncFunction(kind) || IsModule(kind);
}
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698