|
@@ -412,31 +412,33 @@ class hxb_reader_api_server
|
|
|
|
|
|
method resolve_type (pack : string list) (mname : string) (tname : string) =
|
|
|
let path = (pack,mname) in
|
|
|
- let m = match self#find_module path with
|
|
|
- | GoodModule m ->
|
|
|
- m
|
|
|
- | BinaryModule mc ->
|
|
|
- let reader = new HxbReader.hxb_reader path ctx.com.hxb_reader_stats in
|
|
|
- let f_next chunks until =
|
|
|
- let t_hxb = Timer.timer ["server";"module cache";"hxb read"] in
|
|
|
- let r = reader#read_chunks_until (self :> HxbReaderApi.hxb_reader_api) chunks until in
|
|
|
- t_hxb();
|
|
|
- r
|
|
|
- in
|
|
|
- let m,chunks = f_next mc.mc_chunks EOF in
|
|
|
-
|
|
|
- (* 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 || ctx.com.display.dms_full_typing then ignore(f_next chunks EOM);
|
|
|
- m
|
|
|
- | BadModule reason ->
|
|
|
- die (Printf.sprintf "Unexpected BadModule %s" (s_type_path path)) __LOC__
|
|
|
- | NoModule ->
|
|
|
- die (Printf.sprintf "Unexpected NoModule %s" (s_type_path path)) __LOC__
|
|
|
- in
|
|
|
+ let m = self#resolve_module path in
|
|
|
List.find (fun t -> snd (t_path t) = tname) m.m_types
|
|
|
|
|
|
+ method resolve_module (path : path) =
|
|
|
+ match self#find_module path with
|
|
|
+ | GoodModule m ->
|
|
|
+ m
|
|
|
+ | BinaryModule mc ->
|
|
|
+ let reader = new HxbReader.hxb_reader path ctx.com.hxb_reader_stats in
|
|
|
+ let f_next chunks until =
|
|
|
+ let t_hxb = Timer.timer ["server";"module cache";"hxb read"] in
|
|
|
+ let r = reader#read_chunks_until (self :> HxbReaderApi.hxb_reader_api) chunks until in
|
|
|
+ t_hxb();
|
|
|
+ r
|
|
|
+ in
|
|
|
+ let m,chunks = f_next mc.mc_chunks EOF in
|
|
|
+
|
|
|
+ (* 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 || ctx.com.display.dms_full_typing then ignore(f_next chunks EOM);
|
|
|
+ m
|
|
|
+ | BadModule reason ->
|
|
|
+ die (Printf.sprintf "Unexpected BadModule %s" (s_type_path path)) __LOC__
|
|
|
+ | NoModule ->
|
|
|
+ die (Printf.sprintf "Unexpected NoModule %s" (s_type_path path)) __LOC__
|
|
|
+
|
|
|
method find_module (m_path : path) =
|
|
|
try
|
|
|
GoodModule (ctx.com.module_lut#find m_path)
|