Browse Source

Fixed the renaming of properties with the same name as their owners.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1182/head
Dimitar Dobrev 7 years ago
parent
commit
aad3b7f186
  1. 4
      src/Generator/Passes/RenamePass.cs
  2. 4
      tests/Common/Common.Tests.cs
  3. 8
      tests/Common/Common.cpp
  4. 8
      tests/Common/Common.h

4
src/Generator/Passes/RenamePass.cs

@ -170,14 +170,12 @@ namespace CppSharp.Passes
declarations.AddRange(decl.Namespace.Classes.Where(c => !c.IsIncomplete)); declarations.AddRange(decl.Namespace.Classes.Where(c => !c.IsIncomplete));
declarations.AddRange(decl.Namespace.Enums); declarations.AddRange(decl.Namespace.Enums);
declarations.AddRange(decl.Namespace.Events); declarations.AddRange(decl.Namespace.Events);
declarations.Add(decl.Namespace);
var function = decl as Function; var function = decl as Function;
if (function != null) if (function != null)
{
declarations.Add(function.Namespace);
// account for overloads // account for overloads
declarations.AddRange(GetFunctionsWithTheSameParams(function)); declarations.AddRange(GetFunctionsWithTheSameParams(function));
}
else else
declarations.AddRange(decl.Namespace.Functions); declarations.AddRange(decl.Namespace.Functions);

4
tests/Common/Common.Tests.cs

@ -47,6 +47,10 @@ public class CommonTests : GeneratorTestFixture
using (var hasProtectedEnum = new HasProtectedEnum()) using (var hasProtectedEnum = new HasProtectedEnum())
{ {
} }
using (var hasPropertyNamedAsParent = new HasPropertyNamedAsParent())
{
hasPropertyNamedAsParent.hasPropertyNamedAsParent.GetHashCode();
}
EnumWithUnderscores e = EnumWithUnderscores.lOWER_BEFORE_CAPITAL; EnumWithUnderscores e = EnumWithUnderscores.lOWER_BEFORE_CAPITAL;
e = EnumWithUnderscores.UnderscoreAtEnd; e = EnumWithUnderscores.UnderscoreAtEnd;
e = EnumWithUnderscores.CAPITALS_More; e = EnumWithUnderscores.CAPITALS_More;

8
tests/Common/Common.cpp

@ -999,6 +999,14 @@ AmbiguousParamNames::~AmbiguousParamNames()
{ {
} }
HasPropertyNamedAsParent::HasPropertyNamedAsParent()
{
}
HasPropertyNamedAsParent::~HasPropertyNamedAsParent()
{
}
void integerOverload(int i) void integerOverload(int i)
{ {
} }

8
tests/Common/Common.h

@ -1401,6 +1401,14 @@ public:
~AmbiguousParamNames(); ~AmbiguousParamNames();
}; };
class DLL_API HasPropertyNamedAsParent
{
public:
HasPropertyNamedAsParent();
~HasPropertyNamedAsParent();
int hasPropertyNamedAsParent;
};
template<typename T> void TemplatedFunction(T type) template<typename T> void TemplatedFunction(T type)
{ {

Loading…
Cancel
Save