diff options
author | Clyybber <darkmine956@gmail.com> | 2020-06-28 17:47:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 17:47:47 +0200 |
commit | 394a56650ae6139786d8cefb838b0e3e282c24a1 (patch) | |
tree | d2c2ccf977fca01d8db0e6421fcf2b38f2f127ed /compiler | |
parent | 037990bc78914a793a4195c326282f8353cda319 (diff) | |
download | Nim-394a56650ae6139786d8cefb838b0e3e282c24a1.tar.gz |
Fix #14647 (#14776)
* Fix #14647 * Correct fix * Typo and add test * For real now :p
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/cgen.nim | 9 | ||||
-rw-r--r-- | compiler/cgendata.nim | 4 |
2 files changed, 5 insertions, 8 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index cd02ba9b1..99bfe9119 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -1777,11 +1777,6 @@ proc genModule(m: BModule, cfile: Cfile): Rope = if moduleIsEmpty: result = nil -proc newPreInitProc(m: BModule): BProc = - result = newProc(nil, m) - # little hack so that unique temporaries are generated: - result.labels = 100_000 - proc initProcOptions(m: BModule): TOptions = let opts = m.config.options if sfSystemModule in m.module.flags: opts-{optStackTrace} else: opts @@ -1802,7 +1797,9 @@ proc rawNewModule(g: BModuleList; module: PSym, filename: AbsoluteFile): BModule result.sigConflicts = initCountTable[SigHash]() result.initProc = newProc(nil, result) result.initProc.options = initProcOptions(result) - result.preInitProc = newPreInitProc(result) + result.preInitProc = newProc(nil, result) + result.preInitProc.flags.incl nimErrorFlagDisabled + result.preInitProc.labels = 100_000 # little hack so that unique temporaries are generated initNodeTable(result.dataCache) result.typeStack = @[] result.typeNodesName = getTempName(result) diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index ce74963e2..a20931be4 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -189,8 +189,8 @@ proc newProc*(prc: PSym, module: BModule): BProc = new(result) result.prc = prc result.module = module - if prc != nil: result.options = prc.options - else: result.options = module.config.options + result.options = if prc != nil: prc.options + else: module.config.options newSeq(result.blocks, 1) result.nestedTryStmts = @[] result.finallySafePoints = @[] |