(&mut self, rip: usize, cache: &mut OpcodeCache, chunk: &SSAChunk, slots: &mut [Val])
| 98 | } |
| 99 | |
| 100 | fn exec_pos(&mut self, rip: usize, cache: &mut OpcodeCache, chunk: &SSAChunk, slots: &mut [Val]) -> Result<(), VmErr> { |
| 101 | let v = self.pop()?; |
| 102 | // instance `__pos__` takes precedence over numeric coercion. |
| 103 | if let Some(r) = self.try_call_dunder(v, "__pos__", &[], chunk, slots)? { |
| 104 | self.record_dunder_hit(rip, cache, v, "__pos__", 1); |
| 105 | self.push(r); |
| 106 | return Ok(()); |
| 107 | } |
| 108 | let result = if v.is_float() { |
| 109 | v |
| 110 | } else if let Some(i) = self.as_i128(v) { |
| 111 | // bool drops its tag to int; plain ints round-trip unchanged. |
| 112 | self.int_to_val(Some(i))? |
| 113 | } else { |
| 114 | return Err(cold_type("unary + requires a number")); |
| 115 | }; |
| 116 | self.push(result); |
| 117 | Ok(()) |
| 118 | } |
| 119 | |
| 120 | fn exec_mod(&mut self, a: Val, b: Val, chunk: &SSAChunk, slots: &mut [Val]) -> Result<Val, VmErr> { |
| 121 | // `str % args` is printf-style formatting, not modulo. |
no test coverage detected