Example #1
0
        internal bool MethodSignatureHasVarsNeedingCallingConventionConverter(TypeSystemContext context, RuntimeSignature methodSig)
        {
            if (methodSig.IsNativeLayoutSignature)
            {
                return(MethodSignatureHasVarsNeedingCallingConventionConverter_NativeLayout(context, methodSig));
            }
            else
            {
#if SUPPORTS_NATIVE_METADATA_TYPE_LOADING
                var sig = TypeSystemSigFromRuntimeSignature(context, methodSig);
                return(UniversalGenericParameterLayout.MethodSignatureHasVarsNeedingCallingConventionConverter(sig));
#else
                Environment.FailFast("Cannot parse signature");
                return(false);
#endif
            }
        }
Example #2
0
        private static bool GetCallingConverterDataFromMethodSignature_MethodSignature(TypeSystem.MethodSignature methodSignature, Instantiation typeInstantiation, Instantiation methodInstantiation, out bool hasThis, out TypeDesc[] parameters, out bool[] parametersWithGenericDependentLayout)
        {
            // Compute parameters dependent on generic instantiation for their layout
            parametersWithGenericDependentLayout    = new bool[methodSignature.Length + 1];
            parametersWithGenericDependentLayout[0] = UniversalGenericParameterLayout.IsLayoutDependentOnGenericInstantiation(methodSignature.ReturnType);
            for (int i = 0; i < methodSignature.Length; i++)
            {
                parametersWithGenericDependentLayout[i + 1] = UniversalGenericParameterLayout.IsLayoutDependentOnGenericInstantiation(methodSignature[i]);
            }

            // Compute hasThis-ness
            hasThis = !methodSignature.IsStatic;

            // Compute parameter exact types
            parameters = new TypeDesc[methodSignature.Length + 1];

            parameters[0] = methodSignature.ReturnType.InstantiateSignature(typeInstantiation, methodInstantiation);
            for (int i = 0; i < methodSignature.Length; i++)
            {
                parameters[i + 1] = methodSignature[i].InstantiateSignature(typeInstantiation, methodInstantiation);
            }

            return(true);
        }