Skip to content

Split ifs

LiftThenBody dataclass

LiftThenBody(
    exclude_stmts: tuple[type[Statement], ...] = tuple(),
)

Bases: RewriteRule


              flowchart TD
              bloqade.rewrite.rules.split_ifs.LiftThenBody[LiftThenBody]

              

              click bloqade.rewrite.rules.split_ifs.LiftThenBody href "" "bloqade.rewrite.rules.split_ifs.LiftThenBody"
            

Lifts anything that's not in the exclude_stmts in the then body

Parameters:

Name Type Description Default
exclude_stmts tuple[type[Statement], ...]

A tuple of statement types that should not be lifted from the then body. Defaults to an empty tuple, meaning all statements are lifted.

tuple()

SplitIfStmts

Bases: RewriteRule


              flowchart TD
              bloqade.rewrite.rules.split_ifs.SplitIfStmts[SplitIfStmts]

              

              click bloqade.rewrite.rules.split_ifs.SplitIfStmts href "" "bloqade.rewrite.rules.split_ifs.SplitIfStmts"
            

Splits the then body of an if-else statement into multiple if statements