changes on global composite assignment translation and pcloc generation
[IRC.git] / Robust / src / Analysis / SSJava / FlowGraph.java
index ca8679831e8d7c3ce1a8b99646c9560cbc0c8367..77ec3d14feef03ac9e4ddb2140a3f757458164d1 100644 (file)
@@ -231,6 +231,10 @@ public class FlowGraph {
     FlowNode fromNode = getFlowNode(fromDescTuple);
     FlowNode toNode = getFlowNode(toDescTuple);
 
+    if (toNode.getDescTuple().get(0).equals(LocationInference.LITERALDESC)) {
+      return;
+    }
+
     // System.out.println("create an edge from " + fromNode + " to " + toNode);
 
     int fromTupleSize = fromDescTuple.size();
@@ -331,8 +335,6 @@ public class FlowGraph {
     }
 
     FlowNode node = mapDescTupleToInferNode.get(tuple);
-    node.setReturn(true);
-
     returnNodeSet.add(node);
   }
 
@@ -465,11 +467,13 @@ public class FlowGraph {
 
       Descriptor localDesc = fn.getDescTuple().get(0);
 
+      System.out.println("descTuple=" + descTuple);
+
       if (fn.isIntermediate()) {
         Location interLoc = new Location(md, localDesc.getSymbol());
         interLoc.setLocDescriptor(localDesc);
         locTuple.add(interLoc);
-      } else if (localDesc.getSymbol().equals(LocationInference.TOPLOC)) {
+      } else if (localDesc.getSymbol().equals(SSJavaAnalysis.TOP)) {
         Location topLoc = new Location(md, Location.TOP);
         topLoc.setLocDescriptor(LocationInference.TOPDESC);
         locTuple.add(topLoc);
@@ -485,15 +489,23 @@ public class FlowGraph {
           if (i == 0) {
             loc = new Location(md, curDesc.getSymbol());
             loc.setLocDescriptor(curDesc);
-            cd = ((VarDescriptor) curDesc).getType().getClassDesc();
+            if (curDesc instanceof VarDescriptor) {
+              cd = ((VarDescriptor) curDesc).getType().getClassDesc();
+            } else {
+              // otherwise it should be the last element
+              cd = null;
+            }
           } else {
             loc = new Location(cd, curDesc.getSymbol());
             loc.setLocDescriptor(curDesc);
 
             if (curDesc instanceof FieldDescriptor) {
               cd = ((FieldDescriptor) curDesc).getType().getClassDesc();
-            } else {
+            } else if (curDesc instanceof LocationDescriptor) {
               cd = ((LocationDescriptor) curDesc).getEnclosingClassDesc();
+            } else {
+              // otherwise it should be the last element of the tuple
+              cd = null;
             }
 
           }