diff options
Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r-- | src/libexpr/nixexpr.cc | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 03b849a38..3dfbddf5b 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -55,8 +55,8 @@ void ExprAttrs::show(std::ostream & str) { if (recursive) str << "rec "; str << "{ "; - foreach (list<Symbol>::iterator, i, inherited) - str << "inherit " << *i << "; "; + foreach (list<VarRef>::iterator, i, inherited) + str << "inherit " << i->name << "; "; foreach (Attrs::iterator, i, attrs) str << i->first << " = " << *i->second << "; "; str << "}"; @@ -91,8 +91,8 @@ void ExprLambda::show(std::ostream & str) void ExprLet::show(std::ostream & str) { str << "let "; - foreach (list<Symbol>::iterator, i, attrs->inherited) - str << "inherit " << *i << "; "; + foreach (list<VarRef>::iterator, i, attrs->inherited) + str << "inherit " << i->name << "; "; foreach (ExprAttrs::Attrs::iterator, i, attrs->attrs) str << i->first << " = " << *i->second << "; "; str << "in " << *body; @@ -212,16 +212,22 @@ void ExprAttrs::bindVars(const StaticEnv & env) foreach (ExprAttrs::Attrs::iterator, i, attrs) newEnv.vars[i->first] = displ++; - foreach (list<Symbol>::iterator, i, inherited) - newEnv.vars[*i] = displ++; + foreach (list<VarRef>::iterator, i, inherited) { + newEnv.vars[i->name] = displ++; + i->bind(env); + } foreach (ExprAttrs::Attrs::iterator, i, attrs) i->second->bindVars(newEnv); } - else + else { foreach (ExprAttrs::Attrs::iterator, i, attrs) i->second->bindVars(env); + + foreach (list<VarRef>::iterator, i, inherited) + i->bind(env); + } } void ExprList::bindVars(const StaticEnv & env) @@ -258,8 +264,10 @@ void ExprLet::bindVars(const StaticEnv & env) foreach (ExprAttrs::Attrs::iterator, i, attrs->attrs) newEnv.vars[i->first] = displ++; - foreach (list<Symbol>::iterator, i, attrs->inherited) - newEnv.vars[*i] = displ++; + foreach (list<VarRef>::iterator, i, attrs->inherited) { + newEnv.vars[i->name] = displ++; + i->bind(env); + } foreach (ExprAttrs::Attrs::iterator, i, attrs->attrs) i->second->bindVars(newEnv); |