prepareSubClasses method
Prepares subclass entries by computing the graph from declarations.
Implementation
List<SubClassEntry> prepareSubClasses(List<ClassDeclaration> components) {
final graph = <String, List<String>>{};
for (final decl in components) {
final superLink = decl.getSuperClass();
if (superLink != null) {
final superQn = superLink.getPointerQualifiedName();
graph.putIfAbsent(superQn, () => []).add(decl.getQualifiedName());
}
for (final iface in decl.getInterfaces()) {
graph
.putIfAbsent(iface.getPointerQualifiedName(), () => [])
.add(decl.getQualifiedName());
}
for (final mixin in decl.getMixins()) {
graph
.putIfAbsent(mixin.getPointerQualifiedName(), () => [])
.add(decl.getQualifiedName());
}
}
return graph.entries
.map(
(e) => SubClassEntry(
parentQualifiedName: e.key,
childQualifiedNames: e.value,
),
)
.toList();
}