Function: comp--compute-function-type
comp--compute-function-type is a byte-compiled function defined in
comp.el.gz.
Signature
(comp--compute-function-type _ FUNC)
Documentation
Compute type specifier for comp-func FUNC.
Set it into the type slot.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
;;; Function types pass specific code.
(defun comp--compute-function-type (_ func)
"Compute type specifier for `comp-func' FUNC.
Set it into the `type' slot."
(when (and (comp-func-l-p func)
(comp-mvar-p (comp-func-type func)))
(let* ((comp-func (make-comp-func))
(res-mvar (apply #'comp-cstr-union
(make-comp-cstr)
(cl-loop
with res = nil
for bb being the hash-value in (comp-func-blocks
func)
do (cl-loop
for insn in (comp-block-insns bb)
;; Collect over every exit point the returned
;; mvars and union results.
do (pcase insn
(`(return ,mvar)
(push mvar res))))
finally return res)))
(type `(function ,(comp--args-to-lambda-list (comp-func-l-args func))
,(comp-cstr-to-type-spec res-mvar))))
(comp--add-const-to-relocs type)
;; Fix it up.
(setf (comp-cstr-imm (comp-func-type func)) type))))