;;(closure-ref closure a i32)
(define impc:ti:closure-ref-check
(lambda (ast vars kts request?)
;; (println 'cls 'ref 'check: ast 'request? request?)
(if (<> (length ast) 4)
(impc:compiler:print-bad-arity-error ast))
(let* (;; a should be a closure of some kind
(a (if (and (symbol? (cadr ast))
(impc:ti:closure-exists? (symbol->string (cadr ast))))
#t ; // yes (cadr ast) is a globally defined closure
(impc:ti:type-check (cadr ast) vars kts #f))) ;; do NOT check against request!
;; b should be a string (the var's name)
(b (impc:ti:type-check (caddr ast) vars kts (impc:ir:pointer++ (list *impc:ir:si8*)))))
(if (null? (cadddr ast))
(if request?
request?
'())
(impc:ir:get-type-from-str (cadddr ast))))))