Function: js--ensure-cache--pop-if-ended

js--ensure-cache--pop-if-ended is a byte-compiled function defined in js.el.gz.

Signature

(js--ensure-cache--pop-if-ended OPEN-ITEMS PAREN-DEPTH)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--ensure-cache--pop-if-ended (open-items paren-depth)
  (let ((top-item (car open-items)))
    (when (<= paren-depth (js--pitem-paren-depth top-item))
      (cl-assert (not (get-text-property (1- (point)) 'js-pend)))
      (put-text-property (1- (point)) (point) 'js--pend top-item)
      (setf (js--pitem-b-end top-item) (point))
      (setq open-items
            ;; open-items must contain at least two items for this to
            ;; work, but because we push a dummy item to start with,
            ;; that assumption holds.
            (cons (js--pitem-add-child (cl-second open-items) top-item)
                  (cddr open-items)))))
  open-items)