mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
rebase: update kubernetes to 1.28.0 in main
updating kubernetes to 1.28.0 in the main repo. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
b2fdc269c3
commit
ff3e84ad67
63
vendor/github.com/google/cel-go/parser/unparser.go
generated
vendored
63
vendor/github.com/google/cel-go/parser/unparser.go
generated
vendored
@ -106,9 +106,15 @@ func (un *unparser) visitCall(expr *exprpb.Expr) error {
|
||||
// ternary operator
|
||||
case operators.Conditional:
|
||||
return un.visitCallConditional(expr)
|
||||
// optional select operator
|
||||
case operators.OptSelect:
|
||||
return un.visitOptSelect(expr)
|
||||
// index operator
|
||||
case operators.Index:
|
||||
return un.visitCallIndex(expr)
|
||||
// optional index operator
|
||||
case operators.OptIndex:
|
||||
return un.visitCallOptIndex(expr)
|
||||
// unary operators
|
||||
case operators.LogicalNot, operators.Negate:
|
||||
return un.visitCallUnary(expr)
|
||||
@ -218,6 +224,14 @@ func (un *unparser) visitCallFunc(expr *exprpb.Expr) error {
|
||||
}
|
||||
|
||||
func (un *unparser) visitCallIndex(expr *exprpb.Expr) error {
|
||||
return un.visitCallIndexInternal(expr, "[")
|
||||
}
|
||||
|
||||
func (un *unparser) visitCallOptIndex(expr *exprpb.Expr) error {
|
||||
return un.visitCallIndexInternal(expr, "[?")
|
||||
}
|
||||
|
||||
func (un *unparser) visitCallIndexInternal(expr *exprpb.Expr, op string) error {
|
||||
c := expr.GetCallExpr()
|
||||
args := c.GetArgs()
|
||||
nested := isBinaryOrTernaryOperator(args[0])
|
||||
@ -225,7 +239,7 @@ func (un *unparser) visitCallIndex(expr *exprpb.Expr) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
un.str.WriteString("[")
|
||||
un.str.WriteString(op)
|
||||
err = un.visit(args[1])
|
||||
if err != nil {
|
||||
return err
|
||||
@ -262,6 +276,9 @@ func (un *unparser) visitConst(expr *exprpb.Expr) error {
|
||||
// represent the float using the minimum required digits
|
||||
d := strconv.FormatFloat(c.GetDoubleValue(), 'g', -1, 64)
|
||||
un.str.WriteString(d)
|
||||
if !strings.Contains(d, ".") {
|
||||
un.str.WriteString(".0")
|
||||
}
|
||||
case *exprpb.Constant_Int64Value:
|
||||
i := strconv.FormatInt(c.GetInt64Value(), 10)
|
||||
un.str.WriteString(i)
|
||||
@ -289,8 +306,15 @@ func (un *unparser) visitIdent(expr *exprpb.Expr) error {
|
||||
func (un *unparser) visitList(expr *exprpb.Expr) error {
|
||||
l := expr.GetListExpr()
|
||||
elems := l.GetElements()
|
||||
optIndices := make(map[int]bool, len(elems))
|
||||
for _, idx := range l.GetOptionalIndices() {
|
||||
optIndices[int(idx)] = true
|
||||
}
|
||||
un.str.WriteString("[")
|
||||
for i, elem := range elems {
|
||||
if optIndices[i] {
|
||||
un.str.WriteString("?")
|
||||
}
|
||||
err := un.visit(elem)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -303,20 +327,32 @@ func (un *unparser) visitList(expr *exprpb.Expr) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (un *unparser) visitOptSelect(expr *exprpb.Expr) error {
|
||||
c := expr.GetCallExpr()
|
||||
args := c.GetArgs()
|
||||
operand := args[0]
|
||||
field := args[1].GetConstExpr().GetStringValue()
|
||||
return un.visitSelectInternal(operand, false, ".?", field)
|
||||
}
|
||||
|
||||
func (un *unparser) visitSelect(expr *exprpb.Expr) error {
|
||||
sel := expr.GetSelectExpr()
|
||||
return un.visitSelectInternal(sel.GetOperand(), sel.GetTestOnly(), ".", sel.GetField())
|
||||
}
|
||||
|
||||
func (un *unparser) visitSelectInternal(operand *exprpb.Expr, testOnly bool, op string, field string) error {
|
||||
// handle the case when the select expression was generated by the has() macro.
|
||||
if sel.GetTestOnly() {
|
||||
if testOnly {
|
||||
un.str.WriteString("has(")
|
||||
}
|
||||
nested := !sel.GetTestOnly() && isBinaryOrTernaryOperator(sel.GetOperand())
|
||||
err := un.visitMaybeNested(sel.GetOperand(), nested)
|
||||
nested := !testOnly && isBinaryOrTernaryOperator(operand)
|
||||
err := un.visitMaybeNested(operand, nested)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
un.str.WriteString(".")
|
||||
un.str.WriteString(sel.GetField())
|
||||
if sel.GetTestOnly() {
|
||||
un.str.WriteString(op)
|
||||
un.str.WriteString(field)
|
||||
if testOnly {
|
||||
un.str.WriteString(")")
|
||||
}
|
||||
return nil
|
||||
@ -339,6 +375,9 @@ func (un *unparser) visitStructMsg(expr *exprpb.Expr) error {
|
||||
un.str.WriteString("{")
|
||||
for i, entry := range entries {
|
||||
f := entry.GetFieldKey()
|
||||
if entry.GetOptionalEntry() {
|
||||
un.str.WriteString("?")
|
||||
}
|
||||
un.str.WriteString(f)
|
||||
un.str.WriteString(": ")
|
||||
v := entry.GetValue()
|
||||
@ -360,6 +399,9 @@ func (un *unparser) visitStructMap(expr *exprpb.Expr) error {
|
||||
un.str.WriteString("{")
|
||||
for i, entry := range entries {
|
||||
k := entry.GetMapKey()
|
||||
if entry.GetOptionalEntry() {
|
||||
un.str.WriteString("?")
|
||||
}
|
||||
err := un.visit(k)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -492,11 +534,10 @@ func (un *unparser) writeOperatorWithWrapping(fun string, unmangled string) bool
|
||||
un.str.WriteString(" ")
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
un.str.WriteString(" ")
|
||||
un.str.WriteString(unmangled)
|
||||
un.str.WriteString(" ")
|
||||
}
|
||||
un.str.WriteString(" ")
|
||||
un.str.WriteString(unmangled)
|
||||
un.str.WriteString(" ")
|
||||
return false
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user