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.
This commit is contained in:
@@ -1134,9 +1134,10 @@ export class TreeSitterExtractor {
|
|||||||
const func = getChildByField(node, 'function') || node.namedChild(0);
|
const func = getChildByField(node, 'function') || node.namedChild(0);
|
||||||
|
|
||||||
if (func) {
|
if (func) {
|
||||||
if (func.type === 'member_expression' || func.type === 'attribute') {
|
if (func.type === 'member_expression' || func.type === 'attribute' || func.type === 'selector_expression') {
|
||||||
// Method call: obj.method()
|
// Method call: obj.method() or obj.field.method()
|
||||||
const property = getChildByField(func, 'property') || func.namedChild(1);
|
// 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) {
|
if (property) {
|
||||||
calleeName = getNodeText(property, this.source);
|
calleeName = getNodeText(property, this.source);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user