@@ -143,27 +143,8 @@ private static void ProcessProperties(Class @class, HashSet<Property> newPropert
143143 {
144144 foreach ( var property in newProperties )
145145 {
146- if ( property . IsOverride )
147- {
148- Property baseProperty = GetBaseProperty ( @class , property ) ;
149- if ( baseProperty == null )
150- {
151- if ( property . SetMethod != null )
152- {
153- property . SetMethod . GenerationKind = GenerationKind . Generate ;
154- property . SetMethod = null ;
155- }
156- else
157- {
158- property . GetMethod . GenerationKind = GenerationKind . Generate ;
159- property . GetMethod = null ;
160- }
161- }
162- else if ( property . GetMethod == null && baseProperty . SetMethod != null )
163- property . GetMethod = baseProperty . GetMethod ;
164- else if ( property . SetMethod == null )
165- property . SetMethod = baseProperty . SetMethod ;
166- }
146+ ProcessOverridden ( @class , property ) ;
147+
167148 if ( property . GetMethod == null )
168149 {
169150 if ( property . SetMethod != null )
@@ -185,14 +166,45 @@ private static void ProcessProperties(Class @class, HashSet<Property> newPropert
185166 }
186167 }
187168
169+ private static void ProcessOverridden ( Class @class , Property property )
170+ {
171+ if ( ! property . IsOverride )
172+ return ;
173+
174+ Property baseProperty = GetBaseProperty ( @class , property ) ;
175+ if ( baseProperty == null )
176+ {
177+ if ( property . SetMethod != null )
178+ {
179+ property . SetMethod . GenerationKind = GenerationKind . Generate ;
180+ property . SetMethod = null ;
181+ }
182+ else
183+ {
184+ property . GetMethod . GenerationKind = GenerationKind . Generate ;
185+ property . GetMethod = null ;
186+ }
187+ }
188+ else if ( property . GetMethod == null && baseProperty . SetMethod != null )
189+ property . GetMethod = baseProperty . GetMethod ;
190+ else if ( property . SetMethod == null || baseProperty . SetMethod == null )
191+ {
192+ if ( property . SetMethod != null )
193+ property . SetMethod . GenerationKind = GenerationKind . Generate ;
194+ property . SetMethod = baseProperty . SetMethod ;
195+ }
196+ }
197+
188198 private static Property GetBaseProperty ( Class @class , Property @override )
189199 {
190200 foreach ( var @base in @class . Bases )
191201 {
192202 Class baseClass = @base . Class . OriginalClass ?? @base . Class ;
193203 Property baseProperty = baseClass . Properties . Find ( p =>
194- ( @override . GetMethod != null && @override . GetMethod . BaseMethod == p . GetMethod ) ||
195- ( @override . SetMethod != null && @override . SetMethod . BaseMethod == p . SetMethod ) ||
204+ ( @override . GetMethod ? . IsOverride == true &&
205+ @override . GetMethod . BaseMethod == p . GetMethod ) ||
206+ ( @override . SetMethod ? . IsOverride == true &&
207+ @override . SetMethod . BaseMethod == p . SetMethod ) ||
196208 ( @override . Field != null && @override . Field == p . Field ) ) ;
197209 if ( baseProperty != null )
198210 return baseProperty ;
0 commit comments