impc:ir:compiler:closure-ref   scheme

Defined in:


(define impc:ir:compiler:closure-ref
  (lambda (ast types . hint?)
    ;; arg 1 must be a closure
    ;; arg 2 must be a string
    ;; arg 3 MAY be a type string or NULL
    (let* ((os (make-string 0))
           (num (number->string (llvm:count++)))
           (closure-str (if (and (symbol? (cadr ast))
                                 (impc:ti:closure-exists? (symbol->string (cadr ast))))
                            (impc:ir:compiler:closure-from-getter (symbol->string (cadr ast)))
                            (impc:ir:compiler (cadr ast) types)))
           (closure (impc:ir:gname))
           (type-str (impc:ir:compiler (if (null? (cadddr ast))
                                           (if (null? hint?)
                                               (log-error 'Compiler 'Error: 'could 'not 'discern 'ref 'type 'for
                                                            (string-append (symbol->string (cadr ast)) "." (caddr ast))
                                                            'please 'provide 'explicit 'type 'i.e. '(<type>))
                                               (impc:ir:get-type-str (car hint?)))
                                           (cadddr ast))
           (type (impc:ir:gname))
           ;; (name-str (impc:ir:compiler (caddr ast) types))
           ;; (name (impc:ir:gname))
           (valtype (if (null? (cadddr ast)) (impc:ir:get-type-str (car hint?)) (cadddr ast))))
      (emit "\n; closure ref \n" os)
      ;; (emit "call ccc void @llvm_print_i32(i32 123)\n" os)
      (emit closure-str os)
      ;; (emit name-str os)
      (emit type-str os)

Back to Index

Similar Entries