IR
[repair.git] / Repair / RepairCompiler / MCC / IR / SetExpr.java
1 package MCC.IR;
2
3 import java.util.*;
4
5 public class SetExpr extends Expr {
6
7     SetDescriptor sd;
8
9     public SetExpr(SetDescriptor sd) {
10         this.sd = sd;
11     }
12     
13     public SetExpr() {
14         this.sd = null;
15     }
16
17     public Set getRequiredDescriptors() {
18         HashSet v = new HashSet();
19         v.add(sd);
20         return v;
21     }
22
23     public void generate(CodeWriter writer, VarDescriptor vd) {
24         throw new IRException("unsupported");
25     }
26
27     public void generate_set(CodeWriter writer, VarDescriptor vd) {
28         writer.outputline("Set " + vd.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash;");
29     }    
30
31     public void prettyPrint(PrettyPrinter pp) {
32         pp.output(sd.getSafeSymbol());
33     }
34
35     public TypeDescriptor typecheck(SemanticAnalyzer sa) {
36         this.td = sd.getType();
37         return this.td;
38     }
39
40 }