parent
74a7b09412
commit
dfa5faea0f
1 changed files with 14 additions and 10 deletions
|
|
@ -1327,16 +1327,6 @@ proc genInitCode(m: BModule) =
|
|||
appcg(m, m.s[cfsTypeInit1], "static #TNimType $1[$2];$n",
|
||||
[m.nimTypesName, rope(m.nimTypes)])
|
||||
|
||||
if m.initProc.gcFrameId > 0:
|
||||
moduleInitRequired = true
|
||||
add(prc, initGCFrame(m.initProc))
|
||||
|
||||
if m.initProc.s(cpsLocals).len > 0:
|
||||
moduleInitRequired = true
|
||||
add(prc, genSectionStart(cpsLocals, m.config))
|
||||
add(prc, m.initProc.s(cpsLocals))
|
||||
add(prc, genSectionEnd(cpsLocals, m.config))
|
||||
|
||||
if m.preInitProc.s(cpsInit).len > 0 or m.preInitProc.s(cpsStmts).len > 0:
|
||||
# Give this small function its own scope
|
||||
addf(prc, "{$N", [])
|
||||
|
|
@ -1362,6 +1352,19 @@ proc genInitCode(m: BModule) =
|
|||
add(prc, genSectionEnd(cpsStmts, m.config))
|
||||
addf(prc, "}$N", [])
|
||||
|
||||
# add new scope for following code, because old vcc compiler need variable
|
||||
# be defined at the top of the block
|
||||
addf(prc, "{$N", [])
|
||||
if m.initProc.gcFrameId > 0:
|
||||
moduleInitRequired = true
|
||||
add(prc, initGCFrame(m.initProc))
|
||||
|
||||
if m.initProc.s(cpsLocals).len > 0:
|
||||
moduleInitRequired = true
|
||||
add(prc, genSectionStart(cpsLocals, m.config))
|
||||
add(prc, m.initProc.s(cpsLocals))
|
||||
add(prc, genSectionEnd(cpsLocals, m.config))
|
||||
|
||||
if m.initProc.s(cpsInit).len > 0 or m.initProc.s(cpsStmts).len > 0:
|
||||
moduleInitRequired = true
|
||||
if optStackTrace in m.initProc.options and frameDeclared notin m.flags:
|
||||
|
|
@ -1388,6 +1391,7 @@ proc genInitCode(m: BModule) =
|
|||
if m.initProc.gcFrameId > 0:
|
||||
moduleInitRequired = true
|
||||
add(prc, deinitGCFrame(m.initProc))
|
||||
addf(prc, "}$N", [])
|
||||
|
||||
addf(prc, "}$N$N", [])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue