API reference
python:astx:astx.flows.SwitchStmt
class SwitchStmt
SwitchStmt(value: Expr, cases: list[CaseStmt] | ASTNodes[CaseStmt], loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)
Source: packages/astx/src/astx/flows.py:1003
AST class for Switch statements based on Rust's match syntax.
Attributes
-
kind — Kind of value or operation.; Type: ASTKind
-
value — Stored value.; Type: Expr
-
cases — Cases.; Type: ASTNodes[CaseStmt]
-
loc — Type: SourceLocation
-
comment — Type: str
-
parent — Type: Optional[ASTNodes]
-
ref — Type: str
Methods
-
__init__ — Initialize the SwitchStmt instance.
-
__str__ — Return a string representation of the object.
-
get_struct — Return the AST structure of the object.