diff options
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r-- | src/libexpr/nixexpr.hh | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index b38f19b41..6f2a4c0f9 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -8,6 +8,7 @@ #include "symbol-table.hh" #include "error.hh" #include "chunked-vector.hh" +#include "position.hh" namespace nix { @@ -29,27 +30,6 @@ public: using EvalError::EvalError; }; -/** - * Position objects. - */ -struct Pos -{ - uint32_t line; - uint32_t column; - - struct none_tag { }; - struct Stdin { ref<std::string> source; }; - struct String { ref<std::string> source; }; - - typedef std::variant<none_tag, Stdin, String, SourcePath> Origin; - - Origin origin; - - explicit operator bool() const { return line > 0; } - - operator std::shared_ptr<AbstractPos>() const; -}; - class PosIdx { friend class PosTable; @@ -82,7 +62,7 @@ public: mutable uint32_t idx = std::numeric_limits<uint32_t>::max(); // Used for searching in PosTable::[]. - explicit Origin(uint32_t idx): idx(idx), origin{Pos::none_tag()} {} + explicit Origin(uint32_t idx): idx(idx), origin{std::monostate()} {} public: const Pos::Origin origin; @@ -133,8 +113,6 @@ public: inline PosIdx noPos = {}; -std::ostream & operator << (std::ostream & str, const Pos & pos); - struct Env; struct Value; |