Skip to content

Commit aad3b7f

Browse files
committed
Fixed the renaming of properties with the same name as their owners.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 63dc3b5 commit aad3b7f

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

src/Generator/Passes/RenamePass.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,12 @@ private static bool AreThereConflicts(Declaration decl, string newName)
170170
declarations.AddRange(decl.Namespace.Classes.Where(c => !c.IsIncomplete));
171171
declarations.AddRange(decl.Namespace.Enums);
172172
declarations.AddRange(decl.Namespace.Events);
173+
declarations.Add(decl.Namespace);
173174

174175
var function = decl as Function;
175176
if (function != null)
176-
{
177-
declarations.Add(function.Namespace);
178177
// account for overloads
179178
declarations.AddRange(GetFunctionsWithTheSameParams(function));
180-
}
181179
else
182180
declarations.AddRange(decl.Namespace.Functions);
183181

tests/Common/Common.Tests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public unsafe void TestCodeGeneration()
4747
using (var hasProtectedEnum = new HasProtectedEnum())
4848
{
4949
}
50+
using (var hasPropertyNamedAsParent = new HasPropertyNamedAsParent())
51+
{
52+
hasPropertyNamedAsParent.hasPropertyNamedAsParent.GetHashCode();
53+
}
5054
EnumWithUnderscores e = EnumWithUnderscores.lOWER_BEFORE_CAPITAL;
5155
e = EnumWithUnderscores.UnderscoreAtEnd;
5256
e = EnumWithUnderscores.CAPITALS_More;

tests/Common/Common.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,14 @@ AmbiguousParamNames::~AmbiguousParamNames()
999999
{
10001000
}
10011001

1002+
HasPropertyNamedAsParent::HasPropertyNamedAsParent()
1003+
{
1004+
}
1005+
1006+
HasPropertyNamedAsParent::~HasPropertyNamedAsParent()
1007+
{
1008+
}
1009+
10021010
void integerOverload(int i)
10031011
{
10041012
}

tests/Common/Common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,14 @@ class DLL_API AmbiguousParamNames
14011401
~AmbiguousParamNames();
14021402
};
14031403

1404+
class DLL_API HasPropertyNamedAsParent
1405+
{
1406+
public:
1407+
HasPropertyNamedAsParent();
1408+
~HasPropertyNamedAsParent();
1409+
int hasPropertyNamedAsParent;
1410+
};
1411+
14041412
template<typename T> void TemplatedFunction(T type)
14051413
{
14061414

0 commit comments

Comments
 (0)