mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Fontify Java constructor names and arglists
This fixes bug#63328. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): New variable got-stmt-block. After scanning an arglist, set got-arglist to t. When we have as yet no identifier, got-arglist, and scan an open brace, test the "type" for being the name of the enclosing class. (c-directly-in-class-called-p): Test the two names for equality, not merely one being the head of the other.
This commit is contained in:
parent
1eb5faa261
commit
bb7605c087
1 changed files with 26 additions and 4 deletions
|
|
@ -10636,6 +10636,10 @@ This function might do hidden buffer changes."
|
|||
got-parens
|
||||
;; True if there is a terminated argument list.
|
||||
got-arglist
|
||||
;; True when `got-arglist' and the token after the end of the
|
||||
;; arglist is an opening brace. Used only when we have a
|
||||
;; suspected typeless function name.
|
||||
got-stmt-block
|
||||
;; True if there is an identifier in the declarator.
|
||||
got-identifier
|
||||
;; True if we find a number where an identifier was expected.
|
||||
|
|
@ -10788,6 +10792,10 @@ This function might do hidden buffer changes."
|
|||
(setq got-arglist t))
|
||||
t)
|
||||
(when (cond
|
||||
((and (eq (char-after) ?\()
|
||||
(c-safe (c-forward-sexp 1) t))
|
||||
(when (eq (char-before) ?\))
|
||||
(setq got-arglist t)))
|
||||
((save-match-data (looking-at "\\s("))
|
||||
(c-safe (c-forward-sexp 1) t))
|
||||
((save-match-data
|
||||
|
|
@ -10802,6 +10810,11 @@ This function might do hidden buffer changes."
|
|||
(setq got-suffix-after-parens (match-beginning 0)))
|
||||
(setq got-suffix t))))
|
||||
|
||||
((and got-arglist
|
||||
(eq (char-after) ?{))
|
||||
(setq got-stmt-block t)
|
||||
nil)
|
||||
|
||||
(t
|
||||
;; No suffix matched. We might have matched the
|
||||
;; identifier as a type and the open paren of a
|
||||
|
|
@ -10870,9 +10883,17 @@ This function might do hidden buffer changes."
|
|||
(not (memq context '(arglist decl))))
|
||||
(or (and new-style-auto
|
||||
(looking-at c-auto-ops-re))
|
||||
(and (or maybe-typeless backup-maybe-typeless)
|
||||
(not got-prefix)
|
||||
at-type)))
|
||||
(and (not got-prefix)
|
||||
at-type
|
||||
(or maybe-typeless backup-maybe-typeless
|
||||
;; Do we have a (typeless) constructor?
|
||||
(and got-stmt-block
|
||||
(save-excursion
|
||||
(goto-char type-start)
|
||||
(and
|
||||
(looking-at c-identifier-key)
|
||||
(c-directly-in-class-called-p
|
||||
(match-string 0)))))))))
|
||||
;; Have found no identifier but `c-typeless-decl-kwds' has
|
||||
;; matched so we know we're inside a declaration. The
|
||||
;; preceding type must be the identifier instead.
|
||||
|
|
@ -12554,7 +12575,8 @@ comment at the start of cc-engine.el for more info."
|
|||
(looking-at c-class-key))
|
||||
(goto-char (match-end 1))
|
||||
(c-forward-syntactic-ws)
|
||||
(looking-at name))))))
|
||||
(and (looking-at c-identifier-key)
|
||||
(string= (match-string 0) name)))))))
|
||||
|
||||
(defun c-search-uplist-for-classkey (paren-state)
|
||||
;; Check if the closest containing paren sexp is a declaration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue