Skip to content
Browse files

Add rule for removing defmacros; ideally we could whisk them away to …

…a custom generated ns.
  • Loading branch information...
1 parent b4fb0bf commit 17e006cc414bcc4496e0d5f92f675f6d536a444e @lynaghk committed
Showing with 10 additions and 4 deletions.
  1. +1 −2 README.markdown
  2. +7 −2 src/clj/cljx/rules.clj
  3. +2 −0 test/cljx/testns/core.cljx
View
3 README.markdown
@@ -1,8 +1,7 @@
The code is, like, data, bro.
-
-
+CLJX is a static code rewriting tool that emits Clojure and ClojureScript code from a single metadata-annotated codebase.
Misc
View
9 src/clj/cljx/rules.clj
@@ -1,6 +1,6 @@
(ns cljx.rules
(:refer-clojure :exclude [==])
- (:use [clojure.core.logic :only [matche conde pred lvar ==]]))
+ (:use [clojure.core.logic :only [matche conde pred lvar == firsto]]))
(defn- meta-guard [key]
#(-> % meta key (= true)))
@@ -21,7 +21,12 @@
)
#(== % x)]))
+(def remove-defmacro
+ [#(firsto % 'defmacro)
+ #(== % :cljx.core/exclude)])
+
(def cljs-rules [cljs-protocols
- remove-marked-clj])
+ remove-marked-clj
+ remove-defmacro])
View
2 test/cljx/testns/core.cljx
@@ -15,3 +15,5 @@
(reify
clojure.lang.IFn (invoke [_ x] (inc x)))
+
+(defmacro increment [x] `(inc ~x))

0 comments on commit 17e006c

Please sign in to comment.
Something went wrong with that request. Please try again.