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

Side by Side Diff: pkg/compiler/lib/src/inferrer/inferrer_engine.dart

Issue 2980073002: Remove unneeded methods from InferrerEngine. (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 GlobalTypeInferenceElementData lookupDataOfMember(MemberElement element); 125 GlobalTypeInferenceElementData lookupDataOfMember(MemberElement element);
126 126
127 bool checkIfExposesThis(ConstructorElement element); 127 bool checkIfExposesThis(ConstructorElement element);
128 128
129 void recordExposesThis(ConstructorElement element, bool exposesThis); 129 void recordExposesThis(ConstructorElement element, bool exposesThis);
130 130
131 /// Records that the return type [element] is of type [type]. 131 /// Records that the return type [element] is of type [type].
132 void recordReturnType(MethodElement element, TypeInformation type); 132 void recordReturnType(MethodElement element, TypeInformation type);
133 133
134 /// Records that [element] is of type [type]. 134 /// Records that [element] is of type [type].
135 // TODO(johnniwinther): Merge [recordTypeOfFinalField] and
136 // [recordTypeOfNonFinalField] with this?
137 void recordTypeOfField(FieldElement element, TypeInformation type); 135 void recordTypeOfField(FieldElement element, TypeInformation type);
138 136
139 /// Records that [node] sets final field [element] to be of type [type].
140 void recordTypeOfFinalField(FieldElement element, TypeInformation type);
141
142 /// Records that [node] sets non-final field [element] to be of type [type].
143 void recordTypeOfNonFinalField(FieldElement element, TypeInformation type);
144
145 /// Records that the captured variable [local] is read.
146 // TODO(johnniwinther): Remove this.
147 void recordCapturedLocalRead(Local local) {}
148
149 /// Records that the variable [local] is being updated.
150 // TODO(johnniwinther): Remove this.
151 void recordLocalUpdate(Local local, TypeInformation type) {}
152
153 /// Registers a call to await with an expression of type [argumentType] as 137 /// Registers a call to await with an expression of type [argumentType] as
154 /// argument. 138 /// argument.
155 TypeInformation registerAwait(ast.Node node, TypeInformation argument); 139 TypeInformation registerAwait(ast.Node node, TypeInformation argument);
156 140
157 /// Registers a call to yield with an expression of type [argumentType] as 141 /// Registers a call to yield with an expression of type [argumentType] as
158 /// argument. 142 /// argument.
159 TypeInformation registerYield(ast.Node node, TypeInformation argument); 143 TypeInformation registerYield(ast.Node node, TypeInformation argument);
160 144
161 /// Registers that [caller] calls [closure] with [arguments]. 145 /// Registers that [caller] calls [closure] with [arguments].
162 /// 146 ///
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 698 }
715 } 699 }
716 recordTypeOfField(element, type); 700 recordTypeOfField(element, type);
717 } else if (!element.isInstanceMember) { 701 } else if (!element.isInstanceMember) {
718 recordTypeOfField(element, types.nullType); 702 recordTypeOfField(element, types.nullType);
719 } 703 }
720 } else if (initializer == null) { 704 } else if (initializer == null) {
721 // Only update types of static fields if there is no 705 // Only update types of static fields if there is no
722 // assignment. Instance fields are dealt with in the constructor. 706 // assignment. Instance fields are dealt with in the constructor.
723 if (Elements.isStaticOrTopLevelField(element)) { 707 if (Elements.isStaticOrTopLevelField(element)) {
724 recordTypeOfNonFinalField(element, type); 708 recordTypeOfField(element, type);
725 } 709 }
726 } else { 710 } else {
727 recordTypeOfNonFinalField(element, type); 711 recordTypeOfField(element, type);
728 } 712 }
729 if (Elements.isStaticOrTopLevelField(element) && 713 if (Elements.isStaticOrTopLevelField(element) &&
730 resolvedAst.body != null && 714 resolvedAst.body != null &&
731 !element.isConst) { 715 !element.isConst) {
732 dynamic argument = resolvedAst.body; 716 dynamic argument = resolvedAst.body;
733 // TODO(13429): We could do better here by using the 717 // TODO(13429): We could do better here by using the
734 // constant handler to figure out if it's a lazy field or not. 718 // constant handler to figure out if it's a lazy field or not.
735 if (argument.asSend() != null || 719 if (argument.asSend() != null ||
736 (argument.asNewExpression() != null && !argument.isConst)) { 720 (argument.asNewExpression() != null && !argument.isConst)) {
737 recordTypeOfField(element, types.nullType); 721 recordTypeOfField(element, types.nullType);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 TypeInformation typeOfMember(MemberElement element) { 900 TypeInformation typeOfMember(MemberElement element) {
917 if (element is MethodElement) return types.functionType; 901 if (element is MethodElement) return types.functionType;
918 return types.getInferredTypeOfMember(element); 902 return types.getInferredTypeOfMember(element);
919 } 903 }
920 904
921 TypeInformation returnTypeOfMember(MemberElement element) { 905 TypeInformation returnTypeOfMember(MemberElement element) {
922 if (element is! MethodElement) return types.dynamicType; 906 if (element is! MethodElement) return types.dynamicType;
923 return types.getInferredTypeOfMember(element); 907 return types.getInferredTypeOfMember(element);
924 } 908 }
925 909
926 void recordTypeOfFinalField(FieldElement element, TypeInformation type) {
927 types.getInferredTypeOfMember(element).addAssignment(type);
928 }
929
930 void recordTypeOfNonFinalField(FieldElement element, TypeInformation type) {
931 types.getInferredTypeOfMember(element).addAssignment(type);
932 }
933
934 void recordTypeOfField(FieldElement element, TypeInformation type) { 910 void recordTypeOfField(FieldElement element, TypeInformation type) {
935 types.getInferredTypeOfMember(element).addAssignment(type); 911 types.getInferredTypeOfMember(element).addAssignment(type);
936 } 912 }
937 913
938 void recordReturnType(MethodElement element, TypeInformation type) { 914 void recordReturnType(MethodElement element, TypeInformation type) {
939 TypeInformation info = types.getInferredTypeOfMember(element); 915 TypeInformation info = types.getInferredTypeOfMember(element);
940 if (element.name == '==') { 916 if (element.name == '==') {
941 // Even if x.== doesn't return a bool, 'x == null' evaluates to 'false'. 917 // Even if x.== doesn't return a bool, 'x == null' evaluates to 'false'.
942 info.addAssignment(types.boolType); 918 info.addAssignment(types.boolType);
943 } 919 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 @override 1243 @override
1268 bool checkPhiNode(ast.Node node) { 1244 bool checkPhiNode(ast.Node node) {
1269 return true; 1245 return true;
1270 } 1246 }
1271 1247
1272 @override 1248 @override
1273 bool checkClassEntity(covariant ClassElement cls) { 1249 bool checkClassEntity(covariant ClassElement cls) {
1274 return cls.isDeclaration; 1250 return cls.isDeclaration;
1275 } 1251 }
1276 } 1252 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/builder.dart ('k') | pkg/compiler/lib/src/inferrer/locals_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698