public INameCreator clone() { var rv = new GenericParamNameCreator(); rv.index = index; return rv; }
static void prepareRenameGenericParams(IList<GenericParamDef> genericParams, Func<string, bool> isValidName, IList<GenericParamDef> otherGenericParams = null) { Dictionary<string, bool> usedNames = new Dictionary<string, bool>(StringComparer.Ordinal); INameCreator nameCreator = new GenericParamNameCreator(); if (otherGenericParams != null) { foreach (var param in otherGenericParams) usedNames[param.NewName] = true; } foreach (var param in genericParams) { if (!isValidName(param.OldName) || usedNames.ContainsKey(param.OldName)) { string newName; do { newName = nameCreator.newName(); } while (usedNames.ContainsKey(newName)); usedNames[newName] = true; param.rename(newName); } } }
void prepareRenameGenericParams(IEnumerable<GenericParamDef> genericParams, INameChecker checker, IEnumerable<GenericParamDef> otherGenericParams = null) { var usedNames = new Dictionary<string, bool>(StringComparer.Ordinal); var nameCreator = new GenericParamNameCreator(); if (otherGenericParams != null) { foreach (var param in otherGenericParams) { var gpInfo = memberInfos.gparam(param); usedNames[gpInfo.newName] = true; } } foreach (var param in genericParams) { var gpInfo = memberInfos.gparam(param); if (!checker.isValidGenericParamName(gpInfo.oldName) || usedNames.ContainsKey(gpInfo.oldName)) { string newName; do { newName = nameCreator.create(); } while (usedNames.ContainsKey(newName)); usedNames[newName] = true; gpInfo.rename(newName); } } }