@@ -286,53 +286,58 @@ private static void BuildFunctionPointerTypeId(this IFunctionPointerTypeSymbol f
286
286
public static IEnumerable < IFieldSymbol ? > GetTupleElementsMaybeNull ( this INamedTypeSymbol type ) =>
287
287
type . TupleElements ;
288
288
289
- private static void BuildNamedTypeId ( this INamedTypeSymbol named , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined , bool constructUnderlyingTupleType )
289
+ private static void AddContaining ( INamedTypeSymbol named , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined )
290
290
{
291
- if ( ! constructUnderlyingTupleType && named . IsTupleType )
291
+ if ( named . ContainingType is not null )
292
292
{
293
- trapFile . Write ( '(' ) ;
294
- trapFile . BuildList ( "," , named . GetTupleElementsMaybeNull ( ) ,
295
- ( i , f ) =>
296
- {
297
- if ( f is null )
298
- {
299
- trapFile . Write ( $ "null({ i } )") ;
300
- }
301
- else
302
- {
303
- trapFile . Write ( ( f . CorrespondingTupleField ?? f ) . Name ) ;
304
- trapFile . Write ( ":" ) ;
305
- f . Type . BuildOrWriteId ( cx , trapFile , symbolBeingDefined , constructUnderlyingTupleType : false ) ;
306
- }
307
- }
308
- ) ;
309
- trapFile . Write ( ")" ) ;
310
- return ;
293
+ named . ContainingType . BuildOrWriteId ( cx , trapFile , symbolBeingDefined , constructUnderlyingTupleType : false ) ;
294
+ trapFile . Write ( '.' ) ;
311
295
}
312
-
313
- void AddContaining ( )
296
+ else if ( named . ContainingNamespace is not null )
314
297
{
315
- if ( named . ContainingType is not null )
316
- {
317
- named . ContainingType . BuildOrWriteId ( cx , trapFile , symbolBeingDefined , constructUnderlyingTupleType : false ) ;
318
- trapFile . Write ( '.' ) ;
319
- }
320
- else if ( named . ContainingNamespace is not null )
298
+ if ( cx . ShouldAddAssemblyTrapPrefix && named . ContainingAssembly is not null )
299
+ BuildAssembly ( named . ContainingAssembly , trapFile ) ;
300
+ named . ContainingNamespace . BuildNamespace ( cx , trapFile ) ;
301
+ }
302
+ }
303
+
304
+ private static void BuildTupleId ( INamedTypeSymbol named , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined )
305
+ {
306
+ trapFile . Write ( '(' ) ;
307
+ trapFile . BuildList ( "," , named . GetTupleElementsMaybeNull ( ) ,
308
+ ( i , f ) =>
321
309
{
322
- if ( cx . ShouldAddAssemblyTrapPrefix && named . ContainingAssembly is not null )
323
- BuildAssembly ( named . ContainingAssembly , trapFile ) ;
324
- named . ContainingNamespace . BuildNamespace ( cx , trapFile ) ;
310
+ if ( f is null )
311
+ {
312
+ trapFile . Write ( $ "null({ i } )") ;
313
+ }
314
+ else
315
+ {
316
+ trapFile . Write ( ( f . CorrespondingTupleField ?? f ) . Name ) ;
317
+ trapFile . Write ( ":" ) ;
318
+ f . Type . BuildOrWriteId ( cx , trapFile , symbolBeingDefined , constructUnderlyingTupleType : false ) ;
319
+ }
325
320
}
321
+ ) ;
322
+ trapFile . Write ( ")" ) ;
323
+ }
324
+
325
+ private static void BuildNamedTypeId ( this INamedTypeSymbol named , Context cx , EscapingTextWriter trapFile , ISymbol symbolBeingDefined , bool constructUnderlyingTupleType )
326
+ {
327
+ if ( ! constructUnderlyingTupleType && named . IsTupleType )
328
+ {
329
+ BuildTupleId ( named , cx , trapFile , symbolBeingDefined ) ;
330
+ return ;
326
331
}
327
332
328
333
if ( named . TypeParameters . IsEmpty )
329
334
{
330
- AddContaining ( ) ;
335
+ AddContaining ( named , cx , trapFile , symbolBeingDefined ) ;
331
336
trapFile . Write ( named . Name ) ;
332
337
}
333
338
else if ( named . IsReallyUnbound ( ) )
334
339
{
335
- AddContaining ( ) ;
340
+ AddContaining ( named , cx , trapFile , symbolBeingDefined ) ;
336
341
trapFile . Write ( named . Name ) ;
337
342
trapFile . Write ( "`" ) ;
338
343
trapFile . Write ( named . TypeParameters . Length ) ;
0 commit comments