@@ -12371,9 +12371,9 @@ reduces them without incurring seq initialization"
1237112371 (let [a (hash a)
1237212372 b (hash b)]
1237312373 (cond
12374- (< a b) -1
12375- (> a b) 1
12376- :else 0 )))
12374+ (< a b) -1
12375+ (> a b) 1
12376+ :else 0 )))
1237712377
1237812378(defn- obj-clone [obj ks]
1237912379 (let [new-obj (js-obj )
@@ -12387,6 +12387,10 @@ reduces them without incurring seq initialization"
1238712387
1238812388(declare simple-hash-map )
1238912389
12390+ (defn- keyword->obj-map-key
12391+ [k]
12392+ (str " \u FDD0" " '" (. k -fqn)))
12393+
1239012394(deftype ObjMap [meta keys strobj ^:mutable __hash]
1239112395 IWithMeta
1239212396 (-with-meta [coll meta] (ObjMap. meta keys strobj __hash))
@@ -12422,41 +12426,45 @@ reduces them without incurring seq initialization"
1242212426 ILookup
1242312427 (-lookup [coll k] (-lookup coll k nil ))
1242412428 (-lookup [coll k not-found]
12425- (if (and (string? k)
12426- (not (nil? (scan-array 1 k keys))))
12427- (unchecked-get strobj k)
12428- not-found))
12429+ (let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12430+ (if (and (string? k)
12431+ (not (nil? (scan-array 1 k keys))))
12432+ (unchecked-get strobj k)
12433+ not-found)))
1242912434
1243012435 IAssociative
1243112436 (-assoc [coll k v]
12432- (if (string? k)
12433- (if-not (nil? (scan-array 1 k keys))
12434- (let [new-strobj (obj-clone strobj keys)]
12435- (gobject/set new-strobj k v)
12436- (ObjMap. meta keys new-strobj nil )) ; overwrite
12437- (let [new-strobj (obj-clone strobj keys) ; append
12438- new-keys (aclone keys)]
12439- (gobject/set new-strobj k v)
12440- (.push new-keys k)
12441- (ObjMap. meta new-keys new-strobj nil )))
12442- ; non-string key. game over.
12443- (-with-meta
12444- (-kv-reduce coll
12445- (fn [ret k v]
12446- (-assoc ret k v))
12447- (. HashMap -EMPTY) )
12448- meta)))
12437+ (let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12438+ (if (string? k)
12439+ (if-not (nil? (scan-array 1 k keys))
12440+ (let [new-strobj (obj-clone strobj keys)]
12441+ (gobject/set new-strobj k v)
12442+ (ObjMap. meta keys new-strobj nil )) ; overwrite
12443+ (let [new-strobj (obj-clone strobj keys) ; append
12444+ new-keys (aclone keys)]
12445+ (gobject/set new-strobj k v)
12446+ (.push new-keys k)
12447+ (ObjMap. meta new-keys new-strobj nil )))
12448+ ; non-string key. game over.
12449+ (-with-meta
12450+ (-kv-reduce coll
12451+ (fn [ret k v]
12452+ (-assoc ret k v))
12453+ (. HashMap -EMPTY))
12454+ meta))))
1244912455 (-contains-key? [coll k]
12450- (if (and (string? k)
12451- (not (nil? (scan-array 1 k keys))))
12452- true
12453- false ))
12456+ (let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12457+ (if (and (string? k)
12458+ (not (nil? (scan-array 1 k keys))))
12459+ true
12460+ false )))
1245412461
1245512462 IFind
1245612463 (-find [coll k]
12457- (when (and (string? k)
12458- (not (nil? (scan-array 1 k keys))))
12459- (MapEntry. k (unchecked-get strobj k) nil )))
12464+ (let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12465+ (when (and (string? k)
12466+ (not (nil? (scan-array 1 k keys))))
12467+ (MapEntry. k (unchecked-get strobj k) nil ))))
1246012468
1246112469 IKVReduce
1246212470 (-kv-reduce [coll f init]
@@ -12473,14 +12481,15 @@ reduces them without incurring seq initialization"
1247312481
1247412482 IMap
1247512483 (-dissoc [coll k]
12476- (if (and (string? k)
12477- (not (nil? (scan-array 1 k keys))))
12478- (let [new-keys (aclone keys)
12479- new-strobj (obj-clone strobj keys)]
12480- (.splice new-keys (scan-array 1 k new-keys) 1 )
12481- (js-delete new-strobj k)
12482- (ObjMap. meta new-keys new-strobj nil ))
12483- coll)) ; key not found, return coll unchanged
12484+ (let [k (if-not (keyword? k) k (keyword->obj-map-key k))]
12485+ (if (and (string? k)
12486+ (not (nil? (scan-array 1 k keys))))
12487+ (let [new-keys (aclone keys)
12488+ new-strobj (obj-clone strobj keys)]
12489+ (.splice new-keys (scan-array 1 k new-keys) 1 )
12490+ (js-delete new-strobj k)
12491+ (ObjMap. meta new-keys new-strobj nil ))
12492+ coll))) ; key not found, return coll unchanged
1248412493
1248512494 IFn
1248612495 (-invoke [coll k]
0 commit comments