fixes #5237
This commit is contained in:
parent
4ec0f9305e
commit
b85898cd41
2 changed files with 16 additions and 2 deletions
|
|
@ -679,7 +679,7 @@ proc transformCall(c: PTransf, n: PNode): PTransNode =
|
||||||
inc(j)
|
inc(j)
|
||||||
add(result, a.PTransNode)
|
add(result, a.PTransNode)
|
||||||
if len(result) == 2: result = result[1]
|
if len(result) == 2: result = result[1]
|
||||||
elif magic == mNBindSym:
|
elif magic in {mNBindSym, mTypeOf}:
|
||||||
# for bindSym(myconst) we MUST NOT perform constant folding:
|
# for bindSym(myconst) we MUST NOT perform constant folding:
|
||||||
result = n.PTransNode
|
result = n.PTransNode
|
||||||
elif magic == mProcCall:
|
elif magic == mProcCall:
|
||||||
|
|
@ -820,7 +820,7 @@ proc transform(c: PTransf, n: PNode): PTransNode =
|
||||||
of nkConstSection:
|
of nkConstSection:
|
||||||
# do not replace ``const c = 3`` with ``const 3 = 3``
|
# do not replace ``const c = 3`` with ``const 3 = 3``
|
||||||
return transformConstSection(c, n)
|
return transformConstSection(c, n)
|
||||||
of nkTypeSection:
|
of nkTypeSection, nkTypeOfExpr:
|
||||||
# no need to transform type sections:
|
# no need to transform type sections:
|
||||||
return PTransNode(n)
|
return PTransNode(n)
|
||||||
of nkVarSection, nkLetSection:
|
of nkVarSection, nkLetSection:
|
||||||
|
|
@ -851,6 +851,7 @@ proc transform(c: PTransf, n: PNode): PTransNode =
|
||||||
result = transformSons(c, n)
|
result = transformSons(c, n)
|
||||||
when false:
|
when false:
|
||||||
if oldDeferAnchor != nil: c.deferAnchor = oldDeferAnchor
|
if oldDeferAnchor != nil: c.deferAnchor = oldDeferAnchor
|
||||||
|
|
||||||
var cnst = getConstExpr(c.module, PNode(result))
|
var cnst = getConstExpr(c.module, PNode(result))
|
||||||
# we inline constants if they are not complex constants:
|
# we inline constants if they are not complex constants:
|
||||||
if cnst != nil and not dontInlineConstant(n, cnst):
|
if cnst != nil and not dontInlineConstant(n, cnst):
|
||||||
|
|
|
||||||
13
tests/vm/textensionmap.nim
Normal file
13
tests/vm/textensionmap.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
# bug #5237
|
||||||
|
|
||||||
|
import tables
|
||||||
|
import sets
|
||||||
|
import sequtils
|
||||||
|
|
||||||
|
|
||||||
|
const EXTENSIONMAP = {
|
||||||
|
"c": @["*.c", "*.h"],
|
||||||
|
}.toTable()
|
||||||
|
|
||||||
|
const EXTENSIONS = toSet(concat(toSeq(EXTENSIONMAP.values())))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue