File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ std::optional<std::string> Pos::getSource() const
6666 }, origin);
6767}
6868
69+ std::optional<SourcePath> Pos::getSourcePath () const
70+ {
71+ if (auto * path = std::get_if<SourcePath>(&origin))
72+ return *path;
73+ return std::nullopt ;
74+ }
75+
6976void Pos::print (std::ostream & out, bool showOrigin) const
7077{
7178 if (showOrigin) {
Original file line number Diff line number Diff line change @@ -70,9 +70,7 @@ struct Pos
7070 /* *
7171 * Get the SourcePath, if the source was loaded from a file.
7272 */
73- std::optional<SourcePath> getSourcePath () const {
74- return *std::get_if<SourcePath>(&origin);
75- }
73+ std::optional<SourcePath> getSourcePath () const ;
7674
7775 struct LinesIterator {
7876 using difference_type = size_t ;
You can’t perform that action at this time.
0 commit comments