package accrue.analysis.interprocvarcontext;

import polyglot.frontend.ExtensionInfo;
import polyglot.frontend.goals.Goal;
import accrue.analysis.interprocanalysis.AnalysisFactory;
import accrue.analysis.interprocanalysis.InterProcAnalysisPass;
import accrue.analysis.interprocanalysis.Registrar;
import accrue.analysis.interprocanalysis.WorkQueue;

public class InterProcVarContextPass<T extends AbstractValue<T>> extends
        InterProcAnalysisPass<VarContext<T>> {

    protected InterProcVarContextPass(ExtensionInfo extInfo, Goal g,
            Registrar registrar, AnalysisFactory<VarContext<T>> factory) {
        super(extInfo, g, registrar, factory);
    }

    @Override
    protected WorkQueue<VarContext<T>> createWorkQueue() {
        return new WorkQueueVarContext<T>(registrar, extInfo, factory, this);
    }

    @Override
    protected void postSuccessfulProcess(WorkQueue<VarContext<T>> workQueue) {
        super.postSuccessfulProcess(workQueue);
        VarContext.clearHashCons(factory.analysisName());
    }

}
