From 01e58adce0767f1a484d80fcbcf67c7945cbc146 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 7 May 2010 12:43:57 +0000 Subject: * Store position info for inherited attributes. --- src/libexpr/eval.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/libexpr/eval.cc') diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index b8ec410f3993..69632eb37ef1 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::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::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::iterator, i, inherited) { - Value & v2 = (*v.attrs)[i->name].value; - mkCopy(v2, *state.lookupVar(&env, *i)); + foreach (list::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::iterator, i, attrs->inherited) - mkCopy(env2.values[displ++], *state.lookupVar(&env, *i)); + foreach (list::iterator, i, attrs->inherited) + mkCopy(env2.values[displ++], *state.lookupVar(&env, i->first)); state.eval(env2, body, v); } -- cgit 1.4.1