API reference
python:astx:astx.TypeCastExpr
class TypeCastExpr
TypeCastExpr(expr: Expr, target_type: DataType, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Source: packages/astx/src/astx/types/casting.py:23
Declared as: python:astx:astx.types.casting.TypeCastExpr
AST class for type casting expressions.
Attributes
-
kind — Kind of value or operation.; Type: ASTKind
-
expr — Expression to process.; Type: Expr
-
target_type — Destination type for the conversion.; Type: DataType
-
loc — Type: SourceLocation
-
comment — Type: str
-
parent — Type: Optional[ASTNodes]
-
ref — Type: str
-
nbytes — Type: int
Methods
-
__init__ — Initialize the type-cast expression.
-
__str__ — Return a string representation of the TypeCast expression.
-
get_struct — Return the AST structure of the TypeCast expression.