Function: elixir-ts--defun-name

elixir-ts--defun-name is a byte-compiled function defined in elixir-ts-mode.el.gz.

Signature

(elixir-ts--defun-name NODE)

Documentation

Return the name of the defun NODE.

Return nil if NODE is not a defun node or doesn't have a name.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/elixir-ts-mode.el.gz
(defun elixir-ts--defun-name (node)
  "Return the name of the defun NODE.
Return nil if NODE is not a defun node or doesn't have a name."
  (pcase (treesit-node-type node)
    ("call" (let ((node-child
                   (treesit-node-child (treesit-node-child node 1) 0)))
              (pcase (treesit-node-type node-child)
                ("alias" (treesit-node-text node-child t))
                ("call" (treesit-node-text
                         (treesit-node-child-by-field-name node-child "target") t))
                ("binary_operator"
                 (treesit-node-text
                  (treesit-node-child-by-field-name
                   (treesit-node-child-by-field-name node-child "left") "target")
                  t))
                ("identifier"
                 (treesit-node-text node-child t))
                (_ nil))))
    (_ nil)))