libexpr: Migrate Evaluator::evalLazily to return a Value
Change-Id: I9f778407d454e141cb9b7959bbc02ed26a6a6964
This commit is contained in:
@@ -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
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user