| 487 | } |
| 488 | |
| 489 | absl::optional<SourcePosition> Source::GetPosition( |
| 490 | const SourceLocation& location) const { |
| 491 | if (ABSL_PREDICT_FALSE(location.line < 1 || location.column < 0)) { |
| 492 | return absl::nullopt; |
| 493 | } |
| 494 | if (auto position = FindLinePosition(location.line); |
| 495 | ABSL_PREDICT_TRUE(position.has_value())) { |
| 496 | return *position + location.column; |
| 497 | } |
| 498 | return absl::nullopt; |
| 499 | } |
| 500 | |
| 501 | absl::optional<std::string> Source::Snippet(int32_t line) const { |
| 502 | auto content = this->content(); |