/// <summary> /// Tries to beautify all "if" statements inside the given statement. /// </summary> /// <remarks> /// The beautification process considers two cases. First, it locates empty bodies of if-then-else statements /// in order to replace them by simpler if-then statements. Second, it detects negated conditions of if-then-else /// statements. In those cases, the negation is removed, and the two statement bodies are swapped. /// </remarks> /// <param name="stmt">statement to beautify</param> /// <returns>the beautified statement</returns> public static Statement BeautifyIfStatements(this Statement stmt) { IfStatementBeautifier isb = new IfStatementBeautifier(stmt); Function result = isb.GetAlgorithm(); return(result.Body); }
/// <summary> /// Tries to beautify all "if" statements inside the given statement. /// </summary> /// <remarks> /// The beautification process considers two cases. First, it locates empty bodies of if-then-else statements /// in order to replace them by simpler if-then statements. Second, it detects negated conditions of if-then-else /// statements. In those cases, the negation is removed, and the two statement bodies are swapped. /// </remarks> /// <param name="stmt">statement to beautify</param> /// <returns>the beautified statement</returns> public static Statement BeautifyIfStatements(this Statement stmt) { IfStatementBeautifier isb = new IfStatementBeautifier(stmt); Function result = isb.GetAlgorithm(); return result.Body; }