Function: php-ts-mode--defun-name

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

Signature

(php-ts-mode--defun-name NODE)

Documentation

Return the defun name of NODE.

Return nil if the NODE has no field “name” or if NODE is not a defun node.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/php-ts-mode.el.gz
(defun php-ts-mode--defun-name (node)
  "Return the defun name of NODE.
Return nil if the NODE has no field “name” or if NODE is not a defun node."
  (let ((child (treesit-node-child-by-field-name node "name")))
    (cl-case (intern (treesit-node-type node))
      (class_declaration (treesit-node-text child t))
      (trait_declaration (treesit-node-text child t))
      (interface_declaration (treesit-node-text child t))
      (namespace_definition (treesit-node-text child t))
      (enum_declaration (treesit-node-text child t))
      (function_definition (treesit-node-text child t))
      (method_declaration
       (php-ts-mode--defun-object-name node (treesit-node-text child t)))
      (variable_name
       (php-ts-mode--defun-object-name node (treesit-node-text node t)))
      (const_element
       (php-ts-mode--defun-object-name
        node
        (treesit-node-text (treesit-node-child node 0) t))))))