File tree Expand file tree Collapse file tree 2 files changed +23
-12
lines changed Expand file tree Collapse file tree 2 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -3050,16 +3050,27 @@ reduces them without incurring seq initialization"
30503050(defn str
30513051 " With no args, returns the empty string. With one arg x, returns
30523052 x.toString(). (str nil) returns the empty string. With more than
3053- one arg, returns the concatenation of the str values of the args."
3054- ([] " " )
3055- ([x] (if (nil? x)
3056- " "
3057- (.join #js [x] " " )))
3058- ([x & ys]
3059- (loop [sb (StringBuffer. (str x)) more ys]
3060- (if more
3061- (recur (. sb (append (str (first more)))) (next more))
3062- (.toString sb)))))
3053+ one arg, returns the concatenation of the str values of the args.
3054+ @param x
3055+ @param {...*} var_args"
3056+ [x var-args]
3057+ (cond
3058+ ; ; works whether x is undefined or null (cljs nil)
3059+ (nil? x) " "
3060+ ; ; if we have no more parameters, return
3061+ (undefined? var-args) (.join #js [x] " " )
3062+ ; ; var arg case without relying on CLJS fn machinery which creates
3063+ ; ; a circularity via IndexedSeq
3064+ :else
3065+ (let [sb (StringBuffer. )
3066+ args (js-arguments )
3067+ len (alength args)]
3068+ (loop [i 1 ]
3069+ (if (< i len)
3070+ (do
3071+ (.append sb (cljs.core/str (aget args i)))
3072+ (recur (inc i)))
3073+ (.toString sb))))))
30633074
30643075(defn subs
30653076 " Returns the substring of s beginning at start inclusive, and ending
Original file line number Diff line number Diff line change 854854 ([x]
855855 (if (typed-expr? &env x '#{string})
856856 x
857- (string-expr (core/list 'js* " cljs.core.str.cljs$core$IFn$_invoke$arity$1 (~{})" x))))
857+ (string-expr (core/list 'js* " cljs.core.str(~{})" x))))
858858 ([x & ys]
859859 (core/let [interpolate (core/fn [x]
860860 (if (typed-expr? &env x '#{string clj-nil})
861861 " ~{}"
862- " cljs.core.str.cljs$core$IFn$_invoke$arity$1 (~{})" ))
862+ " cljs.core.str(~{})" ))
863863 strs (core/->> (core/list* x ys)
864864 (map interpolate)
865865 (interpose " ," )
You can’t perform that action at this time.
0 commit comments