| 553 | } |
| 554 | |
| 555 | absl::optional<SourcePosition> Source::FindLinePosition(int32_t line) const { |
| 556 | if (ABSL_PREDICT_FALSE(line < 1)) { |
| 557 | return absl::nullopt; |
| 558 | } |
| 559 | if (line == 1) { |
| 560 | return SourcePosition{0}; |
| 561 | } |
| 562 | const auto line_offsets = this->line_offsets(); |
| 563 | if (ABSL_PREDICT_TRUE(line <= static_cast<int32_t>(line_offsets.size()))) { |
| 564 | return line_offsets[static_cast<size_t>(line - 2)]; |
| 565 | } |
| 566 | return absl::nullopt; |
| 567 | } |
| 568 | |
| 569 | absl::optional<std::pair<int32_t, SourcePosition>> Source::FindLine( |
| 570 | SourcePosition position) const { |
nothing calls this directly
no test coverage detected