list.sort(): parse key/reverse kwargs and sort in place. Intercepted from both call paths since it needs chunk/slots for __lt__. */
(&mut self, recv: Val, positional: &[Val], kw_flat: &[Val], chunk: &SSAChunk, slots: &mut [Val])
| 306 | |
| 307 | /* list.sort(): parse key/reverse kwargs and sort in place. Intercepted from both call paths since it needs chunk/slots for __lt__. */ |
| 308 | pub(crate) fn exec_sort(&mut self, recv: Val, positional: &[Val], kw_flat: &[Val], chunk: &SSAChunk, slots: &mut [Val]) -> Result<(), VmErr> { |
| 309 | if !positional.is_empty() { |
| 310 | return Err(cold_type("list.sort() takes no positional arguments")); |
| 311 | } |
| 312 | let mut sort_key: Option<Val> = None; |
| 313 | let mut sort_reverse = false; |
| 314 | for pair in kw_flat.chunks(2) { |
| 315 | match self.kw_name(pair[0]) { |
| 316 | Some("key") => sort_key = Some(pair[1]), |
| 317 | Some("reverse") => sort_reverse = self.truthy(pair[1]), |
| 318 | _ => return Err(cold_type("list.sort() got unexpected keyword argument")), |
| 319 | } |
| 320 | } |
| 321 | self.call_list_sort_keyed(recv, sort_key, sort_reverse, chunk, slots) |
| 322 | } |
| 323 | |
| 324 | /* Dispatch non-Func callees. Returns Ok(true) when handled here; Ok(false) means the caller falls through to the Func path. */ |
| 325 | fn try_dispatch_non_func_callable(&mut self, callee: Val, positional: &[Val], kw_flat: &[Val], num_kw: usize, chunk: &SSAChunk, slots: &mut [Val]) -> Result<bool, VmErr> { |
no test coverage detected