private string DoGetParams(CsParameter[] parms) { var builder = new StringBuilder(); for (int i = 0; i < parms.Length; ++i) { if (parms[i].Modifier != 0) { builder.Append(parms[i].Modifier.ToString().ToLower()); builder.Append(" "); } if (parms[i].IsParams) builder.Append("params "); builder.Append(parms[i].Type); builder.Append(" "); builder.Append(parms[i].Name); if (i + 1 < parms.Length) builder.Append(", "); } return builder.ToString(); }
private bool DoParametersMatch(CsParameter[] args, string[] types) { bool matches = args.Length == types.Length; for (int i = 0; i < args.Length && matches; ++i) { if (args[i].Type != types[i]) matches = false; } return matches; }
private object DoGetAttributes(CsParameter p) { return p.Attributes; }
private object DoGetIsParams(CsParameter p) { return p.IsParams; }
private object DoGetName(CsParameter p) { return p.Name; }
private object DoGetType(CsParameter p) { return p.Type; }
private void DoAddConstructor(string ns, string inGargs, string typeName, string name, CsParameter[] parameters, List<Item> items) { string[] gargs = null; if (inGargs != null) gargs = inGargs.Split(','); string[] argTypes = (from p in parameters select p.ModifiedType).ToArray(); string[] argNames = (from p in parameters select p.Name).ToArray(); string nsName = ns == "<globals>" ? "global" : ns; var item = new MethodItem("System.Void", name, gargs, argTypes, argNames, typeName, nsName + " constructors"); items.AddIfMissing(item); }
private object DoGetModifier(CsParameter p) { return p.Modifier.ToString().ToLower(); }
public CsOperator(int nameOffset, CsBody body, bool isImplicit, bool isExplicit, CsParameter[] parms, string rtype, CsAttribute[] attrs, MemberModifiers modifiers, string name, int offset, int length, int line) : base(nameOffset, attrs, modifiers, name, offset, length, line) { Contract.Requires(!string.IsNullOrEmpty(rtype), "rtype is null or empty"); ReturnType = rtype.TrimAll(); Parameters = parms; IsImplicit = isImplicit; IsExplicit = isExplicit; Body = body; }
public CsMethod(int nameOffset, CsBody body, bool isCtor, bool isDtor, string constraints, CsParameter[] parms, string gargs, string rtype, CsAttribute[] attrs, MemberModifiers modifiers, string name, int offset, int length, int line) : base(nameOffset, attrs, modifiers, name, offset, length, line) { Contract.Requires(!(isCtor && isDtor), "can't be both a ctor and a dtor"); Contract.Requires(parms != null, "parms is null"); Contract.Requires(!string.IsNullOrEmpty(rtype), "rtype is null or empty"); Body = body; IsConstructor = isCtor; IsFinalizer = isDtor; ReturnType = rtype.TrimAll(); Parameters = parms; Constraints = constraints; if (gargs != null) GenericArguments = gargs.TrimAll(); }
protected void AppendParameters(StringBuilder builder, CsParameter[] parms) { Contract.Requires(builder != null, "builder is null"); Contract.Requires(parms != null, "parms is null"); for (int i = 0; i < parms.Length; ++i) { builder.Append(parms[i].Type); builder.Append(' '); builder.Append(parms[i].Name); if (i + 1 < parms.Length) builder.Append(", "); } }
public CsIndexer(int nameOffset, CsBody getterBody, CsBody setterBody, MemberModifiers getAccess, MemberModifiers setAccess, string name, CsAttribute[] getAttrs, CsAttribute[] setAttrs, bool hasGet, bool hasSet, CsParameter[] parms, string rtype, CsAttribute[] attrs, MemberModifiers modifiers, int offset, int length, int line) : base(nameOffset, attrs, modifiers, name, offset, length, line) { Contract.Requires(!hasGet || getAttrs != null, "getAttrs is null"); Contract.Requires(!hasSet || setAttrs != null, "setAttrs is null"); Contract.Requires(hasGet || hasSet, "not a getter and not a setter"); Contract.Requires(parms != null, "parms is null"); Contract.Requires(!string.IsNullOrEmpty(rtype), "rtype is null or empty"); Contract.Requires(((int) getAccess & ~CsMember.AccessMask) == 0, "getAccess has more than just acccess set"); Contract.Requires(((int) setAccess & ~CsMember.AccessMask) == 0, "setAccess has more than just acccess set"); HasGetter = hasGet; HasSetter = hasSet; ReturnType = rtype.TrimAll(); Parameters = parms; GetterAttributes = getAttrs; SetterAttributes = setAttrs; GetterAccess = getAccess; SetterAccess = setAccess; GetterBody = getterBody; SetterBody = setterBody; }
public CsDelegate(int nameOffset, string constraints, CsParameter[] parms, string gargs, string rtype, CsAttribute[] attrs, MemberModifiers modifiers, string name, int offset, int length, int line) : base(nameOffset, null, new CsBases(offset, line), new CsMember[0], new CsType[0], attrs, modifiers, constraints, gargs, name, offset, length, line) { Contract.Requires(!string.IsNullOrEmpty(rtype), "rtype is null or empty"); Contract.Requires(parms != null, "parms is null"); ReturnType = rtype.TrimAll(); Parameters = parms; }