/// <summary> /// Rename the assignment we are making. /// </summary> /// <param name="originalName"></param> /// <param name="newName"></param> public void RenameVariable(string originalName, string newName) { ResultVariable.RenameRawValue(originalName, newName); ResultVariables = new HashSet <string>() { ResultVariable.RawValue }; Expression.RenameRawValue(originalName, newName); DependentVariables = DependentVariables.Select(p => p.ReplaceVariableNames(originalName, newName)).ToHashSet(); }
/// <summary> /// Rename the variables. /// </summary> /// <param name="originalName"></param> /// <param name="newName"></param> public void RenameVariable(string originalName, string newName) { ResultVariable.RenameParameter(originalName, newName); ResultVariables = new HashSet <string>() { ResultVariable.RawValue }; Expression.RenameRawValue(originalName, newName); DependentVariables = new HashSet <string>(DependentVariables.Select(s => s.ReplaceVariableNames(originalName, newName))); }
/// <summary> /// Rename all variables. /// </summary> /// <param name="originalName"></param> /// <param name="newName"></param> public void RenameVariable(string originalName, string newName) { _cppResult.RenameRawValue(originalName, newName); ResultVariables = new HashSet <string>() { _cppResult.RawValue }; _paramReplacesments = _paramReplacesments .Select(p => Tuple.Create(p.Item1, p.Item2.ReplaceVariableNames(originalName, newName))) .ToList(); _linesOfCode = _linesOfCode.Select(l => l.ReplaceVariableNames(originalName, newName)).ToList(); DependentVariables = DependentVariables.Select(r => r.ReplaceVariableNames(originalName, newName)).ToHashSet(); }