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

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

Issue 1323513005: Strong mode foreach inference. Infer the type of declared identifiers (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Cycle detection based on class elements Created 5 years, 4 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index bd316bf690e52de3d87940bf1c4c6195e540a2a2..eb7bacf41f3cb4b8f571cb3feed09e9273cd051c 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -10851,7 +10851,8 @@ class ResolverVisitor extends ScopedVisitor {
}
if (propagatedType != null) {
overrideVariable(loopElement, propagatedType, true);
- _recordPropagatedType(loopVariable.identifier, propagatedType);
+ recordPropagatedTypeIfBetter(
+ loopVariable.identifier, propagatedType);
}
}
} else if (identifier != null && iterable != null) {
@@ -10859,7 +10860,7 @@ class ResolverVisitor extends ScopedVisitor {
if (identifierElement is VariableElement) {
DartType iteratorElementType = _getIteratorElementType(iterable);
overrideVariable(identifierElement, iteratorElementType, true);
- _recordPropagatedType(identifier, iteratorElementType);
+ recordPropagatedTypeIfBetter(identifier, iteratorElementType);
}
}
visitStatementInScope(body);
@@ -11599,18 +11600,6 @@ class ResolverVisitor extends ScopedVisitor {
_propagateTrueState(condition.expression);
}
}
-
- /**
- * Record that the propagated type of the given node is the given type.
- *
- * @param expression the node whose type is to be recorded
- * @param type the propagated type of the node
- */
- void _recordPropagatedType(Expression expression, DartType type) {
- if (type != null && !type.isDynamic) {
- expression.propagatedType = type;
- }
- }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698