]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetApply.java
Fixed an error with recursive definition that is not exported or used
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / ssa / statements / LetApply.java
index 6d139a4d6fda4f1927ac84b9a99f550456503d49..210e3ded3243fc20755dd4553dd19bd309f0d0ba 100644 (file)
@@ -356,6 +356,8 @@ public class LetApply extends LetStatement implements ValRefBinder {
                
         SSABlock headBlock = getParent();
         SSAFunction thisFunction = headBlock.getParent();
+        if(thisFunction == function)
+            return;
                
         /*System.out.println("--- INLINING -------------------------------");
         System.out.println(thisFunction);
@@ -399,7 +401,7 @@ public class LetApply extends LetStatement implements ValRefBinder {
         tailBlock.setExit(headBlock.getExit());
         
         // Merge blocks        
-        thisFunction.mergeBlocks(function);           
+        thisFunction.mergeBlocks(function);
         
         headBlock.setExit(new Jump(function.getFirstBlock().createOccurrence(), 
                 parameters));
@@ -488,4 +490,11 @@ public class LetApply extends LetStatement implements ValRefBinder {
         for(ValRef parameter : parameters)
             visitor.visit(parameter);
     }
+
+    @Override
+    public void cleanup() {
+        function.remove();
+        for(ValRef parameter : parameters)
+            parameter.remove();
+    }
 }