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:
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/corlib/ReferenceSources/Type.cs21
-rw-r--r--mcs/class/corlib/System/TypeSpec.cs4
2 files changed, 12 insertions, 13 deletions
diff --git a/mcs/class/corlib/ReferenceSources/Type.cs b/mcs/class/corlib/ReferenceSources/Type.cs
index a77d734c366..664782b1706 100644
--- a/mcs/class/corlib/ReferenceSources/Type.cs
+++ b/mcs/class/corlib/ReferenceSources/Type.cs
@@ -43,22 +43,12 @@ namespace System
public static Type GetType(string typeName)
{
- if (typeName == null)
- throw new ArgumentNullException ("TypeName");
-
- return internal_from_name (typeName, false, false);
+ return GetType (typeName, false, false);
}
public static Type GetType(string typeName, bool throwOnError)
{
- if (typeName == null)
- throw new ArgumentNullException ("TypeName");
-
- Type type = internal_from_name (typeName, throwOnError, false);
- if (throwOnError && type == null)
- throw new TypeLoadException ("Error loading '" + typeName + "'");
-
- return type;
+ return GetType (typeName, throwOnError, false);
}
public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
@@ -66,6 +56,11 @@ namespace System
if (typeName == null)
throw new ArgumentNullException ("TypeName");
+ if (typeName == String.Empty)
+ if (throwOnError)
+ throw new TypeLoadException ("A null or zero length string does not represent a valid Type.");
+ else
+ return null;
Type t = internal_from_name (typeName, throwOnError, ignoreCase);
if (throwOnError && t == null)
throw new TypeLoadException ("Error loading '" + typeName + "'");
@@ -82,6 +77,8 @@ namespace System
{
if (typeName == null)
throw new ArgumentNullException ("typeName");
+ if (typeName == String.Empty && throwIfNotFound)
+ throw new TypeLoadException ("A null or zero length string does not represent a valid Type");
int idx = typeName.IndexOf (',');
if (idx < 0 || idx == 0 || idx == typeName.Length - 1)
throw new ArgumentException ("Assembly qualifed type name is required", "typeName");
diff --git a/mcs/class/corlib/System/TypeSpec.cs b/mcs/class/corlib/System/TypeSpec.cs
index f233bec088e..4436a77810f 100644
--- a/mcs/class/corlib/System/TypeSpec.cs
+++ b/mcs/class/corlib/System/TypeSpec.cs
@@ -455,7 +455,9 @@ namespace System {
}
if (name_start < pos)
- data.AddName (name.Substring (name_start, pos - name_start));
+ data.AddName (name.Substring (name_start, pos - name_start));
+ else if (name_start == pos)
+ data.AddName (String.Empty);
if (in_modifiers) {
for (; pos < name.Length; ++pos) {