mirror of
https://github.com/janet-lang/janet
synced 2026-10-11 10:11:41 +00:00
Don't use eval for doing hooks.
Instead, require -> module/value -> normal function call
This commit is contained in:
+5
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user