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

@ -1652,7 +1652,11 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
else: discard
if result.len == 1 and
c.inTypeClass == 0 and # concept bodies should be preserved as a stmt list
# concept bodies should be preserved as a stmt list:
c.inTypeClass == 0 and
# also, don't make life complicated for macros.
# they will always expect a proper stmtlist:
nfBlockArg notin n.flags and
result.sons[0].kind != nkDefer:
result = result.sons[0]