Skip to content

Commit

Permalink
Inline modules_exe function in dir_contents.ml
Browse files Browse the repository at this point in the history
It was only used once and inlining it makes the code slightly simpler

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
  • Loading branch information
jeremiedimino committed Jul 8, 2019
1 parent f6aa4db commit 143a9a0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/dir_contents.ml
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,6 @@ end = struct
let make_modules sctx (d : _ Dir_with_dune.t) ~modules =
let scope = d.scope in
let libs, exes =
let modules_exe =
let project = Scope.project scope in
let name = Dune_project.name project in
let wrapped_exes = Dune_project.wrapped_exes project in
if wrapped_exes then
fun modules -> Modules.exe_wrapped ~name ~src_dir:d.ctx_dir ~modules
else
Modules.exe_unwrapped

in
List.filter_partition_map d.data ~f:(fun stanza ->
match (stanza : Stanza.t) with
| Library lib ->
Expand Down Expand Up @@ -292,7 +282,15 @@ end = struct
~kind:Modules_field_evaluator.Exe_or_normal_lib
~private_modules:Ordered_set_lang.standard
in
Right (exes, modules_exe modules)
let modules =
let project = Scope.project scope in
if Dune_project.wrapped_exes project then
let name = Dune_project.name project in
Modules.exe_wrapped ~name ~src_dir:d.ctx_dir ~modules
else
Modules.exe_unwrapped modules
in
Right (exes, modules)
| _ -> Skip)
in
let libraries =
Expand Down

0 comments on commit 143a9a0

Please sign in to comment.