@@ -111,7 +111,7 @@ internal void LogWarnings(Logger? logger)
111111 internal TypeCache ( MetadataType type , ILProvider ilProvider )
112112 {
113113 Debug . Assert ( type == type . GetTypeDefinition ( ) ) ;
114- Debug . Assert ( ! CompilerGeneratedNames . IsStateMachineOrDisplayClass ( type . GetName ( ) ) ) ;
114+ Debug . Assert ( ! CompilerGeneratedNames . IsStateMachineOrDisplayClass ( type . Name ) ) ;
115115
116116 Type = type ;
117117
@@ -132,8 +132,8 @@ void ProcessMethod(MethodDesc method)
132132 {
133133 Debug . Assert ( method == method . GetTypicalMethodDefinition ( ) ) ;
134134
135- bool isStateMachineMember = CompilerGeneratedNames . IsStateMachineType ( ( ( MetadataType ) method . OwningType ) . GetName ( ) ) ;
136- if ( ! CompilerGeneratedNames . IsLambdaOrLocalFunction ( method . GetName ( ) ) )
135+ bool isStateMachineMember = CompilerGeneratedNames . IsStateMachineType ( ( ( MetadataType ) method . OwningType ) . Name ) ;
136+ if ( ! CompilerGeneratedNames . IsLambdaOrLocalFunction ( method . Name ) )
137137 {
138138 if ( ! isStateMachineMember )
139139 {
@@ -177,7 +177,7 @@ void ProcessMethod(MethodDesc method)
177177 referencedMethod . OwningType is MetadataType generatedType &&
178178 // Don't consider calls in the same/nested type, like inside a static constructor
179179 ! IsSameOrNestedType ( method . OwningType , generatedType ) &&
180- CompilerGeneratedNames . IsLambdaDisplayClass ( generatedType . GetName ( ) ) )
180+ CompilerGeneratedNames . IsLambdaDisplayClass ( generatedType . Name ) )
181181 {
182182 Debug . Assert ( generatedType . IsTypeDefinition ) ;
183183
@@ -190,7 +190,7 @@ referencedMethod.OwningType is MetadataType generatedType &&
190190 continue ;
191191 }
192192
193- if ( ! CompilerGeneratedNames . IsLambdaOrLocalFunction ( referencedMethod . GetName ( ) ) )
193+ if ( ! CompilerGeneratedNames . IsLambdaOrLocalFunction ( referencedMethod . Name ) )
194194 continue ;
195195
196196 if ( isStateMachineMember )
@@ -218,7 +218,7 @@ referencedMethod.OwningType is MetadataType generatedType &&
218218 if ( field . OwningType is MetadataType generatedType &&
219219 // Don't consider field accesses in the same/nested type, like inside a static constructor
220220 ! IsSameOrNestedType ( method . OwningType , generatedType ) &&
221- CompilerGeneratedNames . IsLambdaDisplayClass ( generatedType . GetName ( ) ) )
221+ CompilerGeneratedNames . IsLambdaDisplayClass ( generatedType . Name ) )
222222 {
223223 Debug . Assert ( generatedType . IsTypeDefinition ) ;
224224
@@ -243,7 +243,7 @@ referencedMethod.OwningType is MetadataType generatedType &&
243243 if ( TryGetStateMachineType ( method , out MetadataType ? stateMachineType ) )
244244 {
245245 Debug . Assert ( stateMachineType . ContainingType == type ||
246- ( CompilerGeneratedNames . IsStateMachineOrDisplayClass ( stateMachineType . ContainingType . GetName ( ) ) &&
246+ ( CompilerGeneratedNames . IsStateMachineOrDisplayClass ( stateMachineType . ContainingType . Name ) &&
247247 stateMachineType . ContainingType . ContainingType == type ) ) ;
248248 Debug . Assert ( stateMachineType == stateMachineType . GetTypeDefinition ( ) ) ;
249249
@@ -319,7 +319,7 @@ static bool IsSameOrNestedType(TypeDesc type, TypeDesc potentialOuterType)
319319 switch ( compilerGeneratedMember )
320320 {
321321 case MethodDesc nestedFunction :
322- Debug . Assert ( CompilerGeneratedNames . IsLambdaOrLocalFunction ( nestedFunction . GetName ( ) ) ) ;
322+ Debug . Assert ( CompilerGeneratedNames . IsLambdaOrLocalFunction ( nestedFunction . Name ) ) ;
323323 // Nested functions get suppressions from the user method only.
324324 _compilerGeneratedMethodToUserCodeMethod ??= new Dictionary < MethodDesc , MethodDesc > ( ) ;
325325 if ( ! _compilerGeneratedMethodToUserCodeMethod . TryAdd ( nestedFunction , userDefinedMethod ) )
@@ -334,7 +334,7 @@ static bool IsSameOrNestedType(TypeDesc type, TypeDesc potentialOuterType)
334334 // are represented by the state machine type itself.
335335 // We are already tracking the association of the state machine type to the user code method
336336 // above, so no need to track it here.
337- Debug . Assert ( CompilerGeneratedNames . IsStateMachineType ( stateMachineType . GetName ( ) ) ) ;
337+ Debug . Assert ( CompilerGeneratedNames . IsStateMachineType ( stateMachineType . Name ) ) ;
338338 break ;
339339 default :
340340 throw new InvalidOperationException ( ) ;
@@ -386,7 +386,7 @@ void MapGeneratedTypeTypeParameters(
386386 MetadataType generatedType ,
387387 Dictionary < MetadataType , TypeArgumentInfo > generatedTypeToTypeArgs )
388388 {
389- Debug . Assert ( CompilerGeneratedNames . IsStateMachineOrDisplayClass ( generatedType . GetName ( ) ) ) ;
389+ Debug . Assert ( CompilerGeneratedNames . IsStateMachineOrDisplayClass ( generatedType . Name ) ) ;
390390 Debug . Assert ( generatedType == generatedType . GetTypeDefinition ( ) ) ;
391391
392392 var typeInfo = generatedTypeToTypeArgs [ generatedType ] ;
@@ -426,7 +426,7 @@ void MapGeneratedTypeTypeParameters(
426426 else
427427 {
428428 // Must be a type ref
429- if ( method . OwningType is not MetadataType owningType || ! CompilerGeneratedNames . IsStateMachineOrDisplayClass ( owningType . GetName ( ) ) )
429+ if ( method . OwningType is not MetadataType owningType || ! CompilerGeneratedNames . IsStateMachineOrDisplayClass ( owningType . Name ) )
430430 {
431431 userAttrs = param ;
432432 }
@@ -567,7 +567,7 @@ private static IEnumerable<MetadataType> GetCompilerGeneratedNestedTypes(Metadat
567567 {
568568 foreach ( var nestedType in type . GetNestedTypes ( ) )
569569 {
570- if ( ! CompilerGeneratedNames . IsStateMachineOrDisplayClass ( nestedType . GetName ( ) ) )
570+ if ( ! CompilerGeneratedNames . IsStateMachineOrDisplayClass ( nestedType . Name ) )
571571 continue ;
572572
573573 yield return nestedType ;
@@ -579,14 +579,14 @@ private static IEnumerable<MetadataType> GetCompilerGeneratedNestedTypes(Metadat
579579
580580 public static bool IsHoistedLocal ( FieldDesc field )
581581 {
582- if ( CompilerGeneratedNames . IsLambdaDisplayClass ( field . OwningType . GetName ( ) ) )
582+ if ( CompilerGeneratedNames . IsLambdaDisplayClass ( field . OwningType . Name ) )
583583 return true ;
584584
585- if ( CompilerGeneratedNames . IsStateMachineType ( field . OwningType . GetName ( ) ) )
585+ if ( CompilerGeneratedNames . IsStateMachineType ( field . OwningType . Name ) )
586586 {
587587 // Don't track the "current" field which is used for state machine return values,
588588 // because this can be expensive to track.
589- return ! CompilerGeneratedNames . IsStateMachineCurrentField ( field . GetName ( ) ) ;
589+ return ! CompilerGeneratedNames . IsStateMachineCurrentField ( field . Name ) ;
590590 }
591591
592592 return false ;
@@ -595,13 +595,13 @@ public static bool IsHoistedLocal(FieldDesc field)
595595 // "Nested function" refers to lambdas and local functions.
596596 public static bool IsNestedFunctionOrStateMachineMember ( TypeSystemEntity member )
597597 {
598- if ( member is MethodDesc method && CompilerGeneratedNames . IsLambdaOrLocalFunction ( method . GetName ( ) ) )
598+ if ( member is MethodDesc method && CompilerGeneratedNames . IsLambdaOrLocalFunction ( method . Name ) )
599599 return true ;
600600
601601 if ( member . GetOwningType ( ) is not MetadataType declaringType )
602602 return false ;
603603
604- return CompilerGeneratedNames . IsStateMachineType ( declaringType . GetName ( ) ) ;
604+ return CompilerGeneratedNames . IsStateMachineType ( declaringType . Name ) ;
605605 }
606606
607607 public static bool TryGetStateMachineType ( MethodDesc method , [ NotNullWhen ( true ) ] out MetadataType ? stateMachineType )
@@ -631,7 +631,7 @@ public static bool TryGetStateMachineType(MethodDesc method, [NotNullWhen(true)]
631631 // State machines can be emitted into display classes, so we may also need to go one more level up.
632632 // To avoid depending on implementation details, we go up until we see a non-compiler-generated type.
633633 // This is the counterpart to GetCompilerGeneratedNestedTypes.
634- while ( userType != null && CompilerGeneratedNames . IsStateMachineOrDisplayClass ( userType . GetName ( ) ) )
634+ while ( userType != null && CompilerGeneratedNames . IsStateMachineOrDisplayClass ( userType . Name ) )
635635 userType = userType . ContainingType as MetadataType ;
636636
637637 if ( userType is null )
@@ -676,7 +676,7 @@ public bool TryGetCompilerGeneratedCalleesForUserMethod(MethodDesc method, [NotN
676676 public IReadOnlyList < GenericParameterDesc ? > ? GetGeneratedTypeAttributes ( MetadataType type )
677677 {
678678 MetadataType generatedType = ( MetadataType ) type . GetTypeDefinition ( ) ;
679- Debug . Assert ( CompilerGeneratedNames . IsStateMachineOrDisplayClass ( generatedType . GetName ( ) ) ) ;
679+ Debug . Assert ( CompilerGeneratedNames . IsStateMachineOrDisplayClass ( generatedType . Name ) ) ;
680680
681681 // Avoid the heuristics for .NET10+, where DynamicallyAccessedMembers flows to generated code
682682 // because it is annotated with CompilerLoweringPreserveAttribute.
0 commit comments