fixes #2051
This commit is contained in:
parent
2a0b543fc3
commit
1e796ed9d9
2 changed files with 5 additions and 1 deletions
|
|
@ -756,6 +756,9 @@ proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode,
|
||||||
else:
|
else:
|
||||||
if callee.kind in skIterators and callee.id == c.p.owner.id:
|
if callee.kind in skIterators and callee.id == c.p.owner.id:
|
||||||
localError(n.info, errRecursiveDependencyX, callee.name.s)
|
localError(n.info, errRecursiveDependencyX, callee.name.s)
|
||||||
|
# error correction, prevents endless for loop elimination in transf.
|
||||||
|
# See bug #2051:
|
||||||
|
result.sons[0] = newSymNode(errorSym(c, n))
|
||||||
if sfNoSideEffect notin callee.flags:
|
if sfNoSideEffect notin callee.flags:
|
||||||
if {sfImportc, sfSideEffect} * callee.flags != {}:
|
if {sfImportc, sfSideEffect} * callee.flags != {}:
|
||||||
incl(c.p.owner.flags, sfSideEffect)
|
incl(c.p.owner.flags, sfSideEffect)
|
||||||
|
|
|
||||||
|
|
@ -492,7 +492,8 @@ proc transformFor(c: PTransf, n: PNode): PTransNode =
|
||||||
var newC = newTransCon(getCurrOwner(c))
|
var newC = newTransCon(getCurrOwner(c))
|
||||||
newC.forStmt = n
|
newC.forStmt = n
|
||||||
newC.forLoopBody = loopBody
|
newC.forLoopBody = loopBody
|
||||||
internalAssert iter.kind == skIterator
|
# this can fail for 'nimsuggest' and 'check':
|
||||||
|
if iter.kind != skIterator: return result
|
||||||
# generate access statements for the parameters (unless they are constant)
|
# generate access statements for the parameters (unless they are constant)
|
||||||
pushTransCon(c, newC)
|
pushTransCon(c, newC)
|
||||||
for i in countup(1, sonsLen(call) - 1):
|
for i in countup(1, sonsLen(call) - 1):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue