pystencils.backend.ast.expressions.PsCast

pystencils.backend.ast.expressions.PsCast#

class pystencils.backend.ast.expressions.PsCast(target_type, operand)#

C-style type cast.

Convert values to another type according to C casting rules. The target type may be None, in which case it will be inferred by the Typifier according to the surrounding type context.

Parameters:
  • target_type (PsType | None) – Target type of the cast, or None if the target type should be inferred from the surrounding context

  • operand (PsExpression) – Expression whose value will be cast

_clone_expr()#

Implementation of expression cloning.

Return type:

PsUnOp

structurally_equal(other)#

Check two ASTs for structural equality.

By default this method checks the node’s type and children. If an AST node has additional internal state, it MUST override this method.

Return type:

bool

Parameters:

other (PsAstNode)