impc:ti:vector-ref-check   scheme


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

Implementation

(define impc:ti:vector-ref-check
  (lambda (ast vars kts request?)
                                        ;(println 'request? request?)
                                        ;(println 'vector-ref-check: 'ast: ast 'vars: vars 'kts: kts)
    (if (<> (length ast) 3)
        (impc:compiler:print-bad-arity-error ast))
    (let ((a (impc:ti:type-check (cadr ast) vars kts '()))
          ;; b should be i32
          (b (impc:ti:type-check (caddr ast) vars kts (list *impc:ir:si32*))))
      (if (impc:ir:type? a) (set! a (list a)))
      (if (null? a)
          a
          (if (or (not (impc:ir:vector? (car a)))
                  (> (impc:ir:get-ptr-depth (car a)) 1))
              (impc:compiler:print-bad-type-error (impc:ir:get-type-str (car a)))
              (list (caddr (car a))))))))


Back to Index