static string GetArgString(Definitions.ParamDefinition p, int i) { string modify = GetModifyString(p); string paramName = !string.IsNullOrEmpty(p.CSharpName) ? NamedTool.VarName(p.CSharpName) : "p" + i; return(modify + paramName); }
private static string GetModifyString(Definitions.ParamDefinition p) { return(p.Modify switch { Definitions.ParamDefinition.ModifyType.None => "", Definitions.ParamDefinition.ModifyType.Out => "out ", Definitions.ParamDefinition.ModifyType.Ref => "ref ", Definitions.ParamDefinition.ModifyType.In => "in ", _ => throw new InvalidOperationException(), });
static string GetParamString(Definitions.ParamDefinition p, int i) { string modify = GetModifyString(p); var sb = new StringBuilder(); if (p.Attrs.Length > 0) { sb.Append($"[{string.Join(", ", p.Attrs)}] "); } sb.Append(modify).Append(p.Type.CSharpName).Append(' ').Append(NamedTool.VarName(p.CSharpName)); return(sb.ToString()); }
protected virtual void VisitFunctionParam(Definitions.FunctionDefinition function, Definitions.ParamDefinition param) { }
protected virtual void VisitDelegateParam(Definitions.DelegateDefinition @delegate, Definitions.ParamDefinition param) { }