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

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

Issue 1161343002: Issue 23409. Don't set 'propagatedType' in (vs. after) 'name is Type'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 16b6afa974ed12a0bd360f05da11ca55ff109563..df5d9ac1cdcc4bd660d0872d3102c5da97acbbea 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -10509,13 +10509,15 @@ class ResolverVisitor extends ScopedVisitor {
* @param potentialType the potential type of the elements
* @param allowPrecisionLoss see @{code overrideVariable} docs
*/
- void overrideExpression(
- Expression expression, DartType potentialType, bool allowPrecisionLoss) {
+ void overrideExpression(Expression expression, DartType potentialType,
+ bool allowPrecisionLoss, bool setExpressionType) {
VariableElement element = getOverridableStaticElement(expression);
if (element != null) {
DartType newBestType =
overrideVariable(element, potentialType, allowPrecisionLoss);
- recordPropagatedTypeIfBetter(expression, newBestType);
+ if (setExpressionType) {
+ recordPropagatedTypeIfBetter(expression, newBestType);
+ }
}
element = getOverridablePropagatedElement(expression);
if (element != null) {
@@ -10638,7 +10640,7 @@ class ResolverVisitor extends ScopedVisitor {
// Since an as-statement doesn't actually change the type, we don't
// let it affect the propagated type when it would result in a loss
// of precision.
- overrideExpression(node.expression, node.type.type, false);
+ overrideExpression(node.expression, node.type.type, false, false);
return null;
}
@@ -11703,7 +11705,7 @@ class ResolverVisitor extends ScopedVisitor {
// Since an is-statement doesn't actually change the type, we don't
// let it affect the propagated type when it would result in a loss
// of precision.
- overrideExpression(is2.expression, is2.type.type, false);
+ overrideExpression(is2.expression, is2.type.type, false, false);
}
} else if (condition is PrefixExpression) {
PrefixExpression prefix = condition;
@@ -11744,7 +11746,7 @@ class ResolverVisitor extends ScopedVisitor {
// Since an is-statement doesn't actually change the type, we don't
// let it affect the propagated type when it would result in a loss
// of precision.
- overrideExpression(is2.expression, is2.type.type, false);
+ overrideExpression(is2.expression, is2.type.type, false, false);
}
} else if (condition is PrefixExpression) {
PrefixExpression prefix = condition;

Powered by Google App Engine
This is Rietveld 408576698