diff --git a/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs b/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs index 86e7b01d..80586b00 100644 --- a/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs +++ b/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs @@ -94,14 +94,16 @@ namespace CppSharp.Passes foreach (var getter in nonSetters.Where(m => m.Namespace == type)) { string name = GetPropertyName(getter.Name); - if (string.Compare(name, afterSet, StringComparison.OrdinalIgnoreCase) == 0 && + if (name.StartsWith("is")) + { + name = char.ToLowerInvariant(name[2]) + name.Substring(3); + } + if (name == afterSet && GetUnderlyingType(getter.OriginalReturnType).Equals( GetUnderlyingType(setter.Parameters[0].QualifiedType)) && - !type.Methods.Any( - m => - m != getter && - string.Compare(name, m.Name, StringComparison.OrdinalIgnoreCase) == 0)) + !type.Methods.Any(m => m != getter && name == m.Name)) { + getter.Name = name; GenerateProperty(getter.Namespace, getter, readOnly ? null : setter); goto next; } @@ -149,9 +151,8 @@ namespace CppSharp.Passes private static void GenerateProperty(DeclarationContext context, Method getter, Method setter = null) { Class type = (Class) context; - if (type.Properties.All( - p => string.Compare(getter.Name, p.Name, StringComparison.OrdinalIgnoreCase) != 0 || - p.ExplicitInterfaceImpl != getter.ExplicitInterfaceImpl)) + if (type.Properties.All(p => getter.Name != p.Name || + p.ExplicitInterfaceImpl != getter.ExplicitInterfaceImpl)) { Property property = new Property(); property.Name = GetPropertyName(getter.Name); @@ -162,9 +163,6 @@ namespace CppSharp.Passes Property baseVirtualProperty = type.GetRootBaseProperty(property); if (baseVirtualProperty.SetMethod == null) setter = null; - foreach (Method method in type.Methods.Where(m => m.Name == property.Name && - m.Parameters.Any(p => p.Kind != ParameterKind.IndirectReturnType))) - method.Name = "get" + method.Name; } property.GetMethod = getter; property.SetMethod = setter; diff --git a/tests/CSharpTemp/CSharpTemp.Tests.cs b/tests/CSharpTemp/CSharpTemp.Tests.cs index 1115bf84..e6ab78f5 100644 --- a/tests/CSharpTemp/CSharpTemp.Tests.cs +++ b/tests/CSharpTemp/CSharpTemp.Tests.cs @@ -77,5 +77,7 @@ public class CSharpTempTests ComplexType complexType = new ComplexType(); p.ComplexType = complexType; Assert.That(p.ComplexType.Check(), Is.EqualTo(5)); + + Assert.That(p.Test, Is.True); } } \ No newline at end of file diff --git a/tests/CSharpTemp/CSharpTemp.cpp b/tests/CSharpTemp/CSharpTemp.cpp index 304fb1db..ec5840ac 100644 --- a/tests/CSharpTemp/CSharpTemp.cpp +++ b/tests/CSharpTemp/CSharpTemp.cpp @@ -154,3 +154,13 @@ void P::parent(int i) { } + +bool P::isTest() +{ + return true; +} + +void P::setTest(bool value) +{ + +} diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h index feebef6a..00bac024 100644 --- a/tests/CSharpTemp/CSharpTemp.h +++ b/tests/CSharpTemp/CSharpTemp.h @@ -112,6 +112,9 @@ public: virtual void parent(int i); + bool isTest(); + void setTest(bool value); + private: ComplexType m_complexType; };