]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix fontification of C++ declaration with type FOO::FOO.
authorAlan Mackenzie <acm@muc.de>
Sat, 22 Apr 2017 14:45:24 +0000 (14:45 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 22 Apr 2017 14:45:24 +0000 (14:45 +0000)
* lisp/progmodes/cc-engine.el (c-find-decl-spots): Initialize
cfd-top-level properly.
(c-forward-decl-or-cast-1): On finding FOO::FOO, check it is followed by "("
before deciding it is a constructor.

* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare): Negate the
result of the c-bs-at-toplevel-p call passed to c-font-lock-declarators
(simple bug fix).

lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el

index e7a8962ac2b96a09c578a4d621a46a8019494dd5..4af7c3597479dcff745fb1a24911ffe0f4fbdf7c 100644 (file)
@@ -5681,7 +5681,7 @@ comment at the start of cc-engine.el for more info."
        ;; Whether the last position returned from `c-find-decl-prefix-search'
        ;; is at the top-level (including directly in a class or namespace,
        ;; etc.).
-       cfd-top-level)
+       (cfd-top-level (c-bs-at-toplevel-p (point))))
 
     ;; Initialize by finding a syntactically relevant start position
     ;; before the point, and do the first `c-decl-prefix-or-start-re'
@@ -8379,7 +8379,11 @@ comment at the start of cc-engine.el for more info."
                   (c-simple-skip-symbol-backward))
                 (>= (point) type-start)
                 (equal (buffer-substring-no-properties (point) end-1)
-                       name))
+                       name)
+                (goto-char end-2)
+                (progn
+                  (c-forward-syntactic-ws)
+                  (eq (char-after) ?\()))
            ;; It is a (con|de)structor name.  In that case the
            ;; declaration is typeless so zap out any preceding
            ;; identifier(s) that we might have taken as types.
index 923f077b411bf9b22a4f4999c7716537ad5cc089..adb1f1a4937843c19f87b6c2c2591dd8f461d3e6 100644 (file)
@@ -900,7 +900,7 @@ casts and declarations are fontified.  Used on level 2 and higher."
     (when (memq prop '(c-decl-id-start c-decl-type-start))
       (c-forward-syntactic-ws limit)
       (c-font-lock-declarators limit t (eq prop 'c-decl-type-start)
-                              (c-bs-at-toplevel-p (point)))))
+                              (not (c-bs-at-toplevel-p (point))))))
 
   (setq c-font-lock-context ;; (c-guess-font-lock-context)
        (save-excursion