Fixed lot of random bugs. Added code generate strings for expr's.
[repair.git] / Repair / RepairCompiler / MCC / IR / Expr.java
1 package MCC.IR;
2
3 import java.util.*;
4
5 public abstract class Expr {
6     
7     TypeDescriptor td = null;
8
9     public Expr() {}
10     /* Remap this's variables using the remap mapping */
11     public abstract boolean equals(Map remap, Expr e);
12
13     public abstract Set getRequiredDescriptors();
14
15     public abstract void generate(CodeWriter writer, VarDescriptor dest);
16
17     public TypeDescriptor getType() {
18         assert td != null : toString();
19         return td;
20     }
21
22     public String name() {
23         return "?";
24     }
25
26     public abstract TypeDescriptor typecheck(SemanticAnalyzer sa);
27
28     public abstract void prettyPrint(PrettyPrinter pp);
29
30     public Set getInversedRelations() {
31         throw new IRException("unsupported");
32     }
33
34     public DNFRule constructDNF() {
35         return new DNFRule(this);
36     }
37
38     public Descriptor getDescriptor() {
39         return null;
40     }
41
42     public int[] getRepairs(boolean negated) {
43         System.out.println(this.getClass().getName());
44         throw new Error("Unrecognized EXPR");
45     }
46
47     public boolean inverted() {
48         return false;
49     }
50
51     public boolean usesDescriptor(Descriptor rd) {
52         System.out.println(this.getClass().getName());
53         throw new Error("UNIMPLEMENTED");
54     }
55
56 }