Kaynağa Gözat

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.
Colby McHenry 2 ay önce
ebeveyn
işleme
ce7b7684db
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3 3
      src/extraction/tree-sitter.ts

+ 3 - 3
src/extraction/tree-sitter.ts

@@ -1214,7 +1214,6 @@ export class TreeSitterExtractor {
 
       if (
         child.type === 'extends_clause' ||
-        child.type === 'class_heritage' ||
         child.type === 'superclass' ||
         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)
-      if (child.type === 'field_declaration_list') {
+      // Recurse into container nodes (e.g. field_declaration_list in Go structs,
+      // class_heritage in TypeScript which wraps extends_clause/implements_clause)
+      if (child.type === 'field_declaration_list' || child.type === 'class_heritage') {
         this.extractInheritance(child, classId);
       }
     }