maybe so...

This commit is contained in:
araq
2025-09-18 09:46:42 +02:00
parent 246d200557
commit 8fc33633d6
2 changed files with 26 additions and 6 deletions

View File

@@ -858,12 +858,28 @@ proc genRaiseStmt(p: BProc, t: PNode) =
of excCpp:
blockLeaveActions(p, howManyTrys = 0, howManyExcepts = p.inExceptBlockLen)
of excGoto:
var inExcept = 0
for i in 0..<p.nestedTryStmts.len:
if p.nestedTryStmts[i].inExcept:
inExcept = 1
break
blockLeaveActions(p, howManyTrys = 0, howManyExcepts = inExcept)
#[
There is a difference between:
try:
something()
except:
# bug #25037
try:
let tmp = someValue()
raise E(tmp)
finally:
destroy(tmp)
And:
try:
something()
except:
raise E
]#
if noSafePoints notin p.flags:
p.s(cpsStmts).addCallStmt(cgsymValue(p.module, "popAllButOneCurrentExceptions"))
else:
discard
genLineDir(p, t)

View File

@@ -158,6 +158,10 @@ proc popCurrentException {.compilerRtl, inl.} =
currException = currException.up
#showErrorMessage2 "B"
proc popAllButOneCurrentExceptions {.compilerRtl, inl.} =
while currException != nil and currException.up != nil:
currException = currException.up
proc popCurrentExceptionEx(id: uint) {.compilerRtl.} =
discard "only for bootstrapping compatbility"