@@ -56,7 +56,7 @@ public static Method GetBaseMethod(this Class @class, Method @override)
56
56
}
57
57
58
58
public static Property GetBaseProperty ( this Class @class , Property @override ,
59
- bool onlyFirstBase = false , bool getTopmost = false )
59
+ bool onlyFirstBase = false )
60
60
{
61
61
foreach ( var @base in @class . Bases )
62
62
{
@@ -66,44 +66,33 @@ public static Property GetBaseProperty(this Class @class, Property @override,
66
66
( onlyFirstBase && @base . Class . IsInterface ) )
67
67
continue ;
68
68
69
- Property baseProperty ;
70
- if ( ! getTopmost )
71
- {
72
- baseProperty = @base . Class . GetBaseProperty ( @override , onlyFirstBase ) ;
73
- if ( baseProperty != null )
74
- return baseProperty ;
75
- }
76
-
77
69
var properties = @base . Class . Properties . Concat ( @base . Class . Declarations . OfType < Property > ( ) ) ;
78
- baseProperty = ( from property in properties
79
- where property . OriginalName == @override . OriginalName &&
80
- property . Parameters . SequenceEqual ( @override . Parameters ,
81
- ParameterTypeComparer . Instance )
82
- select property ) . FirstOrDefault ( ) ;
70
+ Property baseProperty = ( from property in properties
71
+ where property . OriginalName == @override . OriginalName &&
72
+ property . Parameters . SequenceEqual ( @override . Parameters ,
73
+ ParameterTypeComparer . Instance )
74
+ select property ) . FirstOrDefault ( ) ;
83
75
84
76
if ( baseProperty != null )
85
77
return baseProperty ;
86
78
87
- if ( getTopmost )
88
- {
89
- baseProperty = @base . Class . GetBaseProperty ( @override , onlyFirstBase , true ) ;
90
- if ( baseProperty != null )
91
- return baseProperty ;
92
- }
79
+ baseProperty = @base . Class . GetBaseProperty ( @override , onlyFirstBase ) ;
80
+ if ( baseProperty != null )
81
+ return baseProperty ;
93
82
}
94
83
return null ;
95
84
}
96
85
97
86
public static bool HasNonAbstractBasePropertyInPrimaryBase ( this Class @class , Property property )
98
87
{
99
- var baseProperty = @class . GetBaseProperty ( property , true , true ) ;
88
+ var baseProperty = @class . GetBaseProperty ( property , true ) ;
100
89
return baseProperty != null && ! baseProperty . IsPure &&
101
90
! ( ( Class ) baseProperty . OriginalNamespace ) . IsInterface ;
102
91
}
103
92
104
93
public static Property GetPropertyByName ( this Class @class , string propertyName )
105
94
{
106
- Property property = @class . Properties . FirstOrDefault ( m => m . Name == propertyName ) ;
95
+ Property property = @class . Properties . Find ( m => m . Name == propertyName ) ;
107
96
if ( property != null )
108
97
return property ;
109
98
@@ -119,10 +108,10 @@ public static Property GetPropertyByName(this Class @class, string propertyName)
119
108
120
109
public static Property GetPropertyByConstituentMethod ( this Class @class , Method method )
121
110
{
122
- var property = @class . Properties . FirstOrDefault ( p => p . GetMethod == method ) ;
111
+ var property = @class . Properties . Find ( p => p . GetMethod == method ) ;
123
112
if ( property != null )
124
113
return property ;
125
- property = @class . Properties . FirstOrDefault ( p => p . SetMethod == method ) ;
114
+ property = @class . Properties . Find ( p => p . SetMethod == method ) ;
126
115
if ( property != null )
127
116
return property ;
128
117
0 commit comments