// Cloning only params will speed up the method param renaming code public VariableNameState CloneParamsOnly() { var vns = new VariableNameState(); vns.existingVariableNames = new ExistingNames(); vns.variableNameCreator = new VariableNameCreator(); vns.existingVariableNames.Merge(existingVariableNames); vns.variableNameCreator.Merge(variableNameCreator); return vns; }
// Cloning only params will speed up the method param renaming code public VariableNameState cloneParamsOnly() { var vns = new VariableNameState(); vns.existingVariableNames = new ExistingNames(); vns.variableNameCreator = new VariableNameCreator(); vns.existingVariableNames.merge(existingVariableNames); vns.variableNameCreator.merge(variableNameCreator); return(vns); }
public VariableNameState Merge(VariableNameState other) { existingVariableNames.Merge(other.existingVariableNames); existingMethodNames.Merge(other.existingMethodNames); existingPropertyNames.Merge(other.existingPropertyNames); existingEventNames.Merge(other.existingEventNames); variableNameCreator.Merge(other.variableNameCreator); propertyNameCreator.Merge(other.propertyNameCreator); eventNameCreator.Merge(other.eventNameCreator); genericPropertyNameCreator.Merge(other.genericPropertyNameCreator); staticMethodNameCreator.Merge(other.staticMethodNameCreator); instanceMethodNameCreator.Merge(other.instanceMethodNameCreator); return this; }
public VariableNameState merge(VariableNameState other) { existingVariableNames.merge(other.existingVariableNames); existingMethodNames.merge(other.existingMethodNames); existingPropertyNames.merge(other.existingPropertyNames); existingEventNames.merge(other.existingEventNames); variableNameCreator.merge(other.variableNameCreator); propertyNameCreator.merge(other.propertyNameCreator); eventNameCreator.merge(other.eventNameCreator); genericPropertyNameCreator.merge(other.genericPropertyNameCreator); staticMethodNameCreator.merge(other.staticMethodNameCreator); instanceMethodNameCreator.merge(other.instanceMethodNameCreator); return(this); }
public static VariableNameState Create() { var vns = new VariableNameState(); vns.existingVariableNames = new ExistingNames(); vns.existingMethodNames = new ExistingNames(); vns.existingPropertyNames = new ExistingNames(); vns.existingEventNames = new ExistingNames(); vns.variableNameCreator = new VariableNameCreator(); vns.propertyNameCreator = new PropertyNameCreator(); vns.eventNameCreator = new NameCreator("Event_"); vns.genericPropertyNameCreator = new NameCreator("Prop_"); vns.staticMethodNameCreator = new NameCreator("smethod_"); vns.instanceMethodNameCreator = new NameCreator("method_"); return vns; }
public static VariableNameState create() { var vns = new VariableNameState(); vns.existingVariableNames = new ExistingNames(); vns.existingMethodNames = new ExistingNames(); vns.existingPropertyNames = new ExistingNames(); vns.existingEventNames = new ExistingNames(); vns.variableNameCreator = new VariableNameCreator(); vns.propertyNameCreator = new PropertyNameCreator(); vns.eventNameCreator = new NameCreator("Event_"); vns.genericPropertyNameCreator = new NameCreator("Prop_"); vns.staticMethodNameCreator = new NameCreator("smethod_"); vns.instanceMethodNameCreator = new NameCreator("method_"); return(vns); }
void PrepareRenameMethodArgs(MMethodDef methodDef) { VariableNameState newVariableNameState = null; ParamInfo info; if (methodDef.VisibleParameterCount > 0) { if (IsEventHandler(methodDef)) { info = Param(methodDef.ParamDefs[methodDef.VisibleParameterBaseIndex]); if (!info.GotNewName()) { info.newName = "sender"; } info = Param(methodDef.ParamDefs[methodDef.VisibleParameterBaseIndex + 1]); if (!info.GotNewName()) { info.newName = "e"; } } else { newVariableNameState = variableNameState.CloneParamsOnly(); var checker = NameChecker; foreach (var paramDef in methodDef.ParamDefs) { if (paramDef.IsHiddenThisParameter) { continue; } info = Param(paramDef); if (info.GotNewName()) { continue; } if (!checker.IsValidMethodArgName(info.oldName)) { info.newName = newVariableNameState.GetNewParamName(info.oldName, paramDef.ParameterDef); } } } } info = Param(methodDef.ReturnParamDef); if (!info.GotNewName()) { if (!NameChecker.IsValidMethodReturnArgName(info.oldName)) { if (newVariableNameState == null) { newVariableNameState = variableNameState.CloneParamsOnly(); } info.newName = newVariableNameState.GetNewParamName(info.oldName, methodDef.ReturnParamDef.ParameterDef); } } if ((methodDef.Property != null && methodDef == methodDef.Property.SetMethod) || (methodDef.Event != null && (methodDef == methodDef.Event.AddMethod || methodDef == methodDef.Event.RemoveMethod))) { if (methodDef.VisibleParameterCount > 0) { var paramDef = methodDef.ParamDefs[methodDef.ParamDefs.Count - 1]; Param(paramDef).newName = "value"; } } }
public void mergeProperties(VariableNameState other) { existingPropertyNames.merge(other.existingPropertyNames); }
public void mergeMethods(VariableNameState other) { existingMethodNames.merge(other.existingMethodNames); }
public void mergeEvents(VariableNameState other) { existingEventNames.merge(other.existingEventNames); }
public void MergeEvents(VariableNameState other) => existingEventNames.Merge(other.existingEventNames);
public void MergeProperties(VariableNameState other) => existingPropertyNames.Merge(other.existingPropertyNames);
public void MergeMethods(VariableNameState other) => existingMethodNames.Merge(other.existingMethodNames);