fix for return in macro (#9666); fixes #5874

This commit is contained in:
Arne Döring 2019-05-20 12:18:54 +02:00 • committed by Andreas Rumpf
commit aeb6ec27de
5 changed files with 41 additions and 8 deletions

View file

@ -1550,7 +1550,15 @@ proc activate(c: PContext, n: PNode) =
proc maybeAddResult(c: PContext, s: PSym, n: PNode) =
if s.typ.sons[0] != nil and not isInlineIterator(s):
addResult(c, s.typ.sons[0], n.info, s.kind)
let resultType =
if s.kind == skMacro:
if s.typ.sons[0].kind == tyTypeDesc:
s.typ.sons[0]
else:
sysTypeFromName(c.graph, n.info, "NimNode")
else:
s.typ.sons[0]
addResult(c, resultType, n.info, s.kind)
addResultNode(c, n)
proc canonType(c: PContext, t: PType): PType =