You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.395
Former-commit-id: bc4eb15577ba347ac08038f1ebaa41e253f5b948
This commit is contained in:
parent
006de68e1e
commit
693afccc61
@@ -93,8 +93,7 @@ namespace Microsoft.CSharp.RuntimeBinder
|
||||
module.SetDeclaringAssembly (temp);
|
||||
|
||||
var importer = new Compiler.ReflectionImporter (module, cc.BuiltinTypes) {
|
||||
IgnorePrivateMembers = false,
|
||||
IgnoreCompilerGeneratedField = false
|
||||
IgnorePrivateMembers = false
|
||||
};
|
||||
|
||||
// Import all currently loaded assemblies
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
@@ -295,6 +296,36 @@ namespace MonoTests.System.Linq.Expressions {
|
||||
Assert.AreEqual ("foo42", lamda (42, "foo"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CallDynamicMethod_ToString ()
|
||||
{
|
||||
// Regression test for #49686
|
||||
var m = new DynamicMethod ("intIntId", typeof (int), new Type [] { typeof (int) });
|
||||
var ilg = m.GetILGenerator ();
|
||||
ilg.Emit (OpCodes.Ldarg_0);
|
||||
ilg.Emit (OpCodes.Ret);
|
||||
|
||||
var i = Expression.Parameter (typeof (int), "i");
|
||||
var e = Expression.Call (m, i);
|
||||
|
||||
Assert.IsNotNull (e.ToString ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CallDynamicMethod_CompileInvoke ()
|
||||
{
|
||||
var m = new DynamicMethod ("intIntId", typeof (int), new Type [] { typeof (int) });
|
||||
var ilg = m.GetILGenerator ();
|
||||
ilg.Emit (OpCodes.Ldarg_0);
|
||||
ilg.Emit (OpCodes.Ret);
|
||||
|
||||
var i = Expression.Parameter (typeof (int), "i");
|
||||
var e = Expression.Call (m, i);
|
||||
|
||||
var lambda = Expression.Lambda<Func<int, int>> (e, i).Compile ();
|
||||
Assert.AreEqual (42, lambda (42));
|
||||
}
|
||||
|
||||
public static int Bang (Expression i)
|
||||
{
|
||||
return (int) (i as ConstantExpression).Value;
|
||||
|
||||
@@ -95,8 +95,15 @@ namespace Mono.Net.Security
|
||||
sslStream = provider.CreateSslStream (networkStream, false, settings);
|
||||
|
||||
try {
|
||||
var host = request.Host;
|
||||
if (!string.IsNullOrEmpty (host)) {
|
||||
var pos = host.IndexOf (':');
|
||||
if (pos > 0)
|
||||
host = host.Substring (0, pos);
|
||||
}
|
||||
|
||||
sslStream.AuthenticateAsClient (
|
||||
request.Host, request.ClientCertificates,
|
||||
host, request.ClientCertificates,
|
||||
(SslProtocols)ServicePointManager.SecurityProtocol,
|
||||
ServicePointManager.CheckCertificateRevocationList);
|
||||
|
||||
|
||||
@@ -210,15 +210,20 @@ namespace System.Reflection.Emit {
|
||||
return this;
|
||||
}
|
||||
|
||||
[MonoTODO("Not implemented")]
|
||||
public override object[] GetCustomAttributes (bool inherit) {
|
||||
throw new NotImplementedException ();
|
||||
// support for MethodImplAttribute PCA
|
||||
return new Object[] { new MethodImplAttribute(GetMethodImplementationFlags()) };
|
||||
}
|
||||
|
||||
[MonoTODO("Not implemented")]
|
||||
public override object[] GetCustomAttributes (Type attributeType,
|
||||
bool inherit) {
|
||||
throw new NotImplementedException ();
|
||||
bool inherit) {
|
||||
if (attributeType == null)
|
||||
throw new ArgumentNullException ("attributeType");
|
||||
|
||||
if (attributeType.IsAssignableFrom (typeof (MethodImplAttribute)))
|
||||
return new Object[] { new MethodImplAttribute (GetMethodImplementationFlags()) };
|
||||
else
|
||||
return EmptyArray<Object>.Value;
|
||||
}
|
||||
|
||||
public DynamicILInfo GetDynamicILInfo () {
|
||||
@@ -244,7 +249,7 @@ namespace System.Reflection.Emit {
|
||||
}
|
||||
|
||||
public override MethodImplAttributes GetMethodImplementationFlags () {
|
||||
return MethodImplAttributes.IL | MethodImplAttributes.Managed;
|
||||
return MethodImplAttributes.IL | MethodImplAttributes.Managed | MethodImplAttributes.NoInlining;
|
||||
}
|
||||
|
||||
public override ParameterInfo[] GetParameters ()
|
||||
@@ -298,9 +303,14 @@ namespace System.Reflection.Emit {
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO("Not implemented")]
|
||||
public override bool IsDefined (Type attributeType, bool inherit) {
|
||||
throw new NotImplementedException ();
|
||||
if (attributeType == null)
|
||||
throw new ArgumentNullException ("attributeType");
|
||||
|
||||
if (attributeType.IsAssignableFrom (typeof (MethodImplAttribute)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string ToString () {
|
||||
|
||||
@@ -11,6 +11,7 @@ using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.ExceptionServices;
|
||||
@@ -442,6 +443,31 @@ namespace MonoTests.System.Reflection.Emit
|
||||
f.Method.GetMethodBody ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCustomAttributes ()
|
||||
{
|
||||
var method = new DynamicMethod ("method", typeof (void), new Type [] { });
|
||||
|
||||
var methodImplAttrType = typeof (MethodImplAttribute);
|
||||
Assert.IsTrue (method.IsDefined (methodImplAttrType, true), "MethodImplAttribute is defined");
|
||||
|
||||
// According to the spec, MethodImplAttribute is the
|
||||
// only custom attr that's present on a DynamicMethod.
|
||||
// And it's always a managed method with no inlining.
|
||||
var a1 = method.GetCustomAttributes (true);
|
||||
Assert.AreEqual (a1.Length, 1, "a1.Length == 1");
|
||||
Assert.AreEqual (a1[0].GetType (), methodImplAttrType, "a1[0] is a MethodImplAttribute");
|
||||
var options = (a1[0] as MethodImplAttribute).Value;
|
||||
Assert.IsTrue ((options & MethodImplOptions.NoInlining) != 0, "NoInlining is set");
|
||||
Assert.IsTrue ((options & MethodImplOptions.Unmanaged) == 0, "Unmanaged isn't set");
|
||||
|
||||
|
||||
// any other custom attribute type
|
||||
var extensionAttrType = typeof (ExtensionAttribute);
|
||||
Assert.IsFalse (method.IsDefined (extensionAttrType, true));
|
||||
Assert.AreEqual (Array.Empty<object>(), method.GetCustomAttributes (extensionAttrType, true));
|
||||
}
|
||||
|
||||
public delegate object RetObj();
|
||||
[Test] //#640702
|
||||
public void GetCurrentMethodWorksWithDynamicMethods ()
|
||||
|
||||
@@ -1 +1 @@
|
||||
230b2c651b79678ba74491306ffda95a019edf9b
|
||||
b3586ea6fa1c0ea2a774b82321dc5ea824f48240
|
||||
@@ -1 +1 @@
|
||||
ac6dbc56417da4b2adacbcc7012d2ddad9b7fe18
|
||||
8ae0a08f19dd0b517b5c8c706e3f11044ba7440c
|
||||
@@ -48,6 +48,8 @@ namespace Mono.CSharp
|
||||
public ReflectionImporter (ModuleContainer module, BuiltinTypes builtin)
|
||||
: base (module)
|
||||
{
|
||||
IgnoreCompilerGeneratedField = false;
|
||||
|
||||
Initialize (builtin);
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace Mono.Linker.Steps {
|
||||
// e.g. System.String[] -> System.String
|
||||
var ts = (type as TypeSpecification);
|
||||
if (ts != null) {
|
||||
MarkWithResolvedScope (ts.GetElementType ());
|
||||
MarkWithResolvedScope (ts.ElementType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user