package polyglot.ext.jl.ast;
import polyglot.ast.*;
import polyglot.types.*;
import polyglot.visit.*;
import polyglot.util.*;
/**
* A <code>BooleanLit</code> represents a boolean literal expression.
*/
public class BooleanLit_c extends Lit_c implements BooleanLit
{
protected boolean value;
public BooleanLit_c(Position pos, boolean value) {
super(pos);
this.value = value;
}
/** Get the value of the expression. */
public boolean value() {
return this.value;
}
/** Set the value of the expression. */
public BooleanLit value(boolean value) {
BooleanLit_c n = (BooleanLit_c) copy();
n.value = value;
return n;
}
/** Type check the expression. */
public Node typeCheck(TypeChecker tc) throws SemanticException {
return type(tc.typeSystem().Boolean());
}
public String toString() {
return String.valueOf(value);
}
/** Write the expression to an output file. */
public void prettyPrint(CodeWriter w, PrettyPrinter tr) {
w.write(String.valueOf(value));
}
/** Dumps the AST. */
public void dump(CodeWriter w) {
super.dump(w);
w.allowBreak(4, " ");
w.begin(0);
w.write("(value " + value + ")");
w.end();
}
public Object constantValue() {
return Boolean.valueOf(value);
}
}