Get the type and value of the given local in this frame. # Panics Panics if the index is out-of-range (greater than `num_locals()`).
(&self, mut store: impl AsContextMut, index: u32)
| 583 | /// Panics if the index is out-of-range (greater than |
| 584 | /// `num_locals()`). |
| 585 | pub fn local(&self, mut store: impl AsContextMut, index: u32) -> Result<Val> { |
| 586 | let store = store.as_context_mut(); |
| 587 | let frame_data = self.frame_data(store.0.as_store_opaque())?; |
| 588 | let (offset, ty) = frame_data.locals[usize::try_from(index).unwrap()]; |
| 589 | let slot_addr = frame_data.slot_addr(self.cursor.frame().fp()); |
| 590 | // SAFETY: compiler produced metadata to describe this local |
| 591 | // slot and stored a value of the correct type into it. Slot |
| 592 | // address is valid because we checked liveness of the |
| 593 | // activation/frame via `frame_data` above. |
| 594 | Ok(unsafe { read_value(store.0.as_store_opaque(), slot_addr, offset, ty) }) |
| 595 | } |
| 596 | |
| 597 | /// Get the type and value of the given operand-stack value in |
| 598 | /// this frame. |
nothing calls this directly
no test coverage detected