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
|
|
@ -108,7 +108,7 @@ proc semSymGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode =
|
|||
result = symChoice(c, n, s, scClosed)
|
||||
|
||||
proc inlineConst(c: PContext, n: PNode, s: PSym): PNode {.inline.} =
|
||||
result = copyTree(s.ast)
|
||||
result = copyTree(s.astdef)
|
||||
if result.isNil:
|
||||
localError(c.config, n.info, "constant of type '" & typeToString(s.typ) & "' has no value")
|
||||
result = newSymNode(s)
|
||||
|
|
@ -1230,7 +1230,7 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
|
|||
# It is clear that ``[]`` means two totally different things. Thus, we
|
||||
# copy `x`'s AST into each context, so that the type fixup phase can
|
||||
# deal with two different ``[]``.
|
||||
if s.ast.safeLen == 0: result = inlineConst(c, n, s)
|
||||
if s.astdef.safeLen == 0: result = inlineConst(c, n, s)
|
||||
else: result = newSymNode(s, n.info)
|
||||
of tyStatic:
|
||||
if typ.n != nil:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue