MCPcopy Create free account
hub / github.com/temporalio/temporal / hasParallelCall

Function hasParallelCall

tools/parallelize/parallelize.go:174–198  ·  view source on GitHub ↗

hasParallelCall checks if the function body already contains .Parallel().

(body *ast.BlockStmt, paramName string)

Source from the content-addressed store, hash-verified

172
173// hasParallelCall checks if the function body already contains <param>.Parallel().
174func hasParallelCall(body *ast.BlockStmt, paramName string) bool {
175 found := false
176 ast.Inspect(body, func(n ast.Node) bool {
177 if found {
178 return false
179 }
180 call, ok := n.(*ast.CallExpr)
181 if !ok {
182 return true
183 }
184 sel, ok := call.Fun.(*ast.SelectorExpr)
185 if !ok {
186 return true
187 }
188 ident, ok := sel.X.(*ast.Ident)
189 if !ok {
190 return true
191 }
192 if ident.Name == paramName && sel.Sel.Name == "Parallel" {
193 found = true
194 }
195 return true
196 })
197 return found
198}

Callers 1

processFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected