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

Unified Diff: pkg/compiler/lib/src/elements/elements.dart

Issue 2759623003: Track async state in parser. (Closed)
Patch Set: Created 3 years, 9 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: pkg/compiler/lib/src/elements/elements.dart
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index bc232b44310f48500c7990a68e4879d65212153d..3315cb638bc3dbc09584ad1283d7af7ed767a748 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -4,6 +4,9 @@
library elements;
+import 'package:front_end/src/fasta/parser/async_modifier.dart'
+ show AsyncModifier;
+
import '../common.dart';
import '../common/resolution.dart' show Resolution;
import '../constants/constructors.dart';
@@ -15,7 +18,7 @@ import '../resolution/tree_elements.dart' show TreeElements;
import '../script.dart';
import 'package:front_end/src/fasta/scanner.dart'
show Token, isUserDefinableOperator, isMinusOperator;
-import '../tree/tree.dart';
+import '../tree/tree.dart' hide AsyncModifier;
import '../universe/call_structure.dart';
import 'package:front_end/src/fasta/scanner/characters.dart' show $_;
import '../util/util.dart';
@@ -1337,17 +1340,21 @@ abstract class SetterElement extends AccessorElement {
/// Enum for the synchronous/asynchronous function body modifiers.
class AsyncMarker {
/// The default function body marker.
- static const AsyncMarker SYNC = const AsyncMarker._();
+ static const AsyncMarker SYNC = const AsyncMarker._(AsyncModifier.Sync);
/// The `sync*` function body marker.
- static const AsyncMarker SYNC_STAR = const AsyncMarker._(isYielding: true);
+ static const AsyncMarker SYNC_STAR =
+ const AsyncMarker._(AsyncModifier.SyncStar, isYielding: true);
/// The `async` function body marker.
- static const AsyncMarker ASYNC = const AsyncMarker._(isAsync: true);
+ static const AsyncMarker ASYNC =
+ const AsyncMarker._(AsyncModifier.Async, isAsync: true);
/// The `async*` function body marker.
- static const AsyncMarker ASYNC_STAR =
- const AsyncMarker._(isAsync: true, isYielding: true);
+ static const AsyncMarker ASYNC_STAR = const AsyncMarker._(
+ AsyncModifier.AsyncStar,
+ 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].
@@ -1357,7 +1364,10 @@ class AsyncMarker {
/// result, that is, either an [Iterable] or a [Stream].
final bool isYielding;
- const AsyncMarker._({this.isAsync: false, this.isYielding: false});
+ final AsyncModifier asyncParserState;
+
+ const AsyncMarker._(this.asyncParserState,
+ {this.isAsync: false, this.isYielding: false});
String toString() {
return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}';
« no previous file with comments | « pkg/analyzer/lib/src/summary/fasta/summary_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/async_modifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698