about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-04T20·52+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-04T20·52+0200
commit8e5fbf4d730b9fcf39eddf5539a206cf19d2cdce (patch)
tree281d7553329e1f7431cc667be20ca60f4558acb3 /src/libexpr/eval.cc
parent4c5faad99408cdfc35a8b0923d1efdf288fd9990 (diff)
Show position info in attribute selection errors
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 44d75bd8c03b..0f7e8e385a2b 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -736,7 +736,7 @@ unsigned long nrLookups = 0;
 void ExprSelect::eval(EvalState & state, Env & env, Value & v)
 {
     Value vTmp;
-    Pos * pos = 0;
+    Pos * pos2 = 0;
     Value * vAttrs = &vTmp;
 
     e->eval(state, env, vTmp);
@@ -756,21 +756,21 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
                     return;
                 }
             } else {
-                state.forceAttrs(*vAttrs);
+                state.forceAttrs(*vAttrs, pos);
                 if ((j = vAttrs->attrs->find(name)) == vAttrs->attrs->end())
-                    throwEvalError("attribute `%1%' missing", showAttrPath(attrPath));
+                    throwEvalError("attribute `%1%' missing, at %2%", showAttrPath(attrPath), pos);
             }
             vAttrs = j->value;
-            pos = j->pos;
-            if (state.countCalls && pos) state.attrSelects[*pos]++;
+            pos2 = j->pos;
+            if (state.countCalls && pos2) state.attrSelects[*pos2]++;
         }
 
         state.forceValue(*vAttrs);
 
     } catch (Error & e) {
-        if (pos && pos->file != state.sDerivationNix)
+        if (pos2 && pos2->file != state.sDerivationNix)
             addErrorPrefix(e, "while evaluating the attribute `%1%' at %2%:\n",
-                showAttrPath(attrPath), *pos);
+                showAttrPath(attrPath), *pos2);
         throw;
     }