]> code.delx.au - gnu-emacs-elpa/commitdiff
Declare vars created with renaming destructuring
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 2 May 2016 00:26:52 +0000 (03:26 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 2 May 2016 00:26:52 +0000 (03:26 +0300)
Fixes regression from 0555a8a3.

js2-mode.el
tests/parser.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))
index 4a8c9c3818e93926c6865fe2d5b08712630184a3..b546c1cff0a4462e2dcf8d516a8200a65485458c 100644 (file)
@@ -188,7 +188,8 @@ the test."
   :warnings-count 0)
 
 (js2-deftest-parse destruct-in-arguments
-  "function f({a: aa, b: bb}) {\n}")
+  "function f({a: aa, b: bb}) {\n}"
+  :warnings-count 0)
 
 (js2-deftest-parse destruct-in-array-comp-loop
   "[a + b for ([a, b] in [[0, 1], [1, 2]])];")