Function: pcase--funcall
pcase--funcall is a byte-compiled function defined in pcase.el.gz.
Signature
(pcase--funcall FUN ARG VARS)
Documentation
Build a function call to FUN with arg ARG.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/pcase.el.gz
(defun pcase--funcall (fun arg vars)
"Build a function call to FUN with arg ARG."
(cond
((symbolp fun) `(,fun ,arg))
((eq 'not (car-safe fun)) `(not ,(pcase--funcall (cadr fun) arg vars)))
(t
(let* (;; `env' is hopefully an upper bound on the bindings we need,
;; FIXME: See bug#46786 for a counter example :-(
(env (mapcar (lambda (x)
(setcdr (cdr x) 'used)
(list (car x) (cadr x)))
(macroexp--fgrep vars fun)))
(call (progn
(when (assq arg env)
;; `arg' is shadowed by `env'.
(let ((newsym (gensym "x")))
(push (list newsym arg) env)
(setq arg newsym)))
(if (or (functionp fun) (not (consp fun)))
`(funcall #',fun ,arg)
`(,@fun ,arg)))))
(if (null env)
call
;; Let's not replace `vars' in `fun' since it's
;; too difficult to do it right, instead just
;; let-bind `vars' around `fun'.
`(let* ,env ,call))))))