Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support more defs

  • Loading branch information...
commit b9e25996b634b5cb1845e6eb85dd90627c3bce84 1 parent e361673
@richhickey richhickey authored
Showing with 16 additions and 6 deletions.
  1. +16 −6 src/datomic/codeq/analyzers/clj.clj
View
22 src/datomic/codeq/analyzers/clj.clj
@@ -30,11 +30,14 @@
ns? (= op 'ns)
defing (and ns
(symbol? op)
- (#{'def 'defn} op))
+ (.startsWith (name op) "def"))
- naming (cond
- ns? (str (second x))
- defing (str (symbol (name ns) (name (second x)))))
+ naming (let [nsym (second x)]
+ (cond
+ ns? (str nsym)
+ defing (if (namespace nsym)
+ (str nsym)
+ (str (symbol (name ns) (name nsym))))))
nameid (when naming (codename->id naming))
@@ -49,7 +52,8 @@
(conj [:db/add codeqid :clj/ns nameid])
defing
- (conj [:db/add codeqid :clj/def nameid])
+ (conj [:db/add codeqid :clj/def nameid]
+ [:db/add codeqid :clj/defop (str op)])
(tempid? nameid)
(conj [:db/add nameid :code/name naming]))]
@@ -91,12 +95,18 @@
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db/doc "codename defined by expression"
+ :db.install/_attribute :db.part/db}]
+ 2 [{:db/id #db/id[:db.part/db]
+ :db/ident :clj/defop
+ :db/valueType :db.type/string
+ :db/cardinality :db.cardinality/one
+ :db/doc "the def form (defn, defmacro etc) used to create this definition"
:db.install/_attribute :db.part/db}]})
(deftype CljAnalyzer []
az/Analyzer
(keyname [a] :clj)
- (revision [a] 1)
+ (revision [a] 2)
(extensions [a] [".clj"])
(schemas [a] (schemas))
(analyze [a db f src] (analyze db f src)))
Please sign in to comment.
Something went wrong with that request. Please try again.