mirror of
https://github.com/NixOS/nix
synced 2025-06-27 12:41:15 +02:00
getSnippetUpTo: Return optional
This makes it possible to certain discern failures from empty snippets, which I think is an ok review comment. Maybe it should do so for swapped column indexes too, but I'm not sure. I don't think it matters in the grand scheme. We don't even have a real use case for `nullopt` now anyway. Since we don't have a use case, I'm not applying this logic to higher level functions yet.
This commit is contained in:
parent
03d33703ef
commit
61a4d3d45c
4 changed files with 10 additions and 8 deletions
|
@ -64,7 +64,7 @@ struct Pos
|
|||
bool operator==(const Pos & rhs) const = default;
|
||||
auto operator<=>(const Pos & rhs) const = default;
|
||||
|
||||
std::string getSnippetUpTo(const Pos & end) const;
|
||||
std::optional<std::string> getSnippetUpTo(const Pos & end) const;
|
||||
|
||||
/**
|
||||
* Get the SourcePath, if the source was loaded from a file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue