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

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart

Issue 2904263003: Implement type inference for await expressions in front_end. (Closed)
Patch Set: Created 3 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: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index a2f1cb786f49a993e4fdd8ccefcee47da286a3f5..863ebfbdf83e3fd281a2dbca4b1a089a0b665e70 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -436,6 +436,16 @@ abstract class TypeInferrerImpl extends TypeInferrer {
/// the statement type and calls the appropriate specialized "infer" method.
void inferStatement(Statement statement);
+ DartType wrapFutureOrType(DartType type) {
+ if (type is InterfaceType &&
+ identical(type.classNode, coreTypes.futureOrClass)) {
+ return type;
+ }
+ // TODO(paulberry): If [type] is a subtype of `Future`, should we just
+ // return it unmodified?
+ return new InterfaceType(coreTypes.futureOrClass, <DartType>[type]);
+ }
+
DartType wrapFutureType(DartType type) {
var typeWithoutFutureOr = type ?? const DynamicType();
if (type is InterfaceType &&

Powered by Google App Engine
This is Rietveld 408576698