parent
8942586fa6
commit
e9a287fe12
3 changed files with 37 additions and 1 deletions
|
|
@ -289,6 +289,7 @@ proc genArg(p: BProc, n: PNode, param: PSym; call: PNode, needsTmp = false): Rop
|
||||||
else:
|
else:
|
||||||
initLocExprSingleUse(p, n, a)
|
initLocExprSingleUse(p, n, a)
|
||||||
result = rdLoc(withTmpIfNeeded(p, a, needsTmp))
|
result = rdLoc(withTmpIfNeeded(p, a, needsTmp))
|
||||||
|
#assert result != nil
|
||||||
|
|
||||||
proc genArgNoParam(p: BProc, n: PNode, needsTmp = false): Rope =
|
proc genArgNoParam(p: BProc, n: PNode, needsTmp = false): Rope =
|
||||||
var a: TLoc
|
var a: TLoc
|
||||||
|
|
|
||||||
|
|
@ -427,6 +427,7 @@ proc addExprAssgn(ctx: Ctx, output, input: PNode, sym: PSym) =
|
||||||
|
|
||||||
proc convertExprBodyToAsgn(ctx: Ctx, exprBody: PNode, res: PSym): PNode =
|
proc convertExprBodyToAsgn(ctx: Ctx, exprBody: PNode, res: PSym): PNode =
|
||||||
result = newNodeI(nkStmtList, exprBody.info)
|
result = newNodeI(nkStmtList, exprBody.info)
|
||||||
|
if exprBody.typ != nil:
|
||||||
ctx.addExprAssgn(result, exprBody, res)
|
ctx.addExprAssgn(result, exprBody, res)
|
||||||
|
|
||||||
proc newNotCall(g: ModuleGraph; e: PNode): PNode =
|
proc newNotCall(g: ModuleGraph; e: PNode): PNode =
|
||||||
|
|
|
||||||
34
tests/arc/torcmisc.nim
Normal file
34
tests/arc/torcmisc.nim
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
discard """
|
||||||
|
output: '''success'''
|
||||||
|
cmd: "nim c --gc:orc -d:release $file"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #17170
|
||||||
|
|
||||||
|
when true:
|
||||||
|
import asyncdispatch
|
||||||
|
|
||||||
|
type
|
||||||
|
Flags = ref object
|
||||||
|
returnedEof, reading: bool
|
||||||
|
|
||||||
|
proc dummy(): Future[string] {.async.} =
|
||||||
|
result = "foobar"
|
||||||
|
|
||||||
|
proc hello(s: Flags) {.async.} =
|
||||||
|
let buf =
|
||||||
|
try:
|
||||||
|
await dummy()
|
||||||
|
except CatchableError as exc:
|
||||||
|
# When an exception happens here, the Bufferstream is effectively
|
||||||
|
# broken and no more reads will be valid - for now, return EOF if it's
|
||||||
|
# called again, though this is not completely true - EOF represents an
|
||||||
|
# "orderly" shutdown and that's not what happened here..
|
||||||
|
s.returnedEof = true
|
||||||
|
raise exc
|
||||||
|
finally:
|
||||||
|
s.reading = false
|
||||||
|
|
||||||
|
waitFor hello(Flags())
|
||||||
|
echo "success"
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue