mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-13 14:53:46 +00:00
…16)"
This reverts commit 1a2ee566e3.
This commit is contained in:
@@ -2170,20 +2170,6 @@ proc addHcrInitGuards(p: BProc, n: PNode, inInitGuard: var bool) =
|
||||
|
||||
genStmts(p, n)
|
||||
|
||||
proc handleProcGlobals(m: BModule) =
|
||||
var procGlobals: seq[PNode] = move m.g.graph.procGlobals
|
||||
|
||||
for i in 0..<procGlobals.len:
|
||||
var stmts = newBuilder("")
|
||||
|
||||
# fixes recursive calls #24997
|
||||
swap stmts, m.preInitProc.s(cpsStmts)
|
||||
genStmts(m.preInitProc, procGlobals[i])
|
||||
swap stmts, m.preInitProc.s(cpsStmts)
|
||||
|
||||
handleProcGlobals(m)
|
||||
m.preInitProc.s(cpsStmts).add stmts.extract()
|
||||
|
||||
proc genTopLevelStmt*(m: BModule; n: PNode) =
|
||||
## Also called from `ic/cbackend.nim`.
|
||||
if pipelineutils.skipCodegen(m.config, n): return
|
||||
@@ -2199,7 +2185,13 @@ proc genTopLevelStmt*(m: BModule; n: PNode) =
|
||||
else:
|
||||
genProcBody(m.initProc, transformedN)
|
||||
|
||||
handleProcGlobals(m)
|
||||
var procGloals = move m.g.graph.procGlobals
|
||||
while true:
|
||||
if procGloals.len == 0:
|
||||
procGloals = move m.g.graph.procGlobals
|
||||
if procGloals.len == 0:
|
||||
break
|
||||
genStmts(m.preInitProc, procGloals.pop())
|
||||
|
||||
proc shouldRecompile(m: BModule; code: Rope, cfile: Cfile): bool =
|
||||
if optForceFullMake notin m.config.globalOptions:
|
||||
|
||||
@@ -41,17 +41,3 @@ block: # bug #24981
|
||||
type Foo = object
|
||||
i: int
|
||||
m(Foo)
|
||||
|
||||
block: # bug #24997
|
||||
type R = ref object
|
||||
type B = object
|
||||
j: int
|
||||
proc y(T: type): R
|
||||
proc u(T: type): R =
|
||||
let res {.global.} = y(T)
|
||||
res
|
||||
proc y(T: type): R =
|
||||
when T is object:
|
||||
doAssert not isNil(u(typeof(B.j)))
|
||||
R()
|
||||
discard u(B)
|
||||
|
||||
Reference in New Issue
Block a user