@@ -125,6 +125,7 @@ class InheritanceManager {
125125 * @return the inherited executable element with the member name, or `null` if no such
126126 * member exists
127127 */
128+ @deprecated
128129 ExecutableElement lookupInheritance (
129130 ClassElement classElt, String memberName) {
130131 if (memberName == null || memberName.isEmpty) {
@@ -149,6 +150,7 @@ class InheritanceManager {
149150 * @return the inherited executable element with the member name, or `null` if no such
150151 * member exists
151152 */
153+ @deprecated
152154 ExecutableElement lookupMember (ClassElement classElt, String memberName) {
153155 ExecutableElement element = _lookupMemberInClass (classElt, memberName);
154156 if (element != null ) {
@@ -193,47 +195,6 @@ class InheritanceManager {
193195 return result;
194196 }
195197
196- /**
197- * This method takes some inherited [FunctionType] , and resolves all the parameterized types
198- * in the function type, dependent on the class in which it is being overridden.
199- *
200- * @param baseFunctionType the function type that is being overridden
201- * @param memberName the name of the member, this is used to lookup the inheritance path of the
202- * override
203- * @param definingType the type that is overriding the member
204- * @return the passed function type with any parameterized types substituted
205- */
206- // TODO(jmesserly): investigate why this is needed in ErrorVerifier's override
207- // checking. There seems to be some rare cases where we get partially
208- // substituted type arguments, and the function types don't compare equally.
209- FunctionType substituteTypeArgumentsInMemberFromInheritance (
210- FunctionType baseFunctionType,
211- String memberName,
212- InterfaceType definingType) {
213- // if the baseFunctionType is null, or does not have any parameters,
214- // return it.
215- if (baseFunctionType == null || baseFunctionType.typeArguments.isEmpty) {
216- return baseFunctionType;
217- }
218- // First, generate the path from the defining type to the overridden member
219- Queue <InterfaceType > inheritancePath = new Queue <InterfaceType >();
220- _computeInheritancePath (inheritancePath, definingType, memberName);
221- if (inheritancePath == null || inheritancePath.isEmpty) {
222- // TODO(jwren) log analysis engine error
223- return baseFunctionType;
224- }
225- FunctionType functionTypeToReturn = baseFunctionType;
226- // loop backward through the list substituting as we go:
227- while (! inheritancePath.isEmpty) {
228- InterfaceType lastType = inheritancePath.removeLast ();
229- List <DartType > parameterTypes = lastType.element.type.typeArguments;
230- List <DartType > argumentTypes = lastType.typeArguments;
231- functionTypeToReturn =
232- functionTypeToReturn.substitute2 (argumentTypes, parameterTypes);
233- }
234- return functionTypeToReturn;
235- }
236-
237198 /**
238199 * Compute and return a mapping between the set of all string names of the members inherited from
239200 * the passed [ClassElement] superclass hierarchy, and the associated
@@ -336,78 +297,6 @@ class InheritanceManager {
336297 return resultMap;
337298 }
338299
339- /**
340- * Compute and return the inheritance path given the context of a type and a member that is
341- * overridden in the inheritance path (for which the type is in the path).
342- *
343- * @param chain the inheritance path that is built up as this method calls itself recursively,
344- * when this method is called an empty [Queue] should be provided
345- * @param currentType the current type in the inheritance path
346- * @param memberName the name of the member that is being looked up the inheritance path
347- */
348- void _computeInheritancePath (Queue <InterfaceType > chain,
349- InterfaceType currentType, String memberName) {
350- // TODO (jwren) create a public version of this method which doesn't require
351- // the initial chain to be provided, then provided tests for this
352- // functionality in InheritanceManagerTest
353- chain.add (currentType);
354- ClassElement classElt = currentType.element;
355- // Base case- reached Object
356- if (currentType.isObject) {
357- // Looked up the chain all the way to Object, return null.
358- // This should never happen.
359- return ;
360- }
361- // If we are done, return the chain
362- // We are not done if this is the first recursive call on this method.
363- if (chain.length != 1 ) {
364- // We are done however if the member is in this classElt
365- if (_lookupMemberInClass (classElt, memberName) != null ) {
366- return ;
367- }
368- }
369- // Mixins- note that mixins call lookupMemberInClass, not lookupMember
370- List <InterfaceType > mixins = classElt.mixins;
371- for (int i = mixins.length - 1 ; i >= 0 ; i-- ) {
372- ClassElement mixinElement = mixins[i].element;
373- if (mixinElement != null ) {
374- ExecutableElement elt = _lookupMemberInClass (mixinElement, memberName);
375- if (elt != null ) {
376- // this is equivalent (but faster than) calling this method
377- // recursively
378- // (return computeInheritancePath(chain, mixins[i], memberName);)
379- chain.add (mixins[i]);
380- return ;
381- }
382- }
383- }
384- // Superclass
385- InterfaceType supertype = classElt.supertype;
386- if (supertype != null &&
387- lookupMember (supertype.element, memberName) != null ) {
388- _computeInheritancePath (chain, supertype, memberName);
389- return ;
390- }
391- // Superclass constraints
392- for (InterfaceType interfaceType in classElt.superclassConstraints) {
393- ClassElement interfaceElement = interfaceType.element;
394- if (interfaceElement != null &&
395- lookupMember (interfaceElement, memberName) != null ) {
396- _computeInheritancePath (chain, interfaceType, memberName);
397- return ;
398- }
399- }
400- // Interfaces
401- for (InterfaceType interfaceType in classElt.interfaces) {
402- ClassElement interfaceElement = interfaceType.element;
403- if (interfaceElement != null &&
404- lookupMember (interfaceElement, memberName) != null ) {
405- _computeInheritancePath (chain, interfaceType, memberName);
406- return ;
407- }
408- }
409- }
410-
411300 /**
412301 * Compute and return a mapping between the set of all string names of the members inherited from
413302 * the passed [ClassElement] interface hierarchy, and the associated
0 commit comments