| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 */ | 840 */ |
| 841 bool _checkForInvalidAssignment(Expression lhs, Expression rhs) { | 841 bool _checkForInvalidAssignment(Expression lhs, Expression rhs) { |
| 842 if (lhs == null || rhs == null) { | 842 if (lhs == null || rhs == null) { |
| 843 return false; | 843 return false; |
| 844 } | 844 } |
| 845 VariableElement leftVariableElement = ErrorVerifier.getVariableElement(lhs); | 845 VariableElement leftVariableElement = ErrorVerifier.getVariableElement(lhs); |
| 846 DartType leftType = (leftVariableElement == null) | 846 DartType leftType = (leftVariableElement == null) |
| 847 ? ErrorVerifier.getStaticType(lhs) | 847 ? ErrorVerifier.getStaticType(lhs) |
| 848 : leftVariableElement.type; | 848 : leftVariableElement.type; |
| 849 DartType staticRightType = ErrorVerifier.getStaticType(rhs); | 849 DartType staticRightType = ErrorVerifier.getStaticType(rhs); |
| 850 if (!_typeSystem.isAssignableTo(staticRightType, leftType)) { | 850 if (!_typeSystem.isAssignableTo(staticRightType, leftType, |
| 851 isDeclarationCast: true)) { |
| 851 // The warning was generated on this rhs | 852 // The warning was generated on this rhs |
| 852 return false; | 853 return false; |
| 853 } | 854 } |
| 854 // Test for, and then generate the hint | 855 // Test for, and then generate the hint |
| 855 DartType bestRightType = rhs.bestType; | 856 DartType bestRightType = rhs.bestType; |
| 856 if (leftType != null && bestRightType != null) { | 857 if (leftType != null && bestRightType != null) { |
| 857 if (!_typeSystem.isAssignableTo(bestRightType, leftType)) { | 858 if (!_typeSystem.isAssignableTo(bestRightType, leftType, |
| 859 isDeclarationCast: true)) { |
| 858 _errorReporter.reportTypeErrorForNode( | 860 _errorReporter.reportTypeErrorForNode( |
| 859 HintCode.INVALID_ASSIGNMENT, rhs, [bestRightType, leftType]); | 861 HintCode.INVALID_ASSIGNMENT, rhs, [bestRightType, leftType]); |
| 860 return true; | 862 return true; |
| 861 } | 863 } |
| 862 } | 864 } |
| 863 return false; | 865 return false; |
| 864 } | 866 } |
| 865 | 867 |
| 866 void _checkForInvalidFactory(MethodDeclaration decl) { | 868 void _checkForInvalidFactory(MethodDeclaration decl) { |
| 867 // Check declaration. | 869 // Check declaration. |
| (...skipping 9790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10658 return null; | 10660 return null; |
| 10659 } | 10661 } |
| 10660 if (identical(node.staticElement, variable)) { | 10662 if (identical(node.staticElement, variable)) { |
| 10661 if (node.inSetterContext()) { | 10663 if (node.inSetterContext()) { |
| 10662 result = true; | 10664 result = true; |
| 10663 } | 10665 } |
| 10664 } | 10666 } |
| 10665 return null; | 10667 return null; |
| 10666 } | 10668 } |
| 10667 } | 10669 } |
| OLD | NEW |