package net.loveruby.cflat.ast; import net.loveruby.cflat.type.Type; public class AddressNode extends ExprNode { final ExprNode expr; Type type; public AddressNode(ExprNode expr) { this.expr = expr; } public ExprNode expr() { return expr; } public Type type() { if (type == null) throw new Error("type is null"); return type; } /** Decides type of this node. * This method is called from DereferenceChecker. */ public void setType(Type type) { if (this.type != null) throw new Error("type set twice"); this.type = type; } public Location location() { return expr.location(); } protected void _dump(Dumper d) { if (type != null) { d.printMember("type", type); } d.printMember("expr", expr); } public E accept(ASTVisitor visitor) { return visitor.visit(this); } }