From 38d866cbbf3eb19b0a1a523153a3303a9ac2b1f3 Mon Sep 17 00:00:00 2001 From: RanhaoXu Date: Tue, 6 Apr 2021 21:29:40 +0800 Subject: Copy typemap.xml to output (#540) https://dev.azure.com/ceapex/Engineering/_workitems/edit/394298/ --- mdoc/Mono.Documentation/MDocUpdater.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs index 3e24f500..8d7463e0 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.cs @@ -320,6 +320,7 @@ namespace Mono.Documentation if (File.Exists(typeMapPath)) { Console.WriteLine($"Loading typemap file at {typeMapPath}"); + File.Copy(typeMapPath, Path.Combine(srcPath, "TypeMap.xml"), true); TypeMap map = TypeMap.FromXml(typeMapPath); this.TypeMap = map; FormatterManager.UpdateTypeMap(map); -- cgit v1.2.3 From 806f222aad9a217efc587776915ffba95f92a20f Mon Sep 17 00:00:00 2001 From: Xiao Luo Date: Wed, 14 Apr 2021 23:20:54 +0800 Subject: Improve argument value formatter (#539) https://dev.azure.com/ceapex/Engineering/_workitems/edit/366340 --- mdoc/Mono.Documentation/MDocUpdater.cs | 4 +- .../ApplePlatformEnumFormatter.cs | 95 ----- .../AttributeFormatters/AttributeFormatter.cs | 35 +- .../AttributeFormatters/AttributeValueFormatter.cs | 389 +++++++++++++++--- .../DefaultAttributeValueFormatter.cs | 13 - .../StandardFlagsEnumFormatter.cs | 36 -- .../Formatters/CSharpFullMemberFormatter.cs | 2 +- .../CppFormatters/CppFullMemberFormatter.cs | 2 +- .../Updater/Formatters/FSharpFormatter.cs | 2 +- .../Updater/Formatters/ILFullMemberFormatter.cs | 2 +- .../Updater/Formatters/JsFormatter.cs | 2 +- .../Updater/Formatters/MemberFormatter.cs | 70 +++- .../Updater/Formatters/SlashDocMemberFormatter.cs | 2 +- .../Updater/Formatters/VBFullMemberFormatter.cs | 2 +- .../Mono.Documentation/Updater/ResolvedTypeInfo.cs | 29 -- .../DiscriminatedUnions+Shape+Circle.xml | 4 +- .../DiscriminatedUnions+Shape+Prism.xml | 4 +- .../DiscriminatedUnions+Shape+Rectangle.xml | 4 +- ...atternMatchingExamples+PersonName+FirstLast.xml | 4 +- ...atternMatchingExamples+PersonName+FirstOnly.xml | 4 +- ...PatternMatchingExamples+PersonName+LastOnly.xml | 4 +- .../PatternMatchingExamples+Shape+Circle.xml | 4 +- .../PatternMatchingExamples+Shape+Rectangle.xml | 4 +- mdoc/mdoc.Test/AttributeValueFormatterTest.cs | 168 ++++++++ mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs | 48 +++ .../SampleClasses/AttributeDataTypeAttribute.cs | 57 +++ .../NotApplyAttributeInvalidFlagsEnum.cs | 10 + .../NotApplyAttributeValidFlagsEnum.cs | 12 + mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs | 450 +++++++++++++++++++++ mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs | 14 + .../SampleClasses/SomeIteratorStateMachine.cs | 44 ++ mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs | 34 ++ mdoc/mdoc.Test/mdoc.Test.csproj | 9 + mdoc/mdoc.csproj | 4 - 34 files changed, 1266 insertions(+), 301 deletions(-) delete mode 100644 mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/ApplePlatformEnumFormatter.cs delete mode 100644 mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/DefaultAttributeValueFormatter.cs delete mode 100644 mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/StandardFlagsEnumFormatter.cs delete mode 100644 mdoc/Mono.Documentation/Updater/ResolvedTypeInfo.cs create mode 100644 mdoc/mdoc.Test/AttributeValueFormatterTest.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/AttributeDataTypeAttribute.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/NotApplyAttributeInvalidFlagsEnum.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/NotApplyAttributeValidFlagsEnum.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/SomeIteratorStateMachine.cs create mode 100644 mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs index 8d7463e0..d75db09e 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.cs @@ -4408,9 +4408,9 @@ namespace Mono.Documentation return docTypeFormatter.GetName (type, useTypeProjection: useTypeProjection); } - internal static string GetDocTypeFullName (TypeReference type, bool useTypeProjection = true) + internal static string GetDocTypeFullName (TypeReference type, bool useTypeProjection = true, bool isTypeofOperator = false) { - return DocTypeFullMemberFormatter.Default.GetName (type, useTypeProjection: useTypeProjection); + return DocTypeFullMemberFormatter.Default.GetName (type, useTypeProjection: useTypeProjection, isTypeofOperator: isTypeofOperator); } internal static string GetXPathForMember (DocumentationMember member) diff --git a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/ApplePlatformEnumFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/ApplePlatformEnumFormatter.cs deleted file mode 100644 index 55dd508f..00000000 --- a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/ApplePlatformEnumFormatter.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Mono.Cecil; - -namespace Mono.Documentation.Updater -{ - /// A custom formatter for the ObjCRuntime.Platform enumeration. - class ApplePlatformEnumFormatter : AttributeValueFormatter - { - public override bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue) - { - TypeReference valueType = type.Reference; - string typename = MDocUpdater.GetDocTypeFullName (valueType); - TypeDefinition valueDef = type.Definition; - if (typename.Contains ("ObjCRuntime.Platform") && valueDef.CustomAttributes.Any (ca => ca.AttributeType.FullName == "System.FlagsAttribute")) - { - - var values = GetEnumerationValues (valueDef); - long c = ToInt64 (v); - - returnvalue = Format (c, values, typename); - return true; - } - - returnvalue = null; - return false; - } - - string Format (long c, IDictionary values, string typename) - { - int iosarch, iosmajor, iosminor, iossubminor; - int macarch, macmajor, macminor, macsubminor; - GetEncodingiOS (c, out iosarch, out iosmajor, out iosminor, out iossubminor); - GetEncodingMac ((ulong)c, out macarch, out macmajor, out macminor, out macsubminor); - - if (iosmajor == 0 & iosminor == 0 && iossubminor == 0) - { - return FormatValues ("Mac", macarch, macmajor, macminor, macsubminor); - } - - if (macmajor == 0 & macminor == 0 && macsubminor == 0) - { - return FormatValues ("iOS", iosarch, iosmajor, iosminor, iossubminor); - } - - return string.Format ("(Platform){0}", c); - } - - string FormatValues (string plat, int arch, int major, int minor, int subminor) - { - string archstring = ""; - switch (arch) - { - case 1: - archstring = "32"; - break; - case 2: - archstring = "64"; - break; - } - return string.Format ("Platform.{4}_{0}_{1}{2} | Platform.{4}_Arch{3}", - major, - minor, - subminor == 0 ? "" : "_" + subminor.ToString (), - archstring, - plat - ); - } - - void GetEncodingiOS (long entireLong, out int archindex, out int major, out int minor, out int subminor) - { - long lowerBits = entireLong & 0xffffffff; - int lowerBitsAsInt = (int)lowerBits; - GetEncoding (lowerBitsAsInt, out archindex, out major, out minor, out subminor); - } - - void GetEncodingMac (ulong entireLong, out int archindex, out int major, out int minor, out int subminor) - { - ulong higherBits = entireLong & 0xffffffff00000000; - int higherBitsAsInt = (int)((higherBits) >> 32); - GetEncoding (higherBitsAsInt, out archindex, out major, out minor, out subminor); - } - - void GetEncoding (Int32 encodedBits, out int archindex, out int major, out int minor, out int subminor) - { - // format is AAJJNNSS - archindex = (int)((encodedBits & 0xFF000000) >> 24); - major = (int)((encodedBits & 0x00FF0000) >> 16); - minor = (int)((encodedBits & 0x0000FF00) >> 8); - subminor = (int)((encodedBits & 0x000000FF) >> 0); - } - } -} \ No newline at end of file diff --git a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeFormatter.cs index 1378675a..b8076d73 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeFormatter.cs @@ -2,13 +2,14 @@ using Mono.Documentation.Util; using System; using System.Collections.Generic; -using System.IO; using System.Linq; namespace Mono.Documentation.Updater.Formatters { public class AttributeFormatter { + private AttributeValueFormatter valueFormatter = new AttributeValueFormatter(); + public virtual string PrefixBrackets { get; } = ""; public virtual string SurfixBrackets { get; } = ""; public virtual string Language { get; } = ""; @@ -119,37 +120,9 @@ namespace Mono.Documentation.Updater.Formatters return $"{name}={value}"; } - public virtual string MakeAttributesValueString(object v, TypeReference valueType) + public virtual string MakeAttributesValueString(object argumentValue, TypeReference argumentType) { - var formatters = new[] { - new AttributeValueFormatter (), - new ApplePlatformEnumFormatter (), - new StandardFlagsEnumFormatter (), - new DefaultAttributeValueFormatter (), - }; - - ResolvedTypeInfo type = new ResolvedTypeInfo(valueType); - - if (valueType is ArrayType && v is CustomAttributeArgument[]) - { - ArrayType atype = valueType as ArrayType; - CustomAttributeArgument[] args = v as CustomAttributeArgument[]; - var returnvalue = $"new {atype.FullName}{(atype.FullName.EndsWith("[]") ? "" : "[]")} {{ { string.Join(", ", args.Select(a => MakeAttributesValueString(a.Value, a.Type)).ToArray()) } }}"; - return returnvalue; - } - - foreach (var formatter in formatters) - { - string formattedValue; - if (formatter.TryFormatValue(v, type, out formattedValue)) - { - return formattedValue; - } - } - - // this should never occur because the DefaultAttributeValueFormatter will always - // successfully format the value ... but this is needed to satisfy the compiler :) - throw new InvalidDataException(string.Format("Unable to format attribute value ({0})", v.ToString())); + return valueFormatter.Format(argumentType, argumentValue); } private bool IsIgnoredAttribute(CustomAttribute customAttribute) diff --git a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeValueFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeValueFormatter.cs index a9e092bb..41566740 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeValueFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/AttributeValueFormatter.cs @@ -1,92 +1,385 @@ -using System; +using Mono.Cecil; +using System; using System.Collections.Generic; using System.Linq; -using Mono.Cecil; - -using Mono.Documentation.Util; namespace Mono.Documentation.Updater { - /// Formats attribute values. Should return true if it is able to format the value. - class AttributeValueFormatter - { - public virtual bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue) + public class AttributeValueFormatter + { + public string Format(TypeReference argumentType, object argumentValue) { - TypeReference valueType = type.Reference; - if (v == null) + // When a property type of an attribute is an object type you can assign any type to it, + // so we need to convert the object type to a concrete object type. + if (argumentValue is CustomAttributeArgument attributeArgument) { - returnvalue = "null"; - return true; + return Format(attributeArgument.Type, attributeArgument.Value); } - if (valueType.FullName == "System.Type") + + return FormatValue(argumentType, argumentValue); + } + + // The types of positional and named parameters for an attribute class are limited to the attribute parameter types, which are: + // https://github.com/dotnet/csharplang/blob/main/spec/attributes.md#attribute-parameter-types + private string FormatValue(TypeReference argumentType, object argumentValue) + { + if (IsNull(argumentValue)) { - var vTypeRef = v as TypeReference; - if (vTypeRef != null) - returnvalue = "typeof(" + NativeTypeManager.GetTranslatedName (vTypeRef) + ")"; // TODO: drop NS handling - else - returnvalue = "typeof(" + v.ToString () + ")"; + return "null"; + } - return true; + if (IsArrayType(argumentType, argumentValue)) + { + return ConvertToArrayType(argumentType, argumentValue); } - if (valueType.FullName == "System.String") + + if (IsTypeType(argumentType, argumentValue)) { - returnvalue = "\"" + FilterSpecialChars (v.ToString ()) + "\""; - return true; + return ConvertToType(argumentType, argumentValue); } - if (valueType.FullName == "System.Char") + + if (IsStringType(argumentType, argumentValue)) { - returnvalue = "'" + FilterSpecialChars (v.ToString ()) + "'"; - return true; + return ConvertToString(argumentType, argumentValue); } - if (v is Boolean) + + if (IsCharType(argumentType, argumentValue)) { - returnvalue = (bool)v ? "true" : "false"; - return true; + return ConvertToChar(argumentType, argumentValue); } - TypeDefinition valueDef = type.Definition; - if (valueDef == null || !valueDef.IsEnum) + if (IsBoolType(argumentType, argumentValue)) { - returnvalue = v.ToString (); - return true; + return ConvertToBool(argumentType, argumentValue); } - string typename = MDocUpdater.GetDocTypeFullName (valueType); - var values = GetEnumerationValues (valueDef); - long c = ToInt64 (v); - if (values.ContainsKey (c)) + if (IsEnumType(argumentType, argumentValue)) { - returnvalue = typename + "." + values[c]; - return true; + return ConvertToEnum(argumentType, argumentValue); + } + + return ConvertUnhandledTypeToString(argumentValue); + } + + private bool IsNull(object argumentValue) + { + return argumentValue == null; + } + + private bool IsEnumType(TypeReference argumentType, object argumentValue) + { + return argumentType.Resolve().IsEnum; + } + + private bool IsTypeType(TypeReference argumentType, object argumentValue) + { + return IsType("System.Type", argumentType, argumentValue); + } + + private bool IsStringType(TypeReference argumentType, object argumentValue) + { + return IsType("System.String", argumentType, argumentValue); + } + + private bool IsCharType(TypeReference argumentType, object argumentValue) + { + return IsType("System.Char", argumentType, argumentValue); + } + + private bool IsBoolType(TypeReference argumentType, object argumentValue) + { + return IsType("System.Boolean", argumentType, argumentValue); + } + + private bool IsType(string typeFullName, TypeReference argumentType, object argumentValue) + { + return argumentType.FullName.Equals(typeFullName); + } + + private bool IsArrayType(TypeReference argumentType, object argumentValue) + { + return argumentType is ArrayType && argumentValue is CustomAttributeArgument[]; + } + + private string ConvertToArrayType(TypeReference argumentType, object argumentValue) + { + var arrayType = argumentType as ArrayType; + var arrayArguments = argumentValue as CustomAttributeArgument[]; + var arrayTypeFullName = $"new {arrayType.FullName}{(arrayType.FullName.EndsWith("[]") ? "" : "[]")}"; + var arrayArgumentValues = arrayArguments.Select(i => FormatValue(i.Type, i.Value)); + + return $"{arrayTypeFullName} {{ {string.Join(", ", arrayArgumentValues)} }}"; + } + + private bool IsFlagsEnum(TypeReference argumentType, object argumentValue) + { + var argumentTypeDefinition = argumentType.Resolve(); + var isApplyFlagsAttributeEnumType = argumentTypeDefinition.CustomAttributes.Any(a => a.AttributeType.FullName == "System.FlagsAttribute"); + var isNotApplyAttributeFlagsEnumType = IsNotApplyAttributeFlagsEnumType(argumentTypeDefinition, argumentValue); + + return isApplyFlagsAttributeEnumType || isNotApplyAttributeFlagsEnumType; + } + + /// + /// We have a few legacy flags enum type not apply FlagsAttribute to it. + /// For example, Microsoft.JScript.JSFunctionAttributeEnum in .NET Framework 1.1 but the issue has been fixed in the newer version. + /// + private bool IsNotApplyAttributeFlagsEnumType(TypeDefinition argumentType, object argumentValue) + { + (var typeFullName, var enumConstants, var enumValue) = ExtractEnumTypeData(argumentType, argumentValue); + if (enumConstants.ContainsKey(enumValue)) + { + // Not is a combinations of values. + return false; + } + + var flagsEnumValues = enumConstants.Keys.ToList(); + flagsEnumValues.Remove(0); // The zero value is not a valid flags enum value. + + // The following example is an invalid and valid flags enum type. + // None = 0, Read = 1, Write = 2, ReadWrite = 3 maybe is a flags enum type but sometimes it is not. + // Read = 1, Write = 2, Open = 4, Close = 8 actually is a flags enum type. + var minFlagsEnumValueCount = 4; + if (flagsEnumValues.Count() >= minFlagsEnumValueCount) + { + long allEnumLogicalOrValue = 0; + foreach (var item in flagsEnumValues) + { + allEnumLogicalOrValue = allEnumLogicalOrValue | item; + } + + var isFlagsEnumType = !flagsEnumValues.Any(i => (i & allEnumLogicalOrValue) != i); + var isCombinationValue = flagsEnumValues.Count(i => (i & enumValue) != i) > 1; + + return isFlagsEnumType && isCombinationValue; } - returnvalue = null; return false; } - internal static IDictionary GetEnumerationValues(TypeDefinition type) + private bool IsApplePlatformEnum(TypeReference argumentType, object argumentValue) + { + return MDocUpdater.GetDocTypeFullName(argumentType).Contains("ObjCRuntime.Platform"); + } + + private string ConvertToType(TypeReference argumentType, object argumentValue) { + var valueResult = GetArgumentValue("System.Type", argumentType, argumentValue); + var typeFullName = MDocUpdater.GetDocTypeFullName((TypeReference)valueResult, isTypeofOperator: true); + + return $"typeof({typeFullName})"; + } + + private string ConvertToString(TypeReference argumentType, object argumentValue) + { + var valueResult = GetArgumentValue("System.String", argumentType, argumentValue); + if (valueResult == null) + { + return "null"; + } + + return string.Format("\"{0}\"", FilterSpecialChars(valueResult.ToString())); + } + + private string ConvertToBool(TypeReference argumentType, object argumentValue) + { + return GetArgumentValue("System.Boolean", argumentType, argumentValue).ToString().ToLower(); + } + + private string ConvertToChar(TypeReference argumentType, object argumentValue) + { + var valueResult = GetArgumentValue("System.Char", argumentType, argumentValue).ToString(); + + return string.Format("'{0}'", FilterSpecialChars(valueResult)); + } + + private string ConvertUnhandledTypeToString(object argumentValue) + { + return argumentValue.ToString(); + } + + private string ConvertToEnum(TypeReference argumentType, object argumentValue) + { + if (IsFlagsEnum(argumentType, argumentValue)) + { + if (IsApplePlatformEnum(argumentType, argumentValue)) + { + return ConvertToApplePlatformEnum(argumentType, argumentValue); + } + + return ConvertToFlagsEnum(argumentType, argumentValue); + } + + return ConvertToNormalEnum(argumentType, argumentValue); + } + + private string ConvertToNormalEnum(TypeReference argumentType, object argumentValue) + { + (var typeFullName, var enumConstants, var enumValue) = ExtractEnumTypeData(argumentType, argumentValue); + if (enumConstants.ContainsKey(enumValue)) + { + return typeFullName + "." + enumConstants[enumValue]; + } + + return ConvertToUnknownEnum(argumentType, argumentValue); + } + + private string ConvertToUnknownEnum(TypeReference argumentType, object argumentValue) + { + (var typeFullName, var enumConstants, var enumValue) = ExtractEnumTypeData(argumentType, argumentValue); + + return $"({typeFullName}) {enumValue}"; + } + + private string ConvertToFlagsEnum(TypeReference argumentType, object argumentValue) + { + (var typeFullName, var enumConstants, var enumValue) = ExtractEnumTypeData(argumentType, argumentValue); + if (enumConstants.ContainsKey(enumValue)) + { + // Not is a combinations of values. + return $"{typeFullName}.{enumConstants[enumValue]}"; + } + + var flagsEnumValues = enumConstants.Keys.Where(i => (enumValue & i) == i && i != 0).ToList(); + var duplicateEnumValues = flagsEnumValues.Where(i => flagsEnumValues.Any(a => (a & i) == i && a > i)); + + flagsEnumValues.RemoveAll(i => duplicateEnumValues.Contains(i)); + var flagsEnumNames = flagsEnumValues + .Select(i => $"{typeFullName}.{enumConstants[i]}") + .OrderBy(val => val) // to maintain a consistent list across frameworks/versions + .ToArray(); + + if (flagsEnumNames.Length > 0) + { + return string.Join(" | ", flagsEnumNames); + } + + return ConvertToUnknownEnum(argumentType, argumentValue); + } + + private string ConvertToApplePlatformEnum(TypeReference argumentType, object argumentValue) + { + (var typeFullName, var enumConstants, var enumValue) = ExtractEnumTypeData(argumentType, argumentValue); + if (enumConstants.ContainsKey(enumValue)) + { + return typeFullName + "." + enumConstants[enumValue]; + } + + return FormatApplePlatformEnum(enumValue); + } + + private (string typeFullName, IDictionary enumConstants, long enumValue) ExtractEnumTypeData(TypeReference argumentType, object argumentValue) + { + var argumentTypeDefinition = argumentType.Resolve(); + var typeFullName = MDocUpdater.GetDocTypeFullName(argumentTypeDefinition); + var enumConstants = GetEnumerationValues(argumentTypeDefinition); + var enumValue = ToInt64(argumentValue); + + return (typeFullName, enumConstants, enumValue); + } + + private string FormatApplePlatformEnum(long enumValue) + { + int iosarch, iosmajor, iosminor, iossubminor; + int macarch, macmajor, macminor, macsubminor; + GetEncodingiOS(enumValue, out iosarch, out iosmajor, out iosminor, out iossubminor); + GetEncodingMac((ulong)enumValue, out macarch, out macmajor, out macminor, out macsubminor); + + if (iosmajor == 0 & iosminor == 0 && iossubminor == 0) + { + return FormatApplePlatformEnumValue("Mac", macarch, macmajor, macminor, macsubminor); + } + + if (macmajor == 0 & macminor == 0 && macsubminor == 0) + { + return FormatApplePlatformEnumValue("iOS", iosarch, iosmajor, iosminor, iossubminor); + } + + return string.Format("(Platform){0}", enumValue); + } + + private string FormatApplePlatformEnumValue(string plat, int arch, int major, int minor, int subminor) + { + var archstring = string.Empty; + switch (arch) + { + case 1: + archstring = "32"; + break; + case 2: + archstring = "64"; + break; + } + + return string.Format("Platform.{4}_{0}_{1}{2} | Platform.{4}_Arch{3}", + major, + minor, + subminor == 0 ? "" : "_" + subminor.ToString(), + archstring, + plat + ); + } + + private void GetEncodingiOS(long entireLong, out int archindex, out int major, out int minor, out int subminor) + { + long lowerBits = entireLong & 0xffffffff; + int lowerBitsAsInt = (int)lowerBits; + GetEncodingApplePlatform(lowerBitsAsInt, out archindex, out major, out minor, out subminor); + } + + private void GetEncodingMac(ulong entireLong, out int archindex, out int major, out int minor, out int subminor) + { + ulong higherBits = entireLong & 0xffffffff00000000; + int higherBitsAsInt = (int)((higherBits) >> 32); + GetEncodingApplePlatform(higherBitsAsInt, out archindex, out major, out minor, out subminor); + } + + private void GetEncodingApplePlatform(Int32 encodedBits, out int archindex, out int major, out int minor, out int subminor) + { + // format is AAJJNNSS + archindex = (int)((encodedBits & 0xFF000000) >> 24); + major = (int)((encodedBits & 0x00FF0000) >> 16); + minor = (int)((encodedBits & 0x0000FF00) >> 8); + subminor = (int)((encodedBits & 0x000000FF) >> 0); + } + + private object GetArgumentValue(string argumentTypeFullName, TypeReference argumentType, object argumentValue) + { + if (argumentType.FullName.Equals(argumentTypeFullName)) + { + return argumentValue; + } + + throw new ArgumentException($"The argument type does not match {argumentTypeFullName}."); + } + + private IDictionary GetEnumerationValues(TypeDefinition argumentType) + { + var enumValues = from f in argumentType.Fields + where !(f.IsRuntimeSpecialName || f.IsSpecialName) + select f; + var values = new Dictionary(); - foreach (var f in - (from f in type.Fields - where !(f.IsRuntimeSpecialName || f.IsSpecialName) - select f)) + foreach (var item in enumValues) { - values[ToInt64(f.Constant)] = f.Name; + values[ToInt64(item.Constant)] = item.Name; } + return values; } - internal static long ToInt64(object value) + private long ToInt64(object value) { if (value is ulong) return (long)(ulong)value; + return Convert.ToInt64(value); } - public static string FilterSpecialChars(string value) + private string FilterSpecialChars(string value) { - return value.Replace("\0", "\\0") + return value + .Replace("\0", "\\0") .Replace("\t", "\\t") .Replace("\n", "\\n") .Replace("\r", "\\r") diff --git a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/DefaultAttributeValueFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/DefaultAttributeValueFormatter.cs deleted file mode 100644 index d0a2f8ec..00000000 --- a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/DefaultAttributeValueFormatter.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Mono.Documentation.Updater -{ - /// The final value formatter in the pipeline ... if no other formatter formats the value, - /// then this one will serve as the default implementation. - class DefaultAttributeValueFormatter : AttributeValueFormatter - { - public override bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue) - { - returnvalue = "(" + MDocUpdater.GetDocTypeFullName (type.Reference) + ") " + FilterSpecialChars(v.ToString ()); - return true; - } - } -} \ No newline at end of file diff --git a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/StandardFlagsEnumFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/StandardFlagsEnumFormatter.cs deleted file mode 100644 index 16a1ebe0..00000000 --- a/mdoc/Mono.Documentation/Updater/Formatters/AttributeFormatters/StandardFlagsEnumFormatter.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Linq; - -using Mono.Cecil; - -namespace Mono.Documentation.Updater -{ - /// Flags enum formatter that assumes powers of two values. - /// As described here: https://msdn.microsoft.com/en-us/library/vstudio/ms229062(v=vs.100).aspx - class StandardFlagsEnumFormatter : AttributeValueFormatter - { - public override bool TryFormatValue (object v, ResolvedTypeInfo type, out string returnvalue) - { - TypeReference valueType = type.Reference; - TypeDefinition valueDef = type.Definition; - if (valueDef.CustomAttributes.Any (ca => ca.AttributeType.FullName == "System.FlagsAttribute")) - { - - string typename = MDocUpdater.GetDocTypeFullName (valueType); - var values = GetEnumerationValues (valueDef); - long c = ToInt64 (v); - returnvalue = string.Join (" | ", - (from i in values.Keys - where (c & i) == i && i != 0 - select typename + "." + values[i]) - .DefaultIfEmpty (c.ToString ()) - .OrderBy (val => val) // to maintain a consistent list across frameworks/versions - .ToArray ()); - - return true; - } - - returnvalue = null; - return false; - } - } -} \ No newline at end of file diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs index 34749cc5..d0d674db 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs @@ -107,7 +107,7 @@ namespace Mono.Documentation.Updater.Formatters return buf; } - protected override string GetTypeName (TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = true) + protected override string GetTypeName (TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = true, bool isTypeofOperator = false) { GenericInstanceType genType = type as GenericInstanceType; if (IsSpecialGenericNullableValueType (genType)) diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs index 757b6431..1ae7b91a 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs @@ -553,7 +553,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters return AppendConstraints (buf, method.GenericParameters); } - protected override StringBuilder AppendGenericType(StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false) + protected override StringBuilder AppendGenericType(StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false, bool isTypeofOperator = false) { List decls = DocUtils.GetDeclaringTypes( type is GenericInstanceType ? type.GetElementType() : type); diff --git a/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs index 0589c7f9..25b78bf8 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/FSharpFormatter.cs @@ -308,7 +308,7 @@ namespace Mono.Documentation.Updater return "class"; } - protected override StringBuilder AppendGenericType(StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false) + protected override StringBuilder AppendGenericType(StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false, bool isTypeofOperator = false) { List decls = DocUtils.GetDeclaringTypes( type is GenericInstanceType ? type.GetElementType() : type); diff --git a/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs index 1ad73548..ad30e238 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs @@ -203,7 +203,7 @@ namespace Mono.Documentation.Updater.Formatters return buf.ToString (); } - protected override StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false) + protected override StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false, bool isTypeofOperator = false) { List decls = DocUtils.GetDeclaringTypes ( type is GenericInstanceType ? type.GetElementType () : type); diff --git a/mdoc/Mono.Documentation/Updater/Formatters/JsFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/JsFormatter.cs index 8664d1ba..dabceb3e 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/JsFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/JsFormatter.cs @@ -151,7 +151,7 @@ namespace Mono.Documentation.Updater.Formatters return CamelCase(method.Name); } - protected override string GetTypeName(TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false) + protected override string GetTypeName(TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false, bool isTypeofOperator = false) { int n = type.Name.IndexOf("`"); if (n >= 0) diff --git a/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs index faf87874..d5f634e1 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs @@ -1,12 +1,10 @@ -using System; +using Mono.Cecil; +using Mono.Documentation.Util; +using System; using System.Collections.Generic; using System.Linq; using System.Text; - -using Mono.Documentation.Util; -using Mono.Cecil; - namespace Mono.Documentation.Updater { public abstract class MemberFormatter @@ -25,16 +23,16 @@ namespace Mono.Documentation.Updater get { return "//"; } } - public string GetName (MemberReference member, bool appendGeneric = true, bool useTypeProjection = true) + public string GetName (MemberReference member, bool appendGeneric = true, bool useTypeProjection = true, bool isTypeofOperator = false) { - return GetName (member, EmptyAttributeParserContext.Empty(), appendGeneric, useTypeProjection: useTypeProjection); + return GetName (member, EmptyAttributeParserContext.Empty(), appendGeneric, useTypeProjection, isTypeofOperator); } - public virtual string GetName (MemberReference member, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = true) + public virtual string GetName (MemberReference member, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = true, bool isTypeofOperator = false) { TypeReference type = member as TypeReference; if (type != null) - return GetTypeName (type, context, appendGeneric, useTypeProjection: useTypeProjection); + return GetTypeName (type, context, appendGeneric, useTypeProjection, isTypeofOperator); MethodReference method = member as MethodReference; if (method != null && method.Name == ".ctor") // method.IsConstructor return GetConstructorName (method); @@ -58,12 +56,12 @@ namespace Mono.Documentation.Updater return GetTypeName (type, EmptyAttributeParserContext.Empty(), appendGeneric, useTypeProjection: useTypeProjection); } - protected virtual string GetTypeName (TypeReference type, IAttributeParserContext context, bool appendGeneric=true, bool useTypeProjection = true) + protected virtual string GetTypeName (TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = true, bool isTypeofOperator = false) { if (type == null) throw new ArgumentNullException (nameof (type)); - var typeName = _AppendTypeName (new StringBuilder (type.Name.Length), type, context, appendGeneric, useTypeProjection: useTypeProjection).ToString (); + var typeName = _AppendTypeName (new StringBuilder (type.Name.Length), type, context, appendGeneric, useTypeProjection, isTypeofOperator).ToString (); return RemoveMod (typeName); } @@ -138,7 +136,7 @@ namespace Mono.Documentation.Updater get => true; } - protected StringBuilder _AppendTypeName (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection =false) + protected StringBuilder _AppendTypeName (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false, bool isTypeofOperator = false) { if (type == null) return buf; @@ -206,7 +204,7 @@ namespace Mono.Documentation.Updater AppendFullTypeName (interimBuilder, type, context); return SetBuffer(buf, interimBuilder, useTypeProjection: useTypeProjection); } - AppendGenericType (interimBuilder, type, context, appendGeneric, useTypeProjection: useTypeProjection); + AppendGenericType (interimBuilder, type, context, appendGeneric, useTypeProjection, isTypeofOperator); return SetBuffer(buf, interimBuilder, useTypeProjection: useTypeProjection); } @@ -320,7 +318,7 @@ namespace Mono.Documentation.Updater get { return "."; } } - protected virtual StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = true) + protected virtual StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = true, bool isTypeofOperator = false) { int argIdx = 0; int prev = 0; @@ -344,22 +342,54 @@ namespace Mono.Documentation.Updater if (appendGeneric && c > 0) { buf.Append (GenericTypeContainer[0]); - var origState = MemberFormatterState; - MemberFormatterState = MemberFormatterState.WithinGenericTypeParameters; - AppendGenericTypeParameter (buf, genArgs[argIdx++], context, useTypeProjection); - for (int i = 1; i < c; ++i) + + var currentTypeArguments = genArgs.Skip(argIdx).Take(c); + if (IsTypeOfOperatorWithUnboundGenericType(decl, currentTypeArguments, isTypeofOperator)) { - buf.Append (","); + buf.Append(string.Join(string.Empty, Enumerable.Repeat(",", currentTypeArguments.Count() - 1))); + } + else + { + var origState = MemberFormatterState; + MemberFormatterState = MemberFormatterState.WithinGenericTypeParameters; AppendGenericTypeParameter (buf, genArgs[argIdx++], context, useTypeProjection); + for (int i = 1; i < c; ++i) + { + buf.Append (","); + AppendGenericTypeParameter (buf, genArgs[argIdx++], context, useTypeProjection); + } + + MemberFormatterState = origState; } - MemberFormatterState = origState; buf.Append (GenericTypeContainer[1]); } } + return buf; } + private bool IsTypeOfOperatorWithUnboundGenericType(TypeReference type, IEnumerable genericArguments, bool isTypeofOperator) + { + if (isTypeofOperator) + { + var argumentCount = genericArguments.Count() > 0 ? genericArguments.Count().ToString() : string.Empty; + var genericTypeSeparator = $"`{argumentCount}"; + var genericTypeSeparatorIndex = type.FullName.LastIndexOf(genericTypeSeparator); + + var leftAngleBracketIndex = type.FullName.IndexOf("<", genericTypeSeparatorIndex); + var validLeftAngleBracketIndex = genericTypeSeparatorIndex + genericTypeSeparator.Length + 1; + + // If the type is an unbound generic type that type hasn't angle brackets after its full name. + var notExistParameterType = genericTypeSeparatorIndex >= 0 && leftAngleBracketIndex != validLeftAngleBracketIndex; + var notPassParameterType = genericArguments.All(i => i is GenericParameter); + + return notExistParameterType && notPassParameterType; + } + + return false; + } + private void AppendGenericTypeParameter (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool useTypeProjection = true) { var isNullableType = false; diff --git a/mdoc/Mono.Documentation/Updater/Formatters/SlashDocMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/SlashDocMemberFormatter.cs index 4bb986fc..2a5dfa51 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/SlashDocMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/SlashDocMemberFormatter.cs @@ -102,7 +102,7 @@ namespace Mono.Documentation.Updater return buf.Append (ArrayDelimeters[1]); } - protected override StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false) + protected override StringBuilder AppendGenericType (StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false, bool isTypeofOperator = false) { if (!AddTypeCount) base.AppendGenericType (buf, type, context); diff --git a/mdoc/Mono.Documentation/Updater/Formatters/VBFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/VBFullMemberFormatter.cs index 92a74cec..6d9761f8 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/VBFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/VBFullMemberFormatter.cs @@ -209,7 +209,7 @@ namespace Mono.Documentation.Updater } } - protected override StringBuilder AppendGenericType(StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false) + protected override StringBuilder AppendGenericType(StringBuilder buf, TypeReference type, IAttributeParserContext context, bool appendGeneric = true, bool useTypeProjection = false, bool isTypeofOperator = false) { List decls = DocUtils.GetDeclaringTypes( type is GenericInstanceType ? type.GetElementType() : type); diff --git a/mdoc/Mono.Documentation/Updater/ResolvedTypeInfo.cs b/mdoc/Mono.Documentation/Updater/ResolvedTypeInfo.cs deleted file mode 100644 index 0db9b6da..00000000 --- a/mdoc/Mono.Documentation/Updater/ResolvedTypeInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ - -using Mono.Cecil; - -namespace Mono.Documentation.Updater -{ - class ResolvedTypeInfo - { - TypeDefinition typeDef; - - public ResolvedTypeInfo (TypeReference value) - { - Reference = value; - } - - public TypeReference Reference { get; private set; } - - public TypeDefinition Definition - { - get - { - if (typeDef == null) - { - typeDef = Reference.Resolve (); - } - return typeDef; - } - } - } -} \ No newline at end of file diff --git a/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Circle.xml b/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Circle.xml index 0df6e8c0..1cf1d136 100644 --- a/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Circle.xml +++ b/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Circle.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions/Shape/Circle@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions/Shape/Circle@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions+Shape+Circle@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions+Shape+Circle@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Prism.xml b/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Prism.xml index 6b82ea56..d692ac3a 100644 --- a/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Prism.xml +++ b/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Prism.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions/Shape/Prism@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions/Shape/Prism@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions+Shape+Prism@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions+Shape+Prism@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Rectangle.xml b/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Rectangle.xml index af196c39..fe657c9b 100644 --- a/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Rectangle.xml +++ b/mdoc/Test/en.expected-fsharp/DiscriminatedUnions+Shape+Rectangle.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions/Shape/Rectangle@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions/Shape/Rectangle@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions+Shape+Rectangle@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(DiscriminatedUnions+Shape+Rectangle@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstLast.xml b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstLast.xml index b7b7a2de..e31b131c 100644 --- a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstLast.xml +++ b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstLast.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/PersonName/FirstLast@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/PersonName/FirstLast@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+PersonName+FirstLast@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+PersonName+FirstLast@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstOnly.xml b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstOnly.xml index c50cd03a..8bc63289 100644 --- a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstOnly.xml +++ b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+FirstOnly.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/PersonName/FirstOnly@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/PersonName/FirstOnly@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+PersonName+FirstOnly@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+PersonName+FirstOnly@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+LastOnly.xml b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+LastOnly.xml index 9039e514..b9346976 100644 --- a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+LastOnly.xml +++ b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+PersonName+LastOnly.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/PersonName/LastOnly@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/PersonName/LastOnly@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+PersonName+LastOnly@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+PersonName+LastOnly@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Circle.xml b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Circle.xml index 538409b3..cfc60932 100644 --- a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Circle.xml +++ b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Circle.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/Shape/Circle@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/Shape/Circle@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+Shape+Circle@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+Shape+Circle@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Rectangle.xml b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Rectangle.xml index f22cf1ab..418a8add 100644 --- a/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Rectangle.xml +++ b/mdoc/Test/en.expected-fsharp/PatternMatching/PatternMatchingExamples+Shape+Rectangle.xml @@ -16,8 +16,8 @@ [<System.Diagnostics.DebuggerDisplay("{__DebugDisplay(),nq}")>] - [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/Shape/Rectangle@DebugTypeProxy))] - [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples/Shape/Rectangle@DebugTypeProxy))>] + [System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+Shape+Rectangle@DebugTypeProxy))] + [<System.Diagnostics.DebuggerTypeProxy(typeof(PatternMatching.PatternMatchingExamples+Shape+Rectangle@DebugTypeProxy))>] [System.Serializable] diff --git a/mdoc/mdoc.Test/AttributeValueFormatterTest.cs b/mdoc/mdoc.Test/AttributeValueFormatterTest.cs new file mode 100644 index 00000000..78d93872 --- /dev/null +++ b/mdoc/mdoc.Test/AttributeValueFormatterTest.cs @@ -0,0 +1,168 @@ +using mdoc.Test.SampleClasses; +using Mono.Cecil; +using Mono.Documentation.Updater; +using Mono.Documentation.Updater.Formatters; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace mdoc.Test +{ + [TestFixture()] + public class AttributeValueFormatterTest : BasicTests + { + [TestCase("PropertyTypeType", "typeof(Mono.Cecil.TypeReference)")] + [TestCase("PropertyTypeTypeWithNull", "null")] + [TestCase("PropertyTypeTypeWithNestedType", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedClass)")] + [TestCase("PropertyTypeTypeWithUnboundCollection", "typeof(System.Collections.Generic.ICollection<>)")] + [TestCase("PropertyTypeTypeWithCollectionOfInt", "typeof(System.Collections.Generic.ICollection)")] + [TestCase("PropertyTypeTypeWithUnboundDictionary", "typeof(System.Collections.Generic.IDictionary<,>)")] + [TestCase("PropertyTypeTypeWithDictionaryOfInt", "typeof(System.Collections.Generic.IDictionary)")] + [TestCase("PropertyTypeTypeWithUnboundCustomGenericType", "typeof(mdoc.Test.SampleClasses.SomeGenericClass<>)")] + [TestCase("PropertyTypeTypeWithCustomGenericTypeOfInt", "typeof(mdoc.Test.SampleClasses.SomeGenericClass)")] + [TestCase("PropertyTypeTypeWithUnboundNestedGenericType", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType<>)")] + [TestCase("PropertyTypeTypeWithNestedGenericTypeOfInt", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType)")] + [TestCase("PropertyTypeTypeWithUnboundInnerNestedGenericType", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType<>+InnerNestedGenericType<>)")] + [TestCase("PropertyTypeTypeWithInnerNestedGenericTypeOfInt", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType+InnerNestedGenericType)")] + [TestCase("PropertyBoolType", "true")] + [TestCase("PropertySByteType", SByte.MinValue)] + [TestCase("PropertyByteType", Byte.MaxValue)] + [TestCase("PropertyInt16Type", Int16.MinValue)] + [TestCase("PropertyUInt16Type", UInt16.MaxValue)] + [TestCase("PropertyInt32Type", Int32.MinValue)] + [TestCase("PropertyUInt32Type", UInt32.MaxValue)] + [TestCase("PropertyInt64Type", Int64.MinValue)] + [TestCase("PropertyUInt64Type", UInt64.MaxValue)] + [TestCase("PropertySingleType", Single.MinValue)] + [TestCase("PropertyDoubleType", Double.MinValue)] + [TestCase("PropertyCharType", "'C'")] + [TestCase("PropertyStringType", "\"This is a string argument.\"")] + [TestCase("PropertyStringTypeWithEmptyString", "\"\"")] + [TestCase("PropertyStringTypeWithNull", "null")] + [TestCase("PropertyEnumType", "System.ConsoleColor.Red")] + [TestCase("PropertyEnumTypeWithUnknownValue", "(System.ConsoleColor) 2147483647")] + [TestCase("PropertyNestedEnumType", "mdoc.Test.SampleClasses.SomeNestedTypes+NestedEnum.Read")] + [TestCase("PropertyNestedEnumTypeWithUnknownValue", "(mdoc.Test.SampleClasses.SomeNestedTypes+NestedEnum) 2147483647")] + [TestCase("PropertyFlagsEnumType", "System.AttributeTargets.Class | System.AttributeTargets.Enum")] + [TestCase("PropertyFlagsEnumTypeWithAllValue", "System.AttributeTargets.All")] + [TestCase("PropertyFlagsEnumTypeWithUndefineValueZero", "(System.AttributeTargets) 0")] + [TestCase("PropertyDuplicateFlagsEnumTypeWithCombinationValue", "mdoc.Test.SampleClasses.SomeFlagsEnum.Open | mdoc.Test.SampleClasses.SomeFlagsEnum.ReadWrite")] + [TestCase("PropertyNestedFlagsEnumType", "mdoc.Test.SampleClasses.SomeNestedTypes+NestedFlagsEnum.Class | mdoc.Test.SampleClasses.SomeNestedTypes+NestedFlagsEnum.Enum")] + [TestCase("PropertyNestedFlagsEnumTypeWithUndefineValueZero", "(mdoc.Test.SampleClasses.SomeNestedTypes+NestedFlagsEnum) 0")] + [TestCase("PropertyFlagsEnumTypeWithNotApplyAttributeValidTypeAndCombinationValue", "mdoc.Test.SampleClasses.NotApplyAttributeValidFlagsEnum.Class | mdoc.Test.SampleClasses.NotApplyAttributeValidFlagsEnum.Enum")] + [TestCase("PropertyFlagsEnumTypeWithNotApplyAttributeValidTypeAndSingleValue", "mdoc.Test.SampleClasses.NotApplyAttributeValidFlagsEnum.Class")] + [TestCase("PropertyFlagsEnumTypeWithNotApplyAttributeInvalidTypeAndUnknownCombinationValue", "(mdoc.Test.SampleClasses.NotApplyAttributeInvalidFlagsEnum) 5")] + [TestCase("PropertyFlagsEnumTypeWithApplePlatformType", "Platform.Mac_10_8 | Platform.Mac_Arch64")] + [TestCase("PropertyFlagsEnumTypeWithApplePlatformAndNoneValue", "ObjCRuntime.Platform.None")] + [TestCase("PropertyArrayOfIntType", "new System.Int32[] { 0, 0, 7 }")] + [TestCase("PropertyArrayOfIntTypeWithNull", "null")] + [TestCase("PropertyObjectWithNull", "null")] + [TestCase("PropertyObjectWithTypeType", "typeof(Mono.Cecil.TypeReference)")] + [TestCase("PropertyObjectWithNestedTypeType", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedClass)")] + [TestCase("PropertyObjectWithUnboundCollectionType", "typeof(System.Collections.Generic.ICollection<>)")] + [TestCase("PropertyObjectWithCollectionTypeOfInt", "typeof(System.Collections.Generic.ICollection)")] + [TestCase("PropertyObjectWithUnboundDictionaryType", "typeof(System.Collections.Generic.IDictionary<,>)")] + [TestCase("PropertyObjectWithDictionaryTypeOfInt", "typeof(System.Collections.Generic.IDictionary)")] + [TestCase("PropertyObjectWithUnboundCustomGenericType", "typeof(mdoc.Test.SampleClasses.SomeGenericClass<>)")] + [TestCase("PropertyObjectWithCustomGenericTypeOfInt", "typeof(mdoc.Test.SampleClasses.SomeGenericClass)")] + [TestCase("PropertyObjectWithUnboundNestedGenericType", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType<>)")] + [TestCase("PropertyObjectWithNestedGenericTypeOfInt", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType)")] + [TestCase("PropertyObjectWithUnboundInnerNestedGenericType", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType<>+InnerNestedGenericType<>)")] + [TestCase("PropertyObjectWithInnerNestedGenericTypeOfInt", "typeof(mdoc.Test.SampleClasses.SomeNestedTypes+NestedGenericType+InnerNestedGenericType)")] + [TestCase("PropertyObjectWithBoolType", "true")] + [TestCase("PropertyObjectWithSByteType", SByte.MinValue)] + [TestCase("PropertyObjectWithByteType", Byte.MaxValue)] + [TestCase("PropertyObjectWithInt16Type", Int16.MinValue)] + [TestCase("PropertyObjectWithUInt16Type", UInt16.MaxValue)] + [TestCase("PropertyObjectWithInt32Type", Int32.MinValue)] + [TestCase("PropertyObjectWithUInt32Type", UInt32.MaxValue)] + [TestCase("PropertyObjectWithInt64Type", Int64.MinValue)] + [TestCase("PropertyObjectWithUInt64Type", UInt64.MaxValue)] + [TestCase("PropertyObjectWithSingleType", Single.MinValue)] + [TestCase("PropertyObjectWithDoubleType", Double.MinValue)] + [TestCase("PropertyObjectWithCharType", "'C'")] + [TestCase("PropertyObjectWithStringType", "\"This is a string argument.\"")] + [TestCase("PropertyObjectWithStringTypeAndEmptyString", "\"\"")] + [TestCase("PropertyObjectWithEnumType", "System.ConsoleColor.Red")] + [TestCase("PropertyObjectWithEnumTypeAndUnknownValue", "(System.ConsoleColor) 2147483647")] + [TestCase("PropertyObjectWithNestedEnumType", "mdoc.Test.SampleClasses.SomeNestedTypes+NestedEnum.Read")] + [TestCase("PropertyObjectWithNestedEnumTypeAndUnknownValue", "(mdoc.Test.SampleClasses.SomeNestedTypes+NestedEnum) 2147483647")] + [TestCase("PropertyObjectWithFlagsEnumType", "System.AttributeTargets.Class | System.AttributeTargets.Enum")] + [TestCase("PropertyObjectWithFlagsEnumTypeAndAllValue", "System.AttributeTargets.All")] + [TestCase("PropertyObjectWithFlagsEnumTypeAndUndefineValueZero", "(System.AttributeTargets) 0")] + [TestCase("PropertyObjectWithDuplicateFlagsEnumTypeAndCombinationValue", "mdoc.Test.SampleClasses.SomeFlagsEnum.Open | mdoc.Test.SampleClasses.SomeFlagsEnum.ReadWrite")] + [TestCase("PropertyObjectWithNestedFlagsEnumType", "mdoc.Test.SampleClasses.SomeNestedTypes+NestedFlagsEnum.Class | mdoc.Test.SampleClasses.SomeNestedTypes+NestedFlagsEnum.Enum")] + [TestCase("PropertyObjectWithNestedFlagsEnumTypeAndUndefineValueZero", "(mdoc.Test.SampleClasses.SomeNestedTypes+NestedFlagsEnum) 0")] + [TestCase("PropertyObjectWithNotApplyAttributeValidFlagsEnumTypeAndCombinationValue", "mdoc.Test.SampleClasses.NotApplyAttributeValidFlagsEnum.Class | mdoc.Test.SampleClasses.NotApplyAttributeValidFlagsEnum.Enum")] + [TestCase("PropertyObjectWithNotApplyAttributeValidFlagsEnumTypeAndSingleValue", "mdoc.Test.SampleClasses.NotApplyAttributeValidFlagsEnum.Class")] + [TestCase("PropertyObjectWithNotApplyAttributeInvalidFlagsEnumTypeAndUnknownCombinationValue", "(mdoc.Test.SampleClasses.NotApplyAttributeInvalidFlagsEnum) 5")] + [TestCase("PropertyObjectWithApplePlatformFlagsEnumType", "Platform.Mac_10_8 | Platform.Mac_Arch64")] + [TestCase("PropertyObjectWithApplePlatformFlagsEnumTypeAndNoneValue", "ObjCRuntime.Platform.None")] + [TestCase("PropertyObjectWithArrayOfIntType", "new System.Int32[] { 0, 0, 7 }")] + public void TestFormatValueWithDifferentTypes(string methodName, object argumentValue) + { + TestAttributeValueFormatter(typeof(SomeAttribute), methodName, argumentValue); + } + + [TestCase("GetEnumerator", "typeof(mdoc.Test.SampleClasses.SomeIteratorStateMachine<,>+d__0)", typeof(SomeIteratorStateMachine<,>))] + [TestCase("GetEnumerator", "typeof(mdoc.Test.SampleClasses.SomeIteratorStateMachine<,>+SomeNestedIteratorStateMachine<,>+d__0)", typeof(SomeIteratorStateMachine<,>.SomeNestedIteratorStateMachine<,>))] + [TestCase("WithParameterType", "typeof(mdoc.Test.SampleClasses.SomeIteratorStateMachine<,>+d__2<,>)", typeof(SomeIteratorStateMachine<,>))] + [TestCase("WithParameterType", "typeof(mdoc.Test.SampleClasses.SomeIteratorStateMachine<,>+SomeNestedIteratorStateMachine<,>+d__2<,>)", typeof(SomeIteratorStateMachine<,>.SomeNestedIteratorStateMachine<,>))] + public void TestFormartValueWithIteratorStateMachineAttribute(string methodName, object argumentValue, Type type) + { + TestAttributeValueFormatter(type, methodName, argumentValue); + } + + private void TestAttributeValueFormatter(Type type, string memberName, object expectedValue) + { + var (argumentType, argumentValue) = GetAttributeArguments(type, memberName); + + var attributeFormatter = new AttributeValueFormatter(); + var formatValue = attributeFormatter.Format(argumentType, argumentValue); + + Assert.AreEqual(expectedValue.ToString(), formatValue); + } + + private (TypeReference argumentType, object argumentValue) GetAttributeArguments(Type type, string memberName) + { + var methodDefinition = GetMethod(type, memberName); + var methodAttribute = AttributeFormatter.GetCustomAttributes(methodDefinition).First(); + CustomAttribute customAttribute = methodAttribute.Item1; + + var customAttributeList = new List<(TypeReference, object)>(); + for (int i = 0; i < customAttribute.ConstructorArguments.Count; ++i) + { + customAttributeList.Add((customAttribute.ConstructorArguments[i].Type, customAttribute.ConstructorArguments[i].Value)); + } + + foreach (var item in GetAttributeArgumentsFromFieldsAndProperties(customAttribute)) + { + customAttributeList.Add((item.argumentType, item.argumentValue)); + } + + return customAttributeList.First(); + } + + private IEnumerable<(string argumentName, TypeReference argumentType, object argumentValue)> GetAttributeArgumentsFromFieldsAndProperties(CustomAttribute customAttribute) + { + return (from namedArg in customAttribute.Fields + select (namedArg.Name, namedArg.Argument.Type, namedArg.Argument.Value)) + .Concat(from namedArg in customAttribute.Properties + select (namedArg.Name, namedArg.Argument.Type, namedArg.Argument.Value)) + .OrderBy(v => v.Name); + } + + protected override TypeDefinition GetType(Type type) + { + var moduleName = type.Module.FullyQualifiedName; + return GetType(moduleName, ConvertNestedTypeFullName(type.FullName)); + } + + private string ConvertNestedTypeFullName(string fullName) + { + // Simply of implementation for help nested class convert the full name from .NET style to mono.cecil style. + return fullName.Replace("+", "/"); + } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs b/mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs new file mode 100644 index 00000000..490c7978 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs @@ -0,0 +1,48 @@ +using System; + +namespace ObjCRuntime +{ + [Flags] + public enum Platform : ulong + { + None = 0, + iOS_2_0 = 0x0000000000020000, + iOS_2_2 = 0x0000000000020200, + iOS_3_0 = 0x0000000000030000, + iOS_3_1 = 0x0000000000030100, + iOS_3_2 = 0x0000000000030200, + iOS_4_0 = 0x0000000000040000, + iOS_4_1 = 0x0000000000040100, + iOS_4_2 = 0x0000000000040200, + iOS_4_3 = 0x0000000000040300, + iOS_5_0 = 0x0000000000050000, + iOS_5_1 = 0x0000000000050100, + iOS_6_0 = 0x0000000000060000, + iOS_6_1 = 0x0000000000060100, + iOS_7_0 = 0x0000000000070000, + iOS_7_1 = 0x0000000000070100, + iOS_8_0 = 0x0000000000080000, + iOS_8_1 = 0x0000000000080100, + iOS_8_2 = 0x0000000000080200, + iOS_8_3 = 0x0000000000080300, + Mac_10_0 = 0x000A000000000000, + Mac_10_1 = 0x000A010000000000, + Mac_10_2 = 0x000A020000000000, + Mac_10_3 = 0x000A030000000000, + Mac_10_4 = 0x000A040000000000, + Mac_10_5 = 0x000A050000000000, + Mac_10_6 = 0x000A060000000000, + Mac_10_7 = 0x000A070000000000, + Mac_10_8 = 0x000A080000000000, + Mac_10_9 = 0x000A090000000000, + Mac_10_10 = 0x000A0A0000000000, + iOS_Version = 0x0000000000FFFFFF, + Mac_Version = 0x00FFFFFF00000000, + Mac_Arch32 = 0x0100000000000000, + Mac_Arch64 = 0x0200000000000000, + Mac_Arch = 0xFF00000000000000, + iOS_Arch32 = 0x0000000001000000, + iOS_Arch64 = 0x0000000002000000, + iOS_Arch = 0x00000000FF000000 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/AttributeDataTypeAttribute.cs b/mdoc/mdoc.Test/SampleClasses/AttributeDataTypeAttribute.cs new file mode 100644 index 00000000..ce49992e --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/AttributeDataTypeAttribute.cs @@ -0,0 +1,57 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + public class AttributeDataTypeAttribute : Attribute + { + public object ObjectType { get; set; } + + public Type TypeType { get; set; } + + public bool BoolType { get; set; } + + public SByte SByteType { get; set; } + + public Byte ByteType { get; set; } + + public Int16 Int16Type { get; set; } + + public UInt16 UInt16Type { get; set; } + + public Int32 Int32Type { get; set; } + + public Int32? NullableOfInt32Type { get; set; } + + public UInt32 UInt32Type { get; set; } + + public Int64 Int64Type { get; set; } + + public UInt64 UInt64Type { get; set; } + + public Single SingleType { get; set; } + + public Double DoubleType { get; set; } + + public char CharType { get; set; } + + public string StringType { get; set; } + + public int[] ArrayOfIntType { get; set; } + + public ConsoleColor EnumType { get; set; } + + public SomeNestedTypes.NestedEnum NestedEnumType { get; set; } + + public SomeNestedTypes.NestedFlagsEnum NestedFlagsEnumType { get; set; } + + public SomeFlagsEnum DuplicateFlagsEnumType { get; set; } + + public AttributeTargets FlagsEnumType { get; set; } + + public NotApplyAttributeValidFlagsEnum NotApplyAttributeFlagsEnumType { get; set; } + + public NotApplyAttributeInvalidFlagsEnum NotApplyAttributeInvalidFlagsEnumType { get; set; } + + public ObjCRuntime.Platform ApplePlatformFlagsEnumType { get; set; } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeInvalidFlagsEnum.cs b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeInvalidFlagsEnum.cs new file mode 100644 index 00000000..e0ad0455 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeInvalidFlagsEnum.cs @@ -0,0 +1,10 @@ +namespace mdoc.Test.SampleClasses +{ + public enum NotApplyAttributeInvalidFlagsEnum + { + None = 0, + Read = 1, + Write = 2, + ReadWrite = 3 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeValidFlagsEnum.cs b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeValidFlagsEnum.cs new file mode 100644 index 00000000..de4fa77e --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeValidFlagsEnum.cs @@ -0,0 +1,12 @@ +namespace mdoc.Test.SampleClasses +{ + public enum NotApplyAttributeValidFlagsEnum + { + None = 0, + Assembly = 1, + Module = 2, + Class = 4, + Struct = 8, + Enum = 16 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs b/mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs new file mode 100644 index 00000000..2b7850ce --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs @@ -0,0 +1,450 @@ +using Mono.Cecil; +using System; +using System.Collections.Generic; + +namespace mdoc.Test.SampleClasses +{ + public class SomeAttribute + { + [AttributeDataType(TypeType = typeof(TypeReference))] + public void PropertyTypeType() + { + } + + [AttributeDataType(TypeType = null)] + public void PropertyTypeTypeWithNull() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedClass))] + public void PropertyTypeTypeWithNestedType() + { + } + + [AttributeDataType(TypeType = typeof(ICollection<>))] + public void PropertyTypeTypeWithUnboundCollection() + { + } + + [AttributeDataType(TypeType = typeof(ICollection))] + public void PropertyTypeTypeWithCollectionOfInt() + { + } + + [AttributeDataType(TypeType = typeof(IDictionary<,>))] + public void PropertyTypeTypeWithUnboundDictionary() + { + } + + [AttributeDataType(TypeType = typeof(IDictionary))] + public void PropertyTypeTypeWithDictionaryOfInt() + { + } + + [AttributeDataType(TypeType = typeof(SomeGenericClass<>))] + public void PropertyTypeTypeWithUnboundCustomGenericType() + { + } + + [AttributeDataType(TypeType = typeof(SomeGenericClass))] + public void PropertyTypeTypeWithCustomGenericTypeOfInt() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType<>))] + public void PropertyTypeTypeWithUnboundNestedGenericType() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType))] + public void PropertyTypeTypeWithNestedGenericTypeOfInt() + { + } + + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType<>.InnerNestedGenericType<>))] + public void PropertyTypeTypeWithUnboundInnerNestedGenericType() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType.InnerNestedGenericType))] + public void PropertyTypeTypeWithInnerNestedGenericTypeOfInt() + { + } + + [AttributeDataType(BoolType = true)] + public void PropertyBoolType() + { + } + + [AttributeDataType(SByteType = SByte.MinValue)] + public void PropertySByteType() + { + } + + [AttributeDataType(ByteType = Byte.MaxValue)] + public void PropertyByteType() + { + } + + [AttributeDataType(Int16Type = Int16.MinValue)] + public void PropertyInt16Type() + { + } + + [AttributeDataType(UInt16Type = UInt16.MaxValue)] + public void PropertyUInt16Type() + { + } + + [AttributeDataType(Int32Type = Int32.MinValue)] + public void PropertyInt32Type() + { + } + + [AttributeDataType(UInt32Type = UInt32.MaxValue)] + public void PropertyUInt32Type() + { + } + + [AttributeDataType(Int64Type = Int64.MinValue)] + public void PropertyInt64Type() + { + } + + [AttributeDataType(UInt64Type = UInt64.MaxValue)] + public void PropertyUInt64Type() + { + } + + [AttributeDataType(SingleType = Single.MinValue)] + public void PropertySingleType() + { + } + + [AttributeDataType(DoubleType = Double.MinValue)] + public void PropertyDoubleType() + { + } + + [AttributeDataType(CharType = 'C')] + public void PropertyCharType() + { + } + + [AttributeDataType(StringType = "This is a string argument.")] + public void PropertyStringType() + { + } + + [AttributeDataType(StringType = null)] + public void PropertyStringTypeWithNull() + { + } + + [AttributeDataType(StringType = "")] + public void PropertyStringTypeWithEmptyString() + { + } + + [AttributeDataType(ArrayOfIntType = new[] { 0, 0, 7 })] + public void PropertyArrayOfIntType() + { + } + + [AttributeDataType(ArrayOfIntType = null)] + public void PropertyArrayOfIntTypeWithNull() + { + } + + [AttributeDataType(EnumType = ConsoleColor.Red)] + public void PropertyEnumType() + { + } + + [AttributeDataType(EnumType = (ConsoleColor)int.MaxValue)] + public void PropertyEnumTypeWithUnknownValue() + { + } + + [AttributeDataType(NestedEnumType = SomeNestedTypes.NestedEnum.Read)] + public void PropertyNestedEnumType() + { + } + + [AttributeDataType(NestedEnumType = (SomeNestedTypes.NestedEnum)int.MaxValue)] + public void PropertyNestedEnumTypeWithUnknownValue() + { + } + + [AttributeDataType(FlagsEnumType = AttributeTargets.Class | AttributeTargets.Enum)] + public void PropertyFlagsEnumType() + { + } + + [AttributeDataType(FlagsEnumType = AttributeTargets.All)] + public void PropertyFlagsEnumTypeWithAllValue() + { + } + + [AttributeDataType(FlagsEnumType = (AttributeTargets)0)] + public void PropertyFlagsEnumTypeWithUndefineValueZero() + { + } + + [AttributeDataType(DuplicateFlagsEnumType = SomeFlagsEnum.Read | SomeFlagsEnum.Write | SomeFlagsEnum.Open)] + public void PropertyDuplicateFlagsEnumTypeWithCombinationValue() + { + } + + [AttributeDataType(NestedFlagsEnumType = SomeNestedTypes.NestedFlagsEnum.Class | SomeNestedTypes.NestedFlagsEnum.Enum)] + public void PropertyNestedFlagsEnumType() + { + } + + [AttributeDataType(NestedFlagsEnumType = (SomeNestedTypes.NestedFlagsEnum)0)] + public void PropertyNestedFlagsEnumTypeWithUndefineValueZero() + { + } + + [AttributeDataType(NotApplyAttributeFlagsEnumType = NotApplyAttributeValidFlagsEnum.Class | NotApplyAttributeValidFlagsEnum.Enum)] + public void PropertyFlagsEnumTypeWithNotApplyAttributeValidTypeAndCombinationValue() + { + } + + [AttributeDataType(NotApplyAttributeFlagsEnumType = NotApplyAttributeValidFlagsEnum.Class)] + public void PropertyFlagsEnumTypeWithNotApplyAttributeValidTypeAndSingleValue() + { + } + + [AttributeDataType(NotApplyAttributeInvalidFlagsEnumType = (NotApplyAttributeInvalidFlagsEnum)5)] + public void PropertyFlagsEnumTypeWithNotApplyAttributeInvalidTypeAndUnknownCombinationValue() + { + } + + [AttributeDataType(ApplePlatformFlagsEnumType = ObjCRuntime.Platform.Mac_10_8 | ObjCRuntime.Platform.Mac_Arch64)] + public void PropertyFlagsEnumTypeWithApplePlatformType() + { + } + + [AttributeDataType(ApplePlatformFlagsEnumType = ObjCRuntime.Platform.None)] + public void PropertyFlagsEnumTypeWithApplePlatformAndNoneValue() + { + } + + [AttributeDataType(ObjectType = null)] + public void PropertyObjectWithNull() + { + } + + [AttributeDataType(ObjectType = typeof(TypeReference))] + public void PropertyObjectWithTypeType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedClass))] + public void PropertyObjectWithNestedTypeType() + { + } + + [AttributeDataType(ObjectType = typeof(ICollection<>))] + public void PropertyObjectWithUnboundCollectionType() + { + } + + [AttributeDataType(ObjectType = typeof(ICollection))] + public void PropertyObjectWithCollectionTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(IDictionary<,>))] + public void PropertyObjectWithUnboundDictionaryType() + { + } + + [AttributeDataType(ObjectType = typeof(IDictionary))] + public void PropertyObjectWithDictionaryTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(SomeGenericClass<>))] + public void PropertyObjectWithUnboundCustomGenericType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeGenericClass))] + public void PropertyObjectWithCustomGenericTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType<>))] + public void PropertyObjectWithUnboundNestedGenericType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType))] + public void PropertyObjectWithNestedGenericTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType<>.InnerNestedGenericType<>))] + public void PropertyObjectWithUnboundInnerNestedGenericType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType.InnerNestedGenericType))] + public void PropertyObjectWithInnerNestedGenericTypeOfInt() + { + } + + [AttributeDataType(ObjectType = true)] + public void PropertyObjectWithBoolType() + { + } + + [AttributeDataType(ObjectType = SByte.MinValue)] + public void PropertyObjectWithSByteType() + { + } + + [AttributeDataType(ObjectType = Byte.MaxValue)] + public void PropertyObjectWithByteType() + { + } + + [AttributeDataType(ObjectType = Int16.MinValue)] + public void PropertyObjectWithInt16Type() + { + } + + [AttributeDataType(ObjectType = UInt16.MaxValue)] + public void PropertyObjectWithUInt16Type() + { + } + + [AttributeDataType(ObjectType = Int32.MinValue)] + public void PropertyObjectWithInt32Type() + { + } + + [AttributeDataType(ObjectType = UInt32.MaxValue)] + public void PropertyObjectWithUInt32Type() + { + } + + [AttributeDataType(ObjectType = Int64.MinValue)] + public void PropertyObjectWithInt64Type() + { + } + + [AttributeDataType(ObjectType = UInt64.MaxValue)] + public void PropertyObjectWithUInt64Type() + { + } + + [AttributeDataType(ObjectType = Single.MinValue)] + public void PropertyObjectWithSingleType() + { + } + + [AttributeDataType(ObjectType = Double.MinValue)] + public void PropertyObjectWithDoubleType() + { + } + + [AttributeDataType(ObjectType = 'C')] + public void PropertyObjectWithCharType() + { + } + + [AttributeDataType(ObjectType = "This is a string argument.")] + public void PropertyObjectWithStringType() + { + } + + [AttributeDataType(ObjectType = "")] + public void PropertyObjectWithStringTypeAndEmptyString() + { + } + + [AttributeDataType(ObjectType = new[] { 0, 0, 7 })] + public void PropertyObjectWithArrayOfIntType() + { + } + + [AttributeDataType(ObjectType = ConsoleColor.Red)] + public void PropertyObjectWithEnumType() + { + } + + [AttributeDataType(ObjectType = (ConsoleColor)int.MaxValue)] + public void PropertyObjectWithEnumTypeAndUnknownValue() + { + } + + [AttributeDataType(ObjectType = SomeNestedTypes.NestedEnum.Read)] + public void PropertyObjectWithNestedEnumType() + { + } + + [AttributeDataType(ObjectType = (SomeNestedTypes.NestedEnum)int.MaxValue)] + public void PropertyObjectWithNestedEnumTypeAndUnknownValue() + { + } + + [AttributeDataType(ObjectType = AttributeTargets.Class | AttributeTargets.Enum)] + public void PropertyObjectWithFlagsEnumType() + { + } + + [AttributeDataType(ObjectType = AttributeTargets.All)] + public void PropertyObjectWithFlagsEnumTypeAndAllValue() + { + } + + [AttributeDataType(ObjectType = (AttributeTargets)0)] + public void PropertyObjectWithFlagsEnumTypeAndUndefineValueZero() + { + } + + [AttributeDataType(ObjectType = SomeFlagsEnum.Read | SomeFlagsEnum.Write | SomeFlagsEnum.Open)] + public void PropertyObjectWithDuplicateFlagsEnumTypeAndCombinationValue() + { + } + + [AttributeDataType(ObjectType = SomeNestedTypes.NestedFlagsEnum.Class | SomeNestedTypes.NestedFlagsEnum.Enum)] + public void PropertyObjectWithNestedFlagsEnumType() + { + } + + [AttributeDataType(ObjectType = (SomeNestedTypes.NestedFlagsEnum)0)] + public void PropertyObjectWithNestedFlagsEnumTypeAndUndefineValueZero() + { + } + + [AttributeDataType(ObjectType = NotApplyAttributeValidFlagsEnum.Class | NotApplyAttributeValidFlagsEnum.Enum)] + public void PropertyObjectWithNotApplyAttributeValidFlagsEnumTypeAndCombinationValue() + { + } + + [AttributeDataType(ObjectType = NotApplyAttributeValidFlagsEnum.Class)] + public void PropertyObjectWithNotApplyAttributeValidFlagsEnumTypeAndSingleValue() + { + } + + [AttributeDataType(ObjectType = (NotApplyAttributeInvalidFlagsEnum)5)] + public void PropertyObjectWithNotApplyAttributeInvalidFlagsEnumTypeAndUnknownCombinationValue() + { + } + + [AttributeDataType(ObjectType = ObjCRuntime.Platform.Mac_10_8 | ObjCRuntime.Platform.Mac_Arch64)] + public void PropertyObjectWithApplePlatformFlagsEnumType() + { + } + + [AttributeDataType(ObjectType = ObjCRuntime.Platform.None)] + public void PropertyObjectWithApplePlatformFlagsEnumTypeAndNoneValue() + { + } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs b/mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs new file mode 100644 index 00000000..a95365d3 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs @@ -0,0 +1,14 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + [Flags] + public enum SomeFlagsEnum + { + Read = 1, + Write = 2, + ReadWrite = Read | Write, + Open = 4, + Close = 8 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeIteratorStateMachine.cs b/mdoc/mdoc.Test/SampleClasses/SomeIteratorStateMachine.cs new file mode 100644 index 00000000..3dbf6032 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeIteratorStateMachine.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace mdoc.Test.SampleClasses +{ + public class SomeIteratorStateMachine : IEnumerable> + { + public IEnumerator> GetEnumerator() + { + yield return new KeyValuePair(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + public IEnumerator> WithParameterType() + { + yield return new KeyValuePair(); + + } + + public class SomeNestedIteratorStateMachine : IEnumerable> + { + public IEnumerator> GetEnumerator() + { + yield return new KeyValuePair(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + public IEnumerator> WithParameterType() + { + yield return new KeyValuePair(); + + } + } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs b/mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs new file mode 100644 index 00000000..1c8f332e --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs @@ -0,0 +1,34 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + public class SomeNestedTypes + { + public class NestedClass + { + } + + public class NestedGenericType + { + public class InnerNestedGenericType + { + } + } + + public enum NestedEnum + { + Read = 1, + Write = 2, + } + + [Flags] + public enum NestedFlagsEnum + { + Assembly = 1, + Module = 2, + Class = 4, + Struct = 8, + Enum = 16 + } + } +} diff --git a/mdoc/mdoc.Test/mdoc.Test.csproj b/mdoc/mdoc.Test/mdoc.Test.csproj index 5daf4464..11960802 100644 --- a/mdoc/mdoc.Test/mdoc.Test.csproj +++ b/mdoc/mdoc.Test/mdoc.Test.csproj @@ -72,6 +72,7 @@ + @@ -94,11 +95,19 @@ + + + + + + + + diff --git a/mdoc/mdoc.csproj b/mdoc/mdoc.csproj index f9b0d745..9de40804 100644 --- a/mdoc/mdoc.csproj +++ b/mdoc/mdoc.csproj @@ -59,7 +59,6 @@ - @@ -81,12 +80,9 @@ - - - -- cgit v1.2.3 From 11feb86f91652dab03d170a9bd8fd9c1d4ce6849 Mon Sep 17 00:00:00 2001 From: RanhaoXu Date: Wed, 14 Apr 2021 23:24:33 +0800 Subject: Added missing const& for cpp/winrt syntax (#543) https://dev.azure.com/ceapex/Engineering/_workitems/edit/86667 --- .../CppFormatters/CppWinRtFullMemberFormatter.cs | 9 ++++-- mdoc/Test/ClassEnumeratorECMA.xml | 2 +- .../MyFramework.MyNamespace/MyClass.xml | 2 +- .../MyFramework.MyOtherNamespace/MyOtherClass.xml | 4 +-- .../Mono.DocTest.Generic/GenericBase`1.xml | 6 ++-- .../Mono.DocTest.Generic/IFoo`1.xml | 2 +- .../Mono.DocTest.Generic/MyList`1+Helper`2.xml | 2 +- .../Mono.DocTest.Generic/MyList`1.xml | 6 ++-- .../Mono.DocTest.Generic/MyList`2.xml | 10 +++---- .../Mono.DocTest/DocAttribute.xml | 2 +- .../Mono.DocTest/DocValueType.xml | 2 +- .../Mono.DocTest/UseLists.xml | 2 +- .../Mono.DocTest/Widget+NestedClass.xml | 2 +- .../Mono.DocTest/Widget+NestedClass`1.xml | 2 +- .../en.expected-cppwinrt2/Mono.DocTest/Widget.xml | 32 +++++++++++----------- mdoc/Test/en.expected-cppwinrt2/System/Array.xml | 2 +- .../CustomNamespace/ClassEnumerator.xml | 2 +- .../CustomNamespace/ClassEnumerator.xml | 2 +- .../CustomNamespace/ClassEnumerator.xml | 2 +- .../Mono.DocTest.Generic/GenericBase`1.xml | 6 ++-- .../en.expected/Mono.DocTest.Generic/IFoo`1.xml | 2 +- .../Mono.DocTest.Generic/MyList`1+Helper`2.xml | 2 +- .../en.expected/Mono.DocTest.Generic/MyList`1.xml | 6 ++-- .../en.expected/Mono.DocTest.Generic/MyList`2.xml | 10 +++---- .../Test/en.expected/Mono.DocTest/DocAttribute.xml | 2 +- .../Test/en.expected/Mono.DocTest/DocValueType.xml | 2 +- mdoc/Test/en.expected/Mono.DocTest/UseLists.xml | 2 +- .../Mono.DocTest/Widget+NestedClass.xml | 2 +- .../Mono.DocTest/Widget+NestedClass`1.xml | 2 +- mdoc/Test/en.expected/Mono.DocTest/Widget.xml | 32 +++++++++++----------- mdoc/Test/en.expected/System/Array.xml | 2 +- .../ex.expected-cppwinrtuwp/Namespace2/Class3.xml | 2 +- .../ex.expected-cppwinrtuwp/Namespace222/App.xml | 8 +++--- .../UwpTestWinRtComponentCpp/Class1.xml | 6 ++-- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 12 ++++---- 35 files changed, 98 insertions(+), 93 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index a7f7d3ec..e2031b90 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -10,7 +10,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters public class CppWinRtFullMemberFormatter : CppCxFullMemberFormatter { protected override bool AppendHatOnReturn => false; - protected override string HatModifier => $" const{RefTypeModifier}"; + protected override string HatModifier => $" const&"; public override string Language => Consts.CppWinRt; protected override string RefTypeModifier => " &"; @@ -98,7 +98,12 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters buf.AppendFormat("... "); } - buf.Append(GetTypeNameWithOptions(parameter.ParameterType, !AppendHatOnReturn)).Append(" "); + buf.Append(GetTypeName(parameter.ParameterType, EmptyAttributeParserContext.Empty())); + if (!parameter.ParameterType.IsByReference && !parameter.ParameterType.IsPointer) + { + buf.Append(parameter.IsOut ? RefTypeModifier : HatModifier); + } + buf.Append(" "); buf.Append(parameter.Name); if (parameter.HasDefault && parameter.IsOptional && parameter.HasConstant) diff --git a/mdoc/Test/ClassEnumeratorECMA.xml b/mdoc/Test/ClassEnumeratorECMA.xml index 7c7314bc..e79e8348 100644 --- a/mdoc/Test/ClassEnumeratorECMA.xml +++ b/mdoc/Test/ClassEnumeratorECMA.xml @@ -97,7 +97,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClass.xml b/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClass.xml index ad0dcc31..b7543278 100644 --- a/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClass.xml +++ b/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClass.xml @@ -33,7 +33,7 @@ - + Method DocTest-DropNS-classic diff --git a/mdoc/Test/en.expected-cppwinrt/MyFramework.MyOtherNamespace/MyOtherClass.xml b/mdoc/Test/en.expected-cppwinrt/MyFramework.MyOtherNamespace/MyOtherClass.xml index 46dd62df..2c1ad6b4 100644 --- a/mdoc/Test/en.expected-cppwinrt/MyFramework.MyOtherNamespace/MyOtherClass.xml +++ b/mdoc/Test/en.expected-cppwinrt/MyFramework.MyOtherNamespace/MyOtherClass.xml @@ -33,7 +33,7 @@ - + Method DocTest-DropNS-classic-secondary @@ -55,7 +55,7 @@ - + Method DocTest-DropNS-classic-secondary diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml index 0f52ab69..53452ce4 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml @@ -36,7 +36,7 @@ - + Method 0.0.0.0 @@ -85,7 +85,7 @@ - + Event 0.0.0.0 @@ -117,7 +117,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/IFoo`1.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/IFoo`1.xml index a054fb27..aee418ba 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/IFoo`1.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/IFoo`1.xml @@ -19,7 +19,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1+Helper`2.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1+Helper`2.xml index bc6635e3..eda0a7c2 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1+Helper`2.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1+Helper`2.xml @@ -39,7 +39,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1.xml index f16eff4d..ce9e94a3 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`1.xml @@ -96,7 +96,7 @@ - + Method 0.0.0.0 @@ -168,7 +168,7 @@ - + Method 0.0.0.0 @@ -188,7 +188,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml index 3883ed4b..d2a70af6 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml @@ -76,7 +76,7 @@ - + Method M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32) @@ -195,7 +195,7 @@ - + Method M:Mono.DocTest.Generic.IFoo`1.Method``1(`0,``0) @@ -266,7 +266,7 @@ - + Method M:System.Collections.Generic.ICollection`1.Add(`0) @@ -309,7 +309,7 @@ - + Method M:System.Collections.Generic.ICollection`1.Contains(`0) @@ -353,7 +353,7 @@ - + Method M:System.Collections.Generic.ICollection`1.Remove(`0) diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocAttribute.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocAttribute.xml index b5db4de6..328c1fd8 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocAttribute.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocAttribute.xml @@ -23,7 +23,7 @@ - + Constructor 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocValueType.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocValueType.xml index 61df663c..fae74b1e 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocValueType.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/DocValueType.xml @@ -22,7 +22,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/UseLists.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/UseLists.xml index b19b1ea8..9c0df75d 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/UseLists.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/UseLists.xml @@ -142,7 +142,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass.xml index 80136bf9..5290bea1 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass.xml @@ -31,7 +31,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass`1.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass`1.xml index 51c7907a..73fe2061 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass`1.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget+NestedClass`1.xml @@ -35,7 +35,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml index 97ff0eb8..53153d5f 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml @@ -52,7 +52,7 @@ - + Constructor 0.0.0.0 @@ -131,7 +131,7 @@ - + Field 0.0.0.0 @@ -147,7 +147,7 @@ - + Field 0.0.0.0 @@ -163,7 +163,7 @@ - + Method 0.0.0.0 @@ -185,7 +185,7 @@ - + Method 0.0.0.0 @@ -223,7 +223,7 @@ - + Method 0.0.0.0 @@ -359,7 +359,7 @@ - + Property 0.0.0.0 @@ -470,7 +470,7 @@ - + Method 0.0.0.0 @@ -527,7 +527,7 @@ - + Method 0.0.0.0 @@ -551,7 +551,7 @@ - + Method 0.0.0.0 @@ -595,7 +595,7 @@ - + Method 0.0.0.0 @@ -645,7 +645,7 @@ - + Method 0.0.0.0 @@ -697,7 +697,7 @@ - + Method 0.0.0.0 @@ -736,7 +736,7 @@ - + Method 0.0.0.0 @@ -757,7 +757,7 @@ - + Method 0.0.0.0 @@ -778,7 +778,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/System/Array.xml b/mdoc/Test/en.expected-cppwinrt2/System/Array.xml index 865b3cf4..a5140e63 100644 --- a/mdoc/Test/en.expected-cppwinrt2/System/Array.xml +++ b/mdoc/Test/en.expected-cppwinrt2/System/Array.xml @@ -83,7 +83,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml b/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml index 3e0fdbfc..cd0f756c 100644 --- a/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml +++ b/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml @@ -92,7 +92,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml b/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml index 405861e1..4152d669 100644 --- a/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml +++ b/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml @@ -96,7 +96,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml b/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml index ea03f5c3..9dc4ffff 100644 --- a/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml +++ b/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml @@ -92,7 +92,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml index 083daab5..00b21131 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml @@ -49,7 +49,7 @@ - + Method 0.0.0.0 @@ -107,7 +107,7 @@ - + Event 0.0.0.0 @@ -147,7 +147,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/IFoo`1.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/IFoo`1.xml index fec45e1c..8ba61d91 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/IFoo`1.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/IFoo`1.xml @@ -29,7 +29,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1+Helper`2.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1+Helper`2.xml index b0afe1a6..5e95262c 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1+Helper`2.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1+Helper`2.xml @@ -52,7 +52,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml index ef270948..a6e5e8db 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml @@ -118,7 +118,7 @@ - + Method 0.0.0.0 @@ -204,7 +204,7 @@ - + Method 0.0.0.0 @@ -228,7 +228,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml index c4a8f44f..fa924297 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml @@ -89,7 +89,7 @@ - + Method M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32) @@ -236,7 +236,7 @@ - + Method M:Mono.DocTest.Generic.IFoo`1.Method``1(`0,``0) @@ -322,7 +322,7 @@ - + Method M:System.Collections.Generic.ICollection`1.Add(`0) @@ -375,7 +375,7 @@ - + Method M:System.Collections.Generic.ICollection`1.Contains(`0) @@ -429,7 +429,7 @@ - + Method M:System.Collections.Generic.ICollection`1.Remove(`0) diff --git a/mdoc/Test/en.expected/Mono.DocTest/DocAttribute.xml b/mdoc/Test/en.expected/Mono.DocTest/DocAttribute.xml index e86f9763..1ea7131d 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/DocAttribute.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/DocAttribute.xml @@ -35,7 +35,7 @@ - + Constructor 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest/DocValueType.xml b/mdoc/Test/en.expected/Mono.DocTest/DocValueType.xml index 7bbb671b..212c8444 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/DocValueType.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/DocValueType.xml @@ -34,7 +34,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest/UseLists.xml b/mdoc/Test/en.expected/Mono.DocTest/UseLists.xml index bdad0604..d2646adc 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/UseLists.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/UseLists.xml @@ -179,7 +179,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass.xml b/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass.xml index 5fc561bf..a3c8e1ce 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass.xml @@ -43,7 +43,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass`1.xml b/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass`1.xml index f14b1639..580dccd7 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass`1.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/Widget+NestedClass`1.xml @@ -47,7 +47,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml index 3d88d65c..3acb20b6 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml @@ -72,7 +72,7 @@ - + Constructor 0.0.0.0 @@ -173,7 +173,7 @@ - + Field 0.0.0.0 @@ -193,7 +193,7 @@ - + Field 0.0.0.0 @@ -213,7 +213,7 @@ - + Method 0.0.0.0 @@ -239,7 +239,7 @@ - + Method 0.0.0.0 @@ -288,7 +288,7 @@ - + Method 0.0.0.0 @@ -459,7 +459,7 @@ - + Property 0.0.0.0 @@ -596,7 +596,7 @@ - + Method 0.0.0.0 @@ -663,7 +663,7 @@ - + Method 0.0.0.0 @@ -692,7 +692,7 @@ - + Method 0.0.0.0 @@ -744,7 +744,7 @@ - + Method 0.0.0.0 @@ -805,7 +805,7 @@ - + Method 0.0.0.0 @@ -870,7 +870,7 @@ - + Method 0.0.0.0 @@ -917,7 +917,7 @@ - + Method 0.0.0.0 @@ -942,7 +942,7 @@ - + Method 0.0.0.0 @@ -967,7 +967,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/System/Array.xml b/mdoc/Test/en.expected/System/Array.xml index e88435ab..6a0a209a 100644 --- a/mdoc/Test/en.expected/System/Array.xml +++ b/mdoc/Test/en.expected/System/Array.xml @@ -106,7 +106,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml b/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml index f94f0111..08118006 100644 --- a/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml +++ b/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml @@ -36,7 +36,7 @@ - + Property 255.255.255.255 diff --git a/mdoc/Test/ex.expected-cppwinrtuwp/Namespace222/App.xml b/mdoc/Test/ex.expected-cppwinrtuwp/Namespace222/App.xml index 6a45fd01..00fcc78e 100644 --- a/mdoc/Test/ex.expected-cppwinrtuwp/Namespace222/App.xml +++ b/mdoc/Test/ex.expected-cppwinrtuwp/Namespace222/App.xml @@ -60,7 +60,7 @@ - + Method M:Windows.ApplicationModel.Core.IFrameworkView.Initialize(Windows.ApplicationModel.Core.CoreApplicationView) @@ -83,7 +83,7 @@ - + Method M:Windows.ApplicationModel.Core.IFrameworkView.Load(System.String) @@ -160,7 +160,7 @@ - + Method M:Windows.ApplicationModel.Core.IFrameworkView.SetWindow(Windows.UI.Core.CoreWindow) @@ -183,7 +183,7 @@ - + Method 255.255.255.255 diff --git a/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml b/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml index 1b6b3723..387025c8 100644 --- a/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml +++ b/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml @@ -56,7 +56,7 @@ - + Method 255.255.255.255 @@ -77,7 +77,7 @@ - + Method 255.255.255.255 @@ -100,7 +100,7 @@ - + Method 255.255.255.255 diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index 000f7565..d40e4d29 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -19,7 +19,7 @@ namespace mdoc.Test public void Method_ComputeResult() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "ComputeResult", - @"winrt::Windows::Foundation::Collections::IVector ComputeResult(double input);"); + @"winrt::Windows::Foundation::Collections::IVector ComputeResult(double const& input);"); } [Test] @@ -27,7 +27,7 @@ namespace mdoc.Test public void Method_GetPrimesOrdered() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesOrdered", - @"winrt::Windows::Foundation::IAsyncOperationWithProgress, double> GetPrimesOrdered(int first, int last);"); + @"winrt::Windows::Foundation::IAsyncOperationWithProgress, double> GetPrimesOrdered(int const& first, int const& last);"); } @@ -36,7 +36,7 @@ namespace mdoc.Test public void Method_GetPrimesUnordered() { TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "GetPrimesUnordered", - @"winrt::Windows::Foundation::IAsyncActionWithProgress GetPrimesUnordered(int first, int last);"); + @"winrt::Windows::Foundation::IAsyncActionWithProgress GetPrimesUnordered(int const& first, int const& last);"); } [Test] @@ -44,7 +44,7 @@ namespace mdoc.Test public void Method_DefaultParameters() { TestMethodSignature(CSharpTestLib, "Mono.DocTest.Widget", "Default", - @"void Default(int a = 1, int b = 2);"); + @"void Default(int const& a = 1, int const& b = 2);"); } [Test] @@ -52,7 +52,7 @@ namespace mdoc.Test public void Method_RefType() { TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow1", - @"void SetWindow1(winrt::Windows::UI::Core::CoreWindow const & window);"); + @"void SetWindow1(winrt::Windows::UI::Core::CoreWindow const& window);"); } [Test] @@ -60,7 +60,7 @@ namespace mdoc.Test public void Method_WinRtTypeInterfaceImplementation() { TestMethodSignature(CppCxTestLibName, "Namespace222.App", "SetWindow", - @"void SetWindow(winrt::Windows::UI::Core::CoreWindow const & window);"); + @"void SetWindow(winrt::Windows::UI::Core::CoreWindow const& window);"); } [Test] -- cgit v1.2.3 From b65966eace83a9ffa5ba5bb5dc2a12754084bd29 Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Thu, 15 Apr 2021 21:31:41 +0800 Subject: Enabling Guid type projection for C++/WinRT and C++/CX. (#546) https://dev.azure.com/ceapex/Engineering/_workitems/edit/344653 --- mdoc/Makefile | 11 ++- .../CppFormatters/CppCxFullMemberFormatter.cs | 6 +- .../CppFormatters/CppFullMemberFormatter.cs | 5 +- .../CppFormatters/CppWinRtFullMemberFormatter.cs | 3 +- .../Mono.DocTest.Generic/MyList`1.xml | 2 +- .../en.expected-cppcx2/Mono.DocTest/Widget.xml | 1 + mdoc/Test/en.expected-cppcx2/System/Array.xml | 2 +- mdoc/Test/en.expected-guid/index.xml | 22 +++++ .../mdoc.Test.SampleClasses/GuidClass.xml | 102 +++++++++++++++++++++ .../ns-mdoc.Test.SampleClasses.xml | 6 ++ .../en.expected/Mono.DocTest.Generic/MyList`1.xml | 2 +- mdoc/Test/en.expected/Mono.DocTest/Widget.xml | 1 + mdoc/Test/en.expected/System/Array.xml | 2 +- mdoc/mdoc.Test/CppCxFormatterMembersTests.cs | 29 +++++- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 19 +++- mdoc/mdoc.Test/FormatterTests.cs | 17 ++++ mdoc/mdoc.Test/SampleClasses/GuidClass.cs | 17 ++++ mdoc/mdoc.Test/UwpTestWinRtComponentCpp/Class1.cpp | 2 +- mdoc/mdoc.Test/mdoc.Test.csproj | 1 + 19 files changed, 238 insertions(+), 12 deletions(-) create mode 100644 mdoc/Test/en.expected-guid/index.xml create mode 100644 mdoc/Test/en.expected-guid/mdoc.Test.SampleClasses/GuidClass.xml create mode 100644 mdoc/Test/en.expected-guid/ns-mdoc.Test.SampleClasses.xml create mode 100644 mdoc/mdoc.Test/SampleClasses/GuidClass.cs (limited to 'mdoc') diff --git a/mdoc/Makefile b/mdoc/Makefile index 4393b0d7..69403d6a 100644 --- a/mdoc/Makefile +++ b/mdoc/Makefile @@ -726,6 +726,9 @@ check-monodocer-attached-entities: Test/TestClass.dll: $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ mdoc.Test/SampleClasses/Test*.cs +Test/GuidClass.dll: + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ mdoc.Test/SampleClasses/GuidClass.cs + .PHONY: check-monodocer-operators-work check-monodocer-operators-work: Test/TestClass.dll rm -Rf Test/en.actual @@ -742,6 +745,11 @@ check-monodocer-operators-update: check-monodocer-operators-work rm -Rf Test/en.expected-operators mv Test/en.actual Test/en.expected-operators +check-monodocer-guid: Test/GuidClass.dll + rm -Rf Test/en.actual + $(MONO) $(PROGRAM) update -o Test/en.actual Test/GuidClass.dll -lang c++/cx -lang c++/winrt + $(DIFF) Test/en.expected-guid Test/en.actual + check-mdoc-export-html-update: find Test/html.expected -name \*.html -exec rm "{}" \; $(MONO) $(PROGRAM) export-html -o Test/html.expected \ @@ -856,6 +864,7 @@ check-doc-tools: \ check-monodocer-frameworks-inheritance \ check-monodocer-docid \ check-monodocer-operators \ + check-monodocer-guid \ check-monodocer-fx-statistics-remove \ check-overwrite-attribute \ check-monodocer-vbnet \ @@ -887,5 +896,5 @@ check-doc-tools-update: check-monodocer-since-update \ check-mdoc-export-msxdoc-update \ check-mdoc-validate-update -check: nunit check-doc-tools +check: nunit check-doc-tools @echo "mdoc Tests Complete!" diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs index efba11be..0c158189 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs @@ -62,6 +62,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters "System.String", "System.ValueType", "System.Enum", + "System.Guid", }; protected virtual IList GetAllowedTypes() @@ -106,7 +107,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters if (t.Contains(' ')) { splitType = t.Split(' '); - typeToCompare = splitType[0]; + typeToCompare = splitType[0].Trim('&'); } switch (typeToCompare) @@ -125,6 +126,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters case "System.Boolean": typeToCompare = "bool"; break; case "System.Char": typeToCompare = "char16"; break; case "System.Void": typeToCompare = "void"; break; + case "System.Guid": typeToCompare = "Platform::Guid"; break; case "System.String": typeToCompare = "Platform::String"; break; case "System.Object": typeToCompare = "Platform::Object"; break; case "System.Type": typeToCompare = "Platform::Type"; break; @@ -330,7 +332,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters } } - if (allowedTypes.Contains(tref.FullName.Split(' ')[0]) || CppCxSpecificNamespases.Contains(tref.Namespace)) + if (allowedTypes.Contains(tref.FullName.Split(' ')[0].Trim('&')) || CppCxSpecificNamespases.Contains(tref.Namespace)) { return true; } diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs index 1ae7b91a..171ca144 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs @@ -733,7 +733,10 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters if (IsParamsParameter(parameter)) buf.AppendFormat ("... "); - buf.Append(GetTypeNameWithOptions(parameter.ParameterType, AppendHatOnReturn)).Append(" "); + buf.Append(GetTypeNameWithOptions(parameter.ParameterType, AppendHatOnReturn)); + if (!buf.ToString().EndsWith(" ")) + buf.Append(" "); + buf.Append(parameter.Name); return buf; diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index e2031b90..f4a2a199 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -41,7 +41,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters if (t.Contains(' ')) { splitType = t.Split(' '); - typeToCompare = splitType[0]; + typeToCompare = splitType[0].Trim('&'); foreach (var str in splitType) { @@ -71,6 +71,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters case "System.Void": typeToCompare = "void"; break; //API specific type is "winrt::hstring"; but c++ in built type is better variant case "System.String": typeToCompare = "winrt::hstring"; break; + case "System.Guid": typeToCompare = "winrt::guid"; break; case "System.Object": typeToCompare = "winrt::Windows::Foundation::IInspectable"; break; } diff --git a/mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/MyList`1.xml b/mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/MyList`1.xml index 3a95c108..d7282c63 100644 --- a/mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/MyList`1.xml +++ b/mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/MyList`1.xml @@ -120,7 +120,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppcx2/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected-cppcx2/Mono.DocTest/Widget.xml index ab7b139b..ddad4349 100644 --- a/mdoc/Test/en.expected-cppcx2/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected-cppcx2/Mono.DocTest/Widget.xml @@ -452,6 +452,7 @@ + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppcx2/System/Array.xml b/mdoc/Test/en.expected-cppcx2/System/Array.xml index 964b5fc6..550201f1 100644 --- a/mdoc/Test/en.expected-cppcx2/System/Array.xml +++ b/mdoc/Test/en.expected-cppcx2/System/Array.xml @@ -83,7 +83,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-guid/index.xml b/mdoc/Test/en.expected-guid/index.xml new file mode 100644 index 00000000..9e662045 --- /dev/null +++ b/mdoc/Test/en.expected-guid/index.xml @@ -0,0 +1,22 @@ + + + + + + System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints) + + + System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true) + + + + + To be added. + To be added. + + + + + + GuidClass + diff --git a/mdoc/Test/en.expected-guid/mdoc.Test.SampleClasses/GuidClass.xml b/mdoc/Test/en.expected-guid/mdoc.Test.SampleClasses/GuidClass.xml new file mode 100644 index 00000000..a6451db2 --- /dev/null +++ b/mdoc/Test/en.expected-guid/mdoc.Test.SampleClasses/GuidClass.xml @@ -0,0 +1,102 @@ + + + + + + GuidClass + 0.0.0.0 + + + System.Object + + + + To be added. + To be added. + + + + + + + + Constructor + + 0.0.0.0 + + + + + + To be added. + To be added. + To be added. + + + + + + + + Method + + 0.0.0.0 + + + System.Guid + + + + To be added. + To be added. + To be added. + + + + + + + + Method + + 0.0.0.0 + + + System.Boolean + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + + + Method + + 0.0.0.0 + + + System.Boolean + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected-guid/ns-mdoc.Test.SampleClasses.xml b/mdoc/Test/en.expected-guid/ns-mdoc.Test.SampleClasses.xml new file mode 100644 index 00000000..80a5e984 --- /dev/null +++ b/mdoc/Test/en.expected-guid/ns-mdoc.Test.SampleClasses.xml @@ -0,0 +1,6 @@ + + + To be added. + To be added. + + diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml index a6e5e8db..877bd5fc 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`1.xml @@ -148,7 +148,7 @@ - + Method diff --git a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml index 3acb20b6..75d5a02a 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml @@ -596,6 +596,7 @@ + Method diff --git a/mdoc/Test/en.expected/System/Array.xml b/mdoc/Test/en.expected/System/Array.xml index 6a0a209a..6980a7d2 100644 --- a/mdoc/Test/en.expected/System/Array.xml +++ b/mdoc/Test/en.expected/System/Array.xml @@ -105,7 +105,7 @@ - + Method diff --git a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs index 14500934..10b0378f 100644 --- a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs +++ b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs @@ -1,4 +1,5 @@ -using Mono.Documentation.Updater.Formatters.CppFormatters; +using mdoc.Test.SampleClasses; +using Mono.Documentation.Updater.Formatters.CppFormatters; using Mono_DocTest; using NUnit.Framework; using Cpp = Mono_DocTest_Generic; @@ -42,6 +43,32 @@ namespace mdoc.Test Windows::Foundation::IAsyncActionWithProgress ^ GetPrimesUnordered(int first, int last);"); } + //[Test] + //[Category("Method")] + //public void Method_CreateNewGuid() + //{ + // TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "CreateNewGuid", + // @"public: Platform::Guid ^ CreateNewGuid();"); + //} + + [Test] + public void CreateNewGuid() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual(@"public: + static Platform::Guid CreateNewGuid();", sig); + } + + [Test] + public void ObjectIndentical() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual(@"public: + bool ObjectIndentical(Platform::Guid objGuid1, Platform::Guid objGuid2);", sig); + } + [Test] [Category("Method")] public void Method_WinRtTypeInterfaceImplementation() diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index d40e4d29..3a33e69a 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -1,4 +1,5 @@ -using Mono.Documentation.Updater.Formatters.CppFormatters; +using mdoc.Test.SampleClasses; +using Mono.Documentation.Updater.Formatters.CppFormatters; using Mono_DocTest; using NUnit.Framework; using Cpp = Mono_DocTest_Generic; @@ -39,6 +40,22 @@ namespace mdoc.Test @"winrt::Windows::Foundation::IAsyncActionWithProgress GetPrimesUnordered(int const& first, int const& last);"); } + [Test] + public void CreateNewGuid() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual(@" static winrt::guid CreateNewGuid();", sig); + } + + [Test] + public void ObjectIndentical() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual(@"bool ObjectIndentical(winrt::guid const& objGuid1, winrt::guid const& objGuid2);", sig); + } + [Test] [Category("Method")] public void Method_DefaultParameters() diff --git a/mdoc/mdoc.Test/FormatterTests.cs b/mdoc/mdoc.Test/FormatterTests.cs index 439d9767..f7b60e4e 100644 --- a/mdoc/mdoc.Test/FormatterTests.cs +++ b/mdoc/mdoc.Test/FormatterTests.cs @@ -226,6 +226,23 @@ namespace mdoc.Test var sig = formatter.GetDeclaration (member); Assert.AreEqual (".method public hidebysig instance void RefAndOut(int32& a, [out] int32& b) cil managed", sig); } + + [Test] + public void CreateNewGuid() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual("public static Guid CreateNewGuid ();", sig); + } + + [Test] + public void ObjectIndentical() + { + var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical"); + var sig = formatter.GetDeclaration(member); + Assert.AreEqual("public bool ObjectIndentical (Guid objGuid1, Guid objGuid2);", sig); + } + [Test] public void MethodSignature_Finalize() => TestMethodSignature(typeof(SomeGenericClass<>), diff --git a/mdoc/mdoc.Test/SampleClasses/GuidClass.cs b/mdoc/mdoc.Test/SampleClasses/GuidClass.cs new file mode 100644 index 00000000..9e355b19 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/GuidClass.cs @@ -0,0 +1,17 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + public class GuidClass + { + private readonly Guid _guid = Guid.Empty; + + private GuidClass() { this._guid = Guid.NewGuid(); } + + public GuidClass (Guid guid) { this._guid = guid; } + + public static Guid CreateNewGuid() { return new Guid(); } + public bool ObjectIndentical(Guid objGuid1, Guid objGuid2) { return objGuid1 == objGuid2; } + public bool IsUnique(Guid guid) { return guid == _guid; } + } +} diff --git a/mdoc/mdoc.Test/UwpTestWinRtComponentCpp/Class1.cpp b/mdoc/mdoc.Test/UwpTestWinRtComponentCpp/Class1.cpp index 44d5f4cf..bf2bd782 100644 --- a/mdoc/mdoc.Test/UwpTestWinRtComponentCpp/Class1.cpp +++ b/mdoc/mdoc.Test/UwpTestWinRtComponentCpp/Class1.cpp @@ -163,4 +163,4 @@ IAsyncActionWithProgress^ Class1::GetPrimesUnordered(int first, int last }); reporter.report(100.0); }); -} +} \ No newline at end of file diff --git a/mdoc/mdoc.Test/mdoc.Test.csproj b/mdoc/mdoc.Test/mdoc.Test.csproj index 11960802..6f33aeb6 100644 --- a/mdoc/mdoc.Test/mdoc.Test.csproj +++ b/mdoc/mdoc.Test/mdoc.Test.csproj @@ -97,6 +97,7 @@ + -- cgit v1.2.3 From aff9707cc3ae5724462591ab6517e6f8ed7e9aa1 Mon Sep 17 00:00:00 2001 From: RanhaoXu Date: Tue, 20 Apr 2021 05:01:26 +0800 Subject: Improved filehandling around typemap file copy Update MDocUpdater.cs (#547) --- mdoc/Mono.Documentation/MDocUpdater.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs index d75db09e..eac9ddd7 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.cs @@ -320,6 +320,8 @@ namespace Mono.Documentation if (File.Exists(typeMapPath)) { Console.WriteLine($"Loading typemap file at {typeMapPath}"); + if (!Directory.Exists(srcPath)) + Directory.CreateDirectory(srcPath); File.Copy(typeMapPath, Path.Combine(srcPath, "TypeMap.xml"), true); TypeMap map = TypeMap.FromXml(typeMapPath); this.TypeMap = map; -- cgit v1.2.3 From 83d0e18272676be6880ea81db6ffe7a59694aab7 Mon Sep 17 00:00:00 2001 From: RanhaoXu Date: Tue, 27 Apr 2021 05:36:54 +0800 Subject: Added type forwarding check for member parameters (#548) https://dev.azure.com/ceapex/Engineering/_workitems/edit/373824 --- mdoc/Makefile | 23 +++++++++ mdoc/Mono.Documentation/MDocUpdater.cs | 15 +++++- .../Updater/Frameworks/AssemblySet.cs | 5 ++ mdoc/Test/DocTest-differentTypeDefinitions.cs | 14 ++++++ .../FrameworksIndex/One.xml | 13 +++++ .../TheNamespace/TheClass.xml | 56 ++++++++++++++++++++++ .../en.expected.differentTypeDefinitions/index.xml | 32 +++++++++++++ .../ns-TheNamespace.xml | 6 +++ 8 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 mdoc/Test/DocTest-differentTypeDefinitions.cs create mode 100644 mdoc/Test/en.expected.differentTypeDefinitions/FrameworksIndex/One.xml create mode 100644 mdoc/Test/en.expected.differentTypeDefinitions/TheNamespace/TheClass.xml create mode 100644 mdoc/Test/en.expected.differentTypeDefinitions/index.xml create mode 100644 mdoc/Test/en.expected.differentTypeDefinitions/ns-TheNamespace.xml (limited to 'mdoc') diff --git a/mdoc/Makefile b/mdoc/Makefile index 69403d6a..3966cb34 100644 --- a/mdoc/Makefile +++ b/mdoc/Makefile @@ -139,6 +139,14 @@ Test/DocTest-enumerations.dll: Test/DocTest-embedded-type.dll: $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-embedded-type.cs +Test/DocTest-differentTypeDefinitions-First.dll: + rm -f $@ + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-differentTypeDefinitions.cs /define:FIRST + +Test/DocTest-differentTypeDefinitions-Second.dll: + rm -f $@ + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-differentTypeDefinitions.cs /define:SECOND + Test/DocTest-typeForwards-First.dll: rm -f $@ $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-typeForwards.cs /define:FIRST @@ -199,6 +207,20 @@ Test/FrameworkTestData-fx-inheritance: Test/DocTest-framework-inheritance-one.dl cp Test/DocTest-framework-inheritance-three.dll Test/FrameworkTestData-fx-inheritance/Three/ $(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-inheritance +.PHONY: check-monodocer-differentTypeDefinitions +check-monodocer-differentTypeDefinitions : Test/DocTest-differentTypeDefinitions-First.dll Test/DocTest-differentTypeDefinitions-Second.dll + -rm -Rf Test/en.actual + + -rm -Rf Test/FrameworkTestData-fx-differentTypeDefinitions + mkdir Test/FrameworkTestData-fx-differentTypeDefinitions + mkdir Test/FrameworkTestData-fx-differentTypeDefinitions/One + cp Test/DocTest-differentTypeDefinitions-First.dll Test/FrameworkTestData-fx-differentTypeDefinitions/One + cp Test/DocTest-differentTypeDefinitions-Second.dll Test/FrameworkTestData-fx-differentTypeDefinitions/One + $(MONO) $(PROGRAM) fx-bootstrap Test/FrameworkTestData-fx-differentTypeDefinitions + + $(MONO) $(PROGRAM) update -o Test/en.actual -frameworks Test/FrameworkTestData-fx-differentTypeDefinitions + $(DIFF) Test/en.expected.differentTypeDefinitions Test/en.actual + .PHONY: check-monodocer-typeForwards check-monodocer-typeForwards : Test/DocTest-typeForwards-First.dll Test/DocTest-typeForwards-Second.dll Test/DocTest-typeForwards-Third.dll -rm -Rf Test/en.actual @@ -835,6 +857,7 @@ run-test-local: check-doc-tools run-test-update : check-doc-tools-update check-doc-tools: \ + check-monodocer-differentTypeDefinitions \ check-monodocer-typeForwards \ check-monodocer-nestedType-typeForwards \ check-monodocer-Eii-importslashdoc \ diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs index eac9ddd7..44e7e8ab 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.cs @@ -3873,9 +3873,22 @@ namespace Mono.Documentation NormalizeWhitespace(e); } + private bool ProcessedMoreThanOnce(FrameworkTypeEntry typeEntry) + { + if (typeEntry.TimesProcessed <= 1) + { + return false; + } + else + { + var assemblies = this.assemblies.Where(a => a.Name == typeEntry.Framework.Name).ToList(); + return assemblies.Any(a => a.IsTypeForwardingTo(typeEntry)); + } + } + public void MakeParameters (XmlElement root, MemberReference member, IList parameters, FrameworkTypeEntry typeEntry, ref bool fxAlternateTriggered, bool shouldDuplicateWithNew = false) { - if (typeEntry.TimesProcessed > 1) + if (ProcessedMoreThanOnce(typeEntry)) return; XmlElement e = WriteElement (root, "Parameters"); diff --git a/mdoc/Mono.Documentation/Updater/Frameworks/AssemblySet.cs b/mdoc/Mono.Documentation/Updater/Frameworks/AssemblySet.cs index ce46d488..533f221c 100644 --- a/mdoc/Mono.Documentation/Updater/Frameworks/AssemblySet.cs +++ b/mdoc/Mono.Documentation/Updater/Frameworks/AssemblySet.cs @@ -228,5 +228,10 @@ namespace Mono.Documentation.Updater.Frameworks else return new HashSet(); } + + public bool IsTypeForwardingTo(FrameworkTypeEntry typeEntry) + { + return forwardedTypesTo.ContainsKey(typeEntry.Name); + } } } diff --git a/mdoc/Test/DocTest-differentTypeDefinitions.cs b/mdoc/Test/DocTest-differentTypeDefinitions.cs new file mode 100644 index 00000000..c3c18181 --- /dev/null +++ b/mdoc/Test/DocTest-differentTypeDefinitions.cs @@ -0,0 +1,14 @@ +namespace TheNamespace +{ + public class TheClass + { + #if FIRST + public TheClass(int arg) + {} + #endif + #if SECOND + public TheClass(string arg) + {} + #endif + } +} \ No newline at end of file diff --git a/mdoc/Test/en.expected.differentTypeDefinitions/FrameworksIndex/One.xml b/mdoc/Test/en.expected.differentTypeDefinitions/FrameworksIndex/One.xml new file mode 100644 index 00000000..cf5c13f9 --- /dev/null +++ b/mdoc/Test/en.expected.differentTypeDefinitions/FrameworksIndex/One.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/mdoc/Test/en.expected.differentTypeDefinitions/TheNamespace/TheClass.xml b/mdoc/Test/en.expected.differentTypeDefinitions/TheNamespace/TheClass.xml new file mode 100644 index 00000000..6351228d --- /dev/null +++ b/mdoc/Test/en.expected.differentTypeDefinitions/TheNamespace/TheClass.xml @@ -0,0 +1,56 @@ + + + + + DocTest-differentTypeDefinitions-First + 0.0.0.0 + + + DocTest-differentTypeDefinitions-Second + 0.0.0.0 + + + System.Object + + + + To be added. + To be added. + + + + + + Constructor + + DocTest-differentTypeDefinitions-First + 0.0.0.0 + + + + + + To be added. + To be added. + To be added. + + + + + + Constructor + + DocTest-differentTypeDefinitions-Second + 0.0.0.0 + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected.differentTypeDefinitions/index.xml b/mdoc/Test/en.expected.differentTypeDefinitions/index.xml new file mode 100644 index 00000000..fffae27a --- /dev/null +++ b/mdoc/Test/en.expected.differentTypeDefinitions/index.xml @@ -0,0 +1,32 @@ + + + + + + System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints) + + + System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true) + + + + + + + System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints) + + + System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true) + + + + + To be added. + To be added. + + + + + + Untitled + diff --git a/mdoc/Test/en.expected.differentTypeDefinitions/ns-TheNamespace.xml b/mdoc/Test/en.expected.differentTypeDefinitions/ns-TheNamespace.xml new file mode 100644 index 00000000..757c55bd --- /dev/null +++ b/mdoc/Test/en.expected.differentTypeDefinitions/ns-TheNamespace.xml @@ -0,0 +1,6 @@ + + + To be added. + To be added. + + -- cgit v1.2.3 From decaa24530903975a62a62c1683dd3fc10ac4076 Mon Sep 17 00:00:00 2001 From: Michael Jin Date: Tue, 27 Apr 2021 05:38:06 +0800 Subject: [.NET] Compound Type Constraint Does Not Render (#545) --- .../Formatters/CSharpFullMemberFormatter.cs | 5 +- mdoc/Test/DocTest-v1.cs | 7 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 67 ++++ mdoc/Test/en.expected-cppcx2/index.xml | 1 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 67 ++++ mdoc/Test/en.expected-cppwinrt2/index.xml | 1 + .../en.expected-fx-import/FrameworksIndex/one.xml | 4 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 68 ++++ mdoc/Test/en.expected-fx-import/index.xml | 1 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 65 ++++ mdoc/Test/en.expected-javascript/index.xml | 1 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 68 ++++ mdoc/Test/en.expected-vbnet2/index.xml | 1 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 58 ++++ mdoc/Test/en.expected.delete/index.xml | 1 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 66 ++++ mdoc/Test/en.expected.importslashdoc/index.xml | 1 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 68 ++++ mdoc/Test/en.expected.since/index.xml | 1 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 80 +++++ mdoc/Test/en.expected/index.xml | 1 + mdoc/Test/expected_statistics.txt | 8 +- .../CompoundConstraints`1.html | 349 +++++++++++++++++++++ .../Mono.DocTest.Generic/index.html | 8 + .../html.expected-with-array-extension/index.html | 8 + .../CompoundConstraints`1.html | 346 ++++++++++++++++++++ .../html.expected/Mono.DocTest.Generic/index.html | 8 + mdoc/Test/html.expected/index.html | 8 + mdoc/Test/msxdoc-expected.importslashdoc.xml | 15 + .../Mono.DocTest.Generic/CompoundConstraints`1.xml | 66 ++++ .../en.expected.test.multiple.mdoc/index.xml | 1 + 31 files changed, 1443 insertions(+), 6 deletions(-) create mode 100644 mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected-fx-import/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected-javascript/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected-vbnet2/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected.delete/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected.since/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/en.expected/Mono.DocTest.Generic/CompoundConstraints`1.xml create mode 100644 mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/CompoundConstraints`1.html create mode 100644 mdoc/Test/html.expected/Mono.DocTest.Generic/CompoundConstraints`1.html create mode 100644 mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs index d0d674db..7d0aa7c8 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs @@ -316,10 +316,11 @@ namespace Mono.Documentation.Updater.Formatters for (int i = 1; i < constraints.Count; ++i) buf.Append (", ").Append (GetTypeName (constraints[i])); #endif + } if (isnew && !isvt) { - if (comma) + if (comma || constraints.Count > 0) buf.Append (", "); buf.Append ("new()"); } @@ -768,4 +769,4 @@ namespace Mono.Documentation.Updater.Formatters return buf.ToString (); } } -} \ No newline at end of file +} diff --git a/mdoc/Test/DocTest-v1.cs b/mdoc/Test/DocTest-v1.cs index bd5b52a6..18bf8f3d 100644 --- a/mdoc/Test/DocTest-v1.cs +++ b/mdoc/Test/DocTest-v1.cs @@ -649,6 +649,13 @@ namespace Mono.DocTest.Generic { T Method (T t, U u); } + /// Non-generic param + /// T:Mono.DocTest.CompoundConstraints. + public class CompoundConstraints where NGparam : class, new() + { + public static void CompoundConstraintClass () where param : class, new() { } + } + /// Ako generic param /// Bko generic param /// T:Mono.DocTest.MyList`2. diff --git a/mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..a994bff7 --- /dev/null +++ b/mdoc/Test/en.expected-cppcx2/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,67 @@ + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + To be added. + To be added. + To be added. + + + + + + + Constructor + + 0.0.0.0 + + + + To be added. + To be added. + + + + + + + Method + + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected-cppcx2/index.xml b/mdoc/Test/en.expected-cppcx2/index.xml index 7f30af16..0573cee6 100644 --- a/mdoc/Test/en.expected-cppcx2/index.xml +++ b/mdoc/Test/en.expected-cppcx2/index.xml @@ -35,6 +35,7 @@ + diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..d7a62c9c --- /dev/null +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,67 @@ + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + To be added. + To be added. + To be added. + + + + + + + Constructor + + 0.0.0.0 + + + + To be added. + To be added. + + + + + + + Method + + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected-cppwinrt2/index.xml b/mdoc/Test/en.expected-cppwinrt2/index.xml index 0d692620..d94146c6 100644 --- a/mdoc/Test/en.expected-cppwinrt2/index.xml +++ b/mdoc/Test/en.expected-cppwinrt2/index.xml @@ -35,6 +35,7 @@ + diff --git a/mdoc/Test/en.expected-fx-import/FrameworksIndex/one.xml b/mdoc/Test/en.expected-fx-import/FrameworksIndex/one.xml index 0c0f7b01..4eb18767 100644 --- a/mdoc/Test/en.expected-fx-import/FrameworksIndex/one.xml +++ b/mdoc/Test/en.expected-fx-import/FrameworksIndex/one.xml @@ -109,6 +109,10 @@ + + + + diff --git a/mdoc/Test/en.expected-fx-import/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected-fx-import/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..bebdeebd --- /dev/null +++ b/mdoc/Test/en.expected-fx-import/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,68 @@ + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + Non-generic param + To be added. + + T:Mono.DocTest.CompoundConstraints. + + + + + + Constructor + + DocTest + 0.0.0.0 + + + + To be added. + To be added. + + + + + + Method + + DocTest + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected-fx-import/index.xml b/mdoc/Test/en.expected-fx-import/index.xml index 5190f1db..2199327b 100644 --- a/mdoc/Test/en.expected-fx-import/index.xml +++ b/mdoc/Test/en.expected-fx-import/index.xml @@ -55,6 +55,7 @@ + diff --git a/mdoc/Test/en.expected-javascript/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected-javascript/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..1655cde9 --- /dev/null +++ b/mdoc/Test/en.expected-javascript/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,65 @@ + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + To be added. + To be added. + To be added. + + + + + + Constructor + + 0.0.0.0 + + + + To be added. + To be added. + + + + + + Method + + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected-javascript/index.xml b/mdoc/Test/en.expected-javascript/index.xml index c74a4a77..79f03305 100644 --- a/mdoc/Test/en.expected-javascript/index.xml +++ b/mdoc/Test/en.expected-javascript/index.xml @@ -35,6 +35,7 @@ + diff --git a/mdoc/Test/en.expected-vbnet2/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected-vbnet2/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..15297b83 --- /dev/null +++ b/mdoc/Test/en.expected-vbnet2/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,68 @@ + + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + To be added. + To be added. + To be added. + + + + + + + Constructor + + 0.0.0.0 + + + + To be added. + To be added. + + + + + + + Method + + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected-vbnet2/index.xml b/mdoc/Test/en.expected-vbnet2/index.xml index 91ad0ed3..9bcfe8be 100644 --- a/mdoc/Test/en.expected-vbnet2/index.xml +++ b/mdoc/Test/en.expected-vbnet2/index.xml @@ -35,6 +35,7 @@ + diff --git a/mdoc/Test/en.expected.delete/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected.delete/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..fa8b068a --- /dev/null +++ b/mdoc/Test/en.expected.delete/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,58 @@ + + + + + DocTest + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + To be added. + To be added. + To be added. + + + + + + Constructor + + + To be added. + To be added. + + + + + + Method + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected.delete/index.xml b/mdoc/Test/en.expected.delete/index.xml index 0d692620..d94146c6 100644 --- a/mdoc/Test/en.expected.delete/index.xml +++ b/mdoc/Test/en.expected.delete/index.xml @@ -35,6 +35,7 @@ + diff --git a/mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..f9ba1b6c --- /dev/null +++ b/mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,66 @@ + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + Non-generic param + To be added. + + T:Mono.DocTest.CompoundConstraints. + + + + + + Constructor + + 0.0.0.0 + + + + To be added. + To be added. + + + + + + Method + + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected.importslashdoc/index.xml b/mdoc/Test/en.expected.importslashdoc/index.xml index 82bf818b..da66cdec 100644 --- a/mdoc/Test/en.expected.importslashdoc/index.xml +++ b/mdoc/Test/en.expected.importslashdoc/index.xml @@ -35,6 +35,7 @@ + diff --git a/mdoc/Test/en.expected.since/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected.since/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..5398157d --- /dev/null +++ b/mdoc/Test/en.expected.since/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,68 @@ + + + + + DocTest + 0.0.0.0 + 2.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + To be added. + To be added. + To be added. + + + + + + Constructor + + 0.0.0.0 + 2.0.0.0 + + + + To be added. + To be added. + + + + + + Method + + 0.0.0.0 + 2.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected.since/index.xml b/mdoc/Test/en.expected.since/index.xml index 0e220307..c06f7826 100644 --- a/mdoc/Test/en.expected.since/index.xml +++ b/mdoc/Test/en.expected.since/index.xml @@ -36,6 +36,7 @@ + diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..5aaf82fd --- /dev/null +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,80 @@ + + + + + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + To be added. + To be added. + To be added. + + + + + + + + + + + Constructor + + 0.0.0.0 + + + + To be added. + To be added. + + + + + + + + + + + + Method + + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/en.expected/index.xml b/mdoc/Test/en.expected/index.xml index 3937a118..e6e60ac8 100644 --- a/mdoc/Test/en.expected/index.xml +++ b/mdoc/Test/en.expected/index.xml @@ -35,6 +35,7 @@ + diff --git a/mdoc/Test/expected_statistics.txt b/mdoc/Test/expected_statistics.txt index ae5b2bd0..404d8a31 100644 --- a/mdoc/Test/expected_statistics.txt +++ b/mdoc/Test/expected_statistics.txt @@ -1,16 +1,16 @@ Framework: one -------- -Types Added: 32 +Types Added: 33 Types Removed: 0 -Types Total: 32 +Types Total: 33 Namespaces Added: 4 Namespaces Removed: 0 Namespaces Total: 4 -Members Added: 127 +Members Added: 129 Members Removed: 0 -Members Total: 127 +Members Total: 129 Framework: two -------- diff --git a/mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/CompoundConstraints`1.html b/mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/CompoundConstraints`1.html new file mode 100644 index 00000000..460e9f31 --- /dev/null +++ b/mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/CompoundConstraints`1.html @@ -0,0 +1,349 @@ + + + Mono.DocTest.Generic.CompoundConstraints<NGparam> + + + + + + + +

CompoundConstraints<NGparam> Generic Class

+

+ Documentation for this section has not yet been entered. +

+
+

Syntax

+
public class CompoundConstraints<NGparam>
where NGparam : classnew()
+
+
+

Type Parameters

+
+
+
+ NGparam +
+
+ Documentation for this section has not yet been entered. +
+
+
+

Remarks

+
+ Documentation for this section has not yet been entered. +
+

Requirements

+
+ Namespace: Mono.DocTest.Generic
Assembly: DocTest (in DocTest.dll)
Assembly Versions: 0.0.0.0
+

Members

+
+

+ See Also: Inherited members from + object. +

+

Public Constructors

+
+
+ + + + + + +
+
+
+
+ + + Documentation for this section has not yet been entered. +
+
+
+

Public Methods

+
+
+ + + + + +
+
static
+
+ + CompoundConstraintClass<param> + ()
Documentation for this section has not yet been entered.
+
+
+

Extension Methods

+
+
+ + + + + +
+
static
+
+ + ToEnumerable<T> + (this T) : IEnumerable<T>
Documentation for this section has not yet been entered.
+
+
+
+
+
+

Member Details

+
+

CompoundConstraints Constructor

+
+
+ Documentation for this section has not yet been entered. +
+

Syntax

+
public CompoundConstraints ()
+

Remarks

+
+ Documentation for this section has not yet been entered. +
+

Requirements

+
+ Namespace: Mono.DocTest.Generic
Assembly: DocTest (in DocTest.dll)
Assembly Versions: 0.0.0.0
+
+
+

CompoundConstraintClass<param> Generic Method

+
+
+ Documentation for this section has not yet been entered. +
+

Syntax

+
public static void CompoundConstraintClass<param> ()
where param : classnew()
+

Type Parameters

+
+
+
+ param +
+
+ Documentation for this section has not yet been entered. +
+
+
+

Remarks

+
+ Documentation for this section has not yet been entered. +
+

Requirements

+
+ Namespace: Mono.DocTest.Generic
Assembly: DocTest (in DocTest.dll)
Assembly Versions: 0.0.0.0
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/index.html b/mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/index.html index d82db15a..c88f29b3 100644 --- a/mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/index.html +++ b/mdoc/Test/html.expected-with-array-extension/Mono.DocTest.Generic/index.html @@ -204,6 +204,14 @@ Type Description + + + CompoundConstraints<NGparam> + + + Documentation for this section has not yet been entered. + + Extensions diff --git a/mdoc/Test/html.expected-with-array-extension/index.html b/mdoc/Test/html.expected-with-array-extension/index.html index fb1fea18..6622efe8 100644 --- a/mdoc/Test/html.expected-with-array-extension/index.html +++ b/mdoc/Test/html.expected-with-array-extension/index.html @@ -358,6 +358,14 @@ Type Description + + + CompoundConstraints<NGparam> + + + Documentation for this section has not yet been entered. + + Extensions diff --git a/mdoc/Test/html.expected/Mono.DocTest.Generic/CompoundConstraints`1.html b/mdoc/Test/html.expected/Mono.DocTest.Generic/CompoundConstraints`1.html new file mode 100644 index 00000000..773741fc --- /dev/null +++ b/mdoc/Test/html.expected/Mono.DocTest.Generic/CompoundConstraints`1.html @@ -0,0 +1,346 @@ + + + Mono.DocTest.Generic.CompoundConstraints<NGparam> + + + + + + + +

CompoundConstraints<NGparam> Generic Class

+

+ Documentation for this section has not yet been entered. +

+
+

Syntax

+
public class CompoundConstraints<NGparam>
where NGparam : classnew()
+
+
+

Type Parameters

+
+
+
+ NGparam +
+
Non-generic param
+
+
+

Remarks

+
+ T:Mono.DocTest.CompoundConstraints.
+

Requirements

+
+ Namespace: Mono.DocTest.Generic
Assembly: DocTest (in DocTest.dll)
Assembly Versions: 0.0.0.0
+

Members

+
+

+ See Also: Inherited members from + object. +

+

Public Constructors

+
+
+ + + + + + +
+
+
+
+ + + Documentation for this section has not yet been entered. +
+
+
+

Public Methods

+
+
+ + + + + +
+
static
+
+ + CompoundConstraintClass<param> + ()
Documentation for this section has not yet been entered.
+
+
+

Extension Methods

+
+
+ + + + + +
+
static
+
+ + ToEnumerable<T> + (this T) : IEnumerable<T>
System.Object extension method
+
+
+
+
+
+

Member Details

+
+

CompoundConstraints Constructor

+
+
+ Documentation for this section has not yet been entered. +
+

Syntax

+
public CompoundConstraints ()
+

Remarks

+
+ Documentation for this section has not yet been entered. +
+

Requirements

+
+ Namespace: Mono.DocTest.Generic
Assembly: DocTest (in DocTest.dll)
Assembly Versions: 0.0.0.0
+
+
+

CompoundConstraintClass<param> Generic Method

+
+
+ Documentation for this section has not yet been entered. +
+

Syntax

+
public static void CompoundConstraintClass<param> ()
where param : classnew()
+

Type Parameters

+
+
+
+ param +
+
+ Documentation for this section has not yet been entered. +
+
+
+

Remarks

+
+ Documentation for this section has not yet been entered. +
+

Requirements

+
+ Namespace: Mono.DocTest.Generic
Assembly: DocTest (in DocTest.dll)
Assembly Versions: 0.0.0.0
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/mdoc/Test/html.expected/Mono.DocTest.Generic/index.html b/mdoc/Test/html.expected/Mono.DocTest.Generic/index.html index ccd15a27..261c32c9 100644 --- a/mdoc/Test/html.expected/Mono.DocTest.Generic/index.html +++ b/mdoc/Test/html.expected/Mono.DocTest.Generic/index.html @@ -204,6 +204,14 @@ Type Description + + + CompoundConstraints<NGparam> + + + Documentation for this section has not yet been entered. + + Extensions diff --git a/mdoc/Test/html.expected/index.html b/mdoc/Test/html.expected/index.html index d521e764..487289b4 100644 --- a/mdoc/Test/html.expected/index.html +++ b/mdoc/Test/html.expected/index.html @@ -350,6 +350,14 @@ Type Description + + + CompoundConstraints<NGparam> + + + Documentation for this section has not yet been entered. + + Extensions diff --git a/mdoc/Test/msxdoc-expected.importslashdoc.xml b/mdoc/Test/msxdoc-expected.importslashdoc.xml index 42f2bb1a..2b1faff4 100644 --- a/mdoc/Test/msxdoc-expected.importslashdoc.xml +++ b/mdoc/Test/msxdoc-expected.importslashdoc.xml @@ -591,6 +591,21 @@ class Example { To be added. To be added.
+ + Non-generic param + To be added. + + T:Mono.DocTest.CompoundConstraints. + + + To be added. + To be added. + + + To be added. + To be added. + To be added. + extension methods! diff --git a/mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml b/mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml new file mode 100644 index 00000000..f9ba1b6c --- /dev/null +++ b/mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/Mono.DocTest.Generic/CompoundConstraints`1.xml @@ -0,0 +1,66 @@ + + + + + DocTest + 0.0.0.0 + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + System.Object + + + + Non-generic param + To be added. + + T:Mono.DocTest.CompoundConstraints. + + + + + + Constructor + + 0.0.0.0 + + + + To be added. + To be added. + + + + + + Method + + 0.0.0.0 + + + System.Void + + + + + DefaultConstructorConstraint + ReferenceTypeConstraint + + + + + + To be added. + To be added. + To be added. + + + + diff --git a/mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/index.xml b/mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/index.xml index 82bf818b..da66cdec 100644 --- a/mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/index.xml +++ b/mdoc/Test/test-multiple-mdoc/en.expected.test.multiple.mdoc/index.xml @@ -35,6 +35,7 @@ + -- cgit v1.2.3 From d3ce3cadd68a78fbb11efe02afb9c160e07391e4 Mon Sep 17 00:00:00 2001 From: RanhaoXu Date: Sat, 1 May 2021 03:20:57 +0800 Subject: Fixed array parameter syntax for C++/WinRT (#552) https://dev.azure.com/ceapex/Engineering/_workitems/edit/347021 --- .../Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs | 2 +- mdoc/Test/ClassEnumeratorECMA.xml | 2 +- .../en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml | 2 +- mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml | 12 ++++++------ mdoc/Test/en.expected-cppwinrt2/System/Array.xml | 2 +- .../CustomNamespace/ClassEnumerator.xml | 2 +- .../CustomNamespace/ClassEnumerator.xml | 2 +- .../CustomNamespace/ClassEnumerator.xml | 2 +- mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml | 2 +- mdoc/Test/en.expected/Mono.DocTest/Widget.xml | 12 ++++++------ mdoc/Test/en.expected/System/Array.xml | 2 +- mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index f4a2a199..d389d818 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -131,7 +131,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters protected override StringBuilder AppendArrayTypeName(StringBuilder buf, TypeReference type, IAttributeParserContext context) { - buf.Append("std::Array <"); + buf.Append("winrt::array_view <"); var item = type is TypeSpecification spec ? spec.ElementType : type.GetElementType(); _AppendTypeName(buf, item, context); diff --git a/mdoc/Test/ClassEnumeratorECMA.xml b/mdoc/Test/ClassEnumeratorECMA.xml index e79e8348..bc0dea5b 100644 --- a/mdoc/Test/ClassEnumeratorECMA.xml +++ b/mdoc/Test/ClassEnumeratorECMA.xml @@ -97,7 +97,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml index d2a70af6..1f1dbc61 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/MyList`2.xml @@ -76,7 +76,7 @@ - + Method M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32) diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml index 53153d5f..c0e5766b 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml @@ -115,7 +115,7 @@ - + Field 0.0.0.0 @@ -131,7 +131,7 @@ - + Field 0.0.0.0 @@ -147,7 +147,7 @@ - + Field 0.0.0.0 @@ -527,7 +527,7 @@ - + Method 0.0.0.0 @@ -551,7 +551,7 @@ - + Method 0.0.0.0 @@ -595,7 +595,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/System/Array.xml b/mdoc/Test/en.expected-cppwinrt2/System/Array.xml index a5140e63..a93cfc01 100644 --- a/mdoc/Test/en.expected-cppwinrt2/System/Array.xml +++ b/mdoc/Test/en.expected-cppwinrt2/System/Array.xml @@ -83,7 +83,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml b/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml index cd0f756c..2cee2246 100644 --- a/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml +++ b/mdoc/Test/en.expected-eii-implementation-ecmadoc/CustomNamespace/ClassEnumerator.xml @@ -92,7 +92,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml b/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml index 4152d669..0bfc3fe1 100644 --- a/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml +++ b/mdoc/Test/en.expected-eii-implementation-slashdoc/CustomNamespace/ClassEnumerator.xml @@ -96,7 +96,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml b/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml index 9dc4ffff..58bb9d5d 100644 --- a/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml +++ b/mdoc/Test/en.expected-eii-implementation/CustomNamespace/ClassEnumerator.xml @@ -92,7 +92,7 @@ - + Method 0.0.65535.65535 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml index fa924297..12764a81 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/MyList`2.xml @@ -89,7 +89,7 @@ - + Method M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32) diff --git a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml index 75d5a02a..54c82c81 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml @@ -153,7 +153,7 @@ - + Field 0.0.0.0 @@ -173,7 +173,7 @@ - + Field 0.0.0.0 @@ -193,7 +193,7 @@ - + Field 0.0.0.0 @@ -664,7 +664,7 @@ - + Method 0.0.0.0 @@ -693,7 +693,7 @@ - + Method 0.0.0.0 @@ -745,7 +745,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/en.expected/System/Array.xml b/mdoc/Test/en.expected/System/Array.xml index 6980a7d2..29dbb360 100644 --- a/mdoc/Test/en.expected/System/Array.xml +++ b/mdoc/Test/en.expected/System/Array.xml @@ -106,7 +106,7 @@ - + Method 0.0.0.0 diff --git a/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml b/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml index 08118006..6bee5520 100644 --- a/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml +++ b/mdoc/Test/ex.expected-cppwinrtuwp/Namespace2/Class3.xml @@ -36,7 +36,7 @@ - + Property 255.255.255.255 -- cgit v1.2.3 From b9158aa6bc4e958bbd243a0d4fbf109788c90e87 Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Sat, 1 May 2021 03:23:09 +0800 Subject: Adding the projection of Numerics types in C++/WinRT, C++/CX and fixed an issue of the cppType logic (#550) https://dev.azure.com/ceapex/Engineering/_workitems/edit/100023 --- mdoc/Mono.Documentation/MDocUpdater.cs | 1 - .../CppFormatters/CppCxFullMemberFormatter.cs | 12 +++- .../CppFormatters/CppFullMemberFormatter.cs | 5 +- .../CppFormatters/CppWinRtFullMemberFormatter.cs | 17 ++++-- mdoc/mdoc.Test/CppCxFormatterMembersTests.cs | 20 ++----- mdoc/mdoc.Test/CppCxFormatterTypesTests.cs | 66 ++++++++++++++++++++++ mdoc/mdoc.Test/CppFullFormatterTests.cs | 26 ++++++++- mdoc/mdoc.Test/CppWinRtFormatterTests.cs | 66 ++++++++++++++++++++++ mdoc/mdoc.Test/CppWinRtMembersTests.cs | 4 +- 9 files changed, 189 insertions(+), 28 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs index 44e7e8ab..47b50d40 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.cs @@ -2454,7 +2454,6 @@ namespace Mono.Documentation info.Node = WriteElement (me, "Docs"); MakeDocNode (info, typeEntry.Framework.Importers, typeEntry); - foreach (MemberFormatter f in FormatterManager.MemberFormatters) { diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs index 0c158189..9415680f 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppCxFullMemberFormatter.cs @@ -131,6 +131,13 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters case "System.Object": typeToCompare = "Platform::Object"; break; case "System.Type": typeToCompare = "Platform::Type"; break; case "System.Attribute": typeToCompare = "Platform::Metadata::Attribute"; break; + case "Windows.Foundation.Numerics.Matrix3x2": typeToCompare = "float3x2"; break; + case "Windows.Foundation.Numerics.Matrix4x4": typeToCompare = "float4x4"; break; + case "Windows.Foundation.Numerics.Plane": typeToCompare = "plane"; break; + case "Windows.Foundation.Numerics.Quaternion": typeToCompare = "quaternion"; break; + case "Windows.Foundation.Numerics.Vector2": typeToCompare = "float2"; break; + case "Windows.Foundation.Numerics.Vector3": typeToCompare = "float3"; break; + case "Windows.Foundation.Numerics.Vector4": typeToCompare = "float4"; break; } if (splitType != null) @@ -202,9 +209,10 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters buf.Append(GetTypeKind(type)); buf.Append(" "); - buf.Append(GetCppType(type.FullName) == null + var cppType = GetCppType(type.FullName); + buf.Append(cppType == null ? GetNameWithOptions(type, false, false) - : type.Name); + : cppType); if (type.IsAbstract && !type.IsInterface) buf.Append(" abstract"); diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs index 171ca144..7eede39d 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs @@ -181,9 +181,10 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters buf.Append(GetTypeKind (type)); buf.Append(" "); - buf.Append(GetCppType(type.FullName) == null + var cppType = GetCppType(type.FullName); + buf.Append(cppType == null ? GetNameWithOptions(type, false, false) - : type.Name); + : cppType); if (type.IsAbstract && !type.IsInterface) buf.Append(" abstract"); diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index d389d818..646e802d 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -59,20 +59,26 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters case "System.Int16": typeToCompare = "short"; break; case "System.Int32": typeToCompare = "int"; break; case "System.Int64": typeToCompare = "long"; break; - case "System.UInt16": typeToCompare = "unsigned short"; break; + case "System.UInt16": typeToCompare = "uint16_t"; break; case "System.UInt32": typeToCompare = "uint32_t"; break; case "System.UInt64": typeToCompare = "uint64_t"; break; - case "System.Single": typeToCompare = "float"; break; case "System.Double": typeToCompare = "double"; break; - case "System.Boolean": typeToCompare = "bool"; break; case "System.Char": typeToCompare = "char"; break; case "System.Void": typeToCompare = "void"; break; + //API specific type is "winrt::hstring"; but c++ in built type is better variant case "System.String": typeToCompare = "winrt::hstring"; break; case "System.Guid": typeToCompare = "winrt::guid"; break; case "System.Object": typeToCompare = "winrt::Windows::Foundation::IInspectable"; break; + case "Windows.Foundation.Numerics.Matrix3x2": typeToCompare = "float3x2"; break; + case "Windows.Foundation.Numerics.Matrix4x4": typeToCompare = "float4x4"; break; + case "Windows.Foundation.Numerics.Plane": typeToCompare = "plane"; break; + case "Windows.Foundation.Numerics.Quaternion": typeToCompare = "quaternion"; break; + case "Windows.Foundation.Numerics.Vector2": typeToCompare = "float2"; break; + case "Windows.Foundation.Numerics.Vector3": typeToCompare = "float3"; break; + case "Windows.Foundation.Numerics.Vector4": typeToCompare = "float4"; break; } if (splitType != null) @@ -205,9 +211,10 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters buf.Append(GetTypeKind(type)); buf.Append(" "); - buf.Append(GetCppType(type.FullName) == null + var cppType = GetCppType(type.FullName); + buf.Append(cppType == null ? GetNameWithOptions(type, false, false) - : type.Name); + : cppType); if (type.IsAbstract && !type.IsInterface) buf.Append(" abstract"); diff --git a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs index 10b0378f..d9fe24cd 100644 --- a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs +++ b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs @@ -43,30 +43,22 @@ namespace mdoc.Test Windows::Foundation::IAsyncActionWithProgress ^ GetPrimesUnordered(int first, int last);"); } - //[Test] - //[Category("Method")] - //public void Method_CreateNewGuid() - //{ - // TestMethodSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "CreateNewGuid", - // @"public: Platform::Guid ^ CreateNewGuid();"); - //} - [Test] - public void CreateNewGuid() + [Category("Method")] + public void Method_CreateNewGuid() { var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid"); var sig = formatter.GetDeclaration(member); - Assert.AreEqual(@"public: - static Platform::Guid CreateNewGuid();", sig); + Assert.AreEqual("public:\n static Platform::Guid CreateNewGuid();", sig); } [Test] - public void ObjectIndentical() + [Category("Method")] + public void Method_ObjectIndentical() { var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical"); var sig = formatter.GetDeclaration(member); - Assert.AreEqual(@"public: - bool ObjectIndentical(Platform::Guid objGuid1, Platform::Guid objGuid2);", sig); + Assert.AreEqual("public:\n bool ObjectIndentical(Platform::Guid objGuid1, Platform::Guid objGuid2);", sig); } [Test] diff --git a/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs b/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs index d8bf6909..2bbd8390 100644 --- a/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs +++ b/mdoc/mdoc.Test/CppCxFormatterTypesTests.cs @@ -13,6 +13,7 @@ namespace mdoc.Test { protected override CppCxMemberFormatter formatter => new CppCxMemberFormatter(); + private string _cppWinRtTestLibName = "../../../../external/Windows/Windows.Foundation.UniversalApiContract.winmd"; private string _cppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd"; protected override TypeDefinition GetType(Type type) @@ -85,8 +86,73 @@ namespace mdoc.Test TestTypeSignature(_cppCxTestLibName, "Namespace2.Class4", "public value class Class4"); } + [Test] + [Category("Type")] + public void TypeSignature_NumericsMatrix3x2() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix3x2", "public value class float3x2"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsMatrix4x4() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix4x4", "public value class float4x4"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsQuaternion() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Quaternion", "public value class quaternion"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsVector2() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector2", "public value class float2"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsVector3() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector3", "public value class float3"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsVector4() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector4", "public value class float4"); + } + + [Test] + [Category("Type")] + public void TypeSignature_ValueGuid() + { + TestTypeSignature(typeof(Guid), + "public value class Platform::Guid : IComparable, IComparable, IEquatable, IFormattable"); + } + + [Test] + [Category("Type")] + public void TypeSignature_ValueSingle() + { + TestTypeSignature(typeof(Single), + "public value class float : IComparable, IComparable, IConvertible, IEquatable, IFormattable"); + } + #region NoSupport + [Test] + [Category("Type")] + public void TypeSignature_NumericsPlane() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Plane", null); + } + [Test] [Category("NoSupport")] public void NoSupport_GenericDelegate() diff --git a/mdoc/mdoc.Test/CppFullFormatterTests.cs b/mdoc/mdoc.Test/CppFullFormatterTests.cs index 9cd417d8..1ad39d43 100644 --- a/mdoc/mdoc.Test/CppFullFormatterTests.cs +++ b/mdoc/mdoc.Test/CppFullFormatterTests.cs @@ -240,7 +240,6 @@ generic typeof(MyList1<,>), @"public: virtual System::Collections::Generic::IEnumerator ^ GetEnumerator() = System::Collections::Generic::IEnumerable::GetEnumerator;", nameof(MyList1.GetEnumerator)); - } [Test] @@ -250,7 +249,6 @@ generic static Mono_DocTest::Widget ^ operator +(Mono_DocTest::Widget ^ x1, Mono_DocTest::Widget ^ x2);", "op_Addition"); - [Test] [Category("Methods")] [Category("NoSupport")] @@ -265,6 +263,30 @@ generic TestTypeSignature(CSharpTestLib, "Mono.DocTest.Widget/NestedClass", null); } + [Test] + [Category("Type")] + public void TypeSignature_Widget() + { + TestTypeSignature(CSharpTestLib, + "Mono.DocTest.DocValueType", "public value class Mono::DocTest::DocValueType : Mono::DocTest::IProcess"); + } + + [Test] + [Category("Type")] + public void TypeSignature_Single() + { + TestTypeSignature(typeof(Single), + "public value class float : IComparable, IComparable, IConvertible, IEquatable, IFormattable"); + } + + [Test] + [Category("Type")] + public void TypeSignature_Int32() + { + TestTypeSignature(typeof(Int32), + "public value class int : IComparable, IComparable, IConvertible, IEquatable, IFormattable"); + } + [Test] [Category("Methods")] public void MethodSignature_opExplicit() => diff --git a/mdoc/mdoc.Test/CppWinRtFormatterTests.cs b/mdoc/mdoc.Test/CppWinRtFormatterTests.cs index c17ebec9..65e6a614 100644 --- a/mdoc/mdoc.Test/CppWinRtFormatterTests.cs +++ b/mdoc/mdoc.Test/CppWinRtFormatterTests.cs @@ -13,6 +13,7 @@ namespace mdoc.Test private static readonly CppWinRtMemberFormatter CppWinRtMemberFormatter = new CppWinRtMemberFormatter(); protected override CppWinRtMemberFormatter formatter => CppWinRtMemberFormatter; + private string _cppWinRtTestLibName = "../../../../external/Windows/Windows.Foundation.UniversalApiContract.winmd"; private string _cppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd"; private const string CSharpTestLib = "../../../../external/Test/CSharpExample.dll"; @@ -53,6 +54,55 @@ namespace mdoc.Test TestTypeSignature(_cppCxTestLibName, "Namespace2.Class4", "struct Class4"); } + [Test] + [Category("Type")] + public void TypeSignature_NumericsMatrix3x2() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix3x2", "struct float3x2"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsMatrix4x4() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Matrix4x4", "struct float4x4"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsPlane() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Plane", "struct plane"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsQuaternion() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Quaternion", "struct quaternion"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsVector2() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector2", "struct float2"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsVector3() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector3", "struct float3"); + } + + [Test] + [Category("Type")] + public void TypeSignature_NumericsVector4() + { + TestTypeSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Vector4", "struct float4"); + } + [Test] [Category("Type")] public void TypeSignature_GenericInterface() @@ -86,6 +136,22 @@ class Widget::NestedClass::Double"); class Widget : Mono_DocTest::IProcess"); } + [Test] + [Category("Type")] + public void TypeSignature_ValueGuid() + { + TestTypeSignature(typeof(Guid), + "struct winrt::guid : IComparable, IComparable, IEquatable, IFormattable"); + } + + [Test] + [Category("Type")] + public void TypeSignature_ValueSingle() + { + TestTypeSignature(typeof(Single), + "struct float : IComparable, IComparable, IConvertible, IEquatable, IFormattable"); + } + [Test] [Category("NoSupport")] public void NoSupport_Delegate() diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index 3a33e69a..918efc32 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -41,7 +41,7 @@ namespace mdoc.Test } [Test] - public void CreateNewGuid() + public void Method_CreateNewGuid() { var member = GetMethod(typeof(GuidClass), m => m.Name == "CreateNewGuid"); var sig = formatter.GetDeclaration(member); @@ -49,7 +49,7 @@ namespace mdoc.Test } [Test] - public void ObjectIndentical() + public void Method_ObjectIndentical() { var member = GetMethod(typeof(GuidClass), m => m.Name == "ObjectIndentical"); var sig = formatter.GetDeclaration(member); -- cgit v1.2.3 From 511dafa67f2ba31119c313aa28ce6c01d40d13af Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Sat, 1 May 2021 03:26:32 +0800 Subject: Fixed the return type of auto event revoker (#553) https://dev.azure.com/ceapex/Engineering/_workitems/edit/100018 Co-authored-by: anmeng10101 <33647870+anmeng10101@users.noreply.github.com> --- .../Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs | 3 ++- .../en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml | 4 ++-- mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml | 8 ++++---- mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml | 4 ++-- mdoc/Test/en.expected/Mono.DocTest/Widget.xml | 8 ++++---- .../ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml | 2 +- mdoc/mdoc.Test/CppWinRtMembersTests.cs | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index 646e802d..35795bc2 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -186,6 +186,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters protected override string GetEventDeclaration(EventDefinition e) { string apiName = e.Name, typeName = GetTypeNameWithOptions(e.EventType, AppendHatOnReturn); + var rtnAutoEventRevoker = e.DeclaringType.Name + NestedTypeSeparator + apiName; StringBuilder buf = new StringBuilder(); //if (AppendVisibility(buf, e.AddMethod).Length == 0) @@ -194,7 +195,7 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters buf.AppendLine().AppendLine("// Revoke with event_token"); buf.AppendLine($"void {apiName}(event_token const* cookie) const;"); buf.AppendLine().AppendLine("// Revoke with event_revoker"); - buf.Append($"{apiName}_revoker {apiName}(auto_revoke_t, {typeName} const& handler) const;"); + buf.Append($"{rtnAutoEventRevoker}_revoker {apiName}(auto_revoke_t, {typeName} const& handler) const;"); return buf.ToString().Replace("\r\n", "\n"); } diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml index 53452ce4..47dd2f26 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/GenericBase`1.xml @@ -85,7 +85,7 @@ - + Event 0.0.0.0 @@ -101,7 +101,7 @@ - + Event 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml index c0e5766b..0bb9e49d 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest/Widget.xml @@ -69,7 +69,7 @@ - + Event 0.0.0.0 @@ -99,7 +99,7 @@ - + Event 0.0.0.0 @@ -306,7 +306,7 @@ - + Event 0.0.0.0 @@ -328,7 +328,7 @@ - + Event 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml index 00b21131..31a89773 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml @@ -107,7 +107,7 @@ - + Event 0.0.0.0 @@ -127,7 +127,7 @@ - + Event 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml index 54c82c81..4a2d0cc6 100644 --- a/mdoc/Test/en.expected/Mono.DocTest/Widget.xml +++ b/mdoc/Test/en.expected/Mono.DocTest/Widget.xml @@ -95,7 +95,7 @@ - + Event 0.0.0.0 @@ -133,7 +133,7 @@ - + Event 0.0.0.0 @@ -391,7 +391,7 @@ - + Event 0.0.0.0 @@ -419,7 +419,7 @@ - + Event 0.0.0.0 diff --git a/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml b/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml index 387025c8..63823405 100644 --- a/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml +++ b/mdoc/Test/ex.expected-cppwinrtuwp/UwpTestWinRtComponentCpp/Class1.xml @@ -123,7 +123,7 @@ - + Event 255.255.255.255 diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index 918efc32..cd0f34a1 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -107,7 +107,7 @@ event_token primeFoundEvent(UwpTestWinRtComponentCpp::PrimeFoundHandler const& h void primeFoundEvent(event_token const* cookie) const; // Revoke with event_revoker -primeFoundEvent_revoker primeFoundEvent(auto_revoke_t, UwpTestWinRtComponentCpp::PrimeFoundHandler const& handler) const;"; +Class1::primeFoundEvent_revoker primeFoundEvent(auto_revoke_t, UwpTestWinRtComponentCpp::PrimeFoundHandler const& handler) const;"; TestEventSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Class1", "primeFoundEvent", expectedSig); } -- cgit v1.2.3 From 90a605568aa8005236b5034ef5bcbdd0245ee340 Mon Sep 17 00:00:00 2001 From: Michael Jin Date: Sat, 1 May 2021 03:29:30 +0800 Subject: [mdoc] C++/WinRT: syntax block shouldn't show "abstract" (#554) --- .../Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs | 2 -- .../AttachedEventsAndProperties/AttachedPropertyExample.xml | 2 +- .../en.expected-cppwinrt/MyFramework.MyNamespace/MyClassExtensions.xml | 2 +- mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/Extensions.xml | 2 +- mdoc/Test/en.expected/Mono.DocTest.Generic/Extensions.xml | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index 35795bc2..9b0ef96e 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -217,8 +217,6 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters ? GetNameWithOptions(type, false, false) : cppType); - if (type.IsAbstract && !type.IsInterface) - buf.Append(" abstract"); if (type.IsSealed && !DocUtils.IsDelegate(type) && !type.IsValueType) buf.Append(" final"); diff --git a/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml b/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml index 3ea1fcf1..5bcdd0d4 100644 --- a/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml +++ b/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml @@ -6,7 +6,7 @@ - + AttachedEventsAndProperties 1.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClassExtensions.xml b/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClassExtensions.xml index 00948749..623e21b1 100644 --- a/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClassExtensions.xml +++ b/mdoc/Test/en.expected-cppwinrt/MyFramework.MyNamespace/MyClassExtensions.xml @@ -1,7 +1,7 @@ - + DocTest-DropNS-classic 0.0.0.0 diff --git a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/Extensions.xml b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/Extensions.xml index e8452484..da00e18f 100644 --- a/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/Extensions.xml +++ b/mdoc/Test/en.expected-cppwinrt2/Mono.DocTest.Generic/Extensions.xml @@ -1,7 +1,7 @@ - + DocTest 0.0.0.0 diff --git a/mdoc/Test/en.expected/Mono.DocTest.Generic/Extensions.xml b/mdoc/Test/en.expected/Mono.DocTest.Generic/Extensions.xml index 98746f90..2663c3a5 100644 --- a/mdoc/Test/en.expected/Mono.DocTest.Generic/Extensions.xml +++ b/mdoc/Test/en.expected/Mono.DocTest.Generic/Extensions.xml @@ -6,7 +6,7 @@ - + DocTest 0.0.0.0 -- cgit v1.2.3 From 1ad91bf6f5fac22f76bde705c319516d4b7d3feb Mon Sep 17 00:00:00 2001 From: TerryFei <34563940+TerryFei@users.noreply.github.com> Date: Fri, 7 May 2021 05:16:13 +0800 Subject: [mdoc] C++/WinRT: syntax block missing 'static' keyword for properties/events (#555) https://dev.azure.com/ceapex/Engineering/_workitems/edit/344649/ --- .../CppFormatters/CppWinRtFullMemberFormatter.cs | 25 ++++++++++++++++++---- .../AttachedEventsAndProperties/AquariumFilter.xml | 2 +- .../AttachedPropertyExample.xml | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs index 9b0ef96e..b2591b44 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppWinRtFullMemberFormatter.cs @@ -171,14 +171,27 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters StringBuilder buf = new StringBuilder(); if (property.GetMethod != null) - buf.AppendLine($"{returnType} {apiName}();").AppendLine(); + { + if (property.GetMethod.IsStatic) + buf.AppendLine($"static {returnType} {apiName}();").AppendLine(); + else + buf.AppendLine($"{returnType} {apiName}();").AppendLine(); + } if (property.SetMethod != null) { string paramName = property.SetMethod.Parameters.First().Name; + if (property.SetMethod.IsStatic) + { + buf.Append("static "); + } if (string.IsNullOrWhiteSpace(paramName)) + { buf.AppendLine($"void {apiName}({returnType});"); + } else + { buf.AppendLine($"void {apiName}({returnType} {paramName});"); + } } return buf.ToString().Replace("\r\n", "\n").Trim(); } @@ -190,12 +203,16 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters StringBuilder buf = new StringBuilder(); //if (AppendVisibility(buf, e.AddMethod).Length == 0) + var method = e.AddMethod; + string modifiers = string.Empty; + if (method.IsStatic) + modifiers += "static "; buf.AppendLine("// Register"); - buf.AppendLine($"event_token {apiName}({typeName} const& handler) const;"); + buf.AppendLine($"{modifiers}event_token {apiName}({typeName} const& handler) const;"); buf.AppendLine().AppendLine("// Revoke with event_token"); - buf.AppendLine($"void {apiName}(event_token const* cookie) const;"); + buf.AppendLine($"{modifiers}void {apiName}(event_token const* cookie) const;"); buf.AppendLine().AppendLine("// Revoke with event_revoker"); - buf.Append($"{rtnAutoEventRevoker}_revoker {apiName}(auto_revoke_t, {typeName} const& handler) const;"); + buf.Append($"{modifiers}{rtnAutoEventRevoker}_revoker {apiName}(auto_revoke_t, {typeName} const& handler) const;"); return buf.ToString().Replace("\r\n", "\n"); } diff --git a/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AquariumFilter.xml b/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AquariumFilter.xml index fa35c654..7570f37a 100644 --- a/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AquariumFilter.xml +++ b/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AquariumFilter.xml @@ -47,7 +47,7 @@ - + Property 1.0.0.0 diff --git a/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml b/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml index 5bcdd0d4..684fa0f4 100644 --- a/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml +++ b/mdoc/Test/en.expected-attached-entities/AttachedEventsAndProperties/AttachedPropertyExample.xml @@ -174,7 +174,7 @@ - + Property 1.0.0.0 -- cgit v1.2.3 From 3bea0de737ee82cbc9ca92fe3bf524a577e5e378 Mon Sep 17 00:00:00 2001 From: Jeff Chen <59190910+JeffInChrist@users.noreply.github.com> Date: Fri, 7 May 2021 05:18:03 +0800 Subject: Updating the Windows metadata files with the latest version and fixed a minor issue in the cpp formatter (#551) Co-authored-by: @anmeng10101 <33647870+anmeng10101@users.noreply.github.com> --- .../CppFormatters/CppFullMemberFormatter.cs | 5 ----- mdoc/mdoc.Test/CppCxFormatterMembersTests.cs | 23 ++++++++++++++++++++++ mdoc/mdoc.Test/CppWinRtMembersTests.cs | 23 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs index 7eede39d..9bb44003 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CppFormatters/CppFullMemberFormatter.cs @@ -112,11 +112,6 @@ namespace Mono.Documentation.Updater.Formatters.CppFormatters string typeFullName = type.FullName; if (string.IsNullOrWhiteSpace (typeFullName)) return buf; - - if (!typeFullName.StartsWith ("System.")) - { - return base.AppendTypeName(buf, type, context); - } string cppType = GetCppType(typeFullName); if (cppType != null) diff --git a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs index d9fe24cd..c41cb572 100644 --- a/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs +++ b/mdoc/mdoc.Test/CppCxFormatterMembersTests.cs @@ -12,6 +12,7 @@ namespace mdoc.Test { protected override CppCxFullMemberFormatter formatter { get; } = new CppCxFullMemberFormatter(); + private string _cppWinRtTestLibName = "../../../../external/Windows/Windows.Foundation.UniversalApiContract.winmd"; private const string CppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd"; private const string CSharpTestLib = "../../../../external/Test/CSharpExample.dll"; @@ -92,6 +93,13 @@ namespace mdoc.Test TestFieldSignature(CppCxTestLibName, "UwpTestWinRtComponentCpp.Color1", "Red", "Red"); } + [Test] + [Category("Field")] + public void Field_WinRtNumericsPlaneNormal() + { + TestFieldSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Plane", "Normal", "public: float3 Normal;"); + } + [Test] [Category("Field")] public void Field_ValueType_String() @@ -107,6 +115,21 @@ namespace mdoc.Test event UwpTestWinRtComponentCpp::PrimeFoundHandler ^ primeFoundEvent;"); } + [Test] + [Category("Properties")] + public void Property_WinRtNumericsActualSize() + { + TestPropertySignature(_cppWinRtTestLibName, "Windows.UI.Xaml.UIElement", "ActualSize", "public:\n property float2 ActualSize { float2 get(); };"); + } + + [Test] + [Category("Properties")] + public void Property_WinRtNumericsTransformMatrix() + { + TestPropertySignature(_cppWinRtTestLibName, "Windows.UI.Xaml.UIElement", "TransformMatrix", + "public:\n property float4x4 TransformMatrix { float4x4 get(); void set(float4x4 value); };"); + } + [Test] [Category("Properties")] public void Property_FundamentalType() diff --git a/mdoc/mdoc.Test/CppWinRtMembersTests.cs b/mdoc/mdoc.Test/CppWinRtMembersTests.cs index cd0f34a1..3711e8f8 100644 --- a/mdoc/mdoc.Test/CppWinRtMembersTests.cs +++ b/mdoc/mdoc.Test/CppWinRtMembersTests.cs @@ -12,6 +12,7 @@ namespace mdoc.Test private static readonly CppWinRtFullMemberFormatter CppWinRtFullMemberFormatter = new CppWinRtFullMemberFormatter(); protected override CppWinRtFullMemberFormatter formatter => CppWinRtFullMemberFormatter; + private string _cppWinRtTestLibName = "../../../../external/Windows/Windows.Foundation.UniversalApiContract.winmd"; private string CppCxTestLibName = "../../../../external/Test/UwpTestWinRtComponentCpp.winmd"; private const string CSharpTestLib = "../../../../external/Test/CSharpExample.dll"; @@ -80,6 +81,28 @@ namespace mdoc.Test @"void SetWindow(winrt::Windows::UI::Core::CoreWindow const& window);"); } + [Test] + [Category("Properties")] + public void Property_WinRtNumericsActualSize() + { + TestPropertySignature(_cppWinRtTestLibName, "Windows.UI.Xaml.UIElement", "ActualSize", "float2 ActualSize();"); + } + + [Test] + [Category("Properties")] + public void Property_WinRtNumericsTransformMatrix() + { + TestPropertySignature(_cppWinRtTestLibName, "Windows.UI.Xaml.UIElement", "TransformMatrix", + "float4x4 TransformMatrix();\n\nvoid TransformMatrix(float4x4 value);"); + } + + [Test] + [Category("Fields")] + public void Field_WinRtNumericsPlaneNormal() + { + TestFieldSignature(_cppWinRtTestLibName, "Windows.Foundation.Numerics.Plane", "Normal", "float3 Normal;"); + } + [Test] [Category("Fields")] public void FieldSignature_ConstLong() => -- cgit v1.2.3 From 7e1fce3517284c56966d516ce5c7c0332ee8d7d5 Mon Sep 17 00:00:00 2001 From: Ann Meng Date: Fri, 7 May 2021 13:56:03 +0800 Subject: bump to 5.8.3 --- mdoc/Consts.cs | 2 +- mdoc/mdoc.nuspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'mdoc') diff --git a/mdoc/Consts.cs b/mdoc/Consts.cs index a77b295e..2453363d 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.2"; + public static string MonoVersion = "5.8.3"; public const string DocId = "DocId"; public const string CppCli = "C++ CLI"; public const string CppCx = "C++ CX"; diff --git a/mdoc/mdoc.nuspec b/mdoc/mdoc.nuspec index 6adf740b..770a36a5 100644 --- a/mdoc/mdoc.nuspec +++ b/mdoc/mdoc.nuspec @@ -2,7 +2,7 @@ mdoc - 5.8.2 + 5.8.3 mdoc Microsoft Microsoft -- cgit v1.2.3