diff --git a/lisp/calculate_lifetimes.carp b/lisp/calculate_lifetimes.carp index 9ae91ac7..eadc5c28 100644 --- a/lisp/calculate_lifetimes.carp +++ b/lisp/calculate_lifetimes.carp @@ -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)) diff --git a/lisp/compiler_tests.carp b/lisp/compiler_tests.carp index e82acca5..bc741932 100644 --- a/lisp/compiler_tests.carp +++ b/lisp/compiler_tests.carp @@ -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))