GetItem: built-in indexing only, FFI has no bytecode frame to drive instance `__getitem__` dispatch. */
(recv_h: u32, args: &[Val])
| 125 | |
| 126 | /* GetItem: built-in indexing only, FFI has no bytecode frame to drive instance `__getitem__` dispatch. */ |
| 127 | fn 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`. */ |
| 143 | fn dispatch_set_item(recv_h: u32, args: &[Val]) -> Result<Val, VmErr> { |
no test coverage detected