From 297556925e0138843933563d85335137aaf98d4c Mon Sep 17 00:00:00 2001 From: araq Date: Wed, 12 Nov 2025 10:25:56 +0100 Subject: [PATCH] improvements --- compiler/ast.nim | 13 ++++++++----- compiler/modulegraphs.nim | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index bc4c3b2ff7..406ddade18 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -26,7 +26,8 @@ export nodekinds import astdef export astdef -import ast2nif +when not defined(nimKochBootstrap): + import ast2nif template typ*(n: PNode): PType = n.typField @@ -36,13 +37,15 @@ var program {.threadvar.}: DecodeContext proc setupProgram*(config: ConfigRef; cache: IdentCache) = program = createDecodeContext(config, cache) -proc loadSym*(s: PSym) {.inline.} = +template loadSym(s: PSym) = ## Loads a symbol from NIF file if it's in Partial state. - ast2nif.loadSym(program, s) + when not defined(nimKochBootstrap): + ast2nif.loadSym(program, s) -proc loadType*(t: PType) {.inline.} = +template loadType(t: PType) = ## Loads a type from NIF file if it's in Partial state. - ast2nif.loadType(program, t) + when not defined(nimKochBootstrap): + ast2nif.loadType(program, t) proc ensureMutable*(s: PSym) {.inline.} = assert s.state != Sealed diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim index 883a460d1b..fe2131c555 100644 --- a/compiler/modulegraphs.nim +++ b/compiler/modulegraphs.nim @@ -586,6 +586,7 @@ proc newModuleGraph*(cache: IdentCache; config: ConfigRef): ModuleGraph = result.config = config result.cache = cache initModuleGraphFields(result) + ast.setupProgram(config, cache) proc resetAllModules*(g: ModuleGraph) = g.packageSyms = initStrTable()