diff --git a/lisp/calculate_lifetimes.carp b/lisp/calculate_lifetimes.carp index 528c7f8a..a273f3ca 100644 --- a/lisp/calculate_lifetimes.carp +++ b/lisp/calculate_lifetimes.carp @@ -54,7 +54,9 @@ (let [ast (:ast data) vars (:vars data) pos (:pos data) - new-data (calculate-lifetimes-internal {:ast arg-ast :vars vars}) + new-data (if (and (= :literal (:node arg-ast)) (not (ref? arg-ast))) + {:ast arg-ast :vars vars} ;; a literal as an arg to a non-ref parameter doesn't create any new vars to free + (calculate-lifetimes-internal {:ast arg-ast :vars vars})) new-arg-ast (:ast new-data) new-vars (:vars new-data) ;;_ (println (str "AST: " ast)) diff --git a/lisp/compiler_tests.carp b/lisp/compiler_tests.carp index b4476ad7..990ae0d3 100644 --- a/lisp/compiler_tests.carp +++ b/lisp/compiler_tests.carp @@ -191,6 +191,9 @@ (defn own-string-5 (s) (strlen s)) +(defn own-string-6 (s) + (strlen (ref s))) + ;;(bake own-string-1) ;;(bake own-string-2) ;;(bake own-string-3)