File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change 439
439
440
440
(defn- checked-aget
441
441
([array idx]
442
- (try
443
- (assert (or (array? array) (js/goog.isArrayLike array)))
444
- (assert (number? idx))
445
- (assert (not (neg? idx)))
446
- (assert (< idx (alength array)))
447
- (catch :default e
448
- (maybe-warn e)))
442
+ (when-assert
443
+ (try
444
+ (assert (or (array? array) (js/goog.isArrayLike array)))
445
+ (assert (number? idx))
446
+ (assert (not (neg? idx)))
447
+ (assert (< idx (alength array)))
448
+ (catch :default e
449
+ (maybe-warn e))))
449
450
(unchecked-get array idx))
450
451
([array idx & idxs]
451
452
(apply checked-aget (checked-aget array idx) idxs)))
452
453
453
454
(defn- checked-aset
454
455
([array idx val]
455
- (try
456
- (assert (or (array? array) (js/goog.isArrayLike array)))
457
- (assert (number? idx))
458
- (assert (not (neg? idx)))
459
- (assert (< idx (alength array)))
460
- (catch :default e
461
- (maybe-warn e)))
456
+ (when-assert
457
+ (try
458
+ (assert (or (array? array) (js/goog.isArrayLike array)))
459
+ (assert (number? idx))
460
+ (assert (not (neg? idx)))
461
+ (assert (< idx (alength array)))
462
+ (catch :default e
463
+ (maybe-warn e))))
462
464
(unchecked-set array idx val))
463
465
([array idx idx2 & idxv]
464
466
(apply checked-aset (checked-aget array idx) idx2 idxv)))
Original file line number Diff line number Diff line change 2290
2290
~@(mapcat (core/fn [[m c]] `((cljs.core/= ~m ~esym) ~c)) pairs)
2291
2291
:else ~default)))))
2292
2292
2293
+ (core/defmacro ^:private when-assert [x]
2294
+ (core/when *assert* x))
2295
+
2293
2296
(core/defmacro assert
2294
2297
" Evaluates expr and throws an exception if it does not evaluate to
2295
2298
logical true."
You can’t perform that action at this time.
0 commit comments