File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 15071507 ~(with-meta
15081508 `(fn ~[this-sym argsym]
15091509 (this-as ~this-sym
1510- (.apply (.-call ~this-sym) ~this-sym
1511- (.concat (array ~this-sym)
1512- (if (> (.-length ~argsym) ~max-ifn-arity)
1513- (doto (.slice ~argsym 0 ~max-ifn-arity)
1514- (.push (.slice ~argsym ~max-ifn-arity)))
1515- ~argsym)))))
1510+ (let [args# (cljs.core/aclone ~argsym)]
1511+ (.apply (.-call ~this-sym) ~this-sym
1512+ (.concat (array ~this-sym)
1513+ (if (> (.-length args#) ~max-ifn-arity)
1514+ (doto (.slice args# 0 ~max-ifn-arity)
1515+ (.push (.slice args# ~max-ifn-arity)))
1516+ args#))))))
15161517 (meta form)))]
15171518 (ifn-invoke-methods type type-sym form))))
15181519
Original file line number Diff line number Diff line change 4747 (is (= (range 22 ) (apply meta-f (range 22 )))
4848 " Should properly call the last IFn arity with 20 args with last being a seq" )
4949 (is (= (range 22 ) (.apply meta-f nil (to-array (range 22 ))))
50- " .apply should also handle >20 arguments" ))
50+ " .apply should also handle >20 arguments" )
51+ (let [ctor #(.apply meta-f nil (js-arguments ))] ; CLJS-3382
52+ (is (= '(1 2 3 ) (.apply ctor nil #js [1 2 3 ])))
53+ (is (= (range 30 ) (.apply ctor nil (to-array (range 30 )))))))
5154
5255(deftest multi-arity-test
5356 (is (= 2 (apply (fn ([a] a) ([a b] b)) 1 [2 ])))
You can’t perform that action at this time.
0 commit comments