mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Eliminated unnecessary blank lines in refactored code.
This commit is contained in:
parent
73337a5882
commit
5326d2930a
3 changed files with 49 additions and 49 deletions
|
@ -12,8 +12,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -32,6 +30,8 @@ import org.eclipse.cdt.internal.core.dom.rewrite.changegenerator.ChangeGenerator
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ASTWriter main class. Generates source code from <code>IASTNode</code>.
|
||||
* Uses a {@link ChangeGeneratorWriterVisitor} to generate the code for the given nodes.
|
||||
|
@ -173,7 +173,7 @@ public class ASTWriter {
|
|||
if (isFunctionDeclaration(node1) != isFunctionDeclaration(node2)) {
|
||||
return true;
|
||||
}
|
||||
if (requiresTrailingBlankLine(node1)) {
|
||||
if (node2 != null && requiresTrailingBlankLine(node1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||
|
@ -36,6 +34,8 @@ import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTLiteralNode;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Visits all nodes, prints leading comments and handles macro expansions. The
|
||||
* source code generation is delegated to severals {@code NodeWriter}s.
|
||||
|
|
|
@ -115,11 +115,11 @@ public class StatementWriter extends NodeWriter {
|
|||
writeContinueStatement((IASTContinueStatement)statement);
|
||||
// usually newLine
|
||||
} else if (statement instanceof IASTCompoundStatement) {
|
||||
writeCompoundStatement((IASTCompoundStatement) statement);
|
||||
if (compoundNoNewLine) {
|
||||
newLine = false;
|
||||
compoundNoNewLine = false;
|
||||
}
|
||||
writeCompoundStatement((IASTCompoundStatement) statement);
|
||||
} else if (statement instanceof IASTBreakStatement) {
|
||||
writeBreakStatement((IASTBreakStatement) statement);
|
||||
// usually newLine
|
||||
|
@ -396,7 +396,7 @@ public class StatementWriter extends NodeWriter {
|
|||
return compoundStatement.getStatements();
|
||||
}
|
||||
|
||||
// TODO(sprigogin): Rename second parameter
|
||||
// TODO(sprigogin): Invert and rename second parameter
|
||||
protected void writeBodyStatement(IASTStatement statement, boolean isDoStatement) {
|
||||
if (statement instanceof IASTCompoundStatement) {
|
||||
//TODO hsr existiert noch eine methode
|
||||
|
@ -417,7 +417,7 @@ public class StatementWriter extends NodeWriter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Write no new Line after the next compound statement
|
||||
* Write no new line after the next compound statement
|
||||
*/
|
||||
protected void nextCompoundNoNewLine() {
|
||||
compoundNoNewLine = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue