]> code.delx.au - gnu-emacs-elpa/commitdiff
Don't misindent generator methods
authorDmitry Gutov <dgutov@yandex.ru>
Thu, 15 Oct 2015 19:44:07 +0000 (22:44 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 15 Oct 2015 19:44:07 +0000 (22:44 +0300)
Fixes #275 in the old-indent subpackage; Emacs 25 snapshot users
should update to the latest version.

js2-old-indent.el

index efc9053a2e8118c6615f8640b5c6e8a409f086c8..bb605bcbc95ab75c864a06acd7f3dd5c427ec919 100644 (file)
@@ -215,11 +215,20 @@ and comments have been removed."
 
 (defun js2-looking-at-operator-p ()
   "Return non-nil if text after point is a non-comma operator."
+  (defvar js2-mode-identifier-re)
   (and (looking-at js2-indent-operator-re)
-       (or (not (looking-at ":"))
+       (or (not (eq (char-after) ?:))
            (save-excursion
              (and (js2-re-search-backward "[?:{]\\|\\_<case\\_>" nil t)
-                  (looking-at "?"))))))
+                  (eq (char-after) ??))))
+       (not (and
+             (eq (char-after) ?*)
+             (looking-at (concat "\\* *" js2-mode-identifier-re " *("))
+             (save-excursion
+               (goto-char (1- (match-end 0)))
+               (let (forward-sexp-function) (forward-sexp))
+               (js2-forward-sws)
+               (eq (char-after) ?{))))))
 
 (defun js2-continued-expression-p ()
   "Return non-nil if the current line continues an expression."