Skip to content

Commit

Permalink
refactor(pkg): make add_impls_to_cache more private (#11270)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored Jan 3, 2025
1 parent f566202 commit 6152ab8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/0install-solver/solver_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6152ab8

Please sign in to comment.