File tree Expand file tree Collapse file tree 2 files changed +23
-19
lines changed
clj.analyzer/src/typed/clj/analyzer
cljc.analyzer/src/typed/cljc/analyzer Expand file tree Collapse file tree 2 files changed +23
-19
lines changed Original file line number Diff line number Diff line change 268
268
269
269
:default
270
270
271
- (defn ^Class unbox
272
- " If the argument is a Class with a primitive equivalent, returns that,
271
+ (do (def ^:private classes-with-primitives
272
+ {Integer Integer/TYPE,
273
+ Long Long/TYPE,
274
+ Float Float/TYPE,
275
+ Short Short/TYPE,
276
+ Boolean Boolean/TYPE,
277
+ Byte Byte/TYPE,
278
+ Character Character/TYPE,
279
+ Double Double/TYPE,
280
+ Void Void/TYPE})
281
+
282
+ (defn ^Class unbox
283
+ " If the argument is a Class with a primitive equivalent, returns that,
273
284
otherwise returns the argument"
274
- [c]
275
- ({Integer Integer/TYPE,
276
- Long Long/TYPE,
277
- Float Float/TYPE,
278
- Short Short/TYPE,
279
- Boolean Boolean/TYPE,
280
- Byte Byte/TYPE,
281
- Character Character/TYPE,
282
- Double Double/TYPE,
283
- Void Void/TYPE}
284
- c c))
285
- )
285
+ [c]
286
+ (classes-with-primitives c c))))
286
287
287
288
(defn numeric?
288
289
" Returns true if the given class is numeric"
Original file line number Diff line number Diff line change 203
203
204
204
(defn- -source-info-into-transient!
205
205
" Like `-source-info`, but returns a raw transient."
206
- [x env dest]
207
- (let [t (->> dest
208
- (source-info-into-transient! env)
209
- (source-info-into-transient! (meta x)))]
206
+ [x dest]
207
+ (let [t (source-info-into-transient! (meta x) dest)]
210
208
(if-let [file (let [file #?(:cljs cljs-ana/*cljs-file*
211
209
:default *file*)]
212
210
(and (not= file " NO_SOURCE_FILE" )
217
215
(defn -source-info
218
216
" Returns the source-info of x"
219
217
([x env] (-source-info x env {}))
220
- ([x env base] (persistent! (-source-info-into-transient! x env (transient base)))))
218
+ ([x env base]
219
+ (persistent! (if (identical? env base)
220
+ (-source-info-into-transient! x (transient base))
221
+ (->> (transient base)
222
+ (source-info-into-transient! env)
223
+ (-source-info-into-transient! x))))))
221
224
222
225
(defn const-val
223
226
" Returns the value of a constant node (either :quote or :const)"
You can’t perform that action at this time.
0 commit comments