diff options
author | Araq <rumpf_a@web.de> | 2012-09-23 09:02:11 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-09-23 09:02:11 +0200 |
commit | 83b90b941b4643cfe55ed3b635177147b2e549ea (patch) | |
tree | e18d60b4bdce24de275f94657e032d39bbcfa34c /compiler | |
parent | 92e49aeaafdfc896a90e5939d05b678db0e275f7 (diff) | |
download | Nim-83b90b941b4643cfe55ed3b635177147b2e549ea.tar.gz |
bugfix: proc bodies as expr
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/semexprs.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 89789f269..a74907384 100755 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -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) |