mirror of https://github.com/aamine/cbc
32 lines
903 B
Java
32 lines
903 B
Java
package net.loveruby.cflat.entity;
|
|
import net.loveruby.cflat.ast.TypeNode;
|
|
import net.loveruby.cflat.ast.ExprNode;
|
|
|
|
public class Constant extends Entity {
|
|
private TypeNode type;
|
|
private String name;
|
|
private ExprNode value;
|
|
|
|
public Constant(TypeNode type, String name, ExprNode value) {
|
|
super(true, type, name);
|
|
this.value = value;
|
|
}
|
|
|
|
public boolean isAssignable() { return false; }
|
|
public boolean isDefined() { return true; }
|
|
public boolean isInitialized() { return true; }
|
|
public boolean isConstant() { return true; }
|
|
|
|
public ExprNode value() { return value; }
|
|
|
|
protected void _dump(net.loveruby.cflat.ast.Dumper d) {
|
|
d.printMember("name", name);
|
|
d.printMember("typeNode", typeNode);
|
|
d.printMember("value", value);
|
|
}
|
|
|
|
public <T> T accept(EntityVisitor<T> visitor) {
|
|
return visitor.visit(this);
|
|
}
|
|
}
|