From 6152ab8ec5d7204d792be7b094063c032bfdd3cc Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 3 Jan 2025 21:44:59 +0000 Subject: [PATCH] refactor(pkg): make add_impls_to_cache more private (#11270) Signed-off-by: Rudi Grinberg --- src/0install-solver/solver_core.ml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/0install-solver/solver_core.ml b/src/0install-solver/solver_core.ml index 09cd843416d..8890c72ebe3 100644 --- a/src/0install-solver/solver_core.ml +++ b/src/0install-solver/solver_core.ml @@ -168,15 +168,17 @@ module Make (Model : S.SOLVER_INPUT) = struct let impl_cache = ImplCache.create () in let conflict_classes = Conflict_classes.create sat in let+ () = - let rec add_impls_to_cache role = - let+ clause, impls = make_impl_clause sat ~dummy_impl role in - ( clause - , fun () -> - Fiber.sequential_iter impls ~f:(fun (impl_var, impl) -> - Conflict_classes.process conflict_classes impl_var impl; - Model.requires role impl |> Fiber.sequential_iter ~f:(process_dep impl_var)) - ) - and lookup_impl key = ImplCache.lookup impl_cache add_impls_to_cache key + let rec lookup_impl = + let add_impls_to_cache role = + let+ clause, impls = make_impl_clause sat ~dummy_impl role in + ( clause + , fun () -> + Fiber.sequential_iter impls ~f:(fun (impl_var, impl) -> + Conflict_classes.process conflict_classes impl_var impl; + Model.requires role impl + |> Fiber.sequential_iter ~f:(process_dep impl_var)) ) + in + fun key -> ImplCache.lookup impl_cache add_impls_to_cache key and process_dep user_var dep : unit Fiber.t = (* Process a dependency of [user_var]: - find the candidate implementations to satisfy it