Skip to content

Commit 1a1b007

Browse files
committed
fix js* expressions, introduce a few regressions
1 parent 4192a76 commit 1a1b007

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/cloroutine/impl.cljc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@
110110
(with-meta (cons 'cljs.core/js-obj (interleave keys args)) meta))
111111
(emit-js-array [args meta]
112112
(with-meta (cons 'cljs.core/array args) meta))
113-
(emit-place [ssa tag place]
114-
`(hint ~tag ~(-> ssa :places place :tag) ~place))
113+
(emit-place [{:keys [places]
114+
:as ssa}
115+
tag place]
116+
`(hint ~tag
117+
~(when (contains? places place)
118+
(-> places place :tag))
119+
~place))
115120
(instance [ast]
116121
(or (:instance ast) (:target ast)))
117122
(field [ast]
@@ -168,9 +173,12 @@
168173
(dissoc m k))) m ks))
169174
(current-block [ssa]
170175
(sym (:prefix ssa) 'block (-> ssa :blocks count dec)))
171-
(with-place [ssa place]
176+
(with-place [{:keys [places]
177+
:as ssa}
178+
place]
172179
(let [block (current-block ssa)]
173-
(if (= block (-> ssa :places place :block))
180+
(if (or (not (contains? places place))
181+
(= block (-> places place :block)))
174182
ssa (update-in ssa [:blocks block :read] conj-set place))))
175183
(collect [ssa rf asts f & args]
176184
(loop [ssa (assoc ssa :result [] :tag [])
@@ -491,7 +499,12 @@
491499
(add-place (emit-place ssa tag place) tag))
492500
(add-place ssa (:form ast) tag))
493501

494-
(:const :var :js-var :quote :the-var :static-field)
502+
:const
503+
(assoc ssa
504+
:result (:form ast)
505+
:tag tag)
506+
507+
(:var :js-var :quote :the-var :static-field)
495508
(add-place ssa `(hint ~tag ~(-> ast :o-tag tag->symbol) ~(:form ast)) tag)
496509

497510
(:fn :reify :deftype)

0 commit comments

Comments
 (0)