Ensures that there are at least `n` elements in the value stack, and returns the index calculated by: stack length minus `n`.
(&self, n: usize)
| 330 | /// Ensures that there are at least `n` elements in the value stack, |
| 331 | /// and returns the index calculated by: stack length minus `n`. |
| 332 | pub fn ensure_index_at(&self, n: usize) -> Result<usize> { |
| 333 | if self.len() >= n { |
| 334 | Ok(self.len() - n) |
| 335 | } else { |
| 336 | Err(format_err!(CodeGenError::missing_values_in_stack())) |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | /// Returns true if the stack contains a local with the provided index |
| 341 | /// except if the only time the local appears is the top element. |
no test coverage detected