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

Function load_outer_envs

mypyc/irbuild/env_class.py:171–194  ·  view source on GitHub ↗
(builder: IRBuilder, base: ImplicitClass)

Source from the content-addressed store, hash-verified

169
170
171def load_outer_envs(builder: IRBuilder, base: ImplicitClass) -> None:
172 index = len(builder.builders) - 2
173
174 # Load the first outer environment. This one is special because it gets saved in the
175 # FuncInfo instance's prev_env_reg field.
176 has_outer = index > 1 or (index == 1 and builder.fn_infos[1].contains_nested)
177 if has_outer and builder.fn_infos[index]._env_class is not None:
178 # outer_env = builder.fn_infos[index].environment
179 outer_env = builder.symtables[index]
180 if isinstance(base, GeneratorClass):
181 base.prev_env_reg = load_outer_env(builder, base.curr_env_reg, outer_env)
182 else:
183 base.prev_env_reg = load_outer_env(builder, base.self_reg, outer_env)
184 env_reg = base.prev_env_reg
185 index -= 1
186
187 # Load the remaining outer environments into registers.
188 while index > 1:
189 if builder.fn_infos[index]._env_class is None:
190 break
191 # outer_env = builder.fn_infos[index].environment
192 outer_env = builder.symtables[index]
193 env_reg = load_outer_env(builder, env_reg, outer_env)
194 index -= 1
195
196
197def num_bitmap_args(builder: IRBuilder, args: list[Argument]) -> int:

Callers 2

gen_generator_func_bodyFunction · 0.90
load_env_registersFunction · 0.85

Calls 3

lenFunction · 0.85
isinstanceFunction · 0.85
load_outer_envFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…