Skip to content

Commit 8735ba4

Browse files
authored
Fix indexing of class fields for derived classes (#97)
***NO_CI***
1 parent 01f79e4 commit 8735ba4

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

source/MetadataProcessor.Core/nanoSkeletonGenerator.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -557,26 +557,14 @@ private int GetNestedFieldsCount(TypeDefinition c)
557557
fieldCount = GetNestedFieldsCount(c.BaseType.Resolve());
558558

559559
// now add the fields count from this type
560-
if (_tablesContext.TypeDefinitionTable.TryGetTypeReferenceId(c, out tt))
561-
{
562-
fieldCount += c.Fields.Count(f => !f.IsStatic && !f.IsLiteral);
563-
}
560+
fieldCount += c.Fields.Count(f => !f.IsStatic && !f.IsLiteral);
564561

565562
return fieldCount;
566563
}
567564
else
568565
{
569566
// get the fields count from this type
570-
571-
if (_tablesContext.TypeDefinitionTable.TryGetTypeReferenceId(c, out tt))
572-
{
573-
return c.Fields.Count(f => !f.IsStatic && !f.IsLiteral);
574-
}
575-
else
576-
{
577-
// can't find this type in the table
578-
return 0;
579-
}
567+
return c.Fields.Count(f => !f.IsStatic && !f.IsLiteral);
580568
}
581569
}
582570
}

0 commit comments

Comments
 (0)