Skip to content

Commit 7e152fa

Browse files
authored
[mypyc] Refactor: extract IR generation for statements from genops (python#8429)
This makes `mypyc.genfunc` depend on `mypyc.genstatement` which is a little unfortunate. One way to (partially) fix this would be by extracting try statement related code from `mypyc.genstatement`. It doesn't seem urgent, though. Work on mypyc/mypyc#714.
1 parent ac6fc49 commit 7e152fa

File tree

3 files changed

+591
-489
lines changed

3 files changed

+591
-489
lines changed

mypyc/genfunc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from mypyc.sametype import is_same_method_signature
3131
from mypyc.genopsutil import concrete_arg_kind, is_constant, add_self_to_env
3232
from mypyc.genopscontext import FuncInfo, GeneratorClass, ImplicitClass
33+
from mypyc.genstatement import BuildStatementIR
3334

3435
if TYPE_CHECKING:
3536
from mypyc.genops import IRBuilder
@@ -854,7 +855,9 @@ def else_body() -> None:
854855
self.builder.nonlocal_control[-1].gen_break(self.builder, o.line)
855856

856857
self.builder.push_loop_stack(loop_block, done_block)
857-
self.builder.visit_try_except(try_body, [(None, None, except_body)], else_body, o.line)
858+
BuildStatementIR(self.builder).visit_try_except(
859+
try_body, [(None, None, except_body)], else_body, o.line
860+
)
858861
self.builder.pop_loop_stack()
859862

860863
self.builder.goto_and_activate(done_block)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy