| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dev_compiler.src.checker.checker; | 5 library dev_compiler.src.checker.checker; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; | 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 case TokenType.PLUS: | 850 case TokenType.PLUS: |
| 851 case TokenType.MINUS: | 851 case TokenType.MINUS: |
| 852 case TokenType.STAR: | 852 case TokenType.STAR: |
| 853 case TokenType.TILDE_SLASH: | 853 case TokenType.TILDE_SLASH: |
| 854 case TokenType.PERCENT: | 854 case TokenType.PERCENT: |
| 855 case TokenType.PLUS_EQ: | 855 case TokenType.PLUS_EQ: |
| 856 case TokenType.MINUS_EQ: | 856 case TokenType.MINUS_EQ: |
| 857 case TokenType.STAR_EQ: | 857 case TokenType.STAR_EQ: |
| 858 case TokenType.TILDE_SLASH_EQ: | 858 case TokenType.TILDE_SLASH_EQ: |
| 859 case TokenType.PERCENT_EQ: | 859 case TokenType.PERCENT_EQ: |
| 860 if (rules.isIntType(t1) && rules.isIntType(t2)) return t1; | 860 if (t1 == rules.provider.intType && t2 == rules.provider.intType) return
t1; |
| 861 if (rules.isDoubleType(t1) && rules.isDoubleType(t2)) return t1; | 861 if (t1 == rules.provider.doubleType && t2 == rules.provider.doubleType)
return t1; |
| 862 // This particular combo is not spelled out in the spec, but all | 862 // This particular combo is not spelled out in the spec, but all |
| 863 // implementations and analyzer seem to follow this. | 863 // implementations and analyzer seem to follow this. |
| 864 if (rules.isDoubleType(t1) && rules.isIntType(t2)) return t1; | 864 if (t1 == rules.provider.doubleType && t2 == rules.provider.intType) ret
urn t1; |
| 865 } | 865 } |
| 866 return normalReturnType; | 866 return normalReturnType; |
| 867 } | 867 } |
| 868 | 868 |
| 869 void _checkCompoundAssignment(AssignmentExpression expr) { | 869 void _checkCompoundAssignment(AssignmentExpression expr) { |
| 870 var op = expr.operator.type; | 870 var op = expr.operator.type; |
| 871 assert(op.isAssignmentOperator && op != TokenType.EQ); | 871 assert(op.isAssignmentOperator && op != TokenType.EQ); |
| 872 var methodElement = expr.staticElement; | 872 var methodElement = expr.staticElement; |
| 873 if (methodElement == null) { | 873 if (methodElement == null) { |
| 874 // Dynamic invocation | 874 // Dynamic invocation |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 if (info is CoercionInfo) { | 948 if (info is CoercionInfo) { |
| 949 // TODO(jmesserly): if we're run again on the same AST, we'll produce the | 949 // TODO(jmesserly): if we're run again on the same AST, we'll produce the |
| 950 // same annotations. This should be harmless. This might go away once | 950 // same annotations. This should be harmless. This might go away once |
| 951 // CodeChecker is integrated better with analyzer, as it will know that | 951 // CodeChecker is integrated better with analyzer, as it will know that |
| 952 // checking has already been performed. | 952 // checking has already been performed. |
| 953 // assert(CoercionInfo.get(info.node) == null); | 953 // assert(CoercionInfo.get(info.node) == null); |
| 954 CoercionInfo.set(info.node, info); | 954 CoercionInfo.set(info.node, info); |
| 955 } | 955 } |
| 956 } | 956 } |
| 957 } | 957 } |
| OLD | NEW |