3d7f9acc5060c1bd4447ab9f360894dffd414647
[repair.git] / Repair / RepairCompiler / MCC / IR / SizeofExpr.java
1 package MCC.IR;
2
3 import java.util.*;
4
5 public class SizeofExpr extends Expr {
6
7     SetExpr setexpr;
8
9     public SizeofExpr(SetExpr setexpr) {
10         if (setexpr == null) {
11             throw new NullPointerException();
12         }
13
14         this.setexpr = setexpr;
15     }
16
17     public boolean usesDescriptor(RelationDescriptor rd) {
18         return setexpr.usesDescriptor(rd);
19     }
20
21
22     public Descriptor getDescriptor() {
23         return setexpr.getDescriptor();
24     }
25
26     public boolean inverted() {
27         return setexpr.inverted();
28     }
29
30     public SetExpr getSetExpr() {
31         return setexpr;
32     }
33
34     public Set getRequiredDescriptors() {
35         return setexpr.getRequiredDescriptors();
36     }
37
38     public void generate(CodeWriter writer, VarDescriptor dest) {
39         setexpr.generate_size(writer, dest);
40     }
41
42     public void prettyPrint(PrettyPrinter pp) {
43         pp.output("sizeof(");
44         setexpr.prettyPrint(pp);
45         pp.output(")");
46     }
47
48     public TypeDescriptor typecheck(SemanticAnalyzer sa) {
49         this.td = ReservedTypeDescriptor.INT;
50         return this.td;        
51     }
52
53     public Set getInversedRelations() {
54         return setexpr.getInversedRelations();
55     }
56         
57 }