MCPcopy Index your code
hub / github.com/python/mypy / IfStmt

Class IfStmt

mypy/nodes.py:2072–2095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2070
2071
2072class IfStmt(Statement):
2073 __slots__ = ("expr", "body", "else_body", "unreachable_else")
2074
2075 __match_args__ = ("expr", "body", "else_body", "unreachable_else")
2076
2077 expr: list[Expression]
2078 body: list[Block]
2079 else_body: Block | None
2080 # (If there is actually no else statement, semantic analysis may nevertheless create an
2081 # empty else block and mark it permanently as unreachable to tell that the control flow
2082 # must always go through the if block.)
2083 unreachable_else: bool
2084 # (Type checking may modify this flag repeatedly to indicate whether an actually available
2085 # or unavailable else block is unreachable, considering the current type information.)
2086
2087 def __init__(self, expr: list[Expression], body: list[Block], else_body: Block | None) -> None:
2088 super().__init__()
2089 self.expr = expr
2090 self.body = body
2091 self.else_body = else_body
2092 self.unreachable_else = False
2093
2094 def accept(self, visitor: StatementVisitor[T]) -> T:
2095 return visitor.visit_if_stmt(self)
2096
2097
2098class RaiseStmt(Statement):

Callers 4

visit_while_stmtMethod · 0.90
visit_IfMethod · 0.90
visit_if_stmtMethod · 0.90
read_statementFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…