Skip to content

wake.ir.statements.placeholder_statement module #

PlaceholderStatement class #

Bases: StatementAbc

Placeholder statements represent _ (underscore) in a modifier body.

Example

_ in the following code:

1
2
3
4
modifier foo() {
    require(msg.sender == owner, "Not owner");
    _;
}

Source code in wake/ir/statements/placeholder_statement.py
class PlaceholderStatement(StatementAbc):
    """
    Placeholder statements represent `_` (underscore) in a modifier body.
    !!! example
        `:::solidity _` in the following code:
        ```solidity linenums="1"
        modifier foo() {
            require(msg.sender == owner, "Not owner");
            _;
        }
        ```
    """

    _ast_node: SolcPlaceholderStatement
    _parent: weakref.ReferenceType[
        Union[Block, DoWhileStatement, ForStatement, IfStatement, WhileStatement]
    ]

    def __init__(
        self,
        init: IrInitTuple,
        placeholder_statement: SolcPlaceholderStatement,
        parent: SolidityAbc,
    ):
        super().__init__(init, placeholder_statement, parent)

    @property
    def parent(
        self,
    ) -> Union[Block, DoWhileStatement, ForStatement, IfStatement, WhileStatement]:
        """
        Returns:
            Parent IR node.
        """
        return super().parent

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

parent: Union[Block, DoWhileStatement, ForStatement, IfStatement, WhileStatement] property #

Returns:

Type Description
Union[Block, DoWhileStatement, ForStatement, IfStatement, WhileStatement]

Parent IR node.