resolveMultiplyInheritedElement function
ModelElement
resolveMultiplyInheritedElement(
- MultiplyInheritedExecutableElement e,
- Library? library,
- PackageGraph packageGraph,
- Class enclosingClass,
Resolves this very rare case incorrectly by picking the closest element in the inheritance and interface chains from the analyzer.
Implementation
ModelElement resolveMultiplyInheritedElement(
MultiplyInheritedExecutableElement e,
Library? library,
PackageGraph packageGraph,
Class enclosingClass) {
var inheritables = e.inheritedElements
.map((ee) => ModelElement._fromElement(ee, packageGraph) as Inheritable);
late Inheritable foundInheritable;
var lowIndex = enclosingClass.inheritanceChain.length;
for (var inheritable in inheritables) {
var index = enclosingClass.inheritanceChain
.indexOf(inheritable.enclosingElement as InheritingContainer?);
if (index < lowIndex) {
foundInheritable = inheritable;
lowIndex = index;
}
}
return ModelElement._from(foundInheritable.element!, library, packageGraph,
enclosingContainer: enclosingClass);
}