Imported Upstream version 4.4.0.122

Former-commit-id: a99f46acaeba3ab496c7afc02c29b839e30a0d0b
This commit is contained in:
Xamarin Public Jenkins
2016-04-12 13:19:31 -04:00
parent a632333cc7
commit d444f0caa4
118 changed files with 4121 additions and 1632 deletions

View File

@@ -96,11 +96,6 @@ namespace System
static Console ()
{
#if NET_2_1
Encoding inputEncoding;
Encoding outputEncoding;
#endif
if (Environment.IsRunningOnWindows) {
//
// On Windows, follow the Windows tradition
@@ -540,7 +535,6 @@ namespace System
#endif
#if !NET_2_1
// FIXME: Console should use these encodings when changed
static Encoding inputEncoding;
static Encoding outputEncoding;
@@ -561,6 +555,7 @@ namespace System
}
}
#if !NET_2_1
public static ConsoleColor BackgroundColor {
get { return ConsoleDriver.BackgroundColor; }
set { ConsoleDriver.BackgroundColor = value; }

View File

@@ -218,7 +218,7 @@ namespace System {
if (typeName == null)
throw new ArgumentNullException ("typeName");
TypeSpec res = Parse (typeName, ref pos, false, false);
TypeSpec res = Parse (typeName, ref pos, false, true);
if (pos < typeName.Length)
throw new ArgumentException ("Count not parse the whole type name", "typeName");
return res;
@@ -287,7 +287,7 @@ namespace System {
{
Assembly asm = null;
if (assemblyResolver == null && typeResolver == null)
return Type.GetType (name.DisplayName, throwOnError, ignoreCase);
return Type.GetType (DisplayFullName, throwOnError, ignoreCase);
if (assembly_name != null) {
if (assemblyResolver != null)
@@ -376,6 +376,12 @@ namespace System {
pos = p;
}
static void BoundCheck (int idx, string s)
{
if (idx >= s.Length)
throw new ArgumentException ("Invalid generic arguments spec", "typeName");
}
static TypeIdentifier ParsedTypeIdentifier (string displayName)
{
return TypeIdentifiers.FromDisplay(displayName);
@@ -383,6 +389,17 @@ namespace System {
static TypeSpec Parse (string name, ref int p, bool is_recurse, bool allow_aqn)
{
// Invariants:
// - On exit p, is updated to pos the current unconsumed character.
//
// - The callee peeks at but does not consume delimiters following
// recurisve parse (so for a recursive call like the args of "Foo[P,Q]"
// we'll return with p either on ',' or on ']'. If the name was aqn'd
// "Foo[[P,assmblystuff],Q]" on return p with be on the ']' just
// after the "assmblystuff")
//
// - If allow_aqn is True, assembly qualification is optional.
// If allow_aqn is False, assembly qualification is prohibited.
int pos = p;
int name_start;
bool in_modifiers = false;
@@ -450,18 +467,24 @@ namespace System {
data.AddModifier (new PointerSpec(pointer_level));
break;
case ',':
if (is_recurse) {
if (is_recurse && allow_aqn) {
int end = pos;
while (end < name.Length && name [end] != ']')
++end;
if (end >= name.Length)
throw new ArgumentException ("Unmatched ']' while parsing generic argument assembly name");
data.assembly_name = name.Substring (pos + 1, end - pos - 1).Trim ();
p = end + 1;
p = end;
return data;
}
data.assembly_name = name.Substring (pos + 1).Trim ();
pos = name.Length;
if (is_recurse) {
p = pos;
return data;
}
if (allow_aqn) {
data.assembly_name = name.Substring (pos + 1).Trim ();
pos = name.Length;
}
break;
case '[':
if (data.is_byref)
@@ -482,11 +505,17 @@ namespace System {
if (aqn)
++pos; //skip '[' to the start of the type
args.Add (Parse (name, ref pos, true, aqn));
if (pos >= name.Length)
throw new ArgumentException ("Invalid generic arguments spec", "typeName");
BoundCheck (pos, name);
if (aqn) {
if (name [pos] == ']')
++pos;
else
throw new ArgumentException ("Unclosed assembly-qualified type name at " + name[pos], "typeName");
BoundCheck (pos, name);
}
if (name [pos] == ']')
break;
break;
if (name [pos] == ',')
++pos; // skip ',' to the start of the next arg
else
@@ -523,7 +552,7 @@ namespace System {
break;
case ']':
if (is_recurse) {
p = pos + 1;
p = pos;
return data;
}
throw new ArgumentException ("Unmatched ']'", "typeName");