Browse Source

Fixed a naming conflict involving abstract properties.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/661/head
Dimitar Dobrev 9 years ago
parent
commit
a12a3e2532
  1. 10
      src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs
  2. 8
      tests/CSharp/CSharp.h

10
src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs

@ -158,6 +158,16 @@ namespace CppSharp.Passes @@ -158,6 +158,16 @@ namespace CppSharp.Passes
throw new Exception(string.Format(
"Property {0} has a base property null but its getter has a generated base method.",
getter.QualifiedOriginalName));
if (baseVirtualProperty != null && !baseVirtualProperty.IsVirtual)
{
// the only way the above can happen is if we are generating properties in abstract implementations
// in which case we can have less naming conflicts since the abstract base can also contain non-virtual properties
if (getter.SynthKind == FunctionSynthKind.AbstractImplCall)
return;
throw new Exception(string.Format(
"Base of property {0} is not virtual while the getter is.",
getter.QualifiedOriginalName));
}
if (baseVirtualProperty != null && baseVirtualProperty.SetMethod == null)
setter = null;
}

8
tests/CSharp/CSharp.h

@ -931,3 +931,11 @@ template <class Category, class Traversal> @@ -931,3 +931,11 @@ template <class Category, class Traversal>
struct iterator_category_with_traversal : Category, Traversal
{
};
class HasConflictWithAbstractProperty
{
public:
int conflictWithProperty();
virtual int getConflictWithProperty() = 0;
};

Loading…
Cancel
Save