mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
d8d335dbf8
commit
0177053e2b
9 changed files with 107 additions and 158 deletions
|
@ -26,7 +26,6 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
* @author Emanuel Graf
|
* @author Emanuel Graf
|
||||||
*/
|
*/
|
||||||
public class ASTWriter {
|
public class ASTWriter {
|
||||||
private ChangeGeneratorWriterVisitor transformationVisitor;
|
|
||||||
private ASTModificationStore modificationStore = new ASTModificationStore();
|
private ASTModificationStore modificationStore = new ASTModificationStore();
|
||||||
private String givenIndentation = ""; //$NON-NLS-1$
|
private String givenIndentation = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -76,14 +75,12 @@ public class ASTWriter {
|
||||||
*/
|
*/
|
||||||
public String write(IASTNode rootNode, String fileScope, NodeCommentMap commentMap)
|
public String write(IASTNode rootNode, String fileScope, NodeCommentMap commentMap)
|
||||||
throws ProblemRuntimeException {
|
throws ProblemRuntimeException {
|
||||||
transformationVisitor = new ChangeGeneratorWriterVisitor(modificationStore, givenIndentation,
|
ChangeGeneratorWriterVisitor transformationVisitor = new ChangeGeneratorWriterVisitor(
|
||||||
fileScope, commentMap);
|
modificationStore, givenIndentation, fileScope, commentMap);
|
||||||
if (rootNode != null) {
|
if (rootNode != null) {
|
||||||
rootNode.accept(transformationVisitor);
|
rootNode.accept(transformationVisitor);
|
||||||
}
|
}
|
||||||
String str = transformationVisitor.toString();
|
return transformationVisitor.toString();
|
||||||
transformationVisitor.cleanCache();
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModificationStore(ASTModificationStore modificationStore) {
|
public void setModificationStore(ASTModificationStore modificationStore) {
|
||||||
|
|
|
@ -217,14 +217,13 @@ public class DeclSpecWriter extends NodeWriter {
|
||||||
scribe.print('{');
|
scribe.print('{');
|
||||||
scribe.printSpace();
|
scribe.printSpace();
|
||||||
IASTEnumerator[] enums = enumSpec.getEnumerators();
|
IASTEnumerator[] enums = enumSpec.getEnumerators();
|
||||||
for (int i = 0; i< enums.length;++i) {
|
for (int i = 0; i < enums.length; ++i) {
|
||||||
writeEnumerator(enums[i]);
|
writeEnumerator(enums[i]);
|
||||||
if (i+1< enums.length) {
|
if (i + 1 < enums.length) {
|
||||||
scribe.print(NodeWriter.COMMA_SPACE);
|
scribe.print(NodeWriter.COMMA_SPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scribe.print('}');
|
scribe.print('}');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeEnumerator(IASTEnumerator enumerator) {
|
private void writeEnumerator(IASTEnumerator enumerator) {
|
||||||
|
@ -246,9 +245,9 @@ public class DeclSpecWriter extends NodeWriter {
|
||||||
ICPPASTBaseSpecifier[] baseSpecifiers = cppComp.getBaseSpecifiers();
|
ICPPASTBaseSpecifier[] baseSpecifiers = cppComp.getBaseSpecifiers();
|
||||||
if (baseSpecifiers.length > 0) {
|
if (baseSpecifiers.length > 0) {
|
||||||
scribe.print(SPACE_COLON_SPACE);
|
scribe.print(SPACE_COLON_SPACE);
|
||||||
for (int i = 0; i < baseSpecifiers.length;++i) {
|
for (int i = 0; i < baseSpecifiers.length; ++i) {
|
||||||
writeBaseSpecifiers(baseSpecifiers[i]);
|
writeBaseSpecifiers(baseSpecifiers[i]);
|
||||||
if (i+1 < baseSpecifiers.length) {
|
if (i + 1 < baseSpecifiers.length) {
|
||||||
scribe.print(COMMA_SPACE);
|
scribe.print(COMMA_SPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||||
|
|
||||||
|
@ -32,23 +32,18 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Generates source code of declarator nodes. The actual string operations are delegated
|
* Generates source code of declarator nodes. The actual string operations are delegated
|
||||||
* to the <code>Scribe</code> class.
|
* to the {@link Scribe} class.
|
||||||
*
|
*
|
||||||
* @see Scribe
|
|
||||||
* @see IASTDeclarator
|
* @see IASTDeclarator
|
||||||
* @author Emanuel Graf IFS
|
* @author Emanuel Graf IFS
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DeclaratorWriter extends NodeWriter {
|
public class DeclaratorWriter extends NodeWriter {
|
||||||
|
|
||||||
private static final String AMPERSAND_SPACE = "& "; //$NON-NLS-1$
|
private static final String AMPERSAND_SPACE = "& "; //$NON-NLS-1$
|
||||||
private static final String AMPERSAND__AMPERSAND_SPACE = "&& "; //$NON-NLS-1$
|
private static final String AMPERSAND__AMPERSAND_SPACE = "&& "; //$NON-NLS-1$
|
||||||
private static final String STAR_SPACE = "* "; //$NON-NLS-1$
|
private static final String STAR_SPACE = "* "; //$NON-NLS-1$
|
||||||
private static final String PURE_VIRTUAL = " =0"; //$NON-NLS-1$
|
private static final String PURE_VIRTUAL = " = 0"; //$NON-NLS-1$
|
||||||
private static final String MUTABLE = "mutable"; //$NON-NLS-1$
|
private static final String MUTABLE = "mutable"; //$NON-NLS-1$
|
||||||
private static final String ARROW_OPERATOR = "->"; //$NON-NLS-1$
|
private static final String ARROW_OPERATOR = "->"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -59,17 +54,17 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
protected void writeDeclarator(IASTDeclarator declarator) {
|
protected void writeDeclarator(IASTDeclarator declarator) {
|
||||||
if (declarator instanceof IASTStandardFunctionDeclarator) {
|
if (declarator instanceof IASTStandardFunctionDeclarator) {
|
||||||
writeFunctionDeclarator((IASTStandardFunctionDeclarator) declarator);
|
writeFunctionDeclarator((IASTStandardFunctionDeclarator) declarator);
|
||||||
}else if (declarator instanceof IASTArrayDeclarator) {
|
} else if (declarator instanceof IASTArrayDeclarator) {
|
||||||
writeArrayDeclarator((IASTArrayDeclarator) declarator);
|
writeArrayDeclarator((IASTArrayDeclarator) declarator);
|
||||||
}else if (declarator instanceof IASTFieldDeclarator) {
|
} else if (declarator instanceof IASTFieldDeclarator) {
|
||||||
writeFieldDeclarator((IASTFieldDeclarator) declarator);
|
writeFieldDeclarator((IASTFieldDeclarator) declarator);
|
||||||
}else if (declarator instanceof ICASTKnRFunctionDeclarator) {
|
} else if (declarator instanceof ICASTKnRFunctionDeclarator) {
|
||||||
writeCKnRFunctionDeclarator((ICASTKnRFunctionDeclarator) declarator);
|
writeCKnRFunctionDeclarator((ICASTKnRFunctionDeclarator) declarator);
|
||||||
}else{
|
} else {
|
||||||
writeDefaultDeclarator(declarator);
|
writeDefaultDeclarator(declarator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasTrailingComments(declarator)) {
|
if (hasTrailingComments(declarator)) {
|
||||||
writeTrailingComments(declarator, false);
|
writeTrailingComments(declarator, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +76,7 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
name.accept(visitor);
|
name.accept(visitor);
|
||||||
writeNestedDeclarator(declarator);
|
writeNestedDeclarator(declarator);
|
||||||
IASTInitializer init = getInitializer(declarator);
|
IASTInitializer init = getInitializer(declarator);
|
||||||
if(init!= null) {
|
if (init != null) {
|
||||||
init.accept(visitor);
|
init.accept(visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +104,7 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
|
|
||||||
private void writeInitializer(IASTStandardFunctionDeclarator funcDec) {
|
private void writeInitializer(IASTStandardFunctionDeclarator funcDec) {
|
||||||
IASTInitializer init = getInitializer(funcDec);
|
IASTInitializer init = getInitializer(funcDec);
|
||||||
if(init != null) {
|
if (init != null) {
|
||||||
init.accept(visitor);
|
init.accept(visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +118,7 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
|
|
||||||
private void writeNestedDeclarator(IASTDeclarator funcDec) {
|
private void writeNestedDeclarator(IASTDeclarator funcDec) {
|
||||||
IASTDeclarator nestedDeclarator = funcDec.getNestedDeclarator();
|
IASTDeclarator nestedDeclarator = funcDec.getNestedDeclarator();
|
||||||
if(nestedDeclarator != null) {
|
if (nestedDeclarator != null) {
|
||||||
scribe.print('(');
|
scribe.print('(');
|
||||||
nestedDeclarator.accept(visitor);
|
nestedDeclarator.accept(visitor);
|
||||||
scribe.print(')');
|
scribe.print(')');
|
||||||
|
@ -143,7 +138,7 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
scribe.printSpace();
|
scribe.printSpace();
|
||||||
scribe.print(MUTABLE);
|
scribe.print(MUTABLE);
|
||||||
}
|
}
|
||||||
if(funcDec.isPureVirtual()) {
|
if (funcDec.isPureVirtual()) {
|
||||||
scribe.print(PURE_VIRTUAL);
|
scribe.print(PURE_VIRTUAL);
|
||||||
}
|
}
|
||||||
writeExceptionSpecification(funcDec, funcDec.getExceptionSpecification());
|
writeExceptionSpecification(funcDec, funcDec.getExceptionSpecification());
|
||||||
|
@ -167,8 +162,8 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
|
|
||||||
protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec, IASTParameterDeclaration[] paraDecls) {
|
protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec, IASTParameterDeclaration[] paraDecls) {
|
||||||
writeNodeList(paraDecls);
|
writeNodeList(paraDecls);
|
||||||
if(funcDec.takesVarArgs()){
|
if (funcDec.takesVarArgs()) {
|
||||||
if(paraDecls.length > 0){
|
if (paraDecls.length > 0) {
|
||||||
scribe.print(COMMA_SPACE);
|
scribe.print(COMMA_SPACE);
|
||||||
}
|
}
|
||||||
scribe.print(VAR_ARGS);
|
scribe.print(VAR_ARGS);
|
||||||
|
@ -178,15 +173,14 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
private void writePointer(IASTPointer operator) {
|
private void writePointer(IASTPointer operator) {
|
||||||
if (operator instanceof ICPPASTPointerToMember) {
|
if (operator instanceof ICPPASTPointerToMember) {
|
||||||
ICPPASTPointerToMember pointerToMemberOp = (ICPPASTPointerToMember) operator;
|
ICPPASTPointerToMember pointerToMemberOp = (ICPPASTPointerToMember) operator;
|
||||||
if(pointerToMemberOp.getName() != null){
|
if (pointerToMemberOp.getName() != null) {
|
||||||
pointerToMemberOp.getName().accept(visitor);
|
pointerToMemberOp.getName().accept(visitor);
|
||||||
scribe.print(STAR_SPACE);
|
scribe.print(STAR_SPACE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scribe.print('*');
|
scribe.print('*');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (operator.isConst()) {
|
if (operator.isConst()) {
|
||||||
scribe.printStringSpace(CONST);
|
scribe.printStringSpace(CONST);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +216,7 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
IASTArrayModifier[] arrMods = arrDecl.getArrayModifiers();
|
IASTArrayModifier[] arrMods = arrDecl.getArrayModifiers();
|
||||||
writeArrayModifiers(arrDecl, arrMods);
|
writeArrayModifiers(arrDecl, arrMods);
|
||||||
IASTInitializer initializer = getInitializer(arrDecl);
|
IASTInitializer initializer = getInitializer(arrDecl);
|
||||||
if(initializer != null) {
|
if (initializer != null) {
|
||||||
initializer.accept(visitor);
|
initializer.accept(visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +249,7 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
scribe.printSpace();
|
scribe.printSpace();
|
||||||
fieldDecl.getBitFieldSize().accept(visitor);
|
fieldDecl.getBitFieldSize().accept(visitor);
|
||||||
IASTInitializer initializer = getInitializer(fieldDecl);
|
IASTInitializer initializer = getInitializer(fieldDecl);
|
||||||
if(initializer != null) {
|
if (initializer != null) {
|
||||||
initializer.accept(visitor);
|
initializer.accept(visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,17 +261,15 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
scribe.print(')');
|
scribe.print(')');
|
||||||
scribe.newLine();
|
scribe.newLine();
|
||||||
writeKnRParameterDeclarations(knrFunct, knrFunct.getParameterDeclarations());
|
writeKnRParameterDeclarations(knrFunct, knrFunct.getParameterDeclarations());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeKnRParameterDeclarations(
|
protected void writeKnRParameterDeclarations(ICASTKnRFunctionDeclarator knrFunct,
|
||||||
ICASTKnRFunctionDeclarator knrFunct, IASTDeclaration[] knrDeclarations) {
|
IASTDeclaration[] knrDeclarations) {
|
||||||
for (int i = 0; i < knrDeclarations.length; ++i) {
|
for (int i = 0; i < knrDeclarations.length; ++i) {
|
||||||
scribe.noNewLines();
|
scribe.noNewLines();
|
||||||
knrDeclarations[i].accept(visitor);
|
knrDeclarations[i].accept(visitor);
|
||||||
scribe.newLines();
|
scribe.newLines();
|
||||||
if(i + 1 < knrDeclarations.length) {
|
if (i + 1 < knrDeclarations.length) {
|
||||||
scribe.newLine();
|
scribe.newLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||||
|
|
||||||
|
@ -21,15 +21,12 @@ import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Base class for node writers. This class contains methods and string constants
|
* Base class for node writers. This class contains methods and string constants
|
||||||
* used by multiple node writers.
|
* used by multiple node writers.
|
||||||
*
|
*
|
||||||
* @author Emanuel Graf IFS
|
* @author Emanuel Graf IFS
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class NodeWriter {
|
public class NodeWriter {
|
||||||
|
|
||||||
protected Scribe scribe;
|
protected Scribe scribe;
|
||||||
protected ASTVisitor visitor;
|
protected ASTVisitor visitor;
|
||||||
protected NodeCommentMap commentMap;
|
protected NodeCommentMap commentMap;
|
||||||
|
@ -72,31 +69,37 @@ public class NodeWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeNodeList(IASTNode[] nodes) {
|
protected void writeNodeList(IASTNode[] nodes) {
|
||||||
for(int i = 0; i < nodes.length; ++i) {
|
for (int i = 0; i < nodes.length; ++i) {
|
||||||
nodes[i].accept(visitor);
|
nodes[i].accept(visitor);
|
||||||
if(i + 1 < nodes.length) {
|
if (i + 1 < nodes.length) {
|
||||||
scribe.print(COMMA_SPACE);
|
scribe.print(COMMA_SPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void visitNodeIfNotNull(IASTNode node){
|
protected void visitNodeIfNotNull(IASTNode node) {
|
||||||
if(node != null){
|
if (node != null) {
|
||||||
node.accept(visitor);
|
node.accept(visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void writeTrailingComments(IASTNode node) {
|
protected void writeTrailingComments(IASTNode node) {
|
||||||
//default write newLine
|
// Default is to write a new line after trailing comments.
|
||||||
writeTrailingComments(node, true);
|
writeTrailingComments(node, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasTrailingComments(IASTNode node){
|
protected void writeTrailingComments(IASTNode node, boolean newLine) {
|
||||||
if(getTrailingComments(node).size()>0) {
|
for (IASTComment comment : getTrailingComments(node)) {
|
||||||
return true;
|
scribe.printSpace();
|
||||||
|
scribe.print(comment.getComment());
|
||||||
|
if (newLine) {
|
||||||
|
scribe.newLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
protected boolean hasTrailingComments(IASTNode node) {
|
||||||
|
return !getTrailingComments(node).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<IASTComment> getTrailingComments(IASTNode node) {
|
private ArrayList<IASTComment> getTrailingComments(IASTNode node) {
|
||||||
|
@ -108,22 +111,9 @@ public class NodeWriter {
|
||||||
}
|
}
|
||||||
return trailingComments;
|
return trailingComments;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeTrailingComments(IASTNode node, boolean newLine) {
|
|
||||||
for(IASTComment comment : getTrailingComments(node)) {
|
|
||||||
scribe.printSpace();
|
|
||||||
scribe.print(comment.getComment());
|
|
||||||
if(newLine) {
|
|
||||||
scribe.newLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean hasFreestandingComments(IASTNode node){
|
protected boolean hasFreestandingComments(IASTNode node) {
|
||||||
if(getFreestandingComments(node).size()>0) {
|
return !getFreestandingComments(node).isEmpty();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<IASTComment> getFreestandingComments(IASTNode node) {
|
private ArrayList<IASTComment> getFreestandingComments(IASTNode node) {
|
||||||
|
@ -137,7 +127,7 @@ public class NodeWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeFreeStandingComments(IASTNode node) {
|
protected void writeFreeStandingComments(IASTNode node) {
|
||||||
for(IASTComment comment : getFreestandingComments(node)) {
|
for (IASTComment comment : getFreestandingComments(node)) {
|
||||||
scribe.print(comment.getComment());
|
scribe.print(comment.getComment());
|
||||||
scribe.newLine();
|
scribe.newLine();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||||
|
|
||||||
|
@ -46,17 +46,14 @@ import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Generates source code of statement nodes. The actual string operations are delegated
|
* Generates source code of statement nodes. The actual string operations are delegated
|
||||||
* to the <code>Scribe</code> class.
|
* to the <code>Scribe</code> class.
|
||||||
*
|
*
|
||||||
* @see Scribe
|
* @see Scribe
|
||||||
* @see IASTStatement
|
* @see IASTStatement
|
||||||
* @author Emanuel Graf IFS
|
* @author Emanuel Graf IFS
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class StatementWriter extends NodeWriter{
|
public class StatementWriter extends NodeWriter {
|
||||||
|
|
||||||
private static final String DEFAULT = "default:"; //$NON-NLS-1$
|
private static final String DEFAULT = "default:"; //$NON-NLS-1$
|
||||||
private static final String CASE = "case "; //$NON-NLS-1$
|
private static final String CASE = "case "; //$NON-NLS-1$
|
||||||
private static final String WHILE = "while("; //$NON-NLS-1$
|
private static final String WHILE = "while("; //$NON-NLS-1$
|
||||||
|
@ -85,7 +82,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param statement
|
* @param statement
|
||||||
* @param newLine if true print a newline if statment usually have one.
|
* @param newLine if true print a newline if statement usually have one.
|
||||||
* @return {@link ASTVisitor#PROCESS_SKIP}
|
* @return {@link ASTVisitor#PROCESS_SKIP}
|
||||||
*/
|
*/
|
||||||
protected int writeStatement(IASTStatement statement, boolean newLine) {
|
protected int writeStatement(IASTStatement statement, boolean newLine) {
|
||||||
|
@ -114,14 +111,14 @@ public class StatementWriter extends NodeWriter{
|
||||||
} else if (statement instanceof IASTCaseStatement) {
|
} else if (statement instanceof IASTCaseStatement) {
|
||||||
writeCaseStatement((IASTCaseStatement) statement);
|
writeCaseStatement((IASTCaseStatement) statement);
|
||||||
// usually newLine
|
// usually newLine
|
||||||
}else if (statement instanceof IASTDefaultStatement) {
|
} else if (statement instanceof IASTDefaultStatement) {
|
||||||
writeDefaultStatement((IASTDefaultStatement)statement);
|
writeDefaultStatement((IASTDefaultStatement)statement);
|
||||||
} else if (statement instanceof IASTContinueStatement){
|
} else if (statement instanceof IASTContinueStatement) {
|
||||||
writeContinueStatement((IASTContinueStatement)statement);
|
writeContinueStatement((IASTContinueStatement)statement);
|
||||||
// usually newLine
|
// usually newLine
|
||||||
} else if (statement instanceof IASTCompoundStatement) {
|
} else if (statement instanceof IASTCompoundStatement) {
|
||||||
writeCompoundStatement((IASTCompoundStatement) statement);
|
writeCompoundStatement((IASTCompoundStatement) statement);
|
||||||
if(compoundNoNewLine){
|
if (compoundNoNewLine) {
|
||||||
newLine = false;
|
newLine = false;
|
||||||
compoundNoNewLine = false;
|
compoundNoNewLine = false;
|
||||||
}
|
}
|
||||||
|
@ -156,13 +153,10 @@ public class StatementWriter extends NodeWriter{
|
||||||
throw new ProblemRuntimeException((IASTProblemStatement)statement);
|
throw new ProblemRuntimeException((IASTProblemStatement)statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasTrailingComments(statement)) {
|
if (hasTrailingComments(statement)) {
|
||||||
writeTrailingComments(statement, newLine);
|
writeTrailingComments(statement, newLine);
|
||||||
}
|
} else if (newLine) {
|
||||||
else{
|
scribe.newLine();
|
||||||
if(newLine){
|
|
||||||
scribe.newLine();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ASTVisitor.PROCESS_SKIP;
|
return ASTVisitor.PROCESS_SKIP;
|
||||||
|
@ -186,15 +180,14 @@ public class StatementWriter extends NodeWriter{
|
||||||
if (forStatment instanceof ICPPASTForStatement) {
|
if (forStatment instanceof ICPPASTForStatement) {
|
||||||
ICPPASTForStatement cppForStatment = (ICPPASTForStatement) forStatment;
|
ICPPASTForStatement cppForStatment = (ICPPASTForStatement) forStatment;
|
||||||
IASTDeclaration cppConditionDeclaration = cppForStatment.getConditionDeclaration();
|
IASTDeclaration cppConditionDeclaration = cppForStatment.getConditionDeclaration();
|
||||||
if(cppConditionDeclaration == null) {
|
if (cppConditionDeclaration == null) {
|
||||||
visitNodeIfNotNull(cppForStatment.getConditionExpression());
|
visitNodeIfNotNull(cppForStatment.getConditionExpression());
|
||||||
scribe.printSemicolon();
|
scribe.printSemicolon();
|
||||||
} else {
|
} else {
|
||||||
cppConditionDeclaration.accept(visitor);
|
cppConditionDeclaration.accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(forStatment.getConditionExpression() != null) {
|
if (forStatment.getConditionExpression() != null) {
|
||||||
forStatment.getConditionExpression().accept(visitor);
|
forStatment.getConditionExpression().accept(visitor);
|
||||||
scribe.printSemicolon();
|
scribe.printSemicolon();
|
||||||
}
|
}
|
||||||
|
@ -225,7 +218,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
if (ifStatement instanceof ICPPASTIfStatement) {
|
if (ifStatement instanceof ICPPASTIfStatement) {
|
||||||
ICPPASTIfStatement cppIfStatment = (ICPPASTIfStatement) ifStatement;
|
ICPPASTIfStatement cppIfStatment = (ICPPASTIfStatement) ifStatement;
|
||||||
|
|
||||||
if(cppIfStatment.getConditionDeclaration() == null) {
|
if (cppIfStatment.getConditionDeclaration() == null) {
|
||||||
cppIfStatment.getConditionExpression().accept(visitor);
|
cppIfStatment.getConditionExpression().accept(visitor);
|
||||||
} else {
|
} else {
|
||||||
writeDeclarationWithoutSemicolon(cppIfStatment.getConditionDeclaration());
|
writeDeclarationWithoutSemicolon(cppIfStatment.getConditionDeclaration());
|
||||||
|
@ -238,17 +231,16 @@ public class StatementWriter extends NodeWriter{
|
||||||
scribe.newLines();
|
scribe.newLines();
|
||||||
nextCompoundNoNewLine();
|
nextCompoundNoNewLine();
|
||||||
IASTStatement elseClause = ifStatement.getElseClause();
|
IASTStatement elseClause = ifStatement.getElseClause();
|
||||||
writeBodyStatement(ifStatement.getThenClause(), elseClause != null ? true : false);
|
writeBodyStatement(ifStatement.getThenClause(), elseClause != null);
|
||||||
|
|
||||||
if(elseClause != null){
|
if (elseClause != null) {
|
||||||
scribe.print(ELSE);
|
scribe.print(ELSE);
|
||||||
nextCompoundNoNewLine();
|
nextCompoundNoNewLine();
|
||||||
writeBodyStatement(elseClause, false);
|
writeBodyStatement(elseClause, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeDeclarationWithoutSemicolon(
|
protected void writeDeclarationWithoutSemicolon(IASTDeclaration declaration) {
|
||||||
IASTDeclaration declaration) {
|
|
||||||
declWriter.writeDeclaration(declaration, false);
|
declWriter.writeDeclaration(declaration, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +271,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
scribe.noNewLines();
|
scribe.noNewLines();
|
||||||
scribe.print(RETURN);
|
scribe.print(RETURN);
|
||||||
IASTExpression returnValue = returnStatement.getReturnValue();
|
IASTExpression returnValue = returnStatement.getReturnValue();
|
||||||
if(returnValue != null){
|
if (returnValue != null) {
|
||||||
scribe.printSpaces(1);
|
scribe.printSpaces(1);
|
||||||
returnValue.accept(visitor);
|
returnValue.accept(visitor);
|
||||||
}
|
}
|
||||||
|
@ -327,7 +319,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
scribe.noNewLines();
|
scribe.noNewLines();
|
||||||
if (whileStatment instanceof ICPPASTWhileStatement) {
|
if (whileStatment instanceof ICPPASTWhileStatement) {
|
||||||
ICPPASTWhileStatement cppWhileStatment = (ICPPASTWhileStatement) whileStatment;
|
ICPPASTWhileStatement cppWhileStatment = (ICPPASTWhileStatement) whileStatment;
|
||||||
if(cppWhileStatment.getConditionDeclaration() == null) {
|
if (cppWhileStatment.getConditionDeclaration() == null) {
|
||||||
cppWhileStatment.getCondition().accept(visitor);
|
cppWhileStatment.getCondition().accept(visitor);
|
||||||
} else {
|
} else {
|
||||||
writeDeclarationWithoutSemicolon(cppWhileStatment.getConditionDeclaration());
|
writeDeclarationWithoutSemicolon(cppWhileStatment.getConditionDeclaration());
|
||||||
|
@ -344,7 +336,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
private void writeCaseStatement(IASTCaseStatement caseStatement) {
|
private void writeCaseStatement(IASTCaseStatement caseStatement) {
|
||||||
nextCompoundIndentationLevelOneMore();
|
nextCompoundIndentationLevelOneMore();
|
||||||
|
|
||||||
if(!switchIsNew){
|
if (!switchIsNew) {
|
||||||
scribe.decrementIndentationLevel();
|
scribe.decrementIndentationLevel();
|
||||||
}
|
}
|
||||||
scribe.print(CASE);
|
scribe.print(CASE);
|
||||||
|
@ -361,7 +353,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
scribe.noNewLines();
|
scribe.noNewLines();
|
||||||
if (switchStatement instanceof ICPPASTSwitchStatement) {
|
if (switchStatement instanceof ICPPASTSwitchStatement) {
|
||||||
ICPPASTSwitchStatement cppSwitchStatement = (ICPPASTSwitchStatement) switchStatement;
|
ICPPASTSwitchStatement cppSwitchStatement = (ICPPASTSwitchStatement) switchStatement;
|
||||||
if(cppSwitchStatement.getControllerDeclaration() == null) {
|
if (cppSwitchStatement.getControllerDeclaration() == null) {
|
||||||
cppSwitchStatement.getControllerExpression().accept(visitor);
|
cppSwitchStatement.getControllerExpression().accept(visitor);
|
||||||
} else {
|
} else {
|
||||||
declWriter.writeDeclaration(cppSwitchStatement.getControllerDeclaration(), false);
|
declWriter.writeDeclaration(cppSwitchStatement.getControllerDeclaration(), false);
|
||||||
|
@ -380,7 +372,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
private void writeDefaultStatement(IASTDefaultStatement defaultStatement) {
|
private void writeDefaultStatement(IASTDefaultStatement defaultStatement) {
|
||||||
nextCompoundIndentationLevelOneMore();
|
nextCompoundIndentationLevelOneMore();
|
||||||
|
|
||||||
if(!switchIsNew){
|
if (!switchIsNew) {
|
||||||
scribe.decrementIndentationLevel();
|
scribe.decrementIndentationLevel();
|
||||||
}
|
}
|
||||||
scribe.print(DEFAULT);
|
scribe.print(DEFAULT);
|
||||||
|
@ -395,11 +387,11 @@ public class StatementWriter extends NodeWriter{
|
||||||
statements.accept(visitor);
|
statements.accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasFreestandingComments(compoundStatement)) {
|
if (hasFreestandingComments(compoundStatement)) {
|
||||||
writeFreeStandingComments(compoundStatement);
|
writeFreeStandingComments(compoundStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(decrementIndentationLevelOneMore){
|
if (decrementIndentationLevelOneMore) {
|
||||||
scribe.decrementIndentationLevel();
|
scribe.decrementIndentationLevel();
|
||||||
decrementIndentationLevelOneMore = false;
|
decrementIndentationLevelOneMore = false;
|
||||||
}
|
}
|
||||||
|
@ -411,14 +403,14 @@ public class StatementWriter extends NodeWriter{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeBodyStatement(IASTStatement statement, boolean isDoStatement) {
|
protected void writeBodyStatement(IASTStatement statement, boolean isDoStatement) {
|
||||||
if (statement instanceof IASTCompoundStatement){
|
if (statement instanceof IASTCompoundStatement) {
|
||||||
//TODO hsr existiert noch eine methode
|
//TODO hsr existiert noch eine methode
|
||||||
statement.accept(visitor);
|
statement.accept(visitor);
|
||||||
if(!isDoStatement){
|
if (!isDoStatement) {
|
||||||
scribe.newLine();
|
scribe.newLine();
|
||||||
}
|
}
|
||||||
compoundNoNewLine = false;
|
compoundNoNewLine = false;
|
||||||
} else if (statement instanceof IASTNullStatement){
|
} else if (statement instanceof IASTNullStatement) {
|
||||||
statement.accept(visitor);
|
statement.accept(visitor);
|
||||||
scribe.newLine();
|
scribe.newLine();
|
||||||
} else {
|
} else {
|
||||||
|
@ -432,18 +424,16 @@ 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(){
|
protected void nextCompoundNoNewLine() {
|
||||||
compoundNoNewLine = true;
|
compoundNoNewLine = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indent one time more at the end (before the closing Brackets)
|
* Indent one time more at the end (before the closing Brackets)
|
||||||
* of a Compound-Statement
|
* of a Compound-Statement
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
protected void nextCompoundIndentationLevelOneMore(){
|
protected void nextCompoundIndentationLevelOneMore() {
|
||||||
decrementIndentationLevelOneMore = true;
|
decrementIndentationLevelOneMore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +441,7 @@ public class StatementWriter extends NodeWriter{
|
||||||
IFile file = FileHelper.getFileFromNode(statement);
|
IFile file = FileHelper.getFileFromNode(statement);
|
||||||
int offset = statement.getFileLocation().getNodeOffset();
|
int offset = statement.getFileLocation().getNodeOffset();
|
||||||
int length = statement.getFileLocation().getNodeLength();
|
int length = statement.getFileLocation().getNodeLength();
|
||||||
String code =FileContentHelper.getContent(file, offset, length);
|
String code = FileContentHelper.getContent(file, offset, length);
|
||||||
|
|
||||||
scribe.println(code);
|
scribe.println(code);
|
||||||
return ASTVisitor.PROCESS_SKIP;
|
return ASTVisitor.PROCESS_SKIP;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||||
|
|
||||||
|
@ -28,30 +28,28 @@ import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ContainerNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
|
|
||||||
public class ASTModificationHelper {
|
public class ASTModificationHelper {
|
||||||
|
|
||||||
private final ModificationScopeStack modificationStore;
|
private final ModificationScopeStack modificationStore;
|
||||||
|
|
||||||
public ASTModificationHelper(ModificationScopeStack stack) {
|
public ASTModificationHelper(ModificationScopeStack stack) {
|
||||||
this.modificationStore = stack;
|
this.modificationStore = stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T extends IASTNode> T[] createModifiedChildArray(IASTNode parent, T[] unmodifiedChildren, Class<T> clazz, NodeCommentMap commentMap) {
|
||||||
public <T extends IASTNode> T[] createModifiedChildArray(IASTNode parent, T[] unmodifiedChildren, Class<T> clazz, NodeCommentMap commentMap){
|
|
||||||
ArrayList<T> modifiedChildren = new ArrayList<T>(Arrays.asList(unmodifiedChildren));
|
ArrayList<T> modifiedChildren = new ArrayList<T>(Arrays.asList(unmodifiedChildren));
|
||||||
|
|
||||||
for(ASTModification parentModification : modificationsForNode(parent)){
|
for (ASTModification parentModification : modificationsForNode(parent)) {
|
||||||
switch(parentModification.getKind()){
|
switch (parentModification.getKind()) {
|
||||||
case APPEND_CHILD:
|
case APPEND_CHILD:
|
||||||
IASTNode newNode = parentModification.getNewNode();
|
IASTNode newNode = parentModification.getNewNode();
|
||||||
T appendedTNode = cast(newNode, clazz);
|
T appendedTNode = cast(newNode, clazz);
|
||||||
if (appendedTNode != null) {
|
if (appendedTNode != null) {
|
||||||
modifiedChildren.add(appendedTNode);
|
modifiedChildren.add(appendedTNode);
|
||||||
}
|
}
|
||||||
else if (newNode instanceof ContainerNode){
|
else if (newNode instanceof ContainerNode) {
|
||||||
ContainerNode nodeContainer = (ContainerNode) newNode;
|
ContainerNode nodeContainer = (ContainerNode) newNode;
|
||||||
for(IASTNode currentNode : nodeContainer.getNodes()){
|
for (IASTNode currentNode : nodeContainer.getNodes()) {
|
||||||
T tnode= cast(currentNode, clazz);
|
T tnode= cast(currentNode, clazz);
|
||||||
if(tnode != null){
|
if (tnode != null) {
|
||||||
modifiedChildren.add(tnode);
|
modifiedChildren.add(tnode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,42 +143,35 @@ public class ASTModificationHelper {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private <T> T cast(IASTNode node, Class<T> clazz) {
|
private <T> T cast(IASTNode node, Class<T> clazz) {
|
||||||
if (clazz.isInstance(node)){
|
if (clazz.isInstance(node)) {
|
||||||
return (T) node;
|
return (T) node;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ASTModification> modificationsForNode(IASTNode targetNode) {
|
||||||
public List<ASTModification> modificationsForNode(
|
|
||||||
IASTNode targetNode) {
|
|
||||||
List<ASTModification> modificationsForNode;
|
List<ASTModification> modificationsForNode;
|
||||||
if(modificationStore.getModifiedNodes().contains(targetNode)){
|
if (modificationStore.getModifiedNodes().contains(targetNode)) {
|
||||||
modificationsForNode = modificationStore.getModificationsForNode(targetNode);
|
modificationsForNode = modificationStore.getModificationsForNode(targetNode);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
modificationsForNode = Collections.emptyList();
|
modificationsForNode = Collections.emptyList();
|
||||||
}
|
}
|
||||||
return modificationsForNode;
|
return modificationsForNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IASTInitializer getInitializer(IASTDeclarator decl) {
|
public IASTInitializer getInitializer(IASTDeclarator decl) {
|
||||||
IASTInitializer initializer = decl.getInitializer();
|
IASTInitializer initializer = decl.getInitializer();
|
||||||
|
|
||||||
if(initializer != null){
|
if (initializer != null) {
|
||||||
for(ASTModification childModification : modificationsForNode(initializer)){
|
for (ASTModification childModification : modificationsForNode(initializer)) {
|
||||||
switch(childModification.getKind()){
|
switch (childModification.getKind()) {
|
||||||
case REPLACE:
|
case REPLACE:
|
||||||
if(childModification.getNewNode() instanceof IASTInitializer){
|
if (childModification.getNewNode() instanceof IASTInitializer) {
|
||||||
return (IASTInitializer)childModification.getNewNode();
|
return (IASTInitializer)childModification.getNewNode();
|
||||||
} else if (childModification.getNewNode() == null) {
|
} else if (childModification.getNewNode() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
throw new UnhandledASTModificationException(childModification);
|
throw new UnhandledASTModificationException(childModification);
|
||||||
|
|
||||||
|
|
||||||
case INSERT_BEFORE:
|
case INSERT_BEFORE:
|
||||||
throw new UnhandledASTModificationException(childModification);
|
throw new UnhandledASTModificationException(childModification);
|
||||||
|
|
||||||
|
@ -188,13 +179,11 @@ public class ASTModificationHelper {
|
||||||
throw new UnhandledASTModificationException(childModification);
|
throw new UnhandledASTModificationException(childModification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
for (ASTModification parentModification : modificationsForNode(decl)) {
|
||||||
{
|
if (parentModification.getKind() == ModificationKind.APPEND_CHILD) {
|
||||||
for(ASTModification parentModification : modificationsForNode(decl)){
|
|
||||||
if(parentModification.getKind() == ModificationKind.APPEND_CHILD){
|
|
||||||
IASTNode newNode = parentModification.getNewNode();
|
IASTNode newNode = parentModification.getNewNode();
|
||||||
if(newNode instanceof IASTInitializer){
|
if (newNode instanceof IASTInitializer) {
|
||||||
return (IASTInitializer) newNode;
|
return (IASTInitializer) newNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,17 +192,15 @@ public class ASTModificationHelper {
|
||||||
return initializer;
|
return initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends IASTNode> T getNodeAfterReplacement(T replacedNode) {
|
public <T extends IASTNode> T getNodeAfterReplacement(T replacedNode) {
|
||||||
List<ASTModification> modifications = modificationsForNode(replacedNode);
|
List<ASTModification> modifications = modificationsForNode(replacedNode);
|
||||||
for(ASTModification currentModification : modifications){
|
for (ASTModification currentModification : modifications) {
|
||||||
try{
|
try {
|
||||||
if(currentModification.getKind() == ModificationKind.REPLACE){
|
if (currentModification.getKind() == ModificationKind.REPLACE) {
|
||||||
return (T) currentModification.getNewNode();
|
return (T) currentModification.getNewNode();
|
||||||
}
|
}
|
||||||
}
|
} catch (ClassCastException e) {
|
||||||
catch(ClassCastException e){
|
|
||||||
throw new UnhandledASTModificationException(currentModification);
|
throw new UnhandledASTModificationException(currentModification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,10 +84,8 @@ public class ChangeGeneratorWriterVisitor extends ASTWriterVisitor {
|
||||||
this.fileScope = fileScope;
|
this.fileScope = fileScope;
|
||||||
this.shouldVisitTranslationUnit = true;
|
this.shouldVisitTranslationUnit = true;
|
||||||
this.stack = new ModificationScopeStack(modificationStore);
|
this.stack = new ModificationScopeStack(modificationStore);
|
||||||
declaratorWriter = new ModifiedASTDeclaratorWriter(scribe, this,
|
declaratorWriter = new ModifiedASTDeclaratorWriter(scribe, this, stack, commentMap);
|
||||||
stack, commentMap);
|
expWriter = new ModifiedASTExpressionWriter(scribe, this, macroHandler, stack, commentMap);
|
||||||
expWriter = new ModifiedASTExpressionWriter(scribe, this, macroHandler,
|
|
||||||
stack, commentMap);
|
|
||||||
statementWriter = new ModifiedASTStatementWriter(scribe, this, stack, commentMap);
|
statementWriter = new ModifiedASTStatementWriter(scribe, this, stack, commentMap);
|
||||||
declSpecWriter = new ModifiedASTDeclSpecWriter(scribe, this, stack, commentMap);
|
declSpecWriter = new ModifiedASTDeclSpecWriter(scribe, this, stack, commentMap);
|
||||||
declarationWriter = new ModifiedASTDeclarationWriter(scribe, this, stack, commentMap);
|
declarationWriter = new ModifiedASTDeclarationWriter(scribe, this, stack, commentMap);
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
* Tom Ball (Google)
|
* Tom Ball (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.refactoring;
|
package org.eclipse.cdt.ui.tests.refactoring;
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,6 @@ public class ExtractFunctionRefactoringTest extends RefactoringTest {
|
||||||
private boolean virtual;
|
private boolean virtual;
|
||||||
private static int nr = 1;
|
private static int nr = 1;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
* @param files
|
|
||||||
*/
|
|
||||||
public ExtractFunctionRefactoringTest(String name, Collection<TestSourceFile> files) {
|
public ExtractFunctionRefactoringTest(String name, Collection<TestSourceFile> files) {
|
||||||
super(name, files);
|
super(name, files);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue