public static TooltipInformation Generate(DelegateType dt, int currentParam = -1) { var dd = dt.TypeDeclarationOf as DelegateDeclaration; if (dd != null) return Generate(dd, currentParam); return new TooltipInformation(); }
public void VisitDelegateType(DelegateType t) { AcceptType(t.Base); sb.Append(' ').Append(t.IsFunction ? "function" : "delegate").Append(" ("); if (t.Parameters != null) foreach (var p in t.Parameters) { AcceptType(p); sb.Append(','); } if (sb[sb.Length - 1] == ',') sb.Length--; sb.Append(')'); }
public ITypeDeclaration VisitDelegateType(DelegateType t) { var dd = new DelegateDeclaration { ReturnType = AcceptType(t.ReturnType), IsFunction = t.IsFunction }; if (t.Parameters != null) { foreach (var p in t.Parameters) { dd.Parameters.Add(new DVariable { Type = AcceptType(p) }); } } return(dd); }
public void VisitDelegateType(DelegateType t) { AcceptType(t.Base); sb.Append(' ').Append(t.IsFunction ? "function" : "delegate").Append(" ("); if (t.Parameters != null) { foreach (var p in t.Parameters) { AcceptType(p); sb.Append(','); } } if (sb[sb.Length - 1] == ',') { sb.Length--; } sb.Append(')'); }
public static TooltipInformation Generate(DelegateType dd, bool templateParamInsight, int currentParam = -1) { var sb = new StringBuilder("<i>(Delegate)</i> "); if (dd.ReturnType != null) sb.Append(dd.ReturnType.ToString()).Append(' '); if (dd.IsFunction) sb.Append("function"); else sb.Append("delegate"); var tti = new TooltipInformation(); var fn = dd.DeclarationOrExpressionBase as D_Parser.Dom.Expressions.FunctionLiteral; if (fn != null) RenderParamtersAndFooters (tti, fn.AnonymousMethod, sb, templateParamInsight, currentParam); else { sb.Append ('('); var parms = dd.Parameters; if (parms != null && parms.Length != 0) { for (int i = 0; i < parms.Length; i++) { if (i == currentParam) sb.Append ("<u>"); sb.Append (parms [i] is DSymbol ? (parms [i] as DSymbol).Definition.ToString (true, false) : parms [i].ToCode ()); if (i == currentParam) sb.Append ("</u>"); sb.Append (','); } sb.Remove (sb.Length - 1, 1); } sb.Append (')'); tti.SignatureMarkup = sb.ToString(); } return tti; }
public DelegateValue(DelegateType Dg) : base(Dg) { this.Definition = Dg; }
public DelegateCallSymbol(DelegateType dg, ISyntaxRegion callExpression) : base(dg.Base, callExpression) { this.Delegate = dg; }
public void VisitDelegateType(DelegateType dg) { GenUfcsAndStaticProperties(dg); }
void GenDelegateSignature(DelegateType dt, StringBuilder sb, bool templArgs = false, int curArg = -1) { if (dt.delegateTypeBase is FunctionLiteral) S((dt.delegateTypeBase as FunctionLiteral).AnonymousMethod, sb, templArgs, curArg, DTypeToTypeDeclVisitor.GenerateTypeDecl(dt.ReturnType)); else if (dt.delegateTypeBase is DelegateDeclaration) { var delegateDecl = dt.delegateTypeBase as DelegateDeclaration; AppendAttributes(delegateDecl.Modifiers, sb); if (dt.ReturnType != null) sb.Append(DCodeToMarkup(dt.ReturnType.ToCode(true))); else sb.Append(DCodeToMarkup(delegateDecl.ReturnType.ToString())); sb.Append(' ').Append(delegateDecl.IsFunction ? "function" : "delegate"); AppendParameters(delegateDecl.Parameters, sb, templArgs, curArg); } else { if (dt.ReturnType != null) sb.Append(DCodeToMarkup(dt.ReturnType.ToCode(true))); sb.Append(" ("); int i = -1; foreach (var parm in dt.Parameters) { i++; if ((SignatureFlags & TooltipSignatureFlags.NoLineBreakedMethodParameters) == 0) sb.AppendLine().Append(" "); var indexBackup = sb.Length; sb.Append(parm.ToCode(true)); if (!templArgs && curArg == i) { //TODO: Optimize var contentToUnderline = sb.ToString(indexBackup, sb.Length - indexBackup); sb.Remove(indexBackup, contentToUnderline.Length); AppendFormat(contentToUnderline, sb, FormatFlags.Underline); } sb.Append(','); } RemoveLastChar(sb, ','); if ((SignatureFlags & TooltipSignatureFlags.NoLineBreakedMethodParameters) == 0) sb.AppendLine(); sb.Append(')'); } }
public DelegateValue(DelegateType Dg) : base(ExpressionValueType.Delegate, Dg) { this.Definition = Dg; }