diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ast.nim | 3 | ||||
-rw-r--r-- | compiler/lambdalifting.nim | 4 | ||||
-rw-r--r-- | compiler/transf.nim | 5 |
3 files changed, 7 insertions, 5 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 51dcbc14f..7ebcdddb1 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -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) diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index 69b45c980..d11776cf6 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -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) diff --git a/compiler/transf.nim b/compiler/transf.nim index 39842056f..dddbd51c4 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -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) |