Skip to content

Commit

Permalink
wip; popCurrentException
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Aug 18, 2023
1 parent ade75a1 commit 31ebf67
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/ccgstmts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ proc genTryGoto(p: BProc; t: PNode; d: var TLoc) =
startBlock(p)
# we handled the exception, remember this:
linefmt(p, cpsStmts, "*nimErr_ = NIM_FALSE;$n", [])
linefmt(p, cpsStmts, "#popCurrentException();$n", [])
expr(p, t[i][0], d)
else:
var orExpr = newRopeAppender()
Expand All @@ -1310,9 +1311,9 @@ proc genTryGoto(p: BProc; t: PNode; d: var TLoc) =
startBlock(p, "if ($1) {$n", [orExpr])
# we handled the exception, remember this:
linefmt(p, cpsStmts, "*nimErr_ = NIM_FALSE;$n", [])
linefmt(p, cpsStmts, "#popCurrentException();$n", [])
expr(p, t[i][^1], d)

linefmt(p, cpsStmts, "#popCurrentException();$n", [])
linefmt(p, cpsStmts, "LA$1_:;$n", [nextExcept])
endBlock(p)

Expand Down Expand Up @@ -1435,8 +1436,8 @@ proc genTrySetjmp(p: BProc, t: PNode, d: var TLoc) =
startBlock(p)
if not quirkyExceptions:
linefmt(p, cpsStmts, "$1.status = 0;$n", [safePoint])
expr(p, t[i][0], d)
linefmt(p, cpsStmts, "#popCurrentException();$n", [])
expr(p, t[i][0], d)
endBlock(p)
else:
var orExpr = newRopeAppender()
Expand All @@ -1455,8 +1456,8 @@ proc genTrySetjmp(p: BProc, t: PNode, d: var TLoc) =
startBlock(p, "if ($1) {$n", [orExpr])
if not quirkyExceptions:
linefmt(p, cpsStmts, "$1.status = 0;$n", [safePoint])
expr(p, t[i][^1], d)
linefmt(p, cpsStmts, "#popCurrentException();$n", [])
expr(p, t[i][^1], d)
endBlock(p)
inc(i)
discard pop(p.nestedTryStmts)
Expand Down

0 comments on commit 31ebf67

Please sign in to comment.