@@ -136,15 +136,16 @@ private static Property GetProperty(Method method, string name,
136136        { 
137137            Type  underlyingType  =  GetUnderlyingType ( type ) ; 
138138            Class  @class  =  ( Class )  method . Namespace ; 
139+ 
139140            Property  property  =  @class . Properties . Find ( 
140141                p =>  p . Field  ==  null  && 
141-                     ( ( ! isSetter  &&  p . HasSetter   &&   p . Name  ==  name )  || 
142-                      ( isSetter  &&  p . HasGetter  && 
143-                       GetReadWritePropertyName ( p . GetMethod ,   name )   ==   name ) )   && 
144-                     ( ( p . HasGetter   && 
145-                       GetUnderlyingType ( p . GetMethod . OriginalReturnType ) . Equals ( underlyingType ) )   || 
146-                      ( p . HasSetter  && 
147-                        GetUnderlyingType ( p . SetMethod . Parameters [ 0 ] . QualifiedType ) . Equals ( underlyingType ) ) ) )  ?? 
142+                     ( ( ! isSetter  &&  p . SetMethod ? . IsStatic  ==  method . IsStatic )  || 
143+                          ( isSetter  &&  p . GetMethod ? . IsStatic   ==   method . IsStatic ) )  && 
144+                          ( ( p . HasGetter   &&   GetUnderlyingType ( 
145+                              p . GetMethod . OriginalReturnType ) . Equals ( underlyingType ) )   || 
146+                          ( p . HasSetter   &&   GetUnderlyingType ( 
147+                              p . SetMethod . Parameters [ 0 ] . QualifiedType ) . Equals ( underlyingType ) ) )  && 
148+                     Match ( p ,   name ) )  ?? 
148149                new  Property  {  Name  =  name ,  QualifiedType  =  type  } ; 
149150
150151            if  ( property . Namespace  ==  null ) 
@@ -160,13 +161,43 @@ private static Property GetProperty(Method method, string name,
160161                    ( int )  method . Access ) ; 
161162            } 
162163
163-             property . Name  =  property . OriginalName  =  name ; 
164164            method . GenerationKind  =  GenerationKind . Internal ; 
165165            if  ( method . ExplicitInterfaceImpl  !=  null ) 
166166                property . ExplicitInterfaceImpl  =  method . ExplicitInterfaceImpl ; 
167167            return  property ; 
168168        } 
169169
170+         private  static   bool  Match ( Property  property ,  string  name ) 
171+         { 
172+             if  ( string . IsNullOrEmpty ( name ) ) 
173+                 return  false ; 
174+ 
175+             if  ( property . Name  ==  name ) 
176+                 return  true ; 
177+ 
178+             if  ( property . Name  ==  RemovePrefix ( name ) ) 
179+                 return  true ; 
180+ 
181+             if  ( RemovePrefix ( property . Name )  ==  name ) 
182+             { 
183+                 property . Name  =  property . OriginalName  =  name ; 
184+                 return  true ; 
185+             } 
186+ 
187+             return  property . SetMethod  !=  null  && 
188+                 GetPropertyNameFromSetter ( property . SetMethod . Name )  ==  name ; 
189+         } 
190+ 
191+         private  static   string  RemovePrefix ( string  identifier ) 
192+         { 
193+             if  ( string . IsNullOrEmpty ( identifier ) ) 
194+                 return  identifier ; 
195+ 
196+             string  name  =  GetPropertyName ( identifier ) ; 
197+             return  name . StartsWith ( "is" ,  StringComparison . Ordinal )  &&  name  !=  "is"  ? 
198+                 char . ToLowerInvariant ( name [ 2 ] )  +  name . Substring ( 3 )  :  name ; 
199+         } 
200+ 
170201        private  static   void  ProcessProperties ( Class  @class ,  IEnumerable < Property >  newProperties ) 
171202        { 
172203            foreach  ( Property  property  in  newProperties ) 
@@ -275,17 +306,6 @@ private static void RenameConflictingMethods(Class @class, Property property)
275306            } 
276307        } 
277308
278-         private  static   string  GetReadWritePropertyName ( INamedDecl  getter ,  string  afterSet ) 
279-         { 
280-             string  name  =  GetPropertyName ( getter . Name ) ; 
281-             if  ( name  !=  afterSet  &&  name . StartsWith ( "is" ,  StringComparison . Ordinal )  && 
282-                 name  !=  "is" ) 
283-             { 
284-                 name  =  char . ToLowerInvariant ( name [ 2 ] )  +  name . Substring ( 3 ) ; 
285-             } 
286-             return  name ; 
287-         } 
288- 
289309        private  static   Type  GetUnderlyingType ( QualifiedType  type ) 
290310        { 
291311            TagType  tagType  =  type . Type  as  TagType ; 
0 commit comments