MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / store_item

Method store_item

compiler/src/modules/vm/builtins/index.rs:197–207  ·  view source on GitHub ↗
(&mut self, chunk: &crate::modules::parser::SSAChunk, slots: &mut [Val])

Source from the content-addressed store, hash-verified

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> {

Callers 2

dispatch_genericMethod · 0.80
handle_containerMethod · 0.80

Calls 5

cold_typeFunction · 0.85
is_heapMethod · 0.80
try_call_dunderMethod · 0.80
store_item_builtinMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected