call-as-xtlang-leaky   macro


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

Implementation

;; this version uses a let instead of a letz
(define-macro (call-as-xtlang-leaky . expr)
  (if (not (impc:aot:currently-compiling?))
      (sys:with-quiet-compiler
       (begin
         (set! *impc:ir:sym-name-stack* '())
         (set! *impc:ir:ls_var* '())
         (set! *impc:ti:bound-lambdas* '())
         (set! *impc:ti:generic-type-mappings* '())
         (set! *impc:ti:nativef-generics-recurse-test* 0)
         (let ((type (impc:ti:get-expression-type (car (reverse expr)))))
           (eval `(bind-func xtlang_expression
                    (lambda ()
                      ,(if (not (impc:ir:pointer? type))
                           `(let ((s:i8* null))
                              ;; (println "returning null for non-pointer type")
                              ,@expr
                              s)
                           `(let ((res:i8* (cast (begin ,@expr) i8*)))
                              res))))
                 (interaction-environment))
           (quote (xtlang_expression)))))))


Back to Index