diff --git a/src/compiler/server.ml b/src/compiler/server.ml index 8dd36664db8..4180cb88af7 100644 --- a/src/compiler/server.ml +++ b/src/compiler/server.ml @@ -307,7 +307,7 @@ let check_module sctx ctx m_path m_extra p = ServerMessage.unchanged_content com "" file; end else begin ServerMessage.not_cached com "" m_path; - if m_extra.m_kind = MFake then Hashtbl.remove Typecore.fake_modules (Path.UniqueKey.lazy_key m_extra.m_file); + if m_extra.m_kind = MFake then Hashtbl.remove ctx.g.fake_modules (Path.UniqueKey.lazy_key m_extra.m_file); raise (Dirty (FileChanged file)) end end diff --git a/src/context/typecore.ml b/src/context/typecore.ml index 18d00bf6bea..00766cdec18 100644 --- a/src/context/typecore.ml +++ b/src/context/typecore.ml @@ -118,6 +118,7 @@ type typer_globals = { mutable return_partial_type : bool; mutable build_count : int; mutable t_dynamic_def : Type.t; + fake_modules : (Path.UniqueKey.t,module_def) Hashtbl.t; (* api *) do_macro : typer -> macro_mode -> path -> string -> expr list -> pos -> macro_result; do_load_macro : typer -> bool -> path -> string -> pos -> ((string * bool * t) list * t * tclass * Type.tclass_field); @@ -466,11 +467,10 @@ let make_lazy ?(force=true) ctx t_proc f where = if force then delay ctx PForce (fun () -> ignore(lazy_type r)); r -let fake_modules = Hashtbl.create 0 let create_fake_module ctx file = let key = ctx.com.file_keys#get file in let file = Path.get_full_path file in - let mdep = (try Hashtbl.find fake_modules key with Not_found -> + let mdep = (try Hashtbl.find ctx.g.fake_modules key with Not_found -> let mdep = { m_id = alloc_mid(); m_path = (["$DEP"],file); @@ -478,7 +478,7 @@ let create_fake_module ctx file = m_statics = None; m_extra = module_extra file (Define.get_signature ctx.com.defines) (file_time file) MFake ctx.com.compilation_step []; } in - Hashtbl.add fake_modules key mdep; + Hashtbl.add ctx.g.fake_modules key mdep; mdep ) in ctx.com.module_lut#add mdep.m_path mdep; diff --git a/src/typing/typerEntry.ml b/src/typing/typerEntry.ml index 27637158004..9692fe1c369 100644 --- a/src/typing/typerEntry.ml +++ b/src/typing/typerEntry.ml @@ -29,6 +29,7 @@ let create com macros = build_count = 0; t_dynamic_def = t_dynamic; functional_interface_lut = new Lookup.pmap_lookup; + fake_modules = Hashtbl.create 0; do_macro = MacroContext.type_macro; do_load_macro = MacroContext.load_macro'; do_load_module = TypeloadModule.load_module;