Fix excluding last parameter

This commit is contained in:
Jonathan Müller 2017-10-01 21:23:34 +02:00
commit 682754649a

View file

@ -65,11 +65,15 @@ namespace
{ {
auto need_sep = false; auto need_sep = false;
for (auto& child : cont) for (auto& child : cont)
{
auto is_excluded = output.options(child, cur_access).is_set(code_generator::exclude);
if (!is_excluded)
{ {
if (need_sep) if (need_sep)
output << s; output << s;
need_sep = generate_code_impl(*output.generator(), child, cur_access); need_sep = generate_code_impl(*output.generator(), child, cur_access);
} }
}
return need_sep; return need_sep;
} }
@ -906,22 +910,24 @@ namespace
output << keyword("template") << operator_ws << punctuation("<") << bracket_ws; output << keyword("template") << operator_ws << punctuation("<") << bracket_ws;
auto need_sep = false; auto need_sep = false;
auto first = hide_if_empty; auto need_header = hide_if_empty;
for (auto& param : templ.parameters()) for (auto& param : templ.parameters())
{ {
if (first auto is_excluded = output.options(param, cpp_public).is_set(code_generator::exclude);
&& !output.options(*templ.parameters().begin(), cpp_public) if (!is_excluded)
.is_set(code_generator::exclude))
{ {
first = false; if (need_header)
{
need_header = false;
output << keyword("template") << operator_ws << punctuation("<") << bracket_ws; output << keyword("template") << operator_ws << punctuation("<") << bracket_ws;
} }
else if (need_sep) else if (need_sep)
output << comma; output << comma;
need_sep = generate_code_impl(*output.generator(), param, cpp_public); need_sep = generate_code_impl(*output.generator(), param, cpp_public);
} }
}
if (!hide_if_empty || need_sep) if (!need_header)
output << bracket_ws << punctuation(">") << newl; output << bracket_ws << punctuation(">") << newl;
} }