Checking in changes that:
[repair.git] / Repair / RepairCompiler / MCC / IR / RelationInclusion.java
index b31700c8aadd0ce51f0f74004f3e94f02d4a59e4..0615b2528c9b44b224948f8bf31c7849b0ea4b3d 100755 (executable)
@@ -3,7 +3,7 @@ import MCC.Compiler;
 import java.util.*;
 
 public class RelationInclusion extends Inclusion {
-    
+
     Expr leftelementexpr, rightelementexpr;
     RelationDescriptor relation;
 
@@ -33,7 +33,7 @@ public class RelationInclusion extends Inclusion {
     public Expr getLeftExpr() {
         return leftelementexpr;
     }
-    
+
     public Expr getRightExpr() {
         return rightelementexpr;
     }
@@ -73,11 +73,11 @@ public class RelationInclusion extends Inclusion {
             String check = "int " + typesafecheck + " = " ;
 
             if (!(relation.getDomain() instanceof ReservedSetDescriptor)) {
-                check += relation.getDomain().getSafeSymbol() + "_hash->contains(" + ld.getSafeSymbol() + ") && ";
+                check += "SimpleHashcontainskey("+relation.getDomain().getSafeSymbol() + "_hash, "+ld.getSafeSymbol() + ") && ";
             }
 
             if (!(relation.getRange() instanceof ReservedSetDescriptor)) {
-                check += relation.getRange().getSafeSymbol() + "_hash->contains(" + rd.getSafeSymbol() + ") && ";
+                check += "SimpleHashcontainskey("+relation.getRange().getSafeSymbol() +"_hash, "+ rd.getSafeSymbol() + ") && ";
             }
 
             check += "1;"; // terminate boolean expression
@@ -88,19 +88,8 @@ public class RelationInclusion extends Inclusion {
         }
 
         String addeditem = (VarDescriptor.makeNew("addeditem")).getSafeSymbol();
-       /*      if (!Compiler.REPAIR) {
-           writer.outputline("int " + addeditem + ";");
-           if (relation.testUsage(RelationDescriptor.IMAGE)) {
-               writer.outputline(addeditem + " = " + relation.getSafeSymbol() + "_hash->add((int)" + ld.getSafeSymbol() + ", (int)" + rd.getSafeSymbol() + ");");
-           }
-           
-           if (relation.testUsage(RelationDescriptor.INVIMAGE)) {
-               writer.outputline(addeditem + " = " + relation.getSafeSymbol() + "_hashinv->add((int)" + rd.getSafeSymbol() + ", (int)" + ld.getSafeSymbol() + ");");
-           }
-           } else {*/
-           Repair.generate_dispatch(writer, relation, ld.getSafeSymbol(), rd.getSafeSymbol());
-           //  }
-       
+        Repair.generate_dispatch(writer, relation, ld.getSafeSymbol(), rd.getSafeSymbol());
+
         if (RelationInclusion.worklist) {
             writer.outputline("if (" + addeditem + ")");
             writer.startblock(); {
@@ -119,18 +108,18 @@ public class RelationInclusion extends Inclusion {
     public boolean typecheck(SemanticAnalyzer sa) {
         TypeDescriptor ld = leftelementexpr.typecheck(sa);
         TypeDescriptor rd = rightelementexpr.typecheck(sa);
-        
+
         if (ld == null || rd == null) {
             return false;
         }
 
         boolean ok = true;
 
-        /* #ATTN#: this check makes sure that the types match up, 
-           a runtime check needs to made that the set relationships 
+        /* #ATTN#: this check makes sure that the types match up,
+           a runtime check needs to made that the set relationships
            are correct */
 
-        if (ld != relation.getDomain().getType()) { 
+        if (ld != relation.getDomain().getType()) {
             sa.getErrorReporter().report(null, "Type of left element '" + ld.getSymbol() + "' must match domain type '" + relation.getDomain().getType().getSymbol() + "'");
             ok = false;
         }