Fix excluding last parameter

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

View file

@ -66,9 +66,13 @@ namespace
auto need_sep = false; auto need_sep = false;
for (auto& child : cont) for (auto& child : cont)
{ {
if (need_sep) auto is_excluded = output.options(child, cur_access).is_set(code_generator::exclude);
output << s; if (!is_excluded)
need_sep = generate_code_impl(*output.generator(), child, cur_access); {
if (need_sep)
output << s;
need_sep = generate_code_impl(*output.generator(), child, cur_access);
}
} }
return need_sep; return need_sep;
} }
@ -905,23 +909,25 @@ namespace
if (!hide_if_empty) if (!hide_if_empty)
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)
output << keyword("template") << operator_ws << punctuation("<") << bracket_ws; {
need_header = false;
output << keyword("template") << operator_ws << punctuation("<") << bracket_ws;
}
else if (need_sep)
output << comma;
need_sep = generate_code_impl(*output.generator(), param, cpp_public);
} }
else if (need_sep)
output << comma;
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;
} }