when inserting FlatExit, consider if task body's block node-node pair ends with a...
authorjjenista <jjenista>
Thu, 9 Apr 2009 16:26:12 +0000 (16:26 +0000)
committerjjenista <jjenista>
Thu, 9 Apr 2009 16:26:12 +0000 (16:26 +0000)
Robust/src/IR/Flat/BuildFlat.java

index 902db427a073b8c212ef7e004dfd4e663023b1ce..ce4ad990307d2911ed6ea9c24648dfc34d5e4e52 100644 (file)
@@ -44,10 +44,15 @@ public class BuildFlat {
     NodePair np=flattenBlockNode(bn);
     FlatNode fn=np.getBegin();
     fe=new FlatExit();
-    if (np.getEnd().kind()!=FKind.FlatReturnNode) {
+    FlatNode fn2=np.getEnd();
+    if ( fn2 == null || fn2.kind()!=FKind.FlatReturnNode) {
       FlatReturnNode rnflat=new FlatReturnNode(null);
-      np.getEnd().addNext(rnflat);
       rnflat.addNext(fe);
+      if( fn2 == null ) {
+       np.end = rnflat;
+      } else {
+       fn2.addNext(rnflat);
+      }
     }
 
     FlatFlagActionNode ffan=new FlatFlagActionNode(FlatFlagActionNode.PRE);