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

Method set_iop_and_push

compiler/src/modules/vm/ops.rs:184–193  ·  view source on GitHub ↗

Augmented set bitwise: rewrite the left set in place (identity preserved); frozenset rebinds.

(&mut self, a: Val, b: Val, op: OpCode)

Source from the content-addressed store, hash-verified

182
183 // Augmented set bitwise: rewrite the left set in place (identity preserved); frozenset rebinds.
184 pub(crate) fn set_iop_and_push(&mut self, a: Val, b: Val, op: OpCode) -> Result<(), VmErr> {
185 if !matches!(self.heap.get(a), HeapObj::Set(_)) {
186 return self.set_binop_and_push(a, b, op);
187 }
188 let items = self.set_binop_items(a, b, op)?;
189 let mut s = ValSet::with_capacity(items.len());
190 for v in items { s.insert(v, &self.heap); }
191 if let HeapObj::Set(rc) = self.heap.get(a) { *rc.borrow_mut() = s; }
192 self.push(a); Ok(())
193 }
194
195 /* Set comparisons with subset/superset semantics over set/frozenset. */
196 pub(crate) fn set_compare_and_push(&mut self, a: Val, b: Val, op: OpCode) -> Result<(), VmErr> {

Callers 1

handle_bitwiseMethod · 0.80

Calls 6

set_binop_and_pushMethod · 0.80
set_binop_itemsMethod · 0.80
insertMethod · 0.80
pushMethod · 0.80
lenMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected