From 7074ea16d47839bf79a0ac515ac5657de40ba825 Mon Sep 17 00:00:00 2001 From: Rudy Ges Date: Thu, 5 Oct 2023 15:29:55 +0200 Subject: [PATCH] [custom targets] enable macro cache before setting up targets --- src/compiler/compiler.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/compiler.ml b/src/compiler/compiler.ml index 3364958afa6..0cd8ba39179 100644 --- a/src/compiler/compiler.ml +++ b/src/compiler/compiler.ml @@ -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; @@ -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 @@ -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;