Get the cell-relative index of a free variable. Returns ncells + freevar_idx. Fixed up to localsplus index during finalize.
(&mut self, name: &str)
| 765 | /// Get the cell-relative index of a free variable. |
| 766 | /// Returns ncells + freevar_idx. Fixed up to localsplus index during finalize. |
| 767 | fn get_free_var_index(&mut self, name: &str) -> CompileResult<oparg::VarNum> { |
| 768 | let info = self.code_stack.last_mut().unwrap(); |
| 769 | let idx = info |
| 770 | .metadata |
| 771 | .freevars |
| 772 | .get_index_of(name) |
| 773 | .unwrap_or_else(|| info.metadata.freevars.insert_full(name.to_owned()).0); |
| 774 | Ok((idx + info.metadata.cellvars.len()).to_u32().into()) |
| 775 | } |
| 776 | |
| 777 | /// Get the cell-relative index of a cell variable. |
| 778 | /// Returns cellvar_idx. Fixed up to localsplus index during finalize. |
no test coverage detected