package ovm.services.bytecode.editor;

import ovm.services.bytecode.InstructionBuffer;
import ovm.services.bytecode.InstructionVisitor;
import ovm.services.bytecode.editor.CodeFragmentEditor;

/**
 * An InstructionVisitor that is called upon per-method by an appropriate
 * EditVisitor.Controller. The most common use of this class is via the
 * LinearPassController.
 * @author Filip Pizlo
 */
public abstract class InstructionEditVisitor extends InstructionVisitor {
    /**
     * The editor for the current method.
     */
    protected CodeFragmentEditor cfe;

    public InstructionEditVisitor() {
        super(null);
    }

    public void beginEditing(InstructionBuffer buf_, CodeFragmentEditor cfe_) {
        this.buf = buf_;
	this.cp = buf.getConstantPool();
        this.cfe = cfe_;
    }

    public void endEditing() {
        this.buf = null;
        this.cfe = null;
    }
}
