]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetFunctions.java
Added memory leak test and fixed the leak by removing references
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / ssa / statements / LetFunctions.java
index cf46899f645b48b2b516c5a895c56b25cb566390..dc6a8580d713cc8c579ef1cbdfb45aad24dd34ea 100644 (file)
@@ -164,6 +164,7 @@ public class LetFunctions extends SSAStatement implements ClosureBinder {
                 BoundVar newVar = varMap.get(var);
                 if(newVar == null) {
                     newVar = new BoundVar(var.getType());
+                    newVar.setLabel(var.getLabel());
                     oldVarsList.add(var);
                     newVarsList.add(newVar);
                     varMap.put(var, newVar);
@@ -211,7 +212,7 @@ public class LetFunctions extends SSAStatement implements ClosureBinder {
             inVarsMap.put(closure, inVars);
             varMap.put(closure, map);
             
-            closure.parametrize(inVars);            
+            closure.parametrize(inVars);
             SCLConstant functionConstant = new SCLConstant(context.createName(), closure.getType());
             context.addConstant(functionConstant);   
             oldTargets.put(closure, (BoundVar)closure.getTarget());
@@ -274,4 +275,10 @@ public class LetFunctions extends SSAStatement implements ClosureBinder {
         for(SSAClosure closure = firstClosure; closure != null; closure = closure.getNext())
             closure.forValRefs(visitor);    
     }
+
+    @Override
+    public void cleanup() {
+        for(SSAClosure closure = firstClosure; closure != null; closure = closure.getNext())
+            closure.cleanup();
+    }
 }