diff options
author | maopeixia <34855298+maopeixia@users.noreply.github.com> | 2020-06-27 00:09:48 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2020-09-02 00:27:01 +0300 |
commit | 9c21c90cdb03f37cc1d8ecd19f83e5b0023cb658 (patch) | |
tree | a4fee436c8bfa9426441c4b94008091e411365d7 /mdoc | |
parent | 02f82884dee2f940a7cf772f60884d0c70b85487 (diff) |
C# formatter now renders nullable references
https://ceapex.visualstudio.com/Engineering/_queries/edit/239534/?triage=true
PR #504
Diffstat (limited to 'mdoc')
-rw-r--r-- | mdoc/Mono.Documentation/Updater/DynamicParserContext.cs | 7 | ||||
-rw-r--r-- | mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/mdoc/Mono.Documentation/Updater/DynamicParserContext.cs b/mdoc/Mono.Documentation/Updater/DynamicParserContext.cs index ba1f643a..53e36935 100644 --- a/mdoc/Mono.Documentation/Updater/DynamicParserContext.cs +++ b/mdoc/Mono.Documentation/Updater/DynamicParserContext.cs @@ -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; @@ -25,6 +25,9 @@ namespace Mono.Documentation.Updater 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"); } } }
\ No newline at end of file diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs index e63529bd..746effe4 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs @@ -139,6 +139,12 @@ namespace Mono.Documentation.Updater.Formatters } } + if (context != null && context.IsNullableAttribute) + { + var TypeName = base.GetTypeName(type, context, appendGeneric, useTypeProjection); + return TypeName + "?"; + } + return base.GetTypeName(type, context, appendGeneric, useTypeProjection); } |