From ee1c53b5b0bae39bcbb9981d090e73621b0f013c Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Sun, 10 Nov 2013 14:35:44 +0200 Subject: [PATCH] Simplified the comparisons used in the advanced pass for properties. Signed-off-by: Dimitar Dobrev --- .../Passes/GetterSetterToPropertyAdvancedPass.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs b/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs index 86e7b01d..3e3de1d3 100644 --- a/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs +++ b/src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs @@ -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,9 +146,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);