Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Mar 13, 2023
1 parent 1c8af7f commit 5618780
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/dune_rules/compilation_context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,10 @@ let create ~super_context ~scope ~expander ~obj_dir ~modules ~flags
; loc
}

let for_alias_module t ?flags alias_module =
let for_alias_module t ?(keep_flags = false) alias_module =
let flags =
match flags with
| Some f -> f
| None ->
if keep_flags then t.flags
else
let project = Scope.project t.scope in
let dune_version = Dune_project.dune_version project in
let profile = (Super_context.context t.super_context).profile in
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/compilation_context.mli
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ val create :
-> t Memo.t

(** Return a compilation context suitable for compiling the alias module. *)
val for_alias_module : t -> ?flags:Ocaml_flags.t -> Module.t -> t
val for_alias_module : t -> ?keep_flags:bool -> Module.t -> t

val super_context : t -> Super_context.t

Expand Down
3 changes: 1 addition & 2 deletions src/dune_rules/module_compilation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ let build_all cctx =
if Modules.is_stdlib_alias modules m then
(* XXX it would probably be simpler if the flags were just for this
module in the definition of the stanza *)
let flags = Compilation_context.flags cctx in
Compilation_context.for_alias_module cctx m ~flags
Compilation_context.for_alias_module cctx m ~keep_flags:true
else cctx
in
build_module cctx m))
Expand Down

0 comments on commit 5618780

Please sign in to comment.