fixes reported 'proc foo(): int = result' codegen problem
This commit is contained in:
parent
b6eeebd993
commit
29db57a804
1 changed files with 1 additions and 5 deletions
|
|
@ -1425,11 +1425,7 @@ proc semProcBody(c: PContext, n: PNode): PNode =
|
||||||
openScope(c)
|
openScope(c)
|
||||||
result = semExpr(c, n)
|
result = semExpr(c, n)
|
||||||
if c.p.resultSym != nil and not isEmptyType(result.typ):
|
if c.p.resultSym != nil and not isEmptyType(result.typ):
|
||||||
# transform ``expr`` to ``result = expr``, but not if the expr is already
|
if result.kind == nkNilLit:
|
||||||
# ``result``:
|
|
||||||
if result.kind == nkSym and result.sym == c.p.resultSym:
|
|
||||||
discard
|
|
||||||
elif result.kind == nkNilLit:
|
|
||||||
# or ImplicitlyDiscardable(result):
|
# or ImplicitlyDiscardable(result):
|
||||||
# new semantic: 'result = x' triggers the void context
|
# new semantic: 'result = x' triggers the void context
|
||||||
result.typ = nil
|
result.typ = nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue