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

Function BinaryBinding

common/decls/decls.go:869–883  ·  view source on GitHub ↗

BinaryBinding provides the implementation of a binary 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.BinaryOp)

Source from the content-addressed store, hash-verified

867// BinaryBinding provides the implementation of a binary overload. The provided function is protected by a runtime
868// type-guard which ensures runtime type agreement between the overload signature and runtime argument types.
869func BinaryBinding(binding functions.BinaryOp) OverloadOpt {
870 return func(o *OverloadDecl) (*OverloadDecl, error) {
871 if o.HasBinding() {
872 return nil, fmt.Errorf("overload already has a binding: %s", o.ID())
873 }
874 if len(o.ArgTypes()) != 2 {
875 return nil, fmt.Errorf("binary function bound to non-binary overload: %s", o.ID())
876 }
877 if o.hasLateBinding {
878 return nil, fmt.Errorf("overload already has a late binding: %s", o.ID())
879 }
880 o.binaryOp = binding
881 return o, nil
882 }
883}
884
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.

Callers 8

testDataFunction · 0.92
TestEnvFromConfigFunction · 0.92
BinaryBindingFunction · 0.92
initFunction · 0.92

Calls 3

HasBindingMethod · 0.80
ArgTypesMethod · 0.80
IDMethod · 0.65