Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion mdoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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!"
7 changes: 5 additions & 2 deletions mdoc/Mono.Documentation/MDocUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ public override void Run (IEnumerable<string> args)
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;
FormatterManager.UpdateTypeMap(map);
Expand Down Expand Up @@ -4407,9 +4410,9 @@ private static string GetDocTypeName (TypeReference type, bool useTypeProjection
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)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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; } = "";
Expand Down Expand Up @@ -119,37 +120,9 @@ protected virtual string MakeNamedArgumentString(string name, string value)
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)
Expand Down
Loading