]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/js.el
Fix problems caused by new implementation of sub-word mode
[gnu-emacs] / lisp / progmodes / js.el
index d59e7679b478cd69ee5a6902a8d98d5d79d38398..15a52ba8cdc9a0b1a2f2c3e9e1c8981454a0a044 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."