From a1f52a1ce696bdbdcdd0c2f16764cc4a3bd0f0dd Mon Sep 17 00:00:00 2001 From: skye Date: Tue, 7 Apr 2026 21:05:59 -0400 Subject: [PATCH] libexpr/primops: Migrate helper fn fetchTree to return a Value Part of #1136 Change-Id: Icb79dfc99f530a2965199954ce784e166a6a6964 --- lix/libexpr/primops/fetchTree.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lix/libexpr/primops/fetchTree.cc b/lix/libexpr/primops/fetchTree.cc index febd837a0..3df1bf8db 100644 --- a/lix/libexpr/primops/fetchTree.cc +++ b/lix/libexpr/primops/fetchTree.cc @@ -108,14 +108,14 @@ struct FetchTreeParams { bool allowNameArgument = false; }; -static void fetchTree( +static Value fetchTree( EvalState & state, const PosIdx pos, - Value * * args, - Value & v, + Value ** args, std::optional type, const FetchTreeParams & params = FetchTreeParams{} -) { +) +{ fetchers::Input input; NixStringContext context; @@ -225,12 +225,12 @@ static void fetchTree( state.ctx.paths.allowPath(tree.storePath); - v = emitTreeAttrs(state.ctx, tree, input2, params.emptyRevFallback, false); + return emitTreeAttrs(state.ctx, tree, input2, params.emptyRevFallback, false); } void prim_fetchTree(EvalState & state, Value * * args, Value & v) { - fetchTree(state, noPos, args, v, std::nullopt, FetchTreeParams { .allowNameArgument = false }); + v = fetchTree(state, noPos, args, std::nullopt, FetchTreeParams{.allowNameArgument = false}); } static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v, @@ -346,7 +346,9 @@ void prim_fetchTarball(EvalState & state, Value * * args, Value & v) void prim_fetchGit(EvalState & state, Value * * args, Value & v) { - fetchTree(state, noPos, args, v, "git", FetchTreeParams { .emptyRevFallback = true, .allowNameArgument = true }); + v = fetchTree( + state, noPos, args, "git", FetchTreeParams{.emptyRevFallback = true, .allowNameArgument = true} + ); } }