Browse Source

Add special case for 0u -> null conversion.

pull/844/head
Siegfried Pammer 8 years ago
parent
commit
cf3c4e4039
  1. 7
      ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs

7
ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs

@ -289,7 +289,12 @@ namespace ICSharpCode.Decompiler.CSharp @@ -289,7 +289,12 @@ namespace ICSharpCode.Decompiler.CSharp
return expressionBuilder.ConvertConstantValue(rr)
.WithILInstruction(this.ILInstructions);
}
if (targetType.Kind == TypeKind.Pointer && 0.Equals(ResolveResult.ConstantValue)) {
if (targetType.Kind == TypeKind.Pointer && (0.Equals(ResolveResult.ConstantValue) || 0u.Equals(ResolveResult.ConstantValue))) {
if (allowImplicitConversion) {
return new NullReferenceExpression()
.WithILInstruction(this.ILInstructions)
.WithRR(new ConstantResolveResult(targetType, null));
}
return new CastExpression(expressionBuilder.ConvertType(targetType), new NullReferenceExpression())
.WithILInstruction(this.ILInstructions)
.WithRR(new ConstantResolveResult(targetType, null));

Loading…
Cancel
Save