(&mut self, chunk: &crate::modules::parser::SSAChunk, slots: &mut [Val])
| 195 | } |
| 196 | |
| 197 | pub fn store_item(&mut self, chunk: &crate::modules::parser::SSAChunk, slots: &mut [Val]) -> Result<(), VmErr> { |
| 198 | let value = self.pop()?; |
| 199 | let idx_val = self.pop()?; |
| 200 | let cont = self.pop()?; |
| 201 | if !cont.is_heap() { return Err(cold_type("object does not support item assignment")); } |
| 202 | // instance `__setitem__(idx, value)` short-circuits the built-in dispatch. |
| 203 | if self.try_call_dunder(cont, "__setitem__", &[idx_val, value], chunk, slots)?.is_some() { |
| 204 | return Ok(()); |
| 205 | } |
| 206 | self.store_item_builtin(cont, idx_val, value) |
| 207 | } |
| 208 | |
| 209 | /* No-dunder item-assignment path. Used by callers without a bytecode frame (FFI re-entry); also the post-dunder fallback inside `store_item`. */ |
| 210 | pub fn store_item_builtin(&mut self, cont: Val, idx_val: Val, value: Val) -> Result<(), VmErr> { |
no test coverage detected