@@ -143,27 +143,8 @@ private static void ProcessProperties(Class @class, HashSet<Property> newPropert
143
143
{
144
144
foreach ( var property in newProperties )
145
145
{
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
+
167
148
if ( property . GetMethod == null )
168
149
{
169
150
if ( property . SetMethod != null )
@@ -185,14 +166,45 @@ private static void ProcessProperties(Class @class, HashSet<Property> newPropert
185
166
}
186
167
}
187
168
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
+
188
198
private static Property GetBaseProperty ( Class @class , Property @override )
189
199
{
190
200
foreach ( var @base in @class . Bases )
191
201
{
192
202
Class baseClass = @base . Class . OriginalClass ?? @base . Class ;
193
203
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 ) ||
196
208
( @override . Field != null && @override . Field == p . Field ) ) ;
197
209
if ( baseProperty != null )
198
210
return baseProperty ;
0 commit comments