2007-12-24 16:19:51 +08:00
|
|
|
package net.loveruby.cflat.ast;
|
2008-01-01 22:21:26 +08:00
|
|
|
import net.loveruby.cflat.type.*;
|
2007-12-24 16:19:51 +08:00
|
|
|
|
|
|
|
public class AddressNode extends UnaryOpNode {
|
2008-01-01 22:21:26 +08:00
|
|
|
protected Type type;
|
|
|
|
|
2008-01-02 19:53:41 +08:00
|
|
|
public AddressNode(ExprNode n) {
|
2007-12-24 16:19:51 +08:00
|
|
|
super(n);
|
|
|
|
}
|
|
|
|
|
2008-01-01 22:21:26 +08:00
|
|
|
public Type type() {
|
|
|
|
if (type == null) throw new Error("type is null");
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** This method is called in TypeChecker. */
|
|
|
|
public void setType(Type type) {
|
|
|
|
if (this.type != null) throw new Error("type set twice");
|
|
|
|
this.type = type;
|
|
|
|
}
|
|
|
|
|
2007-12-24 16:19:51 +08:00
|
|
|
public void accept(ASTVisitor visitor) {
|
|
|
|
visitor.visit(this);
|
|
|
|
}
|
|
|
|
}
|