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

Function dispatch_get_item

compiler/src/main/abi_bridge.rs:127–140  ·  view source on GitHub ↗

GetItem: built-in indexing only, FFI has no bytecode frame to drive instance `__getitem__` dispatch. */

(recv_h: u32, args: &[Val])

Source from the content-addressed store, hash-verified

125
126/* GetItem: built-in indexing only, FFI has no bytecode frame to drive instance `__getitem__` dispatch. */
127fn dispatch_get_item(recv_h: u32, args: &[Val]) -> Result<Val, VmErr> {
128 if args.len() != 1 {
129 return Err(VmErr::TypeMsg(s!("get_item expects 1 index, got ", int args.len() as i64)));
130 }
131 let idx = args[0];
132 with_recv("edge_op get_item: invalid receiver handle", recv_h, |vm, recv| {
133 let stack_before = vm.stack.len();
134 let _ = vm.get_item_builtin(recv, idx)?; // Discard the bool (slice-path indicator).
135 if vm.stack.len() != stack_before + 1 {
136 return Err(VmErr::Runtime("edge_op get_item: get_item left no result"));
137 }
138 vm.stack.pop().ok_or(VmErr::Runtime("edge_op get_item: stack drained mid-dispatch"))
139 })
140}
141
142/* SetItem: built-in item-assignment only, same rationale as `dispatch_get_item`. */
143fn dispatch_set_item(recv_h: u32, args: &[Val]) -> Result<Val, VmErr> {

Callers 1

host_edge_opFunction · 0.85

Calls 4

with_recvFunction · 0.85
get_item_builtinMethod · 0.80
lenMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected