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

Function load_env_registers

mypyc/irbuild/env_class.py:123–140  ·  view source on GitHub ↗

Load the registers for the current FuncItem being visited. Adds the arguments of the FuncItem to the environment. If the FuncItem is nested inside of another function, then this also loads all of the outer environments of the FuncItem into registers so that they can be used when acc

(builder: IRBuilder, prefix: str = "")

Source from the content-addressed store, hash-verified

121
122
123def load_env_registers(builder: IRBuilder, prefix: str = "") -> None:
124 """Load the registers for the current FuncItem being visited.
125
126 Adds the arguments of the FuncItem to the environment. If the
127 FuncItem is nested inside of another function, then this also
128 loads all of the outer environments of the FuncItem into registers
129 so that they can be used when accessing free variables.
130 """
131 add_args_to_env(builder, local=True, prefix=prefix)
132
133 fn_info = builder.fn_info
134 fitem = fn_info.fitem
135 if fn_info.is_nested and builder.fn_infos[-2]._env_class is not None:
136 load_outer_envs(builder, fn_info.callable_class)
137 # If this is a FuncDef, then make sure to load the FuncDef into its own environment
138 # class so that the function can be called recursively.
139 if isinstance(fitem, FuncDef) and fn_info.add_nested_funcs_to_env:
140 setup_func_for_recursive_call(builder, fitem, fn_info.callable_class, prefix=prefix)
141
142
143def load_outer_env(

Callers 2

gen_func_bodyFunction · 0.90
gen_generator_funcFunction · 0.90

Calls 4

add_args_to_envFunction · 0.85
load_outer_envsFunction · 0.85
isinstanceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…