private static void VisitFieldReference(Microsoft.Cci.IFieldReference fieldReference, Microsoft.CodeAnalysis.Emit.Context context) { Debug.Assert(fieldReference != null); // Visit containing type VisitTypeReference(fieldReference.GetContainingType(context), context); // Translate substituted field to original definition Microsoft.Cci.ISpecializedFieldReference specializedField = fieldReference.AsSpecializedFieldReference; if (specializedField != null) { fieldReference = specializedField.UnspecializedVersion; } // Visit field type VisitTypeReference(fieldReference.GetType(context), context); }
private static void VisitMethodReference(Microsoft.Cci.IMethodReference methodReference, Microsoft.CodeAnalysis.Emit.Context context) { Debug.Assert(methodReference != null); // Visit containing type VisitTypeReference(methodReference.GetContainingType(context), context); // Visit generic arguments if any Microsoft.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 Microsoft.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); if (methodReference.ReturnValueIsModified) { foreach (var typeModifier in methodReference.ReturnValueCustomModifiers) { VisitTypeReference(typeModifier.GetModifier(context), context); } } }