MCPcopy Index your code
hub / github.com/python/cpython / MacroIfStmt

Class MacroIfStmt

Tools/cases_generator/parsing.py:173–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171
172@dataclass
173class MacroIfStmt(Stmt):
174 condition: lx.Token
175 body: list[Stmt]
176 else_: lx.Token | None
177 else_body: list[Stmt] | None
178 endif: lx.Token
179
180 def print(self, out:CWriter) -> None:
181 out.emit(self.condition)
182 for stmt in self.body:
183 stmt.print(out)
184 if self.else_body is not None:
185 out.emit("#else\n")
186 for stmt in self.else_body:
187 stmt.print(out)
188
189 def accept(self, visitor: Visitor) -> None:
190 visitor(self)
191 for stmt in self.body:
192 stmt.accept(visitor)
193 if self.else_body is not None:
194 for stmt in self.else_body:
195 stmt.accept(visitor)
196
197 def tokens(self) -> Iterator[lx.Token]:
198 yield self.condition
199 for stmt in self.body:
200 yield from stmt.tokens()
201 if self.else_body is not None:
202 for stmt in self.else_body:
203 yield from stmt.tokens()
204
205
206@dataclass

Callers 1

macro_ifMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…