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

Function FunctionBinding

common/decls/decls.go:887–898  ·  view source on GitHub ↗

FunctionBinding provides the implementation of a variadic overload. The provided function is protected by a runtime type-guard which ensures runtime type agreement between the overload signature and runtime argument types.

(binding functions.FunctionOp)

Source from the content-addressed store, hash-verified

885// FunctionBinding provides the implementation of a variadic overload. The provided function is protected by a runtime
886// type-guard which ensures runtime type agreement between the overload signature and runtime argument types.
887func FunctionBinding(binding functions.FunctionOp) OverloadOpt {
888 return func(o *OverloadDecl) (*OverloadDecl, error) {
889 if o.HasBinding() {
890 return nil, fmt.Errorf("overload already has a binding: %s", o.ID())
891 }
892 if o.hasLateBinding {
893 return nil, fmt.Errorf("overload already has a late binding: %s", o.ID())
894 }
895 o.functionOp = binding
896 return o, nil
897 }
898}
899
900// LateFunctionBinding indicates that the function has a binding which is not known at compile time.
901// This is useful for functions which have side-effects or are not deterministically computable.

Calls 2

HasBindingMethod · 0.80
IDMethod · 0.65