Browse Source

Fix bit not expressions on IntPtr/UIntPtr-typed expressions

pull/728/head
Siegfried Pammer 9 years ago
parent
commit
acc6cb8f11
  1. 12
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

12
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -258,9 +258,19 @@ namespace ICSharpCode.Decompiler.CSharp @@ -258,9 +258,19 @@ namespace ICSharpCode.Decompiler.CSharp
protected internal override TranslatedExpression VisitBitNot(BitNot inst)
{
var argument = Translate(inst.Argument);
var type = argument.Type;
if (type.IsKnownType(KnownTypeCode.IntPtr)) {
argument = argument.ConvertTo(compilation.FindType(KnownTypeCode.Int64), this);
}
if (type.IsKnownType(KnownTypeCode.UIntPtr)) {
argument = argument.ConvertTo(compilation.FindType(KnownTypeCode.UInt64), this);
}
return new UnaryOperatorExpression(UnaryOperatorType.BitNot, argument)
.WithRR(argument.ResolveResult)
.WithILInstruction(inst);
.WithILInstruction(inst)
.ConvertTo(type, this);
}
ExpressionWithResolveResult LogicNot(TranslatedExpression expr)

Loading…
Cancel
Save