introduce ir nop to fix loop bugs

This commit is contained in:
Alex Zenla
2025-07-24 22:30:18 -07:00
parent 837e0c1b38
commit 69230deefc
11 changed files with 65 additions and 12 deletions

View File

@ -0,0 +1,5 @@
package gay.pizza.pork.bir
object IrNop : IrCodeElement() {
override fun crawl(block: (IrElement) -> Unit) {}
}

View File

@ -30,6 +30,7 @@ interface IrVisitor<T> {
fun visitIrIndex(ir: IrIndex): T
fun visitIrListSize(ir: IrListSize): T
fun visitIrDeclare(ir: IrDeclare): T
fun visitIrNop(ir: IrNop): T
fun visit(ir: IrElement): T = when (ir) {
is IrBreak -> visitIrBeak(ir)
@ -61,5 +62,6 @@ interface IrVisitor<T> {
is IrIndex -> visitIrIndex(ir)
is IrListSize -> visitIrListSize(ir)
is IrDeclare -> visitIrDeclare(ir)
IrNop -> visitIrNop(ir as IrNop)
}
}