diff options
author | Min Huang <huangmin@microsoft.com> | 2022-04-01 05:48:23 +0300 |
---|---|---|
committer | Min Huang <huangmin@microsoft.com> | 2022-04-01 05:48:23 +0300 |
commit | 0a2519d6f8dc63b549a239e5cc14da4d306977e1 (patch) | |
tree | 0bca6f47fe74252f0848ffc1cfe5c324ffea506b | |
parent | 413d5912490fcb3a69efde0a1dfddc4f0719ac30 (diff) |
updatemdoc-5.8.9
-rw-r--r-- | mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs index 380b5800..4f631418 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs @@ -1,6 +1,7 @@ using Mono.Cecil; using Mono.Documentation.Util; using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; @@ -589,6 +590,7 @@ namespace Mono.Documentation.Updater.Formatters private string GetCallingConvention(FunctionPointerType type) { var callingConvention = type.CallingConvention.ToString("D"); + // Cecil lib uses "9" to stands for "Unmanaged Ext" if (callingConvention != "9") { return NormalizeCallingConvention(type.CallingConvention); @@ -671,16 +673,15 @@ namespace Mono.Documentation.Updater.Formatters private StringBuilder AppendParameter (StringBuilder buf, ParameterDefinition parameter) { TypeReference parameterType = parameter.ParameterType; - bool isIn = false; - bool isOut = false; - bool isRef = false; + var refType = new BitArray(3); if (parameterType is RequiredModifierType requiredModifierType) { switch(requiredModifierType.ModifierType.FullName) { - case Consts.InAttribute: isIn = true; break; - case Consts.OutAttribute: isOut = true; break; + case Consts.InAttribute: refType.Set(0, true); break; + case Consts.OutAttribute: refType.Set(1, true); break; + default: break; } parameterType = requiredModifierType.ElementType; } @@ -688,21 +689,20 @@ namespace Mono.Documentation.Updater.Formatters { if (parameter.IsOut) { - isOut = true; + refType.Set(1, true); } else if(parameter.IsIn && DocUtils.HasCustomAttribute(parameter, Consts.IsReadOnlyAttribute)) { - isIn = true; + refType.Set(0, true); } else { - isRef = true; + refType.Set(2, true); } parameterType = byReferenceType.ElementType; } - buf.Append(isIn ? "in " : (isOut ? "out " : (isRef ? "ref ": ""))); - + buf.Append(refType.Get(0) ? "in " : (refType.Get(1) ? "out " : (refType.Get(2) ? "ref ": ""))); if (parameter.HasCustomAttributes) { |