]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/js.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / progmodes / js.el
index 07849484b788a716567038964d687a1b3871f7ab..1e5cc60ee51c6e33eaa5a53b4054d4954714511f 100644 (file)
@@ -1758,12 +1758,13 @@ This performs fontification according to `js--class-styles'."
                     (eq (char-after) ??))))
          (not (and
                (eq (char-after) ?*)
-               (looking-at (concat "\\* *" js--name-re " *("))
+               ;; Generator method (possibly using computed property).
+               (looking-at (concat "\\* *\\(?:\\[\\|" js--name-re " *(\\)"))
                (save-excursion
-                 (goto-char (1- (match-end 0)))
-                 (let (forward-sexp-function) (forward-sexp))
-                 (js--forward-syntactic-ws)
-                 (eq (char-after) ?{)))))))
+                 (js--backward-syntactic-ws)
+                 ;; We might misindent some expressions that would
+                 ;; return NaN anyway.  Shouldn't be a problem.
+                 (memq (char-before) '(?, ?} ?{))))))))
 
 (defun js--continued-expression-p ()
   "Return non-nil if the current line continues an expression."