fix the do notation when used with procs

This commit is contained in:
Zahary Karadjov 2017-04-09 22:59:24 +03:00
commit 987b522071
7 changed files with 59 additions and 11 deletions

View file

@ -90,7 +90,11 @@ proc evalTemplateArgs(n: PNode, s: PSym; fromHlo: bool): PNode =
result = newNodeI(nkArgList, n.info)
for i in 1 .. givenRegularParams:
result.addSon n.sons[i]
let p = n[i]
if p != nil and p.kind == nkDo and s.typ.sons[i].kind in {tyStmt, tyExpr}:
result.addSon p[bodyPos]
else:
result.addSon p
# handle parameters with default values, which were
# not supplied by the user