From bd87c598e42238893e0c130decae6bc490d44a4b Mon Sep 17 00:00:00 2001 From: worstell Date: Thu, 26 Sep 2024 17:03:48 -0700 Subject: [PATCH] fix: legacy call metadata (#2853) this will all go away when we remove support for ftl.Call(...) --- go-runtime/schema/finalize/analyzer.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/go-runtime/schema/finalize/analyzer.go b/go-runtime/schema/finalize/analyzer.go index 8e6e67d225..d1e7b5dc23 100644 --- a/go-runtime/schema/finalize/analyzer.go +++ b/go-runtime/schema/finalize/analyzer.go @@ -94,28 +94,22 @@ func Run(pass *analysis.Pass) (interface{}, error) { func getCalls(pass *analysis.Pass) (functionCalls map[types.Object]sets.Set[types.Object], verbCalls map[types.Object]sets.Set[*schema.Ref]) { fnCalls := make(map[types.Object]sets.Set[types.Object]) for obj, calls := range common.GetAllFactsOfType[*common.FunctionCall](pass) { - if len(calls) < 1 { - continue - } - fnCall := calls[0] - - if fnCalls[obj] == nil { - fnCalls[obj] = sets.NewSet[types.Object]() + for _, fnCall := range calls { + if fnCalls[obj] == nil { + fnCalls[obj] = sets.NewSet[types.Object]() + } + fnCalls[obj].Add(fnCall.Callee) } - fnCalls[obj].Add(fnCall.Callee) } vCalls := make(map[types.Object]sets.Set[*schema.Ref]) for obj, calls := range common.GetAllFactsOfType[*common.VerbCall](pass) { - if len(calls) < 1 { - continue - } - vCall := calls[0] - - if vCalls[obj] == nil { - vCalls[obj] = sets.NewSet[*schema.Ref]() + for _, vCall := range calls { + if vCalls[obj] == nil { + vCalls[obj] = sets.NewSet[*schema.Ref]() + } + vCalls[obj].Add(vCall.VerbRef) } - vCalls[obj].Add(vCall.VerbRef) } return fnCalls, vCalls }