mirror of https://github.com/aamine/cbc
31 lines
709 B
Java
31 lines
709 B
Java
package net.loveruby.cflat.ast;
|
|
import net.loveruby.cflat.type.*;
|
|
|
|
public class AddressNode extends UnaryOpNode {
|
|
protected Type type;
|
|
|
|
public AddressNode(ExprNode n) {
|
|
super("&", n);
|
|
}
|
|
|
|
public void setExpr(ExprNode expr) {
|
|
this.expr = expr;
|
|
}
|
|
|
|
public Type type() {
|
|
if (type == null) throw new Error("type is null");
|
|
return type;
|
|
}
|
|
|
|
/** Decides type of this node.
|
|
* This method is called in TypeChecker. */
|
|
public void setType(Type type) {
|
|
if (this.type != null) throw new Error("type set twice");
|
|
this.type = type;
|
|
}
|
|
|
|
public <S,E> E accept(ASTVisitor<S,E> visitor) {
|
|
return visitor.visit(this);
|
|
}
|
|
}
|