erlang: Phase 7 capstone — full hot-reload ladder green (+5 eval tests)

This commit is contained in:
2026-05-14 19:29:15 +00:00
parent b5e93df82e
commit 925bbd0d42
5 changed files with 55 additions and 7 deletions

View File

@@ -1967,6 +1967,21 @@
:else
(er-mk-tuple (list (er-mk-atom "module") mod-arg))))))))))
(define er-env-derived-from?
(fn (env target-env)
(cond
(= env target-env) true
:else
(let ((ks (keys env)) (found-ref (list false)))
(for-each
(fn (i)
(when (not (nth found-ref 0))
(let ((v (get env (nth ks i))))
(when (and (er-fun? v) (= (get v :env) target-env))
(set-nth! found-ref 0 true)))))
(range 0 (len ks)))
(nth found-ref 0)))))
(define er-procs-on-env
(fn (target-env)
(let ((all-keys (keys (er-sched-processes)))
@@ -1977,7 +1992,7 @@
(let ((init-fun (get proc :initial-fun)))
(when (and (not (= init-fun nil))
(er-fun? init-fun)
(= (get init-fun :env) target-env)
(er-env-derived-from? (get init-fun :env) target-env)
(not (= (get proc :state) "dead")))
(append! matches (get proc :pid))))))
(range 0 (len all-keys)))