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 103b2cbc1d82c5dbdf012c634ded0aba5ad5cb69..19019da8d839d5cceb3377b7a987e20d113c4021 100644 |
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
@@ -258,13 +258,23 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> { |
} else { |
ExecutableElement staticMethodElement = node.staticElement; |
DartType staticType = _computeStaticReturnType(staticMethodElement); |
- staticType = |
- _refineAssignmentExpressionType(node, staticType, _getStaticType); |
+ staticType = _typeSystem.refineBinaryExpressionType( |
+ _typeProvider, |
+ node.leftHandSide.staticType, |
+ operator, |
+ node.rightHandSide.staticType, |
+ staticType); |
_recordStaticType(node, staticType); |
MethodElement propagatedMethodElement = node.propagatedElement; |
if (!identical(propagatedMethodElement, staticMethodElement)) { |
DartType propagatedType = |
_computeStaticReturnType(propagatedMethodElement); |
+ propagatedType = _typeSystem.refineBinaryExpressionType( |
+ _typeProvider, |
+ node.leftHandSide.propagatedType, |
+ operator, |
+ node.rightHandSide.propagatedType, |
+ propagatedType); |
_resolver.recordPropagatedTypeIfBetter(node, propagatedType); |
} |
} |
@@ -2232,44 +2242,6 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> { |
} |
/** |
- * Attempts to make a better guess for the type of the given assignment |
- * [expression], given that resolution has so far produced the [currentType]. |
- * The [typeAccessor] is used to access the corresponding type of the left |
- * and right operands. |
- */ |
- DartType _refineAssignmentExpressionType(AssignmentExpression expression, |
- DartType currentType, DartType typeAccessor(Expression node)) { |
- Expression leftHandSize = expression.leftHandSide; |
- Expression rightHandSide = expression.rightHandSide; |
- TokenType operator = expression.operator.type; |
- DartType intType = _typeProvider.intType; |
- if (typeAccessor(leftHandSize) == intType) { |
- // int op= double |
- if (operator == TokenType.MINUS_EQ || |
- operator == TokenType.PERCENT_EQ || |
- operator == TokenType.PLUS_EQ || |
- operator == TokenType.STAR_EQ) { |
- DartType doubleType = _typeProvider.doubleType; |
- if (typeAccessor(rightHandSide) == doubleType) { |
- return doubleType; |
- } |
- } |
- // int op= int |
- if (operator == TokenType.MINUS_EQ || |
- operator == TokenType.PERCENT_EQ || |
- operator == TokenType.PLUS_EQ || |
- operator == TokenType.STAR_EQ || |
- operator == TokenType.TILDE_SLASH_EQ) { |
- if (typeAccessor(rightHandSide) == intType) { |
- return intType; |
- } |
- } |
- } |
- // default |
- return currentType; |
- } |
- |
- /** |
* Create a table mapping HTML tag names to the names of the classes (in 'dart:html') that |
* implement those tags. |
* |