libexpr: Migrate Evaluator::evalLazily to return a Value

Change-Id: I9f778407d454e141cb9b7959bbc02ed26a6a6964
This commit is contained in:
skye
2026-03-01 01:01:47 -05:00
parent c6b4f30be9
commit 2be998eeb4
3 changed files with 4 additions and 8 deletions
+1 -3
View File
@@ -185,9 +185,7 @@ Bindings * MixEvalArgs::getAutoArgs(Evaluator & state)
for (auto & i : autoArgs) {
Value v;
if (i.second[0] == 'E')
state.evalLazily(
state.parseExprFromString(i.second.substr(1), CanonPath::fromCwd()), v
);
v = state.evalLazily(state.parseExprFromString(i.second.substr(1), CanonPath::fromCwd()));
else
v = {NewValueAs::string, ((std::string_view) i.second).substr(1)};
res.insert(state.symbols.create(i.first), v);
+2 -4
View File
@@ -844,14 +844,12 @@ Value::List * EvalMemory::newList(size_t size)
return list;
}
void Evaluator::evalLazily(Expr & e, Value & v)
Value Evaluator::evalLazily(Expr & e)
{
v = {NewValueAs::thunk, mem, builtins.env, e};
stats.nrThunks++;
return {NewValueAs::thunk, mem, builtins.env, e};
}
void EvalState::mkPos(Value & v, PosIdx p)
{
auto origin = ctx.positions.originOf(p);
+1 -1
View File
@@ -554,7 +554,7 @@ public:
/**
* Creates a thunk that will evaluate the given expression when forced.
*/
void evalLazily(Expr & e, Value & v);
Value evalLazily(Expr & e);
/** If debugging is enabled, returns the next trace. Otherwise, std::nullopt. */
std::optional<DebugTrace const *> nextDebugTrace() const;