branch: master
commit b1234ca57f7d043fff8c14eb2857d2d435a40fde
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Don't misindent generator methods
Fixes #275 in the old-indent subpackage; Emacs 25 snapshot users
should update to the latest version.
---
js2-old-indent.el | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/js2-old-indent.el b/js2-old-indent.el
index efc9053..bb605bc 100644
--- a/js2-old-indent.el
+++ b/js2-old-indent.el
@@ -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."