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

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

Issue 895113002: Add static type checking of "yield" statements to analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 5cf1c87b7260dfa160c34e90d9a04f0b0c179c47..99a51ce11e396ed8769f890b92003b4000a95eaa 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -1391,13 +1391,19 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
DartType
_computeStaticReturnTypeOfFunctionExpression(FunctionExpression node) {
FunctionBody body = node.body;
+ if (body.isGenerator) {
+ if (body.isAsynchronous) {
+ return _typeProvider.streamDynamicType;
+ } else {
+ return _typeProvider.iterableDynamicType;
+ }
+ }
DartType type;
if (body is ExpressionFunctionBody) {
type = _getStaticType(body.expression);
} else {
type = _dynamicType;
}
- // TODO(paulberry): also handle generator functions.
if (body.isAsynchronous) {
return _typeProvider.futureType.substitute4(<DartType>[type]);
} else {
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/lib/src/generated/testing/test_type_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698