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 = "")
| 121 | |
| 122 | |
| 123 | def 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 | |
| 143 | def load_outer_env( |
no test coverage detected
searching dependent graphs…