@@ -167,12 +167,17 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
167
167
codeWriter . EndBlock ( ) ;
168
168
}
169
169
170
- var verbs = endpoints
170
+ return stringWriter . ToString ( ) ;
171
+ } ) ;
172
+
173
+ var httpVerbs = endpoints
174
+ . Collect ( )
175
+ . Select ( ( endpoints , _ ) =>
176
+ {
177
+ return endpoints
171
178
. Select ( endpoint => endpoint . EmitterContext . HttpMethod ! )
172
179
. Where ( verb => verb is not null )
173
180
. ToImmutableHashSet ( ) ;
174
-
175
- return ( stringWriter . ToString ( ) , verbs ) ;
176
181
} ) ;
177
182
178
183
var endpointHelpers = endpoints
@@ -266,11 +271,16 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
266
271
return stringWriter . ToString ( ) ;
267
272
} ) ;
268
273
269
- var thunksAndEndpoints = thunks . Collect ( ) . Combine ( stronglyTypedEndpointDefinitions ) . Combine ( endpointHelpers ) . Combine ( helperTypes ) ;
274
+ var thunksAndEndpoints = thunks
275
+ . Collect ( )
276
+ . Combine ( stronglyTypedEndpointDefinitions )
277
+ . Combine ( httpVerbs )
278
+ . Combine ( endpointHelpers )
279
+ . Combine ( helperTypes ) ;
270
280
271
281
context . RegisterSourceOutput ( thunksAndEndpoints , ( context , sources ) =>
272
282
{
273
- var ( ( ( thunks , ( endpointsCode , verbs ) ) , helperMethods ) , helperTypes ) = sources ;
283
+ var ( ( ( ( thunks , endpointsCode ) , httpVerbs ) , helperMethods ) , helperTypes ) = sources ;
274
284
275
285
if ( thunks . IsDefaultOrEmpty || string . IsNullOrEmpty ( endpointsCode ) )
276
286
{
@@ -289,7 +299,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
289
299
endpoints : endpointsCode ,
290
300
helperMethods : helperMethods ?? string . Empty ,
291
301
helperTypes : helperTypes ?? string . Empty ,
292
- verbs : verbs ) ;
302
+ verbs : httpVerbs ) ;
293
303
294
304
context . AddSource ( "GeneratedRouteBuilderExtensions.g.cs" , code ) ;
295
305
} ) ;
0 commit comments