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); } }
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); } }
Cci.ITypeReference Cci.ITypeMemberReference.GetContainingType(EmitContext context) { return(underlyingMethod.GetContainingType(context)); }