mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-13 19:37:43 +00:00
Update cel-go to v0.21.0
This commit is contained in:
45
vendor/github.com/google/cel-go/common/ast/ast.go
generated
vendored
45
vendor/github.com/google/cel-go/common/ast/ast.go
generated
vendored
@@ -310,21 +310,18 @@ func (s *SourceInfo) SetOffsetRange(id int64, o OffsetRange) {
|
||||
s.offsetRanges[id] = o
|
||||
}
|
||||
|
||||
// ClearOffsetRange removes the OffsetRange for the given expression id.
|
||||
func (s *SourceInfo) ClearOffsetRange(id int64) {
|
||||
if s != nil {
|
||||
delete(s.offsetRanges, id)
|
||||
}
|
||||
}
|
||||
|
||||
// GetStartLocation calculates the human-readable 1-based line and 0-based column of the first character
|
||||
// of the expression node at the id.
|
||||
func (s *SourceInfo) GetStartLocation(id int64) common.Location {
|
||||
if o, found := s.GetOffsetRange(id); found {
|
||||
line := 1
|
||||
col := int(o.Start)
|
||||
for _, lineOffset := range s.LineOffsets() {
|
||||
if lineOffset < o.Start {
|
||||
line++
|
||||
col = int(o.Start - lineOffset)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return common.NewLocation(line, col)
|
||||
return s.GetLocationByOffset(o.Start)
|
||||
}
|
||||
return common.NoLocation
|
||||
}
|
||||
@@ -336,21 +333,25 @@ func (s *SourceInfo) GetStartLocation(id int64) common.Location {
|
||||
// be identical to the start location for the expression.
|
||||
func (s *SourceInfo) GetStopLocation(id int64) common.Location {
|
||||
if o, found := s.GetOffsetRange(id); found {
|
||||
line := 1
|
||||
col := int(o.Stop)
|
||||
for _, lineOffset := range s.LineOffsets() {
|
||||
if lineOffset < o.Stop {
|
||||
line++
|
||||
col = int(o.Stop - lineOffset)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return common.NewLocation(line, col)
|
||||
return s.GetLocationByOffset(o.Stop)
|
||||
}
|
||||
return common.NoLocation
|
||||
}
|
||||
|
||||
// GetLocationByOffset returns the line and column information for a given character offset.
|
||||
func (s *SourceInfo) GetLocationByOffset(offset int32) common.Location {
|
||||
line := 1
|
||||
col := int(offset)
|
||||
for _, lineOffset := range s.LineOffsets() {
|
||||
if lineOffset > offset {
|
||||
break
|
||||
}
|
||||
line++
|
||||
col = int(offset - lineOffset)
|
||||
}
|
||||
return common.NewLocation(line, col)
|
||||
}
|
||||
|
||||
// ComputeOffset calculates the 0-based character offset from a 1-based line and 0-based column.
|
||||
func (s *SourceInfo) ComputeOffset(line, col int32) int32 {
|
||||
if s != nil {
|
||||
|
||||
Reference in New Issue
Block a user