about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.cc1
-rw-r--r--src/libexpr/nixexpr.hh8
-rw-r--r--src/libexpr/parser.y4
3 files changed, 7 insertions, 6 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index b54f32faf5b9..df129eda66b7 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -636,7 +636,6 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
             if (state.countCalls && pos) state.attrSelects[*pos]++;
         }
 
-
         state.forceValue(*vAttrs);
 
     } catch (Error & e) {
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;
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 6a282e90546f..dab71546f108 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -29,7 +29,7 @@ namespace nix {
         SymbolTable & symbols;
         Expr * result;
         Path basePath;
-        Path path;
+        Symbol path;
         string error;
         Symbol sLetBody;
         ParseData(EvalState & state)
@@ -486,7 +486,7 @@ Expr * EvalState::parse(const char * text,
     yyscan_t scanner;
     ParseData data(*this);
     data.basePath = basePath;
-    data.path = path;
+    data.path = data.symbols.create(path);
 
     yylex_init(&scanner);
     yy_scan_string(text, scanner);