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

Method guardedFunctionOp

common/decls/decls.go:783–793  ·  view source on GitHub ↗

guardedFunctionOp creates an invocation guard around the provided variadic function binding, if one is provided.

(funcName string, disableTypeGuards bool)

Source from the content-addressed store, hash-verified

781
782// guardedFunctionOp creates an invocation guard around the provided variadic function binding, if one is provided.
783func (o *OverloadDecl) guardedFunctionOp(funcName string, disableTypeGuards bool) functions.FunctionOp {
784 if o.functionOp == nil {
785 return nil
786 }
787 return func(args ...ref.Val) ref.Val {
788 if !o.matchesRuntimeSignature(disableTypeGuards, args...) {
789 return MaybeNoSuchOverload(funcName, args...)
790 }
791 return o.functionOp(args...)
792 }
793}
794
795// matchesRuntimeUnarySignature indicates whether the argument type is runtime assiganble to the overload's expected argument.
796func (o *OverloadDecl) matchesRuntimeUnarySignature(disableTypeGuards bool, arg ref.Val) bool {

Callers 1

BindingsMethod · 0.80

Calls 2

MaybeNoSuchOverloadFunction · 0.85

Tested by

no test coverage detected