Commit cc80eeb4 authored by Alan Mackenzie's avatar Alan Mackenzie

Analyze C++ method with & or && ref-qualifier as defun, not brace list

Also firm up detection of beginning of brace list in
c-looking-at-or-maybe-in-bracelist.

* lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): On
detection of such a ref-qualifier, set braceassignp to nil.  When this
variable has a nil value, return nil as the value of the function.  On
encountering a } when scanning backwards, recognise this as the end of a
previous construct and stop the scan.
parent 896e5802
Pipeline #1260 failed with stage
in 49 minutes and 49 seconds
......@@ -10953,7 +10953,8 @@ comment at the start of cc-engine.el for more info."
(eq (char-after) ?\())
(setq braceassignp 'c++-noassign
in-paren 'in-paren))
((looking-at c-pre-id-bracelist-key))
((looking-at c-pre-id-bracelist-key)
(setq braceassignp nil))
((looking-at c-return-key))
((and (looking-at c-symbol-start)
(not (looking-at c-keywords-regexp)))
......@@ -10995,6 +10996,8 @@ comment at the start of cc-engine.el for more info."
(setq pos (point))
(cond
((not braceassignp)
nil)
((and after-type-id-pos
(goto-char after-type-id-pos)
(setq res (c-back-over-member-initializers))
......@@ -11069,14 +11072,20 @@ comment at the start of cc-engine.el for more info."
))))
nil)
(t t))))))
(when (and (eq braceassignp 'dontknow)
(/= (c-backward-token-2 1 t lim) 0))
(if (save-excursion
(and c-has-compound-literals
(eq (c-backward-token-2 1 nil lim) 0)
(eq (char-after) ?\()))
(setq braceassignp t)
(setq braceassignp nil))))
(when (eq braceassignp 'dontknow)
(cond ((and
(not (eq (char-after) ?,))
(save-excursion
(c-backward-syntactic-ws)
(eq (char-before) ?})))
(setq braceassignp nil))
((/= (c-backward-token-2 1 t lim) 0)
(if (save-excursion
(and c-has-compound-literals
(eq (c-backward-token-2 1 nil lim) 0)
(eq (char-after) ?\()))
(setq braceassignp t)
(setq braceassignp nil))))))
(cond
(braceassignp
......@@ -11108,9 +11117,14 @@ comment at the start of cc-engine.el for more info."
(and (consp res)
(eq (car res) after-type-id-pos))))))
(cons bufpos (or in-paren inexpr-brace-list)))
((eq (char-after) ?\;)
;; Brace lists can't contain a semicolon, so we're done.
;; (setq containing-sexp nil)
((or (eq (char-after) ?\;)
;; Brace lists can't contain a semicolon, so we're done.
(save-excursion
(c-backward-syntactic-ws)
(eq (char-before) ?}))
;; They also can't contain a bare }, which is probably the end
;; of a function.
)
nil)
((and (setq macro-start (point))
(c-forward-to-cpp-define-body)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment