Skip to content

Commit

Permalink
[custom targets] enable macro cache before setting up targets
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Oct 5, 2023
1 parent 4a981cf commit 7074ea1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,11 @@ let check_defines com =
end

(** Creates the typer context and types [classes] into it. *)
let do_type ctx mctx actx display_file_dot_path =
let do_type ctx mctx actx display_file_dot_path macro_cache_enabled =
let com = ctx.com in
let t = Timer.timer ["typing"] in
let cs = com.cs in
CommonCache.maybe_add_context_sign cs com "before_init_macros";
let macro_cache_enabled = !MacroContext.macro_enable_cache in
MacroContext.macro_enable_cache := true;
com.stage <- CInitMacrosStart;
ServerMessage.compiler_stage com;

Expand Down Expand Up @@ -339,6 +337,8 @@ let compile ctx actx callbacks =
(* Set up display configuration *)
DisplayProcessing.process_display_configuration ctx;
let display_file_dot_path = DisplayProcessing.process_display_file com actx in
let macro_cache_enabled = !MacroContext.macro_enable_cache in
MacroContext.macro_enable_cache := true;
let mctx = match com.platform with
| CustomTarget name ->
begin try
Expand All @@ -363,7 +363,7 @@ let compile ctx actx callbacks =
if actx.cmds = [] && not actx.did_something then actx.raise_usage();
end else begin
(* Actual compilation starts here *)
let (tctx,display_file_dot_path) = do_type ctx mctx actx display_file_dot_path in
let (tctx,display_file_dot_path) = do_type ctx mctx actx display_file_dot_path macro_cache_enabled in
DisplayProcessing.handle_display_after_typing ctx tctx display_file_dot_path;
finalize_typing ctx tctx;
DisplayProcessing.handle_display_after_finalization ctx tctx display_file_dot_path;
Expand Down

0 comments on commit 7074ea1

Please sign in to comment.