lift parameter-less do block to lambdas

This commit is contained in:
Zahary Karadjov 2017-04-10 21:28:11 +03:00
commit a3f19c87fb
10 changed files with 46 additions and 26 deletions

View file

@ -90,11 +90,7 @@ proc evalTemplateArgs(n: PNode, s: PSym; fromHlo: bool): PNode =
result = newNodeI(nkArgList, n.info)
for i in 1 .. givenRegularParams:
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
result.addSon n[i]
# handle parameters with default values, which were
# not supplied by the user