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

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

Issue 886833005: Fix await parsing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix metadata_test Created 5 years, 11 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/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) {

Powered by Google App Engine
This is Rietveld 408576698