This commit is contained in:
Araq
2015-07-05 14:35:51 +02:00
parent 0e23ac3680
commit 9a8de7f3a3
3 changed files with 7 additions and 5 deletions

View File

@@ -1006,7 +1006,8 @@ proc newSym*(symKind: TSymKind, name: PIdent, owner: PSym,
result.id = getID()
when debugIds:
registerId(result)
#if result.id < 2000:
#if result.id == 93289:
# writeStacktrace()
# MessageOut(name.s & " has id: " & toString(result.id))
var emptyNode* = newNode(nkEmpty)

View File

@@ -1016,7 +1016,9 @@ proc liftForLoop*(body: PNode): PNode =
...
"""
var L = body.len
internalAssert body.kind == nkForStmt and body[L-2].kind in nkCallKinds
if not (body.kind == nkForStmt and body[L-2].kind in nkCallKinds):
localError(body.info, "ignored invalid for loop")
return body
var call = body[L-2]
result = newNodeI(nkStmtList, body.info)

View File

@@ -465,14 +465,13 @@ proc transformFor(c: PTransf, n: PNode): PTransNode =
var call = n.sons[length - 2]
let labl = newLabel(c, n)
c.breakSyms.add(labl)
result = newTransNode(nkBlockStmt, n.info, 2)
result[0] = newSymNode(labl).PTransNode
if call.typ.isNil:
# see bug #3051
result[1] = newNode(nkEmpty).PTransNode
discard c.breakSyms.pop
return result
c.breakSyms.add(labl)
if call.typ.kind != tyIter and
(call.kind notin nkCallKinds or call.sons[0].kind != nkSym or
call.sons[0].sym.kind != skIterator):
@@ -483,10 +482,10 @@ proc transformFor(c: PTransf, n: PNode): PTransNode =
#echo "transforming: ", renderTree(n)
var stmtList = newTransNode(nkStmtList, n.info, 0)
result[1] = stmtList
var loopBody = transformLoopBody(c, n.sons[length-1])
result[1] = stmtList
discard c.breakSyms.pop
var v = newNodeI(nkVarSection, n.info)