You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
47
external/linker/cecil/Mono.Cecil/Import.cs
vendored
47
external/linker/cecil/Mono.Cecil/Import.cs
vendored
@ -29,8 +29,6 @@ namespace Mono.Cecil {
|
||||
MethodReference ImportReference (MethodReference method, IGenericParameterProvider context);
|
||||
}
|
||||
|
||||
#if !PCL && !NET_CORE
|
||||
|
||||
public interface IReflectionImporterProvider {
|
||||
IReflectionImporter GetReflectionImporter (ModuleDefinition module);
|
||||
}
|
||||
@ -41,8 +39,6 @@ namespace Mono.Cecil {
|
||||
MethodReference ImportReference (SR.MethodBase method, IGenericParameterProvider context);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct ImportGenericContext {
|
||||
|
||||
Collection<IGenericParameterProvider> stack;
|
||||
@ -126,8 +122,6 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
#if !PCL && !NET_CORE
|
||||
|
||||
public class ReflectionImporter : IReflectionImporter {
|
||||
|
||||
readonly ModuleDefinition module;
|
||||
@ -159,7 +153,9 @@ namespace Mono.Cecil {
|
||||
{ typeof (float), ElementType.R4 },
|
||||
{ typeof (double), ElementType.R8 },
|
||||
{ typeof (string), ElementType.String },
|
||||
#if !NET_CORE
|
||||
{ typeof (TypedReference), ElementType.TypedByRef },
|
||||
#endif
|
||||
{ typeof (IntPtr), ElementType.I },
|
||||
{ typeof (UIntPtr), ElementType.U },
|
||||
{ typeof (object), ElementType.Object },
|
||||
@ -179,8 +175,8 @@ namespace Mono.Cecil {
|
||||
string.Empty,
|
||||
type.Name,
|
||||
module,
|
||||
ImportScope (type.Assembly),
|
||||
type.IsValueType);
|
||||
ImportScope (type.Assembly ()),
|
||||
type.IsValueType ());
|
||||
|
||||
reference.etype = ImportElementType (type);
|
||||
|
||||
@ -189,7 +185,7 @@ namespace Mono.Cecil {
|
||||
else
|
||||
reference.Namespace = type.Namespace ?? string.Empty;
|
||||
|
||||
if (type.IsGenericType)
|
||||
if (type.IsGenericType ())
|
||||
ImportGenericParameters (reference, type.GetGenericArguments ());
|
||||
|
||||
return reference;
|
||||
@ -197,7 +193,7 @@ namespace Mono.Cecil {
|
||||
|
||||
static bool ImportOpenGenericType (Type type, ImportGenericKind import_kind)
|
||||
{
|
||||
return type.IsGenericType && type.IsGenericTypeDefinition && import_kind == ImportGenericKind.Open;
|
||||
return type.IsGenericType () && type.IsGenericTypeDefinition () && import_kind == ImportGenericKind.Open;
|
||||
}
|
||||
|
||||
static bool ImportOpenGenericMethod (SR.MethodBase method, ImportGenericKind import_kind)
|
||||
@ -221,7 +217,7 @@ namespace Mono.Cecil {
|
||||
if (type.IsArray)
|
||||
return new ArrayType (ImportType (type.GetElementType (), context), type.GetArrayRank ());
|
||||
|
||||
if (type.IsGenericType)
|
||||
if (type.IsGenericType ())
|
||||
return ImportGenericInstance (type, context);
|
||||
|
||||
if (type.IsGenericParameter)
|
||||
@ -235,8 +231,8 @@ namespace Mono.Cecil {
|
||||
if (context.IsEmpty)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
if (type.DeclaringMethod != null)
|
||||
return context.MethodParameter (NormalizeMethodName (type.DeclaringMethod), type.GenericParameterPosition);
|
||||
if (type.DeclaringMethod () != null)
|
||||
return context.MethodParameter (NormalizeMethodName (type.DeclaringMethod ()), type.GenericParameterPosition);
|
||||
|
||||
if (type.DeclaringType != null)
|
||||
return context.TypeParameter (NormalizeTypeFullName (type.DeclaringType), type.GenericParameterPosition);
|
||||
@ -284,7 +280,7 @@ namespace Mono.Cecil {
|
||||
|
||||
static bool IsGenericInstance (Type type)
|
||||
{
|
||||
return type.IsGenericType && !type.IsGenericTypeDefinition;
|
||||
return type.IsGenericType () && !type.IsGenericTypeDefinition ();
|
||||
}
|
||||
|
||||
static ElementType ImportElementType (Type type)
|
||||
@ -306,9 +302,11 @@ namespace Mono.Cecil {
|
||||
return scope;
|
||||
|
||||
scope = new AssemblyNameReference (name.Name, name.Version) {
|
||||
Culture = name.CultureInfo.Name,
|
||||
PublicKeyToken = name.GetPublicKeyToken (),
|
||||
#if !NET_CORE
|
||||
Culture = name.CultureInfo.Name,
|
||||
HashAlgorithm = (AssemblyHashAlgorithm) name.HashAlgorithm,
|
||||
#endif
|
||||
};
|
||||
|
||||
module.AssemblyReferences.Add (scope);
|
||||
@ -354,7 +352,20 @@ namespace Mono.Cecil {
|
||||
|
||||
static SR.FieldInfo ResolveFieldDefinition (SR.FieldInfo field)
|
||||
{
|
||||
#if NET_CORE
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
return field.Module.ResolveField (field.MetadataToken);
|
||||
#endif
|
||||
}
|
||||
|
||||
static SR.MethodBase ResolveMethodDefinition (SR.MethodBase method)
|
||||
{
|
||||
#if NET_CORE
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
return method.Module.ResolveMethod (method.MetadataToken);
|
||||
#endif
|
||||
}
|
||||
|
||||
MethodReference ImportMethod (SR.MethodBase method, ImportGenericContext context, ImportGenericKind import_kind)
|
||||
@ -365,7 +376,7 @@ namespace Mono.Cecil {
|
||||
var declaring_type = ImportType (method.DeclaringType, context);
|
||||
|
||||
if (IsGenericInstance (method.DeclaringType))
|
||||
method = method.Module.ResolveMethod (method.MetadataToken);
|
||||
method = ResolveMethodDefinition (method);
|
||||
|
||||
var reference = new MethodReference {
|
||||
Name = method.Name,
|
||||
@ -466,8 +477,6 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public class MetadataImporter : IMetadataImporter {
|
||||
|
||||
readonly ModuleDefinition module;
|
||||
@ -740,7 +749,7 @@ namespace Mono.Cecil {
|
||||
public static void CheckModule (ModuleDefinition module)
|
||||
{
|
||||
if (module == null)
|
||||
throw new ArgumentNullException ("module");
|
||||
throw new ArgumentNullException (Argument.module.ToString ());
|
||||
}
|
||||
|
||||
public static bool TryGetAssemblyNameReference (this ModuleDefinition module, AssemblyNameReference name_reference, out AssemblyNameReference assembly_reference)
|
||||
|
Reference in New Issue
Block a user