Skip to content

Commit f588611

Browse files
committed
add macroexpand and macroexpand-1 macros
1 parent 258a4a5 commit f588611

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/clj/cljs/core.clj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
cond-> cond->> as-> some-> some->>
3636

37-
if-some when-some test ns-interns var vswap!])
37+
if-some when-some test ns-interns var vswap! macroexpand-1 macroexpand])
3838
(:require clojure.walk
3939
clojure.set
4040
cljs.compiler
@@ -1972,3 +1972,13 @@
19721972
;; INTERNAL - do not use, only for Node.js
19731973
(defmacro load-file* [f]
19741974
`(. js/goog (~'nodeGlobalRequire ~f)))
1975+
1976+
(defmacro macroexpand-1 [[quote form]]
1977+
`(quote ~(ana/macroexpand-1 &env form)))
1978+
1979+
(defmacro macroexpand [[quote form]]
1980+
(core/let [env &env]
1981+
(core/loop [form' (ana/macroexpand-1 env form)]
1982+
(core/if-not (core/identical? form form')
1983+
(recur (ana/macroexpand-1 env form))
1984+
form'))))

0 commit comments

Comments
 (0)