File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 909
909
writer (StringBufferWriter. sb)]
910
910
(-pr-writer obj writer (pr-opts ))
911
911
(-flush writer)
912
- (str sb)))
912
+ (.toString sb)))
913
913
914
914
; ;;;;;;;;;;;;;;;;;; Murmur3 ;;;;;;;;;;;;;;;
915
915
@@ -1648,7 +1648,7 @@ reduces them without incurring seq initialization"
1648
1648
(-first [_] (aget arr i))
1649
1649
(-rest [_] (if (< (inc i) (alength arr))
1650
1650
(IndexedSeq. arr (inc i) nil )
1651
- (list )))
1651
+ ()))
1652
1652
1653
1653
INext
1654
1654
(-next [_] (if (< (inc i) (alength arr))
@@ -3206,8 +3206,7 @@ reduces them without incurring seq initialization"
3206
3206
3207
3207
(deftype EmptyList [meta]
3208
3208
Object
3209
- (toString [coll]
3210
- (pr-str* coll))
3209
+ (toString [coll] " ()" )
3211
3210
(equiv [this other]
3212
3211
(-equiv this other))
3213
3212
(indexOf [coll x]
Original file line number Diff line number Diff line change 1365
1365
[& impls]
1366
1366
(core/let [t (with-meta
1367
1367
(gensym
1368
- (core/str " t_ "
1368
+ (core/str " t_reify_ "
1369
1369
(string/replace (core/str (munge ana/*cljs-ns*)) " ." " $" )))
1370
1370
{:anonymous true })
1371
1371
meta-sym (gensym " meta" )
1382
1382
IMeta
1383
1383
(~'-meta [~this-sym] ~meta-sym)
1384
1384
~@impls ))
1385
- (new ~t ~@locals ~(ana/elide-reader-meta (meta &form))))))
1385
+ (new ~t ~@locals
1386
+ ; ; if the form meta is empty, emit nil
1387
+ ~(core/let [form-meta (ana/elide-reader-meta (meta &form))]
1388
+ (core/when-not (empty? form-meta)
1389
+ form-meta))))))
1386
1390
1387
1391
(core/defmacro specify!
1388
1392
" Identical to reify but mutates its first argument."
1789
1793
[t fields & impls]
1790
1794
(validate-fields " deftype" t fields)
1791
1795
(core/let [env &env
1792
- r (:name (cljs.analyzer/resolve-var (dissoc env :locals ) t))
1796
+ v (cljs.analyzer/resolve-var (dissoc env :locals ) t)
1797
+ r (:name v)
1793
1798
[fpps pmasks] (prepare-protocol-masks env impls)
1794
1799
protocols (collect-protocols impls env)
1795
1800
t (vary-meta t assoc
1796
1801
:protocols protocols
1797
- :skip-protocol-flag fpps) ]
1802
+ :skip-protocol-flag fpps)]
1798
1803
`(do
1799
1804
(deftype* ~t ~fields ~pmasks
1800
1805
~(if (seq impls)
1801
1806
`(extend-type ~t ~@(dt->et t impls fields))))
1802
- (set! (.-getBasis ~t) (fn [] '[~@fields]))
1807
+ ; ; don't emit static basis method w/ reify
1808
+ ; ; nor for core types
1809
+ ~@(core/when-not (core/or (string/starts-with? (name t) " t_reify" )
1810
+ (= 'cljs.core (:ns v)))
1811
+ [`(set! (.-getBasis ~t) (fn [] '[~@fields]))])
1803
1812
(set! (.-cljs$lang$type ~t) true )
1804
1813
(set! (.-cljs$lang$ctorStr ~t) ~(core/str r))
1805
1814
(set! (.-cljs$lang$ctorPrWriter ~t) (fn [this# writer# opt#] (-write writer# ~(core/str r))))
You can’t perform that action at this time.
0 commit comments