Browse Source

ensure that all modules properly depend on String and Array

Nicolas Cannasse 11 years ago
parent
commit
7671ee3860
1 changed files with 5 additions and 1 deletions
  1. 5 1
      typeload.ml

+ 5 - 1
typeload.ml

@@ -40,7 +40,6 @@ let make_module ctx mpath file tdecls loadp =
 		m_types = [];
 		m_types = [];
 		m_extra = module_extra (Common.unique_full_path file) (Common.get_signature ctx.com) (file_time file) (if ctx.in_macro then MMacro else MCode);
 		m_extra = module_extra (Common.unique_full_path file) (Common.get_signature ctx.com) (file_time file) (if ctx.in_macro then MMacro else MCode);
 	} in
 	} in
-	if ctx.g.std != null_module then add_dependency m ctx.g.std;
 	let pt = ref None in
 	let pt = ref None in
 	let rec make_decl acc decl =
 	let rec make_decl acc decl =
 		let p = snd decl in
 		let p = snd decl in
@@ -2336,6 +2335,11 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 let type_module ctx m file tdecls p =
 let type_module ctx m file tdecls p =
 	let m, decls, tdecls = make_module ctx m file tdecls p in
 	let m, decls, tdecls = make_module ctx m file tdecls p in
 	add_module ctx m p;
 	add_module ctx m p;
+	if ctx.g.std != null_module then begin
+		add_dependency m ctx.g.std;
+		(* this will ensure both String and (indirectly) Array which are basic types which might be referenced *)
+		add_dependency m (match follow (load_core_type ctx "String") with TInst (c,_) -> c.cl_module | _ -> assert false);
+	end;
 	(* define the per-module context for the next pass *)
 	(* define the per-module context for the next pass *)
 	let ctx = {
 	let ctx = {
 		com = ctx.com;
 		com = ctx.com;