Browse Source

Fixed "is" operator regression caused by SimplifyLogicNot

pull/205/head
Pent Ploompuu 15 years ago
parent
commit
3d7d36f360
  1. 23
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

23
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -450,17 +450,20 @@ namespace ICSharpCode.Decompiler.Ast
case ILCode.Cgt_Un: { case ILCode.Cgt_Un: {
// can also mean Inequality, when used with object references // can also mean Inequality, when used with object references
TypeReference arg1Type = byteCode.Arguments[0].InferredType; TypeReference arg1Type = byteCode.Arguments[0].InferredType;
if (arg1Type != null && !arg1Type.IsValueType) if (arg1Type != null && !arg1Type.IsValueType) goto case ILCode.Cne;
return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.InEquality, arg2); goto case ILCode.Cgt;
else }
return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.GreaterThan, arg2); case ILCode.Cle_Un: {
// can also mean Equality, when used with object references
TypeReference arg1Type = byteCode.Arguments[0].InferredType;
if (arg1Type != null && !arg1Type.IsValueType) goto case ILCode.Ceq;
goto case ILCode.Cle;
} }
case ILCode.Cge: case ILCode.Cle: return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.LessThanOrEqual, arg2);
case ILCode.Cge_Un: return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.GreaterThanOrEqual, arg2); case ILCode.Cge_Un:
case ILCode.Clt: case ILCode.Cge: return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.GreaterThanOrEqual, arg2);
case ILCode.Clt_Un: return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.LessThan, arg2); case ILCode.Clt_Un:
case ILCode.Cle: case ILCode.Clt: return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.LessThan, arg2);
case ILCode.Cle_Un: return new Ast.BinaryOperatorExpression(arg1, BinaryOperatorType.LessThanOrEqual, arg2);
#endregion #endregion
#region Logical #region Logical
case ILCode.LogicNot: return new Ast.UnaryOperatorExpression(UnaryOperatorType.Not, arg1); case ILCode.LogicNot: return new Ast.UnaryOperatorExpression(UnaryOperatorType.Not, arg1);

Loading…
Cancel
Save