Permalink
Browse files

fixed namespacing for ASYNC-13

  • Loading branch information...
1 parent f0a5263 commit 12af7d8dc207a42f388936318dd2eeb48d1b03c8 @halgari halgari committed Jul 26, 2013
Showing with 15 additions and 10 deletions.
  1. +8 −7 src/main/clojure/cljs/core/async/impl/ioc_macros.clj
  2. +7 −3 src/test/cljs/cljs/core/async/tests.cljs
View
15 src/main/clojure/cljs/core/async/impl/ioc_macros.clj
@@ -559,12 +559,13 @@
res (add-instruction (->Const ::value))]
res))
-(defn fixup-aliases [sym]
+(defn fixup-aliases [sym env]
(let [aliases (ns-aliases *ns*)]
(if-not (namespace sym)
sym
- (if-let [^clojure.lang.Namespace ns (aliases (symbol (namespace sym)))]
- (symbol (name (.getName ns)) (name sym))
+ (if-let [ns (or (get-in env [:ns :requires-macros (symbol (namespace sym))])
+ (get-in env [:ns :requires (symbol (namespace sym))]))]
+ (symbol (name ns) (name sym))
sym))))
(defmethod -item-to-ssa :list
@@ -576,7 +577,7 @@
val (let [exp (expand locals env lst)]
(if (seq? exp)
(if (symbol? (first exp))
- (let [f (fixup-aliases (first exp))]
+ (let [f (fixup-aliases (first exp) env)]
(cond
(is-special? f) (sexpr-to-ssa exp)
(get locals f) (default-sexpr exp)
@@ -751,11 +752,11 @@
(def async-custom-terminators
{'<! 'cljs.core.async.impl.ioc-helpers/take!
- 'clojure.core.async/<! 'cljs.core.async.impl.ioc-helpers/take!
+ 'cljs.core.async/<! 'cljs.core.async.impl.ioc-helpers/take!
'>! 'cljs.core.async.impl.ioc-helpers/put!
- 'clojure.core.async/>! 'cljs.core.async.impl.ioc-helpers/put!
+ 'cljs.core.async/>! 'cljs.core.async.impl.ioc-helpers/put!
'alts! 'cljs.core.async.impl.ioc-helpers/ioc-alts!
- 'clojure.core.async/alts! 'cljs.core.async.impl.ioc-helpers/ioc-alts!
+ 'cljs.core.async/alts! 'cljs.core.async.impl.ioc-helpers/ioc-alts!
:Return 'cljs.core.async.impl.ioc-helpers/return-chan})
View
10 src/test/cljs/cljs/core/async/tests.cljs
@@ -1,5 +1,5 @@
(ns cljs.core.async.tests
- (:require [cljs.core.async :refer [buffer dropping-buffer sliding-buffer put! take! chan close!]]
+ (:require [cljs.core.async :refer [buffer dropping-buffer sliding-buffer put! take! chan close!] :as async]
[cljs.core.async.impl.dispatch :as dispatch]
[cljs.core.async.impl.buffers :as buff]
[cljs.core.async.impl.timers :as timers :refer [timeout]]
@@ -55,5 +55,9 @@
(testing "timeout map is empty after timeout expires"
(go
- (<! (timeout 300))
- (is= 0 (count (seq timers/timeouts-map))))))
+ (<! (timeout 300))
+ (is= 0 (count (seq timers/timeouts-map)))))
+ (testing "timeout map is empty after timeout expires with namespaced take"
+ (go
+ (async/<! (timeout 300))
+ (is= 0 (count (seq timers/timeouts-map))))))

0 comments on commit 12af7d8

Please sign in to comment.