object Create(IToolTipContentCreatorContext context, GenericParam gp) { var creator = context.Create(); creator.SetImage(gp); context.Language.WriteToolTip(creator.Output, gp, null); creator.CreateNewOutput(); try { var docProvider = XmlDocLoader.LoadDocumentation(gp.Module); if (docProvider != null) { if (!creator.Output.WriteXmlDocGeneric(GetDocumentation(docProvider, gp.Owner), gp.Name) && gp.Owner is TypeDef) { // If there's no doc available, use the parent class' documentation if this // is a generic type parameter (and not a generic method parameter). var owner = ((TypeDef)gp.Owner).DeclaringType; while (owner != null) { if (creator.Output.WriteXmlDocGeneric(GetDocumentation(docProvider, owner), gp.Name)) break; owner = owner.DeclaringType; } } } } catch (XmlException) { } return creator.Create(); }
public GenericParamOptions(GenericParam gp) { this.Number = gp.Number; this.Flags = gp.Flags; this.Name = gp.Name; this.Kind = gp.Kind; this.GenericParamConstraints.AddRange(gp.GenericParamConstraints); this.CustomAttributes.AddRange(gp.CustomAttributes); }
public GenericParamOptions(GenericParam gp) { Number = gp.Number; Flags = gp.Flags; Name = gp.Name; Kind = gp.Kind; GenericParamConstraints.AddRange(gp.GenericParamConstraints); CustomAttributes.AddRange(gp.CustomAttributes); }
public GenericParam CopyTo(GenericParam gp) { gp.Number = this.Number; gp.Flags = this.Flags; gp.Name = this.Name ?? UTF8String.Empty; gp.Kind = this.Kind; gp.GenericParamConstraints.Clear(); gp.GenericParamConstraints.AddRange(this.GenericParamConstraints); gp.CustomAttributes.Clear(); gp.CustomAttributes.AddRange(this.CustomAttributes); return gp; }
void Add(GenericParam gp) { if (gp == null || genericParams.ContainsKey(gp)) return; genericParams[gp] = true; Push(gp.Owner); Push(gp.Kind); Add(gp.GenericParamConstraints); Add(gp.CustomAttributes); }
public MGenericParamDef(GenericParam genericParameter, int index) : base(genericParameter, null, index) { }
public static TextTokenKind GetTextTokenType(GenericParam gp) { if (gp == null) return TextTokenKind.Text; if (gp.DeclaringType != null) return TextTokenKind.TypeGenericParameter; if (gp.DeclaringMethod != null) return TextTokenKind.MethodGenericParameter; return TextTokenKind.TypeGenericParameter; }
void WriteToolTip(ITextOutput output, GenericParam gp) { output.Write(IdentifierEscaper.Escape(gp.Name), TextTokenHelper.GetTextTokenType(gp)); output.WriteSpace(); output.Write("in", TextTokenType.Text); output.WriteSpace(); var td = gp.Owner as TypeDef; if (td != null) WriteToolTipType(output, td, TOOLTIP_USE_NAMESPACES); else WriteToolTipMethod(output, gp.Owner as MethodDef); }
void Write(GenericParam gp) { if (gp == null) { WriteError(); return; } WriteIdentifier(gp.Name, TextTokenKindUtils.GetTextTokenType(gp)); WriteToken(gp); }
void WriteToolTip(GenericParam gp) { if (gp == null) { WriteError(); return; } Write(gp); WriteSpace(); OutputWrite(Languages_Resources.ToolTip_GenericParameterInTypeOrMethod, TextTokenKind.Text); WriteSpace(); var td = gp.Owner as TypeDef; if (td != null) WriteType(td, ShowNamespaces, ShowTypeKeywords); else Write(gp.Owner as MethodDef); }
/// <summary> /// Gets a generic parameter color /// </summary> /// <param name="genericParam">Generic parameter</param> /// <returns></returns> public virtual object GetColor(GenericParam genericParam) { if (genericParam == null) return BoxedTextColor.Text; if (genericParam.DeclaringType != null) return BoxedTextColor.TypeGenericParameter; if (genericParam.DeclaringMethod != null) return BoxedTextColor.MethodGenericParameter; return BoxedTextColor.TypeGenericParameter; }