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

Method call_any

compiler/src/modules/vm/builtins/sequence.rs:500–513  ·  view source on GitHub ↗
(&mut self, op: u16)

Source from the content-addressed store, hash-verified

498 }
499
500 pub fn call_any(&mut self, op: u16) -> Result<(), VmErr> {
501 if op != 1 { return Err(cold_type("any() takes exactly 1 argument")); }
502 let o = self.pop()?;
503 let mut cur = self.iter_cursor(o)?;
504 while let Some(v) = cur.next(&mut self.heap)? {
505 self.charge_step()?; // native iteration over a huge range must charge the op-budget
506 if self.truthy(v) {
507 self.push(Val::bool(true));
508 return Ok(());
509 }
510 }
511 self.push(Val::bool(false));
512 Ok(())
513 }
514
515 // Materialise an iterable to a list, strings -> chars, ranges eager, coroutines drained.
516 pub fn call_list(&mut self, argc: u16, chunk: &crate::modules::parser::SSAChunk, slots: &mut [Val]) -> Result<(), VmErr> {

Callers 2

handle_functionMethod · 0.80
dispatch_nativeMethod · 0.80

Calls 7

cold_typeFunction · 0.85
iter_cursorMethod · 0.80
nextMethod · 0.80
charge_stepMethod · 0.80
truthyMethod · 0.80
pushMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected