Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mdoc
diff options
context:
space:
mode:
authorMin Huang <huangmin@microsoft.com>2022-03-01 12:47:17 +0300
committerGitHub <noreply@github.com>2022-03-01 12:47:17 +0300
commite1cd54c0f6f67eff13ba4c6e4c9634f673857437 (patch)
tree0c75185ac42841e5ce25dfc954ddbc729bf890b1 /mdoc
parent03ee19083d4587af6b301beb86b921f2025c8064 (diff)
bump mdoc to 5.8.7 (#612)
* bump mdoc to 5.8.7 * mdoc: use //license/@expression, not //licenseUrl * fix in parameter issue * fix issue for microsoft.extensions.logging.console.consoleformatter.write api * Fix issue for system.diagnostics.taglist api * Fix test cases * update * update
Diffstat (limited to 'mdoc')
-rw-r--r--mdoc/Consts.cs2
-rw-r--r--mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs17
-rw-r--r--mdoc/mdoc.Test/FormatterTests.cs11
-rw-r--r--mdoc/mdoc.Test/SampleClasses/ReadonlyRefClass.cs8
-rw-r--r--mdoc/mdoc.Test/SampleClasses/StructWithReadOnlyMethod.cs4
-rw-r--r--mdoc/mdoc.Test/SampleClasses/Struct_Interface_A.cs7
-rw-r--r--mdoc/mdoc.nuspec4
7 files changed, 38 insertions, 15 deletions
diff --git a/mdoc/Consts.cs b/mdoc/Consts.cs
index db2772ed..3ef0b936 100644
--- a/mdoc/Consts.cs
+++ b/mdoc/Consts.cs
@@ -3,7 +3,7 @@ namespace Mono.Documentation
{
public static class Consts
{
- public static string MonoVersion = "5.8.6.1";
+ public static string MonoVersion = "5.8.7";
public const string DocId = "DocId";
public const string CppCli = "C++ CLI";
public const string CppCx = "C++ CX";
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
index 37c0da24..811ff3be 100644
--- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
+++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
@@ -503,19 +503,19 @@ namespace Mono.Documentation.Updater.Formatters
{
string modifiers = String.Empty;
if (method.IsStatic) modifiers += " static";
- TypeDefinition declType = (TypeDefinition)method.DeclaringType;
- if (declType.IsValueType && DocUtils.HasCustomAttribute(method, Consts.IsReadOnlyAttribute))
- {
- modifiers += " readonly";
- }
if (method.IsVirtual && !method.IsAbstract)
{
if ((method.Attributes & MethodAttributes.NewSlot) != 0) modifiers += " virtual";
else modifiers += " override";
}
+ TypeDefinition declType = (TypeDefinition)method.DeclaringType;
if (method.IsAbstract && !declType.IsInterface) modifiers += " abstract";
if (method.IsFinal) modifiers += " sealed";
if (modifiers == " virtual sealed") modifiers = "";
+ if (declType.IsValueType && DocUtils.HasCustomAttribute(method, Consts.IsReadOnlyAttribute))
+ {
+ modifiers += buf.Length == 0 ? "readonly" : " readonly";
+ }
switch (method.Name)
{
@@ -593,13 +593,18 @@ namespace Mono.Documentation.Updater.Formatters
{
TypeReference parameterType = parameter.ParameterType;
+ if (parameterType is RequiredModifierType requiredModifierType)
+ {
+ parameterType = requiredModifierType.ElementType;
+ }
+
if (parameterType is ByReferenceType byReferenceType)
{
if (parameter.IsOut)
{
buf.Append ("out ");
}
- else if(parameter.IsIn)
+ else if(parameter.IsIn && DocUtils.HasCustomAttribute(parameter, Consts.IsReadOnlyAttribute))
{
buf.Append("in ");
}
diff --git a/mdoc/mdoc.Test/FormatterTests.cs b/mdoc/mdoc.Test/FormatterTests.cs
index 2e16f65f..ce1009fe 100644
--- a/mdoc/mdoc.Test/FormatterTests.cs
+++ b/mdoc/mdoc.Test/FormatterTests.cs
@@ -259,9 +259,11 @@ namespace mdoc.Test
[TestCase(typeof(ReadonlyRefClass), "Ref", "public ref int Ref ();")]
[TestCase(typeof(ReadonlyRefClass), "ReadonlyRef", "public ref readonly int ReadonlyRef ();")]
[TestCase(typeof(ReadonlyRefClass), "RefInAndOutMethod", "public void RefInAndOutMethod (ref int a, in int b, out int c);")]
+ [TestCase(typeof(ReadonlyRefClass), "InAttributeMethod", "public void InAttributeMethod (ref int a, in int b, out int c);")]
[TestCase(typeof(GenericRefClass<>), "Ref", "public ref T Ref ();")]
[TestCase(typeof(GenericRefClass<>), "ReadonlyRef", "public ref readonly T ReadonlyRef ();")]
[TestCase(typeof(GenericRefClass<>), "RefInAndOutMethod", "public void RefInAndOutMethod (ref T a, in T b, out T c);")]
+ [TestCase(typeof(GenericRefClass<>), "InAttributeMethod", "public void InAttributeMethod (ref T a, in T b, out T c);")]
public void CSharpRefReturnMethodTest(Type type, string methodName, string expectedSignature)
{
var member = GetMethod(type, m => m.Name == methodName);
@@ -409,12 +411,13 @@ namespace mdoc.Test
Assert.AreEqual("public readonly ref struct ReadOnlyRefStruct", typeSignature);
}
- [Test]
- public void CSharpReadOnlyMemberStructTest()
+ [TestCase("Sum", "public readonly double Sum ();")]
+ [TestCase("GetNum", "readonly int Struct_Interface_A.GetNum ();")]
+ public void CSharpReadOnlyMemberStructTest(string methodName, string expectedSignature)
{
- var method = GetMethod(typeof(SampleClasses.StructWithReadOnlyMethod), m => m.Name == "Sum");
+ var method = GetMethod(typeof(SampleClasses.StructWithReadOnlyMethod), m => m.Name.Contains(methodName));
var methodSignature = formatter.GetDeclaration(method);
- Assert.AreEqual("public readonly double Sum ();", methodSignature);
+ Assert.AreEqual(expectedSignature, methodSignature);
}
#region Helper Methods
diff --git a/mdoc/mdoc.Test/SampleClasses/ReadonlyRefClass.cs b/mdoc/mdoc.Test/SampleClasses/ReadonlyRefClass.cs
index 59f35672..2ff9d09a 100644
--- a/mdoc/mdoc.Test/SampleClasses/ReadonlyRefClass.cs
+++ b/mdoc/mdoc.Test/SampleClasses/ReadonlyRefClass.cs
@@ -1,4 +1,6 @@
-namespace mdoc.Test.SampleClasses
+using System.Runtime.InteropServices;
+
+namespace mdoc.Test.SampleClasses
{
public class ReadonlyRefClass
{
@@ -12,6 +14,8 @@
public ref readonly int this[int index] => throw null;
public void RefInAndOutMethod(ref int a, in int b, out int c) => throw null;
+
+ public void InAttributeMethod([In] ref int a, [In] in int b, [Out] out int c) => throw null;
}
public class GenericRefClass<T>
@@ -25,5 +29,7 @@
public ref readonly T this[int index] => throw null;
public void RefInAndOutMethod(ref T a, in T b, out T c) => throw null;
+
+ public void InAttributeMethod([In] ref T a, [In] in T b, [Out] out T c) => throw null;
}
}
diff --git a/mdoc/mdoc.Test/SampleClasses/StructWithReadOnlyMethod.cs b/mdoc/mdoc.Test/SampleClasses/StructWithReadOnlyMethod.cs
index baf8f7af..b61b2811 100644
--- a/mdoc/mdoc.Test/SampleClasses/StructWithReadOnlyMethod.cs
+++ b/mdoc/mdoc.Test/SampleClasses/StructWithReadOnlyMethod.cs
@@ -1,6 +1,6 @@
namespace mdoc.Test.SampleClasses
{
- public struct StructWithReadOnlyMethod
+ public struct StructWithReadOnlyMethod : Struct_Interface_A
{
public double X { get; set; }
public double Y { get; set; }
@@ -9,5 +9,7 @@
{
return X + Y;
}
+
+ readonly int Struct_Interface_A.GetNum() => 1;
}
}
diff --git a/mdoc/mdoc.Test/SampleClasses/Struct_Interface_A.cs b/mdoc/mdoc.Test/SampleClasses/Struct_Interface_A.cs
new file mode 100644
index 00000000..0529e026
--- /dev/null
+++ b/mdoc/mdoc.Test/SampleClasses/Struct_Interface_A.cs
@@ -0,0 +1,7 @@
+namespace mdoc.Test.SampleClasses
+{
+ public interface Struct_Interface_A
+ {
+ int GetNum();
+ }
+}
diff --git a/mdoc/mdoc.nuspec b/mdoc/mdoc.nuspec
index 0bf49a81..6483827a 100644
--- a/mdoc/mdoc.nuspec
+++ b/mdoc/mdoc.nuspec
@@ -2,12 +2,12 @@
<package >
<metadata>
<id>mdoc</id>
- <version>5.8.6.1</version>
+ <version>5.8.7</version>
<title>mdoc</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<projectUrl>https://github.com/mono/api-doc-tools</projectUrl>
- <licenseUrl>https://github.com/mono/api-doc-tools/blob/main/LICENSE.md</licenseUrl>
+ <license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>.NET API Documentation toolchain</description>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>