@@ -10022,7 +10022,7 @@ reduces them without incurring seq initialization"
1002210022
1002310023 (array? x)
1002410024 (vec (map thisfn x))
10025-
10025+
1002610026 (identical? (type x) js/Object)
1002710027 (into {} (for [k (js-keys x)]
1002810028 [(keyfn k) (thisfn (aget x k))]))
@@ -10235,20 +10235,23 @@ reduces them without incurring seq initialization"
1023510235 (or (prefers* x y prefer-table) (isa? hierarchy x y)))
1023610236
1023710237(defn- find-and-cache-best-method
10238- [name dispatch-val hierarchy method-table prefer-table method-cache cached-hierarchy]
10238+ [name dispatch-val hierarchy method-table prefer-table method-cache cached-hierarchy default-dispatch-val ]
1023910239 (let [best-entry (reduce (fn [be [k _ :as e]]
1024010240 (if (isa? @hierarchy dispatch-val k)
1024110241 (let [be2 (if (or (nil? be) (dominates k (first be) prefer-table @hierarchy))
1024210242 e
1024310243 be)]
1024410244 (when-not (dominates (first be2) k prefer-table @hierarchy)
1024510245 (throw (js/Error.
10246- (str " Multiple methods in multimethod '" name
10247- " ' match dispatch value: " dispatch-val " -> " k
10248- " and " (first be2) " , and neither is preferred" ))))
10246+ (str " Multiple methods in multimethod '" name
10247+ " ' match dispatch value: " dispatch-val " -> " k
10248+ " and " (first be2) " , and neither is preferred" ))))
1024910249 be2)
1025010250 be))
10251- nil @method-table)]
10251+ nil @method-table)
10252+ best-entry (if-let [entry (and (nil? best-entry) (@method-table default-dispatch-val ))]
10253+ [default-dispatch-val entry]
10254+ best-entry)]
1025210255 (when best-entry
1025310256 (if (= @cached-hierarchy @hierarchy)
1025410257 (do
@@ -10257,7 +10260,7 @@ reduces them without incurring seq initialization"
1025710260 (do
1025810261 (reset-cache method-cache method-table cached-hierarchy hierarchy)
1025910262 (find-and-cache-best-method name dispatch-val hierarchy method-table prefer-table
10260- method-cache cached-hierarchy))))))
10263+ method-cache cached-hierarchy default-dispatch-val ))))))
1026110264
1026210265(defprotocol IMultiFn
1026310266 (-reset [mf])
@@ -10432,10 +10435,8 @@ reduces them without incurring seq initialization"
1043210435 (reset-cache method-cache method-table cached-hierarchy hierarchy))
1043310436 (if-let [target-fn (@method-cache dispatch-val)]
1043410437 target-fn
10435- (if-let [target-fn (find-and-cache-best-method name dispatch-val hierarchy method-table
10436- prefer-table method-cache cached-hierarchy)]
10437- target-fn
10438- (@method-table default-dispatch-val ))))
10438+ (find-and-cache-best-method name dispatch-val hierarchy method-table
10439+ prefer-table method-cache cached-hierarchy default-dispatch-val )))
1043910440
1044010441 (-prefer-method [mf dispatch-val-x dispatch-val-y]
1044110442 (when (prefers* dispatch-val-x dispatch-val-y prefer-table)
@@ -10452,7 +10453,7 @@ reduces them without incurring seq initialization"
1045210453 (-prefers [mf] @prefer-table)
1045310454 (-default-dispatch-val [mf] default-dispatch-val )
1045410455 (-dispatch-fn [mf] dispatch-fn)
10455-
10456+
1045610457 INamed
1045710458 (-name [this] (-name name))
1045810459 (-namespace [this] (-namespace name))
0 commit comments