Browse Source

Simplified the comparisons used in the advanced pass for properties.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/116/head
Dimitar Dobrev 12 years ago
parent
commit
ee1c53b5b0
  1. 10
      src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs

10
src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs

@ -94,13 +94,10 @@ namespace CppSharp.Passes @@ -94,13 +94,10 @@ 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 == 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))
{
GenerateProperty(getter.Namespace, getter, readOnly ? null : setter);
goto next;
@ -149,8 +146,7 @@ namespace CppSharp.Passes @@ -149,8 +146,7 @@ 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 ||
if (type.Properties.All(p => getter.Name != p.Name ||
p.ExplicitInterfaceImpl != getter.ExplicitInterfaceImpl))
{
Property property = new Property();

Loading…
Cancel
Save