branch: elpa/d-mode
commit 12e45cf0978fcee48a54bbdf6c4b9ce4f59ef60f
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Fix fontification of properties with inferred return type
---
d-mode.el | 9 ++++++++-
tests/fonts.d | 2 ++
tests/fonts.d.html | 2 ++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/d-mode.el b/d-mode.el
index 42a0a34..e5d6932 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,7 +7,7 @@
;; Maintainer: Russel Winder <[email protected]>
;; Vladimir Panteleev <[email protected]>
;; Created: March 2007
-;; Version: 201909102153
+;; Version: 201909120240
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -1045,6 +1045,13 @@ Each list item should be a regexp matching a single
identifier."
(apply orig-fun args))
(t
+ ;; Work around a cc-mode bug(?) in which the c-forward-annotation
+ ;; calls in c-forward-decl-or-cast-1 do not advance the start
+ ;; position, causing the annotation to be fontified as the
+ ;; function name.
+ (while (c-forward-annotation)
+ (c-forward-syntactic-ws))
+
(add-function :around (symbol-function 'c-forward-name)
#'d-special-case-c-forward-name)
(unwind-protect
diff --git a/tests/fonts.d b/tests/fonts.d
index eb995c2..76a5a0c 100644
--- a/tests/fonts.d
+++ b/tests/fonts.d
@@ -19,3 +19,5 @@ static if (true) {} else void fun();
scope(exit) fun();
scope(exit) void fun();
+
+@property empty() { return false; }
diff --git a/tests/fonts.d.html b/tests/fonts.d.html
index 0df8a38..ea1d543 100644
--- a/tests/fonts.d.html
+++ b/tests/fonts.d.html
@@ -19,3 +19,5 @@
<span class="keyword">scope</span>(exit) fun();
<span class="keyword">scope</span>(exit) <span class="type">void</span> <span
class="function-name">fun</span>();
+
+<span class="c-annotation-face">@property</span> <span
class="function-name">empty</span>() { <span class="keyword">return</span>
<span class="constant">false</span>; }