| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart'; | 8 import '../common/names.dart'; |
| 9 import '../compiler.dart'; | 9 import '../compiler.dart'; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 * are fixed. | 753 * are fixed. |
| 754 */ | 754 */ |
| 755 bool hasAlreadyComputedTypeOfParameterDefault(Element parameter) { | 755 bool hasAlreadyComputedTypeOfParameterDefault(Element parameter) { |
| 756 TypeInformation seen = defaultTypeOfParameter[parameter]; | 756 TypeInformation seen = defaultTypeOfParameter[parameter]; |
| 757 return (seen != null && seen is! PlaceholderTypeInformation); | 757 return (seen != null && seen is! PlaceholderTypeInformation); |
| 758 } | 758 } |
| 759 | 759 |
| 760 /** | 760 /** |
| 761 * Returns the type of [element]. | 761 * Returns the type of [element]. |
| 762 */ | 762 */ |
| 763 TypeInformation typeOfElement(Element element) { | 763 TypeInformation typeOfElement(Entity element) { |
| 764 if (element is FunctionElement) return types.functionType; | 764 if (element is FunctionElement) return types.functionType; |
| 765 return types.getInferredTypeOf(element); | 765 return types.getInferredTypeOf(element); |
| 766 } | 766 } |
| 767 | 767 |
| 768 /** | 768 /** |
| 769 * Returns the return type of [element]. | 769 * Returns the return type of [element]. |
| 770 */ | 770 */ |
| 771 TypeInformation returnTypeOfElement(Element element) { | 771 TypeInformation returnTypeOfElement(Entity element) { |
| 772 if (element is! FunctionElement) return types.dynamicType; | 772 if (element is! FunctionElement) return types.dynamicType; |
| 773 return types.getInferredTypeOf(element); | 773 return types.getInferredTypeOf(element); |
| 774 } | 774 } |
| 775 | 775 |
| 776 /** | 776 /** |
| 777 * Records that [node] sets final field [element] to be of type [type]. | 777 * Records that [node] sets final field [element] to be of type [type]. |
| 778 * | 778 * |
| 779 * [nodeHolder] is the element holder of [node]. | 779 * [nodeHolder] is the element holder of [node]. |
| 780 */ | 780 */ |
| 781 void recordTypeOfFinalField( | 781 void recordTypeOfFinalField( |
| 782 Spannable node, Element analyzed, Element element, TypeInformation type) { | 782 Spannable node, Entity analyzed, Entity element, TypeInformation type) { |
| 783 types.getInferredTypeOf(element).addAssignment(type); | 783 types.getInferredTypeOf(element).addAssignment(type); |
| 784 } | 784 } |
| 785 | 785 |
| 786 /** | 786 /** |
| 787 * Records that [node] sets non-final field [element] to be of type | 787 * Records that [node] sets non-final field [element] to be of type |
| 788 * [type]. | 788 * [type]. |
| 789 */ | 789 */ |
| 790 void recordTypeOfNonFinalField( | 790 void recordTypeOfNonFinalField( |
| 791 Spannable node, Element element, TypeInformation type) { | 791 Spannable node, Entity element, TypeInformation type) { |
| 792 types.getInferredTypeOf(element).addAssignment(type); | 792 types.getInferredTypeOf(element).addAssignment(type); |
| 793 } | 793 } |
| 794 | 794 |
| 795 /** | 795 /** |
| 796 * Records that [element] is of type [type]. | 796 * Records that [element] is of type [type]. |
| 797 */ | 797 */ |
| 798 void recordType(Element element, TypeInformation type) { | 798 void recordType(Entity element, TypeInformation type) { |
| 799 types.getInferredTypeOf(element).addAssignment(type); | 799 types.getInferredTypeOf(element).addAssignment(type); |
| 800 } | 800 } |
| 801 | 801 |
| 802 /** | 802 /** |
| 803 * Records that the return type [element] is of type [type]. | 803 * Records that the return type [element] is of type [type]. |
| 804 */ | 804 */ |
| 805 void recordReturnType(Element element, TypeInformation type) { | 805 void recordReturnType(Element element, TypeInformation type) { |
| 806 TypeInformation info = types.getInferredTypeOf(element); | 806 TypeInformation info = types.getInferredTypeOf(element); |
| 807 if (element.name == '==') { | 807 if (element.name == '==') { |
| 808 // Even if x.== doesn't return a bool, 'x == null' evaluates to 'false'. | 808 // Even if x.== doesn't return a bool, 'x == null' evaluates to 'false'. |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 /** | 1084 /** |
| 1085 * Records that the captured variable [local] is read. | 1085 * Records that the captured variable [local] is read. |
| 1086 */ | 1086 */ |
| 1087 void recordCapturedLocalRead(Local local) {} | 1087 void recordCapturedLocalRead(Local local) {} |
| 1088 | 1088 |
| 1089 /** | 1089 /** |
| 1090 * Records that the variable [local] is being updated. | 1090 * Records that the variable [local] is being updated. |
| 1091 */ | 1091 */ |
| 1092 void recordLocalUpdate(Local local, TypeInformation type) {} | 1092 void recordLocalUpdate(Local local, TypeInformation type) {} |
| 1093 } | 1093 } |
| OLD | NEW |