impc:ti:pointer-set-check   scheme

Defined in:


(define impc:ti:pointer-set-check
  (lambda (ast vars kts request?)
    (if (<> (length ast) 4)
        (impc:compiler:print-bad-arity-error ast))
    (let* ((aa (impc:ti:type-check (cadr ast) vars kts #f))
           (a (if (and (list? aa) (= (length aa) 1) (symbol? (car aa))) '() aa))
           ;; 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 (null? a) #f
                                                            (if (atom? a)
                                                                (list (impc:ir:pointer-- a))
                                                                (list (impc:ir:pointer-- (car a))))))))
      ;; try running type check on a if C exists! but a does not
      (if (and (null? a)
               (not (null? c)))
           (begin ;; (println 'bingo c)
             (if (atom? c) (set! c (list c)))
            (set! a (impc:ti:type-check (cadr ast) vars kts
                                        (map (lambda (k) (impc:ir:pointer++ k))
                                             (cl:remove-if-not impc:ir:type? c))))))

Back to Index