result from if-s are freed too

This commit is contained in:
Erik Svedäng 2016-01-22 13:58:00 +01:00
parent e81e4a76ae
commit 959b374537
2 changed files with 7 additions and 2 deletions

View File

@ -270,6 +270,11 @@
vars-after-all (remove (fn (v) (contains? all-freed v)) vars-after-expr)
if-ret-type (:type ast)
vars-after-all-with-ret-val (if (managed-type? if-ret-type)
(cons {:name (:result-name ast) :type if-ret-type :doc "if ret val"} vars-after-all)
vars-after-all)
eaten-left (get-maybe data-after-left :eaten)
eaten-right (get-maybe data-after-right :eaten)
;;_ (println (str "eaten-left:\n" eaten-left "\neaten-right:\n" eaten-right))
@ -285,7 +290,7 @@
]
{:ast ast-after-all
:vars vars-after-all
:vars vars-after-all-with-ret-val
:eaten eaten})
:let (let [;;_ (println (str "\nLET vars in body " (get-maybe ast :result-name) ":\n" vars))

View File

@ -465,7 +465,7 @@
free-left (get-in own-asta-13b '(:body :free-left))
free-right (get-in own-asta-13b '(:body :free-right))]
(do (assert-eq '(:fn (:string) :string) (:type own-asta-13b))
;;(bake own-if-13b)
(bake own-if-13b)
(assert-eq 1 (count free))
(assert-eq 2 (count free-left))
(assert-eq 2 (count free-right))