changeset 652:c8fcde3337b0

Fix TryFinally without body or finalbody.
author Christian Kamm <kamm incasoftware de>
date Sun, 05 Oct 2008 22:26:25 +0200
parents 5709381df7e8
children 5812d6fac0f0
files gen/statements.cpp
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gen/statements.cpp	Sun Oct 05 18:55:43 2008 +0200
+++ b/gen/statements.cpp	Sun Oct 05 22:26:25 2008 +0200
@@ -511,6 +511,17 @@
     if (global.params.symdebug)
         DtoDwarfStopPoint(loc.linnum);
 
+    // if there's no finalbody or no body, things are simple
+    if (!finalbody) {
+        if (body)
+            body->toIR(p);
+        return;
+    }
+    if (!body) {
+        finalbody->toIR(p);
+        return;
+    }
+
     // create basic blocks
     llvm::BasicBlock* oldend = p->scopeend();
 
@@ -529,6 +540,7 @@
     //
     p->scope() = IRScope(landingpadbb, endbb);
 
+    assert(finalbody);
     gIR->func()->landingPad.addFinally(finalbody);
     gIR->func()->landingPad.push(landingpadbb);
 
@@ -550,7 +562,6 @@
     // do finally block
     //
     p->scope() = IRScope(finallybb,landingpadbb);
-    assert(finalbody);
     finalbody->toIR(p);
 
     // terminate finally