Skip to content

wake.ir.yul.break_statement module #

YulBreak class #

Bases: YulStatementAbc

Break statement can be used in a body of a YulForLoop to exit the loop early.

Example

assembly {
    for { let i := 0 } lt(i, 10) { i := add(i, 1) } {
        // ...
        break
    }
}
Source code in wake/ir/yul/break_statement.py
class YulBreak(YulStatementAbc):
    """
    Break statement can be used in a body of a [YulForLoop][wake.ir.yul.for_loop.YulForLoop] to exit the loop early.

    !!! example
        ```solidity
        assembly {
            for { let i := 0 } lt(i, 10) { i := add(i, 1) } {
                // ...
                break
            }
        }
        ```
    """

    _parent: weakref.ReferenceType[YulBlock]

    @property
    def parent(self) -> YulBlock:
        """
        Returns:
            Parent IR node.
        """
        return super().parent

    @property
    def modifies_state(
        self,
    ) -> Set[Tuple[Union[ExpressionAbc, StatementAbc, YulAbc], ModifiesStateFlag]]:
        return set()

parent: YulBlock property #

Returns:

Type Description
YulBlock

Parent IR node.