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

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Martinez <joelmartinez@gmail.com>2017-10-27 21:11:40 +0300
committerJoel Martinez <joelmartinez@gmail.com>2017-10-27 22:06:00 +0300
commit412a78bc068984b33a2976a2d9f048077c183215 (patch)
treeef2245855fc74b9663a25eecc38079652d9eb9dd
parent795fb3341c643f187db0626e1f09229e2ce4acb1 (diff)
mdoc: EII events are now documented.
Closes #106
-rw-r--r--mdoc/Consts.cs2
-rw-r--r--mdoc/Makefile2
-rw-r--r--mdoc/Mono.Documentation/MDocUpdater.cs20
-rw-r--r--mdoc/Mono.Documentation/Updater/DocUtils.cs15
-rw-r--r--mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs5
-rw-r--r--mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs2
-rw-r--r--mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs16
-rw-r--r--mdoc/Test/DocTest-InternalInterface.cs12
-rw-r--r--mdoc/Test/en.expected-internal-interface/MyNamespace/MyClass.xml40
-rw-r--r--mdoc/Test/en.expected-internal-interface/MyNamespace/MyPublicInterface.xml30
-rw-r--r--mdoc/Test/en.expected-internal-interface/index.xml1
-rw-r--r--mdoc/mdoc.nuspec2
-rw-r--r--monodoc/Makefile1
13 files changed, 126 insertions, 22 deletions
diff --git a/mdoc/Consts.cs b/mdoc/Consts.cs
index 145ce877..3f721a2b 100644
--- a/mdoc/Consts.cs
+++ b/mdoc/Consts.cs
@@ -3,6 +3,6 @@ namespace Mono.Documentation
{
public static class Consts
{
- public static string MonoVersion = "5.1.1.0";
+ public static string MonoVersion = "5.2.0.0";
}
}
diff --git a/mdoc/Makefile b/mdoc/Makefile
index a8e4022b..7cec2399 100644
--- a/mdoc/Makefile
+++ b/mdoc/Makefile
@@ -540,4 +540,4 @@ check-doc-tools-update: check-monodocer-since-update \
check-mdoc-validate-update
check: nunit check-doc-tools
-
+ @echo "mdoc Tests Complete!"
diff --git a/mdoc/Mono.Documentation/MDocUpdater.cs b/mdoc/Mono.Documentation/MDocUpdater.cs
index 31eebf9e..a3709962 100644
--- a/mdoc/Mono.Documentation/MDocUpdater.cs
+++ b/mdoc/Mono.Documentation/MDocUpdater.cs
@@ -1104,19 +1104,10 @@ namespace Mono.Documentation
throw new ArgumentException ("Unknown kind for type: " + type.FullName);
}
+ [Obsolete("Use DocUtils.IsPublic instead")]
public static bool IsPublic (TypeDefinition type)
{
- TypeDefinition decl = type;
- while (decl != null)
- {
- if (!(decl.IsPublic || decl.IsNestedPublic ||
- decl.IsNestedFamily || decl.IsNestedFamily || decl.IsNestedFamilyOrAssembly))
- {
- return false;
- }
- decl = (TypeDefinition)decl.DeclaringType;
- }
- return true;
+ return DocUtils.IsPublic (type);
}
private void CleanupFiles (string dest, HashSet<string> goodfiles)
@@ -1451,6 +1442,11 @@ namespace Mono.Documentation
var prop = m as PropertyDefinition;
methdef = prop.GetMethod ?? prop.SetMethod;
}
+ else if (m is EventDefinition)
+ {
+ var ev = m as EventDefinition;
+ methdef = ev.AddMethod ?? ev.RemoveMethod;
+ }
if (methdef != null)
{
@@ -1460,7 +1456,7 @@ namespace Mono.Documentation
if (methdef.Overrides.Count == 1 && !methdef.IsPublic)
{
DocUtils.GetInfoForExplicitlyImplementedMethod (methdef, out iface, out imethod);
- if (!IsPublic (iface.Resolve ())) return false;
+ if (!DocUtils.IsPublic (iface.Resolve ())) return false;
}
}
diff --git a/mdoc/Mono.Documentation/Updater/DocUtils.cs b/mdoc/Mono.Documentation/Updater/DocUtils.cs
index c171126c..ff96c446 100644
--- a/mdoc/Mono.Documentation/Updater/DocUtils.cs
+++ b/mdoc/Mono.Documentation/Updater/DocUtils.cs
@@ -132,6 +132,21 @@ namespace Mono.Documentation.Updater
ifaceMethod = method.Overrides[0];
}
+ public static bool IsPublic (TypeDefinition type)
+ {
+ TypeDefinition decl = type;
+ while (decl != null)
+ {
+ if (!(decl.IsPublic || decl.IsNestedPublic ||
+ decl.IsNestedFamily || decl.IsNestedFamily || decl.IsNestedFamilyOrAssembly))
+ {
+ return false;
+ }
+ decl = (TypeDefinition)decl.DeclaringType;
+ }
+ return true;
+ }
+
public static string GetPropertyName (PropertyDefinition pi)
{
// Issue: (g)mcs-generated assemblies that explicitly implement
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
index 5e89539d..7593a4b3 100644
--- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
+++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs
@@ -642,14 +642,15 @@ namespace Mono.Documentation.Updater
protected override string GetEventDeclaration (EventDefinition e)
{
StringBuilder buf = new StringBuilder ();
- if (AppendVisibility (buf, e.AddMethod).Length == 0)
+
+ if (AppendVisibility (buf, e.AddMethod).Length == 0 && !IsPublicEII (e))
{
return null;
}
AppendModifiers (buf, e.AddMethod);
- buf.Append (" event ");
+ buf.Append (buf.Length == 0 ? "event " : " event ");
buf.Append (GetTypeName (e.EventType, new DynamicParserContext (e.AddMethod.Parameters[0]))).Append (' ');
buf.Append (e.Name).Append (';');
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs
index bd21c204..eba9750b 100644
--- a/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs
+++ b/mdoc/Mono.Documentation/Updater/Formatters/ILFullMemberFormatter.cs
@@ -556,7 +556,7 @@ namespace Mono.Documentation.Updater
protected override string GetEventDeclaration (EventDefinition e)
{
StringBuilder buf = new StringBuilder ();
- if (AppendVisibility (buf, e.AddMethod).Length == 0)
+ if (AppendVisibility (buf, e.AddMethod).Length == 0 && !IsPublicEII (e))
{
return null;
}
diff --git a/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs
index 98cd0d4d..1e7245eb 100644
--- a/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs
+++ b/mdoc/Mono.Documentation/Updater/Formatters/MemberFormatter.cs
@@ -417,5 +417,21 @@ namespace Mono.Documentation.Updater
{
return GetEventName (e);
}
+
+ protected static bool IsPublicEII (EventDefinition e)
+ {
+ bool isPublicEII = false;
+ if (e.AddMethod.HasOverrides)
+ {
+ var resolvedAddMethod = e.AddMethod.Overrides[0].Resolve ();
+ var resolvedInterface = e.AddMethod.Overrides[0].DeclaringType.Resolve ();
+ if (DocUtils.IsPublic (resolvedInterface) && resolvedAddMethod != null && resolvedAddMethod.IsPublic)
+ {
+ isPublicEII = true;
+ }
+ }
+
+ return isPublicEII;
+ }
}
} \ No newline at end of file
diff --git a/mdoc/Test/DocTest-InternalInterface.cs b/mdoc/Test/DocTest-InternalInterface.cs
index 34e13b1f..4a0573ee 100644
--- a/mdoc/Test/DocTest-InternalInterface.cs
+++ b/mdoc/Test/DocTest-InternalInterface.cs
@@ -1,12 +1,18 @@
+using System;
+
namespace MyNamespace {
internal interface MyInternalInterface {
bool Foo {get;set;}
string FooSet {set;}
void FooMeth ();
void BarMeth ();
+ event EventHandler<string> InternalEvent;
+ }
+ public interface MyPublicInterface {
+ event EventHandler<string> PublicEvent;
}
- public class MyClass : MyInternalInterface {
+ public class MyClass : MyInternalInterface, MyPublicInterface {
[System.ComponentModel.DefaultValue ('\0')]
public string Bar {get;set;}
public void BarMeth () {} // part of the interface, but publicly implemented
@@ -14,6 +20,10 @@ namespace MyNamespace {
string MyInternalInterface.FooSet {set {}}
bool MyInternalInterface.Foo {get;set;}
void MyInternalInterface.FooMeth () {}
+
+ event EventHandler<string> MyPublicInterface.PublicEvent {add{}remove{}}
+ event EventHandler<string> MyInternalInterface.InternalEvent {add{}remove{}}
+ public event EventHandler<int> InstanceEvent {add{}remove{}}
}
public static class ArrayX10 {
diff --git a/mdoc/Test/en.expected-internal-interface/MyNamespace/MyClass.xml b/mdoc/Test/en.expected-internal-interface/MyNamespace/MyClass.xml
index 4c9b81d2..b9e3a030 100644
--- a/mdoc/Test/en.expected-internal-interface/MyNamespace/MyClass.xml
+++ b/mdoc/Test/en.expected-internal-interface/MyNamespace/MyClass.xml
@@ -1,6 +1,6 @@
<Type Name="MyClass" FullName="MyNamespace.MyClass">
- <TypeSignature Language="C#" Value="public class MyClass" />
- <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MyClass extends System.Object" />
+ <TypeSignature Language="C#" Value="public class MyClass : MyNamespace.MyPublicInterface" />
+ <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MyClass extends System.Object implements class MyNamespace.MyPublicInterface" />
<AssemblyInfo>
<AssemblyName>DocTest-InternalInterface</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
@@ -8,7 +8,11 @@
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
- <Interfaces />
+ <Interfaces>
+ <Interface>
+ <InterfaceName>MyNamespace.MyPublicInterface</InterfaceName>
+ </Interface>
+ </Interfaces>
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
@@ -64,5 +68,35 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="InstanceEvent">
+ <MemberSignature Language="C#" Value="public event EventHandler&lt;int&gt; InstanceEvent;" />
+ <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1&lt;int32&gt; InstanceEvent" />
+ <MemberType>Event</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.EventHandler&lt;System.Int32&gt;</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="MyNamespace.MyPublicInterface.PublicEvent">
+ <MemberSignature Language="C#" Value="event EventHandler&lt;string&gt; MyNamespace.MyPublicInterface.PublicEvent;" />
+ <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1&lt;string&gt; MyNamespace.MyPublicInterface.PublicEvent" />
+ <MemberType>Event</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.EventHandler&lt;System.String&gt;</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
</Members>
</Type>
diff --git a/mdoc/Test/en.expected-internal-interface/MyNamespace/MyPublicInterface.xml b/mdoc/Test/en.expected-internal-interface/MyNamespace/MyPublicInterface.xml
new file mode 100644
index 00000000..3c7af2d5
--- /dev/null
+++ b/mdoc/Test/en.expected-internal-interface/MyNamespace/MyPublicInterface.xml
@@ -0,0 +1,30 @@
+<Type Name="MyPublicInterface" FullName="MyNamespace.MyPublicInterface">
+ <TypeSignature Language="C#" Value="public interface MyPublicInterface" />
+ <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract MyPublicInterface" />
+ <AssemblyInfo>
+ <AssemblyName>DocTest-InternalInterface</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Interfaces />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ <Members>
+ <Member MemberName="PublicEvent">
+ <MemberSignature Language="C#" Value="public event EventHandler&lt;string&gt; PublicEvent;" />
+ <MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1&lt;string&gt; PublicEvent" />
+ <MemberType>Event</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.EventHandler&lt;System.String&gt;</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ </Members>
+</Type>
diff --git a/mdoc/Test/en.expected-internal-interface/index.xml b/mdoc/Test/en.expected-internal-interface/index.xml
index 1f627c5a..fc89c868 100644
--- a/mdoc/Test/en.expected-internal-interface/index.xml
+++ b/mdoc/Test/en.expected-internal-interface/index.xml
@@ -17,6 +17,7 @@
<Namespace Name="MyNamespace">
<Type Name="ArrayX10" Kind="Class" />
<Type Name="MyClass" Kind="Class" />
+ <Type Name="MyPublicInterface" Kind="Interface" />
</Namespace>
</Types>
<Title>DocTest-InternalInterface</Title>
diff --git a/mdoc/mdoc.nuspec b/mdoc/mdoc.nuspec
index ffc627cc..57862828 100644
--- a/mdoc/mdoc.nuspec
+++ b/mdoc/mdoc.nuspec
@@ -2,7 +2,7 @@
<package >
<metadata>
<id>mdoc</id>
- <version>5.1.1.0</version>
+ <version>5.2.0.0</version>
<title>mdoc</title>
<authors>Joel Martinez</authors>
<owners>Xamarin</owners>
diff --git a/monodoc/Makefile b/monodoc/Makefile
index eb6989f9..4aeb820d 100644
--- a/monodoc/Makefile
+++ b/monodoc/Makefile
@@ -2,3 +2,4 @@ CONFIGURATION = Release
check:
mono ../packages/NUnit.ConsoleRunner.3.6.0/tools/nunit3-console.exe Test/bin/$(CONFIGURATION)/Monodoc.Test.dll
+ @echo "monodoc Tests Complete!"