(
self,
stmt: MacroIfStmt,
uop: CodeSection,
storage: Storage,
inst: Instruction | None,
)
| 597 | |
| 598 | |
| 599 | def emit_MacroIfStmt( |
| 600 | self, |
| 601 | stmt: MacroIfStmt, |
| 602 | uop: CodeSection, |
| 603 | storage: Storage, |
| 604 | inst: Instruction | None, |
| 605 | ) -> tuple[bool, Token | None, Storage]: |
| 606 | self.out.emit(stmt.condition) |
| 607 | branch = stmt.else_ is not None |
| 608 | reachable = True |
| 609 | if_storage = storage |
| 610 | else_storage = storage.copy() |
| 611 | for s in stmt.body: |
| 612 | r, tkn, if_storage = self._emit_stmt(s, uop, if_storage, inst) |
| 613 | if tkn is not None: |
| 614 | self.out.emit(tkn) |
| 615 | if not r: |
| 616 | reachable = False |
| 617 | if branch: |
| 618 | assert stmt.else_ is not None |
| 619 | self.out.emit(stmt.else_) |
| 620 | assert stmt.else_body is not None |
| 621 | for s in stmt.else_body: |
| 622 | r, tkn, else_storage = self._emit_stmt(s, uop, else_storage, inst) |
| 623 | if tkn is not None: |
| 624 | self.out.emit(tkn) |
| 625 | if not r: |
| 626 | reachable = False |
| 627 | else_storage.merge(if_storage, self.out) |
| 628 | storage = if_storage |
| 629 | else: |
| 630 | if_storage.merge(else_storage, self.out) |
| 631 | storage = else_storage |
| 632 | self.out.emit(stmt.endif) |
| 633 | return reachable, None, storage |
| 634 | |
| 635 | |
| 636 | def emit_IfStmt( |
nothing calls this directly
no test coverage detected