Skip to content

Commit

Permalink
fix(vlib): remove sketchy laziness
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Nov 12, 2021
1 parent 9c34fe4 commit 7040ee6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/dune_rules/vimpl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type t =
; vlib_modules : Modules.t
; vlib_foreign_objects : Path.t list
; impl_cm_kind : Cm_kind.t
; vlib_obj_map : Module.t Module_name.Unique.Map.t Lazy.t
; vlib_obj_map : Module.t Module_name.Unique.Map.t
}

let vlib_modules t = t.vlib_modules
Expand All @@ -34,17 +34,16 @@ let make ~vlib ~impl ~vlib_modules ~vlib_foreign_objects =
Native)
in
let vlib_obj_map =
lazy
(Modules.obj_map vlib_modules ~f:(function
| Normal m -> m
| _ -> assert false)
|> Module.Obj_map.fold ~init:Module_name.Unique.Map.empty ~f:(fun m acc ->
Module_name.Unique.Map.add_exn acc (Module.obj_name m) m))
Modules.obj_map vlib_modules ~f:(function
| Normal m -> m
| _ -> assert false)
|> Module.Obj_map.fold ~init:Module_name.Unique.Map.empty ~f:(fun m acc ->
Module_name.Unique.Map.add_exn acc (Module.obj_name m) m)
in
{ impl; impl_cm_kind; vlib; vlib_modules; vlib_foreign_objects; vlib_obj_map }

let vlib_stubs_o_files = function
| None -> []
| Some t -> t.vlib_foreign_objects

let vlib_obj_map t = Lazy.force t.vlib_obj_map
let vlib_obj_map t = t.vlib_obj_map

0 comments on commit 7040ee6

Please sign in to comment.