Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
slangmgh authored and Araq committed Jan 19, 2020
1 parent 8d64550 commit 13ddbc4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/ccgstmts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,8 @@ proc genTryGoto(p: BProc; t: PNode; d: var TLoc) =
p.nestedTryStmts.add((fin, false, Natural lab))

p.flags.incl nimErrorFlagAccessed
linefmt(p, cpsStmts, "NI oldNimErr$1_ = *nimErr_; *nimErr_ = 0;;$n", [lab])
p.procSec(cpsLocals).add(ropecg(p.module, "NI oldNimErr$1_;$n", [lab]))
linefmt(p, cpsStmts, "oldNimErr$1_ = *nimErr_; *nimErr_ = 0;;$n", [lab])

expr(p, t[0], d)

Expand Down Expand Up @@ -1104,7 +1105,8 @@ proc genTryGoto(p: BProc; t: PNode; d: var TLoc) =
genStmts(p, t[i][0])
else:
# pretend we did handle the error for the safe execution of the 'finally' section:
linefmt(p, cpsStmts, "NI oldNimErrFin$1_ = *nimErr_; *nimErr_ = 0;$n", [lab])
p.procSec(cpsLocals).add(ropecg(p.module, "NI oldNimErrFin$1_;$n", [lab]))
linefmt(p, cpsStmts, "oldNimErrFin$1_ = *nimErr_; *nimErr_ = 0;$n", [lab])
genStmts(p, t[i][0])
# this is correct for all these cases:
# 1. finally is run during ordinary control flow
Expand Down

0 comments on commit 13ddbc4

Please sign in to comment.