1 package polyglot.ext.jl.ast; 2 3 import polyglot.ast.*; 4 import polyglot.types.*; 5 import polyglot.visit.*; 6 import polyglot.util.*; 7 8 11 public class BooleanLit_c extends Lit_c implements BooleanLit 12 { 13 protected boolean value; 14 15 public BooleanLit_c(Position pos, boolean value) { 16 super(pos); 17 this.value = value; 18 } 19 20 21 public boolean value() { 22 return this.value; 23 } 24 25 26 public BooleanLit value(boolean value) { 27 BooleanLit_c n = (BooleanLit_c) copy(); 28 n.value = value; 29 return n; 30 } 31 32 33 public Node typeCheck(TypeChecker tc) throws SemanticException { 34 return type(tc.typeSystem().Boolean()); 35 } 36 37 public String toString() { 38 return String.valueOf(value); 39 } 40 41 42 public void prettyPrint(CodeWriter w, PrettyPrinter tr) { 43 w.write(String.valueOf(value)); 44 } 45 46 47 public void dump(CodeWriter w) { 48 super.dump(w); 49 50 w.allowBreak(4, " "); 51 w.begin(0); 52 w.write("(value " + value + ")"); 53 w.end(); 54 } 55 56 public Object constantValue() { 57 return Boolean.valueOf(value); 58 } 59 } 60 | Popular Tags |