| Index: pkg/compiler/lib/src/typechecker.dart
|
| diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
|
| index e186ee468711f781d11c2514f45f5d59ef6a8c7f..ba51cc4f52f8e708ab18177313489c24e706525f 100644
|
| --- a/pkg/compiler/lib/src/typechecker.dart
|
| +++ b/pkg/compiler/lib/src/typechecker.dart
|
| @@ -1715,7 +1715,11 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
|
|
| DartType visitAwait(Await node) {
|
| DartType expressionType = analyze(node.expression);
|
| - return types.flatten(expressionType);
|
| + if (compiler.backend.supportsAsyncAwait) {
|
| + return types.flatten(expressionType);
|
| + } else {
|
| + return const DynamicType();
|
| + }
|
| }
|
|
|
| DartType visitYield(Yield node) {
|
| @@ -1838,29 +1842,31 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
| visitAsyncForIn(AsyncForIn node) {
|
| DartType elementType = computeForInElementType(node);
|
| DartType expressionType = analyze(node.expression);
|
| - DartType streamOfDynamic = coreTypes.streamType();
|
| - if (!types.isAssignable(expressionType, streamOfDynamic)) {
|
| - reportMessage(node.expression, MessageKind.NOT_ASSIGNABLE,
|
| - {'fromType': expressionType, 'toType': streamOfDynamic},
|
| - isHint: true);
|
| - } else {
|
| - InterfaceType interfaceType =
|
| - Types.computeInterfaceType(resolution, expressionType);
|
| - if (interfaceType != null) {
|
| - InterfaceType streamType =
|
| - interfaceType.asInstanceOf(streamOfDynamic.element);
|
| - if (streamType != null) {
|
| - DartType streamElementType = streamType.typeArguments.first;
|
| - if (!types.isAssignable(streamElementType, elementType)) {
|
| - reportMessage(
|
| - node.expression,
|
| - MessageKind.FORIN_NOT_ASSIGNABLE,
|
| - {
|
| - 'currentType': streamElementType,
|
| - 'expressionType': expressionType,
|
| - 'elementType': elementType
|
| - },
|
| - isHint: true);
|
| + if (compiler.backend.supportsAsyncAwait) {
|
| + DartType streamOfDynamic = coreTypes.streamType();
|
| + if (!types.isAssignable(expressionType, streamOfDynamic)) {
|
| + reportMessage(node.expression, MessageKind.NOT_ASSIGNABLE,
|
| + {'fromType': expressionType, 'toType': streamOfDynamic},
|
| + isHint: true);
|
| + } else {
|
| + InterfaceType interfaceType =
|
| + Types.computeInterfaceType(resolution, expressionType);
|
| + if (interfaceType != null) {
|
| + InterfaceType streamType =
|
| + interfaceType.asInstanceOf(streamOfDynamic.element);
|
| + if (streamType != null) {
|
| + DartType streamElementType = streamType.typeArguments.first;
|
| + if (!types.isAssignable(streamElementType, elementType)) {
|
| + reportMessage(
|
| + node.expression,
|
| + MessageKind.FORIN_NOT_ASSIGNABLE,
|
| + {
|
| + 'currentType': streamElementType,
|
| + 'expressionType': expressionType,
|
| + 'elementType': elementType
|
| + },
|
| + isHint: true);
|
| + }
|
| }
|
| }
|
| }
|
|
|