From 1d117f1b4b37673ceaa514850594a124250277b4 Mon Sep 17 00:00:00 2001 From: Duologic Date: Mon, 1 Jul 2024 11:20:23 +0200 Subject: [PATCH] fix?: copied case from function below --- pkg/ast/processing/find_field.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/ast/processing/find_field.go b/pkg/ast/processing/find_field.go index edf26f1..3cfb681 100644 --- a/pkg/ast/processing/find_field.go +++ b/pkg/ast/processing/find_field.go @@ -74,6 +74,19 @@ func FindRangesFromIndexList(stack *nodestack.NodeStack, indexList []string, vm if funcBody := findChildDesugaredObject(bodyNode.Body); funcBody != nil { foundDesugaredObjects = append(foundDesugaredObjects, funcBody) } + case *ast.Var: + varReference, err := FindVarReference(bodyNode, vm) + if err != nil { + return nil, err + } + // If the reference is an object, add it directly to the list of objects to look in + // Otherwise, add it back to the list for further processing + if varReferenceObj := findChildDesugaredObject(varReference); varReferenceObj != nil { + foundDesugaredObjects = append(foundDesugaredObjects, varReferenceObj) + } + //else { + // fieldNodes = append(fieldNodes, varReference) + //} default: return nil, fmt.Errorf("unexpected node type when finding bind for '%s': %s", start, reflect.TypeOf(bind.Body)) }