]> code.delx.au - gnu-emacs-elpa/blobdiff - js2-mode.el
Declare vars created with renaming destructuring
[gnu-emacs-elpa] / js2-mode.el
index 00be32c12a00a66f215af77ca95f476cb6a294d2..b2efce007d3d0f5590596e28a470874a26d07b12 100644 (file)
@@ -8100,11 +8100,19 @@ declared; probably to check them for errors."
       (dolist (elem (js2-object-node-elems node))
         ;; js2-infix-node-p catches both object prop node and initialized
         ;; binding element (which is directly an infix node).
-        (when (js2-infix-node-p elem)
+        (cond
+         ((js2-object-prop-node-p elem)
+          (push (js2-define-destruct-symbols
+                 ;; In abbreviated destructuring {a, b}, right == left.
+                 (js2-object-prop-node-right elem)
+                 decl-type face ignore-not-in-block)
+                name-nodes))
+         ;; Destructuring with default argument.
+         ((js2-infix-node-p elem)
           (push (js2-define-destruct-symbols
                  (js2-infix-node-left elem)
                  decl-type face ignore-not-in-block)
-                name-nodes)))
+                name-nodes))))
       (apply #'append (nreverse name-nodes)))
      ((js2-array-node-p node)
       (dolist (elem (js2-array-node-elems node))