Browse Source

Fix #1528: Show default value of nullable parameters as null.

pull/1556/head
Siegfried Pammer 6 years ago
parent
commit
bb10f5a6a6
  1. 2
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

2
ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

@ -739,7 +739,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
if (type == null) if (type == null)
throw new ArgumentNullException("type"); throw new ArgumentNullException("type");
if (constantValue == null) { if (constantValue == null) {
if (type.IsReferenceType == true) { if (type.IsReferenceType == true || type.IsKnownType(KnownTypeCode.NullableOfT)) {
var expr = new NullReferenceExpression(); var expr = new NullReferenceExpression();
if (AddResolveResultAnnotations) if (AddResolveResultAnnotations)
expr.AddAnnotation(new ConstantResolveResult(SpecialType.NullType, null)); expr.AddAnnotation(new ConstantResolveResult(SpecialType.NullType, null));

Loading…
Cancel
Save