| Index: pkg/compiler/lib/src/typechecker.dart
|
| diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
|
| index 68684a40577ed2f0dcbdfb188c2fbec5ee8f4ee9..04a7a432fff6f91592c8d1c2062b1670e7b292dc 100644
|
| --- a/pkg/compiler/lib/src/typechecker.dart
|
| +++ b/pkg/compiler/lib/src/typechecker.dart
|
| @@ -1590,7 +1590,7 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
| // The resolver already emitted an error for this expression.
|
| } else {
|
| if (currentAsyncMarker == AsyncMarker.ASYNC) {
|
| - expressionType = coreTypes.futureType(flatten(expressionType));
|
| + expressionType = coreTypes.futureType(types.flatten(expressionType));
|
| }
|
| if (expectedReturnType.isVoid &&
|
| !types.isAssignable(expressionType, const VoidType())) {
|
| @@ -1618,28 +1618,9 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
| return const DynamicType();
|
| }
|
|
|
| - /// Flatten [type] by recursively removing enclosing `Future` annotations.
|
| - ///
|
| - /// For instance:
|
| - /// flatten(T) = T
|
| - /// flatten(Future<T>) = T
|
| - /// flatten(Future<Future<T>>) = T
|
| - ///
|
| - /// This method is used in the static typing of await and type checking of
|
| - /// return.
|
| - DartType flatten(DartType type) {
|
| - if (type is InterfaceType) {
|
| - InterfaceType futureType = type.asInstanceOf(compiler.futureClass);
|
| - if (futureType != null) {
|
| - return flatten(futureType.typeArguments.first);
|
| - }
|
| - }
|
| - return type;
|
| - }
|
| -
|
| DartType visitAwait(Await node) {
|
| DartType expressionType = analyze(node.expression);
|
| - return flatten(expressionType);
|
| + return types.flatten(expressionType);
|
| }
|
|
|
| DartType visitYield(Yield node) {
|
|
|