aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r--src/libexpr/nixexpr.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 531d5027c..525b2440b 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -68,10 +68,8 @@ void ExprOpHasAttr::show(const SymbolTable & symbols, std::ostream & str) const
str << ") ? " << showAttrPath(symbols, attrPath) << ")";
}
-void ExprAttrs::show(const SymbolTable & symbols, std::ostream & str) const
+void ExprAttrs::showBindings(const SymbolTable & symbols, std::ostream & str) const
{
- if (recursive) str << "rec ";
- str << "{ ";
typedef const decltype(attrs)::value_type * Attr;
std::vector<Attr> sorted;
for (auto & i : attrs) sorted.push_back(&i);
@@ -95,6 +93,13 @@ void ExprAttrs::show(const SymbolTable & symbols, std::ostream & str) const
i.valueExpr->show(symbols, str);
str << "; ";
}
+}
+
+void ExprAttrs::show(const SymbolTable & symbols, std::ostream & str) const
+{
+ if (recursive) str << "rec ";
+ str << "{ ";
+ showBindings(symbols, str);
str << "}";
}
@@ -150,15 +155,7 @@ void ExprCall::show(const SymbolTable & symbols, std::ostream & str) const
void ExprLet::show(const SymbolTable & symbols, std::ostream & str) const
{
str << "(let ";
- for (auto & i : attrs->attrs)
- if (i.second.inherited()) {
- str << "inherit " << symbols[i.first] << "; ";
- }
- else {
- str << symbols[i.first] << " = ";
- i.second.e->show(symbols, str);
- str << "; ";
- }
+ attrs->showBindings(symbols, str);
str << "in ";
body->show(symbols, str);
str << ")";