findLineOffset returns the offset where the (1-indexed) line begins, or false if line doesn't exist.
(line int)
| 167 | // findLineOffset returns the offset where the (1-indexed) line begins, |
| 168 | // or false if line doesn't exist. |
| 169 | func (s *sourceImpl) findLineOffset(line int) (int32, bool) { |
| 170 | if line == 1 { |
| 171 | return 0, true |
| 172 | } |
| 173 | if line > 1 && line <= int(len(s.lineOffsets)) { |
| 174 | offset := s.lineOffsets[line-2] |
| 175 | return offset, true |
| 176 | } |
| 177 | return -1, false |
| 178 | } |
| 179 | |
| 180 | // findLine finds the line that contains the given character offset and |
| 181 | // returns the line number and offset of the beginning of that line. |
no outgoing calls
no test coverage detected