Explorar o código

feat: Add Go selector_expression support to function call extraction

Addresses Go's tree-sitter parsing where method calls use selector_expression nodes with 'field' children instead of member_expression nodes with 'property' children. Extends function call extraction to handle Go's obj.method() syntax alongside existing JavaScript/TypeScript support.
Colby McHenry hai 2 meses
pai
achega
902cb0ef9d
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      src/extraction/tree-sitter.ts

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

@@ -1134,9 +1134,10 @@ export class TreeSitterExtractor {
       const func = getChildByField(node, 'function') || node.namedChild(0);
 
       if (func) {
-        if (func.type === 'member_expression' || func.type === 'attribute') {
-          // Method call: obj.method()
-          const property = getChildByField(func, 'property') || func.namedChild(1);
+        if (func.type === 'member_expression' || func.type === 'attribute' || func.type === 'selector_expression') {
+          // Method call: obj.method() or obj.field.method()
+          // Go uses selector_expression with 'field', JS/TS uses member_expression with 'property'
+          const property = getChildByField(func, 'property') || getChildByField(func, 'field') || func.namedChild(1);
           if (property) {
             calleeName = getNodeText(property, this.source);
           }