Skip to content

Commit

Permalink
[typer] create new typer if signature changed during init macros
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Sep 27, 2023
1 parent a90c3a2 commit c838e61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,16 @@ let do_type ctx tctx actx =
let t = Timer.timer ["typing"] in
let cs = com.cs in
CommonCache.maybe_add_context_sign cs com "before_init_macros";
let init_sign = Define.get_signature com.defines in
com.stage <- CInitMacrosStart;
ServerMessage.compiler_stage com;
List.iter (MacroContext.call_init_macro tctx) (List.rev actx.config_macros);
com.stage <- CInitMacrosDone;
ServerMessage.compiler_stage com;
check_defines ctx.com;
let sign = Define.get_signature com.defines in
CommonCache.lock_signature com "after_init_macros";
let tctx = if init_sign = sign then tctx else Typer.create com in
com.callbacks#run com.callbacks#get_after_init_macros;
run_or_diagnose ctx (fun () ->
if com.display.dms_kind <> DMNone then DisplayTexpr.check_display_file tctx cs;
Expand Down

0 comments on commit c838e61

Please sign in to comment.