impc:ti:closure-set-check   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

;;(closure-set! closure a i32 5)
(define impc:ti:closure-set-check
  (lambda (ast vars kts request?)
    ;;(println 'cset 'ast: ast 'request? request?)
    (if (<> (length ast) 5)
        (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)))
           ;; b should be a string (the var's name)
           (b (impc:ti:type-check (caddr ast) vars kts (list *impc:ir:si8*)))
           ;; c should be a value for var's name
           (c (impc:ti:type-check (cadddr ast) vars kts
                                  (if (null? (car (cddddr ast)))
                                      request?
                                      (impc:ir:get-type-from-str (car (cddddr ast)))))))
      c)))


Back to Index