Skip to content

Commit 57b4fca

Browse files
committed
ASYNC-252 Move go analyzer from ioc-macros to impl.go namespace
1 parent 5a6a346 commit 57b4fca

File tree

5 files changed

+1065
-1132
lines changed

5 files changed

+1065
-1132
lines changed

src/main/clojure/clojure/core/async.clj

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ to catch and handle."
2727
[clojure.core.async.impl.timers :as timers]
2828
[clojure.core.async.impl.dispatch :as dispatch]
2929
[clojure.core.async.impl.ioc-macros :as ioc]
30+
clojure.core.async.impl.go ;; TODO: make conditional
3031
[clojure.core.async.impl.mutex :as mutex]
3132
[clojure.core.async.impl.concurrent :as conc]
3233
)
@@ -456,18 +457,7 @@ to catch and handle."
456457
Returns a channel which will receive the result of the body when
457458
completed"
458459
[& body]
459-
(let [crossing-env (zipmap (keys &env) (repeatedly gensym))]
460-
`(let [c# (chan 1)
461-
captured-bindings# (Var/getThreadBindingFrame)]
462-
(dispatch/run
463-
(^:once fn* []
464-
(let [~@(mapcat (fn [[l sym]] [sym `(^:once fn* [] ~(vary-meta l dissoc :tag))]) crossing-env)
465-
f# ~(ioc/state-machine `(do ~@body) 1 [crossing-env &env] ioc/async-custom-terminators)
466-
state# (-> (f#)
467-
(ioc/aset-all! ioc/USER-START-IDX c#
468-
ioc/BINDINGS-IDX captured-bindings#))]
469-
(ioc/run-state-machine-wrapped state#))))
470-
c#)))
460+
(#'clojure.core.async.impl.go/go-impl &env body))
471461

472462
(defonce ^:private ^Executor thread-macro-executor
473463
(Executors/newCachedThreadPool (conc/counted-thread-factory "async-thread-macro-%d" true)))

0 commit comments

Comments
 (0)