summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-09-23 09:02:11 +0200
committerAraq <rumpf_a@web.de>2012-09-23 09:02:11 +0200
commit83b90b941b4643cfe55ed3b635177147b2e549ea (patch)
treee18d60b4bdce24de275f94657e032d39bbcfa34c /compiler
parent92e49aeaafdfc896a90e5939d05b678db0e275f7 (diff)
downloadNim-83b90b941b4643cfe55ed3b635177147b2e549ea.tar.gz
bugfix: proc bodies as expr
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/semexprs.nim5
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)