mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Run pin-dependency.sh and update-vendor.sh.
This commit is contained in:
parent
d581cc90ad
commit
4a703d6cbc
4
go.mod
4
go.mod
@ -176,7 +176,7 @@ require (
|
||||
github.com/gofrs/uuid v4.0.0+incompatible // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
|
||||
github.com/google/btree v1.0.1 // indirect
|
||||
github.com/google/cel-go v0.12.4 // indirect
|
||||
github.com/google/cel-go v0.12.5 // indirect
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
|
||||
@ -388,7 +388,7 @@ replace (
|
||||
github.com/golangplus/testing => github.com/golangplus/testing v1.0.0
|
||||
github.com/google/btree => github.com/google/btree v1.0.1
|
||||
github.com/google/cadvisor => github.com/google/cadvisor v0.45.0
|
||||
github.com/google/cel-go => github.com/google/cel-go v0.12.4
|
||||
github.com/google/cel-go => github.com/google/cel-go v0.12.5
|
||||
github.com/google/gnostic => github.com/google/gnostic v0.5.7-v3refs
|
||||
github.com/google/go-cmp => github.com/google/go-cmp v0.5.6
|
||||
github.com/google/gofuzz => github.com/google/gofuzz v1.1.0
|
||||
|
4
go.sum
4
go.sum
@ -215,8 +215,8 @@ github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
|
||||
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
|
||||
github.com/google/cadvisor v0.45.0 h1:bXQze1sd8srZiQwiQ19Qaq/AoMIZS8YceBXrIaEvkX0=
|
||||
github.com/google/cadvisor v0.45.0/go.mod h1:vsMT3Uv2XjQ8M7WUtKARV74mU/HN64C4XtM1bJhUKcU=
|
||||
github.com/google/cel-go v0.12.4 h1:YINKfuHZ8n72tPOqSPZBwGiDpew2CJS48mdM5W8LZQU=
|
||||
github.com/google/cel-go v0.12.4/go.mod h1:Av7CU6r6X3YmcHR9GXqVDaEJYfEtSxl6wvIjUQTriCw=
|
||||
github.com/google/cel-go v0.12.5 h1:DmzaiSgoaqGCjtpPQWl26/gND+yRpim56H1jCVev6d8=
|
||||
github.com/google/cel-go v0.12.5/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw=
|
||||
github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=
|
||||
github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ=
|
||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||
|
@ -7,7 +7,7 @@ go 1.19
|
||||
require (
|
||||
github.com/emicklei/go-restful/v3 v3.8.0
|
||||
github.com/gogo/protobuf v1.3.2
|
||||
github.com/google/cel-go v0.12.4
|
||||
github.com/google/cel-go v0.12.5
|
||||
github.com/google/gnostic v0.5.7-v3refs
|
||||
github.com/google/go-cmp v0.5.6
|
||||
github.com/google/gofuzz v1.1.0
|
||||
|
@ -198,8 +198,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
|
||||
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
|
||||
github.com/google/cel-go v0.12.4 h1:YINKfuHZ8n72tPOqSPZBwGiDpew2CJS48mdM5W8LZQU=
|
||||
github.com/google/cel-go v0.12.4/go.mod h1:Av7CU6r6X3YmcHR9GXqVDaEJYfEtSxl6wvIjUQTriCw=
|
||||
github.com/google/cel-go v0.12.5 h1:DmzaiSgoaqGCjtpPQWl26/gND+yRpim56H1jCVev6d8=
|
||||
github.com/google/cel-go v0.12.5/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw=
|
||||
github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=
|
||||
github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
|
65
vendor/github.com/google/cel-go/checker/checker.go
generated
vendored
65
vendor/github.com/google/cel-go/checker/checker.go
generated
vendored
@ -80,10 +80,10 @@ func (c *checker) check(e *exprpb.Expr) {
|
||||
return
|
||||
}
|
||||
|
||||
switch e.ExprKind.(type) {
|
||||
switch e.GetExprKind().(type) {
|
||||
case *exprpb.Expr_ConstExpr:
|
||||
literal := e.GetConstExpr()
|
||||
switch literal.ConstantKind.(type) {
|
||||
switch literal.GetConstantKind().(type) {
|
||||
case *exprpb.Constant_BoolValue:
|
||||
c.checkBoolLiteral(e)
|
||||
case *exprpb.Constant_BytesValue:
|
||||
@ -149,8 +149,8 @@ func (c *checker) checkIdent(e *exprpb.Expr) {
|
||||
identExpr := e.GetIdentExpr()
|
||||
// Check to see if the identifier is declared.
|
||||
if ident := c.env.LookupIdent(identExpr.GetName()); ident != nil {
|
||||
c.setType(e, ident.GetIdent().Type)
|
||||
c.setReference(e, newIdentReference(ident.GetName(), ident.GetIdent().Value))
|
||||
c.setType(e, ident.GetIdent().GetType())
|
||||
c.setReference(e, newIdentReference(ident.GetName(), ident.GetIdent().GetValue()))
|
||||
// Overwrite the identifier with its fully qualified name.
|
||||
identExpr.Name = ident.GetName()
|
||||
return
|
||||
@ -186,23 +186,20 @@ func (c *checker) checkSelect(e *exprpb.Expr) {
|
||||
}
|
||||
|
||||
// Interpret as field selection, first traversing down the operand.
|
||||
c.check(sel.Operand)
|
||||
targetType := substitute(c.mappings, c.getType(sel.Operand), false)
|
||||
c.check(sel.GetOperand())
|
||||
targetType := substitute(c.mappings, c.getType(sel.GetOperand()), false)
|
||||
// Assume error type by default as most types do not support field selection.
|
||||
resultType := decls.Error
|
||||
switch kindOf(targetType) {
|
||||
case kindMap:
|
||||
// Maps yield their value type as the selection result type.
|
||||
mapType := targetType.GetMapType()
|
||||
resultType = mapType.ValueType
|
||||
resultType = mapType.GetValueType()
|
||||
case kindObject:
|
||||
// Objects yield their field type declaration as the selection result type, but only if
|
||||
// the field is defined.
|
||||
messageType := targetType
|
||||
if fieldType, found := c.lookupFieldType(
|
||||
c.location(e),
|
||||
messageType.GetMessageType(),
|
||||
sel.Field); found {
|
||||
if fieldType, found := c.lookupFieldType(c.location(e), messageType.GetMessageType(), sel.GetField()); found {
|
||||
resultType = fieldType.Type
|
||||
}
|
||||
case kindTypeParam:
|
||||
@ -320,15 +317,15 @@ func (c *checker) resolveOverload(
|
||||
|
||||
var resultType *exprpb.Type
|
||||
var checkedRef *exprpb.Reference
|
||||
for _, overload := range fn.GetFunction().Overloads {
|
||||
for _, overload := range fn.GetFunction().GetOverloads() {
|
||||
// Determine whether the overload is currently considered.
|
||||
if c.env.isOverloadDisabled(overload.GetOverloadId()) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Ensure the call style for the overload matches.
|
||||
if (target == nil && overload.IsInstanceFunction) ||
|
||||
(target != nil && !overload.IsInstanceFunction) {
|
||||
if (target == nil && overload.GetIsInstanceFunction()) ||
|
||||
(target != nil && !overload.GetIsInstanceFunction()) {
|
||||
// not a compatible call style.
|
||||
continue
|
||||
}
|
||||
@ -348,13 +345,11 @@ func (c *checker) resolveOverload(
|
||||
if checkedRef == nil {
|
||||
checkedRef = newFunctionReference(overload.GetOverloadId())
|
||||
} else {
|
||||
checkedRef.OverloadId = append(checkedRef.OverloadId, overload.GetOverloadId())
|
||||
checkedRef.OverloadId = append(checkedRef.GetOverloadId(), overload.GetOverloadId())
|
||||
}
|
||||
|
||||
// First matching overload, determines result type.
|
||||
fnResultType := substitute(c.mappings,
|
||||
overloadType.GetFunction().GetResultType(),
|
||||
false)
|
||||
fnResultType := substitute(c.mappings, overloadType.GetFunction().GetResultType(), false)
|
||||
if resultType == nil {
|
||||
resultType = fnResultType
|
||||
} else if !isDyn(resultType) && !proto.Equal(fnResultType, resultType) {
|
||||
@ -375,7 +370,7 @@ func (c *checker) resolveOverload(
|
||||
func (c *checker) checkCreateList(e *exprpb.Expr) {
|
||||
create := e.GetListExpr()
|
||||
var elemType *exprpb.Type
|
||||
for _, e := range create.Elements {
|
||||
for _, e := range create.GetElements() {
|
||||
c.check(e)
|
||||
elemType = c.joinTypes(c.location(e), elemType, c.getType(e))
|
||||
}
|
||||
@ -388,7 +383,7 @@ func (c *checker) checkCreateList(e *exprpb.Expr) {
|
||||
|
||||
func (c *checker) checkCreateStruct(e *exprpb.Expr) {
|
||||
str := e.GetStructExpr()
|
||||
if str.MessageName != "" {
|
||||
if str.GetMessageName() != "" {
|
||||
c.checkCreateMessage(e)
|
||||
} else {
|
||||
c.checkCreateMap(e)
|
||||
@ -419,22 +414,22 @@ func (c *checker) checkCreateMessage(e *exprpb.Expr) {
|
||||
msgVal := e.GetStructExpr()
|
||||
// Determine the type of the message.
|
||||
messageType := decls.Error
|
||||
decl := c.env.LookupIdent(msgVal.MessageName)
|
||||
decl := c.env.LookupIdent(msgVal.GetMessageName())
|
||||
if decl == nil {
|
||||
c.errors.undeclaredReference(
|
||||
c.location(e), c.env.container.Name(), msgVal.MessageName)
|
||||
c.location(e), c.env.container.Name(), msgVal.GetMessageName())
|
||||
return
|
||||
}
|
||||
// Ensure the type name is fully qualified in the AST.
|
||||
msgVal.MessageName = decl.GetName()
|
||||
c.setReference(e, newIdentReference(decl.GetName(), nil))
|
||||
ident := decl.GetIdent()
|
||||
identKind := kindOf(ident.Type)
|
||||
identKind := kindOf(ident.GetType())
|
||||
if identKind != kindError {
|
||||
if identKind != kindType {
|
||||
c.errors.notAType(c.location(e), ident.Type)
|
||||
c.errors.notAType(c.location(e), ident.GetType())
|
||||
} else {
|
||||
messageType = ident.Type.GetType()
|
||||
messageType = ident.GetType().GetType()
|
||||
if kindOf(messageType) != kindObject {
|
||||
c.errors.notAMessageType(c.location(e), messageType)
|
||||
messageType = decls.Error
|
||||
@ -450,12 +445,12 @@ func (c *checker) checkCreateMessage(e *exprpb.Expr) {
|
||||
// Check the field initializers.
|
||||
for _, ent := range msgVal.GetEntries() {
|
||||
field := ent.GetFieldKey()
|
||||
value := ent.Value
|
||||
value := ent.GetValue()
|
||||
c.check(value)
|
||||
|
||||
fieldType := decls.Error
|
||||
if t, found := c.lookupFieldType(
|
||||
c.locationByID(ent.Id),
|
||||
c.locationByID(ent.GetId()),
|
||||
messageType.GetMessageType(),
|
||||
field); found {
|
||||
fieldType = t.Type
|
||||
@ -576,25 +571,25 @@ func (c *checker) lookupFieldType(l common.Location, messageType string, fieldNa
|
||||
}
|
||||
|
||||
func (c *checker) setType(e *exprpb.Expr, t *exprpb.Type) {
|
||||
if old, found := c.types[e.Id]; found && !proto.Equal(old, t) {
|
||||
if old, found := c.types[e.GetId()]; found && !proto.Equal(old, t) {
|
||||
c.errors.ReportError(c.location(e),
|
||||
"(Incompatible) Type already exists for expression: %v(%d) old:%v, new:%v", e, e.GetId(), old, t)
|
||||
return
|
||||
}
|
||||
c.types[e.Id] = t
|
||||
c.types[e.GetId()] = t
|
||||
}
|
||||
|
||||
func (c *checker) getType(e *exprpb.Expr) *exprpb.Type {
|
||||
return c.types[e.Id]
|
||||
return c.types[e.GetId()]
|
||||
}
|
||||
|
||||
func (c *checker) setReference(e *exprpb.Expr, r *exprpb.Reference) {
|
||||
if old, found := c.references[e.Id]; found && !proto.Equal(old, r) {
|
||||
if old, found := c.references[e.GetId()]; found && !proto.Equal(old, r) {
|
||||
c.errors.ReportError(c.location(e),
|
||||
"Reference already exists for expression: %v(%d) old:%v, new:%v", e, e.Id, old, r)
|
||||
"Reference already exists for expression: %v(%d) old:%v, new:%v", e, e.GetId(), old, r)
|
||||
return
|
||||
}
|
||||
c.references[e.Id] = r
|
||||
c.references[e.GetId()] = r
|
||||
}
|
||||
|
||||
func (c *checker) assertType(e *exprpb.Expr, t *exprpb.Type) {
|
||||
@ -616,7 +611,7 @@ func newResolution(checkedRef *exprpb.Reference, t *exprpb.Type) *overloadResolu
|
||||
}
|
||||
|
||||
func (c *checker) location(e *exprpb.Expr) common.Location {
|
||||
return c.locationByID(e.Id)
|
||||
return c.locationByID(e.GetId())
|
||||
}
|
||||
|
||||
func (c *checker) locationByID(id int64) common.Location {
|
||||
@ -624,7 +619,7 @@ func (c *checker) locationByID(id int64) common.Location {
|
||||
var line = 1
|
||||
if offset, found := positions[id]; found {
|
||||
col := int(offset)
|
||||
for _, lineOffset := range c.sourceInfo.LineOffsets {
|
||||
for _, lineOffset := range c.sourceInfo.GetLineOffsets() {
|
||||
if lineOffset < offset {
|
||||
line++
|
||||
col = int(offset - lineOffset)
|
||||
|
42
vendor/github.com/google/cel-go/checker/cost.go
generated
vendored
42
vendor/github.com/google/cel-go/checker/cost.go
generated
vendored
@ -88,9 +88,9 @@ func (e astNode) ComputedSize() *SizeEstimate {
|
||||
return e.derivedSize
|
||||
}
|
||||
var v uint64
|
||||
switch ek := e.expr.ExprKind.(type) {
|
||||
switch ek := e.expr.GetExprKind().(type) {
|
||||
case *exprpb.Expr_ConstExpr:
|
||||
switch ck := ek.ConstExpr.ConstantKind.(type) {
|
||||
switch ck := ek.ConstExpr.GetConstantKind().(type) {
|
||||
case *exprpb.Constant_StringValue:
|
||||
v = uint64(len(ck.StringValue))
|
||||
case *exprpb.Constant_BytesValue:
|
||||
@ -103,10 +103,10 @@ func (e astNode) ComputedSize() *SizeEstimate {
|
||||
return nil
|
||||
}
|
||||
case *exprpb.Expr_ListExpr:
|
||||
v = uint64(len(ek.ListExpr.Elements))
|
||||
v = uint64(len(ek.ListExpr.GetElements()))
|
||||
case *exprpb.Expr_StructExpr:
|
||||
if ek.StructExpr.MessageName == "" {
|
||||
v = uint64(len(ek.StructExpr.Entries))
|
||||
if ek.StructExpr.GetMessageName() == "" {
|
||||
v = uint64(len(ek.StructExpr.GetEntries()))
|
||||
}
|
||||
default:
|
||||
return nil
|
||||
@ -297,7 +297,7 @@ func (c *coster) cost(e *exprpb.Expr) CostEstimate {
|
||||
return CostEstimate{}
|
||||
}
|
||||
var cost CostEstimate
|
||||
switch e.ExprKind.(type) {
|
||||
switch e.GetExprKind().(type) {
|
||||
case *exprpb.Expr_ConstExpr:
|
||||
cost = constCost
|
||||
case *exprpb.Expr_IdentExpr:
|
||||
@ -323,7 +323,7 @@ func (c *coster) costIdent(e *exprpb.Expr) CostEstimate {
|
||||
|
||||
// build and track the field path
|
||||
if iterRange, ok := c.iterRanges.peek(identExpr.GetName()); ok {
|
||||
switch c.checkedExpr.TypeMap[iterRange].TypeKind.(type) {
|
||||
switch c.checkedExpr.TypeMap[iterRange].GetTypeKind().(type) {
|
||||
case *exprpb.Type_ListType_:
|
||||
c.addPath(e, append(c.exprPath[iterRange], "@items"))
|
||||
case *exprpb.Type_MapType_:
|
||||
@ -350,7 +350,7 @@ func (c *coster) costSelect(e *exprpb.Expr) CostEstimate {
|
||||
}
|
||||
|
||||
// build and track the field path
|
||||
c.addPath(e, append(c.getPath(sel.GetOperand()), sel.Field))
|
||||
c.addPath(e, append(c.getPath(sel.GetOperand()), sel.GetField()))
|
||||
|
||||
return sum
|
||||
}
|
||||
@ -476,6 +476,15 @@ func (c *coster) sizeEstimate(t AstNode) SizeEstimate {
|
||||
if l := c.estimator.EstimateSize(t); l != nil {
|
||||
return *l
|
||||
}
|
||||
// return an estimate of 1 for return types of set
|
||||
// lengths, since strings/bytes/more complex objects could be of
|
||||
// variable length
|
||||
if isScalar(t.Type()) {
|
||||
// TODO: since the logic for size estimation is split between
|
||||
// ComputedSize and isScalar, changing one will likely require changing
|
||||
// the other, so they should be merged in the future if possible
|
||||
return SizeEstimate{Min: 1, Max: 1}
|
||||
}
|
||||
return SizeEstimate{Min: 0, Max: math.MaxUint64}
|
||||
}
|
||||
|
||||
@ -599,3 +608,20 @@ func (c *coster) newAstNode(e *exprpb.Expr) *astNode {
|
||||
}
|
||||
return &astNode{path: path, t: c.getType(e), expr: e, derivedSize: derivedSize}
|
||||
}
|
||||
|
||||
// isScalar returns true if the given type is known to be of a constant size at
|
||||
// compile time. isScalar will return false for strings (they are variable-width)
|
||||
// in addition to protobuf.Any and protobuf.Value (their size is not knowable at compile time).
|
||||
func isScalar(t *exprpb.Type) bool {
|
||||
switch kindOf(t) {
|
||||
case kindPrimitive:
|
||||
if t.GetPrimitive() != exprpb.Type_STRING && t.GetPrimitive() != exprpb.Type_BYTES {
|
||||
return true
|
||||
}
|
||||
case kindWellKnown:
|
||||
if t.GetWellKnown() == exprpb.Type_DURATION || t.GetWellKnown() == exprpb.Type_TIMESTAMP {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
8
vendor/github.com/google/cel-go/checker/printer.go
generated
vendored
8
vendor/github.com/google/cel-go/checker/printer.go
generated
vendored
@ -32,22 +32,22 @@ func (a *semanticAdorner) GetMetadata(elem interface{}) string {
|
||||
if !isExpr {
|
||||
return result
|
||||
}
|
||||
t := a.checks.TypeMap[e.Id]
|
||||
t := a.checks.TypeMap[e.GetId()]
|
||||
if t != nil {
|
||||
result += "~"
|
||||
result += FormatCheckedType(t)
|
||||
}
|
||||
|
||||
switch e.ExprKind.(type) {
|
||||
switch e.GetExprKind().(type) {
|
||||
case *exprpb.Expr_IdentExpr,
|
||||
*exprpb.Expr_CallExpr,
|
||||
*exprpb.Expr_StructExpr,
|
||||
*exprpb.Expr_SelectExpr:
|
||||
if ref, found := a.checks.ReferenceMap[e.Id]; found {
|
||||
if ref, found := a.checks.ReferenceMap[e.GetId()]; found {
|
||||
if len(ref.GetOverloadId()) == 0 {
|
||||
result += "^" + ref.Name
|
||||
} else {
|
||||
for i, overload := range ref.OverloadId {
|
||||
for i, overload := range ref.GetOverloadId() {
|
||||
if i == 0 {
|
||||
result += "^"
|
||||
} else {
|
||||
|
36
vendor/github.com/google/cel-go/checker/types.go
generated
vendored
36
vendor/github.com/google/cel-go/checker/types.go
generated
vendored
@ -52,13 +52,13 @@ func FormatCheckedType(t *exprpb.Type) string {
|
||||
t.GetFunction().GetArgTypes(),
|
||||
false)
|
||||
case kindList:
|
||||
return fmt.Sprintf("list(%s)", FormatCheckedType(t.GetListType().ElemType))
|
||||
return fmt.Sprintf("list(%s)", FormatCheckedType(t.GetListType().GetElemType()))
|
||||
case kindObject:
|
||||
return t.GetMessageType()
|
||||
case kindMap:
|
||||
return fmt.Sprintf("map(%s, %s)",
|
||||
FormatCheckedType(t.GetMapType().KeyType),
|
||||
FormatCheckedType(t.GetMapType().ValueType))
|
||||
FormatCheckedType(t.GetMapType().GetKeyType()),
|
||||
FormatCheckedType(t.GetMapType().GetValueType()))
|
||||
case kindNull:
|
||||
return "null"
|
||||
case kindPrimitive:
|
||||
@ -152,12 +152,12 @@ func isEqualOrLessSpecific(t1 *exprpb.Type, t2 *exprpb.Type) bool {
|
||||
}
|
||||
return true
|
||||
case kindList:
|
||||
return isEqualOrLessSpecific(t1.GetListType().ElemType, t2.GetListType().ElemType)
|
||||
return isEqualOrLessSpecific(t1.GetListType().GetElemType(), t2.GetListType().GetElemType())
|
||||
case kindMap:
|
||||
m1 := t1.GetMapType()
|
||||
m2 := t2.GetMapType()
|
||||
return isEqualOrLessSpecific(m1.KeyType, m2.KeyType) &&
|
||||
isEqualOrLessSpecific(m1.ValueType, m2.ValueType)
|
||||
return isEqualOrLessSpecific(m1.GetKeyType(), m2.GetKeyType()) &&
|
||||
isEqualOrLessSpecific(m1.GetValueType(), m2.GetValueType())
|
||||
case kindType:
|
||||
return true
|
||||
default:
|
||||
@ -165,7 +165,7 @@ func isEqualOrLessSpecific(t1 *exprpb.Type, t2 *exprpb.Type) bool {
|
||||
}
|
||||
}
|
||||
|
||||
/// internalIsAssignable returns true if t1 is assignable to t2.
|
||||
// / internalIsAssignable returns true if t1 is assignable to t2.
|
||||
func internalIsAssignable(m *mapping, t1 *exprpb.Type, t2 *exprpb.Type) bool {
|
||||
// Process type parameters.
|
||||
kind1, kind2 := kindOf(t1), kindOf(t2)
|
||||
@ -272,18 +272,14 @@ func isValidTypeSubstitution(m *mapping, t1, t2 *exprpb.Type) (valid, hasSub boo
|
||||
|
||||
// internalIsAssignableAbstractType returns true if the abstract type names agree and all type
|
||||
// parameters are assignable.
|
||||
func internalIsAssignableAbstractType(m *mapping,
|
||||
a1 *exprpb.Type_AbstractType,
|
||||
a2 *exprpb.Type_AbstractType) bool {
|
||||
func internalIsAssignableAbstractType(m *mapping, a1 *exprpb.Type_AbstractType, a2 *exprpb.Type_AbstractType) bool {
|
||||
return a1.GetName() == a2.GetName() &&
|
||||
internalIsAssignableList(m, a1.GetParameterTypes(), a2.GetParameterTypes())
|
||||
}
|
||||
|
||||
// internalIsAssignableFunction returns true if the function return type and arg types are
|
||||
// assignable.
|
||||
func internalIsAssignableFunction(m *mapping,
|
||||
f1 *exprpb.Type_FunctionType,
|
||||
f2 *exprpb.Type_FunctionType) bool {
|
||||
func internalIsAssignableFunction(m *mapping, f1 *exprpb.Type_FunctionType, f2 *exprpb.Type_FunctionType) bool {
|
||||
f1ArgTypes := flattenFunctionTypes(f1)
|
||||
f2ArgTypes := flattenFunctionTypes(f2)
|
||||
if internalIsAssignableList(m, f1ArgTypes, f2ArgTypes) {
|
||||
@ -363,7 +359,7 @@ func kindOf(t *exprpb.Type) int {
|
||||
if t == nil || t.TypeKind == nil {
|
||||
return kindUnknown
|
||||
}
|
||||
switch t.TypeKind.(type) {
|
||||
switch t.GetTypeKind().(type) {
|
||||
case *exprpb.Type_Error:
|
||||
return kindError
|
||||
case *exprpb.Type_Function:
|
||||
@ -425,10 +421,10 @@ func notReferencedIn(m *mapping, t *exprpb.Type, withinType *exprpb.Type) bool {
|
||||
}
|
||||
return true
|
||||
case kindList:
|
||||
return notReferencedIn(m, t, withinType.GetListType().ElemType)
|
||||
return notReferencedIn(m, t, withinType.GetListType().GetElemType())
|
||||
case kindMap:
|
||||
mt := withinType.GetMapType()
|
||||
return notReferencedIn(m, t, mt.KeyType) && notReferencedIn(m, t, mt.ValueType)
|
||||
return notReferencedIn(m, t, mt.GetKeyType()) && notReferencedIn(m, t, mt.GetValueType())
|
||||
case kindWrapper:
|
||||
return notReferencedIn(m, t, decls.NewPrimitiveType(withinType.GetWrapper()))
|
||||
default:
|
||||
@ -457,17 +453,17 @@ func substitute(m *mapping, t *exprpb.Type, typeParamToDyn bool) *exprpb.Type {
|
||||
case kindFunction:
|
||||
fn := t.GetFunction()
|
||||
rt := substitute(m, fn.ResultType, typeParamToDyn)
|
||||
args := make([]*exprpb.Type, len(fn.ArgTypes))
|
||||
args := make([]*exprpb.Type, len(fn.GetArgTypes()))
|
||||
for i, a := range fn.ArgTypes {
|
||||
args[i] = substitute(m, a, typeParamToDyn)
|
||||
}
|
||||
return decls.NewFunctionType(rt, args...)
|
||||
case kindList:
|
||||
return decls.NewListType(substitute(m, t.GetListType().ElemType, typeParamToDyn))
|
||||
return decls.NewListType(substitute(m, t.GetListType().GetElemType(), typeParamToDyn))
|
||||
case kindMap:
|
||||
mt := t.GetMapType()
|
||||
return decls.NewMapType(substitute(m, mt.KeyType, typeParamToDyn),
|
||||
substitute(m, mt.ValueType, typeParamToDyn))
|
||||
return decls.NewMapType(substitute(m, mt.GetKeyType(), typeParamToDyn),
|
||||
substitute(m, mt.GetValueType(), typeParamToDyn))
|
||||
case kindType:
|
||||
if t.GetType() != nil {
|
||||
return decls.NewTypeType(substitute(m, t.GetType(), typeParamToDyn))
|
||||
|
8
vendor/github.com/google/cel-go/common/containers/container.go
generated
vendored
8
vendor/github.com/google/cel-go/common/containers/container.go
generated
vendored
@ -298,18 +298,18 @@ func Name(name string) ContainerOption {
|
||||
// ToQualifiedName converts an expression AST into a qualified name if possible, with a boolean
|
||||
// 'found' value that indicates if the conversion is successful.
|
||||
func ToQualifiedName(e *exprpb.Expr) (string, bool) {
|
||||
switch e.ExprKind.(type) {
|
||||
switch e.GetExprKind().(type) {
|
||||
case *exprpb.Expr_IdentExpr:
|
||||
id := e.GetIdentExpr()
|
||||
return id.Name, true
|
||||
return id.GetName(), true
|
||||
case *exprpb.Expr_SelectExpr:
|
||||
sel := e.GetSelectExpr()
|
||||
// Test only expressions are not valid as qualified names.
|
||||
if sel.GetTestOnly() {
|
||||
return "", false
|
||||
}
|
||||
if qual, found := ToQualifiedName(sel.Operand); found {
|
||||
return qual + "." + sel.Field, true
|
||||
if qual, found := ToQualifiedName(sel.GetOperand()); found {
|
||||
return qual + "." + sel.GetField(), true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
|
42
vendor/github.com/google/cel-go/common/debug/debug.go
generated
vendored
42
vendor/github.com/google/cel-go/common/debug/debug.go
generated
vendored
@ -102,9 +102,9 @@ func (w *debugWriter) Buffer(e *exprpb.Expr) {
|
||||
}
|
||||
|
||||
func (w *debugWriter) appendSelect(sel *exprpb.Expr_Select) {
|
||||
w.Buffer(sel.Operand)
|
||||
w.Buffer(sel.GetOperand())
|
||||
w.append(".")
|
||||
w.append(sel.Field)
|
||||
w.append(sel.GetField())
|
||||
if sel.TestOnly {
|
||||
w.append("~test-only~")
|
||||
}
|
||||
@ -112,15 +112,15 @@ func (w *debugWriter) appendSelect(sel *exprpb.Expr_Select) {
|
||||
|
||||
func (w *debugWriter) appendCall(call *exprpb.Expr_Call) {
|
||||
if call.Target != nil {
|
||||
w.Buffer(call.Target)
|
||||
w.Buffer(call.GetTarget())
|
||||
w.append(".")
|
||||
}
|
||||
w.append(call.Function)
|
||||
w.append(call.GetFunction())
|
||||
w.append("(")
|
||||
if len(call.GetArgs()) > 0 {
|
||||
w.addIndent()
|
||||
w.appendLine()
|
||||
for i, arg := range call.Args {
|
||||
for i, arg := range call.GetArgs() {
|
||||
if i > 0 {
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
@ -138,7 +138,7 @@ func (w *debugWriter) appendList(list *exprpb.Expr_CreateList) {
|
||||
if len(list.GetElements()) > 0 {
|
||||
w.appendLine()
|
||||
w.addIndent()
|
||||
for i, elem := range list.Elements {
|
||||
for i, elem := range list.GetElements() {
|
||||
if i > 0 {
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
@ -160,19 +160,19 @@ func (w *debugWriter) appendStruct(obj *exprpb.Expr_CreateStruct) {
|
||||
}
|
||||
|
||||
func (w *debugWriter) appendObject(obj *exprpb.Expr_CreateStruct) {
|
||||
w.append(obj.MessageName)
|
||||
w.append(obj.GetMessageName())
|
||||
w.append("{")
|
||||
if len(obj.Entries) > 0 {
|
||||
if len(obj.GetEntries()) > 0 {
|
||||
w.appendLine()
|
||||
w.addIndent()
|
||||
for i, entry := range obj.Entries {
|
||||
for i, entry := range obj.GetEntries() {
|
||||
if i > 0 {
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
}
|
||||
w.append(entry.GetFieldKey())
|
||||
w.append(":")
|
||||
w.Buffer(entry.Value)
|
||||
w.Buffer(entry.GetValue())
|
||||
w.adorn(entry)
|
||||
}
|
||||
w.removeIndent()
|
||||
@ -183,17 +183,17 @@ func (w *debugWriter) appendObject(obj *exprpb.Expr_CreateStruct) {
|
||||
|
||||
func (w *debugWriter) appendMap(obj *exprpb.Expr_CreateStruct) {
|
||||
w.append("{")
|
||||
if len(obj.Entries) > 0 {
|
||||
if len(obj.GetEntries()) > 0 {
|
||||
w.appendLine()
|
||||
w.addIndent()
|
||||
for i, entry := range obj.Entries {
|
||||
for i, entry := range obj.GetEntries() {
|
||||
if i > 0 {
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
}
|
||||
w.Buffer(entry.GetMapKey())
|
||||
w.append(":")
|
||||
w.Buffer(entry.Value)
|
||||
w.Buffer(entry.GetValue())
|
||||
w.adorn(entry)
|
||||
}
|
||||
w.removeIndent()
|
||||
@ -208,43 +208,43 @@ func (w *debugWriter) appendComprehension(comprehension *exprpb.Expr_Comprehensi
|
||||
w.appendLine()
|
||||
w.append("// Variable")
|
||||
w.appendLine()
|
||||
w.append(comprehension.IterVar)
|
||||
w.append(comprehension.GetIterVar())
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
w.append("// Target")
|
||||
w.appendLine()
|
||||
w.Buffer(comprehension.IterRange)
|
||||
w.Buffer(comprehension.GetIterRange())
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
w.append("// Accumulator")
|
||||
w.appendLine()
|
||||
w.append(comprehension.AccuVar)
|
||||
w.append(comprehension.GetAccuVar())
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
w.append("// Init")
|
||||
w.appendLine()
|
||||
w.Buffer(comprehension.AccuInit)
|
||||
w.Buffer(comprehension.GetAccuInit())
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
w.append("// LoopCondition")
|
||||
w.appendLine()
|
||||
w.Buffer(comprehension.LoopCondition)
|
||||
w.Buffer(comprehension.GetLoopCondition())
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
w.append("// LoopStep")
|
||||
w.appendLine()
|
||||
w.Buffer(comprehension.LoopStep)
|
||||
w.Buffer(comprehension.GetLoopStep())
|
||||
w.append(",")
|
||||
w.appendLine()
|
||||
w.append("// Result")
|
||||
w.appendLine()
|
||||
w.Buffer(comprehension.Result)
|
||||
w.Buffer(comprehension.GetResult())
|
||||
w.append(")")
|
||||
w.removeIndent()
|
||||
}
|
||||
|
||||
func formatLiteral(c *exprpb.Constant) string {
|
||||
switch c.ConstantKind.(type) {
|
||||
switch c.GetConstantKind().(type) {
|
||||
case *exprpb.Constant_BoolValue:
|
||||
return fmt.Sprintf("%t", c.GetBoolValue())
|
||||
case *exprpb.Constant_BytesValue:
|
||||
|
2
vendor/github.com/google/cel-go/interpreter/interpretable.go
generated
vendored
2
vendor/github.com/google/cel-go/interpreter/interpretable.go
generated
vendored
@ -835,8 +835,10 @@ func (fold *evalFold) Eval(ctx Activation) ref.Val {
|
||||
varActivationPool.Put(accuCtx)
|
||||
// Convert a mutable list to an immutable one, if the comprehension has generated a list as a result.
|
||||
if !types.IsUnknownOrError(res) && buildingList {
|
||||
if _, ok := res.(traits.MutableLister); ok {
|
||||
res = res.(traits.MutableLister).ToImmutableList()
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
|
51
vendor/github.com/google/cel-go/interpreter/planner.go
generated
vendored
51
vendor/github.com/google/cel-go/interpreter/planner.go
generated
vendored
@ -95,7 +95,7 @@ type planner struct {
|
||||
// such as state-tracking, expression re-write, and possibly efficient thread-safe memoization of
|
||||
// repeated expressions.
|
||||
func (p *planner) Plan(expr *exprpb.Expr) (Interpretable, error) {
|
||||
switch expr.ExprKind.(type) {
|
||||
switch expr.GetExprKind().(type) {
|
||||
case *exprpb.Expr_CallExpr:
|
||||
return p.decorate(p.planCall(expr))
|
||||
case *exprpb.Expr_IdentExpr:
|
||||
@ -146,10 +146,10 @@ func (p *planner) planIdent(expr *exprpb.Expr) (Interpretable, error) {
|
||||
|
||||
func (p *planner) planCheckedIdent(id int64, identRef *exprpb.Reference) (Interpretable, error) {
|
||||
// Plan a constant reference if this is the case for this simple identifier.
|
||||
if identRef.Value != nil {
|
||||
if identRef.GetValue() != nil {
|
||||
return p.Plan(&exprpb.Expr{Id: id,
|
||||
ExprKind: &exprpb.Expr_ConstExpr{
|
||||
ConstExpr: identRef.Value,
|
||||
ConstExpr: identRef.GetValue(),
|
||||
}})
|
||||
}
|
||||
|
||||
@ -157,9 +157,9 @@ func (p *planner) planCheckedIdent(id int64, identRef *exprpb.Reference) (Interp
|
||||
// registered with the provider.
|
||||
cType := p.typeMap[id]
|
||||
if cType.GetType() != nil {
|
||||
cVal, found := p.provider.FindIdent(identRef.Name)
|
||||
cVal, found := p.provider.FindIdent(identRef.GetName())
|
||||
if !found {
|
||||
return nil, fmt.Errorf("reference to undefined type: %s", identRef.Name)
|
||||
return nil, fmt.Errorf("reference to undefined type: %s", identRef.GetName())
|
||||
}
|
||||
return NewConstValue(id, cVal), nil
|
||||
}
|
||||
@ -167,11 +167,12 @@ func (p *planner) planCheckedIdent(id int64, identRef *exprpb.Reference) (Interp
|
||||
// Otherwise, return the attribute for the resolved identifier name.
|
||||
return &evalAttr{
|
||||
adapter: p.adapter,
|
||||
attr: p.attrFactory.AbsoluteAttribute(id, identRef.Name),
|
||||
attr: p.attrFactory.AbsoluteAttribute(id, identRef.GetName()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// planSelect creates an Interpretable with either:
|
||||
//
|
||||
// a) selects a field from a map or proto.
|
||||
// b) creates a field presence test for a select within a has() macro.
|
||||
// c) resolves the select expression to a namespaced identifier.
|
||||
@ -193,7 +194,7 @@ func (p *planner) planSelect(expr *exprpb.Expr) (Interpretable, error) {
|
||||
var fieldType *ref.FieldType
|
||||
opType := p.typeMap[sel.GetOperand().GetId()]
|
||||
if opType.GetMessageType() != "" {
|
||||
ft, found := p.provider.FindFieldType(opType.GetMessageType(), sel.Field)
|
||||
ft, found := p.provider.FindFieldType(opType.GetMessageType(), sel.GetField())
|
||||
if found && ft.IsSet != nil && ft.GetFrom != nil {
|
||||
fieldType = ft
|
||||
}
|
||||
@ -213,15 +214,15 @@ func (p *planner) planSelect(expr *exprpb.Expr) (Interpretable, error) {
|
||||
if sel.TestOnly {
|
||||
// Return the test only eval expression.
|
||||
return &evalTestOnly{
|
||||
id: expr.Id,
|
||||
field: types.String(sel.Field),
|
||||
id: expr.GetId(),
|
||||
field: types.String(sel.GetField()),
|
||||
fieldType: fieldType,
|
||||
op: op,
|
||||
}, nil
|
||||
}
|
||||
// Build a qualifier.
|
||||
qual, err := p.attrFactory.NewQualifier(
|
||||
opType, expr.Id, sel.Field)
|
||||
opType, expr.GetId(), sel.GetField())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -329,7 +330,7 @@ func (p *planner) planCallZero(expr *exprpb.Expr,
|
||||
return nil, fmt.Errorf("no such overload: %s()", function)
|
||||
}
|
||||
return &evalZeroArity{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
function: function,
|
||||
overload: overload,
|
||||
impl: impl.Function,
|
||||
@ -354,7 +355,7 @@ func (p *planner) planCallUnary(expr *exprpb.Expr,
|
||||
nonStrict = impl.NonStrict
|
||||
}
|
||||
return &evalUnary{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
function: function,
|
||||
overload: overload,
|
||||
arg: args[0],
|
||||
@ -382,7 +383,7 @@ func (p *planner) planCallBinary(expr *exprpb.Expr,
|
||||
nonStrict = impl.NonStrict
|
||||
}
|
||||
return &evalBinary{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
function: function,
|
||||
overload: overload,
|
||||
lhs: args[0],
|
||||
@ -411,7 +412,7 @@ func (p *planner) planCallVarArgs(expr *exprpb.Expr,
|
||||
nonStrict = impl.NonStrict
|
||||
}
|
||||
return &evalVarArgs{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
function: function,
|
||||
overload: overload,
|
||||
args: args,
|
||||
@ -425,7 +426,7 @@ func (p *planner) planCallVarArgs(expr *exprpb.Expr,
|
||||
func (p *planner) planCallEqual(expr *exprpb.Expr,
|
||||
args []Interpretable) (Interpretable, error) {
|
||||
return &evalEq{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
lhs: args[0],
|
||||
rhs: args[1],
|
||||
}, nil
|
||||
@ -435,7 +436,7 @@ func (p *planner) planCallEqual(expr *exprpb.Expr,
|
||||
func (p *planner) planCallNotEqual(expr *exprpb.Expr,
|
||||
args []Interpretable) (Interpretable, error) {
|
||||
return &evalNe{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
lhs: args[0],
|
||||
rhs: args[1],
|
||||
}, nil
|
||||
@ -445,7 +446,7 @@ func (p *planner) planCallNotEqual(expr *exprpb.Expr,
|
||||
func (p *planner) planCallLogicalAnd(expr *exprpb.Expr,
|
||||
args []Interpretable) (Interpretable, error) {
|
||||
return &evalAnd{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
lhs: args[0],
|
||||
rhs: args[1],
|
||||
}, nil
|
||||
@ -455,7 +456,7 @@ func (p *planner) planCallLogicalAnd(expr *exprpb.Expr,
|
||||
func (p *planner) planCallLogicalOr(expr *exprpb.Expr,
|
||||
args []Interpretable) (Interpretable, error) {
|
||||
return &evalOr{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
lhs: args[0],
|
||||
rhs: args[1],
|
||||
}, nil
|
||||
@ -486,7 +487,7 @@ func (p *planner) planCallConditional(expr *exprpb.Expr,
|
||||
|
||||
return &evalAttr{
|
||||
adapter: p.adapter,
|
||||
attr: p.attrFactory.ConditionalAttribute(expr.Id, cond, tAttr, fAttr),
|
||||
attr: p.attrFactory.ConditionalAttribute(expr.GetId(), cond, tAttr, fAttr),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -541,7 +542,7 @@ func (p *planner) planCreateList(expr *exprpb.Expr) (Interpretable, error) {
|
||||
elems[i] = elemVal
|
||||
}
|
||||
return &evalList{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
elems: elems,
|
||||
adapter: p.adapter,
|
||||
}, nil
|
||||
@ -570,7 +571,7 @@ func (p *planner) planCreateStruct(expr *exprpb.Expr) (Interpretable, error) {
|
||||
vals[i] = valVal
|
||||
}
|
||||
return &evalMap{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
keys: keys,
|
||||
vals: vals,
|
||||
adapter: p.adapter,
|
||||
@ -596,7 +597,7 @@ func (p *planner) planCreateObj(expr *exprpb.Expr) (Interpretable, error) {
|
||||
vals[i] = val
|
||||
}
|
||||
return &evalObj{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
typeName: typeName,
|
||||
fields: fields,
|
||||
vals: vals,
|
||||
@ -628,7 +629,7 @@ func (p *planner) planComprehension(expr *exprpb.Expr) (Interpretable, error) {
|
||||
return nil, err
|
||||
}
|
||||
return &evalFold{
|
||||
id: expr.Id,
|
||||
id: expr.GetId(),
|
||||
accuVar: fold.AccuVar,
|
||||
accu: accu,
|
||||
iterVar: fold.IterVar,
|
||||
@ -646,12 +647,12 @@ func (p *planner) planConst(expr *exprpb.Expr) (Interpretable, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewConstValue(expr.Id, val), nil
|
||||
return NewConstValue(expr.GetId(), val), nil
|
||||
}
|
||||
|
||||
// constValue converts a proto Constant value to a ref.Val.
|
||||
func (p *planner) constValue(c *exprpb.Constant) (ref.Val, error) {
|
||||
switch c.ConstantKind.(type) {
|
||||
switch c.GetConstantKind().(type) {
|
||||
case *exprpb.Constant_BoolValue:
|
||||
return p.adapter.NativeToValue(c.GetBoolValue()), nil
|
||||
case *exprpb.Constant_BytesValue:
|
||||
|
10
vendor/github.com/google/cel-go/interpreter/prune.go
generated
vendored
10
vendor/github.com/google/cel-go/interpreter/prune.go
generated
vendored
@ -41,17 +41,23 @@ type astPruner struct {
|
||||
// A)
|
||||
// 1) Evaluate expr with some unknowns,
|
||||
// 2) If result is unknown:
|
||||
//
|
||||
// a) PruneAst
|
||||
// b) Goto 1
|
||||
//
|
||||
// Functional call results which are known would be effectively cached across
|
||||
// iterations.
|
||||
//
|
||||
// B)
|
||||
// 1) Compile the expression (maybe via a service and maybe after checking a
|
||||
//
|
||||
// compiled expression does not exists in local cache)
|
||||
//
|
||||
// 2) Prepare the environment and the interpreter. Activation might be empty.
|
||||
// 3) Eval the expression. This might return unknown or error or a concrete
|
||||
//
|
||||
// value.
|
||||
//
|
||||
// 4) PruneAst
|
||||
// 4) Maybe cache the expression
|
||||
// This is effectively constant folding the expression. How the environment is
|
||||
@ -232,9 +238,9 @@ func (p *astPruner) prune(node *exprpb.Expr) (*exprpb.Expr, bool) {
|
||||
// transform, or expression was not evaluated. If possible, drill down
|
||||
// more.
|
||||
|
||||
switch node.ExprKind.(type) {
|
||||
switch node.GetExprKind().(type) {
|
||||
case *exprpb.Expr_SelectExpr:
|
||||
if operand, pruned := p.prune(node.GetSelectExpr().Operand); pruned {
|
||||
if operand, pruned := p.prune(node.GetSelectExpr().GetOperand()); pruned {
|
||||
return &exprpb.Expr{
|
||||
Id: node.GetId(),
|
||||
ExprKind: &exprpb.Expr_SelectExpr{
|
||||
|
2
vendor/github.com/google/cel-go/parser/helper.go
generated
vendored
2
vendor/github.com/google/cel-go/parser/helper.go
generated
vendored
@ -217,7 +217,7 @@ func (p *parserHelper) buildMacroCallArg(expr *exprpb.Expr) *exprpb.Expr {
|
||||
return &exprpb.Expr{Id: expr.GetId()}
|
||||
}
|
||||
|
||||
switch expr.ExprKind.(type) {
|
||||
switch expr.GetExprKind().(type) {
|
||||
case *exprpb.Expr_CallExpr:
|
||||
// Iterate the AST from `expr` recursively looking for macros. Because we are at most
|
||||
// starting from the top level macro, this recursion is bounded by the size of the AST. This
|
||||
|
6
vendor/github.com/google/cel-go/parser/parser.go
generated
vendored
6
vendor/github.com/google/cel-go/parser/parser.go
generated
vendored
@ -807,13 +807,13 @@ func (p *parser) extractQualifiedName(e *exprpb.Expr) (string, bool) {
|
||||
if e == nil {
|
||||
return "", false
|
||||
}
|
||||
switch e.ExprKind.(type) {
|
||||
switch e.GetExprKind().(type) {
|
||||
case *exprpb.Expr_IdentExpr:
|
||||
return e.GetIdentExpr().GetName(), true
|
||||
case *exprpb.Expr_SelectExpr:
|
||||
s := e.GetSelectExpr()
|
||||
if prefix, found := p.extractQualifiedName(s.Operand); found {
|
||||
return prefix + "." + s.Field, true
|
||||
if prefix, found := p.extractQualifiedName(s.GetOperand()); found {
|
||||
return prefix + "." + s.GetField(), true
|
||||
}
|
||||
}
|
||||
// TODO: Add a method to Source to get location from character offset.
|
||||
|
4
vendor/github.com/google/cel-go/parser/unparser.go
generated
vendored
4
vendor/github.com/google/cel-go/parser/unparser.go
generated
vendored
@ -81,7 +81,7 @@ func (un *unparser) visit(expr *exprpb.Expr) error {
|
||||
if visited || err != nil {
|
||||
return err
|
||||
}
|
||||
switch expr.ExprKind.(type) {
|
||||
switch expr.GetExprKind().(type) {
|
||||
case *exprpb.Expr_CallExpr:
|
||||
return un.visitCall(expr)
|
||||
case *exprpb.Expr_ConstExpr:
|
||||
@ -249,7 +249,7 @@ func (un *unparser) visitCallUnary(expr *exprpb.Expr) error {
|
||||
|
||||
func (un *unparser) visitConst(expr *exprpb.Expr) error {
|
||||
c := expr.GetConstExpr()
|
||||
switch c.ConstantKind.(type) {
|
||||
switch c.GetConstantKind().(type) {
|
||||
case *exprpb.Constant_BoolValue:
|
||||
un.str.WriteString(strconv.FormatBool(c.GetBoolValue()))
|
||||
case *exprpb.Constant_BytesValue:
|
||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -411,7 +411,7 @@ github.com/google/cadvisor/utils/sysfs
|
||||
github.com/google/cadvisor/utils/sysinfo
|
||||
github.com/google/cadvisor/version
|
||||
github.com/google/cadvisor/watcher
|
||||
# github.com/google/cel-go v0.12.4 => github.com/google/cel-go v0.12.4
|
||||
# github.com/google/cel-go v0.12.5 => github.com/google/cel-go v0.12.5
|
||||
## explicit; go 1.17
|
||||
github.com/google/cel-go/cel
|
||||
github.com/google/cel-go/checker
|
||||
@ -2686,7 +2686,7 @@ sigs.k8s.io/yaml
|
||||
# github.com/golangplus/testing => github.com/golangplus/testing v1.0.0
|
||||
# github.com/google/btree => github.com/google/btree v1.0.1
|
||||
# github.com/google/cadvisor => github.com/google/cadvisor v0.45.0
|
||||
# github.com/google/cel-go => github.com/google/cel-go v0.12.4
|
||||
# github.com/google/cel-go => github.com/google/cel-go v0.12.5
|
||||
# github.com/google/gnostic => github.com/google/gnostic v0.5.7-v3refs
|
||||
# github.com/google/go-cmp => github.com/google/go-cmp v0.5.6
|
||||
# github.com/google/gofuzz => github.com/google/gofuzz v1.1.0
|
||||
|
Loading…
Reference in New Issue
Block a user