Skip to content

Commit ba39fef

Browse files
CopilotSimn
andcommitted
Move warned_positions from global to Common.context scope
Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
1 parent 579fb6c commit ba39fef

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/compiler/server/server.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ let process sctx entry comm args =
202202
let t0 = Extc.time() in
203203
ServerMessage.arguments args;
204204
ServerCompilationContext.reset sctx;
205-
Hashtbl.clear DeprecationCheck.warned_positions;
206205

207206
let stats = Stats.create () in
208207
let after_compilation ctx =

src/context/common.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ type context = {
348348
module_lut : module_lut;
349349
module_nonexistent_lut : (path,bool) lookup;
350350
fake_modules : (Path.UniqueKey.t,module_def) Hashtbl.t;
351+
warned_positions : (string * int, string * Globals.pos * warning_option list list) Hashtbl.t;
351352
mutable has_error : bool;
352353
pass_debug_messages : string DynArray.t;
353354
(* output *)
@@ -803,6 +804,7 @@ let create io timer_ctx compilation_step sctx version args display_mode =
803804
error_ext = (fun _ -> die "" __LOC__);
804805
get_messages = (fun() -> []);
805806
filter_messages = (fun _ -> ());
807+
warned_positions = Hashtbl.create 0;
806808
pass_debug_messages = DynArray.create();
807809
basic = {
808810
tvoid = mk_mono();
@@ -923,6 +925,7 @@ let clone com is_macro_context =
923925
dump_config = com.dump_config;
924926
file_contents = com.file_contents;
925927
(* reinits *)
928+
warned_positions = Hashtbl.create 0;
926929
cache = None;
927930
stage = CCreated;
928931
display_information = {

src/context/display/deprecationCheck.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ let create_context com = {
1717
curmod = null_module;
1818
}
1919

20-
let warned_positions = Hashtbl.create 0
21-
2220
let warn_deprecation dctx s p_usage =
2321
let pkey p = (p.pfile,p.pmin) in
24-
if not (Hashtbl.mem warned_positions (pkey p_usage)) then begin
22+
if not (Hashtbl.mem dctx.com.warned_positions (pkey p_usage)) then begin
2523
let options = Warning.from_meta (dctx.class_meta @ dctx.field_meta) in
26-
Hashtbl.add warned_positions (pkey p_usage) (s,p_usage,options);
24+
Hashtbl.add dctx.com.warned_positions (pkey p_usage) (s,p_usage,options);
2725
module_warning dctx.com dctx.curmod WDeprecated options s p_usage;
2826
end
2927

src/context/display/diagnosticsPrinter.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ let json_of_diagnostics com dctx =
190190
add DKDeprecationWarning p MessageSeverity.Warning (Some wobj.w_name) (JString s);
191191
| WMDisable -> ()
192192
end
193-
) DeprecationCheck.warned_positions;
193+
) com.warned_positions;
194194
| WMDisable ->
195195
()
196196
end;

0 commit comments

Comments
 (0)