Function: neocaml--defun-name

neocaml--defun-name is a natively compiled function defined in neocaml.el.

Signature

(neocaml--defun-name NODE)

Documentation

Return the defun name of NODE.

Return nil if there is no name or if NODE is not a defun node.

Source Code

;; Defined in /nix/store/ahssdx4rwzyxhyhavpn0bkznk13xrggi-emacs-packages-deps/share/emacs/site-lisp/elpa/neocaml-20260907.2015/neocaml.el
(defun neocaml--defun-name (node)
  "Return the defun name of NODE.
Return nil if there is no name or if NODE is not a defun node."
  (pcase (treesit-node-type node)
    ("type_binding"
     (treesit-node-text
      (treesit-node-child-by-field-name node "name") t))
    ("module_binding"
     (neocaml--subtree-text node "module_name"))
    ("module_type_definition"
     (neocaml--subtree-text node "module_type_name"))
    ("class_binding"
     (neocaml--subtree-text node "class_name"))
    ("class_type_binding"
     (neocaml--subtree-text node "class_type_name"))
    ("method_definition"
     (neocaml--subtree-text node "method_name"))
    ("instance_variable_definition"
     (neocaml--subtree-text node "instance_variable_name"))
    ("exception_definition"
     (neocaml--subtree-text node "constructor_name" 2))
    ("external"
     (neocaml--subtree-text node "value_name"))
    ("let_binding"
     (treesit-node-text
      (treesit-node-child-by-field-name node "pattern") t))
    ("value_specification"
     (neocaml--subtree-text node "value_name"))
    ("method_specification"
     (neocaml--subtree-text node "method_name"))
    ("instance_variable_specification"
     (neocaml--subtree-text node "instance_variable_name"))))