diff options
-rw-r--r-- | src/clj/clojure/core.clj | 24 | ||||
-rw-r--r-- | src/clj/clojure/genclass.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/zip.clj | 28 |
3 files changed, 27 insertions, 27 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index 89929e02..0d314a5a 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -2943,7 +2943,7 @@ conds (when (and (next body) (map? (first body))) (first body)) body (if conds (next body) body) - conds (or conds ^params) + conds (or conds (meta params)) pre (:pre conds) post (:post conds) body (if post @@ -3172,7 +3172,7 @@ "test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception" [v] - (let [f (:test ^v)] + (let [f (:test (meta v))] (if f (do (f) :ok) :no-test))) @@ -3254,11 +3254,11 @@ (defn print-doc [v] (println "-------------------------") - (println (str (ns-name (:ns ^v)) "/" (:name ^v))) - (prn (:arglists ^v)) - (when (:macro ^v) + (println (str (ns-name (:ns (meta v))) "/" (:name (meta v)))) + (prn (:arglists (meta v))) + (when (:macro (meta v)) (println "Macro")) - (println " " (:doc ^v))) + (println " " (:doc (meta v)))) (defn find-doc "Prints documentation for any var whose documentation or name @@ -3267,9 +3267,9 @@ (let [re (re-pattern re-string-or-pattern)] (doseq [ns (all-ns) v (sort-by (comp :name meta) (vals (ns-interns ns))) - :when (and (:doc ^v) - (or (re-find (re-matcher re (:doc ^v))) - (re-find (re-matcher re (str (:name ^v))))))] + :when (and (:doc (meta v)) + (or (re-find (re-matcher re (:doc (meta v)))) + (re-find (re-matcher re (str (:name (meta v)))))))] (print-doc v)))) (defn special-form-anchor @@ -3297,7 +3297,7 @@ [nspace] (println "-------------------------") (println (str (ns-name nspace))) - (println " " (:doc ^nspace))) + (println " " (:doc (meta nspace)))) (defmacro doc "Prints documentation for a var or special form given its name" @@ -4307,11 +4307,11 @@ metadata from the name symbol. Returns the var." ([ns #^clojure.lang.Symbol name] (let [v (clojure.lang.Var/intern (the-ns ns) name)] - (when ^name (.setMeta v ^name)) + (when (meta name) (.setMeta v (meta name))) v)) ([ns name val] (let [v (clojure.lang.Var/intern (the-ns ns) name val)] - (when ^name (.setMeta v ^name)) + (when (meta name) (.setMeta v (meta name))) v))) (defmacro while diff --git a/src/clj/clojure/genclass.clj b/src/clj/clojure/genclass.clj index 4947b3b3..1c61e40b 100644 --- a/src/clj/clojure/genclass.clj +++ b/src/clj/clojure/genclass.clj @@ -381,7 +381,7 @@ mm (mapcat #(.getMethods #^Class %) interfaces)) ;extra methods (doseq [[mname pclasses rclass :as msig] methods] - (emit-forwarding-method (str mname) pclasses rclass (:static ^msig) + (emit-forwarding-method (str mname) pclasses rclass (:static (meta msig)) emit-unsupported)) ;expose specified overridden superclass methods (doseq [[local-mname #^java.lang.reflect.Method m] (reduce (fn [ms [[name _ _] m]] diff --git a/src/clj/clojure/zip.clj b/src/clj/clojure/zip.clj index 7423513f..54e8f180 100644 --- a/src/clj/clojure/zip.clj +++ b/src/clj/clojure/zip.clj @@ -61,20 +61,20 @@ (defn branch? "Returns true if the node at loc is a branch" [loc] - ((:zip/branch? ^loc) (node loc))) + ((:zip/branch? (meta loc)) (node loc))) (defn children "Returns a seq of the children of node at loc, which must be a branch" [loc] (if (branch? loc) - ((:zip/children ^loc) (node loc)) + ((:zip/children (meta loc)) (node loc)) (throw (Exception. "called children on a leaf node")))) (defn make-node "Returns a new branch node, given an existing node and new children. The loc is only used to supply the constructor." [loc node children] - ((:zip/make-node ^loc) node children)) + ((:zip/make-node (meta loc)) node children)) (defn path "Returns a seq of nodes leading to this loc" @@ -103,7 +103,7 @@ (with-meta [c {:l [] :pnodes (if path (conj (:pnodes path) node) [node]) :ppath path - :r cnext}] ^loc))))) + :r cnext}] (meta loc)))))) (defn up "Returns the loc of the parent of the node at this loc, or nil if at @@ -116,7 +116,7 @@ [(make-node loc pnode (concat l (cons node r))) (and ppath (assoc ppath :changed? true))] [pnode ppath]) - ^loc))))) + (meta loc)))))) (defn root "zips all the way up and returns the root node, reflecting any @@ -134,14 +134,14 @@ [loc] (let [[node {l :l [r & rnext :as rs] :r :as path}] loc] (when (and path rs) - (with-meta [r (assoc path :l (conj l node) :r rnext)] ^loc)))) + (with-meta [r (assoc path :l (conj l node) :r rnext)] (meta loc))))) (defn rightmost "Returns the loc of the rightmost sibling of the node at this loc, or self" [loc] (let [[node {l :l r :r :as path}] loc] (if (and path r) - (with-meta [(last r) (assoc path :l (apply conj l node (butlast r)) :r nil)] ^loc) + (with-meta [(last r) (assoc path :l (apply conj l node (butlast r)) :r nil)] (meta loc)) loc))) (defn left @@ -149,14 +149,14 @@ [loc] (let [[node {l :l r :r :as path}] loc] (when (and path (seq l)) - (with-meta [(peek l) (assoc path :l (pop l) :r (cons node r))] ^loc)))) + (with-meta [(peek l) (assoc path :l (pop l) :r (cons node r))] (meta loc))))) (defn leftmost "Returns the loc of the leftmost sibling of the node at this loc, or self" [loc] (let [[node {l :l r :r :as path}] loc] (if (and path (seq l)) - (with-meta [(first l) (assoc path :l [] :r (concat (rest l) [node] r))] ^loc) + (with-meta [(first l) (assoc path :l [] :r (concat (rest l) [node] r))] (meta loc)) loc))) (defn insert-left @@ -166,7 +166,7 @@ (let [[node {l :l :as path}] loc] (if (nil? path) (throw (new Exception "Insert at top")) - (with-meta [node (assoc path :l (conj l item) :changed? true)] ^loc)))) + (with-meta [node (assoc path :l (conj l item) :changed? true)] (meta loc))))) (defn insert-right "Inserts the item as the right sibling of the node at this loc, @@ -175,13 +175,13 @@ (let [[node {r :r :as path}] loc] (if (nil? path) (throw (new Exception "Insert at top")) - (with-meta [node (assoc path :r (cons item r) :changed? true)] ^loc)))) + (with-meta [node (assoc path :r (cons item r) :changed? true)] (meta loc))))) (defn replace "Replaces the node at this loc, without moving" [loc node] (let [[_ path] loc] - (with-meta [node (assoc path :changed? true)] ^loc))) + (with-meta [node (assoc path :changed? true)] (meta loc)))) (defn edit "Replaces the node at this loc with the value of (f node args)" @@ -239,13 +239,13 @@ (if (nil? path) (throw (new Exception "Remove at top")) (if (pos? (count l)) - (loop [loc (with-meta [(peek l) (assoc path :l (pop l) :changed? true)] ^loc)] + (loop [loc (with-meta [(peek l) (assoc path :l (pop l) :changed? true)] (meta loc))] (if-let [child (and (branch? loc) (down loc))] (recur (rightmost child)) loc)) (with-meta [(make-node loc (peek pnodes) rs) (and ppath (assoc ppath :changed? true))] - ^loc))))) + (meta loc)))))) (comment |