Просмотр исходного кода

check context before checking cache for display files

see #11480
Simon Krajewski 1 год назад
Родитель
Сommit
1d84117c35
1 измененных файлов с 13 добавлено и 8 удалено
  1. 13 8
      src/context/display/displayTexpr.ml

+ 13 - 8
src/context/display/displayTexpr.ml

@@ -170,14 +170,19 @@ let check_display_file ctx cs =
 			TypeloadParse.PdiHandler.handle_pdi ctx.com cfile.c_pdi;
 			(* We have to go through type_module_hook because one of the module's dependencies could be
 			   invalid (issue #8991). *)
-			begin match !TypeloadModule.type_module_hook ctx path null_pos with
-			| NoModule | BadModule _ -> raise Not_found
-			| BinaryModule mc ->
-				let m = (TypeloadModule.get_reader ctx p)#read_hxb (IO.input_bytes mc.mc_bytes) ctx.com.hxb_reader_stats in
-				check_display_module ctx cfile.c_decls m
-			| GoodModule m ->
-				check_display_module ctx cfile.c_decls m
-			end
+			let m = try
+				ctx.com.module_lut#find path
+			with Not_found ->
+				begin match !TypeloadModule.type_module_hook ctx path null_pos with
+				| NoModule | BadModule _ -> raise Not_found
+				| BinaryModule mc ->
+					let m = (TypeloadModule.get_reader ctx p)#read_hxb (IO.input_bytes mc.mc_bytes) ctx.com.hxb_reader_stats in
+					m
+				| GoodModule m ->
+					m
+				end
+			in
+			check_display_module ctx cfile.c_decls m
 		with Not_found ->
 			let fkey = DisplayPosition.display_position#get_file_key in
 			(* force parsing again : if the completion point have been changed *)