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 439439
440440(defn- checked-aget
441441 ([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))))
449450 (unchecked-get array idx))
450451 ([array idx & idxs]
451452 (apply checked-aget (checked-aget array idx) idxs)))
452453
453454(defn- checked-aset
454455 ([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))))
462464 (unchecked-set array idx val))
463465 ([array idx idx2 & idxv]
464466 (apply checked-aset (checked-aget array idx) idx2 idxv)))
Original file line number Diff line number Diff line change 22902290 ~@(mapcat (core/fn [[m c]] `((cljs.core/= ~m ~esym) ~c)) pairs)
22912291 :else ~default)))))
22922292
2293+ (core/defmacro ^:private when-assert [x]
2294+ (core/when *assert* x))
2295+
22932296(core/defmacro assert
22942297 " Evaluates expr and throws an exception if it does not evaluate to
22952298 logical true."
You can’t perform that action at this time.
0 commit comments