@@ -58,22 +58,21 @@ internal static bool CanWrapNode(SyntaxNode node, Type underlyingType)
5858
5959 internal static Func < TSyntax , TProperty > CreateSyntaxPropertyAccessor < TSyntax , TProperty > ( Type type , string propertyName )
6060 {
61- Func < TSyntax , TProperty > fallbackAccessor =
62- syntax =>
61+ TProperty FallbackAccessor ( TSyntax syntax )
62+ {
63+ if ( syntax == null )
6364 {
64- if ( syntax == null )
65- {
66- // Unlike an extension method which would throw ArgumentNullException here, the light-up
67- // behavior needs to match behavior of the underlying property.
68- throw new NullReferenceException ( ) ;
69- }
65+ // Unlike an extension method which would throw ArgumentNullException here, the light-up
66+ // behavior needs to match behavior of the underlying property.
67+ throw new NullReferenceException ( ) ;
68+ }
7069
71- return default ;
72- } ;
70+ return default ;
71+ }
7372
7473 if ( type == null )
7574 {
76- return fallbackAccessor ;
75+ return FallbackAccessor ;
7776 }
7877
7978 if ( ! typeof ( TSyntax ) . GetTypeInfo ( ) . IsAssignableFrom ( type . GetTypeInfo ( ) ) )
@@ -84,7 +83,7 @@ internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, T
8483 var property = type . GetTypeInfo ( ) . GetDeclaredProperty ( propertyName ) ;
8584 if ( property == null )
8685 {
87- return fallbackAccessor ;
86+ return FallbackAccessor ;
8887 }
8988
9089 if ( ! typeof ( TProperty ) . GetTypeInfo ( ) . IsAssignableFrom ( property . PropertyType . GetTypeInfo ( ) ) )
@@ -107,22 +106,21 @@ internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, T
107106
108107 internal static Func < TSyntax , SeparatedSyntaxListWrapper < TProperty > > CreateSeparatedSyntaxListPropertyAccessor < TSyntax , TProperty > ( Type type , string propertyName )
109108 {
110- Func < TSyntax , SeparatedSyntaxListWrapper < TProperty > > fallbackAccessor =
111- syntax =>
109+ SeparatedSyntaxListWrapper < TProperty > FallbackAccessor ( TSyntax syntax )
110+ {
111+ if ( syntax == null )
112112 {
113- if ( syntax == null )
114- {
115- // Unlike an extension method which would throw ArgumentNullException here, the light-up
116- // behavior needs to match behavior of the underlying property.
117- throw new NullReferenceException ( ) ;
118- }
113+ // Unlike an extension method which would throw ArgumentNullException here, the light-up
114+ // behavior needs to match behavior of the underlying property.
115+ throw new NullReferenceException ( ) ;
116+ }
119117
120- return SeparatedSyntaxListWrapper < TProperty > . UnsupportedEmpty ;
121- } ;
118+ return SeparatedSyntaxListWrapper < TProperty > . UnsupportedEmpty ;
119+ }
122120
123121 if ( type == null )
124122 {
125- return fallbackAccessor ;
123+ return FallbackAccessor ;
126124 }
127125
128126 if ( ! typeof ( TSyntax ) . GetTypeInfo ( ) . IsAssignableFrom ( type . GetTypeInfo ( ) ) )
@@ -133,7 +131,7 @@ internal static Func<TSyntax, SeparatedSyntaxListWrapper<TProperty>> CreateSepar
133131 var property = type . GetTypeInfo ( ) . GetDeclaredProperty ( propertyName ) ;
134132 if ( property == null )
135133 {
136- return fallbackAccessor ;
134+ return FallbackAccessor ;
137135 }
138136
139137 if ( property . PropertyType . GetGenericTypeDefinition ( ) != typeof ( SeparatedSyntaxList < > ) )
@@ -168,27 +166,26 @@ internal static Func<TSyntax, SeparatedSyntaxListWrapper<TProperty>> CreateSepar
168166
169167 internal static Func < TSyntax , TProperty , TSyntax > CreateSyntaxWithPropertyAccessor < TSyntax , TProperty > ( Type type , string propertyName )
170168 {
171- Func < TSyntax , TProperty , TSyntax > fallbackAccessor =
172- ( syntax , newValue ) =>
169+ TSyntax FallbackAccessor ( TSyntax syntax , TProperty newValue )
170+ {
171+ if ( syntax == null )
173172 {
174- if ( syntax == null )
175- {
176- // Unlike an extension method which would throw ArgumentNullException here, the light-up
177- // behavior needs to match behavior of the underlying property.
178- throw new NullReferenceException ( ) ;
179- }
173+ // Unlike an extension method which would throw ArgumentNullException here, the light-up
174+ // behavior needs to match behavior of the underlying property.
175+ throw new NullReferenceException ( ) ;
176+ }
180177
181- if ( Equals ( newValue , default ( TProperty ) ) )
182- {
183- return syntax ;
184- }
178+ if ( Equals ( newValue , default ( TProperty ) ) )
179+ {
180+ return syntax ;
181+ }
185182
186- throw new NotSupportedException ( ) ;
187- } ;
183+ throw new NotSupportedException ( ) ;
184+ }
188185
189186 if ( type == null )
190187 {
191- return fallbackAccessor ;
188+ return FallbackAccessor ;
192189 }
193190
194191 if ( ! typeof ( TSyntax ) . GetTypeInfo ( ) . IsAssignableFrom ( type . GetTypeInfo ( ) ) )
@@ -199,7 +196,7 @@ internal static Func<TSyntax, TProperty, TSyntax> CreateSyntaxWithPropertyAccess
199196 var property = type . GetTypeInfo ( ) . GetDeclaredProperty ( propertyName ) ;
200197 if ( property == null )
201198 {
202- return fallbackAccessor ;
199+ return FallbackAccessor ;
203200 }
204201
205202 if ( ! typeof ( TProperty ) . GetTypeInfo ( ) . IsAssignableFrom ( property . PropertyType . GetTypeInfo ( ) ) )
@@ -231,27 +228,26 @@ internal static Func<TSyntax, TProperty, TSyntax> CreateSyntaxWithPropertyAccess
231228
232229 internal static Func < TSyntax , SeparatedSyntaxListWrapper < TProperty > , TSyntax > CreateSeparatedSyntaxListWithPropertyAccessor < TSyntax , TProperty > ( Type type , string propertyName )
233230 {
234- Func < TSyntax , SeparatedSyntaxListWrapper < TProperty > , TSyntax > fallbackAccessor =
235- ( syntax , newValue ) =>
231+ TSyntax FallbackAccessor ( TSyntax syntax , SeparatedSyntaxListWrapper < TProperty > newValue )
232+ {
233+ if ( syntax == null )
236234 {
237- if ( syntax == null )
238- {
239- // Unlike an extension method which would throw ArgumentNullException here, the light-up
240- // behavior needs to match behavior of the underlying property.
241- throw new NullReferenceException ( ) ;
242- }
235+ // Unlike an extension method which would throw ArgumentNullException here, the light-up
236+ // behavior needs to match behavior of the underlying property.
237+ throw new NullReferenceException ( ) ;
238+ }
243239
244- if ( newValue is null )
245- {
246- return syntax ;
247- }
240+ if ( newValue is null )
241+ {
242+ return syntax ;
243+ }
248244
249- throw new NotSupportedException ( ) ;
250- } ;
245+ throw new NotSupportedException ( ) ;
246+ }
251247
252248 if ( type == null )
253249 {
254- return fallbackAccessor ;
250+ return FallbackAccessor ;
255251 }
256252
257253 if ( ! typeof ( TSyntax ) . GetTypeInfo ( ) . IsAssignableFrom ( type . GetTypeInfo ( ) ) )
@@ -262,7 +258,7 @@ internal static Func<TSyntax, SeparatedSyntaxListWrapper<TProperty>, TSyntax> Cr
262258 var property = type . GetTypeInfo ( ) . GetDeclaredProperty ( propertyName ) ;
263259 if ( property == null )
264260 {
265- return fallbackAccessor ;
261+ return FallbackAccessor ;
266262 }
267263
268264 if ( property . PropertyType . GetGenericTypeDefinition ( ) != typeof ( SeparatedSyntaxList < > ) )
0 commit comments