1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-17 06:04:49 +00:00

Merge branch 'master' of github.com:janet-lang/janet

This commit is contained in:
Calvin Rose 2019-06-02 13:28:48 -04:00
commit c20c9cd5d7

View File

@ -1820,8 +1820,8 @@ _fiber is bound to the suspended fiber
:source "repl"})) :source "repl"}))
(defn- env-walk (defn- env-walk
[pred] [pred &opt env]
(def env (fiber/getenv (fiber/current))) (default env (fiber/getenv (fiber/current)))
(def envs @[]) (def envs @[])
(do (var e env) (while e (array/push envs e) (set e (table/getproto e)))) (do (var e env) (while e (array/push envs e) (set e (table/getproto e))))
(def ret-set @{}) (def ret-set @{})
@ -1832,14 +1832,16 @@ _fiber is bound to the suspended fiber
(sort (keys ret-set))) (sort (keys ret-set)))
(defn all-bindings (defn all-bindings
"Get all symbols available in the current environment." "Get all symbols available in an enviroment. Defaults to the current
[] fiber's environment."
(env-walk symbol?)) [&opt env]
(env-walk symbol? env))
(defn all-dynamics (defn all-dynamics
"Get all dynamic bindings in the current fiber." "Get all dynamic bindings in an environment. Defaults to the current
[] fiber's environment."
(env-walk keyword?)) [&opt env]
(env-walk keyword? env))
# Clean up some extra defs # Clean up some extra defs
(put _env 'process/opts nil) (put _env 'process/opts nil)