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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorJérémie Laval <jeremie.laval@gmail.com>2013-03-23 19:01:03 +0400
committerJérémie Laval <jeremie.laval@gmail.com>2013-03-23 19:01:03 +0400
commitba43a5ae56101d2e9c8a531d1639e0dfa966467a (patch)
treeffc43059a53d974dfa49f9ecc730f5b7d0a48b97 /mcs
parent75faf4d8974e385d1260fd80df68bf49cbda7cfb (diff)
[monodoc] Add utility property Generic*IsNumeric to distinguish between types using full generic notation (e.g. Foo<T1, T2>) or just backtick notation (e.g. Foo`2)
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs15
-rw-r--r--mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs10
2 files changed, 25 insertions, 0 deletions
diff --git a/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs b/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs
index 0974b07adf1..5f4349609ac 100644
--- a/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs
+++ b/mcs/class/monodoc/Monodoc.Ecma/EcmaDesc.cs
@@ -86,11 +86,26 @@ namespace Monodoc.Ecma
set;
}
+ /* This property tells if the above collections only correct value
+ * is the number of item in it to represent generic arguments
+ */
+ public bool GenericTypeArgumentsIsNumeric {
+ get {
+ return GenericTypeArguments != null && GenericTypeArguments.FirstOrDefault () == null;
+ }
+ }
+
public IList<EcmaDesc> GenericMemberArguments {
get;
set;
}
+ public bool GenericMemberArgumentsIsNumeric {
+ get {
+ return GenericMemberArguments != null && GenericMemberArguments.FirstOrDefault () == null;
+ }
+ }
+
public IList<EcmaDesc> MemberArguments {
get;
set;
diff --git a/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs b/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs
index a16d7c59587..e6872f2ca5d 100644
--- a/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs
+++ b/mcs/class/monodoc/Test/Monodoc.Ecma/EcmaUrlTests.cs
@@ -183,6 +183,16 @@ namespace MonoTests.Monodoc.Ecma
}
[Test]
+ public void GenericTypeArgsIsNumericTest ()
+ {
+ var desc = parser.Parse ("T:System.Collections.Generic.Dictionary`2");
+ Assert.IsTrue (desc.GenericTypeArgumentsIsNumeric);
+ Assert.AreEqual (2, desc.GenericTypeArguments.Count);
+ desc = parser.Parse ("T:System.Collections.Generic.Dictionary<TKey,TValue>");
+ Assert.IsFalse (desc.GenericTypeArgumentsIsNumeric);
+ }
+
+ [Test]
public void MetaEtcNodeTest ()
{
var ast = new EcmaDesc () { DescKind = EcmaDesc.Kind.Type,