Index: pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
index ff88128b907fa5ce74f163dc6047eac65a790e32..5cf1c87b7260dfa160c34e90d9a04f0b0c179c47 100644 |
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
@@ -1391,10 +1391,18 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> { |
DartType |
_computeStaticReturnTypeOfFunctionExpression(FunctionExpression node) { |
FunctionBody body = node.body; |
+ DartType type; |
if (body is ExpressionFunctionBody) { |
- return _getStaticType(body.expression); |
+ type = _getStaticType(body.expression); |
+ } else { |
+ type = _dynamicType; |
+ } |
+ // TODO(paulberry): also handle generator functions. |
+ if (body.isAsynchronous) { |
+ return _typeProvider.futureType.substitute4(<DartType>[type]); |
+ } else { |
+ return type; |
} |
- return _dynamicType; |
} |
/** |