MCPcopy Create free account
hub / github.com/cel-expr/cel-go / visitCallFunc

Method visitCallFunc

parser/unparser.go:248–275  ·  view source on GitHub ↗
(expr ast.Expr)

Source from the content-addressed store, hash-verified

246}
247
248func (un *unparser) visitCallFunc(expr ast.Expr) error {
249 c := expr.AsCall()
250 fun := c.FunctionName()
251 args := c.Args()
252 if c.IsMemberFunction() {
253 nested := isBinaryOrTernaryOperator(c.Target())
254 err := un.visitMaybeNested(c.Target(), nested)
255 if err != nil {
256 return err
257 }
258 un.str.WriteString(".")
259 un.str.WriteString(un.maybeQuoteIdent(fun))
260 } else {
261 un.str.WriteString(un.maybeQuoteFunction(fun))
262 }
263 un.str.WriteString("(")
264 for i, arg := range args {
265 err := un.visit(arg)
266 if err != nil {
267 return err
268 }
269 if i < len(args)-1 {
270 un.str.WriteString(", ")
271 }
272 }
273 un.str.WriteString(")")
274 return nil
275}
276
277func (un *unparser) visitCallIndex(expr ast.Expr) error {
278 return un.visitCallIndexInternal(expr, "[")

Callers 1

visitCallMethod · 0.95

Calls 10

visitMaybeNestedMethod · 0.95
maybeQuoteIdentMethod · 0.95
maybeQuoteFunctionMethod · 0.95
visitMethod · 0.95
AsCallMethod · 0.65
FunctionNameMethod · 0.65
ArgsMethod · 0.65
IsMemberFunctionMethod · 0.65
TargetMethod · 0.65

Tested by

no test coverage detected