store full definition AST for consts, fix noRewrite (#20115)
* continue #9582 for consts, close #9331, fix #20114 also move extractPragma to ast to pave the way for things like {.strdefine: "abc".} etc * changelog correctly * fix jsgen * update tgetimpl * fix sighashes * fix #19766, add comment about postfix * fix noRewrite LOL refs #16620 * fix changelog * fix destructors
This commit is contained in:
parent
fdc6b0fb6e
commit
de4b0346bd
26 changed files with 176 additions and 65 deletions
|
|
@ -2856,7 +2856,7 @@ proc genConstSetup(p: BProc; sym: PSym): bool =
|
|||
useHeader(m, sym)
|
||||
if sym.loc.k == locNone:
|
||||
fillBackendName(p.module, sym)
|
||||
fillLoc(sym.loc, locData, sym.ast, OnStatic)
|
||||
fillLoc(sym.loc, locData, sym.astdef, OnStatic)
|
||||
if m.hcrOn: incl(sym.loc.flags, lfIndirect)
|
||||
result = lfNoDecl notin sym.loc.flags
|
||||
|
||||
|
|
@ -2882,7 +2882,7 @@ proc genConstDefinition(q: BModule; p: BProc; sym: PSym) =
|
|||
var data = newRopeAppender()
|
||||
data.addf("N_LIB_PRIVATE NIM_CONST $1 $2 = ",
|
||||
[getTypeDesc(q, sym.typ), actualConstName])
|
||||
genBracedInit(q.initProc, sym.ast, isConst = true, sym.typ, data)
|
||||
genBracedInit(q.initProc, sym.astdef, isConst = true, sym.typ, data)
|
||||
data.addf(";$n", [])
|
||||
q.s[cfsData].add data
|
||||
if q.hcrOn:
|
||||
|
|
@ -2942,7 +2942,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
|
|||
of skConst:
|
||||
if isSimpleConst(sym.typ):
|
||||
var lit = newRopeAppender()
|
||||
genLiteral(p, sym.ast, sym.typ, lit)
|
||||
genLiteral(p, sym.astdef, sym.typ, lit)
|
||||
putIntoDest(p, d, n, lit, OnStatic)
|
||||
elif useAliveDataFromDce in p.module.flags:
|
||||
genConstHeader(p.module, p.module, p, sym)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue