Present-to-absent check is necessary in assertion removal handler
This commit is contained in:
parent
e9d510d658
commit
fe40d6b804
|
@ -204,11 +204,14 @@ function add_to_handler(h, vs) {
|
|||
function del_from_cont(c, v) { c.cachedAssertions = c.cachedAssertions.remove(v); }
|
||||
function del_from_leaf(l, v) { l.cachedAssertions = l.cachedAssertions.remove(v); }
|
||||
function del_from_handler(h, vs) {
|
||||
h.cachedCaptures = Bag.change(h.cachedCaptures, vs, -1).bag;
|
||||
h.callbacks.forEach((cb) => {
|
||||
cb(EVENT_REMOVED, vs);
|
||||
return true;
|
||||
});
|
||||
let net;
|
||||
({bag: h.cachedCaptures, net: net} = Bag.change(h.cachedCaptures, vs, -1));
|
||||
if (net === Bag.PRESENT_TO_ABSENT) {
|
||||
h.callbacks.forEach((cb) => {
|
||||
cb(EVENT_REMOVED, vs);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Index.prototype.adjustAssertion = function(outerValue, delta) {
|
||||
|
|
|
@ -444,8 +444,9 @@ check followed by zero or more (move, check) pairs.
|
|||
del_leaf (leafcache, _) v = leafcache -= v
|
||||
del_handler (bag, f_table) vs =
|
||||
bag[vs] -= 1
|
||||
for f in f_table
|
||||
f "-" vs
|
||||
if vs not in bag then
|
||||
for f in f_table
|
||||
f "-" vs
|
||||
|
||||
**Definition.** The procedures `addAssertion` and `removeAssertion`
|
||||
install and remove an assertion `v` into the given index,
|
||||
|
|
Loading…
Reference in New Issue