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
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs')
-rw-r--r--mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs49
1 files changed, 28 insertions, 21 deletions
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
index 4f4f287a..37c0da24 100644
--- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
+++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
@@ -517,18 +517,6 @@ namespace Mono.Documentation.Updater.Formatters
if (method.IsFinal) modifiers += " sealed";
if (modifiers == " virtual sealed") modifiers = "";
- if ((method.ReturnType.IsRequiredModifier
- && ((RequiredModifierType)method.ReturnType).ElementType.IsByReference)
- || method.ReturnType.IsByReference)
- {
- modifiers += " ref";
- }
-
- if (method.ReturnType.IsRequiredModifier && DocUtils.HasCustomAttribute(method.MethodReturnType, Consts.IsReadOnlyAttribute))
- {
- modifiers += " readonly";
- }
-
switch (method.Name)
{
case "op_Implicit":
@@ -542,6 +530,24 @@ namespace Mono.Documentation.Updater.Formatters
return buf.Append (modifiers);
}
+ protected override StringBuilder AppendRefTypeName(StringBuilder buf, ByReferenceType type, IAttributeParserContext context)
+ {
+ buf.Append("ref ");
+ return base.AppendRefTypeName(buf, type, context);
+ }
+
+ protected override StringBuilder AppendRequiredModifierTypeName(
+ StringBuilder buf, RequiredModifierType type, IAttributeParserContext context)
+ {
+ if (type.ModifierType.FullName == Consts.InAttribute && type.ElementType is ByReferenceType refType)
+ {
+ buf.Append("ref readonly ");
+ return _AppendTypeName(buf, refType.ElementType, context);
+ }
+
+ return base.AppendRequiredModifierTypeName(buf, type, context);
+ }
+
protected override StringBuilder AppendGenericMethod (StringBuilder buf, MethodDefinition method)
{
if (method.IsGenericMethod ())
@@ -585,19 +591,23 @@ namespace Mono.Documentation.Updater.Formatters
private StringBuilder AppendParameter (StringBuilder buf, ParameterDefinition parameter)
{
- if (parameter.ParameterType is ByReferenceType)
+ TypeReference parameterType = parameter.ParameterType;
+
+ if (parameterType is ByReferenceType byReferenceType)
{
if (parameter.IsOut)
{
buf.Append ("out ");
}
+ else if(parameter.IsIn)
+ {
+ buf.Append("in ");
+ }
else
{
- if (parameter.HasCustomAttributes && parameter.CustomAttributes.Any (ca => ca.AttributeType.Name == "IsReadOnlyAttribute"))
- buf.Append ("in ");
- else
- buf.Append ("ref ");
+ buf.Append("ref ");
}
+ parameterType = byReferenceType.ElementType;
}
if (parameter.HasCustomAttributes)
@@ -609,7 +619,7 @@ namespace Mono.Documentation.Updater.Formatters
var context = AttributeParserContext.Create (parameter);
var isNullableType = context.IsNullable ();
- buf.Append (GetTypeName (parameter.ParameterType, context));
+ buf.Append (GetTypeName (parameterType, context));
buf.Append (GetTypeNullableSymbol (parameter.ParameterType, isNullableType));
buf.Append (" ");
buf.Append (parameter.Name);
@@ -673,9 +683,6 @@ namespace Mono.Documentation.Updater.Formatters
modifiers = "";
buf.Append (modifiers).Append (' ');
- if (property.PropertyType.IsByReference)
- buf.Append("ref ");
-
var context = AttributeParserContext.Create (property);
var isNullableType = context.IsNullable ();
var propertyReturnTypeName = GetTypeName (property.PropertyType, context);