package accrue.analysis.ext;

import polyglot.ast.Expr;
import polyglot.util.InternalCompilerError;
import polyglot.util.SerialVersionUID;
import accrue.analysis.pointer.RegisterPointerStmtsVisitor;
import accrue.analysis.pointer.StmtRegistrar;

/**
 * The extension to use for any primitive only expression.
 */
public class ExtPrimitiveExpr extends ExtExpr {
    private static final long serialVersionUID = SerialVersionUID.generate();

    @Override
    public void registerPointerStmts(StmtRegistrar registrar,
            RegisterPointerStmtsVisitor v) {
        Expr e = (Expr) this.node();
        if (!e.type().isReference()) return;

        throw new InternalCompilerError("We thought that "
                + e.getClass().getName()
                + " could only have primitive type, but we have " + e);
    }
}
