]> code.delx.au - gnu-emacs-elpa/commitdiff
Recognize for-of and for-in loops with const
authorChristoph Dittmann <github@christoph-d.de>
Mon, 30 Nov 2015 09:41:34 +0000 (10:41 +0100)
committerChristoph Dittmann <github@christoph-d.de>
Mon, 30 Nov 2015 11:12:15 +0000 (12:12 +0100)
Declarations in for-of and for-in loops may also be "const".  See
http://www.ecma-international.org/ecma-262/6.0/#sec-runtime-semantics-bindinginstantiation

js2-mode.el

index 7e5c9d836358fdbc86cbffb3a221aa01eb272133..74f0ea2f1950cf231a44153fc271c94e1e05c877 100644 (file)
@@ -8924,7 +8924,7 @@ Last matched token must be js2-FOR."
              ((= tt js2-SEMI)
               (js2-unget-token)
               (setq init (make-js2-empty-expr-node)))
-             ((or (= tt js2-VAR) (= tt js2-LET))
+             ((or (= tt js2-VAR) (= tt js2-LET) (= tt js2-CONST))
               (setq init (js2-parse-variables tt (js2-current-token-beg))))
              (t
               (js2-unget-token)