Add length checks to struct? and sumtype? for safety

This commit is contained in:
scottolsen 2020-05-27 15:03:10 -04:00
parent 9a0a061192
commit 095866e45f

View File

@ -40,7 +40,9 @@
(let [s (s-expr binding)]
(if (empty? s)
false
(array? (caddr s)))))
(if (< (length s) 2)
false
(array? (caddr s))))))
(doc sumtype?
"Is this binding a sumtype?")
@ -48,7 +50,9 @@
(let [s (s-expr binding)]
(if (empty? s)
false
(list? (caddr s)))))
(if (< (length s) 2)
false
(list? (caddr s))))))
(doc arity
"What's the arity of this binding?