Function: js--forward-destructuring-spec
js--forward-destructuring-spec is a byte-compiled function defined in
js.el.gz.
Signature
(js--forward-destructuring-spec &optional FUNC)
Documentation
Move forward over a JavaScript destructuring spec.
If FUNC is supplied, call it with no arguments before every variable name in the spec. Return true if this was actually a spec. FUNC must preserve the match data.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--forward-destructuring-spec (&optional func)
"Move forward over a JavaScript destructuring spec.
If FUNC is supplied, call it with no arguments before every
variable name in the spec. Return true if this was actually a
spec. FUNC must preserve the match data."
(pcase (char-after)
(?\[
(forward-char)
(while
(progn
(forward-comment most-positive-fixnum)
(cond ((memq (char-after) '(?\[ ?\{))
(js--forward-destructuring-spec func))
((eq (char-after) ?,)
(forward-char)
t)
((looking-at js--name-re)
(and func (funcall func))
(goto-char (match-end 0))
t))))
(when (eq (char-after) ?\])
(forward-char)
t))
(?\{
(forward-char)
(forward-comment most-positive-fixnum)
(while
(when (looking-at js--objfield-re)
(goto-char (match-end 0))
(forward-comment most-positive-fixnum)
(and (cond ((memq (char-after) '(?\[ ?\{))
(js--forward-destructuring-spec func))
((looking-at js--name-re)
(and func (funcall func))
(goto-char (match-end 0))
t))
(progn (forward-comment most-positive-fixnum)
(when (eq (char-after) ?\,)
(forward-char)
(forward-comment most-positive-fixnum)
t)))))
(when (eq (char-after) ?\})
(forward-char)
t))))