Skip to content

Commit

Permalink
fix: legacy call metadata (#2853)
Browse files Browse the repository at this point in the history
this will all go away when we remove support for ftl.Call(...)
  • Loading branch information
worstell authored Sep 27, 2024
1 parent 1bba467 commit bd87c59
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions go-runtime/schema/finalize/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit bd87c59

Please sign in to comment.