Checking in various changes...
[repair.git] / Repair / RepairCompiler / MCC / IR / SetInclusion.java
index f80c63116045c619663688ad1dcf103f1a94e319..7beefc99eb23e036ea207a7481f2e672d2a926e3 100755 (executable)
@@ -3,14 +3,14 @@ import MCC.Compiler;
 import java.util.*;
 
 public class SetInclusion extends Inclusion {
-    
+
     Expr elementexpr;
     SetDescriptor set;
 
     public String generatedresult = null;
     public String generatedaddeditem = null;
 
-    static boolean worklist = false;
+    public static boolean worklist = false;
     public boolean dostore = true;
 
     public String toString() {
@@ -59,37 +59,34 @@ public class SetInclusion extends Inclusion {
         String addeditem = (VarDescriptor.makeNew("addeditem")).getSafeSymbol();
         generatedaddeditem = addeditem; // allows access to the result of the set addition later.
 
-        // we set equal to one so that if dostore == false the guard in teh 
-        // metainclusion generation for the subrules and sub quantifiers will go on        
-        writer.outputline("int " + addeditem + " = 1;");
+        // we set equal to one so that if dostore == false the guard in teh
+        // metainclusion generation for the subrules and sub quantifiers will go on
+
 
         if (dostore) {
-           writer.outputline(addeditem + " = " + set.getSafeSymbol() + "_hash->add((int)" + vd.getSafeSymbol() 
-                              +  ", (int)" + vd.getSafeSymbol() + ");");
-           
+           /*      if (!Compiler.REPAIR) {
+               writer.outputline("int " + addeditem + " = 1;");
+               writer.outputline(addeditem + " = " + set.getSafeSymbol() + "_hash->add((int)" + vd.getSafeSymbol()
+                                 +  ", (int)" + vd.getSafeSymbol() + ");");
+                                 } else {*/
+               Repair.generate_dispatch(writer, set, vd.getSafeSymbol());
+               //          }
+
             if (SetInclusion.worklist) {
                 writer.outputline("if (" + addeditem + ")");
-                writer.startblock(); {                
+                writer.startblock(); {
                     WorkList.generate_dispatch(writer, set, vd.getSafeSymbol());
                 }
                 writer.endblock();
             }
-            if (Compiler.REPAIR) {
-                writer.outputline("if (" + addeditem + ")");
-                writer.startblock(); {                
-                    Repair.generate_dispatch(writer, set, vd.getSafeSymbol());
-                }
-                writer.endblock();
-            }
-           
-        }
-        
+       }
     }
 
     public boolean typecheck(SemanticAnalyzer sa) {
         TypeDescriptor td = elementexpr.typecheck(sa);
-        
+
         if (td == null) {
+            sa.getErrorReporter().report(null, "No type found for:"+elementexpr);
             return false;
         }
 
@@ -99,7 +96,7 @@ public class SetInclusion extends Inclusion {
             sa.getErrorReporter().report(null, "Type mismatch: attempting to test for types '" + td.getSymbol() + "' in set of type '" + settype.getSymbol() + "'");
             return false;
         }
-        
+
         return true;
     }