bugfix: proc bodies as expr

This commit is contained in:
Araq
2012-09-23 09:02:11 +02:00
parent 92e49aeaaf
commit 83b90b941b

View File

@@ -1075,8 +1075,11 @@ proc semProcBody(c: PContext, n: PNode): PNode =
if c.p.resultSym != nil and not isEmptyType(result.typ):
# transform ``expr`` to ``result = expr``, but not if the expr is already
# ``result``:
if result.kind == nkSym and result.sym == c.p.resultSym:
if result.kind == nkSym and result.sym == c.p.resultSym:
nil
elif result.kind == nkNilLit:
# ambiguous :-(
result.typ = nil
else:
var a = newNodeI(nkAsgn, n.info, 2)
a.sons[0] = newSymNode(c.p.resultSym)