fix inline handle params for cljs, most tests passing

This commit is contained in:
Nathan Marz 2016-05-23 10:01:44 -04:00
parent ac8119dbbe
commit b156727f3c
3 changed files with 9 additions and 6 deletions

View file

@ -18,6 +18,7 @@
(defn spy [e] (defn spy [e]
(println "SPY:")
(println (pr-str e)) (println (pr-str e))
e) e)
@ -680,8 +681,9 @@
#+cljs #+cljs
(defn handle-params [precompiled params-maker possible-params] (defn handle-params [precompiled params-maker possible-params]
(let [params (fast-object-array (count params-maker))] (let [params (fast-object-array (count params-maker))]
(doseq [i params-maker] ;;TODO: is there a faster way to do this in cljs?
(aset params i ((get possible-params i)))) (doseq [i (range (count params-maker))]
(aset params i ((get possible-params (get params-maker i)))))
(bind-params* precompiled params 0) (bind-params* precompiled params 0)
)) ))

View file

@ -350,7 +350,7 @@
(mapcat (mapcat
(fn [e] (fn [e]
(cond (i/fn-invocation? e) (cond (i/fn-invocation? e)
(concat (-> e rest) (ic-possible-params e)) (concat (rest e) (ic-possible-params e))
(vector? e) (vector? e)
(ic-possible-params e) (ic-possible-params e)
@ -368,6 +368,7 @@
used-locals (vec (i/walk-select local-syms vector path)) used-locals (vec (i/walk-select local-syms vector path))
prepared-path (ic-prepare-path local-syms (walk/macroexpand-all (vec path))) prepared-path (ic-prepare-path local-syms (walk/macroexpand-all (vec path)))
possible-params (vec (ic-possible-params path)) possible-params (vec (ic-possible-params path))
;; TODO: unclear if using long here versus string makes ;; TODO: unclear if using long here versus string makes
;; a significant difference ;; a significant difference
;; - but using random longs creates possibility of collisions ;; - but using random longs creates possibility of collisions
@ -410,12 +411,12 @@
~precompiled-sym (.-precompiled info#) ~precompiled-sym (.-precompiled info#)
~params-maker-sym (.-params-maker info#)] ~params-maker-sym (.-params-maker info#)]
(if (some? ~precompiled-sym) (if (nil? ~precompiled-sym)
(i/comp-paths* ~(vec path))
(if (nil? ~params-maker-sym) (if (nil? ~params-maker-sym)
~precompiled-sym ~precompiled-sym
~handle-params-code ~handle-params-code
) )
(i/comp-paths* ~(vec path))
)) ))
)) ))

View file

@ -239,7 +239,7 @@
(deftest atom-test (deftest atom-test
(let [v (transform s/ATOM inc (atom 1))] (let [v (transform s/ATOM inc (atom 1))]
(is (instance? clojure.lang.Atom v)) (is (instance? #+clj clojure.lang.Atom #+cljs cljs.core/Atom v))
(is (= 2 (select-one s/ATOM v) @v)))) (is (= 2 (select-one s/ATOM v) @v))))
(defspec view-test (defspec view-test