From cf3d206b9e0c4afea9944954199cc2b7dabe1c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20D=C3=B6ring?= Date: Tue, 30 Oct 2018 16:35:48 +0100 Subject: [PATCH] undo try break --- compiler/ccgstmts.nim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 9015c57a58..3665a7e85d 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -875,15 +875,16 @@ proc genTryCpp(p: BProc, t: PNode, d: var TLoc) = discard pop(p.nestedTryStmts) if t[^1].kind == nkFinally: - if catchAllPresent: - genSimpleBlock(p, t[^1][0]) - else: + # c++ does not have finally, therefore code needs to be generated twice + if not catchAllPresent: # finally requires catch all presence startBlock(p, "catch (...) {$n") - genSimpleBlock(p, t[^1][0]) + genStmts(p, t[^1][0]) line(p, cpsStmts, ~"throw;$n") endBlock(p) + genSimpleBlock(p, t[^1][0]) + proc genTry(p: BProc, t: PNode, d: var TLoc) = # code to generate: #