impc:ir:compiler:pointer-set   scheme


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

Implementation

(define impc:ir:compiler:pointer-set
  (lambda (ast types)
    (let* ((os (make-string 0))
           (index-str (impc:ir:compiler (caddr ast) types))
           (idx (impc:ir:gname))
           (var-str (impc:ir:compiler (cadr ast) types))
           (var (impc:ir:gname))
           (ttype (impc:ir:get-type-from-str (cadr var)))
           (val-str (impc:ir:compiler (cadddr ast) types
                                      (impc:ir:pointer-- ttype)))
           (val (impc:ir:gname)))
      ;; type tests
      (if (not (impc:ir:pointer? ttype))
          (impc:compiler:print-bad-type-error-with-ast ttype "must be a pointer" ast))
      (if (not (impc:ir:fixed-point? (impc:ir:get-type-from-str (cadr idx))))
          (impc:compiler:print-bad-type-error-with-ast (impc:ir:get-type-from-str (cadr idx))  "index must be an integer" ast))
      ;; (if (and (= 1 (impc:ir:get-ptr-depth ttype))
      ;;          (or (impc:ir:closure? ttype)
      ;;              (impc:ir:array? ttype)
      ;;              (impc:ir:tuple? ttype)))
      ;;     (if (impc:ir:tuple? ttype)
      ;;         (impc:compiler:print-bad-type-error-with-ast (cadr var) (string-append "cannot be a tuple type, maybe you want " (cadr var) "*") ast)
      ;;         (if (impc:ir:array? ttype)
      ;;             (impc:compiler:print-bad-type-error-with-ast (cadr var) (string-append "cannot be an array type, maybe you want " (cadr var) "*") ast)
      ;;             (impc:compiler:print-bad-type-error-with-ast (cadr var) (string-append "cannot be a closure type, maybe you want " (cadr var) "*") ast))))


Back to Index

Similar Entries