Skip to content

Commit

Permalink
Rename to delete-invalid-proxies
Browse files Browse the repository at this point in the history
From delete-dead-proxies, as it doesn't just remove dead proxies, but
also node-to-proxy mappings for nodes inserted into the tree.
  • Loading branch information
ruricolist committed Jan 7, 2025
1 parent df15c6e commit 7566885
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions attrs.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -570,22 +570,24 @@ SHADOW nil, INHERIT T -> Error on shadowing, unless inherited"
(invalidate-subroots *attrs*))
(funcall fn)))

(defun delete-dead-proxies (attrs)
"Delete any node->proxy mappings that point to proxies no longer in the
tree."
(defun delete-invalid-proxies (attrs)
"Delete any invalid node->proxy mappings.
Node-to-proxy mappings are invalid when the proxy is no longer in the
tree, or when the node itself has been inserted into the tree."
(update-subroot-mapping)
(let ((node->proxy (attrs.node->proxy attrs))
(node->subroot (attrs.node->subroot attrs)))
(iter (for (node proxy) in-hashtable node->proxy)
;; Delete proxies that no longer point into the tree.
(unless (@ node->subroot proxy)
(remhash node node->proxy))
;; Delete proxies that have been inserted into the tree.
;; Delete proxies for nodes that have been inserted into the
;; tree.
(when (@ node->subroot node)
(remhash node node->proxy)))))

(defun invalidate-subroots (attrs)
(delete-dead-proxies attrs)
(delete-invalid-proxies attrs)
(let ((subroot->attr-table (attrs.subroot->attr-table attrs))
(subroot->deps (attrs.subroot->deps attrs))
(node->subroot (attrs.node->subroot attrs))
Expand Down

0 comments on commit 7566885

Please sign in to comment.