From 7d47498b5ea1ad4685bad954e5407f628f7f5595 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Apr 2010 13:42:25 +0000 Subject: * Evaluate lets directly (i.e. without desugaring to `rec { attrs...; = e; }.). This prevents the unnecessary allocation of an attribute set. --- src/libexpr/nixexpr.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libexpr/nixexpr.cc') diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 922066c234a4..0abc2a457304 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -87,6 +87,16 @@ void ExprLambda::show(std::ostream & str) str << ": " << *body << ")"; } +void ExprLet::show(std::ostream & str) +{ + str << "let "; + foreach (list::iterator, i, attrs->inherited) + str << "inherit " << *i << "; "; + foreach (ExprAttrs::Attrs::iterator, i, attrs->attrs) + str << i->first << " = " << *i->second << "; "; + str << "in " << *body; +} + void ExprWith::show(std::ostream & str) { str << "with " << *attrs << "; " << *body; -- cgit 1.4.1