Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@ -0,0 +1,114 @@
#if MOBILE
using System;
using System.Globalization;
namespace Microsoft.CSharp
{
internal class CodeDomProvider
{
public string CreateEscapedIdentifier (string name)
{
// Any identifier started with two consecutive underscores are
// reserved by CSharp.
if (IsKeyword(name) || IsPrefixTwoUnderscore(name)) {
return "@" + name;
}
return name;
}
static bool IsKeyword(string value) {
return false;
}
static bool IsPrefixTwoUnderscore(string value) {
if( value.Length < 3) {
return false;
}
else {
return ((value[0] == '_') && (value[1] == '_') && (value[2] != '_'));
}
}
}
internal class CSharpCodeProvider : CodeDomProvider
{
}
class CodeGenerator
{
public static bool IsValidLanguageIndependentIdentifier(string value)
{
return IsValidTypeNameOrIdentifier(value, false);
}
private static bool IsValidTypeNameOrIdentifier(string value, bool isTypeName) {
bool nextMustBeStartChar = true;
if (value.Length == 0)
return false;
// each char must be Lu, Ll, Lt, Lm, Lo, Nd, Mn, Mc, Pc
//
for(int i = 0; i < value.Length; i++) {
char ch = value[i];
UnicodeCategory uc = Char.GetUnicodeCategory(ch);
switch (uc) {
case UnicodeCategory.UppercaseLetter: // Lu
case UnicodeCategory.LowercaseLetter: // Ll
case UnicodeCategory.TitlecaseLetter: // Lt
case UnicodeCategory.ModifierLetter: // Lm
case UnicodeCategory.LetterNumber: // Lm
case UnicodeCategory.OtherLetter: // Lo
nextMustBeStartChar = false;
break;
case UnicodeCategory.NonSpacingMark: // Mn
case UnicodeCategory.SpacingCombiningMark: // Mc
case UnicodeCategory.ConnectorPunctuation: // Pc
case UnicodeCategory.DecimalDigitNumber: // Nd
// Underscore is a valid starting character, even though it is a ConnectorPunctuation.
if (nextMustBeStartChar && ch != '_')
return false;
nextMustBeStartChar = false;
break;
default:
// We only check the special Type chars for type names.
if (isTypeName && IsSpecialTypeChar(ch, ref nextMustBeStartChar)) {
break;
}
return false;
}
}
return true;
}
private static bool IsSpecialTypeChar(char ch, ref bool nextMustBeStartChar) {
switch(ch) {
case ':':
case '.':
case '$':
case '+':
case '<':
case '>':
case '-':
case '[':
case ']':
case ',':
case '&':
case '*':
nextMustBeStartChar = true;
return true;
case '`':
return true;
}
return false;
}
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
static class ThisAssembly
{
public const string Version = Consts.FxVersion;
}

View File

@ -0,0 +1,50 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Xml.Schema;
namespace System.Xml.Serialization
{
// from Types.cs
internal class TypeScope
{
static internal XmlQualifiedName ParseWsdlArrayType(string type, out string dims, XmlSchemaObject parent) {
string ns;
string name;
int nsLen = type.LastIndexOf(':');
if (nsLen <= 0) {
ns = "";
}
else {
ns = type.Substring(0, nsLen);
}
int nameLen = type.IndexOf('[', nsLen + 1);
if (nameLen <= nsLen) {
throw new InvalidOperationException(Res.GetString(Res.XmlInvalidArrayTypeSyntax, type));
}
name = type.Substring(nsLen + 1, nameLen - nsLen - 1);
dims = type.Substring(nameLen);
// parent is not null only in the case when we used XmlSchema.Read(),
// in which case we need to fixup the wsdl:arayType attribute value
while (parent != null) {
if (parent.Namespaces != null) {
string wsdlNs = (string)parent.Namespaces.Namespaces[ns];
if (wsdlNs != null) {
ns = wsdlNs;
break;
}
}
parent = parent.Parent;
}
return new XmlQualifiedName(name, ns);
}
}
}

View File

@ -0,0 +1,9 @@
namespace System.Xml.Serialization
{
internal class Wsdl {
private Wsdl() { }
internal const string Namespace = "http://schemas.xmlsoap.org/wsdl/";
internal const string ArrayType = "arrayType";
}
}