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

Method emit_BlockStmt

Tools/cases_generator/generators_common.py:677–701  ·  view source on GitHub ↗

Returns (reachable?, closing '}', stack).

(
        self,
        stmt: BlockStmt,
        uop: CodeSection,
        storage: Storage,
        inst: Instruction | None,
        emit_braces: bool = True,
    )

Source from the content-addressed store, hash-verified

675 raise analysis_error(ex.args[0], rbrace) from None
676
677 def emit_BlockStmt(
678 self,
679 stmt: BlockStmt,
680 uop: CodeSection,
681 storage: Storage,
682 inst: Instruction | None,
683 emit_braces: bool = True,
684 ) -> tuple[bool, Token | None, Storage]:
685 """ Returns (reachable?, closing '}', stack)."""
686 tkn: Token | None = None
687 try:
688 if emit_braces:
689 self.out.emit(stmt.open)
690 reachable = True
691 for s in stmt.body:
692 reachable, tkn, storage = self._emit_stmt(s, uop, storage, inst)
693 if tkn is not None:
694 self.out.emit(tkn)
695 if not reachable:
696 break
697 return reachable, stmt.close, storage
698 except StackError as ex:
699 if tkn is None:
700 tkn = stmt.close
701 raise analysis_error(ex.args[0], tkn) from None
702
703 def emit_ForStmt(
704 self,

Callers 1

emit_tokensMethod · 0.95

Calls 3

_emit_stmtMethod · 0.95
analysis_errorFunction · 0.90
emitMethod · 0.45

Tested by

no test coverage detected