codegen: fix ignorable fields and duplicate accessors
@@ -299,8 +299,7 @@ kainjow::mustache::object EnumProcessor::process (const kdb::Key & key, const st
auto isNew = true;
auto generateTypeDef = shouldGenerateTypeDef (key);
- if (genType && generateTypeDef)
- {
+
auto other = enumTypes.find (typeName);
if (other != enumTypes.end ())
{
@@ -318,7 +317,6 @@ kainjow::mustache::object EnumProcessor::process (const kdb::Key & key, const st
}
enumTypes[typeName] = std::make_pair (name, valuesString);
- }
auto useTrie = conversion == EnumConversion::Trie || (conversion == EnumConversion::Default && trieDepth < 3);
@@ -559,8 +557,7 @@ kainjow::mustache::object StructProcessor::process (const kdb::Key & key, const
auto isNew = true;
auto generateTypeDef = shouldGenerateTypeDef (key);
- if (genType && generateTypeDef)
- {
+
auto other = structTypes.find (typeName);
if (other != structTypes.end ())
{
@@ -577,7 +574,6 @@ kainjow::mustache::object StructProcessor::process (const kdb::Key & key, const
}
structTypes[typeName] = std::make_pair (name, fieldsString);
- }
return object{ { "new", isNew },
{ "type_name", typeName },
@@ -925,8 +921,13 @@ kainjow::mustache::data ElektraGenTemplate::getTemplateData (const std::string &
kdb::KeySet subkeys;
for (auto cur = it + 1; cur != ks.end (); ++cur)
{
- if (cur->isBelow (key) && !StructProcessor::isFieldIgnored (*cur))
+ if (cur->isBelow (key))
+ {
+ if (StructProcessor::isFieldIgnored (*cur))
{
+ continue;
+ }
+
auto parts = getKeyParts (*cur);
if (parts.size () <= baseDepth + maxDepth)
{
