Augmented set bitwise: rewrite the left set in place (identity preserved); frozenset rebinds.
(&mut self, a: Val, b: Val, op: OpCode)
| 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> { |
no test coverage detected