impc:ir:compiler:closure-set   scheme


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

Implementation

(define impc:ir:compiler:closure-set
  (lambda (ast types)
    ;; arg 1 must be a closure
    ;; arg 2 must be a string
    ;; arg 3 must be a value
    ;; arg 4 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))
           ;; (name-str (impc:ir:compiler (caddr ast) types))
           ;; (name (impc:ir:gname))
           (val-str (if (null? (car (cddddr ast)))
                        (impc:ir:compiler (cadddr ast) types)
                        (impc:ir:compiler (cadddr ast) types
                                          (impc:ir:get-type-from-str (car (cddddr ast))))))
           (val (impc:ir:gname))
           (type-str (impc:ir:compiler (if (null? (car (cddddr ast)))
                                           (cadr val)
                                           (car (cddddr ast)))
                                       types))
           (type (impc:ir:gname)))
      (emit "\n; closure set! \n" os)
      (emit closure-str os)
      ;; (emit name-str os)
      (emit type-str os)
      (emit val-str os)


Back to Index

Similar Entries