Skip to content

Commit 58bf524

Browse files
committed
fix: remove all special name re-mappings for Handlebars
We renamed some members into different Handlebars key names. But there's no particular reason to do that. So we switch to use the canonical names everywhere.
1 parent c4dd89a commit 58bf524

5 files changed

Lines changed: 13 additions & 37 deletions

File tree

share/mrdocs/addons/generator/common/partials/symbol/name-text.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
--}}
1414
{{~#if (and (eq kind "function") (eq funcClass "conversion"))~}}
1515
{{! Conversion operator: "operator" and the type declarator ~}}
16-
operator {{>type/declarator-text return ~}}
16+
operator {{>type/declarator-text returnType ~}}
1717
{{~else if (eq kind "guide")~}}
1818
{{! Deduction guide: "deduced" type declarator ~}}
1919
{{>type/declarator-text deduced ~}}
@@ -22,7 +22,7 @@
2222
{{~#if name~}}
2323
{{~name~}}
2424
{{~else if parent ~}}
25-
Unnamed {{or tag kind~}}
25+
Unnamed {{or keyKind kind~}}
2626
{{~else ~}}
2727
Global namespace
2828
{{~/if~}}

share/mrdocs/addons/generator/common/partials/symbol/name.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
--}}
1414
{{~#if (and (eq kind "function") (eq funcClass "conversion"))~}}
1515
{{! Conversion operator: "operator" and the type declarator ~}}
16-
operator {{>type/declarator return ~}}
16+
operator {{>type/declarator returnType ~}}
1717
{{~else if (eq kind "guide")~}}
1818
{{! Deduction guide: "deduced" type declarator ~}}
1919
{{>type/declarator deduced ~}}

share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
{{/if~}}
55
{{#if attributes}}{{#unless isFriend}}{{ str "[[" }}{{join ", " attributes}}{{ str "]]" }}
66
{{/unless}}{{/if~}}
7-
{{#if constexprKind}}{{constexprKind}}
7+
{{#if constexpr}}{{constexpr}}
88
{{/if~}}
99
{{#if storageClass}}{{storageClass}}
1010
{{/if~}}
1111
{{#if isVirtual}}virtual
1212
{{/if~}}
13-
{{#if explicitSpec}}{{explicitSpec}}
13+
{{#if explicit}}{{explicit}}
1414
{{/if~}}
15-
{{#if (eq funcClass "normal")}}{{>type/declarator-prefix return}}
15+
{{#if (eq funcClass "normal")}}{{>type/declarator-prefix returnType}}
1616
{{/if~}}
1717
{{~#if force-link~}}
1818
{{>symbol/name symbol }}
@@ -31,8 +31,8 @@
3131
{{~#if isConst}} const{{/if~}}
3232
{{#if isVolatile}} volatile{{/if~}}
3333
{{#if refQualifier}} {{refQualifier}}{{/if~}}
34-
{{#if exceptionSpec}} {{exceptionSpec}}{{/if~}}
35-
{{#if (eq funcClass "normal")}}{{>type/declarator-suffix return}}{{/if~}}
34+
{{#if noexcept}} {{noexcept}}{{/if~}}
35+
{{#if (eq funcClass "normal")}}{{>type/declarator-suffix returnType}}{{/if~}}
3636
{{#if requires}}
3737

3838
requires {{requires}}{{/if~}}

share/mrdocs/addons/generator/common/partials/symbol/signature/record.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{#if template}}{{>template/head template}}
22
{{/if~}}
33
{{#if isFriend}}friend {{/if~}}
4-
{{~tag}} {{#if (contains (arr "explicit" "partial") template.kind)~}}
4+
{{~keyKind}} {{#if (contains (arr "explicit" "partial") template.kind)~}}
55
{{!~ If the last part is a template specialization, we include links to primary template and the arguments. ~}}
66
{{!~ If the primary template wasn't correctly extracted for some reason, we just print the name as usual. ~}}
77
{{#if template.primary }}{{~>symbol/name template.primary ~}}{{else}}{{ name }}{{/if}}{{>template/args args=template.args ~}}

src/lib/Support/Reflection/MapReflectedType.hpp

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,36 +83,12 @@ inline
8383
std::string
8484
normalizeMemberName(std::string_view name)
8585
{
86-
// Special cases.
87-
if (name == "Constexpr")
86+
std::string result(name);
87+
if (!result.empty())
8888
{
89-
return "constexprKind";
90-
}
91-
else if (name == "ReturnType")
92-
{
93-
return "return";
94-
}
95-
else if (name == "Noexcept")
96-
{
97-
return "exceptionSpec";
98-
}
99-
else if (name == "Explicit")
100-
{
101-
return "explicitSpec";
102-
}
103-
else if (name == "KeyKind")
104-
{
105-
return "tag";
106-
}
107-
else
108-
{
109-
std::string result(name);
110-
if (!result.empty())
111-
{
112-
result.front() = std::tolower(result.front(), std::locale::classic());
113-
}
114-
return result;
89+
result.front() = std::tolower(result.front(), std::locale::classic());
11590
}
91+
return result;
11692
}
11793

11894
/** Remove namespace qualifiers from a type name.

0 commit comments

Comments
 (0)