diff --git a/lix/libcmd/common-eval-args.cc b/lix/libcmd/common-eval-args.cc index 232f9a8e2..4cf6b43af 100644 --- a/lix/libcmd/common-eval-args.cc +++ b/lix/libcmd/common-eval-args.cc @@ -177,7 +177,9 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state) for (auto & i : autoArgs) { auto v = state.mem.allocValue(); if (i.second[0] == 'E') - state.mkThunk_(*v, state.parseExprFromString(i.second.substr(1), CanonPath::fromCwd())); + state.evalLazily( + state.parseExprFromString(i.second.substr(1), CanonPath::fromCwd()), *v + ); else v->mkString(((std::string_view) i.second).substr(1)); res.insert(state.symbols.create(i.first), v); diff --git a/lix/libexpr/eval.cc b/lix/libexpr/eval.cc index 5f795fc30..c989dd0fb 100644 --- a/lix/libexpr/eval.cc +++ b/lix/libexpr/eval.cc @@ -788,9 +788,9 @@ static inline void mkThunk(Value & v, Env & env, Expr & expr) } -void EvalState::mkThunk_(Value & v, Expr & expr) +void EvalState::evalLazily(Expr & e, Value & v) { - mkThunk(v, builtins.env, expr); + mkThunk(v, builtins.env, e); } diff --git a/lix/libexpr/eval.hh b/lix/libexpr/eval.hh index a5e776fa3..d42e3ff87 100644 --- a/lix/libexpr/eval.hh +++ b/lix/libexpr/eval.hh @@ -539,6 +539,11 @@ public: */ void eval(Expr & e, Value & v); + /** + * Creates a thunk that will evaluate the given expression when forced. + */ + void evalLazily(Expr & e, Value & v); + /** * Evaluation the expression, then verify that it has the expected * type. @@ -690,7 +695,6 @@ public: return mem.buildBindings(symbols, capacity); } - void mkThunk_(Value & v, Expr & expr); void mkPos(Value & v, PosIdx pos); /**