Fixed some analysis problems...
[repair.git] / Repair / RepairCompiler / MCC / IR / CastExpr.java
index 83a1ddb2f18203bd280fd0f7c91917f5dbc7fdbe..263460f5bc1667bef1152f9342da9c96fbe8a785 100755 (executable)
@@ -7,11 +7,65 @@ public class CastExpr extends Expr {
     TypeDescriptor type;
     Expr expr;
 
+    public boolean isValue(TypeDescriptor td) {
+       if (td==null) /* Don't know type */
+           return false;
+       if (!td.isSubtypeOf(type)) /* Not subtype of us */
+           return false;
+       return expr.isValue(td);
+    }
+
+    public SetDescriptor getSet() {
+       return expr.getSet();
+    }
+
+    public Set freeVars() {
+       return expr.freeVars();
+    }
+
+    public Expr getExpr() {
+       return expr;
+    }
+
+    public boolean isInvariant(Set vars) {
+       return false;
+    }
+
+    public Set findInvariants(Set vars) {
+       return expr.findInvariants(vars);
+    }
+
     public CastExpr(TypeDescriptor type, Expr expr) {
         this.type = type;
         this.expr = expr;
     }
 
+    public String name() {
+       String str="";
+       str="(("+type.toString()+")"+expr.name()+")";
+       return str;
+    }
+
+    public boolean equals(Map remap, Expr e) {
+       if (e==null)
+           return false;
+       else if (!(e instanceof CastExpr))
+           return false;
+       else return ((this.type==((CastExpr)e).type)&&expr.equals(remap,((CastExpr)e).expr));
+    }
+
+    public void findmatch(Descriptor d, Set s) {
+       expr.findmatch(d,s);
+    }
+
+    public Set useDescriptor(Descriptor d) {
+       return expr.useDescriptor(d);
+    }
+
+    public boolean usesDescriptor(Descriptor d) {
+       return expr.usesDescriptor(d);
+    }
+
     public Set getRequiredDescriptors() {
         return expr.getRequiredDescriptors();
     }
@@ -43,17 +97,7 @@ public class CastExpr extends Expr {
             sa.getErrorReporter().report(null, "Expression type '" + td.getSymbol() + "' is not a parent of the cast type '" + type.getSymbol() + "'");
             return null;
         }
-
         this.td = type;
         return type;
     }
-
 }
-
-
-
-
-
-
-
-