impc:ti:while-check   scheme


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

Implementation

(define impc:ti:while-check
  (lambda (ast vars kts request?)
    (if (tree-member 'let (cadr ast))
        (impc:compiler:print-compiler-error "You cannot bind variables within a while condition check!" (cadr ast)))
    (let ((type (impc:ti:type-check (cadr ast) vars kts (list *impc:ir:i1*)))
          (body (impc:ti:type-check (caddr ast) vars kts #f)))
      (if (not (or (and (number? type) (= type *impc:ir:i1*))
                   (= (car type) *impc:ir:i1*)
                   (null? type)))
          (impc:compiler:print-bad-type-error (car type) "test expression in while loop must return a boolean"))
      (list *impc:ir:void*))))


Back to Index