Interpret panic! not as fn but as rw.

This commit is contained in:
Scott Richmond 2022-05-19 18:12:55 -04:00
parent 4aeaa9e889
commit 9dd963e5b2

View File

@ -308,6 +308,9 @@
))
)
(defn- panic [ast ctx]
(throw (ex-info (show/show (interpret-ast (:expr ast) ctx)) {:ast ast})))
(defn interpret-ast [ast ctx]
(case (::ast/type ast)
@ -337,6 +340,8 @@
::ast/ref (interpret-ref ast ctx)
::ast/panic (panic ast ctx)
::ast/recur
{::data/recur true :tuple (interpret-ast (:tuple ast) ctx)}
@ -406,8 +411,10 @@
(def source "
let :foo = :bar
print (:foo)
print (:bar)
panic! \"well, shit\"
")