mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-10 10:29:36 +00:00
28 lines
760 B
Java
28 lines
760 B
Java
package dk.camelot64.kickc.passes;
|
|
|
|
import dk.camelot64.kickc.model.GraphBaseVisitor;
|
|
import dk.camelot64.kickc.model.Program;
|
|
import dk.camelot64.kickc.model.statements.StatementLabel;
|
|
|
|
/** Asserts that the graph contains no label statements */
|
|
public class Pass2AssertNoLabels extends Pass2SsaAssertion {
|
|
|
|
public Pass2AssertNoLabels(Program program) {
|
|
super(program);
|
|
}
|
|
|
|
@Override
|
|
public void check() throws AssertionFailed {
|
|
|
|
GraphBaseVisitor<Void> checkCalls = new GraphBaseVisitor<Void>() {
|
|
|
|
@Override
|
|
public Void visitJumpTarget(StatementLabel jumpTarget) {
|
|
throw new AssertionFailed("No label statements allowed! " + jumpTarget);
|
|
}
|
|
};
|
|
checkCalls.visitGraph(getGraph());
|
|
}
|
|
|
|
}
|