about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/eval.hh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libexpr/eval.hh')
-rw-r--r--third_party/nix/src/libexpr/eval.hh12
1 files changed, 10 insertions, 2 deletions
diff --git a/third_party/nix/src/libexpr/eval.hh b/third_party/nix/src/libexpr/eval.hh
index 11cc295b230d..3da0961b6f4a 100644
--- a/third_party/nix/src/libexpr/eval.hh
+++ b/third_party/nix/src/libexpr/eval.hh
@@ -3,6 +3,10 @@
 #include <map>
 #include <optional>
 #include <unordered_map>
+#include <vector>
+
+#include <gc/gc_allocator.h>
+#include <gc/gc_cpp.h>
 
 #include "libexpr/attr-set.hh"
 #include "libexpr/nixexpr.hh"
@@ -28,12 +32,16 @@ struct PrimOp {
       : fun(fun), arity(arity), name(name) {}
 };
 
-struct Env {
+struct Env : public gc {
+  Env(unsigned short size) : size(size) {
+    values = std::vector<Value*, traceable_allocator<Value*>>(size);
+  }
+
   Env* up;
   unsigned short size;           // used by ‘valueSize’
   unsigned short prevWith : 14;  // nr of levels up to next `with' environment
   enum { Plain = 0, HasWithExpr, HasWithAttrs } type : 2;
-  Value* values[0];
+  std::vector<Value*, traceable_allocator<Value*>> values;
 };
 
 Value& mkString(Value& v, const std::string& s,