Imported Upstream version 5.18.0.142

Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-09 08:20:59 +00:00
parent e52655b4dc
commit 0abdbe5a7d
1547 changed files with 93792 additions and 47893 deletions

View File

@ -31,9 +31,9 @@ using System.Reflection;
using System.Text;
using System.Xml.Linq;
namespace Xamarin.ApiDiff {
namespace Mono.ApiTools {
public static class Helper {
static class Helper {
public static bool IsTrue (this XElement self, string name)
{
return (self.GetAttribute (name) == "true");
@ -92,7 +92,7 @@ namespace Xamarin.ApiDiff {
}
// make it beautiful (.NET -> C#)
public static string GetTypeName (this XElement self, string name)
public static string GetTypeName (this XElement self, string name, State state)
{
string type = self.GetAttribute (name);
if (type == null)
@ -121,7 +121,7 @@ namespace Xamarin.ApiDiff {
if (is_pointer)
sb.Remove (sb.Length - 1, 1);
type = GetTypeName (sb.Replace ('+', '.').ToString ());
type = GetTypeName (sb.Replace ('+', '.').ToString (), state);
sb.Length = 0;
if (is_ref)
sb.Append (self.GetAttribute ("direction")).Append (' ');
@ -137,13 +137,13 @@ namespace Xamarin.ApiDiff {
return sb.ToString ();
}
static string GetTypeName (string type)
static string GetTypeName (string type, State state)
{
int pos = type.IndexOf ('`');
if (pos >= 0) {
int end = type.LastIndexOf (']');
string subtype = type.Substring (pos + 3, end - pos - 3);
return type.Substring (0, pos) + Formatter.Current.LesserThan + GetTypeName (subtype) + Formatter.Current.GreaterThan;
return type.Substring (0, pos) + state.Formatter.LesserThan + GetTypeName (subtype, state) + state.Formatter.GreaterThan;
}
switch (type) {
@ -180,14 +180,14 @@ namespace Xamarin.ApiDiff {
case "System.nint":
return "nint";
case "System.nuint":
return "uint";
return "nuint";
case "System.nfloat":
return "nfloat";
case "System.IntPtr":
return "IntPtr";
default:
if (type.StartsWith (State.Namespace, StringComparison.Ordinal))
type = type.Substring (State.Namespace.Length + 1);
if (type.StartsWith (state.Namespace, StringComparison.Ordinal))
type = type.Substring (state.Namespace.Length + 1);
return type;
}
}