Skip to content module #

ElementaryTypeNameExpression class #

Bases: ExpressionAbc

May be used:

  • in a FunctionCall type conversion expressions, e.g. address(this),
  • as type argument, e.g. type(uint256).max,
  • as a FunctionCall argument, e.g. abi.decode(x, (uint256)).
Source code in wake/ir/expressions/
class ElementaryTypeNameExpression(ExpressionAbc):
    May be used:

    - in a [FunctionCall][] type conversion expressions, e.g. `:::solidity address(this)`,
    - as `type` argument, e.g. `:::solidity type(uint256).max`,
    - as a [FunctionCall][] argument, e.g. `:::solidity abi.decode(x, (uint256))`.

    _ast_node: SolcElementaryTypeNameExpression
    _parent: SolidityAbc  # TODO: make this more specific

    _type_name: ElementaryTypeName

    def __init__(
        init: IrInitTuple,
        elementary_type_name_expression: SolcElementaryTypeNameExpression,
        parent: SolidityAbc,
        super().__init__(init, elementary_type_name_expression, parent)
        self._type_name = ElementaryTypeName(
            init, elementary_type_name_expression.type_name, self

    def __iter__(self) -> Iterator[IrAbc]:
        yield self
        yield from self._type_name

    def parent(self) -> SolidityAbc:
        return self._parent

    def type_name(self) -> ElementaryTypeName:
            Type name referenced by the expression.
        return self._type_name

    def is_ref_to_state_variable(self) -> bool:
        return False

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

type_name: ElementaryTypeName property #


Type Description

Type name referenced by the expression.