]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix indentation of empty array literals
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 26 Apr 2011 21:20:40 +0000 (01:20 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 26 Apr 2011 21:20:40 +0000 (01:20 +0400)
js2-mode.el

index e02a154162e606550e60ad4785a74c8fb59bbf53..b4cf4eda2824d89ed9bef5b87bcbf0e13ab1d5e3 100644 (file)
@@ -9999,7 +9999,8 @@ In particular, return the buffer position of the first `for' kwd."
                     (match-beginning 0)))
             ;; to skip arbitrary expressions we need the parser,
             ;; so we'll just guess at it.
-            (if (re-search-forward "[^,]* \\(for\\) " end t)
+            (if (and (> end (point)) ; not empty literal
+                     (re-search-forward "[^,]]* \\(for\\) " end t))
                 (match-beginning 1))))))))
 
 (defun js2-array-comp-indentation (parse-status for-kwd)