diff options
author | Joel Martinez <joelmartinez@gmail.com> | 2015-03-18 23:23:37 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2015-03-19 17:41:50 +0300 |
commit | 1e45f99905312fb6a8a27aed7ff28524b6183cf6 (patch) | |
tree | d26c179ce80cf3cd32665a3fccdac664df62b196 /mcs/class/monodoc | |
parent | 89882a67762b32a7cddafd4cbba09310de7bd54e (diff) |
[monodoc] Fixed issue generating EcmaCref URLs.
If you have a URL of the form ``T:System.Collections.Generic.Dictionary`2``, it parses correctly, but the `EcmaDesc` instance returned by the parser will throw an exception if you try to call the `.ToEcmaCref ()` method. This patch resolves this issue and returns a correctly formatted URL in this instance. Unit test included.
Diffstat (limited to 'mcs/class/monodoc')
-rw-r--r-- | mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs | 4 | ||||
-rw-r--r-- | mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs b/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs index 3d1e8c92c3f..ccf4b4bb12d 100644 --- a/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs +++ b/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs @@ -234,7 +234,9 @@ namespace Monodoc.Ecma sb.Append ('.'); sb.Append (TypeName); - if (GenericTypeArguments != null) { + if (GenericTypeArguments != null && GenericTypeArgumentsIsNumeric) { + sb.AppendFormat ("`{0}", GenericTypeArgumentsCount); + } else if (GenericTypeArguments != null) { sb.Append ('<'); int i=0; foreach (var t in GenericTypeArguments) { diff --git a/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs b/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs index e6872f2ca5d..1c8d44311e6 100644 --- a/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs +++ b/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs @@ -193,6 +193,17 @@ namespace MonoTests.Monodoc.Ecma } [Test] + public void GenericTypeArgsNumericToStringTest () + { + string stringCref = "T:System.Collections.Generic.Dictionary`2"; + var desc = parser.Parse (stringCref); + Assert.IsTrue (desc.GenericTypeArgumentsIsNumeric); + Assert.AreEqual (2, desc.GenericTypeArguments.Count); + string generatedEcmaCref = desc.ToEcmaCref (); + Assert.AreEqual (stringCref, generatedEcmaCref); + } + + [Test] public void MetaEtcNodeTest () { var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type, |