Пример #1
0
 private bool ShouldDeleteOpCode(Instruction instruction)
 {
     if (instruction.OpCode == OpCodes.Newobj) return false;
     if (instruction.OpCode == OpCodes.Nop) return false;
     if (instruction.OpCode == OpCodes.Ret) return false;
     if (instruction.OpCode == OpCodes.Br
         && instruction.Next.Offset == ((Instruction)instruction.Operand).Offset)
     {
         return false;
     }
     if (instruction.OpCode == OpCodes.Endfinally) return false;
     if (instruction.IsNumericConversion()) return false;
     if (IsOpCodeSettingOutputParameterToDefaultValue(instruction)) return false;
     if (IsOpCodeSettingLocalVariableToDefaultValue(instruction)) return false;
     if (IsOpCodeSwitchDefaultThatHasAlreadyBeenCateredFor(instruction)) return false;
     if (instruction.IsPartOfCompilerGeneratedDispose()) return false;
     return true;
 }