1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-09 18:29:36 +00:00
kickc/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueHandler.java

26 lines
1.3 KiB
Java

package dk.camelot64.kickc.model.iterator;
import dk.camelot64.kickc.model.ControlFlowBlock;
import dk.camelot64.kickc.model.Graph;
import dk.camelot64.kickc.model.statements.Statement;
import java.util.ListIterator;
/** A handler that performs some action for RValues in the program.
* A {@link }ProgramValueIterator} can be used to iterate all RValues in a part of the program.
* The Handler then receives all program values one at a time. The Handler has the option of replacing the value with another. After the handler is executed all sub-values are recursed.
* The execute() method furthermore receives some extra parameters with information about the context of the passed value.
*/
public interface ProgramValueHandler {
/**
* Handle a single RValue
*
* @param programValue The programValue value
* @param currentStmt The statement iterator - just past the current statement that the value is a part of. Current statment can be retrieved by calling
* @param stmtIt The statement iterator - just past the current statement. Can be used for modifying the control flow block.
* @param currentBlock The current block that the value is a part of
*/
void execute(ProgramValue programValue, Statement currentStmt, ListIterator<Statement> stmtIt, Graph.Block currentBlock);
}