static GenericParam GetGenericParam(GenericSig gsig, GenericParamContext gpContext) { if (gsig == null) return null; ITypeOrMethodDef owner = gsig.IsTypeVar ? (ITypeOrMethodDef)gpContext.Type : gpContext.Method; if (owner == null) return null; foreach (var gp in owner.GenericParameters) { if (gp.Number == gsig.Number) return gp; } return null; }
public static TextTokenKind GetTextTokenType(GenericSig sig) { if (sig == null) return TextTokenKind.Text; return sig.IsMethodVar ? TextTokenKind.MethodGenericParameter : TextTokenKind.TypeGenericParameter; }
/// <summary> /// Gets a generic signature color /// </summary> /// <param name="genericSig">Generic signature</param> /// <returns></returns> public virtual object GetColor(GenericSig genericSig) { if (genericSig == null) return BoxedTextColor.Text; return genericSig.IsMethodVar ? BoxedTextColor.MethodGenericParameter : BoxedTextColor.TypeGenericParameter; }