File tree 2 files changed +11
-7
lines changed
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1507
1507
~(with-meta
1508
1508
`(fn ~[this-sym argsym]
1509
1509
(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#))))))
1516
1517
(meta form)))]
1517
1518
(ifn-invoke-methods type type-sym form))))
1518
1519
Original file line number Diff line number Diff line change 47
47
(is (= (range 22 ) (apply meta-f (range 22 )))
48
48
" Should properly call the last IFn arity with 20 args with last being a seq" )
49
49
(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 )))))))
51
54
52
55
(deftest multi-arity-test
53
56
(is (= 2 (apply (fn ([a] a) ([a b] b)) 1 [2 ])))
You can’t perform that action at this time.
0 commit comments