Exemple #1
0
        private static void VisitMethodReference(Cci.IMethodReference methodReference, EmitContext context)
        {
            RoslynDebug.Assert(methodReference != null);

            // Visit containing type
            VisitTypeReference(methodReference.GetContainingType(context), context);

            // Visit generic arguments if any
            Cci.IGenericMethodInstanceReference?genericInstance = methodReference.AsGenericMethodInstanceReference;
            if (genericInstance != null)
            {
                foreach (var arg in genericInstance.GetGenericArguments(context))
                {
                    VisitTypeReference(arg, context);
                }
                methodReference = genericInstance.GetGenericMethod(context);
            }

            // Translate substituted method to original definition
            Cci.ISpecializedMethodReference?specializedMethod = methodReference.AsSpecializedMethodReference;
            if (specializedMethod != null)
            {
                methodReference = specializedMethod.UnspecializedVersion;
            }

            VisitSignature(methodReference, context);

            if (methodReference.AcceptsExtraArguments)
            {
                VisitParameters(methodReference.ExtraParameters, context);
            }
        }
Exemple #2
0
        private static void VisitMethodReference(Cci.IMethodReference methodReference, EmitContext context)
        {
            Debug.Assert(methodReference != null);

            // Visit containing type
            VisitTypeReference(methodReference.GetContainingType(context), context);

            // Visit generic arguments if any
            Cci.IGenericMethodInstanceReference genericInstance = methodReference.AsGenericMethodInstanceReference;
            if (genericInstance != null)
            {
                foreach (var arg in genericInstance.GetGenericArguments(context))
                {
                    VisitTypeReference(arg, context);
                }
                methodReference = genericInstance.GetGenericMethod(context);
            }

            // Translate substituted method to original definition
            Cci.ISpecializedMethodReference specializedMethod = methodReference.AsSpecializedMethodReference;
            if (specializedMethod != null)
            {
                methodReference = specializedMethod.UnspecializedVersion;
            }

            // Visit parameter types
            VisitParameters(methodReference.GetParameters(context), context);

            if (methodReference.AcceptsExtraArguments)
            {
                VisitParameters(methodReference.ExtraParameters, context);
            }

            // Visit return value type
            VisitTypeReference(methodReference.GetType(context), context);

            foreach (var typeModifier in methodReference.RefCustomModifiers)
            {
                VisitTypeReference(typeModifier.GetModifier(context), context);
            }

            foreach (var typeModifier in methodReference.ReturnValueCustomModifiers)
            {
                VisitTypeReference(typeModifier.GetModifier(context), context);
            }
        }
Exemple #3
0
 Cci.ITypeReference Cci.ITypeMemberReference.GetContainingType(EmitContext context)
 {
     return(underlyingMethod.GetContainingType(context));
 }