fix array creation for cljs
This commit is contained in:
parent
41f42e20a1
commit
3073f1256b
2 changed files with 4 additions and 2 deletions
|
|
@ -3,13 +3,13 @@
|
||||||
(defn gensyms [amt]
|
(defn gensyms [amt]
|
||||||
(vec (repeatedly amt gensym)))
|
(vec (repeatedly amt gensym)))
|
||||||
|
|
||||||
(defmacro define-ParamsNeededPath [fn-type invoke-name var-arity-impl]
|
(defmacro define-ParamsNeededPath [clj? fn-type invoke-name var-arity-impl]
|
||||||
(let [a (with-meta (gensym "array") {:tag 'objects})
|
(let [a (with-meta (gensym "array") {:tag 'objects})
|
||||||
impls (for [i (range 21)
|
impls (for [i (range 21)
|
||||||
:let [args (vec (gensyms i))
|
:let [args (vec (gensyms i))
|
||||||
setters (for [j (range i)] `(aset ~a ~j ~(get args j)))]]
|
setters (for [j (range i)] `(aset ~a ~j ~(get args j)))]]
|
||||||
`(~invoke-name [this# ~@args]
|
`(~invoke-name [this# ~@args]
|
||||||
(let [~a (com.rpl.specter.impl/fast-object-array ~i)]
|
(let [~a (~(if clj? 'com.rpl.specter.impl/fast-object-array 'object-array) ~i)]
|
||||||
~@setters
|
~@setters
|
||||||
(com.rpl.specter.impl/bind-params* this# ~a 0)
|
(com.rpl.specter.impl/bind-params* this# ~a 0)
|
||||||
)))]
|
)))]
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@
|
||||||
|
|
||||||
#+clj
|
#+clj
|
||||||
(dh/define-ParamsNeededPath
|
(dh/define-ParamsNeededPath
|
||||||
|
true
|
||||||
clojure.lang.IFn
|
clojure.lang.IFn
|
||||||
invoke
|
invoke
|
||||||
(applyTo [this args]
|
(applyTo [this args]
|
||||||
|
|
@ -100,6 +101,7 @@
|
||||||
|
|
||||||
#+cljs
|
#+cljs
|
||||||
(define-ParamsNeededPath
|
(define-ParamsNeededPath
|
||||||
|
false
|
||||||
cljs.core/IFn
|
cljs.core/IFn
|
||||||
-invoke
|
-invoke
|
||||||
(-invoke [this p01 p02 p03 p04 p05 p06 p07 p08 p09 p10
|
(-invoke [this p01 p02 p03 p04 p05 p06 p07 p08 p09 p10
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue