aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-08-01 13:23:15 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-08-01 13:23:15 -0300
commit7181abd43d76115de8dedfba12307f8df54a95b9 (patch)
tree20a24251eeba9783eae412b25569428677680a6e
parentmono-docs: Add misc struct docs (diff)
downloadefl-7181abd43d76115de8dedfba12307f8df54a95b9.tar.gz
Avoid generating empty <value> tags
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index 413f59ec53..f4d55ea4f9 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -406,15 +406,16 @@ struct struct_definition_generator
// iterate struct fields
for (auto const& field : struct_.fields)
{
- auto field_name = field.name;
- field_name[0] = std::toupper(field_name[0]); // Hack to allow 'static' as a field name
- if (!as_generator
- (
- documentation(indent.n + 1)
- << indent << scope_tab << "/// <value>" << string << "</value>\n"
- << indent << scope_tab << "public " << type << " " << string << ";\n"
- )
- .generate(sink, std::make_tuple(field, field.type.doc_summary, field.type, name_helpers::to_field_name(field.name)), context))
+ if (!as_generator(documentation(indent.n + 1)).generate(sink, field, context))
+ return false;
+
+ if (!field.type.doc_summary.empty())
+ {
+ if (!as_generator(indent << scope_tab << "/// <value>" << field.type.doc_summary << "</value>\n").generate(sink, attributes::unused, context))
+ return false;
+ }
+
+ if (!as_generator(indent << scope_tab << "public " << type << " " << name_helpers::to_field_name(field.name) << ";\n").generate(sink, field.type, context))
return false;
}