Skip to content

Commit

Permalink
[server] delay on PConnectField, also delay in hxb reader
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Feb 8, 2024
1 parent b18953a commit dc0a219
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/compiler/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down Expand Up @@ -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__
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/context/display/displayTexpr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/typing/typeloadModule.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 _ ->
Expand Down

0 comments on commit dc0a219

Please sign in to comment.