Cleaned-up extract-common-docstring and made it ignore forms in which the second item isn't a symbol.

This commit is contained in:
Nicolas Buduroi 2011-04-27 16:34:08 -04:00
parent 70a0b2f6bc
commit 3f63422e5c

View file

@ -102,17 +102,20 @@
(defn- extract-common-docstring
[form raw nspace-sym]
(let [sym (second form)
_ (if (= 'ns (first form))
(try (require sym)
(catch Exception _)))
nspace (find-ns sym)]
(let [docstring (if nspace
(-> nspace meta :doc)
(get-var-docstring nspace-sym sym))]
[docstring
(strip-docstring docstring raw)
(if nspace sym nspace-sym)])))
(let [sym (second form)]
(if (symbol? sym)
(do
(when (= 'ns (first form))
(try (require sym)
(catch Exception _)))
(let [nspace (find-ns sym)
docstring (if nspace
(-> nspace meta :doc)
(get-var-docstring nspace-sym sym))]
[docstring
(strip-docstring docstring raw)
(if nspace sym nspace-sym)]))
[nil raw nspace-sym])))
(defn- extract-impl-docstring
[fn-body]