more fixes

This commit is contained in:
Nathan Marz 2016-08-04 16:03:59 -04:00
parent 423da1e03f
commit 53682de1eb
3 changed files with 24 additions and 16 deletions

View file

@ -619,8 +619,8 @@
([cond-p then-path]
(if-path cond-p then-path STOP))
([cond-p then-path else-path]
(let [then-comp (i/comp-paths* then-path)
else-comp (i/comp-paths* else-path)
(let [then-comp (i/comp-paths-internalized then-path)
else-comp (i/comp-paths-internalized else-path)
then-needed (i/num-needed-params then-comp)
else-needed (i/num-needed-params else-comp)
then-nav (i/extract-rich-nav then-comp)
@ -651,7 +651,7 @@
then-needed
else-nav
))))
(let [cond-comp (i/comp-paths* cond-p)
(let [cond-comp (i/comp-paths-internalized cond-p)
cond-needed (i/num-needed-params cond-comp)]
(richnav (+ then-needed else-needed cond-needed)
(select* [this params params-idx vals structure next-fn]
@ -706,8 +706,8 @@
([] STAY)
([path] (i/comp-paths* path))
([path1 path2]
(let [comp1 (i/comp-paths* path1)
comp2 (i/comp-paths* path2)
(let [comp1 (i/comp-paths-internalized path1)
comp2 (i/comp-paths-internalized path2)
comp1-needed (i/num-needed-params comp1)
nav1 (i/extract-rich-nav comp1)
nav2 (i/extract-rich-nav comp2)

View file

@ -389,6 +389,9 @@
(next-fn params2 params-idx2 vals-next structure-next)
)))))))))
(defn comp-paths-internalized [path]
(capture-params-internally (comp-paths* path)))
(extend-protocol PathComposer
nil
(do-comp-paths [o]

View file

@ -67,16 +67,19 @@
(+ ~PARAMS-IDX-SYM ~num-params)
(conj vals# c#)
~structure-sym)
))]
(i/->ParamsNeededPath
(reify RichNavigator
(~'rich-select* [this# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#]
(collector# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#))
(~'rich-transform* [this# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#]
(collector# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#))
)
~num-params
)))
))
nav# (reify RichNavigator
(~'rich-select* [this# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#]
(collector# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#))
(~'rich-transform* [this# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#]
(collector# ~PARAMS-SYM ~PARAMS-IDX-SYM vals# ~structure-sym next-fn#))
)]
(if (= ~num-params 0)
(i/no-params-rich-compiled-path nav#)
(i/->ParamsNeededPath
nav#
~num-params
))))
(defn ^:no-doc pathed-nav* [builder paths-seq latefns-sym pre-bindings post-bindings impls]
(let [num-params-sym (gensym "num-params")]
@ -102,7 +105,9 @@
ret# ~(builder post-bindings num-params-sym impls)
]
(if (not any-params-needed?#)
(i/bind-params* ret# nil 0)
(if (i/params-needed-path? ret#)
(i/bind-params* ret# nil 0)
ret#)
ret#
))))