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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/elements.dart

Issue 675113002: Support async/await in the dart2js frontend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 6 years, 1 month 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: sdk/lib/_internal/compiler/implementation/elements/elements.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index 9f6dcfc59295e87a899d5b6a9a575f837ebd4d3a..442e12b22701773a76c374dde646b3d4dcc2f264 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -1137,6 +1137,39 @@ abstract class FunctionElement extends Element
/// The type of this function.
FunctionType get type;
+
+ /// The synchronous/asynchronous marker on this function.
+ AsyncMarker get asyncMarker;
+}
+
+/// Enum for the synchronous/asynchronous function body modifiers.
+class AsyncMarker {
+ /// The default function body marker.
+ static AsyncMarker SYNC = const AsyncMarker._();
+
+ /// The `sync*` function body marker.
+ static AsyncMarker SYNC_STAR = const AsyncMarker._(isYielding: true);
+
+ /// The `async` function body marker.
+ static AsyncMarker ASYNC = const AsyncMarker._(isAsync: true);
+
+ /// The `async*` function body marker.
+ static AsyncMarker ASYNC_STAR =
+ const AsyncMarker._(isAsync: true, isYielding: true);
+
+ /// Is `true` if this marker defines the function body to have an
+ /// asynchronous result, that is, either a [Future] or a [Stream].
+ final bool isAsync;
+
+ /// Is `true` if this marker defines the function body to have a plural
+ /// result, that is, either an [Iterable] or a [Stream].
+ final bool isYielding;
+
+ const AsyncMarker._({this.isAsync: false, this.isYielding: false});
+
+ String toString() {
+ return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}';
+ }
}
/// A top level, static or instance function.

Powered by Google App Engine
This is Rietveld 408576698