File tree 2 files changed +21
-14
lines changed
2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -3503,7 +3503,6 @@ reduces them without incurring seq initialization"
3503
3503
:else name)]
3504
3504
(Keyword. ns name (str (when ns (str ns " /" )) name) nil ))))
3505
3505
3506
-
3507
3506
(deftype LazySeq [meta ^:mutable fn ^:mutable s ^:mutable __hash]
3508
3507
Object
3509
3508
(toString [coll]
@@ -3514,10 +3513,7 @@ reduces them without incurring seq initialization"
3514
3513
(if (nil? fn )
3515
3514
s
3516
3515
(do
3517
- (loop [ls (fn )]
3518
- (if (instance? LazySeq ls)
3519
- (recur (.sval ls))
3520
- (set! s (seq ls))))
3516
+ (set! s (fn ))
3521
3517
(set! fn nil )
3522
3518
s)))
3523
3519
(indexOf [coll x]
@@ -3537,27 +3533,27 @@ reduces them without incurring seq initialization"
3537
3533
(-with-meta [coll new-meta]
3538
3534
(if (identical? new-meta meta)
3539
3535
coll
3540
- (LazySeq. new-meta #(.sval coll) nil __hash)))
3536
+ (LazySeq. new-meta #(-seq coll) nil __hash)))
3541
3537
3542
3538
IMeta
3543
3539
(-meta [coll] meta)
3544
3540
3545
3541
ISeq
3546
3542
(-first [coll]
3547
- (.sval coll)
3543
+ (-seq coll)
3548
3544
(when-not (nil? s)
3549
- (- first s)))
3545
+ (first s)))
3550
3546
(-rest [coll]
3551
- (.sval coll)
3547
+ (-seq coll)
3552
3548
(if-not (nil? s)
3553
- (- rest s)
3549
+ (rest s)
3554
3550
()))
3555
3551
3556
3552
INext
3557
3553
(-next [coll]
3558
- (.sval coll)
3554
+ (-seq coll)
3559
3555
(when-not (nil? s)
3560
- (- next s)))
3556
+ (next s)))
3561
3557
3562
3558
ICollection
3563
3559
(-conj [coll o] (cons o coll))
@@ -3573,7 +3569,14 @@ reduces them without incurring seq initialization"
3573
3569
(-hash [coll] (caching-hash coll hash-ordered-coll __hash))
3574
3570
3575
3571
ISeqable
3576
- (-seq [coll] (.sval coll))
3572
+ (-seq [coll]
3573
+ (.sval coll)
3574
+ (when-not (nil? s)
3575
+ (loop [ls s]
3576
+ (if (instance? LazySeq ls)
3577
+ (recur (.sval ls))
3578
+ (do (set! s ls)
3579
+ (seq s))))))
3577
3580
3578
3581
IReduce
3579
3582
(-reduce [coll f] (seq-reduce f coll))
Original file line number Diff line number Diff line change 1151
1151
(deftest test-cljs-3393
1152
1152
(is (= '(0 2 4 ) (take 3 (filter even? (range 100000000 ))))))
1153
1153
1154
- (deftest test-cljs-3420-lazy-seq-caching-bug
1154
+ #_ (deftest test-cljs-3420-lazy-seq-caching-bug
1155
1155
(testing " LazySeq should realize seq once"
1156
1156
(let [a (atom 0 )
1157
1157
x (eduction (map (fn [_] (swap! a inc))) [nil ])
1158
1158
l (lazy-seq x)]
1159
1159
(dotimes [_ 10 ]
1160
1160
(is (= [1 ] l))))))
1161
1161
1162
+ (deftest test-cljs-3240-overflow-regress
1163
+ (let [things (zipmap (range 15000 ) (repeat 0 ))]
1164
+ (is (zero? (count (filter #(-> % key string?) things))))))
1165
+
1162
1166
(comment
1163
1167
1164
1168
(run-tests )
You can’t perform that action at this time.
0 commit comments