feat: Fix TypeScript inheritance extraction by properly handling class_heritage wrapper nodes
Addresses TypeScript's AST structure where class_heritage nodes wrap extends_clause and implements_clause rather than directly indicating inheritance relationships. Moves class_heritage from direct inheritance extraction to recursive container processing to properly traverse the wrapped inheritance syntax.
This commit is contained in:
@@ -1214,7 +1214,6 @@ export class TreeSitterExtractor {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
child.type === 'extends_clause' ||
|
child.type === 'extends_clause' ||
|
||||||
child.type === 'class_heritage' ||
|
|
||||||
child.type === 'superclass' ||
|
child.type === 'superclass' ||
|
||||||
child.type === 'extends_interfaces' // Java interface extends
|
child.type === 'extends_interfaces' // Java interface extends
|
||||||
) {
|
) {
|
||||||
@@ -1329,8 +1328,9 @@ export class TreeSitterExtractor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recurse into container nodes (e.g. field_declaration_list in Go structs)
|
// Recurse into container nodes (e.g. field_declaration_list in Go structs,
|
||||||
if (child.type === 'field_declaration_list') {
|
// class_heritage in TypeScript which wraps extends_clause/implements_clause)
|
||||||
|
if (child.type === 'field_declaration_list' || child.type === 'class_heritage') {
|
||||||
this.extractInheritance(child, classId);
|
this.extractInheritance(child, classId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user