impc:ti:array-set-check   scheme


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

Implementation

(define impc:ti:array-set-check
  (lambda (ast vars kts request?)
    (if (<> (length ast) 4)
        (impc:compiler:print-bad-arity-error (car ast)))
    (let* ((a (impc:ti:type-check (cadr ast) vars kts #f))
           ;; b should be fixed point types
           (b (impc:ti:type-check (caddr ast) vars kts (list *impc:ir:si64* *impc:ir:si32*)))
           ;; c should be of type a*
           (c (impc:ti:type-check (cadddr ast) vars kts (if (or (null? a)
                                                                (not (impc:ir:type? (car a))))
                                                            #f
                                                            (list (caddr (car a)))))))
      (if (or (and (not (null? a))
                   (impc:ir:type? (car a))
                   (not (impc:ir:array? (car a))))
              (and (not (null? a))
                   (impc:ir:type? (car a))
                   (> (impc:ir:get-ptr-depth (car a)) 1)))
          (impc:compiler:print-bad-type-error (impc:ir:get-type-str (car a) c)))
      ;; array set check will return the value set
      c)))


Back to Index