diff options
author | Ben Burdette <bburdette@gmail.com> | 2021-10-22 14:49:58 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2021-10-22 14:49:58 -0600 |
commit | fb8377547bcb6d4dc6464ca34c0fe433e1cfda44 (patch) | |
tree | 24dd0fb08285536b55b23abba5b60736dcbf404b /src/libexpr/eval.cc | |
parent | 71da988d47433543e70cd52dbdd6c907dd3cabda (diff) |
more code cleanup
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 719dcc1b4..4dde92c0a 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -912,6 +912,9 @@ Env & EvalState::allocEnv(size_t size) nrValuesInEnvs += size; Env * env = (Env *) allocBytes(sizeof(Env) + size * sizeof(Value *)); env->type = Env::Plain; + + /* We assume that env->values has been cleared by the allocator; maybeThunk() and lookupVar fromWith expect this. */ + return *env; } @@ -925,7 +928,6 @@ Env & fakeEnv(size_t size) return *env; } - void EvalState::mkList(Value & v, size_t size) { v.mkList(size); @@ -1291,7 +1293,6 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v) state.forceAttrs(*vAttrs, pos); if ((j = vAttrs->attrs->find(name)) == vAttrs->attrs->end()) throwEvalError(pos, "attribute '%1%' missing", name, env, this); - // mapBindings(*vAttrs->attrs)); } vAttrs = j->value; pos2 = j->pos; @@ -1419,8 +1420,6 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & po "attempt to call something which is not a function but %1%", showType(fun).c_str(), fakeEnv(1), 0); - // fun.env); - // map2("fun", &fun, "arg", &arg)); } ExprLambda & lambda(*fun.lambda.fun); |