Function: majutsu-template-call

majutsu-template-call is a natively compiled function defined in majutsu-template.el.

Signature

(majutsu-template-call NAME &rest ARGS)

Documentation

funcall helper, with builtin function support.

Parameters:
  name (Any)
  args (Any) [rest]

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-template.el
(majutsu-template-defun call ((name Any)
                              (args Any :rest t))
  (:returns Any :doc "funcall helper, with builtin function support.")
  (let* ((name-node (majutsu-template--rewrite name))
         (arg-nodes (mapcar #'majutsu-template--rewrite args)))
    (if (eq (majutsu-template-node-kind name-node) :lambda)
        (majutsu-template--apply-lambda name-node arg-nodes)
      (let* ((identifier (majutsu-template--node->identifier name-node "call name"))
             (meta (majutsu-template--lookup-function-meta identifier)))
        (cond
         (meta
          (if-let* ((fn-symbol (majutsu-template--fn-symbol meta)))
              (apply fn-symbol arg-nodes)
            (majutsu-template--call-node (majutsu-template--fn-name meta)
                                         arg-nodes
                                         (majutsu-template--fn-returns meta))))
         (t
          (majutsu-template--call-node
           (majutsu-template--normalize-call-name identifier)
           arg-nodes)))))))