mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Some module fixes
This commit is contained in:
parent
9a255522be
commit
54d956823b
@ -578,8 +578,13 @@ let gen_build_statements
|
||||
~outputs:[inc srcv]
|
||||
in
|
||||
let module_deps =
|
||||
Option.map
|
||||
(fun m -> Nj.build "phony" ~inputs:[inc srcv] ~outputs:[modd m])
|
||||
Option.map (fun m ->
|
||||
Nj.build "phony"
|
||||
~inputs:[inc srcv;
|
||||
(!Var.builddir / src /../ m) ^ ".cmi";
|
||||
(!Var.builddir / src /../ m) ^ ".cmxs";
|
||||
]
|
||||
~outputs:[modd m])
|
||||
item.module_def
|
||||
in
|
||||
let ml_file =
|
||||
@ -604,7 +609,7 @@ let gen_build_statements
|
||||
| Some m ->
|
||||
let target ext = (!Var.builddir / src /../ m) ^ "." ^ ext in
|
||||
Nj.build "ocaml-module" ~inputs:[ml_file]
|
||||
~implicit_in:(List.map (modfile ".cmi") modules)
|
||||
~implicit_in:(List.map modd modules)
|
||||
~outputs:[target "cmxs"]
|
||||
~implicit_out:(List.map target implicit_out_exts)
|
||||
~vars:
|
||||
@ -656,6 +661,7 @@ let gen_build_statements
|
||||
])
|
||||
include_dirs
|
||||
@ List.map (fun m -> m ^ ".cmx") modules );
|
||||
(* FIXME: This doesn't work for module used through file inclusion *)
|
||||
]
|
||||
in
|
||||
let expose_module =
|
||||
@ -664,11 +670,7 @@ let gen_build_statements
|
||||
Some
|
||||
(Nj.build "phony"
|
||||
~outputs:[m ^ "@module"]
|
||||
~inputs:
|
||||
[
|
||||
(!Var.builddir / src /../ m) ^ ".cmi";
|
||||
(!Var.builddir / src /../ m) ^ ".cmxs";
|
||||
])
|
||||
~inputs:[modd m])
|
||||
| _ -> None
|
||||
in
|
||||
let interp_deps =
|
||||
|
@ -1013,7 +1013,7 @@ let form_context (surface, mod_uses) surface_modules : context =
|
||||
disambiguation. This is only done towards the root context, because
|
||||
submodules are only interfaces which don't need disambiguation ; and
|
||||
transitive dependencies shouldn't be visible here. *)
|
||||
let sub_constructor_idmap, sub_field_idmap =
|
||||
let constructor_idmap, field_idmap =
|
||||
Ident.Map.fold
|
||||
(fun _ m (cmap, fmap) ->
|
||||
let lctx = ModuleName.Map.find m ctxt.modules in
|
||||
@ -1029,22 +1029,14 @@ let form_context (surface, mod_uses) surface_modules : context =
|
||||
in
|
||||
cmap, fmap)
|
||||
mod_uses
|
||||
(Ident.Map.empty, Ident.Map.empty)
|
||||
(ctxt.local.constructor_idmap, ctxt.local.field_idmap)
|
||||
in
|
||||
{
|
||||
ctxt with
|
||||
local =
|
||||
{
|
||||
ctxt.local with
|
||||
(* In the root context, don't disambiguate on submodules structs/enums
|
||||
when there is a conflict *)
|
||||
constructor_idmap =
|
||||
Ident.Map.union
|
||||
(fun _ base _ -> Some base)
|
||||
ctxt.local.constructor_idmap sub_constructor_idmap;
|
||||
field_idmap =
|
||||
Ident.Map.union
|
||||
(fun _ base _ -> Some base)
|
||||
ctxt.local.field_idmap sub_field_idmap;
|
||||
constructor_idmap;
|
||||
field_idmap;
|
||||
};
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ let load_module_interfaces options includes program =
|
||||
"Circular module dependency"
|
||||
| None ->
|
||||
let intf = Surface.Parser_driver.load_interface (Cli.FileName f) in
|
||||
let modname = ModuleName.fresh use.Surface.Ast.mod_use_name in
|
||||
let modname = ModuleName.fresh intf.intf_modname in
|
||||
let seen = File.Map.add f None seen in
|
||||
let seen, sub_use_map =
|
||||
aux
|
||||
|
Loading…
Reference in New Issue
Block a user