don't write class files for eval'd functions for inline path functions or protpath extensions.

This commit is contained in:
Nathan Marz 2019-09-10 18:18:56 -04:00
parent 925e2e91d6
commit 9c7f6fb65e
3 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,6 @@
## 1.1.3-SNAPSHOT
* Better AOT behavior: path functions for inline caching and protpath extensions no longer write eval'd class files. You can force path functions to not override `*compile-files*` by binding `com.rpl.specter.impl/*path-compile-files*` to `true`.
* Bug fix: fix throw-illegal in cljs
## 1.1.2 - 2018-11-01

View file

@ -456,7 +456,8 @@
params (-> protpath-prot :sigs first last :arglists first)]
(doseq [[atype path-code] extensions]
(extend atype protpath-prot
{m (eval `(fn ~params (path ~path-code)))}))))
{m (binding [*compile-files* false]
(eval `(fn ~params (path ~path-code))))}))))
(defmacro extend-protocolpath
"Used in conjunction with `defprotocolpath`. See [[defprotocolpath]]."

View file

@ -908,6 +908,8 @@
(if (fn? e) (re-find #" .*" (pr-str e)) e))
o)))
(def ^:dynamic *path-compile-files* false)
#?(:clj
(defn mk-dynamic-path-maker [resolved-code ns-str used-locals-list possible-param]
(let [code `(fn [~@used-locals-list] ~resolved-code)
@ -916,7 +918,11 @@
(println "Produced code:")
(pp/pprint code)
(println))
(binding [*ns* ns] (eval+ code))))
(binding [*ns* ns
*compile-files* (if *path-compile-files*
*compile-files*
false)]
(eval+ code))))
:cljs
(defn mk-dynamic-path-maker [resolved-code ns-str used-locals-list possible-params]