Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit 20e4e45

Browse files
Stuart SierraChouser
authored andcommitted
Remove deprecated ^ reader macro from core sources; refs #215
Signed-off-by: Chouser <chouser@n01se.net>
1 parent d7cc05c commit 20e4e45

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

src/clj/clojure/core.clj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,7 +2943,7 @@
29432943
conds (when (and (next body) (map? (first body)))
29442944
(first body))
29452945
body (if conds (next body) body)
2946-
conds (or conds ^params)
2946+
conds (or conds (meta params))
29472947
pre (:pre conds)
29482948
post (:post conds)
29492949
body (if post
@@ -3172,7 +3172,7 @@
31723172
"test [v] finds fn at key :test in var metadata and calls it,
31733173
presuming failure will throw exception"
31743174
[v]
3175-
(let [f (:test ^v)]
3175+
(let [f (:test (meta v))]
31763176
(if f
31773177
(do (f) :ok)
31783178
:no-test)))
@@ -3254,11 +3254,11 @@
32543254

32553255
(defn print-doc [v]
32563256
(println "-------------------------")
3257-
(println (str (ns-name (:ns ^v)) "/" (:name ^v)))
3258-
(prn (:arglists ^v))
3259-
(when (:macro ^v)
3257+
(println (str (ns-name (:ns (meta v))) "/" (:name (meta v))))
3258+
(prn (:arglists (meta v)))
3259+
(when (:macro (meta v))
32603260
(println "Macro"))
3261-
(println " " (:doc ^v)))
3261+
(println " " (:doc (meta v))))
32623262

32633263
(defn find-doc
32643264
"Prints documentation for any var whose documentation or name
@@ -3267,9 +3267,9 @@
32673267
(let [re (re-pattern re-string-or-pattern)]
32683268
(doseq [ns (all-ns)
32693269
v (sort-by (comp :name meta) (vals (ns-interns ns)))
3270-
:when (and (:doc ^v)
3271-
(or (re-find (re-matcher re (:doc ^v)))
3272-
(re-find (re-matcher re (str (:name ^v))))))]
3270+
:when (and (:doc (meta v))
3271+
(or (re-find (re-matcher re (:doc (meta v))))
3272+
(re-find (re-matcher re (str (:name (meta v)))))))]
32733273
(print-doc v))))
32743274

32753275
(defn special-form-anchor
@@ -3297,7 +3297,7 @@
32973297
[nspace]
32983298
(println "-------------------------")
32993299
(println (str (ns-name nspace)))
3300-
(println " " (:doc ^nspace)))
3300+
(println " " (:doc (meta nspace))))
33013301

33023302
(defmacro doc
33033303
"Prints documentation for a var or special form given its name"
@@ -4307,11 +4307,11 @@
43074307
metadata from the name symbol. Returns the var."
43084308
([ns #^clojure.lang.Symbol name]
43094309
(let [v (clojure.lang.Var/intern (the-ns ns) name)]
4310-
(when ^name (.setMeta v ^name))
4310+
(when (meta name) (.setMeta v (meta name)))
43114311
v))
43124312
([ns name val]
43134313
(let [v (clojure.lang.Var/intern (the-ns ns) name val)]
4314-
(when ^name (.setMeta v ^name))
4314+
(when (meta name) (.setMeta v (meta name)))
43154315
v)))
43164316

43174317
(defmacro while

src/clj/clojure/genclass.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
mm (mapcat #(.getMethods #^Class %) interfaces))
382382
;extra methods
383383
(doseq [[mname pclasses rclass :as msig] methods]
384-
(emit-forwarding-method (str mname) pclasses rclass (:static ^msig)
384+
(emit-forwarding-method (str mname) pclasses rclass (:static (meta msig))
385385
emit-unsupported))
386386
;expose specified overridden superclass methods
387387
(doseq [[local-mname #^java.lang.reflect.Method m] (reduce (fn [ms [[name _ _] m]]

src/clj/clojure/zip.clj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@
6161
(defn branch?
6262
"Returns true if the node at loc is a branch"
6363
[loc]
64-
((:zip/branch? ^loc) (node loc)))
64+
((:zip/branch? (meta loc)) (node loc)))
6565

6666
(defn children
6767
"Returns a seq of the children of node at loc, which must be a branch"
6868
[loc]
6969
(if (branch? loc)
70-
((:zip/children ^loc) (node loc))
70+
((:zip/children (meta loc)) (node loc))
7171
(throw (Exception. "called children on a leaf node"))))
7272

7373
(defn make-node
7474
"Returns a new branch node, given an existing node and new
7575
children. The loc is only used to supply the constructor."
7676
[loc node children]
77-
((:zip/make-node ^loc) node children))
77+
((:zip/make-node (meta loc)) node children))
7878

7979
(defn path
8080
"Returns a seq of nodes leading to this loc"
@@ -103,7 +103,7 @@
103103
(with-meta [c {:l []
104104
:pnodes (if path (conj (:pnodes path) node) [node])
105105
:ppath path
106-
:r cnext}] ^loc)))))
106+
:r cnext}] (meta loc))))))
107107

108108
(defn up
109109
"Returns the loc of the parent of the node at this loc, or nil if at
@@ -116,7 +116,7 @@
116116
[(make-node loc pnode (concat l (cons node r)))
117117
(and ppath (assoc ppath :changed? true))]
118118
[pnode ppath])
119-
^loc)))))
119+
(meta loc))))))
120120

121121
(defn root
122122
"zips all the way up and returns the root node, reflecting any
@@ -134,29 +134,29 @@
134134
[loc]
135135
(let [[node {l :l [r & rnext :as rs] :r :as path}] loc]
136136
(when (and path rs)
137-
(with-meta [r (assoc path :l (conj l node) :r rnext)] ^loc))))
137+
(with-meta [r (assoc path :l (conj l node) :r rnext)] (meta loc)))))
138138

139139
(defn rightmost
140140
"Returns the loc of the rightmost sibling of the node at this loc, or self"
141141
[loc]
142142
(let [[node {l :l r :r :as path}] loc]
143143
(if (and path r)
144-
(with-meta [(last r) (assoc path :l (apply conj l node (butlast r)) :r nil)] ^loc)
144+
(with-meta [(last r) (assoc path :l (apply conj l node (butlast r)) :r nil)] (meta loc))
145145
loc)))
146146

147147
(defn left
148148
"Returns the loc of the left sibling of the node at this loc, or nil"
149149
[loc]
150150
(let [[node {l :l r :r :as path}] loc]
151151
(when (and path (seq l))
152-
(with-meta [(peek l) (assoc path :l (pop l) :r (cons node r))] ^loc))))
152+
(with-meta [(peek l) (assoc path :l (pop l) :r (cons node r))] (meta loc)))))
153153

154154
(defn leftmost
155155
"Returns the loc of the leftmost sibling of the node at this loc, or self"
156156
[loc]
157157
(let [[node {l :l r :r :as path}] loc]
158158
(if (and path (seq l))
159-
(with-meta [(first l) (assoc path :l [] :r (concat (rest l) [node] r))] ^loc)
159+
(with-meta [(first l) (assoc path :l [] :r (concat (rest l) [node] r))] (meta loc))
160160
loc)))
161161

162162
(defn insert-left
@@ -166,7 +166,7 @@
166166
(let [[node {l :l :as path}] loc]
167167
(if (nil? path)
168168
(throw (new Exception "Insert at top"))
169-
(with-meta [node (assoc path :l (conj l item) :changed? true)] ^loc))))
169+
(with-meta [node (assoc path :l (conj l item) :changed? true)] (meta loc)))))
170170

171171
(defn insert-right
172172
"Inserts the item as the right sibling of the node at this loc,
@@ -175,13 +175,13 @@
175175
(let [[node {r :r :as path}] loc]
176176
(if (nil? path)
177177
(throw (new Exception "Insert at top"))
178-
(with-meta [node (assoc path :r (cons item r) :changed? true)] ^loc))))
178+
(with-meta [node (assoc path :r (cons item r) :changed? true)] (meta loc)))))
179179

180180
(defn replace
181181
"Replaces the node at this loc, without moving"
182182
[loc node]
183183
(let [[_ path] loc]
184-
(with-meta [node (assoc path :changed? true)] ^loc)))
184+
(with-meta [node (assoc path :changed? true)] (meta loc))))
185185

186186
(defn edit
187187
"Replaces the node at this loc with the value of (f node args)"
@@ -239,13 +239,13 @@
239239
(if (nil? path)
240240
(throw (new Exception "Remove at top"))
241241
(if (pos? (count l))
242-
(loop [loc (with-meta [(peek l) (assoc path :l (pop l) :changed? true)] ^loc)]
242+
(loop [loc (with-meta [(peek l) (assoc path :l (pop l) :changed? true)] (meta loc))]
243243
(if-let [child (and (branch? loc) (down loc))]
244244
(recur (rightmost child))
245245
loc))
246246
(with-meta [(make-node loc (peek pnodes) rs)
247247
(and ppath (assoc ppath :changed? true))]
248-
^loc)))))
248+
(meta loc))))))
249249

250250
(comment
251251

0 commit comments

Comments
 (0)