예제 #1
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);
            }
        }
예제 #2
0
 Cci.ITypeReference Cci.ISignature.GetType(EmitContext context)
 {
     return(underlyingMethod.GetType(context));
 }