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:
@@ -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)"))
|
||||
|
||||
|
Reference in New Issue
Block a user