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

Function MakeHas

parser/macro.go:550–556  ·  view source on GitHub ↗

MakeHas expands the input call arguments into a presence test, e.g. has( .field)

(eh ExprHelper, target ast.Expr, args []ast.Expr)

Source from the content-addressed store, hash-verified

548
549// MakeHas expands the input call arguments into a presence test, e.g. has(<operand>.field)
550func MakeHas(eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) {
551 if args[0].Kind() == ast.SelectKind {
552 s := args[0].AsSelect()
553 return eh.NewPresenceTest(s.Operand(), s.FieldName()), nil
554 }
555 return nil, eh.NewError(args[0].ID(), "invalid argument to has() macro")
556}
557
558func makeQuantifier(kind quantifierKind, eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) {
559 v, found := extractIdent(args[0])

Callers

nothing calls this directly

Calls 7

KindMethod · 0.65
AsSelectMethod · 0.65
NewPresenceTestMethod · 0.65
OperandMethod · 0.65
FieldNameMethod · 0.65
NewErrorMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected