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 Item DoCreateItem(string displayText, string filter, int kind, string type) { string[] parts = displayText.Split(':'); Contract.Assert(parts.Length == 6, "expected 6 parts from " + displayText); string rtype = parts[0]; string name = parts[2]; Item result; if (kind == 1 || kind == 2) { // property getter or setter result = new NameItem(name, rtype + ' ' + name, filter, type); } else { string[] gargs = parts[3].Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries); string[] argTypes = parts[4].Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries); string[] argNames = parts[5].Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries); if (kind == 3) { // indexer getter result = new MethodItem(rtype, name, gargs, argTypes, argNames, type, filter, '[', ']'); } else if (kind == 4) { // indexer setter argTypes = argTypes.SubArray(0, argTypes.Length - 1); argNames = argNames.SubArray(0, argNames.Length - 1); result = new MethodItem(rtype, name, gargs, argTypes, argNames, "System.Void", filter, '[', ']'); } else if (kind == 8) { // extension method argTypes = argTypes.SubArray(1); argNames = argNames.SubArray(1); result = new MethodItem(rtype, name, gargs, argTypes, argNames, type, filter); } else if (kind == 0 || kind == 6) { // normal method or constructor result = new MethodItem(rtype, name, gargs, argTypes, argNames, type, filter); } else throw new Exception("bad method kind: " + kind); } return result; }