Yield in try

This commit is contained in:
Yuriy Glukhov
2018-05-04 15:23:47 +03:00
parent 0ed6c3e476
commit ce63490928
6 changed files with 711 additions and 93 deletions

View File

@@ -1544,7 +1544,7 @@ proc semYield(c: PContext, n: PNode): PNode =
checkSonsLen(n, 1)
if c.p.owner == nil or c.p.owner.kind != skIterator:
localError(n.info, errYieldNotAllowedHere)
elif c.p.inTryStmt > 0 and c.p.owner.typ.callConv != ccInline:
elif oldIterTransf in c.features and c.p.inTryStmt > 0 and c.p.owner.typ.callConv != ccInline:
localError(n.info, errYieldNotAllowedInTryStmt)
elif n.sons[0].kind != nkEmpty:
n.sons[0] = semExprWithType(c, n.sons[0]) # check for type compatibility: