@@ -553,11 +553,9 @@ static bool CheckForAsyncEnumerator(List<Instruction> instructions, Instruction
553
553
( instructions [ currentIndex - 2 ] . OpCode == OpCodes . Ldarg ||
554
554
instructions [ currentIndex - 2 ] . OpCode == OpCodes . Ldarg_0 ) &&
555
555
instructions [ currentIndex - 1 ] . OpCode == OpCodes . Ldfld &&
556
- (
557
- ( instructions [ currentIndex - 1 ] . Operand is FieldDefinition field && IsCompilerGenerated ( field ) && field . FieldType . FullName . StartsWith ( "System.Collections.Generic.IAsyncEnumerator" ) ) ||
558
- ( instructions [ currentIndex - 1 ] . Operand is FieldReference fieldRef && IsCompilerGenerated ( fieldRef . Resolve ( ) ) && fieldRef . FieldType . FullName . StartsWith ( "System.Collections.Generic.IAsyncEnumerator" ) )
559
- )
560
- )
556
+ IsCompilerGeneratedField ( instructions [ currentIndex - 1 ] , out FieldDefinition field ) &&
557
+ field . FieldType . FullName . StartsWith ( "System.Collections.Generic.IAsyncEnumerator" )
558
+ )
561
559
{
562
560
return true ;
563
561
}
@@ -598,10 +596,8 @@ static bool CheckIfExceptionThrown(List<Instruction> instructions, Instruction i
598
596
for ( int i = currentIndex - 1 ; i >= minFieldIndex ; -- i )
599
597
{
600
598
if ( instructions [ i ] . OpCode == OpCodes . Ldfld &&
601
- (
602
- ( instructions [ i ] . Operand is FieldDefinition field && IsCompilerGenerated ( field ) && field . FieldType . FullName == "System.Object" ) ||
603
- ( instructions [ i ] . Operand is FieldReference fieldRef && IsCompilerGenerated ( fieldRef . Resolve ( ) ) && fieldRef . FieldType . FullName == "System.Object" )
604
- ) )
599
+ IsCompilerGeneratedField ( instructions [ i ] , out FieldDefinition field ) &&
600
+ field . FieldType . FullName == "System.Object" )
605
601
{
606
602
// We expect the call to GetResult() to be no more than four
607
603
// instructions before the loading of the field's value.
@@ -932,10 +928,8 @@ static bool DisposeCheck(List<Instruction> instructions, Instruction instruction
932
928
933
929
if ( currentIndex >= 2 &&
934
930
instructions [ currentIndex - 1 ] . OpCode == OpCodes . Ldfld &&
935
- (
936
- ( instructions [ currentIndex - 1 ] . Operand is FieldDefinition field && IsCompilerGenerated ( field ) && field . FullName . EndsWith ( "__disposeMode" ) ) ||
937
- ( instructions [ currentIndex - 1 ] . Operand is FieldReference fieldRef && IsCompilerGenerated ( fieldRef . Resolve ( ) ) && fieldRef . FullName . EndsWith ( "__disposeMode" ) )
938
- ) &&
931
+ IsCompilerGeneratedField ( instructions [ currentIndex - 1 ] , out FieldDefinition field ) &&
932
+ field . FullName . EndsWith ( "__disposeMode" ) &&
939
933
( instructions [ currentIndex - 2 ] . OpCode == OpCodes . Ldarg ||
940
934
instructions [ currentIndex - 2 ] . OpCode == OpCodes . Ldarg_0 ) )
941
935
{
0 commit comments