From e3ba0e78848c7bccc89661c285095bfdaf9a3c1e Mon Sep 17 00:00:00 2001 From: Aleksandr Kuzmenko Date: Thu, 18 Jun 2020 14:40:17 +0300 Subject: [PATCH] added `module_def_extra.m_file_key` (#9509) --- extra/CHANGES.txt | 1 + src/context/compilationServer.ml | 2 +- src/core/tFunctions.ml | 9 +++++++++ src/core/tType.ml | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/extra/CHANGES.txt b/extra/CHANGES.txt index bf1a312608f..361850e9893 100644 --- a/extra/CHANGES.txt +++ b/extra/CHANGES.txt @@ -7,6 +7,7 @@ display : fixed completion for out-of-bounds argument in a call (#9435) display : fixed "find references" through interfaces (#9470) display : optimized "find references" (#9504) + display : optimized "server/invalidate" requests (#9509) macro : fixed type intersection syntax in macro reification (#9404) lua : fixed lua code generation without `--main` compilation argument (#9489) php : added an overload signature for `session_set_cookie_params` function (#9507) diff --git a/src/context/compilationServer.ml b/src/context/compilationServer.ml index d3073ba060f..2e277eeaecd 100644 --- a/src/context/compilationServer.ml +++ b/src/context/compilationServer.ml @@ -163,7 +163,7 @@ class cache = object(self) method taint_modules file_key = Hashtbl.iter (fun _ cc -> Hashtbl.iter (fun _ m -> - if Path.UniqueKey.create m.m_extra.m_file = file_key then m.m_extra.m_dirty <- Some m.m_path + if m.m_extra.m_file_key() = file_key then m.m_extra.m_dirty <- Some m.m_path ) cc#get_modules ) contexts diff --git a/src/core/tFunctions.ml b/src/core/tFunctions.ml index 652f10b8709..ea4825a427c 100644 --- a/src/core/tFunctions.ml +++ b/src/core/tFunctions.ml @@ -115,8 +115,17 @@ let mk_class m path pos name_pos = } let module_extra file sign time kind policy = + let file_key = ref None in { m_file = file; + m_file_key = (fun () -> + match !file_key with + | Some key -> key + | None -> + let key = Path.UniqueKey.create file in + file_key := Some key; + key + ); m_sign = sign; m_display = { m_inline_calls = []; diff --git a/src/core/tType.ml b/src/core/tType.ml index e12b670f6cb..6ce56c4e008 100644 --- a/src/core/tType.ml +++ b/src/core/tType.ml @@ -323,6 +323,7 @@ and module_def_display = { and module_def_extra = { m_file : string; + m_file_key : unit -> Path.UniqueKey.t; m_sign : string; m_display : module_def_display; mutable m_check_policy : module_check_policy list;