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

Unified Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 1953043002: Extract 'refineBinaryExpressionType' into TypeSystem. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/link.dart
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index be4c442abfe4b01f1b4153aa7080760182ea5a6c..db465cd47830f648d60317a9b40f40dbbe142dae 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -2346,7 +2346,8 @@ class ExprTypeComputer {
MethodElement method = left.lookUpMethod(operator.lexeme, library);
if (method != null) {
DartType type = method.returnType;
- type = _refineBinaryExpressionType(operator, type, left, right);
+ type = linker.typeSystem.refineBinaryExpressionType(
+ typeProvider, left, operator, right, type);
stack.add(type);
return;
}
@@ -2365,35 +2366,6 @@ class ExprTypeComputer {
_pushBinaryOperatorType(propertyType, operator, operandType);
}
- DartType _refineBinaryExpressionType(TokenType operator, DartType currentType,
- DartType leftType, DartType rightType) {
- DartType intType = typeProvider.intType;
- if (leftType == intType) {
- // int op double
- if (operator == TokenType.MINUS ||
- operator == TokenType.PERCENT ||
- operator == TokenType.PLUS ||
- operator == TokenType.STAR) {
- DartType doubleType = typeProvider.doubleType;
- if (rightType == doubleType) {
- return doubleType;
- }
- }
- // int op int
- if (operator == TokenType.MINUS ||
- operator == TokenType.PERCENT ||
- operator == TokenType.PLUS ||
- operator == TokenType.STAR ||
- operator == TokenType.TILDE_SLASH) {
- if (rightType == intType) {
- return intType;
- }
- }
- }
- // default
- return currentType;
- }
-
static TokenType _convertAssignOperatorToTokenType(
UnlinkedExprAssignOperator o) {
switch (o) {
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698