diff options
author | Araq <rumpf_a@web.de> | 2017-12-30 00:29:53 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-12-30 00:29:53 +0100 |
commit | 29db57a804e03ac4d9d943ac7cf3966777fa5c8d (patch) | |
tree | 1564ce4a871595cd549694a9a9f2159cd76cfdf0 /compiler | |
parent | b6eeebd993487fad77b2132b10cc2f34a438033f (diff) | |
download | Nim-29db57a804e03ac4d9d943ac7cf3966777fa5c8d.tar.gz |
fixes reported 'proc foo(): int = result' codegen problem
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index a0f519820..51e75e91f 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1425,11 +1425,7 @@ proc semProcBody(c: PContext, n: PNode): PNode = openScope(c) result = semExpr(c, n) 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: - discard - elif result.kind == nkNilLit: + if result.kind == nkNilLit: # or ImplicitlyDiscardable(result): # new semantic: 'result = x' triggers the void context result.typ = nil |