aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/attr-path.cc1
-rw-r--r--src/libexpr/common-opts.cc1
-rw-r--r--src/libexpr/eval.cc1
-rw-r--r--src/libexpr/eval.hh3
-rw-r--r--src/libexpr/expr-to-xml.hh1
-rw-r--r--src/libexpr/get-drvs.cc1
-rw-r--r--src/libexpr/parser.y8
-rw-r--r--src/libexpr/primops.cc1
8 files changed, 14 insertions, 3 deletions
diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc
index e8e4c050c..092d9b1c2 100644
--- a/src/libexpr/attr-path.cc
+++ b/src/libexpr/attr-path.cc
@@ -1,6 +1,7 @@
#include "attr-path.hh"
#include "nixexpr-ast.hh"
#include "util.hh"
+#include "aterm.hh"
namespace nix {
diff --git a/src/libexpr/common-opts.cc b/src/libexpr/common-opts.cc
index 9e3f8f961..0ef488373 100644
--- a/src/libexpr/common-opts.cc
+++ b/src/libexpr/common-opts.cc
@@ -2,6 +2,7 @@
#include "../libmain/shared.hh"
#include "util.hh"
#include "parser.hh"
+#include "aterm.hh"
namespace nix {
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index cd9c64594..5a0e8bc27 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -6,6 +6,7 @@
#include "derivations.hh"
#include "nixexpr-ast.hh"
#include "globals.hh"
+#include "aterm.hh"
#define LocalNoInline(f) static f __attribute__((noinline)); f
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index fed6d3472..00d0e3564 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -3,9 +3,10 @@
#include <map>
-#include "aterm.hh"
#include "nixexpr.hh"
+typedef union _ATermList * ATermList;
+
namespace nix {
diff --git a/src/libexpr/expr-to-xml.hh b/src/libexpr/expr-to-xml.hh
index 36b8e4042..576a46fc3 100644
--- a/src/libexpr/expr-to-xml.hh
+++ b/src/libexpr/expr-to-xml.hh
@@ -5,7 +5,6 @@
#include <map>
#include "nixexpr.hh"
-#include "aterm.hh"
namespace nix {
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index 1442d7988..cd5a85e5b 100644
--- a/src/libexpr/get-drvs.cc
+++ b/src/libexpr/get-drvs.cc
@@ -1,6 +1,7 @@
#include "get-drvs.hh"
#include "nixexpr-ast.hh"
#include "util.hh"
+#include "aterm.hh"
namespace nix {
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index c4afb72ea..8706ce025 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -85,6 +85,10 @@ static Expr fixAttrs(bool recursive, ATermList as)
{
Tree attrs;
+ /* This ATermMap is needed to ensure that the `leaf' fields in the
+ Tree nodes are not garbage collected. */
+ ATermMap gcRoots;
+
for (ATermIterator i(as); i; ++i) {
ATermList names, attrPath; Expr src, e; ATerm name, pos;
@@ -95,7 +99,9 @@ static Expr fixAttrs(bool recursive, ATermList as)
throw ParseError(format("duplicate definition of attribute `%1%' at %2%")
% showAttrPath(ATmakeList1(*j)) % showPos(pos));
Tree & t(attrs.children[*j]);
- t.leaf = fromScope ? makeVar(*j) : makeSelect(src, *j);
+ Expr leaf = fromScope ? makeVar(*j) : makeSelect(src, *j);
+ gcRoots.set(leaf, leaf);
+ t.leaf = leaf;
t.pos = pos;
if (recursive && fromScope) t.recursive = false;
}
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 7dddc91a8..bf2752d0d 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -8,6 +8,7 @@
#include "nixexpr-ast.hh"
#include "parser.hh"
#include "names.hh"
+#include "aterm.hh"
#include <sys/types.h>
#include <sys/stat.h>