Permalink
Browse files

Fixed the renaming of methods in forwarded types from secondary bases…

… in dependencies.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Jul 28, 2017
1 parent 8b9c3ab commit d2426a7db63f16ccbc39beb13f8e1b13d08f87a2
@@ -30,6 +30,7 @@ public int GetHashCode(Parameter obj)
protected RenamePass()
{
VisitOptions.VisitFunctionParameters = false;
VisitOptions.VisitFunctionReturnType = false;
VisitOptions.VisitTemplateArguments = false;
// these need to be visited but in a different order (see VisitClassDecl) so disable the default order
@@ -226,6 +227,9 @@ public override bool VisitClassDecl(Class @class)
if (!base.VisitClassDecl(@class))
return false;
if (@class.OriginalClass != null)
VisitClassDecl(@class.OriginalClass);
foreach (var property in @class.Properties.OrderByDescending(p => p.Access))
VisitProperty(property);
@@ -36,3 +36,15 @@ int HasVirtualInCore::virtualInCore(int parameter)
{
return 1;
}
SecondaryBase::SecondaryBase()
{
}
SecondaryBase::~SecondaryBase()
{
}
void SecondaryBase::function()
{
}
@@ -65,3 +65,14 @@ class DLL_API HasVirtualInCore
HasVirtualInCore();
virtual int virtualInCore(int parameter);
};
class DLL_API DerivedFromSecondaryBaseInDependency;
typedef DerivedFromSecondaryBaseInDependency RenameDerivedBeforeBase;
class DLL_API SecondaryBase
{
public:
SecondaryBase();
~SecondaryBase();
void function();
};
@@ -4,6 +4,12 @@
[TestFixture]
public class NamespaceDerivedTests
{
[Test]
public void TestCodeGeneration()
{
using (new DerivedFromSecondaryBaseInDependency()) { }
}
[Test]
public void TestNonRenamedMethod()
{
@@ -27,9 +33,6 @@ public void TestOverrideMethodFromDependency()
private class OverrideMethodFromDependency : HasVirtualInDependency
{
public override int VirtualInCore(int parameter)
{
return 2;
}
public override int VirtualInCore(int parameter) => 2;
}
}
@@ -70,3 +70,11 @@ int HasVirtualInDependency::callManagedOverride()
{
return managedObject->virtualInCore(0);
}
DerivedFromSecondaryBaseInDependency::DerivedFromSecondaryBaseInDependency()
{
}
DerivedFromSecondaryBaseInDependency::~DerivedFromSecondaryBaseInDependency()
{
}
@@ -71,6 +71,13 @@ class DLL_API HasVirtualInDependency : public HasVirtualInCore
int callManagedOverride();
};
class DLL_API DerivedFromSecondaryBaseInDependency : public Derived, public SecondaryBase
{
public:
DerivedFromSecondaryBaseInDependency();
~DerivedFromSecondaryBaseInDependency();
};
namespace NamespacesBase
{
class DLL_API ClassInNamespaceNamedAfterDependency

0 comments on commit d2426a7

Please sign in to comment.