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

Unified Diff: pkg/analyzer/lib/src/generated/static_type_analyzer.dart

Issue 898513002: Fix async/await type checking in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reformat and sort methods 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/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;
}
/**

Powered by Google App Engine
This is Rietveld 408576698