about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-05-07T12·43+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-05-07T12·43+0000
commit01e58adce0767f1a484d80fcbcf67c7945cbc146 (patch)
treee4d644b176cc3d73ccdb6dc6b1eb671721fff02b /src/libexpr/eval.cc
parent83d7b89660ebb942ad844b9be260492b2ea9fb24 (diff)
* Store position info for inherited attributes.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index b8ec410f39..69632eb37e 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -430,11 +430,12 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v)
 
         /* The inherited attributes, on the other hand, are
            evaluated in the original environment. */
-        foreach (list<VarRef>::iterator, i, inherited) {
-            Value & v2 = (*v.attrs)[i->name].value;
-            Value * v3 = state.lookupVar(&env, *i);
-            mkCopy(v2, *v3);
-            mkCopy(env2.values[displ++], *v3);
+        foreach (list<Inherited>::iterator, i, inherited) {
+            nix::Attr & a = (*v.attrs)[i->first.name];
+            Value * v2 = state.lookupVar(&env, i->first);
+            mkCopy(a.value, *v2);
+            mkCopy(env2.values[displ++], *v2);
+            a.pos = &i->second;
         }
 
     }
@@ -446,9 +447,10 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v)
             a.pos = &i->second.second;
         }
 
-        foreach (list<VarRef>::iterator, i, inherited) {
-            Value & v2 = (*v.attrs)[i->name].value;
-            mkCopy(v2, *state.lookupVar(&env, *i));
+        foreach (list<Inherited>::iterator, i, inherited) {
+            nix::Attr & a = (*v.attrs)[i->first.name];
+            mkCopy(a.value, *state.lookupVar(&env, i->first));
+            a.pos = &i->second;
         }
     }
 }
@@ -470,8 +472,8 @@ void ExprLet::eval(EvalState & state, Env & env, Value & v)
 
     /* The inherited attributes, on the other hand, are evaluated in
        the original environment. */
-    foreach (list<VarRef>::iterator, i, attrs->inherited)
-        mkCopy(env2.values[displ++], *state.lookupVar(&env, *i));
+    foreach (list<ExprAttrs::Inherited>::iterator, i, attrs->inherited)
+        mkCopy(env2.values[displ++], *state.lookupVar(&env, i->first));
 
     state.eval(env2, body, v);
 }