|
@@ -2742,8 +2742,9 @@ let rec init_module_type ctx context_init do_init (decl,p) =
|
|
|
error "Abstract is missing underlying type declaration" a.a_pos
|
|
|
end
|
|
|
|
|
|
-let type_module ctx m file tdecls p =
|
|
|
+let type_module ctx m file ?(is_extern=false) tdecls p =
|
|
|
let m, decls, tdecls = make_module ctx m file tdecls p in
|
|
|
+ if is_extern then m.m_extra.m_kind <- MExtern;
|
|
|
add_module ctx m p;
|
|
|
(* define the per-module context for the next pass *)
|
|
|
let ctx = {
|
|
@@ -2906,6 +2907,7 @@ let load_module ctx m p =
|
|
|
match !type_module_hook ctx m p with
|
|
|
| Some m -> m
|
|
|
| None ->
|
|
|
+ let is_extern = ref false in
|
|
|
let file, decls = (try
|
|
|
parse_module ctx m p
|
|
|
with Not_found ->
|
|
@@ -2917,10 +2919,12 @@ let load_module ctx m p =
|
|
|
| None -> loop l
|
|
|
| Some (file,(_,a)) -> file, a
|
|
|
in
|
|
|
+ is_extern := true;
|
|
|
loop ctx.com.load_extern_type
|
|
|
) in
|
|
|
+ let is_extern = !is_extern in
|
|
|
try
|
|
|
- type_module ctx m file decls p
|
|
|
+ type_module ctx m file ~is_extern decls p
|
|
|
with Forbid_package (inf,pl,pf) when p <> Ast.null_pos ->
|
|
|
raise (Forbid_package (inf,p::pl,pf))
|
|
|
) in
|