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

Side by Side Diff: pkg/compiler/lib/src/inferrer/builder.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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/inferrer_engine.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 simple_types_inferrer; 5 library simple_types_inferrer;
6 6
7 import '../closure.dart' show ClosureRepresentationInfo; 7 import '../closure.dart' show ClosureRepresentationInfo;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show Identifiers, Selectors; 9 import '../common/names.dart' show Identifiers, Selectors;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 971 }
972 972
973 if (analyzedElement.isGenerativeConstructor) { 973 if (analyzedElement.isGenerativeConstructor) {
974 isThisExposed = false; 974 isThisExposed = false;
975 signature.forEachParameter((FormalElement _element) { 975 signature.forEachParameter((FormalElement _element) {
976 ParameterElement element = _element; 976 ParameterElement element = _element;
977 TypeInformation parameterType = inferrer.typeOfParameter(element); 977 TypeInformation parameterType = inferrer.typeOfParameter(element);
978 if (element.isInitializingFormal) { 978 if (element.isInitializingFormal) {
979 InitializingFormalElement initializingFormal = element; 979 InitializingFormalElement initializingFormal = element;
980 if (initializingFormal.fieldElement.isFinal) { 980 if (initializingFormal.fieldElement.isFinal) {
981 inferrer.recordTypeOfFinalField( 981 inferrer.recordTypeOfField(
982 initializingFormal.fieldElement, parameterType); 982 initializingFormal.fieldElement, parameterType);
983 } else { 983 } else {
984 locals.updateField(initializingFormal.fieldElement, parameterType); 984 locals.updateField(initializingFormal.fieldElement, parameterType);
985 inferrer.recordTypeOfNonFinalField( 985 inferrer.recordTypeOfField(
986 initializingFormal.fieldElement, parameterType); 986 initializingFormal.fieldElement, parameterType);
987 } 987 }
988 } 988 }
989 locals.update(element, parameterType, node); 989 locals.update(element, parameterType, node);
990 }); 990 });
991 ClassElement cls = analyzedElement.enclosingClass; 991 ClassElement cls = analyzedElement.enclosingClass;
992 Spannable spannable = node; 992 Spannable spannable = node;
993 if (analyzedElement.isSynthesized) { 993 if (analyzedElement.isSynthesized) {
994 spannable = analyzedElement; 994 spannable = analyzedElement;
995 ConstructorElement constructor = analyzedElement; 995 ConstructorElement constructor = analyzedElement;
(...skipping 29 matching lines...) Expand all
1025 inferrer.recordExposesThis(analyzedElement, isThisExposed); 1025 inferrer.recordExposesThis(analyzedElement, isThisExposed);
1026 } 1026 }
1027 if (!isConstructorRedirect) { 1027 if (!isConstructorRedirect) {
1028 // Iterate over all instance fields, and give a null type to 1028 // Iterate over all instance fields, and give a null type to
1029 // fields that we haven'TypeInformation initialized for sure. 1029 // fields that we haven'TypeInformation initialized for sure.
1030 cls.forEachInstanceField((_, FieldElement field) { 1030 cls.forEachInstanceField((_, FieldElement field) {
1031 if (field.isFinal) return; 1031 if (field.isFinal) return;
1032 TypeInformation type = locals.fieldScope.readField(field); 1032 TypeInformation type = locals.fieldScope.readField(field);
1033 ResolvedAst resolvedAst = field.resolvedAst; 1033 ResolvedAst resolvedAst = field.resolvedAst;
1034 if (type == null && resolvedAst.body == null) { 1034 if (type == null && resolvedAst.body == null) {
1035 inferrer.recordTypeOfNonFinalField(field, types.nullType); 1035 inferrer.recordTypeOfField(field, types.nullType);
1036 } 1036 }
1037 }); 1037 });
1038 } 1038 }
1039 if (analyzedElement.isGenerativeConstructor && cls.isAbstract) { 1039 if (analyzedElement.isGenerativeConstructor && cls.isAbstract) {
1040 if (closedWorld.isInstantiated(cls)) { 1040 if (closedWorld.isInstantiated(cls)) {
1041 returnType = types.nonNullSubclass(cls); 1041 returnType = types.nonNullSubclass(cls);
1042 } else { 1042 } else {
1043 // TODO(johnniwinther): Avoid analyzing [analyzedElement] in this 1043 // TODO(johnniwinther): Avoid analyzing [analyzedElement] in this
1044 // case; it's never called. 1044 // case; it's never called.
1045 returnType = types.nonNullEmpty(); 1045 returnType = types.nonNullEmpty();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 if (element.isField) { 1210 if (element.isField) {
1211 ResolvedAst elementResolvedAst = element.resolvedAst; 1211 ResolvedAst elementResolvedAst = element.resolvedAst;
1212 if (!selector.isSetter && 1212 if (!selector.isSetter &&
1213 isInClassOrSubclass(element) && 1213 isInClassOrSubclass(element) &&
1214 !element.isFinal && 1214 !element.isFinal &&
1215 locals.fieldScope.readField(element) == null && 1215 locals.fieldScope.readField(element) == null &&
1216 elementResolvedAst.body == null) { 1216 elementResolvedAst.body == null) {
1217 // If the field is being used before this constructor 1217 // If the field is being used before this constructor
1218 // actually had a chance to initialize it, say it can be 1218 // actually had a chance to initialize it, say it can be
1219 // null. 1219 // null.
1220 inferrer.recordTypeOfNonFinalField(element, types.nullType); 1220 inferrer.recordTypeOfField(element, types.nullType);
1221 } 1221 }
1222 // Accessing a field does not expose [:this:]. 1222 // Accessing a field does not expose [:this:].
1223 return true; 1223 return true;
1224 } 1224 }
1225 // TODO(ngeoffray): We could do better here if we knew what we 1225 // TODO(ngeoffray): We could do better here if we knew what we
1226 // are calling does not expose this. 1226 // are calling does not expose this.
1227 isThisExposed = true; 1227 isThisExposed = true;
1228 return false; 1228 return false;
1229 }); 1229 });
1230 } 1230 }
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 MemberElement single = targets.first; 1995 MemberElement single = targets.first;
1996 if (single.isField) { 1996 if (single.isField) {
1997 locals.updateField(single, rhsType); 1997 locals.updateField(single, rhsType);
1998 } 1998 }
1999 } 1999 }
2000 } 2000 }
2001 handleDynamicSend( 2001 handleDynamicSend(
2002 node, setterSelector, setterMask, receiverType, arguments); 2002 node, setterSelector, setterMask, receiverType, arguments);
2003 } else if (element.isField) { 2003 } else if (element.isField) {
2004 if (element.isFinal) { 2004 if (element.isFinal) {
2005 inferrer.recordTypeOfFinalField(element, rhsType); 2005 inferrer.recordTypeOfField(element, rhsType);
2006 } else { 2006 } else {
2007 if (analyzedElement.isGenerativeConstructor) { 2007 if (analyzedElement.isGenerativeConstructor) {
2008 locals.updateField(element, rhsType); 2008 locals.updateField(element, rhsType);
2009 } 2009 }
2010 if (visitingInitializers) { 2010 if (visitingInitializers) {
2011 inferrer.recordTypeOfNonFinalField(element, rhsType); 2011 inferrer.recordTypeOfField(element, rhsType);
2012 } else { 2012 } else {
2013 handleDynamicSend( 2013 handleDynamicSend(
2014 node, setterSelector, setterMask, receiverType, arguments); 2014 node, setterSelector, setterMask, receiverType, arguments);
2015 } 2015 }
2016 } 2016 }
2017 } else if (element.isLocal) { 2017 } else if (element.isLocal) {
2018 locals.update(element, rhsType, node); 2018 locals.update(element, rhsType, node);
2019 } 2019 }
2020 return rhsType; 2020 return rhsType;
2021 } 2021 }
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 Selector moveNextSelector = Selectors.moveNext; 2947 Selector moveNextSelector = Selectors.moveNext;
2948 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node); 2948 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node);
2949 2949
2950 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, 2950 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector,
2951 iteratorMask, expressionType, new ArgumentsTypes.empty()); 2951 iteratorMask, expressionType, new ArgumentsTypes.empty());
2952 2952
2953 return handleForInLoop(node, iteratorType, currentSelector, currentMask, 2953 return handleForInLoop(node, iteratorType, currentSelector, currentMask,
2954 moveNextSelector, moveNextMask); 2954 moveNextSelector, moveNextMask);
2955 } 2955 }
2956 } 2956 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/inferrer_engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698