Bump cel-go to v0.17.6
This commit is contained in:
17
vendor/github.com/google/cel-go/parser/macro.go
generated
vendored
17
vendor/github.com/google/cel-go/parser/macro.go
generated
vendored
@@ -232,6 +232,9 @@ type ExprHelper interface {
|
||||
|
||||
// OffsetLocation returns the Location of the expression identifier.
|
||||
OffsetLocation(exprID int64) common.Location
|
||||
|
||||
// NewError associates an error message with a given expression id.
|
||||
NewError(exprID int64, message string) *common.Error
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -324,7 +327,7 @@ func MakeExistsOne(eh ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*ex
|
||||
func MakeMap(eh ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {
|
||||
v, found := extractIdent(args[0])
|
||||
if !found {
|
||||
return nil, &common.Error{Message: "argument is not an identifier"}
|
||||
return nil, eh.NewError(args[0].GetId(), "argument is not an identifier")
|
||||
}
|
||||
|
||||
var fn *exprpb.Expr
|
||||
@@ -355,7 +358,7 @@ func MakeMap(eh ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.E
|
||||
func MakeFilter(eh ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {
|
||||
v, found := extractIdent(args[0])
|
||||
if !found {
|
||||
return nil, &common.Error{Message: "argument is not an identifier"}
|
||||
return nil, eh.NewError(args[0].GetId(), "argument is not an identifier")
|
||||
}
|
||||
|
||||
filter := args[1]
|
||||
@@ -372,17 +375,13 @@ func MakeHas(eh ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.E
|
||||
if s, ok := args[0].ExprKind.(*exprpb.Expr_SelectExpr); ok {
|
||||
return eh.PresenceTest(s.SelectExpr.GetOperand(), s.SelectExpr.GetField()), nil
|
||||
}
|
||||
return nil, &common.Error{Message: "invalid argument to has() macro"}
|
||||
return nil, eh.NewError(args[0].GetId(), "invalid argument to has() macro")
|
||||
}
|
||||
|
||||
func makeQuantifier(kind quantifierKind, eh ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {
|
||||
v, found := extractIdent(args[0])
|
||||
if !found {
|
||||
location := eh.OffsetLocation(args[0].GetId())
|
||||
return nil, &common.Error{
|
||||
Message: "argument must be a simple name",
|
||||
Location: location,
|
||||
}
|
||||
return nil, eh.NewError(args[0].GetId(), "argument must be a simple name")
|
||||
}
|
||||
|
||||
var init *exprpb.Expr
|
||||
@@ -411,7 +410,7 @@ func makeQuantifier(kind quantifierKind, eh ExprHelper, target *exprpb.Expr, arg
|
||||
eh.GlobalCall(operators.Add, eh.AccuIdent(), oneExpr), eh.AccuIdent())
|
||||
result = eh.GlobalCall(operators.Equals, eh.AccuIdent(), oneExpr)
|
||||
default:
|
||||
return nil, &common.Error{Message: fmt.Sprintf("unrecognized quantifier '%v'", kind)}
|
||||
return nil, eh.NewError(args[0].GetId(), fmt.Sprintf("unrecognized quantifier '%v'", kind))
|
||||
}
|
||||
return eh.Fold(v, target, AccumulatorName, init, condition, step, result), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user