Skip to content

Commit 2d34791

Browse files
committed
implement the transient protocols as identity and the standard ops. impossible to respect the O(1) copy contract, but too much of cljs.core relies on the protocol, we have to pretend we support it
1 parent 614d180 commit 2d34791

File tree

1 file changed

+59
-3
lines changed

1 file changed

+59
-3
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12323,6 +12323,16 @@ reduces them without incurring seq initialization"
1232312323
(-invoke [coll k not-found]
1232412324
(-lookup coll k not-found))
1232512325

12326+
IEditableCollection
12327+
(-as-transient [coll]
12328+
coll)
12329+
12330+
ITransientCollection
12331+
(-conj! [coll val]
12332+
(-conj coll val))
12333+
(-persistent! [coll]
12334+
coll)
12335+
1232612336
IPrintWithWriter
1232712337
(-pr-writer [coll writer opts] (pr-sequential-writer writer pr-writer "[" " " "]" opts coll)))
1232812338

@@ -12473,9 +12483,23 @@ reduces them without incurring seq initialization"
1247312483
(-invoke [coll k not-found]
1247412484
(-lookup coll k not-found))
1247512485

12476-
;IEditableCollection
12477-
;(-as-transient [coll]
12478-
; (transient (into (simple-hash-map) coll)))
12486+
IEditableCollection
12487+
(-as-transient [coll]
12488+
coll)
12489+
12490+
ITransientCollection
12491+
(-conj! [coll val]
12492+
(-conj coll val))
12493+
(-persistent! [coll]
12494+
coll)
12495+
12496+
ITransientAssociative
12497+
(-assoc! [coll key val]
12498+
(-assoc coll key val))
12499+
12500+
ITransientMap
12501+
(-dissoc! [coll key]
12502+
(-dissoc coll key))
1247912503

1248012504
IPrintWithWriter
1248112505
(-pr-writer [coll writer opts]
@@ -12590,6 +12614,24 @@ reduces them without incurring seq initialization"
1259012614
(-invoke [coll k not-found]
1259112615
(-lookup coll k not-found))
1259212616

12617+
IEditableCollection
12618+
(-as-transient [coll]
12619+
coll)
12620+
12621+
ITransientCollection
12622+
(-conj! [coll val]
12623+
(-conj coll val))
12624+
(-persistent! [coll]
12625+
coll)
12626+
12627+
ITransientAssociative
12628+
(-assoc! [coll key val]
12629+
(-assoc coll key val))
12630+
12631+
ITransientMap
12632+
(-dissoc! [coll key]
12633+
(-dissoc coll key))
12634+
1259312635
IPrintWithWriter
1259412636
(-pr-writer [coll writer opts]
1259512637
(print-map coll pr-writer writer opts)))
@@ -12655,6 +12697,20 @@ reduces them without incurring seq initialization"
1265512697
(-disjoin [coll v]
1265612698
(Set. meta (dissoc hash-map v) nil))
1265712699

12700+
IEditableCollection
12701+
(-as-transient [coll]
12702+
coll)
12703+
12704+
ITransientCollection
12705+
(-conj! [coll val]
12706+
(-conj coll val))
12707+
(-persistent! [coll]
12708+
coll)
12709+
12710+
ITransientSet
12711+
(-disjoin! [coll key]
12712+
(-disjoin coll key))
12713+
1265812714
IFn
1265912715
(-invoke [coll k]
1266012716
(-lookup coll k))

0 commit comments

Comments
 (0)