diff options
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r-- | src/libexpr/nixexpr.hh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index f5cc69801e42..2178c016ec11 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -23,14 +23,16 @@ MakeError(UndefinedVarError, Error) struct Pos { - string file; + Symbol file; unsigned int line, column; Pos() : line(0), column(0) { }; - Pos(const string & file, unsigned int line, unsigned int column) + Pos(const Symbol & file, unsigned int line, unsigned int column) : file(file), line(line), column(column) { }; bool operator < (const Pos & p2) const { - int d = file.compare(p2.file); + if (!line) return p2.line; + if (!p2.line) return false; + int d = ((string) file).compare((string) p2.file); if (d < 0) return true; if (d > 0) return false; if (line < p2.line) return true; |