MCPcopy Create free account
hub / github.com/cel-expr/cel-go / GetStopLocation

Method GetStopLocation

common/ast/ast.go:389–394  ·  view source on GitHub ↗

GetStopLocation calculates the human-readable 1-based line and 0-based column of the last character for the expression node at the given id. If the SourceInfo was generated from a serialized protobuf representation, the stop location will be identical to the start location for the expression.

(id int64)

Source from the content-addressed store, hash-verified

387// If the SourceInfo was generated from a serialized protobuf representation, the stop location will
388// be identical to the start location for the expression.
389func (s *SourceInfo) GetStopLocation(id int64) common.Location {
390 if o, found := s.GetOffsetRange(id); found {
391 return s.GetLocationByOffset(o.Stop)
392 }
393 return common.NoLocation
394}
395
396// GetLocationByOffset returns the line and column information for a given character offset.
397func (s *SourceInfo) GetLocationByOffset(offset int32) common.Location {

Callers 2

TestSourceInfoFunction · 0.95
TestSourceInfoNilSafetyFunction · 0.80

Calls 2

GetOffsetRangeMethod · 0.95
GetLocationByOffsetMethod · 0.95

Tested by 2

TestSourceInfoFunction · 0.76
TestSourceInfoNilSafetyFunction · 0.64