Browse Source

[server] delay on PConnectField, also delay in hxb reader

Rudy Ges 1 year ago
parent
commit
dc0a2197c4
3 changed files with 6 additions and 4 deletions
  1. 4 2
      src/compiler/server.ml
  2. 1 1
      src/context/display/displayTexpr.ml
  3. 1 1
      src/typing/typeloadModule.ml

+ 4 - 2
src/compiler/server.ml

@@ -389,6 +389,7 @@ let check_module sctx com m_path m_extra p =
 class hxb_reader_api_server
 	(com : Common.context)
 	(cc : context_cache)
+	(delay : (unit -> unit) -> unit)
 = object(self)
 
 	method make_module (path : path) (file : string) =
@@ -426,7 +427,8 @@ class hxb_reader_api_server
 			(* We try to avoid reading expressions as much as possible, so we only do this for
 				 our current display file if we're in display mode. *)
 			let is_display_file = DisplayPosition.display_position#is_in_file (Path.UniqueKey.lazy_key m.m_extra.m_file) in
-			if is_display_file || com.display.dms_full_typing then ignore(f_next chunks EOM);
+			if is_display_file || com.display.dms_full_typing then ignore(f_next chunks EOM)
+			else delay (fun () -> ignore(f_next chunks EOM));
 			m
 		| BadModule reason ->
 			die (Printf.sprintf "Unexpected BadModule %s" (s_type_path path)) __LOC__
@@ -568,7 +570,7 @@ and type_module sctx com delay mpath p =
 						| Some api ->
 							api
 						| None ->
-							let api = (new hxb_reader_api_server com cc :> HxbReaderApi.hxb_reader_api) in
+							let api = (new hxb_reader_api_server com cc delay :> HxbReaderApi.hxb_reader_api) in
 							com.hxb_reader_api <- Some api;
 							api
 					in

+ 1 - 1
src/context/display/displayTexpr.ml

@@ -173,7 +173,7 @@ let check_display_file ctx cs =
 			let m = try
 				ctx.com.module_lut#find path
 			with Not_found ->
-				begin match !TypeloadCacheHook.type_module_hook ctx.com (delay ctx.g PTypeField) path null_pos with
+				begin match !TypeloadCacheHook.type_module_hook ctx.com (delay ctx.g PConnectField) path null_pos with
 				| NoModule | BadModule _ -> raise Not_found
 				| BinaryModule mc ->
 					let api = (new TypeloadModule.hxb_reader_api_typeload ctx.com ctx.g TypeloadModule.load_module' p :> HxbReaderApi.hxb_reader_api) in

+ 1 - 1
src/typing/typeloadModule.ml

@@ -804,7 +804,7 @@ and load_module' com g m p =
 		com.module_lut#find m
 	with Not_found ->
 		(* Check cache *)
-		match !TypeloadCacheHook.type_module_hook com (delay g PTypeField) m p with
+		match !TypeloadCacheHook.type_module_hook com (delay g PConnectField) m p with
 		| GoodModule m ->
 			m
 		| BinaryModule _ ->