Chromium Code Reviews| Index: pkg/compiler/lib/src/typechecker.dart |
| diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart |
| index 26272a918483b0cec84ffd100ce6a4a1c5d6befb..68139d08a3673743716b3f5b2701725a645bd996 100644 |
| --- a/pkg/compiler/lib/src/typechecker.dart |
| +++ b/pkg/compiler/lib/src/typechecker.dart |
| @@ -1601,17 +1601,19 @@ class TypeCheckerVisitor extends Visitor<DartType> { |
| return const DynamicType(); |
| } |
| - DartType visitAwait(Await node) { |
| - DartType expressionType = analyze(node.expression); |
| - DartType resultType = expressionType; |
| - if (expressionType is InterfaceType) { |
| - InterfaceType futureType = |
| - expressionType.asInstanceOf(compiler.futureClass); |
| + DartType flatten(DartType type) { |
|
floitsch
2015/02/03 13:34:21
add comment.
floitsch
2015/02/03 13:34:21
If I understand correctly this reduces the type of
floitsch
2015/02/03 13:34:21
This seems to be very await specific (talking abou
Johnni Winther
2015/02/03 14:12:56
It term 'flatten' is from the spec is used to desc
Johnni Winther
2015/02/03 14:12:56
Done.
|
| + if (type is InterfaceType) { |
| + InterfaceType futureType = type.asInstanceOf(compiler.futureClass); |
| if (futureType != null) { |
| - resultType = futureType.typeArguments.first; |
| + return flatten(futureType.typeArguments.first); |
| } |
| } |
| - return resultType; |
| + return type; |
| + } |
| + |
| + DartType visitAwait(Await node) { |
| + DartType expressionType = analyze(node.expression); |
| + return flatten(expressionType); |
| } |
| DartType visitYield(Yield node) { |