libexpr: "hide" Value union members

on its own this is not very useful, but having accessors for every value
kind is a prerequisite for doing smart things with Value than the union.
the net effect for now is only to add a few parentheses across the tree.

Change-Id: I88688ac09eb08495dad1eb221034ca540f094950
This commit is contained in:
eldritch horrors
2025-09-29 15:22:41 +02:00
parent 2dae1141d9
commit c7cc7d6c31
32 changed files with 492 additions and 428 deletions
+4 -4
View File
@@ -78,13 +78,13 @@ static std::string attrPathJoin(nix::JSON input) {
static std::optional<Constituents>
readConstituents(const nix::Value *v, nix::box_ptr<nix::EvalState> &state,
nix::ref<nix::eval_cache::CachingEvaluator> &evaluator) {
auto a = v->attrs->get(state->ctx.symbols.create("_hydraAggregate"));
auto a = v->attrs()->get(state->ctx.symbols.create("_hydraAggregate"));
if (a && state->forceBool(*a->value, a->pos,
"while evaluating the "
"`_hydraAggregate` attribute")) {
std::vector<std::string> constituents;
std::vector<std::string> namedConstituents;
auto a = v->attrs->get(state->ctx.symbols.create("constituents"));
auto a = v->attrs()->get(state->ctx.symbols.create("constituents"));
if (!a)
state->ctx.errors
.make<nix::EvalError>("derivation must have a constituents "
@@ -197,13 +197,13 @@ void worker(nix::ref<nix::eval_cache::CachingEvaluator> evaluator,
// = true;` for top-level attrset
for (auto &i :
v->attrs->lexicographicOrder(evaluator->symbols)) {
v->attrs()->lexicographicOrder(evaluator->symbols)) {
const std::string_view name = evaluator->symbols[i->name];
attrs.emplace_back(name);
if (name == "recurseForDerivations" &&
!args.forceRecurse) {
auto attrv = v->attrs->get(
auto attrv = v->attrs()->get(
evaluator->s.recurseForDerivations);
recurse = state->forceBool(
*attrv->value, attrv->pos,