Form reordering occuring
arrdem opened this issue · comments
user> (-> (let [ast (atom {})]
(oxcart.core/load "hello"
{:forms ast})
@ast)
(oxcart.passes.fn-reduction/reduce-fn-arities {})
(oxcart.passes.emit-clj/emit-clojure {})
pprint)
Compiles down to
(do
(def -main (fn* ([] (-main$arity$0))))
(def -main$arity$0 (fn* ([] (clojure.core/println "Hello, world!"))))
(def fn__9100 (fn* ([] (fn__9100$arity$0))))
(def
fn__9100$arity$0
(fn*
([]
(clojure.core/commute
@#'clojure.core/*loaded-libs*
clojure.core/conj
'hello))))
(clojure.core/in-ns 'hello)
((fn*
loading__4910__auto__
([]
(do
(clojure.lang.Var/pushThreadBindings
{clojure.lang.Compiler/LOADER
(.getClassLoader (.getClass loading__4910__auto__))})
(try
(clojure.core/refer 'clojure.core)
(finally (clojure.lang.Var/popThreadBindings)))))))
(if
(.equals 'hello 'clojure.core)
nil
(do
(clojure.lang.LockingTransaction/runInTransaction
(clojure.core/partial fn__9100))
nil)))
This resulting code is incorrect in that the -main
method and lifted functions are defined before the in-ns
which is both a compile error and shouldn't be possible.