IR
[repair.git] / Repair / RepairCompiler / MCC / IR / BooleanLiteralExpr.java
1 package MCC.IR;
2
3 import MCC.State;
4
5 public class BooleanLiteralExpr extends LiteralExpr {
6     
7     boolean value;
8     
9     public BooleanLiteralExpr(boolean value) {
10         this.value = value;
11         td = ReservedTypeDescriptor.INT;
12     }
13
14     public boolean getValue() {
15         return value;
16     }
17
18     public void generate(CodeWriter writer, VarDescriptor dest) {
19         writer.outputline("int " + dest.getSafeSymbol() + " = " + (value ? "1" : "0") + ";");
20     }
21
22     public void prettyPrint(PrettyPrinter pp) {
23         pp.output(value ? "true" : "false");
24     }
25
26     public TypeDescriptor typecheck(SemanticAnalyzer sa) {
27         td = ReservedTypeDescriptor.INT;
28         return td;
29     }
30
31 }