don't die when trying to check arity of a nonexistent function

This commit is contained in:
Scott Richmond 2024-05-16 13:57:23 -04:00
parent d5f593b0f3
commit b0c912b16c

View File

@ -309,6 +309,7 @@ Imports are for a later iteration of Ludus:
(def data (ast :data)) (def data (ast :data))
(def fn-word (first data)) (def fn-word (first data))
(def the-fn (resolve-name ctx (fn-word :data))) (def the-fn (resolve-name ctx (fn-word :data)))
(when (not the-fn) (break validator))
(print "fn name: " (the-fn :name)) (print "fn name: " (the-fn :name))
(def arities (the-fn :arities)) (def arities (the-fn :arities))
(print "arities: ") (print "arities: ")
@ -588,14 +589,10 @@ Imports are for a later iteration of Ludus:
(def validator (new-validator ast)) (def validator (new-validator ast))
(validate validator)) (validate validator))
# (do (do
(comment # (comment
(def source ` (def source `
fn bar () -> :bar
fn foo () -> match :foo with {
a -> bar ()
b -> :baz
}
`) `)
(def scanned (s/scan source)) (def scanned (s/scan source))
(def parsed (p/parse scanned)) (def parsed (p/parse scanned))