Changes:
[IRC.git] / Robust / src / Analysis / CallGraph / CallGraph.java
index c8129723d07b131172621fb5f4d08ea5c9b890ce..72c0232eeb7cb8750a95c384e64b97c0cbde8333 100644 (file)
@@ -7,6 +7,7 @@ import IR.Flat.FKind;
 import java.util.*;
 import IR.ClassDescriptor;
 import IR.MethodDescriptor;
+import IR.TypeDescriptor;
 
 public class CallGraph {
     State state;
@@ -50,6 +51,11 @@ public class CallGraph {
        }
     }
 
+
+    public Set getMethods(MethodDescriptor md, TypeDescriptor type) {
+       return getMethods(md);
+    }
+
     /** Given a call to MethodDescriptor, lists the methods which
         could actually be called due to virtual dispatch. */
     public Set getMethods(MethodDescriptor md) {
@@ -109,7 +115,8 @@ public class CallGraph {
            if (fn.kind()==FKind.FlatCall) {
                FlatCall fc=(FlatCall)fn;
                MethodDescriptor calledmethod=fc.getMethod();
-               Set methodsthatcouldbecalled=getMethods(calledmethod);
+               Set methodsthatcouldbecalled=fc.getThis()==null?getMethods(calledmethod):
+                   getMethods(calledmethod, fc.getThis().getType());
                if (!methodmap.containsKey(md))
                    methodmap.put(md,new HashSet());
                ((HashSet)methodmap.get(md)).addAll(methodsthatcouldbecalled);