aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov2016-03-05 14:35:10 +0200
committerDmitry Gutov2016-03-05 14:35:35 +0200
commitdc9d837d02edd665f2c9468de51bb4a1dda7ef6d (patch)
treec285c7e4df684ae98679577bc55e137c367736d7 /lisp
parent792311228d8f4cb26262c279e310b0344d735bd8 (diff)
downloademacs-dc9d837d02edd665f2c9468de51bb4a1dda7ef6d.tar.gz
emacs-dc9d837d02edd665f2c9468de51bb4a1dda7ef6d.zip
Don't misindent computed property generator methods
* lisp/progmodes/js.el (js--looking-at-operator-p): Don't misindent computed property generator methods (https://github.com/mooz/js2-mode/issues/317).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/js.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index d59e7679b47..15a52ba8cdc 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1758,12 +1758,13 @@ This performs fontification according to `js--class-styles'."
1758 (eq (char-after) ??)))) 1758 (eq (char-after) ??))))
1759 (not (and 1759 (not (and
1760 (eq (char-after) ?*) 1760 (eq (char-after) ?*)
1761 (looking-at (concat "\\* *" js--name-re " *(")) 1761 ;; Generator method (possibly using computed property).
1762 (looking-at (concat "\\* *\\(?:\\[\\|" js--name-re " *(\\)"))
1762 (save-excursion 1763 (save-excursion
1763 (goto-char (1- (match-end 0))) 1764 (js--backward-syntactic-ws)
1764 (let (forward-sexp-function) (forward-sexp)) 1765 ;; We might misindent some expressions that would
1765 (js--forward-syntactic-ws) 1766 ;; return NaN anyway. Shouldn't be a problem.
1766 (eq (char-after) ?{))))))) 1767 (memq (char-before) '(?, ?} ?{))))))))
1767 1768
1768(defun js--continued-expression-p () 1769(defun js--continued-expression-p ()
1769 "Return non-nil if the current line continues an expression." 1770 "Return non-nil if the current line continues an expression."