Function: js--beginning-of-defun-nested

js--beginning-of-defun-nested is a byte-compiled function defined in js.el.gz.

Signature

(js--beginning-of-defun-nested)

Documentation

Helper function for js--beginning-of-defun.

Return the pitem of the function we went to the beginning of.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--beginning-of-defun-nested ()
  "Helper function for `js--beginning-of-defun'.
Return the pitem of the function we went to the beginning of."
  (or
   ;; Look for the smallest function that encloses point...
   (cl-loop for pitem in (js--parse-state-at-point)
            if (and (eq 'function (js--pitem-type pitem))
                    (js--inside-pitem-p pitem))
            do (goto-char (js--pitem-h-begin pitem))
            and return pitem)

   ;; ...and if that isn't found, look for the previous top-level
   ;; defun
   (cl-loop for pstate = (js--backward-pstate)
            while pstate
            if (js--pstate-is-toplevel-defun pstate)
            do (goto-char (js--pitem-h-begin it))
            and return it)))