mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-21 16:31:39 +00:00
fixes #5237
This commit is contained in:
@@ -679,7 +679,7 @@ proc transformCall(c: PTransf, n: PNode): PTransNode =
|
||||
inc(j)
|
||||
add(result, a.PTransNode)
|
||||
if len(result) == 2: result = result[1]
|
||||
elif magic == mNBindSym:
|
||||
elif magic in {mNBindSym, mTypeOf}:
|
||||
# for bindSym(myconst) we MUST NOT perform constant folding:
|
||||
result = n.PTransNode
|
||||
elif magic == mProcCall:
|
||||
@@ -820,7 +820,7 @@ proc transform(c: PTransf, n: PNode): PTransNode =
|
||||
of nkConstSection:
|
||||
# do not replace ``const c = 3`` with ``const 3 = 3``
|
||||
return transformConstSection(c, n)
|
||||
of nkTypeSection:
|
||||
of nkTypeSection, nkTypeOfExpr:
|
||||
# no need to transform type sections:
|
||||
return PTransNode(n)
|
||||
of nkVarSection, nkLetSection:
|
||||
@@ -851,6 +851,7 @@ proc transform(c: PTransf, n: PNode): PTransNode =
|
||||
result = transformSons(c, n)
|
||||
when false:
|
||||
if oldDeferAnchor != nil: c.deferAnchor = oldDeferAnchor
|
||||
|
||||
var cnst = getConstExpr(c.module, PNode(result))
|
||||
# we inline constants if they are not complex constants:
|
||||
if cnst != nil and not dontInlineConstant(n, cnst):
|
||||
|
||||
Reference in New Issue
Block a user