How do I get &env data in CLJS-macros?

In clj/cljr I use the following to get all locally defined variables:

(defmacro get-env
  []
  (into {} (for [k (keys &env)]
             [`'~k k])))

E.g. (do (defn a [x] (get-env)) (a 5)) would show me that x is defined to 5.

When trying the same macro in cljs though, I get this:

{:protocol-inline :protocol-inline, :fn-scope :fn-scope, :locals :locals, :repl-env :repl-env, :ns :ns, :def-emits-var :def-emits-var, :protocol-impl :protocol-impl, :column :column, :root-source-info :root-source-info, :line :line, :context :context}

Is there a way in cljs to extract the locally defined variables?

3 Likes