aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-18 21:09:39 +0100
committereldritch horrors <pennae@lix.systems>2024-03-18 14:15:22 -0700
commitafb839a0c9888bc8b98c0dd4abd28c79d754c250 (patch)
tree524b05762d4820b338bde66b4fd5fa03b6bfc083 /src/libexpr
parentb3599166ad98c3cad304183bd7cc7bc280522e71 (diff)
libexpr: associate let exprs with the correct StaticEnv
static env association is from expr to its enclosing scope, but let exprs set their association to their *inner* scope. this skips one level of envs and will cause segfaults if the parent is a with expr. fixes #145 Change-Id: I1d22146110f071ede21b4eed7ed34b5850ef2ef3
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/nixexpr.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index a9989b59e..e0f4def4c 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -483,7 +483,7 @@ void ExprLet::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> &
i.second.e->bindVars(es, i.second.chooseByKind(newEnv, env, inheritFromEnv));
if (es.debugRepl)
- es.exprEnvs.insert(std::make_pair(this, newEnv));
+ es.exprEnvs.insert(std::make_pair(this, env));
body->bindVars(es, newEnv);
}