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_cont(c, v) { c.cachedAssertions = c.cachedAssertions.remove(v); }
|
||||||
function del_from_leaf(l, v) { l.cachedAssertions = l.cachedAssertions.remove(v); }
|
function del_from_leaf(l, v) { l.cachedAssertions = l.cachedAssertions.remove(v); }
|
||||||
function del_from_handler(h, vs) {
|
function del_from_handler(h, vs) {
|
||||||
h.cachedCaptures = Bag.change(h.cachedCaptures, vs, -1).bag;
|
let net;
|
||||||
h.callbacks.forEach((cb) => {
|
({bag: h.cachedCaptures, net: net} = Bag.change(h.cachedCaptures, vs, -1));
|
||||||
cb(EVENT_REMOVED, vs);
|
if (net === Bag.PRESENT_TO_ABSENT) {
|
||||||
return true;
|
h.callbacks.forEach((cb) => {
|
||||||
});
|
cb(EVENT_REMOVED, vs);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Index.prototype.adjustAssertion = function(outerValue, delta) {
|
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_leaf (leafcache, _) v = leafcache -= v
|
||||||
del_handler (bag, f_table) vs =
|
del_handler (bag, f_table) vs =
|
||||||
bag[vs] -= 1
|
bag[vs] -= 1
|
||||||
for f in f_table
|
if vs not in bag then
|
||||||
f "-" vs
|
for f in f_table
|
||||||
|
f "-" vs
|
||||||
|
|
||||||
**Definition.** The procedures `addAssertion` and `removeAssertion`
|
**Definition.** The procedures `addAssertion` and `removeAssertion`
|
||||||
install and remove an assertion `v` into the given index,
|
install and remove an assertion `v` into the given index,
|
||||||
|
|
Loading…
Reference in New Issue