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
Binary file added external/Test/RefReadonlyParameter.dll
Binary file not shown.
3 changes: 2 additions & 1 deletion mdoc/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Mono.Documentation
{
public static class Consts
{
public static string MonoVersion = "5.9.4";
public static string MonoVersion = "5.9.5";
public const string DocId = "DocId";
public const string CppCli = "C++ CLI";
public const string CppCx = "C++ CX";
Expand Down Expand Up @@ -49,6 +49,7 @@ public static class Consts
public const string CompilerGeneratedAttribute = "System.Runtime.CompilerServices.CompilerGeneratedAttribute";
public const string IsByRefLikeAttribute = "System.Runtime.CompilerServices.IsByRefLikeAttribute";
public const string IsReadOnlyAttribute = "System.Runtime.CompilerServices.IsReadOnlyAttribute";
public const string RequiresLocationAttribute = "System.Runtime.CompilerServices.RequiresLocationAttribute";
public const string InAttribute = "System.Runtime.InteropServices.InAttribute";
public const string OutAttribute = "System.Runtime.InteropServices.OutAttribute";
public const string TupleElementNamesAttribute = "System.Runtime.CompilerServices.TupleElementNamesAttribute";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ private StringBuilder AppendParameters (StringBuilder buf, MethodDefinition meth
protected override StringBuilder AppendParameter(StringBuilder buf, ParameterDefinition parameter)
{
TypeReference parameterType = parameter.ParameterType;
var refType = new BitArray(3);
var refType = new BitArray(4);

if (parameter.HasCustomAttributes)
{
Expand Down Expand Up @@ -650,14 +650,18 @@ protected override StringBuilder AppendParameter(StringBuilder buf, ParameterDef
{
refType.Set(0, true);
}
else if (parameter.IsIn && DocUtils.HasCustomAttribute(parameter, Consts.RequiresLocationAttribute))
{
refType.Set(3, true);
}
else
{
refType.Set(2, true);
}
parameterType = byReferenceType.ElementType;
}

buf.Append(refType.Get(0) ? "in " : (refType.Get(1) ? "out " : (refType.Get(2) ? "ref ": "")));
buf.Append(refType.Get(0) ? "in " : (refType.Get(1) ? "out " : (refType.Get(2) ? "ref ": (refType.Get(3) ? "ref readonly " : ""))));

if (parameter.HasCustomAttributes)
{
Expand Down
6 changes: 6 additions & 0 deletions mdoc/mdoc.Test/FormatterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,12 @@ public void CSharpAllowsRefStructForMemberTest(string typeFullName, string metho
TestMethodSignature(allowsRefStructDllPath, typeFullName, methodName, expectedSignature);
}

[TestCase("SomeClass", "MethodWithRefReadOnlyParam", "public void MethodWithRefReadOnlyParam (ref readonly int i);")]
public void CSharpRefReadonlyTest(string typeFullName, string methodName, string expectedSignature)
{
TestMethodSignature("../../../../external/Test/RefReadonlyParameter.dll", typeFullName, methodName, expectedSignature);
}

#region Helper Methods
string RealTypeName(string name){
switch (name) {
Expand Down
2 changes: 1 addition & 1 deletion mdoc/mdoc.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>mdoc</id>
<version>5.9.4</version>
<version>5.9.5</version>
<title>mdoc</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand Down