fix(python): visit a shared base or subclass once when walking inheritance

This commit is contained in:
l0ng-ai
2026-11-16 20:58:50 +08:00
parent f76ac263a0
commit ac3c564249
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -316,7 +316,9 @@ export async function ancestryResolution(
continue;
}
for (const parent of found) {
if (!seen.add(declarationKey(parent))) continue;
const key = declarationKey(parent);
if (seen.has(key)) continue;
seen.add(key);
out.push({ decl: parent, depth: d });
next.push(parent);
}
+3 -1
View File
@@ -123,7 +123,9 @@ export async function pythonDescendants(
const next: ClassInheritance[] = [];
for (const parent of level) {
for (const sub of subclasses.get(declarationKey(parent)) ?? []) {
if (!seen.add(declarationKey(sub))) continue;
const key = declarationKey(sub);
if (seen.has(key)) continue;
seen.add(key);
out.push(sub);
next.push(sub);
}