Skip to content

Commit ce7b768

Browse files
committed
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.
1 parent 5046c76 commit ce7b768

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/extraction/tree-sitter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,6 @@ export class TreeSitterExtractor {
12141214

12151215
if (
12161216
child.type === 'extends_clause' ||
1217-
child.type === 'class_heritage' ||
12181217
child.type === 'superclass' ||
12191218
child.type === 'extends_interfaces' // Java interface extends
12201219
) {
@@ -1329,8 +1328,9 @@ export class TreeSitterExtractor {
13291328
}
13301329
}
13311330

1332-
// Recurse into container nodes (e.g. field_declaration_list in Go structs)
1333-
if (child.type === 'field_declaration_list') {
1331+
// Recurse into container nodes (e.g. field_declaration_list in Go structs,
1332+
// class_heritage in TypeScript which wraps extends_clause/implements_clause)
1333+
if (child.type === 'field_declaration_list' || child.type === 'class_heritage') {
13341334
this.extractInheritance(child, classId);
13351335
}
13361336
}

0 commit comments

Comments
 (0)