From 892ce2b5b4f0eebd4aa7bcc9ef95a297bad44552 Mon Sep 17 00:00:00 2001 From: araq Date: Sun, 28 Dec 2025 14:06:58 +0100 Subject: [PATCH] progress --- compiler/modulegraphs.nim | 2 +- compiler/nifbackend.nim | 4 +--- compiler/options.nim | 1 + compiler/scriptconfig.nim | 2 ++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim index d0069e59b0..114e0b5724 100644 --- a/compiler/modulegraphs.nim +++ b/compiler/modulegraphs.nim @@ -471,7 +471,7 @@ proc copyTypeProps*(g: ModuleGraph; module: int; dest, src: PType) = proc loadCompilerProc*(g: ModuleGraph; name: string): PSym = result = nil - if g.config.symbolFiles == disabledSf: + if g.config.symbolFiles == disabledSf and optWithinConfigSystem notin g.config.globalOptions: # For NIF-based compilation, search in loaded NIF modules when not defined(nimKochBootstrap): # Only try to resolve from NIF if we're actually using NIF files (cmdNifC) diff --git a/compiler/nifbackend.nim b/compiler/nifbackend.nim index 5ebf953343..39da0d762e 100644 --- a/compiler/nifbackend.nim +++ b/compiler/nifbackend.nim @@ -115,9 +115,7 @@ proc generateCode*(g: ModuleGraph; mainFileIdx: FileIndex) = # Also ensure system module is set up and generated first if it exists if precompSys.module != nil: - let systemBmod = BModuleList(g.backend).mods[precompSys.module.position] - if systemBmod == nil: - discard setupNifBackendModule(g, precompSys.module) + discard setupNifBackendModule(g, precompSys.module) generateCodeForModule(g, precompSys) # Track which modules have been processed to avoid duplicates diff --git a/compiler/options.nim b/compiler/options.nim index 479148d07c..6dcec635b3 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -112,6 +112,7 @@ type # please make sure we have under 32 options optJsBigInt64 # use bigints for 64-bit integers in JS optItaniumMangle # mangling follows the Itanium spec optCompress # turn on AST compression by converting it to NIF + optWithinConfigSystem # we still compile within the configuration system TGlobalOptions* = set[TGlobalOption] diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index e2df695268..10d3f73bc0 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/scriptconfig.nim @@ -213,6 +213,7 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile; unregisterArcOrc(conf) conf.globalOptions.excl optOwnedRefs conf.selectedGC = gcUnselected + conf.globalOptions.incl optWithinConfigSystem var m = graph.makeModule(scriptName) incl(m, sfMainModule) @@ -251,4 +252,5 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile; #initDefines() undefSymbol(conf.symbols, "nimscript") undefSymbol(conf.symbols, "nimconfig") + conf.globalOptions.excl optWithinConfigSystem conf.symbolFiles = oldSymbolFiles