Don't use eval for doing hooks.

Instead, require -> module/value -> normal function call
This commit is contained in:
Calvin Rose
2026-10-05 09:03:40 -05:00
parent 0e5fdd5309
commit 0809778b41
+5 -3
View File
@@ -5139,9 +5139,11 @@
2)
"z" (fn :z-switch [i &]
(set no-file false)
(import* "./bundle" :prefix "" :exit exit-on-error)
(for i (inc i) (length args)
(eval [(symbol (get args i))]))
(def m (require "./bundle" :exit exit-on-error))
(for j (inc i) (length args)
(def hook (module/value m (symbol (get args j))))
(unless hook (errorf "no hook found for %V" (get args j)))
(hook))
math/inf)
"t" (fn :t-switch [i &]
(set should-repl false)