Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions mdoc/Mono.Documentation/Updater/DynamicParserContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Mono.Documentation.Updater
public class DynamicParserContext
{
public ReadOnlyCollection<bool> TransformFlags;
public int TransformIndex;

public int TransformIndex;
public bool IsNullableAttribute;
public DynamicParserContext (ICustomAttributeProvider provider)
{
CustomAttribute da;
Expand All @@ -25,6 +25,9 @@ public DynamicParserContext (ICustomAttributeProvider provider)

TransformFlags = new ReadOnlyCollection<bool> (values.Select (t => (bool)t.Value).ToArray ());
}

IsNullableAttribute = provider.HasCustomAttributes &&
provider.CustomAttributes.Any(ca => ca.AttributeType.FullName == "System.Runtime.CompilerServices.NullableAttribute");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ protected override string GetTypeName(TypeReference type, DynamicParserContext c
}
}

if (context != null && context.IsNullableAttribute)
{
var TypeName = base.GetTypeName(type, context, appendGeneric, useTypeProjection);
return TypeName + "?";
}

return base.GetTypeName(type, context, appendGeneric, useTypeProjection);
}

Expand Down