Skip to content

Commit eb6a90d

Browse files
committed
Fix the naming of anonymous types when 2+ types are nested 2+ levels
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent d2e8d6e commit eb6a90d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Generator/Passes/CleanInvalidDeclNamesPass.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,12 @@ public override bool VisitDeclarationContext(DeclarationContext context)
5858
return false;
5959

6060
DeclarationContext currentContext = context;
61-
int parents = 0;
61+
int order = -1;
6262
while (currentContext != null)
6363
{
64-
parents++;
64+
order++;
6565
currentContext = currentContext.Namespace;
6666
}
67-
int order = parents % 2;
6867
CheckChildrenNames(context.Declarations, ref order);
6968

7069
var @class = context as Class;

tests/CSharp/CSharp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,12 @@ struct {
13111311
struct {
13121312
struct {
13131313
int(*forIntegers)(int b, short s, unsigned int i);
1314+
struct {
1315+
int i;
1316+
} APIHost;
1317+
struct {
1318+
int i;
1319+
} Method;
13141320
} example;
13151321
} root;
13161322
} kotlin;

0 commit comments

Comments
 (0)