Skip to content

Lowering

QASM2 dataclass

QASM2(
    *,
    max_lines: int = 3,
    hint_indent: int = 2,
    hint_show_lineno: bool = True,
    stacktrace: bool = True
)

Bases: LoweringABC[Node]

branch_next_if_not_terminated

branch_next_if_not_terminated(frame: Frame)

Branch to the next block if the current block is not terminated.

This must be used after exhausting the current frame and before popping the frame.

Source code in .venv/lib/python3.12/site-packages/bloqade/qasm2/parse/lowering.py
213
214
215
216
217
218
219
220
221
222
223
def branch_next_if_not_terminated(self, frame: lowering.Frame):
    """Branch to the next block if the current block is not terminated.

    This must be used after exhausting the current frame and before popping the frame.
    """
    if not frame.curr_block.last_stmt or not frame.curr_block.last_stmt.has_trait(
        ir.IsTerminator
    ):
        frame.curr_block.stmts.append(
            cf.Branch(arguments=(), successor=frame.next_block)
        )