1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-21 02:37:49 +00:00

Update signature of :missing-symbol hook.

don't take env table as explicit argument - it is already available
as the env table of the fiber.
This commit is contained in:
Calvin Rose
2022-01-27 21:24:01 -06:00
parent 61c8c1e8d2
commit 06f613e40b
2 changed files with 16 additions and 18 deletions

View File

@@ -28,14 +28,14 @@
# missing symbols
(def replacement 10)
(defn lookup-symbol [sym env] (dyn 'replacement))
(defn lookup-symbol [sym] (defglobal sym 10) (dyn sym))
(setdyn :missing-symbol lookup-symbol)
(assert (= (eval-string "(+ a 5)") 15) "lookup missing symbol")
(setdyn :missing-symbol nil)
(setdyn 'a nil)
(assert-error "compile error" (eval-string "(+ a 5)"))