SHA256
1
0
forked from pool/mono-core
mono-core/mcs-compatibility-fix.patch

321 lines
17 KiB
Diff
Raw Normal View History

diff -uprN mono-5.4.0.201.old/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs mono-5.4.0.201/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs
--- mono-5.4.0.201.old/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs 2017-10-17 21:13:18.835702962 +0300
@@ -33,8 +33,9 @@ namespace Microsoft.CSharp.RuntimeBinder
Expr exprCur = expr;
while (exprCur != null)
{
- if (exprCur is ExprList list)
+ if (exprCur is ExprList)
{
+ var list = (ExprList)exprCur;
yield return list.OptionalElement;
exprCur = list.OptionalNextListNode;
}
@@ -61,12 +62,12 @@ namespace Microsoft.CSharp.RuntimeBinder
}
public static bool isNull(this Expr expr)
{
- return expr is ExprConstant constant && constant.IsOK && (expr.Type.fundType() == FUNDTYPE.FT_REF) && constant.Val.IsNullRef;
+ return expr is ExprConstant && ((ExprConstant)expr).IsOK && (expr.Type.fundType() == FUNDTYPE.FT_REF) && ((ExprConstant)expr).Val.IsNullRef;
}
public static bool IsZero(this Expr expr)
{
- return expr is ExprConstant constant && constant.IsOK && constant.IsZero;
+ return expr is ExprConstant && ((ExprConstant)expr).IsOK && ((ExprConstant)expr).IsZero;
}
private static Expr GetSeqVal(this Expr expr)
diff -uprN mono-5.4.0.201.old/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs mono-5.4.0.201/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs
--- mono-5.4.0.201.old/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs 2017-10-17 20:53:01.339702962 +0300
@@ -29,8 +29,9 @@ namespace Microsoft.CSharp.RuntimeBinder
{
Debug.Assert(expr != null);
- if (expr is ExprCall pCall && pCall.MemberGroup.OptionalObject == null)
+ if (expr is ExprCall && ((ExprCall)expr).MemberGroup.OptionalObject == null)
{
+ var pCall = (ExprCall)expr;
MethodSymbol meth = pCall.MethWithInst.Meth();
if (meth != null && meth.IsNullableConstructor())
{
@@ -45,7 +46,8 @@ namespace Microsoft.CSharp.RuntimeBinder
public static Expr StripNullableConstructor(Expr pExpr)
{
- while (IsNullableConstructor(pExpr, out ExprCall call))
+ ExprCall call;
+ while (IsNullableConstructor(pExpr, out call))
{
pExpr = call.OptionalArguments;
Debug.Assert(pExpr != null && !(pExpr is ExprList));
@@ -60,7 +62,8 @@ namespace Microsoft.CSharp.RuntimeBinder
Debug.Assert(exprSrc != null && exprSrc.Type.IsNullableType());
// For new T?(x), the answer is x.
- if (IsNullableConstructor(exprSrc, out ExprCall call))
+ ExprCall call;
+ if (IsNullableConstructor(exprSrc, out call))
{
var args = call.OptionalArguments;
Debug.Assert(args != null && !(args is ExprList));
diff -uprN mono-5.4.0.201.old/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs mono-5.4.0.201/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs
--- mono-5.4.0.201.old/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs 2017-10-17 17:12:55.639702962 +0300
@@ -352,7 +352,7 @@ namespace System.Collections.Generic
throw new PlatformNotSupportedException();
}
- protected override void OnDeserialization(Object sender) => throw new PlatformNotSupportedException();
+ protected override void OnDeserialization(Object sender) { throw new PlatformNotSupportedException(); }
}
}
}
diff -uprN mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs
--- mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs 2017-10-17 19:28:46.291702962 +0300
@@ -65,7 +65,8 @@ namespace System.Dynamic.Utils
internal static ParameterInfo[] GetParametersCached(this MethodBase method)
{
CacheDict<MethodBase, ParameterInfo[]> pic = s_paramInfoCache;
- if (!pic.TryGetValue(method, out ParameterInfo[] pis))
+ ParameterInfo[] pis;
+ if (!pic.TryGetValue(method, out pis))
{
pis = method.GetParameters();
diff -uprN mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs
--- mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs 2017-10-17 19:42:26.615702962 +0300
@@ -952,8 +952,9 @@ namespace System.Linq.Expressions.Compil
private void EmitMemberAssignment(MemberAssignment binding, Type objectType)
{
EmitExpression(binding.Expression);
- if (binding.Member is FieldInfo fi)
+ if (binding.Member is FieldInfo)
{
+ var fi = (FieldInfo)binding.Member;
_ilg.Emit(OpCodes.Stfld, fi);
}
else
@@ -1097,7 +1098,7 @@ namespace System.Linq.Expressions.Compil
private static Type GetMemberType(MemberInfo member)
{
Debug.Assert(member is FieldInfo || member is PropertyInfo);
- return member is FieldInfo fi ? fi.FieldType : (member as PropertyInfo).PropertyType;
+ return member is FieldInfo ? ((FieldInfo)member).FieldType : (member as PropertyInfo).PropertyType;
}
#endregion
diff -uprN mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs
--- mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberAssignment.cs 2017-10-17 19:35:40.931702962 +0300
@@ -93,24 +93,24 @@ namespace System.Linq.Expressions
// Null paramName as there are two paths here with different parameter names at the API
TypeUtils.ValidateType(decType, null);
- switch (member)
- {
- case PropertyInfo pi:
- if (!pi.CanWrite)
- {
- throw Error.PropertyDoesNotHaveSetter(pi, nameof(member));
- }
-
- memberType = pi.PropertyType;
- break;
-
- case FieldInfo fi:
- memberType = fi.FieldType;
- break;
-
- default:
- throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member));
- }
+ if (member is PropertyInfo)
+ {
+ var pi = (PropertyInfo)member;
+ if (!pi.CanWrite)
+ {
+ throw Error.PropertyDoesNotHaveSetter(pi, nameof(member));
+ }
+ memberType = pi.PropertyType;
+ }
+ else if (member is FieldInfo)
+ {
+ var fi = (FieldInfo)member;
+ memberType = fi.FieldType;
+ }
+ else
+ {
+ throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member));
+ }
}
}
}
diff -uprN mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs
--- mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberBinding.cs 2017-10-17 19:36:39.243702962 +0300
@@ -61,6 +61,6 @@ namespace System.Linq.Expressions
return ExpressionStringBuilder.MemberBindingToString(this);
}
- internal virtual void ValidateAsDefinedHere(int index) => throw Error.UnknownBindingType(index);
+ internal virtual void ValidateAsDefinedHere(int index) { throw Error.UnknownBindingType(index); }
}
}
diff -uprN mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs
--- mono-5.4.0.201.old/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs 2017-10-04 18:31:23.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberMemberBinding.cs 2017-10-17 19:39:08.035702962 +0300
@@ -127,24 +127,24 @@ namespace System.Linq.Expressions
// Null paramName as there are several paths here with different parameter names at the API
TypeUtils.ValidateType(decType, null, allowByRef: true, allowPointer: true);
- switch (member)
- {
- case PropertyInfo pi:
- if (!pi.CanRead)
- {
- throw Error.PropertyDoesNotHaveGetter(pi, nameof(member));
- }
-
- memberType = pi.PropertyType;
- break;
-
- case FieldInfo fi:
- memberType = fi.FieldType;
- break;
-
- default:
- throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member));
- }
+ if (member is PropertyInfo)
+ {
+ var pi = (PropertyInfo)member;
+ if (!pi.CanRead)
+ {
+ throw Error.PropertyDoesNotHaveGetter(pi, nameof(member));
+ }
+ memberType = pi.PropertyType;
+ }
+ else if (member is FieldInfo)
+ {
+ var fi = (FieldInfo)member;
+ memberType = fi.FieldType;
+ }
+ else
+ {
+ throw Error.ArgumentMustBeFieldInfoOrPropertyInfo(nameof(member));
+ }
}
private static void ValidateMemberInitArgs(Type type, ReadOnlyCollection<MemberBinding> bindings)
diff -uprN mono-5.4.0.201.old/external/corefx/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs mono-5.4.0.201/external/corefx/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs
--- mono-5.4.0.201.old/external/corefx/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs 2017-10-04 18:31:24.000000000 +0300
+++ mono-5.4.0.201/external/corefx/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs 2017-10-17 17:17:31.687702962 +0300
@@ -94,8 +94,9 @@ namespace System.Net.WebSockets
if (!(user is WindowsPrincipal))
{
// AuthenticationSchemes.Basic.
- if (user.Identity is HttpListenerBasicIdentity basicIdentity)
+ if (user.Identity is HttpListenerBasicIdentity)
{
+ var basicIdentity=(HttpListenerBasicIdentity)user.Identity;
return new GenericPrincipal(new HttpListenerBasicIdentity(basicIdentity.Name, basicIdentity.Password), null);
}
}
diff -uprN mono-5.4.0.201.old/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs mono-5.4.0.201/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs
--- mono-5.4.0.201.old/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs 2017-10-04 18:30:40.000000000 +0300
+++ mono-5.4.0.201/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs 2017-10-17 19:11:21.963702962 +0300
@@ -316,7 +316,7 @@ namespace Mono.Net.Security
{
Debug ("ProcessRead - read user: {0} {1}", this, status);
- var (ret, wantMore) = Parent.ProcessRead (UserBuffer);
+ int ret; bool wantMore; Parent.ProcessRead (UserBuffer, out ret, out wantMore);
Debug ("ProcessRead - read user done: {0} - {1} {2}", this, ret, wantMore);
@@ -355,7 +355,7 @@ namespace Mono.Net.Security
return AsyncOperationStatus.Complete;
}
- var (ret, wantMore) = Parent.ProcessWrite (UserBuffer);
+ int ret; bool wantMore; Parent.ProcessWrite(UserBuffer, out ret, out wantMore);
Debug ("ProcessWrite - write user done: {0} - {1} {2}", this, ret, wantMore);
diff -uprN mono-5.4.0.201.old/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs mono-5.4.0.201/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs
--- mono-5.4.0.201.old/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs 2017-10-04 18:30:40.000000000 +0300
+++ mono-5.4.0.201/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs 2017-10-17 19:11:27.267702962 +0300
@@ -403,7 +403,7 @@ namespace Mono.Net.Security
asyncReadRequest != null ? "async" : "",
readBuffer != null ? readBuffer.ToString () : "");
var asyncRequest = asyncHandshakeRequest ?? asyncReadRequest;
- var (ret, wantMore) = InternalRead (asyncRequest, readBuffer, buffer, offset, size);
+ int ret; bool wantMore; InternalRead (asyncRequest, readBuffer, buffer, offset, size, out ret, out wantMore);
outWantMore = wantMore;
return ret;
} catch (Exception ex) {
@@ -414,7 +414,7 @@ namespace Mono.Net.Security
}
}
- (int, bool) InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size)
+ void InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size, out int _ret, out bool _wantMore)
{
if (asyncRequest == null)
throw new InvalidOperationException ();
@@ -436,10 +436,10 @@ namespace Mono.Net.Security
Debug ("InternalRead #1: {0} {1} {2}", internalBuffer.Offset, internalBuffer.TotalBytes, size);
internalBuffer.Offset = internalBuffer.Size = 0;
asyncRequest.RequestRead (size);
- return (0, true);
+ _ret = 0; _wantMore = true; return;
}
- /*
+ /*Сабж. И чтобы гонка по кольцевым трассам. В третьи-четвёртые NFS наигрался, хочется новых трасс при схожем геймплее.
* The second time we're called, the native buffer will contain the exact amount of data that the
* previous call requested from us, so we should be able to return it all here. However, just in
* case that Apple's native function changed its mind, we can also return less.
@@ -451,7 +451,7 @@ namespace Mono.Net.Security
Buffer.BlockCopy (internalBuffer.Buffer, internalBuffer.Offset, buffer, offset, len);
internalBuffer.Offset += len;
internalBuffer.Size -= len;
- return (len, !internalBuffer.Complete && len < size);
+ _ret = len; _wantMore = !internalBuffer.Complete && len < size; return;
}
/*
@@ -620,21 +620,21 @@ namespace Mono.Net.Security
}
}
- internal (int, bool) ProcessRead (BufferOffsetSize userBuffer)
+ internal void ProcessRead (BufferOffsetSize userBuffer, out int _ret, out bool _wantMore)
{
lock (ioLock) {
// This operates on the internal buffer and will never block.
- var ret = xobileTlsContext.Read (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
- return (ret, wantMore);
+ _ret = xobileTlsContext.Read (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out _wantMore);
+ return;
}
}
- internal (int, bool) ProcessWrite (BufferOffsetSize userBuffer)
+ internal void ProcessWrite (BufferOffsetSize userBuffer, out int _ret, out bool _wantMore)
{
lock (ioLock) {
// This operates on the internal buffer and will never block.
- var ret = xobileTlsContext.Write (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
- return (ret, wantMore);
+ _ret = xobileTlsContext.Write (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out _wantMore);
+ return;
}
}