mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Bump cel-go to v0.10.0
This commit is contained in:
		
							
								
								
									
										31
									
								
								vendor/github.com/google/cel-go/interpreter/attribute_patterns.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								vendor/github.com/google/cel-go/interpreter/attribute_patterns.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -157,14 +157,23 @@ func (q *stringQualifier) QualifierValueEquals(value interface{}) bool {
 | 
			
		||||
 | 
			
		||||
// QualifierValueEquals implementation for int qualifiers.
 | 
			
		||||
func (q *intQualifier) QualifierValueEquals(value interface{}) bool {
 | 
			
		||||
	ival, ok := value.(int64)
 | 
			
		||||
	return ok && q.value == ival
 | 
			
		||||
	return numericValueEquals(value, q.celValue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// QualifierValueEquals implementation for uint qualifiers.
 | 
			
		||||
func (q *uintQualifier) QualifierValueEquals(value interface{}) bool {
 | 
			
		||||
	uval, ok := value.(uint64)
 | 
			
		||||
	return ok && q.value == uval
 | 
			
		||||
	return numericValueEquals(value, q.celValue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// QualifierValueEquals implementation for double qualifiers.
 | 
			
		||||
func (q *doubleQualifier) QualifierValueEquals(value interface{}) bool {
 | 
			
		||||
	return numericValueEquals(value, q.celValue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// numericValueEquals uses CEL equality to determine whether two number values are
 | 
			
		||||
func numericValueEquals(value interface{}, celValue ref.Val) bool {
 | 
			
		||||
	val := types.DefaultTypeAdapter.NativeToValue(value)
 | 
			
		||||
	return celValue.Equal(val) == types.True
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewPartialAttributeFactory returns an AttributeFactory implementation capable of performing
 | 
			
		||||
@@ -348,7 +357,8 @@ func (m *attributeMatcher) Resolve(vars Activation) (interface{}, error) {
 | 
			
		||||
// the standard Resolve logic applies.
 | 
			
		||||
func (m *attributeMatcher) TryResolve(vars Activation) (interface{}, bool, error) {
 | 
			
		||||
	id := m.NamespacedAttribute.ID()
 | 
			
		||||
	partial, isPartial := vars.(PartialActivation)
 | 
			
		||||
	// Bug in how partial activation is resolved, should search parents as well.
 | 
			
		||||
	partial, isPartial := toPartialActivation(vars)
 | 
			
		||||
	if isPartial {
 | 
			
		||||
		unk, err := m.fac.matchesUnknownPatterns(
 | 
			
		||||
			partial,
 | 
			
		||||
@@ -381,3 +391,14 @@ func (m *attributeMatcher) Qualify(vars Activation, obj interface{}) (interface{
 | 
			
		||||
	}
 | 
			
		||||
	return qual.Qualify(vars, obj)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func toPartialActivation(vars Activation) (PartialActivation, bool) {
 | 
			
		||||
	pv, ok := vars.(PartialActivation)
 | 
			
		||||
	if ok {
 | 
			
		||||
		return pv, true
 | 
			
		||||
	}
 | 
			
		||||
	if vars.Parent() != nil {
 | 
			
		||||
		return toPartialActivation(vars.Parent())
 | 
			
		||||
	}
 | 
			
		||||
	return nil, false
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user