Permalink
Browse files

fix for ASYNC-17, parallel loop bindings don't work

  • Loading branch information...
1 parent 018d26a commit d445dd3d6a231f52989f45021f58a5a1413cee17 @halgari halgari committed Aug 9, 2013
@@ -383,7 +383,16 @@
syms (map first parted)
inits (map second parted)]
(gen-plan
- [local-val-ids (all (map item-to-ssa inits))
+ [local-val-ids (all (map ; parallel bind
+ (fn [sym init]
+ (gen-plan
+ [itm-id (item-to-ssa init)
+ _ (push-alter-binding :locals assoc sym itm-id)]
+ itm-id))
+ syms
+ inits))
+ _ (all (for [x syms]
+ (pop-binding :locals)))
local-ids (all (map (comp add-instruction ->Const) local-val-ids))
body-blk (add-block)
final-blk (add-block)
@@ -381,7 +381,16 @@
syms (map first parted)
inits (map second parted)]
(gen-plan
- [local-val-ids (all (map item-to-ssa inits))
+ [local-val-ids (all (map ; parallel bind
+ (fn [sym init]
+ (gen-plan
+ [itm-id (item-to-ssa init)
+ _ (push-alter-binding :locals assoc sym itm-id)]
+ itm-id))
+ syms
+ inits))
+ _ (all (for [x syms]
+ (pop-binding :locals)))
local-ids (all (map (comp add-instruction ->Const) local-val-ids))
body-blk (add-block)
final-blk (add-block)
@@ -15,8 +15,8 @@
(deftest runner-tests
(testing "macros add locals to the env"
(is= :pass
- (runner (let [x 42]
- (pause (locals-test))))))
+ (runner (let [x 42]
+ (pause (locals-test))))))
(testing "do blocks"
(is= 42
(runner (do (pause 42))))
@@ -46,10 +46,14 @@
(recur (inc (pause x)))
(pause x)))))
(is= [:b :a]
- (runner (loop [a :a b :b n 1]
- (if (pos? n)
- (recur b a (dec n)) ;; swap bindings
- [a b])))))
+ (runner (loop [a :a b :b n 1]
+ (if (pos? n)
+ (recur b a (dec n)) ;; swap bindings
+ [a b]))))
+ (is= 1
+ (runner (loop [x 0
+ y (inc x)]
+ y))))
(testing "let expressions"
(is= 3
@@ -73,7 +73,11 @@
(runner (loop [a :a b :b n 1]
(if (pos? n)
(recur b a (dec n)) ;; swap bindings
- [a b]))))))
+ [a b])))))
+ (is (= 1
+ (runner (loop [x 0
+ y (inc x)]
+ y)))))
(testing "let expressions"
(is (= 3

0 comments on commit d445dd3

Please sign in to comment.