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

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

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « packages/analyzer/lib/src/generated/sdk.dart ('k') | packages/analyzer/lib/src/plugin/engine_plugin.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/lib/src/generated/static_type_analyzer.dart
diff --git a/packages/analyzer/lib/src/generated/static_type_analyzer.dart b/packages/analyzer/lib/src/generated/static_type_analyzer.dart
index 7362c4de016b5baacdaf6d352a1cd2f69afa72a6..ce0016c586a00465e31f1085c06f825d7d10cc41 100644
--- a/packages/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/packages/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -1419,12 +1419,17 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
}
// TODO(vsm): Use leafp's matchType here?
- DartType _findIteratedType(InterfaceType type, DartType targetType) {
+ DartType _findIteratedType(DartType type, DartType targetType) {
// Set by _find if match is found
DartType result = null;
// Elements we've already visited on a given inheritance path.
HashSet<ClassElement> visitedClasses = null;
+ while (type is TypeParameterType) {
+ TypeParameterElement element = type.element;
+ type = element.bound;
+ }
+
bool _find(InterfaceType type) {
ClassElement element = type.element;
if (type == _typeProvider.objectType || element == null) {
@@ -1451,7 +1456,9 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
visitedClasses.remove(element);
}
}
- _find(type);
+ if (type is InterfaceType) {
+ _find(type);
+ }
return result;
}
@@ -1691,15 +1698,13 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
Expression expr = loop.iterable;
LocalVariableElementImpl element = loopVariable.element;
DartType exprType = expr.staticType;
- if (exprType is InterfaceType) {
- DartType targetType = (loop.awaitKeyword == null)
- ? _typeProvider.iterableType
+ DartType targetType = (loop.awaitKeyword == null)
+ ? _typeProvider.iterableType
: _typeProvider.streamType;
- DartType iteratedType = _findIteratedType(exprType, targetType);
- if (element != null && iteratedType != null) {
- element.type = iteratedType;
- loopVariable.identifier.staticType = iteratedType;
- }
+ DartType iteratedType = _findIteratedType(exprType, targetType);
+ if (element != null && iteratedType != null) {
+ element.type = iteratedType;
+ loopVariable.identifier.staticType = iteratedType;
}
}
}
« no previous file with comments | « packages/analyzer/lib/src/generated/sdk.dart ('k') | packages/analyzer/lib/src/plugin/engine_plugin.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698