diff options
author | Ann Meng <anmeng@microsoft.com> | 2020-03-19 09:03:05 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2020-03-25 18:59:15 +0300 |
commit | 2d107a12b1b3434f2890dbcf5446880f3ac39b8d (patch) | |
tree | 9646f3a7617f2cf9682f55a5f37e8b8f13b14167 /mdoc/Mono.Documentation/Updater/DocUtils.cs | |
parent | c9b64b8846e59f0eac83fb742c3f77ce8e92d6c2 (diff) |
display "TypeParameter" node for delegate only if generic parameters are declared by itself
Diffstat (limited to 'mdoc/Mono.Documentation/Updater/DocUtils.cs')
-rw-r--r-- | mdoc/Mono.Documentation/Updater/DocUtils.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mdoc/Mono.Documentation/Updater/DocUtils.cs b/mdoc/Mono.Documentation/Updater/DocUtils.cs index 34b69f55..ec485cbc 100644 --- a/mdoc/Mono.Documentation/Updater/DocUtils.cs +++ b/mdoc/Mono.Documentation/Updater/DocUtils.cs @@ -847,5 +847,27 @@ namespace Mono.Documentation.Updater return false;
}
+
+ // For some types, the generic parameters resolved by mono declared by their declaring type
+ // This method will return the generic parameters declared by type itself
+ public static List<GenericParameter> GetGenericParameters(TypeDefinition type)
+ {
+ if (type == null)
+ throw new ArgumentNullException("type");
+
+ var genericParameters = new List<GenericParameter>(type.GenericParameters);
+ List<TypeReference> declTypes = GetDeclaringTypes(type);
+ int maxGenArgs = GetGenericArgumentCount(type);
+
+ for (int i = 0; i < declTypes.Count - 1; ++i)
+ {
+ int remove = System.Math.Min(maxGenArgs,
+ GetGenericArgumentCount(declTypes[i]));
+ maxGenArgs -= remove;
+ while (remove-- > 0)
+ genericParameters.RemoveAt(0);
+ }
+ return genericParameters;
+ }
}
}
|