ResolveParameterType() public méthode

public ResolveParameterType ( MethodReference method, Mono.Cecil.ParameterReference parameter ) : TypeReference
method Mono.Cecil.MethodReference
parameter Mono.Cecil.ParameterReference
Résultat Mono.Cecil.TypeReference
        public int GetIndex(MethodReference method)
        {
            int num3;

            if (method.HasGenericParameters || method.DeclaringType.HasGenericParameters)
            {
                return(-1);
            }
            if (GenericSharingAnalysis.CanShareMethod(method))
            {
                method = GenericSharingAnalysis.GetSharedMethod(method);
            }
            Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod);
            TypeReference[] key = new TypeReference[method.Parameters.Count + 1];
            key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method));
            for (int i = 0; i < method.Parameters.Count; i++)
            {
                key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i]));
            }
            if (!this._runtimeInvokerData.TryGetValue(key, out num3))
            {
                return(-1);
            }
            return(num3);
        }
 internal static bool MethodSignaturesMatchIgnoreStaticness(MethodReference candidate, MethodReference method)
 {
     if (candidate.Parameters.Count != method.Parameters.Count)
     {
         return false;
     }
     if (candidate.GenericParameters.Count != method.GenericParameters.Count)
     {
         return false;
     }
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(candidate.DeclaringType as GenericInstanceType, candidate as GenericInstanceMethod);
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver2 = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod);
     if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveReturnType(candidate), resolver2.ResolveReturnType(method), TypeComparisonMode.SignatureOnly))
     {
         return false;
     }
     for (int i = 0; i < candidate.Parameters.Count; i++)
     {
         if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveParameterType(candidate, candidate.Parameters[i]), resolver2.ResolveParameterType(method, method.Parameters[i]), TypeComparisonMode.SignatureOnly))
         {
             return false;
         }
     }
     return true;
 }
Exemple #3
0
 internal static bool MethodSignaturesMatchIgnoreStaticness(MethodReference candidate, MethodReference method)
 {
     if (candidate.Parameters.Count != method.Parameters.Count)
     {
         return(false);
     }
     if (candidate.GenericParameters.Count != method.GenericParameters.Count)
     {
         return(false);
     }
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver  = new Unity.IL2CPP.ILPreProcessor.TypeResolver(candidate.DeclaringType as GenericInstanceType, candidate as GenericInstanceMethod);
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver2 = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod);
     if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveReturnType(candidate), resolver2.ResolveReturnType(method), TypeComparisonMode.SignatureOnly))
     {
         return(false);
     }
     for (int i = 0; i < candidate.Parameters.Count; i++)
     {
         if (!Unity.IL2CPP.Common.TypeReferenceEqualityComparer.AreEqual(resolver.ResolveParameterType(candidate, candidate.Parameters[i]), resolver2.ResolveParameterType(method, method.Parameters[i]), TypeComparisonMode.SignatureOnly))
         {
             return(false);
         }
     }
     return(true);
 }
 private static TypeReference[] MethodToSignature(MethodReference method)
 {
     if (GenericSharingAnalysis.CanShareMethod(method))
     {
         method = GenericSharingAnalysis.GetSharedMethod(method);
     }
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod);
     TypeReference[] referenceArray = new TypeReference[method.Parameters.Count + 1];
     referenceArray[0] = TypeFor(resolver.ResolveReturnType(method));
     for (int i = 0; i < method.Parameters.Count; i++)
     {
         referenceArray[i + 1] = TypeFor(resolver.ResolveParameterType(method, method.Parameters[i]));
     }
     return(referenceArray);
 }
 public void AddIncludesForMethodDeclaration(GenericInstanceMethod method)
 {
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method);
     this.AddIncludeForType(method.DeclaringType);
     if (method.ReturnType.MetadataType != MetadataType.Void)
     {
         this.AddIncludesForTypeReference(resolver.ResolveReturnType(method), false);
     }
     foreach (ParameterDefinition definition in method.Parameters)
     {
         this.AddIncludesForTypeReference(resolver.ResolveParameterType(method, definition), false);
     }
     if (GenericSharingAnalysis.CanShareMethod(method) && !GenericSharingAnalysis.IsSharedMethod(method))
     {
         this.AddIncludesForMethodDeclaration((GenericInstanceMethod)GenericSharingAnalysis.GetSharedMethod(method));
     }
     this.AddGenericInstanceMethod(method);
 }
 public string Add(MethodReference method)
 {
     if (GenericSharingAnalysis.CanShareMethod(method))
     {
         method = GenericSharingAnalysis.GetSharedMethod(method);
     }
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod);
     TypeReference[] key = new TypeReference[method.Parameters.Count + 1];
     key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method));
     for (int i = 0; i < method.Parameters.Count; i++)
     {
         key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i]));
     }
     if (!this._runtimeInvokerData.ContainsKey(key))
     {
         this._runtimeInvokerData.Add(key, this._runtimeInvokerData.Count);
     }
     return(NameForInvoker(key));
 }
 public string Add(MethodReference method)
 {
     if (GenericSharingAnalysis.CanShareMethod(method))
     {
         method = GenericSharingAnalysis.GetSharedMethod(method);
     }
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod);
     TypeReference[] key = new TypeReference[method.Parameters.Count + 1];
     key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method));
     for (int i = 0; i < method.Parameters.Count; i++)
     {
         key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i]));
     }
     if (!this._runtimeInvokerData.ContainsKey(key))
     {
         this._runtimeInvokerData.Add(key, this._runtimeInvokerData.Count);
     }
     return NameForInvoker(key);
 }
 public int GetIndex(MethodReference method)
 {
     int num3;
     if (method.HasGenericParameters || method.DeclaringType.HasGenericParameters)
     {
         return -1;
     }
     if (GenericSharingAnalysis.CanShareMethod(method))
     {
         method = GenericSharingAnalysis.GetSharedMethod(method);
     }
     Unity.IL2CPP.ILPreProcessor.TypeResolver resolver = new Unity.IL2CPP.ILPreProcessor.TypeResolver(method.DeclaringType as GenericInstanceType, method as GenericInstanceMethod);
     TypeReference[] key = new TypeReference[method.Parameters.Count + 1];
     key[0] = InvokerReturnTypeFor(resolver.ResolveReturnType(method));
     for (int i = 0; i < method.Parameters.Count; i++)
     {
         key[i + 1] = InvokerParameterTypeFor(resolver.ResolveParameterType(method, method.Parameters[i]));
     }
     if (!this._runtimeInvokerData.TryGetValue(key, out num3))
     {
         return -1;
     }
     return num3;
 }