impc:ti:type-check-bound-lambda   scheme

Defined in:


;; this is here for whenever we get
;; new 'argument' information about
;; a locally bound lambda which might help
;; us to derive new return type information
(define impc:ti:type-check-bound-lambda
  (lambda (sym vars kts t)
    (if (not (assoc-strcmp sym *impc:ti:bound-lambdas*))
        (let* ((f (cadr (assoc-strcmp sym *impc:ti:bound-lambdas*)))
               (args (cadr f))
               (body (caddr f))
               (estr (sexpr->string body))
               (recursive? (regex:match? estr (string-append "(" "\\(\\s*" (symbol->string sym) "\\s" ")|(\\(\\s*callback)")))
               (rettype '()))
          (if (not recursive?)
                (if (not (null? t))
                    (for-each (lambda (x y)
                                ;; (println 'lambda 'x: x 'y: y)
                                (impc:ti:update-var x vars kts y))
                              args (cddr t)))
                (set! rettype (impc:ti:type-check (caddr (cadr (assoc-strcmp sym *impc:ti:bound-lambdas*)))
                                                  vars kts #f))
                (if (null? t)
                    (let ((argtypes (map (lambda (x)
                                           (cadr (assoc-strcmp x vars)))
                      ;; (println 'update: sym 'with (cons 213 (cons (car rettype) argtypes)))
                      (impc:ti:update-var sym vars kts (cons 213 (cons(car rettype) argtypes)))))
                (if (impc:ir:type? rettype)

Back to Index