Skip to content

Commit

Permalink
Fix class member generation
Browse files Browse the repository at this point in the history
It would duplicate members if the members were of a different type than
TAG_member or TAG_typedef. But it didn't matter because those other tags
got erroneously filtered out.
  • Loading branch information
RA-Kooi committed Dec 21, 2021
1 parent 8a10b9a commit df6a27f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions DwarfOne2C/CWriter/Class.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ private static List<string> GenerateClassStruct(
child.sibling != Tag.NoSibling;
child = allTags[IDToIndex[child.sibling]])
{
// This is perhaps not needed anymore...
// Work around weirdness where anonymous structs are generated
// with members (padding) and functions (padding) as children.
if(child.tagType == TagType.Member
|| child.tagType == TagType.TypeDef)
/*if(child.tagType == TagType.Member
|| child.tagType == TagType.TypeDef)*/
children.Add(child);
}

Expand Down Expand Up @@ -119,13 +120,22 @@ private static List<string> GenerateClassStruct(
{
child = children[i];

code.AddRange(
TagDispatcher(
List<string> innerCode = TagDispatcher(
allTags,
allMemberFuncs,
IDToIndex,
child,
depth + 1));
depth + 1);

if(innerCode.Count > 0)
{
innerCode.RemoveAt(innerCode.Count - 1);

code.Add("");
code.AddRange(innerCode);

continue;
}

if(child.accessLevel != accessLevel
&& child.accessLevel != AccessLevel.None)
Expand Down

0 comments on commit df6a27f

Please sign in to comment.