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

Function matchOperandTrait

interpreter/interpretable.go:1012–1016  ·  view source on GitHub ↗

matchOperandTrait returns true if the operand satisfies the trait required by the function implementation, or if the implementation does not require a trait. Non-strict functions are given the chance to handle unknown and error operands themselves.

(trait int, strict bool, operand ref.Val)

Source from the content-addressed store, hash-verified

1010//
1011// Non-strict functions are given the chance to handle unknown and error operands themselves.
1012func matchOperandTrait(trait int, strict bool, operand ref.Val) bool {
1013 return trait == 0 ||
1014 (!strict && types.IsUnknownOrError(operand)) ||
1015 operand.Type().HasTrait(trait)
1016}
1017
1018// evalList evaluates a list construction expression.
1019type evalList struct {

Callers 4

ExecMethod · 0.70
ExecMethod · 0.70
ExecMethod · 0.70
matchOverloadMethod · 0.70

Calls 3

IsUnknownOrErrorFunction · 0.92
HasTraitMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected