associate assignment nodes that writes to the same height location with corresponding...
[IRC.git] / Robust / src / Analysis / SSJava / FlowDownCheck.java
index 8ff79e398032c8652695b791848a87c93fc22e2b..9cbe54bde105816425298b208b1552548405de42 100644 (file)
@@ -25,6 +25,7 @@ import IR.SymbolTable;
 import IR.TypeDescriptor;
 import IR.TypeExtension;
 import IR.VarDescriptor;
+import IR.Flat.FlatNode;
 import IR.Tree.ArrayAccessNode;
 import IR.Tree.AssignmentNode;
 import IR.Tree.BlockExpressionNode;
@@ -1527,10 +1528,10 @@ public class FlowDownCheck {
       }
       // }
 
-//      System.out.println("dstLocation=" + destLocation);
-//      System.out.println("rhsLocation=" + rhsLocation);
-//      System.out.println("srcLocation=" + srcLocation);
-//      System.out.println("constraint=" + constraint);
+      // System.out.println("dstLocation=" + destLocation);
+      // System.out.println("rhsLocation=" + rhsLocation);
+      // System.out.println("srcLocation=" + srcLocation);
+      // System.out.println("constraint=" + constraint);
 
       if (!CompositeLattice.isGreaterThan(srcLocation, destLocation, generateErrorMessage(cd, an))) {
 
@@ -1544,6 +1545,16 @@ public class FlowDownCheck {
             + " at " + cd.getSourceFileName() + "::" + an.getNumLine());
       }
 
+      if (srcLocation.equals(destLocation)) {
+        // keep it for definitely written analysis
+        Set<FlatNode> flatNodeSet = ssjava.getBuildFlat().getFlatNodeSet(an);
+        for (Iterator iterator = flatNodeSet.iterator(); iterator.hasNext();) {
+          FlatNode fn = (FlatNode) iterator.next();
+          ssjava.addSameHeightWriteFlatNode(fn);
+        }
+
+      }
+
     } else {
       destLocation =
           rhsLocation =
@@ -1576,6 +1587,15 @@ public class FlowDownCheck {
 
       }
 
+      if (srcLocation.equals(destLocation)) {
+        // keep it for definitely written analysis
+        Set<FlatNode> flatNodeSet = ssjava.getBuildFlat().getFlatNodeSet(an);
+        for (Iterator iterator = flatNodeSet.iterator(); iterator.hasNext();) {
+          FlatNode fn = (FlatNode) iterator.next();
+          ssjava.addSameHeightWriteFlatNode(fn);
+        }
+      }
+
     }
 
     return destLocation;