mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Automatic formatting of code affected by refactoring.
This commit is contained in:
parent
65673a50e1
commit
afb3fae823
90 changed files with 5152 additions and 5765 deletions
|
@ -70,11 +70,12 @@ public class ASTWriterTest extends RewriteBaseTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void compareFiles(Map<String,TestSourceFile> testResourceFiles) throws Exception {
|
||||
protected void compareFiles(Map<String, TestSourceFile> testResourceFiles) throws Exception {
|
||||
for (String fileName : testResourceFiles.keySet()) {
|
||||
TestSourceFile testFile = testResourceFiles.get(fileName);
|
||||
String code = generateSource(testFile);
|
||||
assertEquals(TestHelper.unifyNewLines(testFile.getExpectedSource()), TestHelper.unifyNewLines(code + System.getProperty("line.separator"))); //$NON-NLS-1$
|
||||
assertEquals(TestHelper.unifyNewLines(testFile.getExpectedSource()),
|
||||
TestHelper.unifyNewLines(code + System.getProperty("line.separator"))); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class SourceRewriteTester extends TestSuite {
|
|||
TestSuite suite = new TestSuite(name);
|
||||
Iterator<RewriteBaseTest> it = testCases.iterator();
|
||||
while (it.hasNext()) {
|
||||
RewriteBaseTest subject =it.next();
|
||||
RewriteBaseTest subject = it.next();
|
||||
suite.addTest(subject);
|
||||
}
|
||||
return suite;
|
||||
|
@ -88,11 +88,11 @@ public class SourceRewriteTester extends TestSuite {
|
|||
}
|
||||
|
||||
private static ArrayList<RewriteBaseTest> createTests(BufferedReader inputReader) throws Exception {
|
||||
String line;
|
||||
ASTWriterTestSourceFile file = null;
|
||||
MatcherState matcherState = MatcherState.skip;
|
||||
ArrayList<RewriteBaseTest> testCases = new ArrayList<RewriteBaseTest>();
|
||||
|
||||
String line;
|
||||
while ((line = inputReader.readLine()) != null) {
|
||||
if (lineMatchesBeginOfTest(line)) {
|
||||
matcherState = MatcherState.inTest;
|
||||
|
@ -156,7 +156,7 @@ public class SourceRewriteTester extends TestSuite {
|
|||
}
|
||||
|
||||
private static RewriteBaseTest createTestClass(String testName, ASTWriterTestSourceFile file) throws Exception {
|
||||
ASTWriterTest test = new ASTWriterTest(testName,file);
|
||||
ASTWriterTest test = new ASTWriterTest(testName, file);
|
||||
TextSelection sel = file.getSelection();
|
||||
if (sel != null) {
|
||||
test.setFileWithSelection(file.getName());
|
||||
|
|
|
@ -49,7 +49,7 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void runTest() throws Exception{
|
||||
public void runTest() throws Exception {
|
||||
final ASTModificationStore modStore = new ASTModificationStore();
|
||||
IFile testFile = importFile("source.h", source); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software (IFS)- initial API and implementation
|
||||
* Institute for Software (IFS)- initial API and implementation
|
||||
******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
|
@ -29,26 +29,26 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTParameterDeclaration;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
/**
|
||||
* @author Emanuel Graf IFS
|
||||
*
|
||||
*/
|
||||
public class AddDeclarationBug extends ChangeGeneratorTest {
|
||||
|
||||
|
||||
|
||||
|
||||
public AddDeclarationBug() {
|
||||
super("Add Declaration Bug Test");
|
||||
|
||||
AddDeclarationBug() {
|
||||
super("AddDeclarationBug");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new AddDeclarationBug();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "class A\n{\npublic:\n A();\n virtual ~A();\n int foo();\n \nprivate:\n int help();\n};"; //$NON-NLS-1$
|
||||
expectedSource = "class A\n{\npublic:\n A();\n virtual ~A();\n int foo();\n \nprivate:\n int help();\n int exp(int i);\n};"; //$NON-NLS-1$
|
||||
expectedSource = "class A\n{\npublic:\n A();\n virtual ~A();\n int foo();\n \nprivate:\n int help();\n\tint exp(int i);\n};"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,4 @@ public class AddDeclarationBug extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new AddDeclarationBug();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,40 +7,44 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
public class ArrayModifierTest extends ChangeGeneratorTest {
|
||||
|
||||
public ArrayModifierTest(){
|
||||
super("Replace Array Modifier"); //$NON-NLS-1$
|
||||
ArrayModifierTest() {
|
||||
super("ArrayModifierTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ArrayModifierTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "int *pi[3];"; //$NON-NLS-1$
|
||||
expectedSource = "int *pi[5][3];"; //$NON-NLS-1$
|
||||
source = "int* pi[3];"; //$NON-NLS-1$
|
||||
expectedSource = "int* pi[5][3];"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitDeclarators = true;
|
||||
|
@ -49,11 +53,12 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
|
|||
@Override
|
||||
public int visit(IASTDeclarator declarator) {
|
||||
if (declarator instanceof IASTArrayDeclarator) {
|
||||
IASTArrayDeclarator arrayDeclarator = (IASTArrayDeclarator)declarator;
|
||||
|
||||
IASTArrayDeclarator arrayDeclarator = (IASTArrayDeclarator) declarator;
|
||||
|
||||
IASTArrayModifier[] modifiers = arrayDeclarator.getArrayModifiers();
|
||||
IASTArrayModifier newModifier = new CPPASTArrayModifier();
|
||||
IASTExpression expr = new CPPASTLiteralExpression(0, "5"); //$NON-NLS-1$
|
||||
IASTExpression expr =
|
||||
new CPPASTLiteralExpression(IASTLiteralExpression.lk_integer_constant, "5".toCharArray()); //$NON-NLS-1$
|
||||
newModifier.setConstantExpression(expr);
|
||||
ASTModification modification = new ASTModification(ModificationKind.INSERT_BEFORE, modifiers[0], newModifier, null);
|
||||
modStore.storeModification(null, modification);
|
||||
|
@ -62,8 +67,4 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ArrayModifierTest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,17 +7,18 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
|
||||
|
@ -25,25 +26,25 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
|
||||
|
||||
public class ArraySizeExpressionTest extends ChangeGeneratorTest {
|
||||
|
||||
public ArraySizeExpressionTest(){
|
||||
super("Insert Array Size Expression"); //$NON-NLS-1$
|
||||
ArraySizeExpressionTest() {
|
||||
super("ArraySizeExpressionTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ArraySizeExpressionTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "int *values = new int[5];"; //$NON-NLS-1$
|
||||
expectedSource = "int *values = new int[6][5];"; //$NON-NLS-1$
|
||||
source = "int* values = new int[5];"; //$NON-NLS-1$
|
||||
expectedSource = "int* values = new int[6][5];"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitExpressions = true;
|
||||
|
@ -56,7 +57,8 @@ public class ArraySizeExpressionTest extends ChangeGeneratorTest {
|
|||
IASTTypeId id= newExpression.getTypeId();
|
||||
IASTArrayDeclarator dtor= (IASTArrayDeclarator) id.getAbstractDeclarator();
|
||||
IASTArrayModifier[] mods= dtor.getArrayModifiers();
|
||||
IASTArrayModifier add= new CPPASTArrayModifier(new CPPASTLiteralExpression(0, "6"));
|
||||
IASTArrayModifier add= new CPPASTArrayModifier(
|
||||
new CPPASTLiteralExpression(IASTLiteralExpression.lk_integer_constant, "6".toCharArray()));
|
||||
ASTModification modification = new ASTModification(ASTModification.ModificationKind.INSERT_BEFORE, mods[0], add, null);
|
||||
modStore.storeModification(null, modification);
|
||||
}
|
||||
|
@ -64,9 +66,4 @@ public class ArraySizeExpressionTest extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ArraySizeExpressionTest();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTConstructorChainInitializer;
|
||||
|
@ -22,25 +22,28 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTIdExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
public class CtorChainInitializerTest extends ChangeGeneratorTest {
|
||||
|
||||
public CtorChainInitializerTest(){
|
||||
super("Insert Before Ctor Initializer"); //$NON-NLS-1$
|
||||
CtorChainInitializerTest() {
|
||||
super("CtorChainInitializerTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new CtorChainInitializerTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "TestClass::TestClass(int a, int b):beta(b){\n}\n\n"; //$NON-NLS-1$
|
||||
expectedSource = "TestClass::TestClass(int a, int b):alpha(a), beta(b){\n}\n\n"; //$NON-NLS-1$
|
||||
source = "TestClass::TestClass(int a, int b):beta(b) {\n}\n\n"; //$NON-NLS-1$
|
||||
expectedSource = "TestClass::TestClass(int a, int b) :\n\t\talpha(a), beta(b) {\n}\n\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitDeclarators = true;
|
||||
|
@ -49,7 +52,7 @@ public class CtorChainInitializerTest extends ChangeGeneratorTest {
|
|||
@Override
|
||||
public int visit(IASTDeclarator declarator) {
|
||||
if (declarator instanceof CPPASTFunctionDeclarator) {
|
||||
CPPASTFunctionDeclarator functionDeclarator = (CPPASTFunctionDeclarator)declarator;
|
||||
CPPASTFunctionDeclarator functionDeclarator = (CPPASTFunctionDeclarator) declarator;
|
||||
ICPPASTConstructorChainInitializer ctorInitializer = functionDeclarator.getConstructorChain()[0];
|
||||
CPPASTIdExpression initExpr = new CPPASTIdExpression(new CPPASTName("a".toCharArray())); //$NON-NLS-1$
|
||||
CPPASTName initName = new CPPASTName("alpha".toCharArray()); //$NON-NLS-1$
|
||||
|
@ -63,9 +66,4 @@ public class CtorChainInitializerTest extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new CtorChainInitializerTest();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
|
||||
|
@ -24,15 +24,19 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTypeId;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
public class ExceptionTest extends ChangeGeneratorTest {
|
||||
|
||||
public ExceptionTest(){
|
||||
super("Insert Before Exception Declaration"); //$NON-NLS-1$
|
||||
ExceptionTest() {
|
||||
super("ExceptionTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ExceptionTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "void foo(int parameter) throw (/*Test*/float) /*Test2*/{\n}\n\n"; //$NON-NLS-1$
|
||||
|
@ -41,8 +45,7 @@ public class ExceptionTest extends ChangeGeneratorTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitDeclarators = true;
|
||||
|
@ -69,9 +72,4 @@ public class ExceptionTest extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ExceptionTest();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTIdExpression;
|
||||
|
@ -25,14 +25,14 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class ExpressionTest extends ChangeGeneratorTest {
|
||||
|
||||
public ExpressionTest(){
|
||||
super("Insert Expression"); //$NON-NLS-1$
|
||||
ExpressionTest() {
|
||||
super("ExpressionTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ExpressionTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,10 +41,9 @@ public class ExpressionTest extends ChangeGeneratorTest {
|
|||
expectedSource = "void main(){int s = 0, c = 0, h = 0;\ns = 3, c = 9, h = 5;}"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitExpressions = true;
|
||||
|
@ -63,9 +62,4 @@ public class ExpressionTest extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ExpressionTest();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
|
||||
|
@ -24,17 +24,17 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTParameterDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
public class FirstParameterTest extends ChangeGeneratorTest {
|
||||
|
||||
public FirstParameterTest(){
|
||||
super("Insert Before First Parameter"); //$NON-NLS-1$
|
||||
FirstParameterTest() {
|
||||
super("FirstParameterTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new FirstParameterTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,11 +43,9 @@ public class FirstParameterTest extends ChangeGeneratorTest {
|
|||
expectedSource = "void foo(int newParameter, int a){\n}\n\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitDeclarators = true;
|
||||
|
@ -77,9 +75,4 @@ public class FirstParameterTest extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new FirstParameterTest();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
|
@ -16,12 +16,11 @@ import junit.framework.TestSuite;
|
|||
|
||||
/**
|
||||
* @author Thomas Corbat
|
||||
*
|
||||
*/
|
||||
public class InsertBeforeTestSuite{
|
||||
public class InsertBeforeTestSuite {
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite("Changegenerator InsertBefore Tests");
|
||||
TestSuite suite = new TestSuite("ChangeGenerator InsertBefore Tests");
|
||||
|
||||
suite.addTest(FirstParameterTest.suite());
|
||||
suite.addTest(PointerParameterTest.suite());
|
||||
|
|
|
@ -7,50 +7,44 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNodeFactory;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class MultilineWhitespaceHandlingTest extends ChangeGeneratorTest {
|
||||
|
||||
public MultilineWhitespaceHandlingTest(){
|
||||
super("Multiline Whitespace Handling"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n\r\n }\r\n}\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n int i;\r\n int j;\r\n\r\n }\r\n}\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
MultilineWhitespaceHandlingTest() {
|
||||
super("MultilineWhitespaceHandlingTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new MultilineWhitespaceHandlingTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "void foo() {\r\n\r\n\tfor(int i = 0; i < 10; i++) {\r\n\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "void foo() {\r\n\r\n\tfor(int i = 0; i < 10; i++) {\r\n\t\tint i;\r\n\t\tint j;\r\n\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitStatements = true;
|
||||
|
|
|
@ -7,27 +7,31 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTPointer;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
public class PointerParameterTest extends ChangeGeneratorTest {
|
||||
|
||||
public PointerParameterTest(){
|
||||
super("Insert Pointer for Parameter"); //$NON-NLS-1$
|
||||
PointerParameterTest() {
|
||||
super("PointerParameterTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new PointerParameterTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,8 +42,7 @@ public class PointerParameterTest extends ChangeGeneratorTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitDeclarators = true;
|
||||
|
@ -63,9 +66,4 @@ public class PointerParameterTest extends ChangeGeneratorTest {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new PointerParameterTest();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
|
||||
|
||||
|
@ -21,31 +21,25 @@ import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGenerator
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class SelfInsertionTest extends ChangeGeneratorTest {
|
||||
|
||||
public SelfInsertionTest(){
|
||||
super("Self Insertion Test"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n }\r\n}\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n for(int i = 0;i < 10;i++){\r\n }\r\n }\r\n}\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
SelfInsertionTest() {
|
||||
super("SelfInsertionTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new SelfInsertionTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "void foo() {\r\n\r\n\tfor (int i = 0; i < 10; i++) {\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "void foo() {\r\n\r\n\tfor (int i = 0; i < 10; i++) {\r\n\t\tfor (int i = 0; i < 10; i++) {\r\n\t\t}\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitStatements = true;
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompositeTypeSpecifier;
|
||||
|
@ -25,32 +25,25 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclaration;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class MoveRenameTest extends ChangeGeneratorTest {
|
||||
|
||||
public MoveRenameTest(){
|
||||
super("Swap Rename Declarations"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
|
||||
source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int b;\r\n int a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int d;\r\n int b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
MoveRenameTest() {
|
||||
super("MoveRenameTest");
|
||||
}
|
||||
|
||||
|
||||
public static Test suite() {
|
||||
public static Test suite() {
|
||||
return new MoveRenameTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected void setUp() throws Exception {
|
||||
source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint b;\r\n\tint a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint d;\r\n\tint b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitDeclSpecifiers = true;
|
||||
|
@ -70,8 +63,6 @@ public class MoveRenameTest extends ChangeGeneratorTest {
|
|||
}
|
||||
return super.visit(declSpec);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,46 +7,40 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class MoveTest extends ChangeGeneratorTest {
|
||||
|
||||
public MoveTest(){
|
||||
super("Swap Declarations"); //$NON-NLS-1$
|
||||
MoveTest() {
|
||||
super("MoveTest");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int b;\r\n int a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int a;\r\n int b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
|
||||
public static Test suite() {
|
||||
return new MoveTest();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected void setUp() throws Exception {
|
||||
source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint b;\r\n\tint a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint a;\r\n\tint b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitDeclSpecifiers = true;
|
||||
|
@ -64,8 +58,6 @@ public class MoveTest extends ChangeGeneratorTest {
|
|||
}
|
||||
return super.visit(declSpec);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||
|
@ -20,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTExpressionStatement;
|
||||
|
@ -33,43 +33,37 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
|||
|
||||
public class ReplaceInsertStatementTest extends ChangeGeneratorTest {
|
||||
|
||||
public ReplaceInsertStatementTest() {
|
||||
super("Replace Insert Statement Test");
|
||||
ReplaceInsertStatementTest() {
|
||||
super("ReplaceInsertStatementTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ReplaceInsertStatementTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "void main(){\r\n int i = 0;\r\n ++i;\r\n}"; //$NON-NLS-1$
|
||||
expectedSource = "void main(){\r\n int i = 0;\r\n i = 42;\r\n i++;\r\n}"; //$NON-NLS-1$
|
||||
source = "void main() {\r\n\tint i = 0;\r\n\t++i;\r\n}"; //$NON-NLS-1$
|
||||
expectedSource = "void main() {\r\n\tint i = 0;\r\n\ti = 42;\r\n\ti++;\r\n}"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new ReplaceInsertStatementTest();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest#createModificator(org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore)
|
||||
*/
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitStatements = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int visit(IASTStatement statement) {
|
||||
if (statement instanceof IASTCompoundStatement) {
|
||||
IASTCompoundStatement compStmt = (IASTCompoundStatement) statement;
|
||||
IASTStatement stmt = compStmt.getStatements()[1];
|
||||
|
||||
IASTIdExpression id = new CPPASTIdExpression(
|
||||
new CPPASTName("i".toCharArray()));
|
||||
IASTIdExpression id = new CPPASTIdExpression(new CPPASTName("i".toCharArray()));
|
||||
IASTLiteralExpression value = new CPPASTLiteralExpression(
|
||||
IASTLiteralExpression.lk_integer_constant, "42");
|
||||
IASTLiteralExpression.lk_integer_constant, "42".toCharArray());
|
||||
IASTExpressionStatement insertStmt = new CPPASTExpressionStatement(
|
||||
new CPPASTBinaryExpression(
|
||||
IASTBinaryExpression.op_assign, id, value));
|
||||
|
@ -82,15 +76,12 @@ public class ReplaceInsertStatementTest extends ChangeGeneratorTest {
|
|||
incExp);
|
||||
|
||||
ASTModification replaceMod = new ASTModification(
|
||||
ASTModification.ModificationKind.REPLACE, stmt,
|
||||
replaceStatement, null);
|
||||
ASTModification.ModificationKind.REPLACE, stmt, replaceStatement, null);
|
||||
modStore.storeModification(null, replaceMod);
|
||||
|
||||
ASTModification insertMod = new ASTModification(
|
||||
ASTModification.ModificationKind.INSERT_BEFORE,
|
||||
stmt, insertStmt, null);
|
||||
ASTModification.ModificationKind.INSERT_BEFORE, stmt, insertStmt, null);
|
||||
modStore.storeModification(null, insertMod);
|
||||
|
||||
}
|
||||
|
||||
return PROCESS_CONTINUE;
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompoundStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTExpressionStatement;
|
||||
|
@ -26,31 +26,25 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTUnaryExpression;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class StatementTest extends ChangeGeneratorTest {
|
||||
|
||||
public StatementTest(){
|
||||
super("Replace Then-Statement"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "int f()\r\n{\r\n\tint i = 0;\r\n\tif(i < 1){\r\n\t\t++i;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "int f()\r\n{\r\n\tint i = 0;\r\n\tif(i < 1){\r\n\t i++;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
|
||||
StatementTest() {
|
||||
super("StatementTest");
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return new StatementTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
source = "int f()\r\n{\r\n\tint i = 0;\r\n\tif (i < 1) {\r\n\t\t++i;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
expectedSource = "int f()\r\n{\r\n\tint i = 0;\r\n\tif (i < 1) {\r\n\t\ti++;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ASTVisitor createModificator(
|
||||
final ASTModificationStore modStore) {
|
||||
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||
return new ASTVisitor() {
|
||||
{
|
||||
shouldVisitStatements = true;
|
||||
|
|
|
@ -11,11 +11,12 @@ const int a = 1;
|
|||
//Test3
|
||||
volatile int b = 3;
|
||||
//Test4
|
||||
typedef int *intp;
|
||||
typedef int* intp;
|
||||
//Test5
|
||||
extern int b;
|
||||
//Test6
|
||||
static int c;
|
||||
|
||||
//Test7
|
||||
int foo()
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
//!Commented ElaboratedTypeSpecifier 1
|
||||
//%CPP
|
||||
//Test1
|
||||
class A *A; //Test2
|
||||
class A* A; //Test2
|
||||
//Test3
|
||||
enum Status{ good, bad}; //Test4
|
||||
//Test5
|
||||
|
|
|
@ -76,42 +76,51 @@ extern "C" typedef void FUNC(); /*TEST 2*/
|
|||
//!Commented NamespaceAlias 1
|
||||
//%CPP
|
||||
//TEST 1
|
||||
namespace kurz = ziemlichlangernamespace; //TEST 2
|
||||
namespace kurz = somenamespace; //TEST 2
|
||||
|
||||
//!Commented NamespaceAlias 2
|
||||
//%CPP
|
||||
/*TEST 1*/
|
||||
namespace kurz = ziemlichlangernamespace; /*TEST 2*/
|
||||
namespace kurz = somenamespace; /*TEST 2*/
|
||||
|
||||
//!Commented NamespaceDefinition 1
|
||||
//%CPP
|
||||
//TEST 1
|
||||
namespace ziemlichlangernamespace
|
||||
namespace namespace1
|
||||
{
|
||||
//TEST 2
|
||||
|
||||
//TEST 2
|
||||
|
||||
} //TEST 3
|
||||
|
||||
//!Commented NamespaceDefinition 2
|
||||
//%CPP
|
||||
/*TEST 1*/
|
||||
namespace ziemlichlangernamespace
|
||||
namespace namespace2
|
||||
{
|
||||
/*TEST 2*/
|
||||
|
||||
/*TEST 2*/
|
||||
|
||||
} /*TEST 3*/
|
||||
|
||||
//!Commented NamespaceDefinition 3
|
||||
//%CPP
|
||||
namespace ziemlichlangernamespace
|
||||
namespace namespace3
|
||||
{
|
||||
//TEST
|
||||
|
||||
//TEST
|
||||
|
||||
}
|
||||
|
||||
//!Commented NamespaceDefinition 4
|
||||
//%CPP
|
||||
namespace ziemlichlangernamespace
|
||||
namespace namespace4
|
||||
{
|
||||
//TEST
|
||||
|
||||
//TEST
|
||||
|
||||
}
|
||||
|
||||
void doIt()
|
||||
{
|
||||
int i = 0;
|
||||
|
@ -158,8 +167,9 @@ template<> class MyQueue<double> //TEST 2
|
|||
{
|
||||
//TEST 3
|
||||
std::vector<double> data;
|
||||
|
||||
public:
|
||||
void Add(const double& );
|
||||
void Add(const double&);
|
||||
void Remove();
|
||||
void Print();
|
||||
//TEST 4
|
||||
|
@ -173,8 +183,9 @@ template<> class MyQueue<double> /*TEST 2*/
|
|||
{
|
||||
/*TEST 3*/
|
||||
std::vector<double> data;
|
||||
|
||||
public:
|
||||
void Add(const double& );
|
||||
void Add(const double&);
|
||||
void Remove();
|
||||
void Print();
|
||||
/*TEST 4*/
|
||||
|
@ -214,9 +225,11 @@ class A
|
|||
//TEST 1
|
||||
public: //TEST 2
|
||||
int hallo();
|
||||
|
||||
/*TEST 3*/
|
||||
protected: /*TEST 4*/
|
||||
int b, c;
|
||||
|
||||
private:
|
||||
int p;
|
||||
};
|
||||
|
@ -231,13 +244,13 @@ int i = 2; //TEST 2
|
|||
/*TEST 1*/
|
||||
int i = 2; /*TEST 2*/
|
||||
|
||||
//!Commented typename qualfier 1
|
||||
//!Commented typename qualifier 1
|
||||
//%CPP
|
||||
//TEST 1
|
||||
typename T::A *a6; //TEST 2
|
||||
typename T::A* a6; //TEST 2
|
||||
|
||||
//!Commented typename qualfier 2
|
||||
//!Commented typename qualifier 2
|
||||
//%CPP
|
||||
/*TEST 1*/
|
||||
typename T::A *a6; /*TEST 2*/
|
||||
typename T::A* a6; /*TEST 2*/
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ void foo()
|
|||
{
|
||||
int f();
|
||||
};
|
||||
int (B::* pb)() = &B::f;
|
||||
int (B::*pb)() = &B::f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,13 +22,14 @@ void foo()
|
|||
{
|
||||
int f();
|
||||
};
|
||||
int (B::* pb)() = &B::f;
|
||||
int (B::*pb)() = &B::f;
|
||||
}
|
||||
|
||||
|
||||
//!Commented CPPFunctionDeclaratorTest 1
|
||||
//%CPP
|
||||
char & operator [](unsigned int);
|
||||
char& operator [](unsigned int);
|
||||
|
||||
//TEST 1
|
||||
TestClass::TestClass(int a) //TEST 2
|
||||
{
|
||||
|
@ -38,7 +39,8 @@ TestClass::TestClass(int a) //TEST 2
|
|||
|
||||
//!Commented CPPFunctionDeclaratorTest 2
|
||||
//%CPP
|
||||
char & operator [](unsigned int);
|
||||
char& operator [](unsigned int);
|
||||
|
||||
/*TEST 1*/
|
||||
TestClass::TestClass(int a) /*TEST 2*/
|
||||
{
|
||||
|
@ -48,7 +50,8 @@ TestClass::TestClass(int a) /*TEST 2*/
|
|||
|
||||
//!Commented CPPFunctionDeclaratorTest 3
|
||||
//%CPP
|
||||
char & operator [](unsigned int);
|
||||
char& operator [](unsigned int);
|
||||
|
||||
//TEST 1
|
||||
TestClass::TestClass(int a)
|
||||
:alpha(a) //TEST 2
|
||||
|
@ -59,7 +62,8 @@ TestClass::TestClass(int a)
|
|||
|
||||
//!Commented CPPFunctionDeclaratorTest 4
|
||||
//%CPP
|
||||
char & operator [](unsigned int);
|
||||
char& operator [](unsigned int);
|
||||
|
||||
/*TEST 1*/
|
||||
TestClass::TestClass(int a)
|
||||
:alpha(a) /*TEST 3*/
|
||||
|
@ -76,7 +80,7 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +94,7 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +108,7 @@ void foo()
|
|||
//Test
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +122,7 @@ void foo()
|
|||
{
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +136,7 @@ void foo()
|
|||
//Test
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +149,7 @@ void foo()
|
|||
try {
|
||||
i++; //Test
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +163,7 @@ void foo()
|
|||
i++;
|
||||
//Test
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +176,7 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
} //Test
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +189,7 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
//Test
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +203,7 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
//Test
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +217,7 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
//Test
|
||||
}
|
||||
|
@ -227,9 +231,9 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
}
|
||||
catch(Overflow oo){
|
||||
catch (Overflow oo){
|
||||
}
|
||||
catch(Matherr mm){
|
||||
catch (Matherr mm){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,9 +246,9 @@ void foo()
|
|||
try {
|
||||
i++;
|
||||
}
|
||||
catch(Overflow oo){
|
||||
catch (Overflow oo){
|
||||
}
|
||||
catch(Matherr mm){
|
||||
catch (Matherr mm){
|
||||
//Test
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class Foo
|
|||
{
|
||||
public:
|
||||
//Test
|
||||
char & operator [](unsigned int);
|
||||
char& operator [](unsigned int);
|
||||
};
|
||||
|
||||
//!Commented OperatorName2
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
class Foo
|
||||
{
|
||||
public:
|
||||
char & operator [](unsigned int); //Test
|
||||
char& operator [](unsigned int); //Test
|
||||
};
|
||||
|
||||
//!Commented ConversionName1
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
//TEST 1
|
||||
break; //TEST 2
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ void foo()
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
/*TEST 1*/
|
||||
break; /*TEST 2*/
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void foo()
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
//TEST 1
|
||||
continue; //TEST 2
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ void foo()
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
/*TEST 1*/
|
||||
continue; /*TEST 2*/
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void foo()
|
|||
do{ //TEST 2
|
||||
continue; //TEST 3
|
||||
//TEST 4
|
||||
} while(true); //TEST 5
|
||||
} while (true); //TEST 5
|
||||
}
|
||||
|
||||
|
||||
|
@ -124,7 +124,7 @@ void foo()
|
|||
//TEST 2
|
||||
continue; //TEST 3
|
||||
//TEST 4
|
||||
} while(true); //TEST 5
|
||||
} while (true); //TEST 5
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ void foo()
|
|||
do{ /*TEST 2*/
|
||||
continue; /*TEST 3*/
|
||||
/*TEST 4*/
|
||||
} while(true); /*TEST 5*/
|
||||
} while (true); /*TEST 5*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ void foo()
|
|||
/*TEST 2*/
|
||||
continue; /*TEST 3*/
|
||||
/*TEST 4*/
|
||||
} while(true); /*TEST 5*/
|
||||
} while (true); /*TEST 5*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,7 +158,7 @@ void foo()
|
|||
{
|
||||
do{
|
||||
continue;
|
||||
} while(true); /*TEST 1*/
|
||||
} while (true); /*TEST 1*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,7 +197,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
//TEST 1
|
||||
for(int i = 0;i < 1;++i){ //TEST 2
|
||||
for (int i = 0;i < 1;++i){ //TEST 2
|
||||
break; //TEST 3
|
||||
} //TEST 4
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
//TEST 1
|
||||
for(int i = 0;i < 1;++i){
|
||||
for (int i = 0;i < 1;++i){
|
||||
//TEST 2
|
||||
break; //TEST 3
|
||||
} //TEST 4
|
||||
|
@ -219,7 +219,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
/*TEST 1*/
|
||||
for(int i = 0;i < 1;++i){ /*TEST 2*/
|
||||
for (int i = 0;i < 1;++i){ /*TEST 2*/
|
||||
break; /*TEST 3*/
|
||||
} /*TEST 4*/
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
/*TEST 1*/
|
||||
for(int i = 0;i < 1;++i){
|
||||
for (int i = 0;i < 1;++i){
|
||||
/*TEST 2*/
|
||||
break; /*TEST 3*/
|
||||
} /*TEST 4*/
|
||||
|
@ -240,7 +240,7 @@ void foo()
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
for(int i = 0;i < 1;++i){
|
||||
for (int i = 0;i < 1;++i){
|
||||
break;
|
||||
} /*TEST 4*/
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ void foo()
|
|||
//%CPP
|
||||
int f()
|
||||
{
|
||||
if(int c = f()){
|
||||
if (int c = f()){
|
||||
c++;
|
||||
} //TEST 1
|
||||
return i;
|
||||
|
@ -398,7 +398,7 @@ int f()
|
|||
{
|
||||
int i = 0;
|
||||
//TEST 1
|
||||
if(i < 1){
|
||||
if (i < 1){
|
||||
//TEST 3
|
||||
++i;
|
||||
//TEST 4
|
||||
|
@ -407,7 +407,7 @@ int f()
|
|||
--i;
|
||||
//TEST 6
|
||||
} //TEST 7
|
||||
if(int c = f()){
|
||||
if (int c = f()){
|
||||
c++;
|
||||
} //TEST 8
|
||||
return i;
|
||||
|
@ -420,7 +420,7 @@ int f()
|
|||
{
|
||||
int i = 0;
|
||||
/*TEST 1*/
|
||||
if(i < 1){
|
||||
if (i < 1){
|
||||
/*TEST 1*/
|
||||
++i;
|
||||
/*TEST 1*/
|
||||
|
@ -429,7 +429,7 @@ int f()
|
|||
--i;
|
||||
/*TEST 1*/
|
||||
} /*TEST 1*/
|
||||
if(int c = f()){
|
||||
if (int c = f()){
|
||||
c++;
|
||||
} /*TEST 1*/
|
||||
return i;
|
||||
|
@ -440,7 +440,7 @@ int f()
|
|||
//%CPP
|
||||
int g()
|
||||
{
|
||||
if(10 > 5) //TEST 1
|
||||
if (10 > 5) //TEST 1
|
||||
return 1; //TEST 2
|
||||
|
||||
return 0;
|
||||
|
@ -449,7 +449,7 @@ int g()
|
|||
//=
|
||||
int g()
|
||||
{
|
||||
if(10 > 5)
|
||||
if (10 > 5)
|
||||
//TEST 1
|
||||
return 1; //TEST 2
|
||||
|
||||
|
@ -460,7 +460,7 @@ int g()
|
|||
//%CPP
|
||||
int g()
|
||||
{
|
||||
if(10 > 5) /*TEST 1*/
|
||||
if (10 > 5) /*TEST 1*/
|
||||
return 1; /*TEST 2*/
|
||||
|
||||
return 0;
|
||||
|
@ -469,7 +469,7 @@ int g()
|
|||
//=
|
||||
int g()
|
||||
{
|
||||
if(10 > 5)
|
||||
if (10 > 5)
|
||||
/*TEST 1*/
|
||||
return 1; /*TEST 2*/
|
||||
|
||||
|
@ -583,7 +583,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
//TEST 1
|
||||
while(true){ //TEST 2
|
||||
while (true){ //TEST 2
|
||||
//TEST 3
|
||||
break; //TEST 4
|
||||
//TEST 5
|
||||
|
@ -595,7 +595,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
//TEST 1
|
||||
while(true){
|
||||
while (true){
|
||||
//TEST 2
|
||||
//TEST 3
|
||||
break; //TEST 4
|
||||
|
@ -609,7 +609,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
/*TEST 1*/
|
||||
while(true){ /*TEST 2*/
|
||||
while (true){ /*TEST 2*/
|
||||
/*TEST 3*/
|
||||
break; /*TEST 4*/
|
||||
/*TEST 5*/
|
||||
|
@ -621,7 +621,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
/*TEST 1*/
|
||||
while(true){
|
||||
while (true){
|
||||
/*TEST 2*/
|
||||
/*TEST 3*/
|
||||
break; /*TEST 4*/
|
||||
|
@ -634,7 +634,7 @@ void foo()
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
break;
|
||||
} /*TEST 6*/
|
||||
}
|
||||
|
@ -650,10 +650,10 @@ int foo()
|
|||
++i;
|
||||
return i;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,7 @@
|
|||
//!Commented TemplateFunction1
|
||||
//%CPP
|
||||
template<typename T> int tempFunct(T p)
|
||||
template<typename T>
|
||||
int tempFunct(T p)
|
||||
{
|
||||
++p;
|
||||
//Kommentar
|
||||
|
@ -12,7 +13,8 @@ template<typename T> int tempFunct(T p)
|
|||
//!Commented TemplateFunction2
|
||||
//%CPP
|
||||
//Kommentar
|
||||
template<typename T> int tempFunct(T p)
|
||||
template<typename T>
|
||||
int tempFunct(T p)
|
||||
{
|
||||
++p;
|
||||
p + 4;
|
||||
|
@ -22,7 +24,8 @@ template<typename T> int tempFunct(T p)
|
|||
|
||||
//!Commented TemplateFunction3
|
||||
//%CPP
|
||||
template<typename T> int tempFunct(T p)
|
||||
template<typename T>
|
||||
int tempFunct(T p)
|
||||
{
|
||||
++p;
|
||||
p + 4;
|
||||
|
|
|
@ -7,9 +7,10 @@ inline int foo()
|
|||
|
||||
const int a = 1;
|
||||
volatile int b = 3;
|
||||
typedef int *intp;
|
||||
typedef int* intp;
|
||||
extern int b;
|
||||
static int c;
|
||||
|
||||
int foo()
|
||||
{
|
||||
int i = 1;
|
||||
|
@ -43,7 +44,7 @@ public:
|
|||
|
||||
//!ElaboratedTypeSpecifier
|
||||
//%CPP
|
||||
class A *A;
|
||||
class A* A;
|
||||
enum Status{ good, bad};
|
||||
enum Status stat;
|
||||
union D
|
||||
|
@ -52,7 +53,7 @@ union D
|
|||
int y;
|
||||
};
|
||||
union D d;
|
||||
struct S *S;
|
||||
struct S* S;
|
||||
|
||||
//!EnumeratioSpecifier
|
||||
//%CPP
|
||||
|
|
|
@ -32,12 +32,14 @@ extern "C" typedef void FUNC();
|
|||
|
||||
//!NamespaceAlias
|
||||
//%CPP
|
||||
namespace kurz = ziemlichlangernamespace;
|
||||
namespace kurz = somenamespace;
|
||||
|
||||
//!NamespaceDefinition
|
||||
//%CPP
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
//!TemplateDeclaration
|
||||
|
@ -58,8 +60,9 @@ template<typename T> class MyQueue;
|
|||
template<> class MyQueue<double>
|
||||
{
|
||||
std::vector<double> data;
|
||||
|
||||
public:
|
||||
void Add(const double& );
|
||||
void Add(const double&);
|
||||
void Remove();
|
||||
void Print();
|
||||
};
|
||||
|
@ -92,9 +95,11 @@ using namespace B;
|
|||
class A
|
||||
{
|
||||
public:
|
||||
int hallo();
|
||||
int hello();
|
||||
|
||||
protected:
|
||||
int b, c;
|
||||
|
||||
private:
|
||||
int p;
|
||||
};
|
||||
|
@ -104,7 +109,7 @@ private:
|
|||
//Comment
|
||||
int i = 2;
|
||||
|
||||
//!typename qualfier
|
||||
//!Typename qualifier
|
||||
//%CPP
|
||||
typename T::A *a6;
|
||||
typename T::A* a6;
|
||||
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
//!DeclaratorTest
|
||||
//%CPP
|
||||
int sd;
|
||||
int *ip;
|
||||
int* ip;
|
||||
int hs = 1;
|
||||
char & c;
|
||||
char& c;
|
||||
|
||||
void foo()
|
||||
{
|
||||
struct B
|
||||
{
|
||||
int f();
|
||||
};
|
||||
int (B::* pb)() = &B::f;
|
||||
int (B::*pb)() = &B::f;
|
||||
}
|
||||
|
||||
|
||||
//!ArrayDeclaratorTest
|
||||
//%CPP
|
||||
int *pi[3];
|
||||
int* pi[3];
|
||||
int (*p3i)[3];
|
||||
|
||||
//!FieldDeclaratorTest
|
||||
|
@ -30,38 +31,39 @@ struct Bit
|
|||
//%C
|
||||
int foo();
|
||||
int bar(int a, int b);
|
||||
int fun(const char *a, ...);
|
||||
int fun3(int i, const char *a, ...);
|
||||
int fun(const char* a, ...);
|
||||
int fun3(int i, const char* a, ...);
|
||||
|
||||
//!CPPStandardFunctionDeclaratorTest
|
||||
//%CPP
|
||||
int foo();
|
||||
int bar(int a, int b);
|
||||
int fun(const char *a, ...);
|
||||
int fun2(const char *a ...);
|
||||
int fun3(int i, const char *a, ...);
|
||||
int fun(const char* a, ...);
|
||||
int fun2(const char* a ...);
|
||||
int fun3(int i, const char* a, ...);
|
||||
//= ,... is synonymous with ...
|
||||
int foo();
|
||||
int bar(int a, int b);
|
||||
int fun(const char *a, ...);
|
||||
int fun2(const char *a, ...);
|
||||
int fun3(int i, const char *a, ...);
|
||||
int fun(const char* a, ...);
|
||||
int fun2(const char* a, ...);
|
||||
int fun3(int i, const char* a, ...);
|
||||
|
||||
//!CPPFunctionDeclaratorTest
|
||||
//%CPP
|
||||
char & operator [](unsigned int);
|
||||
char& operator [](unsigned int);
|
||||
class TestClass
|
||||
{
|
||||
int alpha;
|
||||
TestClass(int a);
|
||||
virtual void pure() =0;
|
||||
virtual void pure() = 0;
|
||||
};
|
||||
|
||||
TestClass::TestClass(int a)
|
||||
:alpha(a)
|
||||
{
|
||||
}
|
||||
|
||||
void undefPar(const char *c) throw (int);
|
||||
void undefPar(const char* c) throw (int);
|
||||
int getV() const;
|
||||
int vol() volatile;
|
||||
|
||||
|
@ -72,15 +74,17 @@ class C
|
|||
{
|
||||
int i;
|
||||
double d;
|
||||
|
||||
public:
|
||||
C(int, double);
|
||||
};
|
||||
|
||||
C::C(int ii, double id)
|
||||
try
|
||||
:i(f(ii)), d(id)
|
||||
{
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +98,7 @@ int b, a;
|
|||
|
||||
//!ICPPASTDeclarator with nested declarator being a variable
|
||||
//%C
|
||||
int *(*var[3]);
|
||||
int* (*var[3]);
|
||||
|
||||
//!ICPPASTDeclarator with nested declarator and redundant parentheses
|
||||
//%C
|
||||
|
@ -108,8 +112,8 @@ class Foo
|
|||
};
|
||||
//!ICPPASTReferenceOperator rvalue reference
|
||||
//%CPP
|
||||
int && foo(int && a)
|
||||
int&& foo(int&& a)
|
||||
{
|
||||
char && b;
|
||||
char&& b;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ int i = (int)'A';
|
|||
|
||||
//!CPPCastExpression
|
||||
//%CPP
|
||||
TestClass *i = dynamic_cast<TestClass*>(tc);
|
||||
TestClass *i = static_cast<TestClass*>(tc);
|
||||
TestClass *i = reinterpret_cast<TestClass*>(tc);
|
||||
TestClass *i = const_cast<TestClass*>(tc);
|
||||
TestClass* i = dynamic_cast<TestClass*>(tc);
|
||||
TestClass* i = static_cast<TestClass*>(tc);
|
||||
TestClass* i = reinterpret_cast<TestClass*>(tc);
|
||||
TestClass* i = const_cast<TestClass*>(tc);
|
||||
|
||||
//!ArraySubscrition
|
||||
//%C GNU
|
||||
|
@ -33,6 +33,7 @@ int i = 1 | x;
|
|||
bool b = 1 && x;
|
||||
bool b = 1 || x;
|
||||
int i = x;
|
||||
|
||||
void foo()
|
||||
{
|
||||
i *= x;
|
||||
|
@ -131,7 +132,7 @@ string s = "abc";
|
|||
|
||||
//!CPPLiteralExpression
|
||||
//%CPP
|
||||
TestClass *tc = this;
|
||||
TestClass* tc = this;
|
||||
bool b = true;
|
||||
bool b = false;
|
||||
|
||||
|
@ -141,7 +142,7 @@ int i = ++a;
|
|||
int i = --a;
|
||||
int i = +a;
|
||||
int i = -a;
|
||||
int *b = &a;
|
||||
int* b = &a;
|
||||
int i = *b;
|
||||
int i = ~b;
|
||||
bool b = !false;
|
||||
|
@ -167,7 +168,7 @@ void rethrow()
|
|||
int i = 1;
|
||||
throw i;
|
||||
}
|
||||
catch(int j){
|
||||
catch (int j){
|
||||
throw ;
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +192,7 @@ void f()
|
|||
|
||||
//!CPPNewExpression
|
||||
//%CPP
|
||||
TestClass *tc = new TestClass();
|
||||
TestClass* tc = new TestClass();
|
||||
|
||||
//!CPPSimpleTypeConstructorExpression
|
||||
//%CPP
|
||||
|
|
|
@ -11,7 +11,7 @@ int TestClass::Hallo;
|
|||
class Foo
|
||||
{
|
||||
public:
|
||||
char & operator [](unsigned int);
|
||||
char& operator [](unsigned int);
|
||||
};
|
||||
|
||||
//!ConversionName
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ void foo()
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void foo()
|
|||
{
|
||||
do{
|
||||
continue;
|
||||
} while(true);
|
||||
} while (true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,13 +79,13 @@ void foo()
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
for(int i = 0;i < 1;++i){
|
||||
for (int i = 0;i < 1;++i){
|
||||
break;
|
||||
}
|
||||
for(;;){
|
||||
for (;;){
|
||||
break;
|
||||
}
|
||||
for(;int c = f();){
|
||||
for (;int c = f();){
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void foo()
|
|||
void foo()
|
||||
{
|
||||
int i;
|
||||
for(i = 0;i < 1;++i){
|
||||
for (i = 0;i < 1;++i){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,12 +115,12 @@ int f()
|
|||
int f()
|
||||
{
|
||||
int i = 0;
|
||||
if(i < 1){
|
||||
if (i < 1){
|
||||
++i;
|
||||
}else{
|
||||
--i;
|
||||
}
|
||||
if(int c = f()){
|
||||
if (int c = f()){
|
||||
c++;
|
||||
}
|
||||
return i;
|
||||
|
@ -131,7 +131,7 @@ int f()
|
|||
//%CPP
|
||||
int g()
|
||||
{
|
||||
if(10 > 5)
|
||||
if (10 > 5)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -141,7 +141,7 @@ int g()
|
|||
//%C
|
||||
int g()
|
||||
{
|
||||
if(10 > 5)
|
||||
if (10 > 5)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -240,14 +240,14 @@ int foo(int a)
|
|||
//%CPP
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void fa()
|
||||
{
|
||||
while(int i = f()){
|
||||
while (int i = f()){
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void fa()
|
|||
|
||||
void fb()
|
||||
{
|
||||
while(true);
|
||||
while (true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ void fb()
|
|||
//%C
|
||||
void foo()
|
||||
{
|
||||
while(true){
|
||||
while (true){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -279,10 +279,10 @@ int foo()
|
|||
++i;
|
||||
return i;
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
catch (...){
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ int foo()
|
|||
int foo()
|
||||
{
|
||||
int i = 1;
|
||||
if( i == ZWO)
|
||||
if (i == ZWO)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ int foo()
|
|||
int foo()
|
||||
{
|
||||
int i = 1;
|
||||
if( i == ZWO)
|
||||
if (i == ZWO)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -309,5 +309,5 @@ int foo()
|
|||
|
||||
//!ArrayDeclarationStatementTest
|
||||
//%CPP
|
||||
string *newElements = new string[m_capacity];
|
||||
string* newElements = new string[m_capacity];
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
//![temp.names] examples abschnitt 4/1
|
||||
//%CPP
|
||||
T *p1 = p->template alloc<100>();
|
||||
T* p1 = p->template alloc<100>();
|
||||
|
||||
//![temp.names] examples abschnitt 4/2, didn't work cause of Bug# 164482
|
||||
//%CPP
|
||||
template<class T> void f(T *p)
|
||||
template<class T>
|
||||
void f(T* p)
|
||||
{
|
||||
T::template adjust<100>();
|
||||
}
|
||||
|
|
|
@ -148,6 +148,7 @@ class Klasse0
|
|||
public:
|
||||
Klasse0(); //Comment
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
int i;
|
||||
};
|
||||
|
@ -170,6 +171,7 @@ class Klasse0
|
|||
public:
|
||||
Klasse1();
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
int i;
|
||||
};
|
||||
|
@ -182,6 +184,7 @@ class Klasse0
|
|||
public:
|
||||
Klasse1();
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
int i;
|
||||
}; = //Comment1
|
||||
|
@ -2779,26 +2782,26 @@ int foo = bar; = //Zweiteilig
|
|||
//#org.eclipse.cdt.core.parser.tests.rewrite.comenthandler.CommentHandlingTest
|
||||
//@Klasse1.h
|
||||
//TEST 1
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
//TEST 2
|
||||
} //TEST 3
|
||||
|
||||
//=
|
||||
=>leading
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
//TEST 2
|
||||
} = //TEST 1
|
||||
|
||||
=>trailing
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
//TEST 2
|
||||
} = //TEST 3
|
||||
|
||||
=>freestanding
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
//TEST 2
|
||||
} = //TEST 2
|
||||
|
@ -2807,7 +2810,7 @@ namespace ziemlichlangernamespace
|
|||
//!CommentRecognition215 - von ASTWriter NamesapceDefinition
|
||||
//#org.eclipse.cdt.core.parser.tests.rewrite.comenthandler.CommentHandlingTest
|
||||
//@Klasse1.h
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
//TEST
|
||||
}
|
||||
|
@ -2822,7 +2825,7 @@ void doIt(){
|
|||
=>trailing
|
||||
|
||||
=>freestanding
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
//TEST
|
||||
} = //TEST
|
||||
|
@ -2830,7 +2833,7 @@ namespace ziemlichlangernamespace
|
|||
//!CommentRecognition216 - von ASTWriter NamesapceDefinition
|
||||
//#org.eclipse.cdt.core.parser.tests.rewrite.comenthandler.CommentHandlingTest
|
||||
//@Klasse1.h
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
int i = 0;
|
||||
//TEST
|
||||
|
@ -2846,7 +2849,7 @@ void doIt(){
|
|||
=>trailing
|
||||
|
||||
=>freestanding
|
||||
namespace ziemlichlangernamespace
|
||||
namespace somenamespace
|
||||
{
|
||||
int i = 0;
|
||||
//TEST
|
||||
|
|
|
@ -8,10 +8,19 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.changegenerator.ChangeGeneratorWriterVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter;
|
||||
|
@ -19,9 +28,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
|
||||
/**
|
||||
* ASTWriter main class. Generates source code from <code>IASTNode</code>.
|
||||
* Uses a <code>hangeGeneratorWriterVisitor</code> to generate the code for the given nodes.
|
||||
*
|
||||
* @see ChangeGeneratorWriterVisitor
|
||||
* Uses a {@link ChangeGeneratorWriterVisitor} to generate the code for the given nodes.
|
||||
*
|
||||
* @author Emanuel Graf
|
||||
*/
|
||||
|
@ -54,18 +61,13 @@ public class ASTWriter {
|
|||
* @throws ProblemRuntimeException if the node or one of it's children is a <code>IASTProblemNode</code>.
|
||||
*/
|
||||
public String write(IASTNode rootNode) throws ProblemRuntimeException {
|
||||
return write(rootNode, null, new NodeCommentMap());
|
||||
}
|
||||
|
||||
public String write(IASTNode rootNode, NodeCommentMap commentMap) {
|
||||
return write(rootNode, null, commentMap);
|
||||
return write(rootNode, new NodeCommentMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the source code representing this node including comments.
|
||||
*
|
||||
* @param rootNode Node to write.
|
||||
* @param fileScope
|
||||
* @param commentMap Node Comment Map <code>ASTCommenter</code>
|
||||
* @return A <code>String</code> representing the source code for the node.
|
||||
* @throws ProblemRuntimeException if the node or one of it's children is
|
||||
|
@ -73,17 +75,95 @@ public class ASTWriter {
|
|||
*
|
||||
* @see ASTCommenter#getCommentedNodeMap(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit)
|
||||
*/
|
||||
public String write(IASTNode rootNode, String fileScope, NodeCommentMap commentMap)
|
||||
public String write(IASTNode rootNode, NodeCommentMap commentMap)
|
||||
throws ProblemRuntimeException {
|
||||
ChangeGeneratorWriterVisitor transformationVisitor = new ChangeGeneratorWriterVisitor(
|
||||
modificationStore, givenIndentation, fileScope, commentMap);
|
||||
ChangeGeneratorWriterVisitor writer = new ChangeGeneratorWriterVisitor(
|
||||
modificationStore, givenIndentation, null, commentMap);
|
||||
if (rootNode != null) {
|
||||
rootNode.accept(transformationVisitor);
|
||||
rootNode.accept(writer);
|
||||
}
|
||||
return transformationVisitor.toString();
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
public void setModificationStore(ASTModificationStore modificationStore) {
|
||||
this.modificationStore = modificationStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the node should be separated by a blank line from the node
|
||||
* before it.
|
||||
*
|
||||
* @param node The node.
|
||||
* @return <code>true</code> if the node should be separated by a blank line from the node
|
||||
* before it.
|
||||
*/
|
||||
public static boolean requiresLeadingBlankLine(IASTNode node) {
|
||||
if (node instanceof ICPPASTTemplateDeclaration) {
|
||||
node = ((ICPPASTTemplateDeclaration) node).getDeclaration();
|
||||
}
|
||||
return node instanceof IASTASMDeclaration ||
|
||||
node instanceof IASTFunctionDefinition ||
|
||||
node instanceof ICPPASTVisibilityLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the node should be separated by a blank line from the node
|
||||
* after it.
|
||||
*
|
||||
* @param node The node.
|
||||
* @return <code>true</code> if the node should be separated by a blank line from the node
|
||||
* after it.
|
||||
*/
|
||||
public static boolean requiresTrailingBlankLine(IASTNode node) {
|
||||
if (node instanceof ICPPASTNamespaceDefinition)
|
||||
return true;
|
||||
if (node instanceof IASTFunctionDefinition)
|
||||
return true;
|
||||
if (node instanceof IASTIfStatement) {
|
||||
IASTIfStatement statement = ((IASTIfStatement) node);
|
||||
IASTStatement lastClause = statement.getElseClause();
|
||||
if (lastClause == null)
|
||||
lastClause = statement.getThenClause();
|
||||
|
||||
if (!(lastClause instanceof IASTCompoundStatement) &&
|
||||
!doNodesHaveSameOffset(lastClause, statement)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if there should be no blank line after this node even if a blank
|
||||
* line is normally required before the subsequent node.
|
||||
*
|
||||
* @param node The node.
|
||||
* @return <code>true</code> if there should be no blank line after this node.
|
||||
*/
|
||||
public static boolean suppressesTrailingBlankLine(IASTNode node) {
|
||||
return node instanceof ICPPASTVisibilityLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the two given nodes should be separated by a blank line.
|
||||
*
|
||||
* @param node1 The first node.
|
||||
* @param node2 The second node.
|
||||
* @return <code>true</code> if the blank line between the nodes is needed.
|
||||
*/
|
||||
public static boolean requireBlankLineInBetween(IASTNode node1, IASTNode node2) {
|
||||
if (requiresTrailingBlankLine(node1))
|
||||
return true;
|
||||
|
||||
return !suppressesTrailingBlankLine(node1) && requiresLeadingBlankLine(node2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two given nodes have the same offset. For nodes that are normally
|
||||
* separated by other tokens this is an indication that they were produced by the same macro
|
||||
* expansion.
|
||||
*/
|
||||
private static boolean doNodesHaveSameOffset(IASTNode node1, IASTNode node2) {
|
||||
return node1.getFileLocation().getNodeOffset() == node2.getFileLocation().getNodeOffset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
|
@ -38,15 +39,14 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
|
||||
/**
|
||||
* Visits all nodes, prints leading comments and handles macro expansions. The
|
||||
* source code generation is delegated to severals <code>NodeWriters</code>.
|
||||
* source code generation is delegated to severals {@code NodeWriter}s.
|
||||
*
|
||||
* @see NodeWriter
|
||||
* @see MacroExpansionHandler
|
||||
*
|
||||
* @author Emanuel Graf IFS
|
||||
*/
|
||||
public class ASTWriterVisitor extends ASTVisitor {
|
||||
protected Scribe scribe = new Scribe();
|
||||
protected final Scribe scribe = new Scribe();
|
||||
protected NodeCommentMap commentMap;
|
||||
protected ExpressionWriter expWriter;
|
||||
protected DeclSpecWriter declSpecWriter;
|
||||
|
@ -57,6 +57,9 @@ public class ASTWriterVisitor extends ASTVisitor {
|
|||
protected NameWriter nameWriter;
|
||||
protected TemplateParameterWriter tempParameterWriter;
|
||||
protected MacroExpansionHandler macroHandler;
|
||||
private boolean insertLeadingBlankLine;
|
||||
private boolean suppressLeadingBlankLine;
|
||||
private boolean spaceNeededBeforeName;
|
||||
|
||||
{
|
||||
shouldVisitExpressions = true;
|
||||
|
@ -83,6 +86,7 @@ public class ASTWriterVisitor extends ASTVisitor {
|
|||
scribe.setGivenIndentation(givenIndentation);
|
||||
init(commentMap);
|
||||
this.commentMap = commentMap;
|
||||
this.suppressLeadingBlankLine = true;
|
||||
}
|
||||
|
||||
private void init(NodeCommentMap commentMap) {
|
||||
|
@ -135,6 +139,10 @@ public class ASTWriterVisitor extends ASTVisitor {
|
|||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
if (spaceNeededBeforeName && name.getSimpleID().length != 0) {
|
||||
scribe.printSpace();
|
||||
spaceNeededBeforeName = false;
|
||||
}
|
||||
writeLeadingComments(name);
|
||||
if (!macroHandler.checkisMacroExpansionNode(name)) {
|
||||
nameWriter.writeName(name);
|
||||
|
@ -166,24 +174,31 @@ public class ASTWriterVisitor extends ASTVisitor {
|
|||
|
||||
@Override
|
||||
public int visit(IASTStatement statement) {
|
||||
insertBlankLineIfNeeded(statement);
|
||||
writeLeadingComments(statement);
|
||||
if (macroHandler.isStatementWithMixedLocation(statement) &&
|
||||
!(statement instanceof IASTCompoundStatement)) {
|
||||
return statementWriter.writeMixedStatement(statement);
|
||||
try {
|
||||
if (macroHandler.isStatementWithMixedLocation(statement) &&
|
||||
!(statement instanceof IASTCompoundStatement)) {
|
||||
return statementWriter.writeMixedStatement(statement);
|
||||
}
|
||||
if (macroHandler.checkisMacroExpansionNode(statement)) {
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
}
|
||||
return statementWriter.writeStatement(statement, true);
|
||||
} finally {
|
||||
setLeadingBlankLineFlags(statement);
|
||||
}
|
||||
if (macroHandler.checkisMacroExpansionNode(statement)) {
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
}
|
||||
return statementWriter.writeStatement(statement, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTDeclaration declaration) {
|
||||
insertBlankLineIfNeeded(declaration);
|
||||
writeLeadingComments(declaration);
|
||||
if (!macroHandler.checkisMacroExpansionNode(declaration)) {
|
||||
declarationWriter.writeDeclaration(declaration);
|
||||
setLeadingBlankLineFlags(declaration);
|
||||
}
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -219,9 +234,7 @@ public class ASTWriterVisitor extends ASTVisitor {
|
|||
parameterDeclaration.getDeclSpecifier().accept(this);
|
||||
IASTDeclarator declarator = getParameterDeclarator(parameterDeclaration);
|
||||
|
||||
if (getParameterName(declarator).toString().length() != 0) {
|
||||
scribe.printSpaces(1);
|
||||
}
|
||||
spaceNeededBeforeName = true;
|
||||
declarator.accept(this);
|
||||
}
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
|
@ -237,9 +250,11 @@ public class ASTWriterVisitor extends ASTVisitor {
|
|||
|
||||
@Override
|
||||
public int visit(ICPPASTNamespaceDefinition namespace) {
|
||||
insertBlankLineIfNeeded(namespace);
|
||||
writeLeadingComments(namespace);
|
||||
if (!macroHandler.checkisMacroExpansionNode(namespace)) {
|
||||
declarationWriter.writeDeclaration(namespace);
|
||||
setLeadingBlankLineFlags(namespace);
|
||||
}
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
}
|
||||
|
@ -257,4 +272,38 @@ public class ASTWriterVisitor extends ASTVisitor {
|
|||
scribe.cleanCache();
|
||||
macroHandler.reset();
|
||||
}
|
||||
|
||||
private void insertBlankLineIfNeeded(IASTNode node) {
|
||||
if (!suppressLeadingBlankLine &&
|
||||
(insertLeadingBlankLine || ASTWriter.requiresLeadingBlankLine(node))) {
|
||||
scribe.newLine();
|
||||
}
|
||||
insertLeadingBlankLine = false;
|
||||
suppressLeadingBlankLine = false;
|
||||
}
|
||||
|
||||
private void setLeadingBlankLineFlags(IASTNode node) {
|
||||
insertLeadingBlankLine = ASTWriter.requiresTrailingBlankLine(node);
|
||||
suppressLeadingBlankLine = ASTWriter.suppressesTrailingBlankLine(node);
|
||||
}
|
||||
|
||||
public boolean isSuppressLeadingBlankLine() {
|
||||
return suppressLeadingBlankLine;
|
||||
}
|
||||
|
||||
public void setSuppressLeadingBlankLine(boolean value) {
|
||||
this.suppressLeadingBlankLine = value;
|
||||
}
|
||||
|
||||
public boolean isSpaceNeededBeforeName() {
|
||||
return spaceNeededBeforeName;
|
||||
}
|
||||
|
||||
public void setSpaceNeededBeforeName(boolean value) {
|
||||
this.spaceNeededBeforeName = value;
|
||||
}
|
||||
|
||||
public void newLine() {
|
||||
scribe.newLine();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -62,12 +61,12 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
private static final String ENUM = "enum "; //$NON-NLS-1$
|
||||
private static final String _BOOL = "_Bool"; //$NON-NLS-1$
|
||||
|
||||
public DeclSpecWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public DeclSpecWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
}
|
||||
|
||||
protected void writeDelcSpec(IASTDeclSpecifier declSpec) {
|
||||
// Write general DelcSpec Keywords
|
||||
// Write general DelcSpec Keywords
|
||||
writeDeclSpec(declSpec);
|
||||
if (declSpec instanceof ICPPASTDeclSpecifier) {
|
||||
writeCPPDeclSpec((ICPPASTDeclSpecifier) declSpec);
|
||||
|
@ -129,7 +128,6 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
break;
|
||||
}
|
||||
|
||||
System.err.println("Unknown specifier type: " + type); //$NON-NLS-1$
|
||||
throw new IllegalArgumentException("Unknown specifier type: " + type); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
@ -152,7 +150,7 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
}
|
||||
|
||||
private void writeNamedTypeSpecifier(ICPPASTNamedTypeSpecifier namedSpc) {
|
||||
if ( namedSpc.isTypename() ){
|
||||
if (namedSpc.isTypename()) {
|
||||
scribe.print(TYPENAME);
|
||||
}
|
||||
namedSpc.getName().accept(visitor);
|
||||
|
@ -179,8 +177,7 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
return CLASS_SPACE;
|
||||
|
||||
default:
|
||||
System.err.println("Unknown ElaboratedType: " + kind); //$NON-NLS-1$
|
||||
throw new IllegalArgumentException("Unknown ElaboratedType: " + kind); //$NON-NLS-1$
|
||||
throw new IllegalArgumentException("Unknown elaborated type: " + kind); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,12 +251,13 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
hasTrailingComments = hasTrailingComments(baseSpecifiers[baseSpecifiers.length-1].getName());
|
||||
}
|
||||
}
|
||||
if (!hasTrailingComments){
|
||||
if (!hasTrailingComments) {
|
||||
scribe.newLine();
|
||||
}
|
||||
scribe.print('{');
|
||||
scribe.newLine();
|
||||
scribe.incrementIndentationLevel();
|
||||
visitor.setSuppressLeadingBlankLine(true);
|
||||
IASTDeclaration[] decls = getMembers(compDeclSpec);
|
||||
|
||||
if (decls.length > 0) {
|
||||
|
@ -306,8 +304,7 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
case ICPPASTCompositeTypeSpecifier.k_class:
|
||||
return CLASS;
|
||||
default:
|
||||
System.err.println("Unknow Specifiertype: " + key); //$NON-NLS-1$
|
||||
throw new IllegalArgumentException("Unknow Specifiertype: " + key); //$NON-NLS-1$
|
||||
throw new IllegalArgumentException("Unknown type specifier: " + key); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,8 +315,7 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
case IASTCompositeTypeSpecifier.k_union:
|
||||
return UNION;
|
||||
default:
|
||||
System.err.println("Unknow Specifiertype: " + key); //$NON-NLS-1$
|
||||
throw new IllegalArgumentException("Unknow Specifiertype: " + key); //$NON-NLS-1$
|
||||
throw new IllegalArgumentException("Unknown type specifier: " + key); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,7 +364,7 @@ public class DeclSpecWriter extends NodeWriter {
|
|||
private void printQualifiers(IASTSimpleDeclSpecifier simpDeclSpec) {
|
||||
if (simpDeclSpec.isSigned()) {
|
||||
scribe.printStringSpace(SIGNED);
|
||||
} else if (simpDeclSpec.isUnsigned()){
|
||||
} else if (simpDeclSpec.isUnsigned()) {
|
||||
scribe.printStringSpace(UNSIGNED);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -47,7 +47,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
* @see IASTDeclaration
|
||||
* @author Emanuel Graf IFS
|
||||
*/
|
||||
public class DeclarationWriter extends NodeWriter{
|
||||
public class DeclarationWriter extends NodeWriter {
|
||||
private static final String ASM_END = ")"; //$NON-NLS-1$
|
||||
private static final String ASM_START = "asm("; //$NON-NLS-1$
|
||||
private static final String TEMPLATE_DECLARATION = "template<"; //$NON-NLS-1$
|
||||
|
@ -57,7 +57,7 @@ public class DeclarationWriter extends NodeWriter{
|
|||
private static final String USING = "using "; //$NON-NLS-1$
|
||||
private boolean printSemicolon;
|
||||
|
||||
public DeclarationWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public DeclarationWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ public class DeclarationWriter extends NodeWriter{
|
|||
writeASMDeclatation((IASTASMDeclaration) declaration);
|
||||
} else if (declaration instanceof IASTFunctionDefinition) {
|
||||
writeFunctionDefinition((IASTFunctionDefinition) declaration);
|
||||
addNewLine = false;
|
||||
} else if (declaration instanceof IASTProblemDeclaration) {
|
||||
throw new ProblemRuntimeException((IASTProblemDeclaration) declaration);
|
||||
} else if (declaration instanceof IASTSimpleDeclaration) {
|
||||
|
@ -98,17 +99,17 @@ public class DeclarationWriter extends NodeWriter{
|
|||
}
|
||||
|
||||
if (hasTrailingComments(declaration)) {
|
||||
writeTrailingComments(declaration, addNewLine);
|
||||
} else if (addNewLine) {
|
||||
writeTrailingComments(declaration, false);
|
||||
}
|
||||
if (addNewLine) {
|
||||
scribe.newLine();
|
||||
}
|
||||
if (hasFreestandingComments(declaration)) {
|
||||
if (declaration instanceof IASTFunctionDefinition) {
|
||||
scribe.newLine();
|
||||
}
|
||||
writeFreeStandingComments(declaration);
|
||||
}
|
||||
|
||||
if (declaration instanceof ICPPASTUsingDirective) {
|
||||
scribe.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeVisibilityLabel(ICPPASTVisibilityLabel visiblityLabel) {
|
||||
|
@ -181,17 +182,18 @@ public class DeclarationWriter extends NodeWriter{
|
|||
if (!hasTrailingComments(namespaceDefinition.getName())) {
|
||||
scribe.newLine();
|
||||
}
|
||||
scribe.printLBrace();
|
||||
scribe.newLine();
|
||||
scribe.print('{');
|
||||
scribe.newLine(2);
|
||||
writeDeclarationsInNamespace(namespaceDefinition, namespaceDefinition.getDeclarations());
|
||||
if (hasFreestandingComments(namespaceDefinition)) {
|
||||
writeFreeStandingComments(namespaceDefinition);
|
||||
}
|
||||
scribe.printRBrace();
|
||||
scribe.newLine();
|
||||
scribe.print('}');
|
||||
|
||||
if (hasTrailingComments(namespaceDefinition)) {
|
||||
writeTrailingComments(namespaceDefinition);
|
||||
}else{
|
||||
} else {
|
||||
scribe.newLine();
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +213,7 @@ public class DeclarationWriter extends NodeWriter{
|
|||
}
|
||||
|
||||
private void writeLinkageSpecification(ICPPASTLinkageSpecification linkageSpecification) {
|
||||
scribe.print( EXTERN);
|
||||
scribe.print(EXTERN);
|
||||
scribe.print(linkageSpecification.getLiteral());
|
||||
scribe.printSpaces(1);
|
||||
|
||||
|
@ -266,10 +268,10 @@ public class DeclarationWriter extends NodeWriter{
|
|||
if (declSpecifier instanceof IASTSimpleDeclSpecifier) {
|
||||
IASTSimpleDeclSpecifier simDeclSpec = (IASTSimpleDeclSpecifier) declSpecifier;
|
||||
if (simDeclSpec.getType() != IASTSimpleDeclSpecifier.t_unspecified) {
|
||||
scribe.printSpace();
|
||||
visitor.setSpaceNeededBeforeName(true);
|
||||
}
|
||||
}else {
|
||||
scribe.printSpace();
|
||||
} else {
|
||||
visitor.setSpaceNeededBeforeName(true);
|
||||
}
|
||||
IASTDeclarator declarator = ASTQueries.findOutermostDeclarator(funcDef.getDeclarator());
|
||||
declarator.accept(visitor);
|
||||
|
@ -325,10 +327,16 @@ public class DeclarationWriter extends NodeWriter{
|
|||
}
|
||||
|
||||
if (decls.length > 0) {
|
||||
if (!noSpace) {
|
||||
scribe.printSpace();
|
||||
if (decls.length == 1) {
|
||||
if (!noSpace)
|
||||
visitor.setSpaceNeededBeforeName(true);
|
||||
decls[0].accept(visitor);
|
||||
} else {
|
||||
if (!noSpace) {
|
||||
scribe.printSpace();
|
||||
}
|
||||
writeNodeList(decls);
|
||||
}
|
||||
writeNodeList(decls);
|
||||
}
|
||||
|
||||
printSemicolon();
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -40,14 +39,12 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
* @author Emanuel Graf IFS
|
||||
*/
|
||||
public class DeclaratorWriter extends NodeWriter {
|
||||
private static final String 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 AMPERSAND_AMPERSAND = "&&"; //$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 ARROW_OPERATOR = "->"; //$NON-NLS-1$
|
||||
|
||||
public DeclaratorWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public DeclaratorWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
}
|
||||
|
||||
|
@ -63,7 +60,8 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
} else {
|
||||
writeDefaultDeclarator(declarator);
|
||||
}
|
||||
|
||||
|
||||
visitor.setSpaceNeededBeforeName(false);
|
||||
if (hasTrailingComments(declarator)) {
|
||||
writeTrailingComments(declarator, false);
|
||||
}
|
||||
|
@ -119,6 +117,10 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
private void writeNestedDeclarator(IASTDeclarator funcDec) {
|
||||
IASTDeclarator nestedDeclarator = funcDec.getNestedDeclarator();
|
||||
if (nestedDeclarator != null) {
|
||||
if (visitor.isSpaceNeededBeforeName()) {
|
||||
scribe.printSpace();
|
||||
visitor.setSpaceNeededBeforeName(false);
|
||||
}
|
||||
scribe.print('(');
|
||||
nestedDeclarator.accept(visitor);
|
||||
scribe.print(')');
|
||||
|
@ -160,10 +162,10 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
}
|
||||
}
|
||||
|
||||
protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec, IASTParameterDeclaration[] paraDecls) {
|
||||
writeNodeList(paraDecls);
|
||||
protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec, IASTParameterDeclaration[] paramDecls) {
|
||||
writeNodeList(paramDecls);
|
||||
if (funcDec.takesVarArgs()) {
|
||||
if (paraDecls.length > 0) {
|
||||
if (paramDecls.length > 0) {
|
||||
scribe.print(COMMA_SPACE);
|
||||
}
|
||||
scribe.print(VAR_ARGS);
|
||||
|
@ -175,7 +177,7 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
ICPPASTPointerToMember pointerToMemberOp = (ICPPASTPointerToMember) operator;
|
||||
if (pointerToMemberOp.getName() != null) {
|
||||
pointerToMemberOp.getName().accept(visitor);
|
||||
scribe.print(STAR_SPACE);
|
||||
scribe.print('*');
|
||||
}
|
||||
} else {
|
||||
scribe.print('*');
|
||||
|
@ -198,9 +200,9 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
writePointer(pointOp);
|
||||
} else if (operator instanceof ICPPASTReferenceOperator) {
|
||||
if (((ICPPASTReferenceOperator) operator).isRValueReference()) {
|
||||
scribe.print(AMPERSAND_AMPERSAND_SPACE);
|
||||
scribe.print(AMPERSAND_AMPERSAND);
|
||||
} else {
|
||||
scribe.print(AMPERSAND_SPACE);
|
||||
scribe.print('&');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
|
@ -115,7 +114,7 @@ public class ExpressionWriter extends NodeWriter{
|
|||
private static final String THIS = "this"; //$NON-NLS-1$
|
||||
private final MacroExpansionHandler macroHandler;
|
||||
|
||||
public ExpressionWriter(Scribe scribe, ASTVisitor visitor, MacroExpansionHandler macroHandler, NodeCommentMap commentMap) {
|
||||
public ExpressionWriter(Scribe scribe, ASTWriterVisitor visitor, MacroExpansionHandler macroHandler, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
this.macroHandler = macroHandler;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
|
||||
|
@ -36,7 +35,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
*/
|
||||
public class InitializerWriter extends NodeWriter{
|
||||
|
||||
public InitializerWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public InitializerWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -36,7 +35,7 @@ public class NameWriter extends NodeWriter {
|
|||
* @param scribe
|
||||
* @param visitor
|
||||
*/
|
||||
public NameWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public NameWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
}
|
||||
|
||||
|
@ -45,7 +44,7 @@ public class NameWriter extends NodeWriter {
|
|||
writeTempalteId((ICPPASTTemplateId) name);
|
||||
} else if (name instanceof ICPPASTConversionName) {
|
||||
scribe.print(OPERATOR);
|
||||
((ICPPASTConversionName)name).getTypeId().accept(visitor);
|
||||
((ICPPASTConversionName) name).getTypeId().accept(visitor);
|
||||
} else if (name instanceof ICPPASTQualifiedName){
|
||||
writeQualifiedName((ICPPASTQualifiedName) name);
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCopyLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -28,7 +27,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
*/
|
||||
public class NodeWriter {
|
||||
protected Scribe scribe;
|
||||
protected ASTVisitor visitor;
|
||||
protected ASTWriterVisitor visitor;
|
||||
protected NodeCommentMap commentMap;
|
||||
protected static final String COMMA_SPACE = ", "; //$NON-NLS-1$
|
||||
protected static final String EQUALS = " = "; //$NON-NLS-1$
|
||||
|
@ -61,7 +60,7 @@ public class NodeWriter {
|
|||
protected static final String COLON_COLON = "::"; //$NON-NLS-1$
|
||||
protected static final String COLON_SPACE = ": "; //$NON-NLS-1$
|
||||
|
||||
public NodeWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public NodeWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super();
|
||||
this.scribe = scribe;
|
||||
this.visitor = visitor;
|
||||
|
@ -89,12 +88,17 @@ public class NodeWriter {
|
|||
}
|
||||
|
||||
protected void writeTrailingComments(IASTNode node, boolean newLine) {
|
||||
boolean first = true;
|
||||
for (IASTComment comment : getTrailingComments(node)) {
|
||||
scribe.printSpace();
|
||||
scribe.print(comment.getComment());
|
||||
if (newLine) {
|
||||
if (!first) {
|
||||
scribe.newLine();
|
||||
}
|
||||
scribe.printSpace();
|
||||
scribe.print(comment.getComment());
|
||||
first = false;
|
||||
}
|
||||
if (newLine) {
|
||||
scribe.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Institute for Software - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
|
@ -20,92 +20,93 @@ package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
|||
*/
|
||||
public class Scribe {
|
||||
private int indentationLevel = 0;
|
||||
private int indentationSize = 4; //HSR tcorbat: could be a tab character too - this is not a very elegant solution
|
||||
// Any positive indentation size is good enough since the code is going to be formatted anyway.
|
||||
private int indentationSize = 4;
|
||||
private StringBuilder buffer = new StringBuilder();
|
||||
private boolean isAtLineBeginning = true;
|
||||
private String newLine = System.getProperty("line.separator"); //$NON-NLS-1$
|
||||
private String givenIndentation = null;
|
||||
private String givenIndentation;
|
||||
|
||||
private boolean skipLineBreaks;
|
||||
private boolean skipSemicolons;
|
||||
|
||||
private boolean noNewLine = false;
|
||||
private boolean noSemicolon = false;
|
||||
|
||||
public void newLine() {
|
||||
if (!noNewLine) {
|
||||
if (!skipLineBreaks) {
|
||||
isAtLineBeginning = true;
|
||||
buffer.append(getNewline());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void indent() {
|
||||
if (givenIndentation != null) {
|
||||
buffer.append(givenIndentation);
|
||||
}
|
||||
printSpaces(indentationLevel * indentationSize);
|
||||
}
|
||||
|
||||
|
||||
private void indentIfNewLine() {
|
||||
if (isAtLineBeginning) {
|
||||
isAtLineBeginning = false;
|
||||
indent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getNewline() {
|
||||
return newLine;
|
||||
}
|
||||
|
||||
|
||||
public void print(String code) {
|
||||
indentIfNewLine();
|
||||
buffer.append(code);
|
||||
}
|
||||
|
||||
|
||||
public void println(String code) {
|
||||
print(code);
|
||||
newLine();
|
||||
}
|
||||
|
||||
|
||||
public void print(String code, String code2) {
|
||||
print(code);
|
||||
buffer.append(code2);
|
||||
}
|
||||
|
||||
|
||||
public void println(String code, String code2) {
|
||||
print(code, code2);
|
||||
newLine();
|
||||
}
|
||||
|
||||
|
||||
public void println(String code, char[] code2) {
|
||||
print(code);
|
||||
buffer.append(code2);
|
||||
newLine();
|
||||
}
|
||||
|
||||
|
||||
public void printSpaces(int number) {
|
||||
indentIfNewLine();
|
||||
for (int i = 0; i < number; ++i) {
|
||||
printSpace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void noSemicolon() {
|
||||
noSemicolon = true;
|
||||
skipSemicolons = true;
|
||||
}
|
||||
|
||||
|
||||
public void printSemicolon() {
|
||||
if (!noSemicolon) {
|
||||
if (!skipSemicolons) {
|
||||
indentIfNewLine();
|
||||
buffer.append(';');
|
||||
} else {
|
||||
noSemicolon = false;
|
||||
skipSemicolons = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public void print (char code) {
|
||||
|
||||
public void print(char code) {
|
||||
indentIfNewLine();
|
||||
buffer.append(code);
|
||||
}
|
||||
|
@ -114,19 +115,19 @@ public class Scribe {
|
|||
indentIfNewLine();
|
||||
buffer.append(code);
|
||||
}
|
||||
|
||||
|
||||
public void println(char[] code) {
|
||||
print(code);
|
||||
newLine();
|
||||
}
|
||||
|
||||
|
||||
public void printStringSpace(String code) {
|
||||
print(code);
|
||||
printSpace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a { to the Buffer an increases the indentation level.
|
||||
* Prints a { to the buffer an increases the indentation level.
|
||||
*/
|
||||
public void printLBrace() {
|
||||
print('{');
|
||||
|
@ -134,31 +135,31 @@ public class Scribe {
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints a } to the Buffer an decrease the indentation level.
|
||||
* Prints a } to the buffer an decrease the indentation level.
|
||||
*/
|
||||
public void printRBrace() {
|
||||
--indentationLevel;
|
||||
print('}');
|
||||
}
|
||||
|
||||
|
||||
public void incrementIndentationLevel() {
|
||||
++indentationLevel;
|
||||
}
|
||||
|
||||
|
||||
public void decrementIndentationLevel() {
|
||||
if (indentationLevel > 0) {
|
||||
--indentationLevel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void noNewLines() {
|
||||
noNewLine = true;
|
||||
skipLineBreaks = true;
|
||||
}
|
||||
|
||||
|
||||
protected void newLines() {
|
||||
noNewLine = false;
|
||||
skipLineBreaks = false;
|
||||
}
|
||||
|
||||
|
||||
public void newLine(int i) {
|
||||
while (i > 0) {
|
||||
newLine();
|
||||
|
@ -167,7 +168,7 @@ public class Scribe {
|
|||
}
|
||||
|
||||
public void printSpace() {
|
||||
buffer.append(' ');
|
||||
buffer.append(' ');
|
||||
}
|
||||
|
||||
public String getGivenIndentation() {
|
||||
|
@ -179,6 +180,6 @@ public class Scribe {
|
|||
}
|
||||
|
||||
public void cleanCache() {
|
||||
buffer = new StringBuilder();
|
||||
buffer = new StringBuilder();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,17 +56,17 @@ import org.eclipse.core.resources.IFile;
|
|||
public class StatementWriter extends NodeWriter {
|
||||
private static final String DEFAULT = "default:"; //$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$
|
||||
private static final String TRY = "try "; //$NON-NLS-1$
|
||||
private static final String CATCH = "catch("; //$NON-NLS-1$
|
||||
private static final String CATCH = "catch ("; //$NON-NLS-1$
|
||||
private static final String RETURN = "return"; //$NON-NLS-1$
|
||||
private static final String GOTO = "goto "; //$NON-NLS-1$
|
||||
private static final String CONTINUE = "continue"; //$NON-NLS-1$
|
||||
private static final String BREAK = "break"; //$NON-NLS-1$
|
||||
private static final String ELSE = "else"; //$NON-NLS-1$
|
||||
private static final String IF = "if("; //$NON-NLS-1$
|
||||
private static final String FOR = "for("; //$NON-NLS-1$
|
||||
private static final String DO_WHILE = " while("; //$NON-NLS-1$
|
||||
private static final String IF = "if ("; //$NON-NLS-1$
|
||||
private static final String FOR = "for ("; //$NON-NLS-1$
|
||||
private static final String DO_WHILE = " while ("; //$NON-NLS-1$
|
||||
private static final String DO = "do"; //$NON-NLS-1$
|
||||
private static final String SWITCH_BRACKET = "switch ("; //$NON-NLS-1$
|
||||
private boolean compoundNoNewLine = false;
|
||||
|
@ -74,14 +74,15 @@ public class StatementWriter extends NodeWriter {
|
|||
private boolean decrementIndentationLevelOneMore = false;
|
||||
private final DeclarationWriter declWriter;
|
||||
|
||||
public StatementWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public StatementWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
declWriter = new DeclarationWriter(scribe, visitor, commentMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a statement.
|
||||
*
|
||||
* @param statement
|
||||
* @param statement the statement
|
||||
* @param newLine if true print a newline if statement usually have one.
|
||||
* @return {@link ASTVisitor#PROCESS_SKIP}
|
||||
*/
|
||||
|
@ -132,7 +133,7 @@ public class StatementWriter extends NodeWriter {
|
|||
writeIfStatement((IASTIfStatement) statement);
|
||||
newLine = false;
|
||||
} else if (statement instanceof IASTWhileStatement) {
|
||||
writeWhileStatement( (IASTWhileStatement) statement );
|
||||
writeWhileStatement((IASTWhileStatement) statement);
|
||||
newLine = false;
|
||||
} else if (statement instanceof IASTForStatement) {
|
||||
writeForStatement((IASTForStatement) statement);
|
||||
|
@ -173,12 +174,12 @@ public class StatementWriter extends NodeWriter {
|
|||
scribe.printSemicolon();
|
||||
}
|
||||
|
||||
private void writeForStatement(IASTForStatement forStatment) {
|
||||
private void writeForStatement(IASTForStatement forStatement) {
|
||||
scribe.noNewLines();
|
||||
scribe.print(FOR);
|
||||
writeStatement(forStatment.getInitializerStatement(),false);
|
||||
if (forStatment instanceof ICPPASTForStatement) {
|
||||
ICPPASTForStatement cppForStatment = (ICPPASTForStatement) forStatment;
|
||||
writeStatement(forStatement.getInitializerStatement(),false);
|
||||
if (forStatement instanceof ICPPASTForStatement) {
|
||||
ICPPASTForStatement cppForStatment = (ICPPASTForStatement) forStatement;
|
||||
IASTDeclaration cppConditionDeclaration = cppForStatment.getConditionDeclaration();
|
||||
if (cppConditionDeclaration == null) {
|
||||
visitNodeIfNotNull(cppForStatment.getConditionExpression());
|
||||
|
@ -187,17 +188,17 @@ public class StatementWriter extends NodeWriter {
|
|||
cppConditionDeclaration.accept(visitor);
|
||||
}
|
||||
} else {
|
||||
if (forStatment.getConditionExpression() != null) {
|
||||
forStatment.getConditionExpression().accept(visitor);
|
||||
if (forStatement.getConditionExpression() != null) {
|
||||
forStatement.getConditionExpression().accept(visitor);
|
||||
scribe.printSemicolon();
|
||||
}
|
||||
}
|
||||
|
||||
visitNodeIfNotNull(forStatment.getIterationExpression());
|
||||
visitNodeIfNotNull(forStatement.getIterationExpression());
|
||||
scribe.print(')');
|
||||
scribe.newLines();
|
||||
nextCompoundNoNewLine();
|
||||
writeBodyStatement(forStatment.getBody(), false);
|
||||
writeBodyStatement(forStatement.getBody(), false);
|
||||
}
|
||||
|
||||
private void writeForStatement(ICPPASTRangeBasedForStatement forStatment) {
|
||||
|
@ -418,10 +419,9 @@ public class StatementWriter extends NodeWriter {
|
|||
scribe.newLine();
|
||||
statement.accept(visitor);
|
||||
scribe.decrementIndentationLevel();
|
||||
scribe.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write no new Line after the next Compound-Statement
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter;
|
||||
|
@ -35,7 +34,7 @@ public class TemplateParameterWriter extends NodeWriter {
|
|||
* @param scribe
|
||||
* @param visitor
|
||||
*/
|
||||
public TemplateParameterWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
|
||||
public TemplateParameterWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,7 @@ public class ASTModificationHelper {
|
|||
T appendedTNode = cast(newNode, clazz);
|
||||
if (appendedTNode != null) {
|
||||
modifiedChildren.add(appendedTNode);
|
||||
}
|
||||
else if (newNode instanceof ContainerNode) {
|
||||
} else if (newNode instanceof ContainerNode) {
|
||||
ContainerNode nodeContainer = (ContainerNode) newNode;
|
||||
for (IASTNode currentNode : nodeContainer.getNodes()) {
|
||||
T tnode= cast(currentNode, clazz);
|
||||
|
|
|
@ -9,16 +9,23 @@
|
|||
* Contributors:
|
||||
* Institute for Software - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ToolFactory;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -31,7 +38,10 @@ import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.formatter.CodeFormatter;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationMap;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTRewriteAnalyzer;
|
||||
|
@ -41,16 +51,26 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileContentHelper;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
|
||||
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
|
||||
import org.eclipse.cdt.internal.formatter.CCodeFormatter;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.Document;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.TextUtilities;
|
||||
import org.eclipse.ltk.core.refactoring.Change;
|
||||
import org.eclipse.ltk.core.refactoring.CompositeChange;
|
||||
import org.eclipse.ltk.core.refactoring.TextFileChange;
|
||||
import org.eclipse.text.edits.DeleteEdit;
|
||||
import org.eclipse.text.edits.InsertEdit;
|
||||
import org.eclipse.text.edits.MalformedTreeException;
|
||||
import org.eclipse.text.edits.MultiTextEdit;
|
||||
import org.eclipse.text.edits.ReplaceEdit;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
import org.eclipse.text.edits.TextEditGroup;
|
||||
|
||||
public class ChangeGenerator extends ASTVisitor {
|
||||
|
@ -93,8 +113,10 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
initParentModList();
|
||||
rootNode.accept(pathProvider);
|
||||
for (IFile currentFile : changes.keySet()) {
|
||||
MultiTextEdit edit = changes.get(currentFile);
|
||||
edit = formatChangedCode(edit, currentFile);
|
||||
TextFileChange subchange= ASTRewriteAnalyzer.createCTextFileChange(currentFile);
|
||||
subchange.setEdit(changes.get(currentFile));
|
||||
subchange.setEdit(edit);
|
||||
change.add(subchange);
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +152,63 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
return modifiedNodeParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the C++ code formatter to the code affected by refactoring.
|
||||
*
|
||||
* @param edit The text edit produced by refactoring.
|
||||
* @param file The file being modified.
|
||||
* @return The text edit containing formatted refactoring changes, or the original text edit
|
||||
* in case of errors.
|
||||
*/
|
||||
private MultiTextEdit formatChangedCode(MultiTextEdit edit, IFile file) {
|
||||
String code;
|
||||
try {
|
||||
code = FileContentHelper.getContent(file, 0);
|
||||
} catch (IOException e) {
|
||||
CCorePlugin.log(e);
|
||||
return edit;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return edit;
|
||||
}
|
||||
IDocument document = new Document(code);
|
||||
try {
|
||||
TextEdit tempEdit = edit.copy();
|
||||
tempEdit.apply(document, TextEdit.UPDATE_REGIONS);
|
||||
TextEdit[] edits = tempEdit.getChildren();
|
||||
IRegion[] regions = new IRegion[edits.length];
|
||||
for (int i = 0; i < edits.length; i++) {
|
||||
regions[i] = edits[i].getRegion();
|
||||
}
|
||||
ICProject project = CCorePlugin.getDefault().getCoreModel().create(file.getProject());
|
||||
Map<String, String> options = project.getOptions(true);
|
||||
CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
|
||||
code = document.get();
|
||||
TextEdit[] formatEdits = formatter.format(CCodeFormatter.K_TRANSLATION_UNIT, code,
|
||||
regions, TextUtilities.getDefaultLineDelimiter(document));
|
||||
MultiTextEdit resultEdit = new MultiTextEdit();
|
||||
edits = edit.getChildren();
|
||||
for (int i = 0; i < edits.length; i++) {
|
||||
IRegion region = regions[i];
|
||||
int offset = region.getOffset();
|
||||
TextEdit formatEdit = formatEdits[i];
|
||||
formatEdit.moveTree(-offset);
|
||||
document = new Document(code.substring(offset, offset + region.getLength()));
|
||||
formatEdit.apply(document, TextEdit.NONE);
|
||||
TextEdit textEdit = edits[i];
|
||||
resultEdit.addChild(
|
||||
new ReplaceEdit(textEdit.getOffset(), textEdit.getLength(), document.get()));
|
||||
}
|
||||
return resultEdit;
|
||||
} catch (MalformedTreeException e) {
|
||||
CCorePlugin.log(e);
|
||||
return edit;
|
||||
} catch (BadLocationException e) {
|
||||
CCorePlugin.log(e);
|
||||
return edit;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTTranslationUnit translationUnit) {
|
||||
if (hasChangedChild(translationUnit)) {
|
||||
|
@ -145,11 +224,6 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
return super.leave(tu);
|
||||
}
|
||||
|
||||
private int getOffsetForNodeFile(IASTNode rootNode) {
|
||||
Integer offset = sourceOffsets.get(rootNode.getFileLocation().getFileName());
|
||||
return offset == null ? 0 : offset.intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTDeclaration declaration) {
|
||||
if (hasChangedChild(declaration)) {
|
||||
|
@ -160,33 +234,126 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
}
|
||||
|
||||
private void synthTreatment(IASTNode synthNode) {
|
||||
synthTreatment(synthNode, null);
|
||||
}
|
||||
|
||||
private void synthTreatment(IASTNode synthNode, String fileScope) {
|
||||
String indent = getIndent(synthNode);
|
||||
ASTWriter synthWriter = new ASTWriter(indent);
|
||||
synthWriter.setModificationStore(modificationStore);
|
||||
|
||||
String synthSource = synthWriter.write(synthNode, fileScope, commentMap);
|
||||
|
||||
ChangeGeneratorWriterVisitor writer =
|
||||
new ChangeGeneratorWriterVisitor(modificationStore, commentMap);
|
||||
synthNode.accept(writer);
|
||||
String synthSource = writer.toString();
|
||||
createChange(synthNode, synthSource);
|
||||
|
||||
|
||||
IASTFileLocation fileLocation = synthNode.getFileLocation();
|
||||
int newOffset = fileLocation.getNodeOffset() + fileLocation.getNodeLength();
|
||||
sourceOffsets.put(fileLocation.getFileName(), Integer.valueOf(newOffset));
|
||||
}
|
||||
|
||||
private void handleAppends(IASTNode node) {
|
||||
ChangeGeneratorWriterVisitor writer =
|
||||
new ChangeGeneratorWriterVisitor(modificationStore, commentMap);
|
||||
List<ASTModification> modifications = modificationParent.get(node);
|
||||
ReplaceEdit anchor = getAppendAnchor(node);
|
||||
Assert.isNotNull(anchor);
|
||||
IASTNode precedingNode = getLastNodeBeforeAppendPoint(node);
|
||||
if (precedingNode != null &&
|
||||
ASTWriter.requireBlankLineInBetween(precedingNode, modifications.get(0).getNewNode())) {
|
||||
writer.newLine();
|
||||
}
|
||||
for (ASTModification modification : modifications) {
|
||||
IASTNode newNode = modification.getNewNode();
|
||||
newNode.accept(writer);
|
||||
}
|
||||
String code = writer.toString();
|
||||
IFile file = FileHelper.getFileFromNode(node);
|
||||
MultiTextEdit parentEdit = getEdit(node, file);
|
||||
ReplaceEdit edit = new ReplaceEdit(anchor.getOffset(), anchor.getLength(),
|
||||
code + anchor.getText());
|
||||
parentEdit.addChild(edit);
|
||||
IASTFileLocation fileLocation = node.getFileLocation();
|
||||
int newOffset = fileLocation.getNodeOffset() + fileLocation.getNodeLength();
|
||||
sourceOffsets.put(fileLocation.getFileName(), Integer.valueOf(newOffset));
|
||||
}
|
||||
|
||||
private IASTNode getLastNodeBeforeAppendPoint(IASTNode node) {
|
||||
IASTNode[] children;
|
||||
if (node instanceof IASTCompositeTypeSpecifier) {
|
||||
children = ((IASTCompositeTypeSpecifier) node).getDeclarations(true);
|
||||
} else {
|
||||
children = node.getChildren();
|
||||
}
|
||||
return children.length > 0 ? children[children.length - 1] : null;
|
||||
}
|
||||
|
||||
private boolean isAppendable(Iterable<ASTModification> modifications) {
|
||||
for (ASTModification modification : modifications) {
|
||||
if (!isAppendable(modification))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isAppendable(ASTModification modification) {
|
||||
if (modification.getKind() != ModificationKind.APPEND_CHILD)
|
||||
return false;
|
||||
IASTNode node = modification.getNewNode();
|
||||
return node instanceof IASTDeclaration || node instanceof IASTStatement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a replace edit whose offset is the position where child appended nodes should be
|
||||
* inserted at. The text contains the content of the code region that will be disturbed by
|
||||
* the insertion.
|
||||
* @param node The node to append children to.
|
||||
* @return a ReplaceEdit object, or <code>null</code> if the node does not support appending
|
||||
* children to it.
|
||||
*/
|
||||
private ReplaceEdit getAppendAnchor(IASTNode node) {
|
||||
if (!(node instanceof IASTCompositeTypeSpecifier ||
|
||||
node instanceof IASTCompoundStatement ||
|
||||
node instanceof ICPPASTNamespaceDefinition)) {
|
||||
return null;
|
||||
}
|
||||
IFile file = FileHelper.getFileFromNode(node);
|
||||
String code = originalCodeOfNode(node, file);
|
||||
IASTFileLocation location = node.getFileLocation();
|
||||
int pos = location.getNodeOffset() + location.getNodeLength();
|
||||
int len = code.endsWith("}") ? 1 : 0; //$NON-NLS-1$
|
||||
int startOfLine = skipPrecedingBlankLines(code, code.length() - len);
|
||||
if (startOfLine < 0) {
|
||||
// Include the closing brace in the region that will be reformatted.
|
||||
return new ReplaceEdit(pos - len, len, code.substring(code.length() - len));
|
||||
}
|
||||
return new ReplaceEdit(location.getNodeOffset() + startOfLine, 0, ""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips blank lines preceding the given position.
|
||||
* @param text the text to scan
|
||||
* @param pos the position after that blank lines.
|
||||
* @return the beginning of the first blank line, or -1 if the beginning of the line
|
||||
* corresponding to the given position contains non-whitespace characters.
|
||||
*/
|
||||
private int skipPrecedingBlankLines(String text, int pos) {
|
||||
int lineStart = -1;
|
||||
while (--pos >= 0) {
|
||||
char c = text.charAt(pos);
|
||||
if (c == '\n') {
|
||||
lineStart = pos + 1;
|
||||
} else if (!Character.isWhitespace(c)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lineStart;
|
||||
}
|
||||
|
||||
private void synthTreatment(IASTTranslationUnit synthTU) {
|
||||
ASTWriter synthWriter = new ASTWriter();
|
||||
synthWriter.setModificationStore(modificationStore);
|
||||
|
||||
for (ASTModification modification : modificationParent.get(synthTU)) {
|
||||
IASTFileLocation targetLocation = modification.getTargetNode().getFileLocation();
|
||||
IASTNode targetNode = modification.getTargetNode();
|
||||
IASTFileLocation targetLocation = targetNode.getFileLocation();
|
||||
String currentFile = targetLocation.getFileName();
|
||||
IPath implPath = new Path(currentFile);
|
||||
IFile relevantFile= ResourceLookup.selectFileForLocation(implPath, null);
|
||||
if (relevantFile == null || !relevantFile.exists()) { // if not in workspace or local file system
|
||||
if (relevantFile == null || !relevantFile.exists()) { // If not in workspace or local file system
|
||||
throw new UnhandledASTModificationException(modification);
|
||||
}
|
||||
MultiTextEdit edit;
|
||||
|
@ -196,7 +363,7 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
edit = new MultiTextEdit();
|
||||
changes.put(relevantFile, edit);
|
||||
}
|
||||
String newNodeCode = synthWriter.write(modification.getNewNode(), null, commentMap);
|
||||
String newNodeCode = synthWriter.write(modification.getNewNode(), commentMap);
|
||||
|
||||
switch (modification.getKind()) {
|
||||
case REPLACE:
|
||||
|
@ -204,18 +371,20 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
targetLocation.getNodeLength(), newNodeCode));
|
||||
break;
|
||||
case INSERT_BEFORE:
|
||||
edit.addChild(new InsertEdit(getOffsetIncludingComments(modification.getTargetNode()),
|
||||
newNodeCode));
|
||||
if (ASTWriter.requireBlankLineInBetween(modification.getNewNode(), targetNode)) {
|
||||
newNodeCode = newNodeCode + "\n"; //$NON-NLS-1$
|
||||
}
|
||||
edit.addChild(new InsertEdit(getOffsetIncludingComments(targetNode), newNodeCode));
|
||||
break;
|
||||
case APPEND_CHILD:
|
||||
if (modification.getTargetNode() instanceof IASTTranslationUnit &&
|
||||
((IASTTranslationUnit)modification.getTargetNode()).getDeclarations().length > 0) {
|
||||
IASTTranslationUnit tu = (IASTTranslationUnit)modification.getTargetNode();
|
||||
if (targetNode instanceof IASTTranslationUnit &&
|
||||
((IASTTranslationUnit) targetNode).getDeclarations().length > 0) {
|
||||
IASTTranslationUnit tu = (IASTTranslationUnit) targetNode;
|
||||
IASTDeclaration lastDecl = tu.getDeclarations()[tu.getDeclarations().length - 1];
|
||||
targetLocation = lastDecl.getFileLocation();
|
||||
}
|
||||
String lineDelimiter = FileHelper.determineLineDelimiter(
|
||||
FileHelper.getFileFromNode(modification.getTargetNode()));
|
||||
FileHelper.getFileFromNode(targetNode));
|
||||
edit.addChild(new InsertEdit(targetLocation.getNodeOffset() + targetLocation.getNodeLength(),
|
||||
lineDelimiter + lineDelimiter + newNodeCode));
|
||||
break;
|
||||
|
@ -225,30 +394,32 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
|
||||
private void createChange(IASTNode synthNode, String synthSource) {
|
||||
IFile relevantFile = FileHelper.getFileFromNode(synthNode);
|
||||
|
||||
String originalCode = originalCodeOfNode(synthNode);
|
||||
String originalCode = originalCodeOfNode(synthNode, relevantFile);
|
||||
CodeComparer codeComparer = new CodeComparer(originalCode, synthSource);
|
||||
|
||||
MultiTextEdit edit;
|
||||
if (changes.containsKey(relevantFile)) {
|
||||
edit = changes.get(relevantFile);
|
||||
} else {
|
||||
edit = new MultiTextEdit();
|
||||
changes.put(relevantFile, edit);
|
||||
}
|
||||
|
||||
codeComparer.createChange(edit, synthNode);
|
||||
codeComparer.createChange(getEdit(synthNode, relevantFile), synthNode);
|
||||
}
|
||||
|
||||
public String originalCodeOfNode(IASTNode node) {
|
||||
if (node.getFileLocation() != null) {
|
||||
IFile sourceFile = FileHelper.getFileFromNode(node);
|
||||
int nodeOffset = getOffsetIncludingComments(node);
|
||||
int nodeLength = getNodeLengthIncludingComments(node);
|
||||
|
||||
return FileContentHelper.getContent(sourceFile, nodeOffset, nodeLength);
|
||||
private MultiTextEdit getEdit(IASTNode modifiedNode, IFile file) {
|
||||
MultiTextEdit edit = changes.get(file);
|
||||
if (edit == null) {
|
||||
edit = new MultiTextEdit();
|
||||
changes.put(file, edit);
|
||||
}
|
||||
return null;
|
||||
TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group);
|
||||
for (ASTModification currentModification : modificationParent.get(modifiedNode)) {
|
||||
if (currentModification.getAssociatedEditGroup() != null) {
|
||||
editGroup = currentModification.getAssociatedEditGroup();
|
||||
edit.addChildren(editGroup.getTextEdits());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return edit;
|
||||
}
|
||||
|
||||
private String originalCodeOfNode(IASTNode node, IFile sourceFile) {
|
||||
int nodeOffset = getOffsetIncludingComments(node);
|
||||
int nodeLength = getNodeLengthIncludingComments(node);
|
||||
return FileContentHelper.getContent(sourceFile, nodeOffset, nodeLength);
|
||||
}
|
||||
|
||||
private int getNodeLengthIncludingComments(IASTNode node) {
|
||||
|
@ -290,23 +461,15 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
return nodeOffset;
|
||||
}
|
||||
|
||||
private String getIndent(IASTNode nextNode) {
|
||||
IASTFileLocation fileLocation = nextNode.getFileLocation();
|
||||
int length = fileLocation.getNodeOffset() - getOffsetForNodeFile(nextNode);
|
||||
|
||||
String originalSource = FileContentHelper.getContent(FileHelper.getFileFromNode(nextNode),
|
||||
getOffsetForNodeFile(nextNode), length);
|
||||
StringBuilder indent = new StringBuilder(originalSource);
|
||||
indent.reverse();
|
||||
String lastline = indent.substring(0, Math.max(indent.indexOf("\n"), 0)); //$NON-NLS-1$
|
||||
if (lastline.trim().length() == 0) {
|
||||
return lastline;
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
private boolean hasChangedChild(IASTNode node) {
|
||||
return modificationParent.containsKey(node);
|
||||
}
|
||||
|
||||
private boolean hasChangedChild(IASTNode parent) {
|
||||
return modificationParent.containsKey(parent);
|
||||
private boolean hasAppendsOnly(IASTNode node) {
|
||||
List<ASTModification> modifications = modificationParent.get(node);
|
||||
if (modifications == null)
|
||||
return false;
|
||||
return isAppendable(modifications);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -329,22 +492,38 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
|
||||
@Override
|
||||
public int visit(ICPPASTNamespaceDefinition namespaceDefinition) {
|
||||
if (hasChangedChild(namespaceDefinition)) {
|
||||
if (hasChangedChild(namespaceDefinition) && !hasAppendsOnly(namespaceDefinition)) {
|
||||
synthTreatment(namespaceDefinition);
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
}
|
||||
return super.visit(namespaceDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(ICPPASTNamespaceDefinition namespaceDefinition) {
|
||||
if (hasAppendsOnly(namespaceDefinition)) {
|
||||
handleAppends(namespaceDefinition);
|
||||
}
|
||||
return super.leave(namespaceDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTDeclSpecifier declSpec) {
|
||||
if (hasChangedChild(declSpec)) {
|
||||
if (hasChangedChild(declSpec) && !hasAppendsOnly(declSpec)) {
|
||||
synthTreatment(declSpec);
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
}
|
||||
return super.visit(declSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTDeclSpecifier declSpec) {
|
||||
if (hasAppendsOnly(declSpec)) {
|
||||
handleAppends(declSpec);
|
||||
}
|
||||
return super.leave(declSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTExpression expression) {
|
||||
if (hasChangedChild(expression)) {
|
||||
|
@ -383,13 +562,21 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
|
||||
@Override
|
||||
public int visit(IASTStatement statement) {
|
||||
if (hasChangedChild(statement)) {
|
||||
if (hasChangedChild(statement) && !hasAppendsOnly(statement)) {
|
||||
synthTreatment(statement);
|
||||
return ASTVisitor.PROCESS_SKIP;
|
||||
}
|
||||
return super.visit(statement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTStatement statement) {
|
||||
if (hasAppendsOnly(statement)) {
|
||||
handleAppends(statement);
|
||||
}
|
||||
return super.leave(statement);
|
||||
}
|
||||
|
||||
class CodeComparer {
|
||||
private final StringBuilder originalCode;
|
||||
private final StringBuilder synthCode;
|
||||
|
@ -536,14 +723,6 @@ public class ChangeGenerator extends ASTVisitor {
|
|||
|
||||
protected void createChange(MultiTextEdit edit, IASTNode changedNode) {
|
||||
int changeOffset = getOffsetIncludingComments(changedNode);
|
||||
TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group);
|
||||
for (ASTModification currentModification : modificationParent.get(changedNode)) {
|
||||
if (currentModification.getAssociatedEditGroup() != null) {
|
||||
editGroup = currentModification.getAssociatedEditGroup();
|
||||
edit.addChildren(editGroup.getTextEdits());
|
||||
break;
|
||||
}
|
||||
}
|
||||
createChange(edit, changeOffset);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.DeclSpecWriter;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
|
@ -21,8 +21,8 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
public class ModifiedASTDeclSpecWriter extends DeclSpecWriter {
|
||||
private final ASTModificationHelper modificationHelper;
|
||||
|
||||
public ModifiedASTDeclSpecWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack,
|
||||
NodeCommentMap commentMap) {
|
||||
public ModifiedASTDeclSpecWriter(Scribe scribe, ASTWriterVisitor visitor,
|
||||
ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
this.modificationHelper = new ASTModificationHelper(stack);
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.DeclarationWriter;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
|
@ -24,21 +24,26 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
public class ModifiedASTDeclarationWriter extends DeclarationWriter {
|
||||
private final ASTModificationHelper modificationHelper;
|
||||
|
||||
public ModifiedASTDeclarationWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
public ModifiedASTDeclarationWriter(Scribe scribe, ASTWriterVisitor visitor,
|
||||
ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
this.modificationHelper = new ASTModificationHelper(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeDeclarationsInNamespace(ICPPASTNamespaceDefinition namespaceDefinition, IASTDeclaration[] declarations) {
|
||||
IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(namespaceDefinition, declarations, IASTDeclaration.class, commentMap);
|
||||
protected void writeDeclarationsInNamespace(ICPPASTNamespaceDefinition namespaceDefinition,
|
||||
IASTDeclaration[] declarations) {
|
||||
IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(
|
||||
namespaceDefinition, declarations, IASTDeclaration.class, commentMap);
|
||||
super.writeDeclarationsInNamespace(namespaceDefinition, modifiedDeclarations);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeCtorChainInitializer(ICPPASTFunctionDefinition funcDec,
|
||||
ICPPASTConstructorChainInitializer[] ctorInitChain) {
|
||||
ICPPASTConstructorChainInitializer[] modifiedChainInitializer = modificationHelper.createModifiedChildArray(funcDec, ctorInitChain, ICPPASTConstructorChainInitializer.class, commentMap);
|
||||
super.writeCtorChainInitializer(funcDec, modifiedChainInitializer);
|
||||
ICPPASTConstructorChainInitializer[] modifiedInitializer =
|
||||
modificationHelper.createModifiedChildArray(funcDec, ctorInitChain,
|
||||
ICPPASTConstructorChainInitializer.class, commentMap);
|
||||
super.writeCtorChainInitializer(funcDec, modifiedInitializer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -25,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.DeclaratorWriter;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
|
@ -32,7 +32,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
public class ModifiedASTDeclaratorWriter extends DeclaratorWriter {
|
||||
private final ASTModificationHelper modificationHelper;
|
||||
|
||||
public ModifiedASTDeclaratorWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
public ModifiedASTDeclaratorWriter(Scribe scribe, ASTWriterVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
this.modificationHelper = new ASTModificationHelper(stack);
|
||||
}
|
||||
|
@ -40,29 +40,31 @@ public class ModifiedASTDeclaratorWriter extends DeclaratorWriter {
|
|||
@Override
|
||||
protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec,
|
||||
IASTParameterDeclaration[] paraDecls) {
|
||||
IASTParameterDeclaration[] modifiedParameters = modificationHelper
|
||||
.createModifiedChildArray(funcDec, paraDecls, IASTParameterDeclaration.class,
|
||||
commentMap);
|
||||
IASTParameterDeclaration[] modifiedParameters = modificationHelper.createModifiedChildArray(
|
||||
funcDec, paraDecls, IASTParameterDeclaration.class, commentMap);
|
||||
super.writeParameterDeclarations(funcDec, modifiedParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writePointerOperators(IASTDeclarator declarator,IASTPointerOperator[] unmodifiedPointerOperations) {
|
||||
protected void writePointerOperators(IASTDeclarator declarator,
|
||||
IASTPointerOperator[] unmodifiedPointerOperations) {
|
||||
IASTPointerOperator[] modifiedPointer = modificationHelper.createModifiedChildArray(
|
||||
declarator, unmodifiedPointerOperations, IASTPointerOperator.class, commentMap);
|
||||
super.writePointerOperators(declarator, modifiedPointer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeArrayModifiers(IASTArrayDeclarator arrDecl,
|
||||
IASTArrayModifier[] arrMods) {
|
||||
IASTArrayModifier[] modifiedModifiers = modificationHelper.createModifiedChildArray(arrDecl, arrMods, IASTArrayModifier.class, commentMap);
|
||||
protected void writeArrayModifiers(IASTArrayDeclarator arrDecl, IASTArrayModifier[] arrMods) {
|
||||
IASTArrayModifier[] modifiedModifiers = modificationHelper.createModifiedChildArray(arrDecl,
|
||||
arrMods, IASTArrayModifier.class, commentMap);
|
||||
super.writeArrayModifiers(arrDecl, modifiedModifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeExceptionSpecification(ICPPASTFunctionDeclarator funcDec, IASTTypeId[] exceptions ) {
|
||||
IASTTypeId[] modifiedExceptions = modificationHelper.createModifiedChildArray(funcDec, exceptions, IASTTypeId.class, commentMap);
|
||||
protected void writeExceptionSpecification(ICPPASTFunctionDeclarator funcDec,
|
||||
IASTTypeId[] exceptions) {
|
||||
IASTTypeId[] modifiedExceptions = modificationHelper.createModifiedChildArray(funcDec,
|
||||
exceptions, IASTTypeId.class, commentMap);
|
||||
// it makes a difference whether the exception array is identical to
|
||||
// ICPPASTFunctionDeclarator.NO_EXCEPTION_SPECIFICATION
|
||||
if (modifiedExceptions.length == 0 &&
|
||||
|
@ -74,18 +76,18 @@ public class ModifiedASTDeclaratorWriter extends DeclaratorWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void writeKnRParameterDeclarations(
|
||||
ICASTKnRFunctionDeclarator knrFunct,
|
||||
protected void writeKnRParameterDeclarations(ICASTKnRFunctionDeclarator knrFunct,
|
||||
IASTDeclaration[] knrDeclarations) {
|
||||
IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(knrFunct, knrDeclarations, IASTDeclaration.class, commentMap);
|
||||
|
||||
IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(
|
||||
knrFunct, knrDeclarations, IASTDeclaration.class, commentMap);
|
||||
super.writeKnRParameterDeclarations(knrFunct, modifiedDeclarations);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeKnRParameterNames(
|
||||
ICASTKnRFunctionDeclarator knrFunct, IASTName[] parameterNames) {
|
||||
IASTName[] modifiedNames = modificationHelper.createModifiedChildArray(knrFunct, parameterNames, IASTName.class, commentMap);
|
||||
protected void writeKnRParameterNames(ICASTKnRFunctionDeclarator knrFunct,
|
||||
IASTName[] parameterNames) {
|
||||
IASTName[] modifiedNames = modificationHelper.createModifiedChildArray(knrFunct,
|
||||
parameterNames, IASTName.class, commentMap);
|
||||
super.writeKnRParameterNames(knrFunct, modifiedNames);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
|
@ -20,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ExpressionWriter;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.MacroExpansionHandler;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
|
||||
|
@ -28,7 +28,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
public class ModifiedASTExpressionWriter extends ExpressionWriter {
|
||||
private final ASTModificationHelper modificationHelper;
|
||||
|
||||
public ModifiedASTExpressionWriter(Scribe scribe, ASTVisitor visitor, MacroExpansionHandler macroHandler,
|
||||
public ModifiedASTExpressionWriter(Scribe scribe, ASTWriterVisitor visitor, MacroExpansionHandler macroHandler,
|
||||
ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, macroHandler, commentMap);
|
||||
this.modificationHelper = new ASTModificationHelper(stack);
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.StatementWriter;
|
||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||
|
@ -22,7 +22,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
|||
public class ModifiedASTStatementWriter extends StatementWriter {
|
||||
private final ASTModificationHelper modificationHelper;
|
||||
|
||||
public ModifiedASTStatementWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
public ModifiedASTStatementWriter(Scribe scribe, ASTWriterVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
|
||||
super(scribe, visitor, commentMap);
|
||||
this.modificationHelper = new ASTModificationHelper(stack);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ void foo();
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
void foo()
|
||||
{
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -20,14 +19,13 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
void bar();
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -36,21 +34,17 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return /*$*/42/*$$*/; //Hallo
|
||||
int A::foo() {
|
||||
return /*$*/42/*$$*/; //Hello
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
int a = 42;
|
||||
int b = 42;
|
||||
}
|
||||
|
@ -58,21 +52,17 @@ void A::bar()
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return theAnswer; //Hallo
|
||||
int A::foo() {
|
||||
return theAnswer; //Hello
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
int a = theAnswer;
|
||||
int b = theAnswer;
|
||||
}
|
||||
|
@ -83,8 +73,7 @@ void A::bar()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -99,14 +88,13 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
void bar();
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -115,22 +103,18 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
//Hallo
|
||||
return /*$*/42/*$$*/;
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
int a = 42;
|
||||
int b = 42;
|
||||
}
|
||||
|
@ -138,22 +122,18 @@ void A::bar()
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
//Hallo
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
int a = theAnswer;
|
||||
int b = theAnswer;
|
||||
}
|
||||
|
@ -164,8 +144,7 @@ void A::bar()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -180,14 +159,13 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
void bar();
|
||||
static const float theAnswer = 42.0f;
|
||||
static const float theAnswer = 42.0f;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -196,21 +174,17 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
float A::foo()
|
||||
{
|
||||
float A::foo() {
|
||||
return /*$*/42.0f/*$$*/;
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
float a = 42.0f;
|
||||
float b = 42.0f;
|
||||
}
|
||||
|
@ -218,21 +192,17 @@ void A::bar()
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
float A::foo()
|
||||
{
|
||||
float A::foo() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
float a = theAnswer;
|
||||
float b = theAnswer;
|
||||
}
|
||||
|
@ -243,8 +213,7 @@ void A::bar()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -259,14 +228,13 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
double foo();
|
||||
void bar();
|
||||
static const double theAnswer = 42.0;
|
||||
static const double theAnswer = 42.0;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -275,21 +243,17 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
double A::foo()
|
||||
{
|
||||
double A::foo() {
|
||||
return /*$*/42.0/*$$*/;
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
double a = 42.0;
|
||||
double b = 42.0;
|
||||
}
|
||||
|
@ -297,21 +261,17 @@ void A::bar()
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
double A::foo()
|
||||
{
|
||||
double A::foo() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
double a = theAnswer;
|
||||
double b = theAnswer;
|
||||
}
|
||||
|
@ -322,8 +282,7 @@ void A::bar()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -337,8 +296,7 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -351,51 +309,43 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int bar()
|
||||
{
|
||||
int bar() {
|
||||
return /*$*/42/*$$*/;
|
||||
}
|
||||
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const int theAnswer = 42;
|
||||
}
|
||||
A::A()
|
||||
{
|
||||
namespace {
|
||||
|
||||
const int theAnswer = 42;
|
||||
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
int bar()
|
||||
{
|
||||
int bar() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
|
||||
//!replaceNumberProtected
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
|
||||
//@.config
|
||||
|
@ -404,8 +354,7 @@ visibility=protected
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -418,14 +367,14 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
protected:
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -433,32 +382,26 @@ protected:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return /*$*/42/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
|
@ -470,8 +413,7 @@ visibility=private
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -484,14 +426,14 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
private:
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -499,32 +441,26 @@ private:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return /*$*/42/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
|
@ -535,18 +471,18 @@ filename=A.h
|
|||
//@A.h
|
||||
class X {
|
||||
void method() {
|
||||
int a= /*$*/42/*$$*/;
|
||||
int a = /*$*/42/*$$*/;
|
||||
}
|
||||
};
|
||||
|
||||
//=
|
||||
class X {
|
||||
void method() {
|
||||
int a= theAnswer;
|
||||
}
|
||||
int a = theAnswer;
|
||||
}
|
||||
|
||||
public:
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
//!ExtractConstantString
|
||||
|
@ -556,30 +492,26 @@ visibility=private
|
|||
filename=A.h
|
||||
//@A.h
|
||||
class X {
|
||||
void method()
|
||||
{
|
||||
char *a = /*$*/"sometext"/*$$*/;
|
||||
}
|
||||
|
||||
void method2()
|
||||
{
|
||||
const char *b = "sometext";
|
||||
}
|
||||
void method() {
|
||||
char* a = /*$*/"sometext"/*$$*/;
|
||||
}
|
||||
|
||||
void method2() {
|
||||
const char* b = "sometext";
|
||||
}
|
||||
};
|
||||
|
||||
//=
|
||||
class X {
|
||||
void method()
|
||||
{
|
||||
char *a = theAnswer;
|
||||
}
|
||||
void method() {
|
||||
char* a = theAnswer;
|
||||
}
|
||||
|
||||
void method2()
|
||||
{
|
||||
const char *b = theAnswer;
|
||||
}
|
||||
void method2() {
|
||||
const char* b = theAnswer;
|
||||
}
|
||||
|
||||
static const char *theAnswer = "sometext";
|
||||
static const char* theAnswer = "sometext";
|
||||
};
|
||||
|
||||
//!ExtractConstantWideString
|
||||
|
@ -589,31 +521,27 @@ visibility=private
|
|||
filename=A.h
|
||||
//@A.h
|
||||
class X {
|
||||
void method()
|
||||
{
|
||||
wchar_t *a = /*$*/L"sometext"/*$$*/;
|
||||
}
|
||||
|
||||
void method2()
|
||||
{
|
||||
const wchar_t *b = L"sometext";
|
||||
const char *c = "sometext";
|
||||
}
|
||||
void method() {
|
||||
wchar_t* a = /*$*/L"sometext"/*$$*/;
|
||||
}
|
||||
|
||||
void method2() {
|
||||
const wchar_t* b = L"sometext";
|
||||
const char* c = "sometext";
|
||||
}
|
||||
};
|
||||
|
||||
//=
|
||||
class X {
|
||||
void method()
|
||||
{
|
||||
wchar_t *a = theAnswer;
|
||||
}
|
||||
void method() {
|
||||
wchar_t* a = theAnswer;
|
||||
}
|
||||
|
||||
void method2()
|
||||
{
|
||||
const wchar_t *b = theAnswer;
|
||||
const char *c = "sometext";
|
||||
}
|
||||
void method2() {
|
||||
const wchar_t* b = theAnswer;
|
||||
const char* c = "sometext";
|
||||
}
|
||||
|
||||
static const wchar_t *theAnswer = L"sometext";
|
||||
static const wchar_t* theAnswer = L"sometext";
|
||||
};
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -19,14 +18,13 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
void bar();
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -34,21 +32,17 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return 42; //Hallo
|
||||
int A::foo() {
|
||||
return 42; // Hello
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
int a = 42;
|
||||
int b = 42;
|
||||
}
|
||||
|
@ -56,21 +50,17 @@ void A::bar()
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return theAnswer; //Hallo
|
||||
int A::foo() {
|
||||
return theAnswer; // Hello
|
||||
}
|
||||
|
||||
void A::bar()
|
||||
{
|
||||
void A::bar() {
|
||||
int a = theAnswer;
|
||||
int b = theAnswer;
|
||||
}
|
||||
|
@ -91,8 +81,7 @@ project="RegressionTestProject" selection="64,2" visibility="public"/>
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -105,14 +94,14 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
protected:
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -120,32 +109,26 @@ protected:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
|
@ -164,8 +147,7 @@ project="RegressionTestProject" selection="64,2" visibility="protected"/>
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
|
@ -178,14 +160,14 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
private:
|
||||
static const int theAnswer = 42;
|
||||
static const int theAnswer = 42;
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -193,32 +175,26 @@ private:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
return theAnswer;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,34 +1,34 @@
|
|||
//!Extract template function
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
|
||||
//@A.cpp
|
||||
void test(){
|
||||
void test() {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int tempFunct(){
|
||||
|
||||
int tempFunct() {
|
||||
T i;
|
||||
i = 0;
|
||||
/*$*/i++;
|
||||
i+=3;/*$$*/
|
||||
i += 3;/*$$*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=
|
||||
void test(){
|
||||
void test() {
|
||||
}
|
||||
template<typename T> void exp(T i)
|
||||
{
|
||||
i++;
|
||||
i += 3;
|
||||
|
||||
template<typename T>
|
||||
void exp(T i) {
|
||||
i++;
|
||||
i += 3;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int tempFunct(){
|
||||
|
||||
int tempFunct() {
|
||||
T i;
|
||||
i = 0;
|
||||
exp(i);
|
||||
exp(i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -36,39 +36,40 @@ int tempFunct(){
|
|||
//!Extract template function with template parameter Bug #12
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
|
||||
//@A.cpp
|
||||
void test(){
|
||||
void test() {
|
||||
}
|
||||
template <typename T>
|
||||
int tempFunct(T p){
|
||||
|
||||
template <typename T>
|
||||
int tempFunct(T p) {
|
||||
/*$*/++p;
|
||||
p + 4;/*$$*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=
|
||||
void test(){
|
||||
void test() {
|
||||
}
|
||||
template<typename T> void exp(T p)
|
||||
{
|
||||
++p;
|
||||
p + 4;
|
||||
|
||||
template<typename T>
|
||||
void exp(T p) {
|
||||
++p;
|
||||
p + 4;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int tempFunct(T p){
|
||||
exp(p);
|
||||
int tempFunct(T p) {
|
||||
exp(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//!Extract template function with template type declaration Bug #11
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
|
||||
//@A.cpp
|
||||
void test(){
|
||||
void test() {
|
||||
}
|
||||
template <typename T>
|
||||
int tempFunct(){
|
||||
|
||||
template <typename T>
|
||||
int tempFunct() {
|
||||
/*$*/T p;
|
||||
p = 0;
|
||||
p + 4;/*$$*/
|
||||
|
@ -77,19 +78,19 @@ int tempFunct(){
|
|||
}
|
||||
|
||||
//=
|
||||
void test(){
|
||||
void test() {
|
||||
}
|
||||
template<typename T> T exp()
|
||||
{
|
||||
T p;
|
||||
p = 0;
|
||||
p + 4;
|
||||
return p;
|
||||
|
||||
template<typename T>
|
||||
T exp() {
|
||||
T p;
|
||||
p = 0;
|
||||
p + 4;
|
||||
return p;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int tempFunct(){
|
||||
|
||||
int tempFunct() {
|
||||
T p = exp();
|
||||
p + 2;
|
||||
return 0;
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -18,12 +17,11 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -31,34 +29,28 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return /*$*/42/*$$*/;
|
||||
int A::foo() {
|
||||
return /*$*/42/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int i = 42;
|
||||
return i;
|
||||
int A::foo() {
|
||||
int i = 42;
|
||||
return i;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest char
|
||||
|
@ -67,12 +59,11 @@ int A::foo()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -81,12 +72,11 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -94,34 +84,28 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return /*$*/'c'/*$$*/;
|
||||
int A::foo() {
|
||||
return /*$*/'c'/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
char temp = 'c';
|
||||
return temp;
|
||||
int A::foo() {
|
||||
char temp = 'c';
|
||||
return temp;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest float
|
||||
|
@ -130,12 +114,11 @@ int A::foo()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -144,12 +127,11 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -157,34 +139,28 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
float A::foo()
|
||||
{
|
||||
return /*$*/42.0f/*$$*/;
|
||||
float A::foo() {
|
||||
return /*$*/42.0f/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
float A::foo()
|
||||
{
|
||||
float f = 42.0f;
|
||||
return f;
|
||||
float A::foo() {
|
||||
float f = 42.0f;
|
||||
return f;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest double
|
||||
|
@ -193,12 +169,11 @@ float A::foo()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -207,12 +182,11 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
float foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -220,34 +194,28 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
float A::foo()
|
||||
{
|
||||
return /*$*/42.0/*$$*/;
|
||||
float A::foo() {
|
||||
return /*$*/42.0/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
float A::foo()
|
||||
{
|
||||
double f = 42.0;
|
||||
return f;
|
||||
float A::foo() {
|
||||
double f = 42.0;
|
||||
return f;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest parentheses
|
||||
|
@ -256,12 +224,11 @@ float A::foo()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -270,12 +237,11 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -283,34 +249,28 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return /*$*/(42)/*$$*/;
|
||||
int A::foo() {
|
||||
return /*$*/(42)/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int i = 42;
|
||||
return i;
|
||||
int A::foo() {
|
||||
int i = 42;
|
||||
return i;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest proposed name in scope
|
||||
|
@ -319,12 +279,11 @@ int A::foo()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -333,12 +292,11 @@ public:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -346,96 +304,94 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int x = 3;
|
||||
return /*$*/(x + 2)/*$$*/ * 15;
|
||||
int A::foo() {
|
||||
int x = 3;
|
||||
return /*$*/(x + 2)/*$$*/ * 15;
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int x = 3;
|
||||
int i = x + 2;
|
||||
return i * 15;
|
||||
int A::foo() {
|
||||
int x = 3;
|
||||
int i = x + 2;
|
||||
return i * 15;
|
||||
}
|
||||
|
||||
//!Bug #277065 extract local variable fails to extract from for loop
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
void foo(){
|
||||
for(int n = /*$*/5 + 2/*$$*/; n < 10; ++n);
|
||||
void foo() {
|
||||
for (int n = /*$*/5 + 2/*$$*/; n < 10; ++n)
|
||||
;
|
||||
}
|
||||
|
||||
//=
|
||||
void foo(){
|
||||
int i = 5 + 2;
|
||||
for(int n = i; n < 10; ++n);
|
||||
void foo() {
|
||||
int i = 5 + 2;
|
||||
for (int n = i; n < 10; ++n)
|
||||
;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest expression
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
void foo(){
|
||||
int a = 0;
|
||||
float b = 0.1f;
|
||||
double c = /*$*/(a + b)/*$$*/ * 0.2;
|
||||
void foo() {
|
||||
int a = 0;
|
||||
float b = 0.1f;
|
||||
double c = /*$*/(a + b)/*$$*/ * 0.2;
|
||||
}
|
||||
|
||||
//=
|
||||
void foo(){
|
||||
int a = 0;
|
||||
float b = 0.1f;
|
||||
float a0 = a + b;
|
||||
double c = a0 * 0.2;
|
||||
void foo() {
|
||||
int a = 0;
|
||||
float b = 0.1f;
|
||||
float a0 = a + b;
|
||||
double c = a0 * 0.2;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest pointer
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
void foo(){
|
||||
int a[2];
|
||||
int b = */*$*/(a + 1)/*$$*/;
|
||||
void foo() {
|
||||
int a[2];
|
||||
int b = */*$*/(a + 1)/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
void foo(){
|
||||
int a[2];
|
||||
int *i = a + 1;
|
||||
int b = *i;
|
||||
void foo() {
|
||||
int a[2];
|
||||
int* i = a + 1;
|
||||
int b = *i;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest qualifiers
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
const volatile int *k;
|
||||
void foo(){
|
||||
/*$*/k;/*$$*/
|
||||
const volatile int* k;
|
||||
|
||||
void foo() {
|
||||
/*$*/k;/*$$*/
|
||||
}
|
||||
|
||||
//=
|
||||
const volatile int *k;
|
||||
void foo(){
|
||||
const volatile int *k0 = k;
|
||||
k0;
|
||||
const volatile int* k;
|
||||
|
||||
void foo() {
|
||||
const volatile int* k0 = k;
|
||||
k0;
|
||||
}
|
||||
|
||||
//!ExtractLocalVariableRefactoringTest overloaded operators
|
||||
|
@ -443,24 +399,24 @@ void foo(){
|
|||
//@A.cpp
|
||||
class K {
|
||||
public:
|
||||
bool operator+(int b) {return true;}
|
||||
float operator+(unsigned u) {return 1.0f;}
|
||||
bool operator+(int b) { return true; }
|
||||
float operator+(unsigned u) { return 1.0f; }
|
||||
};
|
||||
void foo(){
|
||||
K k;
|
||||
/*$*/k+3u/*$$*/;
|
||||
void foo() {
|
||||
K k;
|
||||
/*$*/k+3u/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
class K {
|
||||
public:
|
||||
bool operator+(int b) {return true;}
|
||||
float operator+(unsigned u) {return 1.0f;}
|
||||
bool operator+(int b) { return true; }
|
||||
float operator+(unsigned u) { return 1.0f; }
|
||||
};
|
||||
void foo(){
|
||||
K k;
|
||||
float i = k + 3u;
|
||||
i;
|
||||
void foo() {
|
||||
K k;
|
||||
float i = k + 3u;
|
||||
i;
|
||||
}
|
||||
|
||||
//!Bug 318784 DeclarationGenerator fails for some cases
|
||||
|
@ -468,16 +424,16 @@ void foo(){
|
|||
//@A.cpp
|
||||
|
||||
void func() {
|
||||
int *(*a)[2];
|
||||
/*$*/a/*$$*/;
|
||||
int* (*a)[2];
|
||||
/*$*/a/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
|
||||
void func() {
|
||||
int *(*a)[2];
|
||||
int *(*a0)[2] = a;
|
||||
a0;
|
||||
int* (*a)[2];
|
||||
int* (*a0)[2] = a;
|
||||
a0;
|
||||
}
|
||||
|
||||
//!Bug 331963 Extract local variable doesn't put template type parameters
|
||||
|
@ -491,10 +447,8 @@ class Foo {
|
|||
Foo<int> getFoo();
|
||||
|
||||
int main() {
|
||||
|
||||
/*$*/getFoo()/*$$*/;
|
||||
|
||||
return 0;
|
||||
/*$*/getFoo()/*$$*/;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=
|
||||
|
@ -506,163 +460,163 @@ class Foo {
|
|||
Foo<int> getFoo();
|
||||
|
||||
int main() {
|
||||
Foo<int> foo = getFoo();
|
||||
foo;
|
||||
|
||||
return 0;
|
||||
Foo<int> foo = getFoo();
|
||||
foo;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//!Bug 331963 Extract local variable doesn't put template type parameters Namespace
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
namespace bar{
|
||||
namespace bar {
|
||||
|
||||
template<class T>
|
||||
class Foo {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
bar::Foo<int> getFoo();
|
||||
|
||||
int main() {
|
||||
|
||||
/*$*/getFoo()/*$$*/;
|
||||
|
||||
return 0;
|
||||
/*$*/getFoo()/*$$*/;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=
|
||||
namespace bar{
|
||||
namespace bar {
|
||||
|
||||
template<class T>
|
||||
class Foo {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
bar::Foo<int> getFoo();
|
||||
|
||||
int main() {
|
||||
bar::Foo<int> foo = getFoo();
|
||||
foo;
|
||||
|
||||
return 0;
|
||||
bar::Foo<int> foo = getFoo();
|
||||
foo;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//!Bug 330693 Improve suggested variable name in Extract Local Variable
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
|
||||
struct Foo{
|
||||
struct Foo {
|
||||
int getVarWithLongName();
|
||||
};
|
||||
|
||||
void bar(){
|
||||
void bar() {
|
||||
Foo f;
|
||||
/*$*/f.getVarWithLongName()/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
|
||||
struct Foo{
|
||||
struct Foo {
|
||||
int getVarWithLongName();
|
||||
};
|
||||
|
||||
void bar(){
|
||||
void bar() {
|
||||
Foo f;
|
||||
int varWithLongName = f.getVarWithLongName();
|
||||
varWithLongName;
|
||||
int varWithLongName = f.getVarWithLongName();
|
||||
varWithLongName;
|
||||
}
|
||||
|
||||
//!Bug 330693 Improve suggested variable name in Extract Local Variable: name == prefix
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
|
||||
struct Foo{
|
||||
struct Foo {
|
||||
int get();
|
||||
};
|
||||
|
||||
void bar(){
|
||||
void bar() {
|
||||
Foo f;
|
||||
/*$*/f.get()/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
|
||||
struct Foo{
|
||||
struct Foo {
|
||||
int get();
|
||||
};
|
||||
|
||||
void bar(){
|
||||
void bar() {
|
||||
Foo f;
|
||||
int get = f.get();
|
||||
get;
|
||||
int get = f.get();
|
||||
get;
|
||||
}
|
||||
|
||||
//!Bug 335202 Suggested name is wrong for nested function calls - outer function call
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
|
||||
int getA(){
|
||||
return 0;
|
||||
int getA() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
int getB(int a){
|
||||
return a;
|
||||
int getB(int a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
void bar(){
|
||||
/*$*/getB(getA())/*$$*/;
|
||||
void bar() {
|
||||
/*$*/getB(getA())/*$$*/;
|
||||
}
|
||||
|
||||
//=
|
||||
|
||||
int getA(){
|
||||
return 0;
|
||||
int getA() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
int getB(int a){
|
||||
return a;
|
||||
int getB(int a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
void bar(){
|
||||
int b = getB(getA());
|
||||
b;
|
||||
void bar() {
|
||||
int b = getB(getA());
|
||||
b;
|
||||
}
|
||||
|
||||
//!Bug 335202 Suggested name is wrong for nested function calls - inner function call
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
|
||||
//@A.cpp
|
||||
|
||||
int getA(){
|
||||
return 0;
|
||||
int getA() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
int getB(int a){
|
||||
return a;
|
||||
int getB(int a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
int getC(int a){
|
||||
return a;
|
||||
int getC(int a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
void bar(){
|
||||
getB(/*$*/getC(getA())/*$$*/);
|
||||
void bar() {
|
||||
getB(/*$*/getC(getA())/*$$*/);
|
||||
}
|
||||
|
||||
//=
|
||||
|
||||
int getA(){
|
||||
return 0;
|
||||
int getA() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
int getB(int a){
|
||||
return a;
|
||||
int getB(int a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
int getC(int a){
|
||||
return a;
|
||||
int getC(int a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
void bar(){
|
||||
int c = getC(getA());
|
||||
getB(c);
|
||||
void bar() {
|
||||
int c = getC(getA());
|
||||
getB(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
//!extract local variable from for loop
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
|
||||
//@main.cpp
|
||||
void foo(){
|
||||
for(int n = 5 + 2; n < 10; ++n);
|
||||
void foo() {
|
||||
for (int n = 5 + 2; n < 10; ++n)
|
||||
;
|
||||
}
|
||||
|
||||
//=
|
||||
void foo(){
|
||||
int i = 5 + 2;
|
||||
for(int n = i; n < 10; ++n);
|
||||
void foo() {
|
||||
int i = 5 + 2;
|
||||
for (int n = i; n < 10; ++n)
|
||||
;
|
||||
}
|
||||
|
||||
//@refScript.xml
|
||||
|
@ -17,5 +19,5 @@ void foo(){
|
|||
<refactoring comment="Extract 5 + 2" description="Extract Local Variable Refactoring"
|
||||
fileName="file:$$projectPath$$/main.cpp" flags="4"
|
||||
id="org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable.ExtractLocalVariableRefactoring"
|
||||
name="i" project="RegressionTestProject" selection="25,5"/>
|
||||
name="i" project="RegressionTestProject" selection="27,5"/>
|
||||
</session>
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -4,13 +4,12 @@
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
};
|
||||
|
@ -21,16 +20,15 @@ private:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
int exp();
|
||||
int exp();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -38,62 +36,55 @@ private:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
int A::foo()
|
||||
{
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
++i;
|
||||
help();
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
}
|
||||
int A::exp()
|
||||
{
|
||||
int i = 2;
|
||||
++i;
|
||||
help();
|
||||
return i;
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::exp() {
|
||||
int i = 2;
|
||||
++i;
|
||||
help();
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
int i = exp();
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//@refScript.xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<session version="1.0">
|
||||
<refactoring comment="Create method exp" description="Extract Method Refactoring"
|
||||
fileName="file:$$projectPath$$/A.cpp"
|
||||
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
|
||||
name="exp" project="RegressionTestProject" selection="56,25" visibility="private"/>
|
||||
<refactoring comment="Create method exp" description="Extract Method Refactoring"
|
||||
fileName="file:$$projectPath$$/A.cpp"
|
||||
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
|
||||
name="exp" project="RegressionTestProject" selection="57,25" visibility="private"/>
|
||||
</session>
|
||||
|
||||
|
||||
|
@ -103,13 +94,12 @@ int A::help()
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
};
|
||||
|
@ -120,16 +110,15 @@ private:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
void exp(int & i);
|
||||
void exp(int& i);
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -137,15 +126,13 @@ private:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
int A::foo()
|
||||
{
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
//comment
|
||||
++i;
|
||||
|
@ -153,40 +140,35 @@ int A::foo()
|
|||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
}
|
||||
void A::exp(int & i)
|
||||
{
|
||||
//comment
|
||||
++i;
|
||||
help();
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
void A::exp(int& i) {
|
||||
//comment
|
||||
++i;
|
||||
help();
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
//comment
|
||||
exp(i);
|
||||
exp(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//@refScript.xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -194,32 +176,29 @@ int A::help()
|
|||
<refactoring comment="Create method exp" description="Extract Method Refactoring"
|
||||
fileName="file:$$projectPath$$/A.cpp"
|
||||
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
|
||||
name="exp" project="RegressionTestProject" selection="79,13" visibility="private"/>
|
||||
name="exp" project="RegressionTestProject" selection="69,24" visibility="private"/>
|
||||
</session>
|
||||
|
||||
//!Extract Function History first extracted statement with leading comment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
|
||||
//@main.cpp
|
||||
int main(){
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
// Comment
|
||||
i= 7;
|
||||
i = 7;
|
||||
return i;
|
||||
}
|
||||
|
||||
//=
|
||||
void exp(int & i)
|
||||
{
|
||||
// Comment
|
||||
i = 7;
|
||||
void exp(int& i) {
|
||||
// Comment
|
||||
i = 7;
|
||||
}
|
||||
|
||||
int main(){
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
// Comment
|
||||
exp(i);
|
||||
exp(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -229,29 +208,26 @@ int main(){
|
|||
<refactoring comment="Create method exp" description="Extract Method Refactoring"
|
||||
fileName="file:$$projectPath$$/main.cpp"
|
||||
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
|
||||
name="exp" project="RegressionTestProject" selection="35,5" visibility="private"/>
|
||||
name="exp" project="RegressionTestProject" selection="34,6" visibility="private"/>
|
||||
</session>
|
||||
|
||||
//!Extract Function History extracted statement with trailling comment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
|
||||
//@main.cpp
|
||||
int main(){
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
i= 7; // Comment
|
||||
i = 7; // Comment
|
||||
return i;
|
||||
}
|
||||
|
||||
//=
|
||||
void exp(int & i)
|
||||
{
|
||||
i = 7; // Comment
|
||||
void exp(int& i) {
|
||||
i = 7; // Comment
|
||||
}
|
||||
|
||||
int main(){
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
exp(i); // Comment
|
||||
exp(i); // Comment
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -261,7 +237,7 @@ int main(){
|
|||
<refactoring comment="Create method exp" description="Extract Method Refactoring"
|
||||
fileName="file:$$projectPath$$/main.cpp"
|
||||
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
|
||||
name="exp" project="RegressionTestProject" selection="23,5" visibility="private"/>
|
||||
name="exp" project="RegressionTestProject" selection="22,6" visibility="private"/>
|
||||
</session>
|
||||
|
||||
//!ExtractFunctionRefactoringTest duplicates with different Names History Test
|
||||
|
@ -270,13 +246,12 @@ int main(){
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
};
|
||||
|
@ -287,16 +262,15 @@ private:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
void exp(int & i);
|
||||
void exp(int& i);
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -304,61 +278,56 @@ private:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
int oo = 99;
|
||||
++oo;
|
||||
help();
|
||||
}int A::foo()
|
||||
{
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
++i;
|
||||
help();
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
int oo = 99;
|
||||
exp(oo);
|
||||
}void A::exp(int & i)
|
||||
{
|
||||
++i;
|
||||
help();
|
||||
exp(oo);
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
void A::exp(int& i) {
|
||||
++i;
|
||||
help();
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
exp(i);
|
||||
exp(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//@refScript.xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<session version="1.0">
|
||||
<refactoring comment="Create method exp" description="Extract Method Refactoring"
|
||||
<refactoring comment="Create method exp" description="Extract Method Refactoring"
|
||||
fileName="file:$$projectPath$$/A.cpp" flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
|
||||
name="exp" project="RegressionTestProject" replaceDuplicates="true" selection="97,13" visibility="private"/>
|
||||
name="exp" project="RegressionTestProject" replaceDuplicates="true" selection="99,13" visibility="private"/>
|
||||
</session>
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
};
|
||||
|
@ -21,16 +20,15 @@ private:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
|
||||
private:
|
||||
int help();
|
||||
void exp(int & ii);
|
||||
void exp(int& ii);
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -40,15 +38,13 @@ private:
|
|||
|
||||
#define ADD(a,ab) a + ab + 2 + a
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
int A::foo()
|
||||
{
|
||||
|
||||
int A::foo() {
|
||||
int ii = 2;
|
||||
/*$*/++ii;
|
||||
ii = ADD(ii, 42);
|
||||
|
@ -56,41 +52,36 @@ int A::foo()
|
|||
return ii;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
#define ADD(a,ab) a + ab + 2 + a
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
}
|
||||
void A::exp(int & ii)
|
||||
{
|
||||
++ii;
|
||||
ii = ADD(ii, 42);
|
||||
help();
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
void A::exp(int& ii) {
|
||||
++ii;
|
||||
ii = ADD(ii, 42);
|
||||
help();
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
int ii = 2;
|
||||
exp(ii);
|
||||
exp(ii);
|
||||
return ii;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//!Extract Method return value assinged to Macrocall Bug
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
|
||||
|
@ -101,14 +92,14 @@ returnparameterindex=1
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
private:
|
||||
int help();
|
||||
int help();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -117,15 +108,15 @@ private:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
private:
|
||||
int help();
|
||||
int exp(int & i, int b);
|
||||
int help();
|
||||
int exp(int& i, int b);
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -135,62 +126,55 @@ private:
|
|||
|
||||
#define ADD(b) b = b + 2
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
int A::foo()
|
||||
{
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
int b = 42;
|
||||
/*$*/++i;
|
||||
help();
|
||||
ADD(b);/*$$*/
|
||||
help();
|
||||
ADD(b);/*$$*/
|
||||
b += 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
#define ADD(b) b = b + 2
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
}
|
||||
int A::exp(int & i, int b)
|
||||
{
|
||||
++i;
|
||||
help();
|
||||
ADD(b);
|
||||
return b;
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::exp(int& i, int b) {
|
||||
++i;
|
||||
help();
|
||||
ADD(b);
|
||||
return b;
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
int b = 42;
|
||||
b = exp(i, b);
|
||||
b = exp(i, b);
|
||||
b += 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//!Extract Method Methodlength with more than 1 Macrocall Bug
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
|
||||
|
@ -202,14 +186,14 @@ replaceduplicates=true
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
private:
|
||||
int help();
|
||||
int help();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -218,15 +202,15 @@ private:
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
virtual ~A();
|
||||
int foo();
|
||||
|
||||
private:
|
||||
int help();
|
||||
int exp(int bb);
|
||||
int help();
|
||||
int exp(int bb);
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -236,60 +220,53 @@ private:
|
|||
|
||||
#define ADD(b) b = b + 2
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
int A::foo()
|
||||
{
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
int bb = 42;
|
||||
++i;
|
||||
/*$*/ADD(bb);
|
||||
ADD(bb);/*$$*/
|
||||
/*$*/ADD(bb);
|
||||
ADD(bb);/*$$*/
|
||||
bb += 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
#define ADD(b) b = b + 2
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
}
|
||||
int A::exp(int bb)
|
||||
{
|
||||
ADD(bb);
|
||||
ADD(bb);
|
||||
return bb;
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::exp(int bb) {
|
||||
ADD(bb);
|
||||
ADD(bb);
|
||||
return bb;
|
||||
}
|
||||
|
||||
int A::foo() {
|
||||
int i = 2;
|
||||
int bb = 42;
|
||||
++i;
|
||||
bb = exp(bb);
|
||||
bb = exp(bb);
|
||||
bb += 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
int A::help()
|
||||
{
|
||||
int A::help() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -6,11 +6,12 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
class A{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
void method2();
|
||||
std::string toString();
|
||||
A();
|
||||
void method2();
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
int i;
|
||||
};
|
||||
|
@ -23,13 +24,14 @@ private:
|
|||
|
||||
#include <iostream>
|
||||
|
||||
class A{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
std::string toString();
|
||||
A();
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
int i;
|
||||
void method2();
|
||||
int i;
|
||||
void method2();
|
||||
};
|
||||
|
||||
#endif /*A_H_*/
|
||||
|
@ -40,5 +42,5 @@ private:
|
|||
<refactoring comment="Hide Method method2" description="Hide Method Refactoring"
|
||||
fileName="file:$$projectPath$$/A.h" flags="2"
|
||||
id="org.eclipse.cdt.internal.ui.refactoring.hidemethod.HideMethodRefactoring"
|
||||
project="RegressionTestProject" selection="83,7"/>
|
||||
project="RegressionTestProject" selection="78,7"/>
|
||||
</session>
|
||||
|
|
|
@ -15,12 +15,10 @@ public:
|
|||
bool a(int = 100) const;
|
||||
};
|
||||
|
||||
inline bool X::a(int int1) const
|
||||
{
|
||||
inline bool X::a(int int1) const {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!Param const and reference and pointer two params
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
|
@ -38,37 +36,34 @@ public:
|
|||
bool xy(int, int i) const;
|
||||
};
|
||||
|
||||
inline bool X::xy(int int1, int i) const
|
||||
{
|
||||
inline bool X::xy(int int1, int i) const {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!Test if TemplateMethod stays in header
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
infos=1
|
||||
//@A.h
|
||||
template<class T> class A
|
||||
{
|
||||
template<class T>
|
||||
class A {
|
||||
public:
|
||||
/*$*/void test();/*$$*/
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
|
||||
//=
|
||||
template<class T> class A
|
||||
{
|
||||
template<class T>
|
||||
class A {
|
||||
public:
|
||||
void test();
|
||||
void test();
|
||||
};
|
||||
|
||||
template<class T> inline void A<T>::test()
|
||||
{
|
||||
template<class T>
|
||||
inline void A<T>::test() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
|
@ -81,45 +76,42 @@ template<class T> inline void A<T>::test()
|
|||
filename=A.h
|
||||
infos=1
|
||||
//@A.h
|
||||
template<class T> class A
|
||||
{
|
||||
template<class T>
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
/*$*/void test();/*$$*/
|
||||
A();
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
|
||||
template<class T> A<T>::A()
|
||||
{
|
||||
template<class T>
|
||||
A<T>::A() {
|
||||
}
|
||||
|
||||
//=
|
||||
template<class T> class A
|
||||
{
|
||||
template<class T>
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
void test();
|
||||
A();
|
||||
void test();
|
||||
};
|
||||
|
||||
template<class T> A<T>::A()
|
||||
{
|
||||
template<class T>
|
||||
A<T>::A() {
|
||||
}
|
||||
|
||||
template<class T> inline void A<T>::test()
|
||||
{
|
||||
template<class T>
|
||||
inline void A<T>::test() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!member class
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
|
||||
class Demo
|
||||
{
|
||||
class SubClass
|
||||
{
|
||||
class Demo {
|
||||
class SubClass {
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
};
|
||||
|
@ -131,102 +123,88 @@ class Demo
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
void Demo::SubClass::test()
|
||||
{
|
||||
void Demo::SubClass::test() {
|
||||
}
|
||||
|
||||
//!method declared in otherwise empty class without cpp file
|
||||
//!Method declared in otherwise empty class without cpp file
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
infos=1
|
||||
//@A.h
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
/*$*/void test();/*$$*/
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
|
||||
//=
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
void test();
|
||||
void test();
|
||||
};
|
||||
|
||||
inline void A::test()
|
||||
{
|
||||
inline void A::test() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!method declared in otherwise empty class
|
||||
//!Method declared in otherwise empty class
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
/*$*/void test();/*$$*/
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
|
||||
//=
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
void test();
|
||||
void test();
|
||||
};
|
||||
|
||||
//@A.cpp
|
||||
|
||||
//=
|
||||
|
||||
|
||||
|
||||
void A::test()
|
||||
{
|
||||
void A::test() {
|
||||
}
|
||||
|
||||
//!implement in existing namespace
|
||||
//!Implement in existing namespace
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
namespace NameSpace
|
||||
{
|
||||
class ClassInNamespace
|
||||
{
|
||||
public:
|
||||
int test();
|
||||
/*$*/void test2();/*$$*/
|
||||
};
|
||||
namespace Namespace {
|
||||
|
||||
class ClassInNamespace {
|
||||
public:
|
||||
int test();
|
||||
/*$*/void test2();/*$$*/
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
namespace NameSpace
|
||||
{
|
||||
int ClassInNamespace::test()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
namespace Namespace {
|
||||
|
||||
int ClassInNamespace::test() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
namespace NameSpace
|
||||
{
|
||||
int ClassInNamespace::test()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
namespace Namespace {
|
||||
|
||||
int ClassInNamespace::test() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
void ClassInNamespace::test2() {
|
||||
}
|
||||
|
||||
void ClassInNamespace::test2()
|
||||
{}
|
||||
}
|
||||
//!virtual method in the middle of con/destructor, without parameters and void return value
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
|
@ -236,8 +214,7 @@ filename=A.h
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
/*$*/virtual void foo();/*$$*/
|
||||
|
@ -248,30 +225,25 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
void A::foo()
|
||||
{
|
||||
void A::foo() {
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
//!implement a function at start of source file
|
||||
//!Implement a function at start of source file
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
|
@ -279,18 +251,15 @@ filename=A.h
|
|||
/*$*/void function();/*$$*/
|
||||
void function_with_impl();
|
||||
//@A.cpp
|
||||
void function_with_impl()
|
||||
{
|
||||
void function_with_impl() {
|
||||
}
|
||||
//=
|
||||
void function()
|
||||
{
|
||||
void function() {
|
||||
}
|
||||
|
||||
void function_with_impl()
|
||||
{
|
||||
void function_with_impl() {
|
||||
}
|
||||
//!method at end, without parameters and void return value
|
||||
//!Method at end, without parameters and void return value
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
|
@ -298,8 +267,7 @@ filename=A.h
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
/*$*/void foo();/*$$*/
|
||||
|
@ -309,24 +277,20 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
void A::foo()
|
||||
{
|
||||
void A::foo() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!method at beginning, without parameters, void return value and const
|
||||
//!Method at beginning, without parameters, void return value and const
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
|
@ -334,8 +298,7 @@ filename=A.h
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
/*$*/void foo() const;/*$$*/
|
||||
A();
|
||||
|
@ -345,22 +308,19 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
void A::foo() const
|
||||
{
|
||||
void A::foo() const {
|
||||
}
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
//!method with int return value
|
||||
//!Method with int return value
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
|
@ -368,8 +328,7 @@ filename=A.h
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
/*$*/int foo();/*$$*/
|
||||
|
@ -379,24 +338,20 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
int A::foo() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!method with two int parameters
|
||||
//!Method with two int parameters
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
|
@ -404,8 +359,7 @@ filename=A.h
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
/*$*/int foo(int param1, int param2);/*$$*/
|
||||
|
@ -415,59 +369,49 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
int A::foo(int param1, int param2)
|
||||
{
|
||||
int A::foo(int param1, int param2) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!method defined in header
|
||||
//!Method defined in header
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
infos=1
|
||||
//@A.h
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
/*$*/void test();/*$$*/
|
||||
A();
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
//=
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
void test();
|
||||
A();
|
||||
void test();
|
||||
};
|
||||
|
||||
A::A()
|
||||
{
|
||||
A::A() {
|
||||
}
|
||||
|
||||
inline void A::test()
|
||||
{
|
||||
inline void A::test() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!implement a function at end of source file
|
||||
//!Implement a function at end of source file
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
|
@ -475,113 +419,111 @@ filename=A.h
|
|||
void function_with_impl();
|
||||
/*$*/void function();/*$$*/
|
||||
//@A.cpp
|
||||
void function_with_impl()
|
||||
{
|
||||
void function_with_impl() {
|
||||
}
|
||||
//=
|
||||
void function_with_impl()
|
||||
{
|
||||
void function_with_impl() {
|
||||
}
|
||||
|
||||
void function()
|
||||
{
|
||||
void function() {
|
||||
}
|
||||
|
||||
|
||||
//!implement with namespace
|
||||
//!Implement with namespace
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
namespace NameSpace
|
||||
{
|
||||
class ClassInNamespace
|
||||
{
|
||||
public:
|
||||
int other_test();
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
namespace Namespace {
|
||||
|
||||
class ClassInNamespace {
|
||||
public:
|
||||
int other_test();
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
void NameSpace::ClassInNamespace::other_test()
|
||||
{
|
||||
void Namespace::ClassInNamespace::other_test() {
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
void NameSpace::ClassInNamespace::other_test()
|
||||
{
|
||||
void Namespace::ClassInNamespace::other_test() {
|
||||
}
|
||||
|
||||
void NameSpace::ClassInNamespace::test()
|
||||
{
|
||||
void Namespace::ClassInNamespace::test() {
|
||||
}
|
||||
|
||||
|
||||
//!implement function within namespace
|
||||
//!Implement function within namespace
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
namespace OuterSpace {
|
||||
namespace NameSpace
|
||||
{
|
||||
int test();
|
||||
/*$*/int test2();/*$$*/
|
||||
}
|
||||
namespace Namespace {
|
||||
|
||||
int test();
|
||||
/*$*/int test2();/*$$*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
namespace OuterSpace {
|
||||
int NameSpace::test()
|
||||
{
|
||||
}
|
||||
|
||||
int Namespace::test() {
|
||||
}
|
||||
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
namespace OuterSpace {
|
||||
int NameSpace::test()
|
||||
{
|
||||
}
|
||||
|
||||
int NameSpace::test2()
|
||||
{}
|
||||
int Namespace::test() {
|
||||
}
|
||||
//!implement function within namespaces
|
||||
|
||||
int Namespace::test2() {
|
||||
}
|
||||
|
||||
}
|
||||
//!Implement function within namespaces
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
namespace OuterSpace {
|
||||
namespace NameSpace
|
||||
{
|
||||
int test();
|
||||
/*$*/int test2();/*$$*/
|
||||
}
|
||||
namespace Namespace {
|
||||
|
||||
int test();
|
||||
/*$*/int test2();/*$$*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
namespace OuterSpace {
|
||||
namespace NameSpace {
|
||||
int test()
|
||||
{
|
||||
}
|
||||
}
|
||||
namespace Namespace {
|
||||
|
||||
int test() {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
namespace OuterSpace {
|
||||
namespace NameSpace {
|
||||
int test()
|
||||
{
|
||||
}
|
||||
namespace Namespace {
|
||||
|
||||
int test2()
|
||||
{}
|
||||
}
|
||||
int test() {
|
||||
}
|
||||
|
||||
int test2() {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//!class template member functions with multiple templates
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
|
@ -589,43 +531,41 @@ namespace OuterSpace {
|
|||
filename=A.h
|
||||
infos=1
|
||||
//@A.h
|
||||
template<class T, class U> class A
|
||||
{
|
||||
template<class T, class U>
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
/*$*/void test();/*$$*/
|
||||
A();
|
||||
/*$*/void test();/*$$*/
|
||||
};
|
||||
|
||||
template<class T, class U> A<T,U>::A()
|
||||
{
|
||||
template<class T, class U>
|
||||
A<T,U>::A() {
|
||||
}
|
||||
|
||||
//=
|
||||
template<class T, class U> class A
|
||||
{
|
||||
template<class T, class U>
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
void test();
|
||||
A();
|
||||
void test();
|
||||
};
|
||||
|
||||
template<class T, class U> A<T,U>::A()
|
||||
{
|
||||
template<class T, class U>
|
||||
A<T,U>::A() {
|
||||
}
|
||||
|
||||
template<class T, class U> inline void A<T,U>::test()
|
||||
{
|
||||
template<class T, class U>
|
||||
inline void A<T, U>::test() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!with default parameters
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
|
||||
class Class
|
||||
{
|
||||
class Class {
|
||||
public:
|
||||
/*$*/void test(int param1, int param2 = 5, int param3 = 10);/*$$*/
|
||||
};
|
||||
|
@ -637,20 +577,15 @@ public:
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
void Class::test(int param1, int param2, int param3)
|
||||
{
|
||||
void Class::test(int param1, int param2, int param3) {
|
||||
}
|
||||
|
||||
//!static method
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
|
||||
class Class
|
||||
{
|
||||
class Class {
|
||||
public:
|
||||
/*$*/static void test();/*$$*/
|
||||
};
|
||||
|
@ -662,12 +597,8 @@ public:
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
void Class::test()
|
||||
{
|
||||
void Class::test() {
|
||||
}
|
||||
|
||||
//! Bug 238253 Pointer refence of the return value lost
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
|
@ -686,21 +617,16 @@ public:
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
int *TestClass::get(char *val)
|
||||
{
|
||||
int* TestClass::get(char* val) {
|
||||
}
|
||||
|
||||
//! Bug 238554 void parameters
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
|
||||
class Test
|
||||
{
|
||||
public:
|
||||
class Test {
|
||||
public:
|
||||
/*$*/void doNothing(void);/*$$*/
|
||||
};
|
||||
|
||||
|
@ -711,12 +637,8 @@ class Test
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
void Test::doNothing(void)
|
||||
{
|
||||
void Test::doNothing(void) {
|
||||
}
|
||||
|
||||
//! Bug 282989 Refactor->Implement method option doesn't qualify the name in the method definition with a fully qualified container class name
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
|
@ -726,10 +648,12 @@ infos=1
|
|||
#ifndef TESTCLASS_H_
|
||||
#define TESTCLASS_H_
|
||||
|
||||
namespace nspace{
|
||||
namespace nspace {
|
||||
|
||||
class TestClass {
|
||||
void /*$*/testMethod()/*$$*/;
|
||||
void /*$*/testMethod()/*$$*/;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* TESTCLASS_H_ */
|
||||
|
@ -738,18 +662,18 @@ void /*$*/testMethod()/*$$*/;
|
|||
#ifndef TESTCLASS_H_
|
||||
#define TESTCLASS_H_
|
||||
|
||||
namespace nspace{
|
||||
namespace nspace {
|
||||
|
||||
class TestClass {
|
||||
void testMethod();
|
||||
void testMethod();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
inline void nspace::TestClass::testMethod()
|
||||
{
|
||||
inline void nspace::TestClass::testMethod() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* TESTCLASS_H_ */
|
||||
|
||||
//!Bug 290110 Source-> Implement Method
|
||||
|
@ -768,6 +692,7 @@ public:
|
|||
A();
|
||||
~A();
|
||||
void testmethod(int x);
|
||||
|
||||
protected:
|
||||
class B {
|
||||
public:
|
||||
|
@ -810,12 +735,10 @@ A::~A() {
|
|||
}
|
||||
}
|
||||
|
||||
void n1::n2::A::B::testmethod2()
|
||||
{
|
||||
void n1::n2::A::B::testmethod2() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!Bug 337040 - Insert definition in empty implementation file (.cxx)
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
|
@ -832,12 +755,8 @@ public:
|
|||
|
||||
//=
|
||||
|
||||
|
||||
|
||||
void TestClass::foo()
|
||||
{
|
||||
void TestClass::foo() {
|
||||
}
|
||||
|
||||
//!Bug 355006 - NPE implementing template function
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
|
||||
//@.config
|
||||
|
@ -845,15 +764,14 @@ filename=A.h
|
|||
infos=1
|
||||
//@A.h
|
||||
|
||||
/*$*/template<typename T> void func(T&);/*$$*/
|
||||
|
||||
/*$*/template<typename T>
|
||||
void func(T&);/*$$*/
|
||||
//=
|
||||
|
||||
template<typename T> void func(T&);
|
||||
template<typename T>
|
||||
void func(T&);
|
||||
|
||||
template<typename T> inline void func(T& )
|
||||
{
|
||||
template<typename T>
|
||||
inline void func(T&) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ newfilecreation=true
|
|||
newfiles=A.cpp
|
||||
//@A.h
|
||||
void /*$*/freefunction/*$$*/() {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
//=
|
||||
void freefunction();
|
||||
|
@ -17,9 +17,8 @@ void freefunction();
|
|||
|
||||
#include "A.h"
|
||||
|
||||
void freefunction()
|
||||
{
|
||||
return;
|
||||
void freefunction() {
|
||||
return;
|
||||
}
|
||||
//!FreefunctionFromImplToHeader
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -28,9 +27,8 @@ filename=A.cpp
|
|||
newfilecreation=true
|
||||
newfiles=A.h
|
||||
//@A.cpp
|
||||
void /*$*/freefunction/*$$*/()
|
||||
{
|
||||
return;
|
||||
void /*$*/freefunction/*$$*/() {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -40,8 +38,7 @@ void /*$*/freefunction/*$$*/()
|
|||
//=
|
||||
|
||||
|
||||
void freefunction()
|
||||
{
|
||||
return;
|
||||
void freefunction() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,16 +7,14 @@ filename=A.h
|
|||
using namespace std;
|
||||
|
||||
class A {
|
||||
int /*$*/member/*$$*/();
|
||||
int /*$*/member/*$$*/();
|
||||
};
|
||||
//=
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
class A {
|
||||
int member()
|
||||
{
|
||||
return int();
|
||||
}
|
||||
|
||||
int member() {
|
||||
return int();
|
||||
}
|
||||
};
|
|
@ -4,208 +4,190 @@
|
|||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void /*$*/member/*$$*/()
|
||||
{
|
||||
// return comment
|
||||
return;
|
||||
}
|
||||
void /*$*/member/*$$*/() {
|
||||
// return comment
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
// return comment
|
||||
return;
|
||||
inline void A::member() {
|
||||
// return comment
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!ClassToHeaderTopCommentOrder
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
// First Top Comment
|
||||
// Second Top Comment
|
||||
void /*$*/member/*$$*/()
|
||||
{
|
||||
return;
|
||||
}
|
||||
// First Top Comment
|
||||
// Second Top Comment
|
||||
void /*$*/member/*$$*/() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
// First Top Comment
|
||||
// Second Top Comment
|
||||
void member();
|
||||
// First Top Comment
|
||||
// Second Top Comment
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!ClassToHeaderCatchComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void /*$*/member/*$$*/() try
|
||||
{
|
||||
return;
|
||||
} catch (int i) {
|
||||
// catch comment
|
||||
}
|
||||
void /*$*/member/*$$*/() try
|
||||
{
|
||||
return;
|
||||
}
|
||||
catch (int i) {
|
||||
// catch comment
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(int i){
|
||||
// catch comment
|
||||
catch (int i) {
|
||||
// catch comment
|
||||
}
|
||||
|
||||
|
||||
//!ClassToHeaderTopComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
// Top comment
|
||||
void /*$*/member/*$$*/()
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Top comment
|
||||
void /*$*/member/*$$*/() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
// Top comment
|
||||
void member();
|
||||
// Top comment
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!ClassToHeaderTemplateTopComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
// Top comment
|
||||
template<typename T>
|
||||
T /*$*/member/*$$*/()
|
||||
{
|
||||
return T();
|
||||
}
|
||||
// Top comment
|
||||
template<typename T>
|
||||
T /*$*/member/*$$*/() {
|
||||
return T();
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
// Top comment
|
||||
template<typename T>
|
||||
T member();
|
||||
// Top comment
|
||||
template<typename T>
|
||||
T member();
|
||||
|
||||
};
|
||||
|
||||
// Top comment
|
||||
template<typename T> inline T A::member()
|
||||
{
|
||||
return T();
|
||||
template<typename T>
|
||||
inline T A::member() {
|
||||
return T();
|
||||
}
|
||||
|
||||
|
||||
//!ClassToHeaderTrailingComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void /*$*/member/*$$*/()
|
||||
{
|
||||
return;
|
||||
} // Trailing comment
|
||||
void /*$*/member/*$$*/() {
|
||||
return;
|
||||
} // Trailing comment
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
} // Trailing comment
|
||||
|
||||
|
||||
//!ClassToHeaderTrailingCommentWithTryBlock
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void /*$*/member/*$$*/() try
|
||||
{
|
||||
return;
|
||||
} catch (int e) {
|
||||
} // Trailing comment
|
||||
void /*$*/member/*$$*/()
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch (int e) {
|
||||
} // Trailing comment
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(int e){
|
||||
catch (int e) {
|
||||
}
|
||||
// Trailing comment
|
||||
|
||||
// Trailing comment
|
||||
//!ClassToHeaderTrailingMultipleCommentsInTryBlock
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
int /*$*/member/*$$*/() try
|
||||
{
|
||||
// aans
|
||||
} /* one */ catch (int i) {
|
||||
// zwaa
|
||||
} /* two */ catch (int j) {
|
||||
// draa
|
||||
} /* three */
|
||||
int /*$*/member/*$$*/()
|
||||
try {
|
||||
// aans
|
||||
} /* one */ catch (int i) {
|
||||
// zwaa
|
||||
} /* two */ catch (int j) {
|
||||
// draa
|
||||
} /* three */
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
int member();
|
||||
int member();
|
||||
};
|
||||
|
||||
inline int A::member()
|
||||
try
|
||||
{
|
||||
// aans
|
||||
try {
|
||||
// aans
|
||||
} /* one */
|
||||
catch(int i){
|
||||
// zwaa
|
||||
catch (int i) {
|
||||
// zwaa
|
||||
}
|
||||
/* two */catch(int j){
|
||||
// draa
|
||||
/* two */catch (int j) {
|
||||
// draa
|
||||
}
|
||||
/* three */
|
||||
|
||||
/* three */
|
||||
|
|
|
@ -5,21 +5,21 @@ filename=A.h
|
|||
//@A.h
|
||||
template<typename T>
|
||||
class A {
|
||||
T /*$*/member/*$$*/();
|
||||
T /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
template<typename T> inline T A<T>::member() {
|
||||
// body comment
|
||||
return T();
|
||||
template<typename T>
|
||||
inline T A<T>::member() {
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
//=
|
||||
template<typename T>
|
||||
class A {
|
||||
T member()
|
||||
{
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
T member() {
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -32,27 +32,25 @@ template<typename T>
|
|||
class A {
|
||||
// First comment
|
||||
// Second comment
|
||||
T /*$*/member/*$$*/();
|
||||
T /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
// Third comment
|
||||
// Fourth comment
|
||||
template<typename T>
|
||||
inline T A<T>::member()
|
||||
{
|
||||
return T();
|
||||
inline T A<T>::member() {
|
||||
return T();
|
||||
}
|
||||
//=
|
||||
template<typename T>
|
||||
class A {
|
||||
// Third comment
|
||||
// Fourth comment
|
||||
// First comment
|
||||
// Second comment
|
||||
T member()
|
||||
{
|
||||
return T();
|
||||
}
|
||||
// Fourth comment
|
||||
// First comment
|
||||
// Second comment
|
||||
T member() {
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -65,32 +63,35 @@ filename=A.h
|
|||
//@A.h
|
||||
template<typename T>
|
||||
class A {
|
||||
T /*$*/member/*$$*/();
|
||||
T /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
template<typename T> inline T A<T>::member() try {
|
||||
// body comment
|
||||
return T();
|
||||
} catch(int e) {
|
||||
// Catch 1
|
||||
} catch(int e) {
|
||||
// Catch 2
|
||||
template<typename T>
|
||||
inline T A<T>::member()
|
||||
try {
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
catch (int e) {
|
||||
// Catch 1
|
||||
}
|
||||
catch (int e) {
|
||||
// Catch 2
|
||||
}
|
||||
//=
|
||||
template<typename T>
|
||||
class A {
|
||||
T member()
|
||||
try
|
||||
{
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
catch(int e){
|
||||
// Catch 1
|
||||
}
|
||||
catch(int e){
|
||||
// Catch 2
|
||||
}
|
||||
T member()
|
||||
try {
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
catch (int e) {
|
||||
// Catch 1
|
||||
}
|
||||
catch (int e) {
|
||||
// Catch 2
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -101,29 +102,27 @@ filename=A.h
|
|||
//@A.h
|
||||
template<typename S, typename T>
|
||||
class A {
|
||||
// Top Comment
|
||||
template<typename U, typename V>
|
||||
T /*$*/member/*$$*/();
|
||||
// Top Comment
|
||||
template<typename U, typename V>
|
||||
T /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
// 2nd Top Comment
|
||||
template<typename S, typename T>
|
||||
template<typename U, typename V>
|
||||
inline T A<S, T>::member() {
|
||||
// body comment
|
||||
return T();
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
//=
|
||||
template<typename S, typename T>
|
||||
class A {
|
||||
// Top Comment
|
||||
template<typename U, typename V>
|
||||
T member()
|
||||
{
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
|
||||
// Top Comment
|
||||
template<typename U, typename V>
|
||||
T member() {
|
||||
// body comment
|
||||
return T();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -136,21 +135,21 @@ filename=A.h
|
|||
//@A.h
|
||||
template<typename T>
|
||||
class A {
|
||||
T /*$*/member/*$$*/();
|
||||
T /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
// Top comment
|
||||
template<typename T> inline T A<T>::member() {
|
||||
return T();
|
||||
template<typename T>
|
||||
inline T A<T>::member() {
|
||||
return T();
|
||||
}
|
||||
//=
|
||||
template<typename T>
|
||||
class A {
|
||||
// Top comment
|
||||
T member()
|
||||
{
|
||||
return T();
|
||||
}
|
||||
// Top comment
|
||||
T member() {
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void /*$*/member/*$$*/();
|
||||
void /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
inline void A::member() {
|
||||
// body comment
|
||||
return;
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,30 +22,27 @@ class A {
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
void A::member()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
void A::member() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
|
||||
//!HeaderToImplTryCatchComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void /*$*/member/*$$*/();
|
||||
void /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
inline void A::member() try {
|
||||
// body comment
|
||||
return;
|
||||
// body comment
|
||||
return;
|
||||
} catch /*1*/ (int e) { /*2*/ }
|
||||
catch /*3*/ (int e) { /*4*/ }
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
|
||||
|
@ -54,37 +51,34 @@ class A {
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
void A::member()
|
||||
try
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
try {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
catch(/*1*/int e){
|
||||
/*2*/
|
||||
catch (/*1*/int e) {
|
||||
/*2*/
|
||||
}
|
||||
catch(/*3*/int e){
|
||||
/*4*/
|
||||
catch (/*3*/int e) {
|
||||
/*4*/
|
||||
}
|
||||
|
||||
//!HeaderToImplTopComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void /*$*/member/*$$*/();
|
||||
void /*$*/member/*$$*/();
|
||||
};
|
||||
|
||||
// Top comment
|
||||
inline void A::member() {
|
||||
// body comment
|
||||
return;
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
|
||||
|
@ -94,14 +88,11 @@ class A {
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
// Top comment
|
||||
void A::member()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
void A::member() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
|
||||
//!HeaderToImplFreeFuncTopComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -109,7 +100,7 @@ filename=A.h
|
|||
//@A.h
|
||||
// Definition comment
|
||||
void /*$*/member/*$$*/() {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
//=
|
||||
// Definition comment
|
||||
|
@ -121,11 +112,7 @@ void member();
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
// Definition comment
|
||||
void member()
|
||||
{
|
||||
return;
|
||||
void member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,9 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
void A::/*$*/member/*$$*/()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
void A::/*$*/member/*$$*/() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -16,15 +15,14 @@ void A::/*$*/member/*$$*/()
|
|||
|
||||
//@A.h
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
void member() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
};
|
||||
//!ImplToHeaderTopComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -34,9 +32,8 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
// Definition comment
|
||||
void A::/*$*/member/*$$*/()
|
||||
{
|
||||
return;
|
||||
void A::/*$*/member/*$$*/() {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -45,15 +42,14 @@ void A::/*$*/member/*$$*/()
|
|||
|
||||
//@A.h
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
// Definition comment
|
||||
void member()
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Definition comment
|
||||
void member() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//!ImplToHeaderTryCatchComment
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -63,9 +59,8 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
// Definition comment
|
||||
void A::/*$*/member/*$$*/() try
|
||||
{
|
||||
return;
|
||||
void A::/*$*/member/*$$*/() try {
|
||||
return;
|
||||
} /*1*/ catch (int e) { /*2*/ } /*3*/ catch (int e) { /*4*/ }
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -74,22 +69,21 @@ void A::/*$*/member/*$$*/() try
|
|||
|
||||
//@A.h
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
// Definition comment
|
||||
void member()
|
||||
try
|
||||
{
|
||||
return;
|
||||
} /*1*/
|
||||
catch(int e){
|
||||
/*2*/
|
||||
}
|
||||
/*3*/catch(int e){
|
||||
/*4*/
|
||||
}
|
||||
// Definition comment
|
||||
void member()
|
||||
try {
|
||||
return;
|
||||
} /*1*/
|
||||
catch (int e) {
|
||||
/*2*/
|
||||
}
|
||||
/*3*/catch (int e) {
|
||||
/*4*/
|
||||
}
|
||||
};
|
||||
//!ImplToHeaderBodyCommentWithoutDeclaration
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -98,10 +92,9 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
void /*$*/member/*$$*/()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
void /*$*/member/*$$*/() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -111,14 +104,10 @@ void /*$*/member/*$$*/()
|
|||
|
||||
//=
|
||||
|
||||
|
||||
|
||||
void member()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
void member() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
|
||||
//!ImplToHeaderTopCommentWithoutDeclaration
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -127,10 +116,9 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
// Top comment
|
||||
void /*$*/member/*$$*/()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
void /*$*/member/*$$*/() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -141,12 +129,8 @@ void /*$*/member/*$$*/()
|
|||
|
||||
//=
|
||||
|
||||
|
||||
|
||||
// Top comment
|
||||
void member()
|
||||
{
|
||||
// body comment
|
||||
return;
|
||||
void member() {
|
||||
// body comment
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,36 +7,34 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
/*$*/A/*$$*/(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
/*$*/A/*$$*/(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y);
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y);
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
inline A::A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{
|
||||
inline A::A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
|
||||
|
||||
//!TestConstructorToggleInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -46,31 +44,30 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y);
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y);
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
inline A::/*$*/A/*$$*/(int x, int y)
|
||||
:a(x), b(y)
|
||||
{
|
||||
inline A::/*$*/A/*$$*/(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y);
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y);
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,21 +75,19 @@ public:
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
A::A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{
|
||||
A::A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
|
||||
|
||||
//!TestConstructorToggleInImplementationToClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -100,13 +95,12 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
A::/*$*/A/*$$*/(int x, int y)
|
||||
:a(x), b(y)
|
||||
{
|
||||
A::/*$*/A/*$$*/(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -114,28 +108,25 @@ int main() {
|
|||
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//@A.h
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
A(int x, int y);
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y);
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{
|
||||
}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
//!TestDestructorToggleInClassToInHeader
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -146,28 +137,28 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
/*$*/~A/*$$*/()
|
||||
{}
|
||||
/*$*/~A/*$$*/() {
|
||||
}
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
~A();
|
||||
~A();
|
||||
};
|
||||
|
||||
inline A::~A()
|
||||
{
|
||||
inline A::~A() {
|
||||
}
|
||||
|
||||
|
||||
//!TestDestructorToggleInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -177,24 +168,25 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
~A();
|
||||
~A();
|
||||
};
|
||||
|
||||
inline /*$*/A::~A/*$$*/()
|
||||
{
|
||||
inline /*$*/A::~A/*$$*/() {
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
~A();
|
||||
~A();
|
||||
};
|
||||
|
||||
|
||||
|
@ -202,20 +194,18 @@ public:
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
A::~A()
|
||||
{
|
||||
A::~A() {
|
||||
}
|
||||
|
||||
|
||||
//!TestDestructorToggleInImplementationToClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -223,15 +213,14 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
/*$*/A::~A/*$$*/()
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
return;
|
||||
/*$*/A::~A/*$$*/() {
|
||||
int x;
|
||||
int y;
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -239,28 +228,27 @@ int main() {
|
|||
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//@A.h
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A();
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A();
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
return;
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
int x;
|
||||
int y;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,24 +6,21 @@ filename=A.h
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void /*$*/member/*$$*/(int a=0, int b=0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void /*$*/member/*$$*/(int a = 0, int b = 0) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member(int a=0, int b=0);
|
||||
void member(int a = 0, int b = 0);
|
||||
};
|
||||
|
||||
inline void A::member(int a, int b)
|
||||
{
|
||||
return;
|
||||
inline void A::member(int a, int b) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestDefaultParameterInitializerInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -32,18 +29,17 @@ filename=A.h
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member(int a=0, int b=0);
|
||||
void member(int a = 0, int b = 0);
|
||||
};
|
||||
|
||||
inline void /*$*/A::member/*$$*/(int a, int b)
|
||||
{
|
||||
return;
|
||||
inline void /*$*/A::member/*$$*/(int a, int b) {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member(int a=0, int b=0);
|
||||
void member(int a = 0, int b = 0);
|
||||
};
|
||||
|
||||
|
||||
|
@ -51,21 +47,19 @@ class A {
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void A::member(int a, int b)
|
||||
{
|
||||
return;
|
||||
void A::member(int a, int b) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestDefaultParameterInitializerInImplementationToClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -73,36 +67,32 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
void A::/*$*/member/*$$*/(int a, int b)
|
||||
{
|
||||
return;
|
||||
void A::/*$*/member/*$$*/(int a, int b) {
|
||||
return;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//@A.h
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member(int a = 0, int b = 0);
|
||||
void member(int a = 0, int b = 0);
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member(int a = 0, int b = 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void member(int a = 0, int b = 0) {
|
||||
return;
|
||||
}
|
||||
};
|
|
@ -6,18 +6,17 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void N::A::/*$*/foo/*$$*/()
|
||||
{
|
||||
return;
|
||||
void N::A::/*$*/foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,21 +25,24 @@ int main() {
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
//!TestImplementationToClassWithDeclarationSelected
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -51,9 +53,11 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void /*$*/foo/*$$*/();
|
||||
};
|
||||
|
||||
class A {
|
||||
void /*$*/foo/*$$*/();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//=
|
||||
|
@ -61,28 +65,30 @@ namespace N {
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
void N::A::foo()
|
||||
{
|
||||
return;
|
||||
|
||||
void N::A::foo() {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ fatalerror=true
|
|||
|
||||
class A {
|
||||
public:
|
||||
void foo()
|
||||
{
|
||||
}
|
||||
void foo() {
|
||||
}
|
||||
|
||||
private:
|
||||
int /*$*/x/*$$*/;
|
||||
int /*$*/x/*$$*/;
|
||||
};
|
||||
|
||||
//!TestNotSupportedNoDefinition
|
||||
|
@ -23,14 +23,13 @@ fatalerror=true
|
|||
|
||||
class A {
|
||||
public:
|
||||
void /*$*/foo/*$$*/();
|
||||
void /*$*/foo/*$$*/();
|
||||
};
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//!TestNotSupportedNoTranslationunit
|
||||
|
@ -42,7 +41,7 @@ fatalerror=true
|
|||
|
||||
class A {
|
||||
public:
|
||||
void /*$*/foo/*$$*/();
|
||||
void /*$*/foo/*$$*/();
|
||||
};
|
||||
|
||||
//!TestMultipleDeclarations
|
||||
|
@ -54,15 +53,14 @@ fatalerror=true
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void /*$*/foo/*$$*/();
|
||||
void foo();
|
||||
void /*$*/foo/*$$*/();
|
||||
void foo();
|
||||
};
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//!TestMultipledefinitions
|
||||
|
@ -73,28 +71,23 @@ fatalerror=true
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
void /*$*/foo/*$$*/()
|
||||
{
|
||||
return;
|
||||
}
|
||||
void foo();
|
||||
void /*$*/foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
void blah()
|
||||
{
|
||||
|
||||
void blah() {
|
||||
}
|
||||
|
||||
inline void A::foo()
|
||||
{
|
||||
return;
|
||||
inline void A::foo() {
|
||||
return;
|
||||
}
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//!TestNotSupportedNestedFunctions
|
||||
|
@ -105,9 +98,8 @@ fatalerror=true
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void foo()
|
||||
{
|
||||
void /*$*/bar/*$$*/() {
|
||||
}
|
||||
}
|
||||
void foo() {
|
||||
void /*$*/bar/*$$*/() {
|
||||
}
|
||||
}
|
||||
};
|
|
@ -7,57 +7,55 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
int /*$*/freeFunction/*$$*/(int *a, int & b) {
|
||||
return 42;
|
||||
int /*$*/freeFunction/*$$*/(int* a, int& b) {
|
||||
return 42;
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
int freeFunction(int *a, int & b);
|
||||
int freeFunction(int* a, int& b);
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int freeFunction(int *a, int & b)
|
||||
{
|
||||
return 42;
|
||||
int freeFunction(int* a, int& b) {
|
||||
return 42;
|
||||
}
|
||||
|
||||
|
||||
//!TestFreeFunctionToggleFromImplementationToHeaderWithDeclaration
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -66,18 +64,17 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int /*$*/freeFunction/*$$*/(int *a, int & b)
|
||||
{
|
||||
return 42;
|
||||
int /*$*/freeFunction/*$$*/(int* a, int& b) {
|
||||
return 42;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,40 +83,38 @@ int main() {
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
int freeFunction(int *a, int & b);
|
||||
int freeFunction(int* a, int& b);
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
int freeFunction(int *a, int & b)
|
||||
{
|
||||
return 42;
|
||||
int freeFunction(int* a, int& b) {
|
||||
return 42;
|
||||
}
|
||||
|
||||
|
||||
//!TestFreeFunctionToggleFromImplementationToHeaderWithOutDeclaration
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -128,20 +123,20 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int /*$*/freeFunction/*$$*/(int *a, int & b)
|
||||
int /*$*/freeFunction/*$$*/(int* a, int& b)
|
||||
try {
|
||||
return 42;
|
||||
} catch (std::exception & e)
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,15 +145,15 @@ int main() {
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
//=
|
||||
|
@ -166,35 +161,32 @@ public:
|
|||
|
||||
class A {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
A(int x, int y)
|
||||
:a(x), b(y)
|
||||
{}
|
||||
~A()
|
||||
{
|
||||
}
|
||||
A(int x, int y) :
|
||||
a(x), b(y) {
|
||||
}
|
||||
~A() {
|
||||
}
|
||||
};
|
||||
|
||||
int freeFunction(int *a, int & b)
|
||||
try
|
||||
{
|
||||
return 42;
|
||||
int freeFunction(int* a, int& b)
|
||||
try {
|
||||
return 42;
|
||||
}
|
||||
catch(std::exception & e){
|
||||
catch (std::exception& e) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//!TestFreeFunction
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
int /*$*/freeFunction/*$$*/()
|
||||
{
|
||||
return 42;
|
||||
int /*$*/freeFunction/*$$*/() {
|
||||
return 42;
|
||||
}
|
||||
//=
|
||||
int freeFunction();
|
||||
|
@ -204,12 +196,9 @@ int freeFunction();
|
|||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
int freeFunction()
|
||||
{
|
||||
return 42;
|
||||
int freeFunction() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
//!TestQualifiedNameToggle
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -218,18 +207,15 @@ fatalerror=true
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int /*$*/A::freefunction/*$$*/()
|
||||
{
|
||||
return 42;
|
||||
int /*$*/A::freefunction/*$$*/() {
|
||||
return 42;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int A::freefunction()
|
||||
{
|
||||
return 42;
|
||||
int A::freefunction() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
//!TestNamespacedFreeFunction
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -241,10 +227,11 @@ filename=A.h
|
|||
#include <iostream>
|
||||
|
||||
namespace N {
|
||||
void /*$*/freefunction/*$$*/()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void /*$*/freefunction/*$$*/() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* A_H_ */
|
||||
|
@ -255,7 +242,9 @@ namespace N {
|
|||
#include <iostream>
|
||||
|
||||
namespace N {
|
||||
void freefunction();
|
||||
|
||||
void freefunction();
|
||||
|
||||
}
|
||||
|
||||
#endif /* A_H_ */
|
||||
|
@ -263,21 +252,20 @@ namespace N {
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace N
|
||||
{
|
||||
void freefunction()
|
||||
{
|
||||
return;
|
||||
}
|
||||
namespace N {
|
||||
|
||||
void freefunction() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,24 +7,28 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void /*$*/foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
class A {
|
||||
void /*$*/foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
inline void A::foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
inline void A::foo() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
//!TestSimpleNamespaceInHeaderToImplementationWithinNSDefinition
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -35,42 +39,45 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
inline void A::/*$*/foo/*$$*/()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
inline void A::/*$*/foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
}
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace N
|
||||
{
|
||||
void A::foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
namespace N {
|
||||
|
||||
void A::foo() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -83,13 +90,14 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
inline void A::/*$*/foo/*$$*/()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
inline void A::/*$*/foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
//=
|
||||
|
@ -97,34 +105,33 @@ namespace N {
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
}
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace N
|
||||
{
|
||||
namespace N {
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace N
|
||||
{
|
||||
void A::foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
namespace N {
|
||||
|
||||
void A::foo() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//!TestSimpleNamespaceInHeaderToImplementationWithNamespaceQualifiedName
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -135,23 +142,26 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
inline void /*$*/N::A::foo/*$$*/()
|
||||
{
|
||||
return;
|
||||
inline void /*$*/N::A::foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,21 +169,20 @@ namespace N {
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace N
|
||||
{
|
||||
void A::foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
namespace N {
|
||||
|
||||
void A::foo() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -184,42 +193,42 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
void /*$*/N::A::foo/*$$*/()
|
||||
{
|
||||
return;
|
||||
void /*$*/N::A::foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//@A.h
|
||||
#include <iostream>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
//!TestRemoveEmptyNamespaceFromImplentation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -229,10 +238,11 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
namespace N {
|
||||
void /*$*/A::foo/*$$*/()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void /*$*/A::foo/*$$*/() {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
@ -242,18 +252,21 @@ namespace N {
|
|||
#include <iostream>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
class A {
|
||||
void foo();
|
||||
};
|
||||
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
namespace N {
|
||||
class A {
|
||||
void foo()
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class A {
|
||||
void foo() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,27 +6,25 @@ filename=A.h
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
class B {
|
||||
void /*$*/member/*$$*/(int a, int b) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
class B {
|
||||
void /*$*/member/*$$*/(int a, int b) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
};
|
||||
|
||||
inline void A::B::member(int a, int b)
|
||||
{
|
||||
return;
|
||||
inline void A::B::member(int a, int b) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestNestedClassInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -35,46 +33,41 @@ filename=A.h
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
};
|
||||
|
||||
inline void A::B::/*$*/member/*$$*/(int a, int b)
|
||||
{
|
||||
return;
|
||||
inline void A::B::/*$*/member/*$$*/(int a, int b) {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void A::B::member(int a, int b)
|
||||
{
|
||||
return;
|
||||
void A::B::member(int a, int b) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestNestedClassInImplementationToClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -82,21 +75,18 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void A::B::/*$*/member/*$$*/(int a, int b)
|
||||
{
|
||||
return;
|
||||
void A::B::/*$*/member/*$$*/(int a, int b) {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,18 +94,17 @@ int main()
|
|||
#include <iostream>
|
||||
|
||||
class A {
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
class B {
|
||||
void member(int a, int b);
|
||||
};
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
class B {
|
||||
void member(int a, int b)
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
class B {
|
||||
void member(int a, int b) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -7,46 +7,38 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void /*$*/func2/*$$*/()
|
||||
{
|
||||
}
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void /*$*/func2/*$$*/() {
|
||||
}
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
inline void A::func1()
|
||||
{
|
||||
inline void A::func1() {
|
||||
}
|
||||
|
||||
inline void A::func3()
|
||||
{
|
||||
inline void A::func3() {
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
inline void A::func1()
|
||||
{
|
||||
inline void A::func1() {
|
||||
}
|
||||
|
||||
inline void A::func2()
|
||||
{
|
||||
inline void A::func2() {
|
||||
}
|
||||
|
||||
inline void A::func3()
|
||||
{
|
||||
inline void A::func3() {
|
||||
}
|
||||
//!TestCorrectOrderingInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -57,17 +49,15 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
inline void A::/*$*/func2/*$$*/()
|
||||
{
|
||||
return;
|
||||
inline void A::/*$*/func2/*$$*/() {
|
||||
return;
|
||||
}
|
||||
|
||||
//=
|
||||
|
@ -75,12 +65,11 @@ inline void A::/*$*/func2/*$$*/()
|
|||
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -88,41 +77,34 @@ public:
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void A::func1()
|
||||
{
|
||||
return;
|
||||
void A::func1() {
|
||||
return;
|
||||
}
|
||||
|
||||
void A::func3()
|
||||
{
|
||||
return;
|
||||
void A::func3() {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void A::func1()
|
||||
{
|
||||
return;
|
||||
void A::func1() {
|
||||
return;
|
||||
}
|
||||
|
||||
void A::func2()
|
||||
{
|
||||
return;
|
||||
void A::func2() {
|
||||
return;
|
||||
}
|
||||
|
||||
void A::func3()
|
||||
{
|
||||
return;
|
||||
void A::func3() {
|
||||
return;
|
||||
}
|
||||
//!TestCorrectTemplateOrderingInClassToInHeader
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -134,21 +116,20 @@ filename=A.h
|
|||
template <typename T>
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void /*$*/func2/*$$*/()
|
||||
{
|
||||
}
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void /*$*/func2/*$$*/() {
|
||||
}
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> inline void A<T>::func1()
|
||||
{
|
||||
template<typename T>
|
||||
inline void A<T>::func1() {
|
||||
}
|
||||
template<typename T> inline void A<T>::func3()
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
inline void A<T>::func3() {
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
@ -156,23 +137,23 @@ template<typename T> inline void A<T>::func3()
|
|||
template <typename T>
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> inline void A<T>::func1()
|
||||
{
|
||||
}
|
||||
template<typename T> inline void A<T>::func2()
|
||||
{
|
||||
template<typename T>
|
||||
inline void A<T>::func1() {
|
||||
}
|
||||
|
||||
template<typename T> inline void A<T>::func3()
|
||||
{
|
||||
template<typename T>
|
||||
inline void A<T>::func2() {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void A<T>::func3() {
|
||||
}
|
||||
//!TestCorrectTemplateOrderingInHeaderToInClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -184,22 +165,23 @@ filename=A.h
|
|||
template <typename T>
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void func2();
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> inline void A<T>::func1()
|
||||
{
|
||||
template<typename T>
|
||||
inline void A<T>::func1() {
|
||||
}
|
||||
template<typename T> inline void A<T>::/*$*/func2/*$$*/()
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
inline void A<T>::/*$*/func2/*$$*/() {
|
||||
}
|
||||
template<typename T> inline void A<T>::func3()
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
inline void A<T>::func3() {
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
@ -207,20 +189,20 @@ template<typename T> inline void A<T>::func3()
|
|||
template <typename T>
|
||||
class A {
|
||||
public:
|
||||
void func1();
|
||||
void func2()
|
||||
{
|
||||
}
|
||||
void func3();
|
||||
void func4()
|
||||
{
|
||||
}
|
||||
void func1();
|
||||
void func2() {
|
||||
}
|
||||
void func3();
|
||||
void func4() {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> inline void A<T>::func1()
|
||||
{
|
||||
template<typename T>
|
||||
inline void A<T>::func1() {
|
||||
}
|
||||
|
||||
template<typename T> inline void A<T>::func3()
|
||||
{
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline void A<T>::func3() {
|
||||
}
|
||||
|
|
|
@ -4,153 +4,132 @@
|
|||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void me/*$*//*$$*/mber()
|
||||
{
|
||||
return;
|
||||
}
|
||||
void me/*$*//*$$*/mber() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestSubstringSelection
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void m/*$*/e/*$$*/mber()
|
||||
{
|
||||
return;
|
||||
}
|
||||
void m/*$*/e/*$$*/mber() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestBodySelection
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void member()
|
||||
{
|
||||
r/*$*//*$$*/eturn;
|
||||
}
|
||||
void member() {
|
||||
r/*$*//*$$*/eturn;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestBodySelectionWithConfusingName
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void member()
|
||||
{
|
||||
int /*$*/abcd/*$$*/ = 42;
|
||||
return;
|
||||
}
|
||||
void member() {
|
||||
int /*$*/abcd/*$$*/ = 42;
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
int abcd = 42;
|
||||
return;
|
||||
inline void A::member() {
|
||||
int abcd = 42;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestLeftBorderSelection
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
/*$*//*$$*/void member()
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*$*//*$$*/void member() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestRightBorderSelection
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
void member()
|
||||
{
|
||||
return;
|
||||
}/*$*//*$$*/
|
||||
void member() {
|
||||
return;
|
||||
}/*$*//*$$*/
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestOverlappingSelection
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
vo/*$*/id member()
|
||||
{
|
||||
ret/*$$*/urn;
|
||||
}
|
||||
vo/*$*/id member() {
|
||||
ret/*$$*/urn;
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
|
||||
inline void A::member()
|
||||
{
|
||||
return;
|
||||
inline void A::member() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,29 +7,28 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
public:
|
||||
int /*$*/function/*$$*/()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int /*$*/function/*$$*/() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
int a;
|
||||
int a;
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
public:
|
||||
int function();
|
||||
int function();
|
||||
|
||||
private:
|
||||
int a;
|
||||
int a;
|
||||
};
|
||||
|
||||
inline int A::function()
|
||||
{
|
||||
return 0;
|
||||
inline int A::function() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//!TestSimpleFunctionInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -39,23 +38,24 @@ filename=A.h
|
|||
|
||||
class A {
|
||||
public:
|
||||
int function();
|
||||
int function();
|
||||
|
||||
private:
|
||||
int a;
|
||||
int a;
|
||||
};
|
||||
|
||||
inline int A::/*$*/function/*$$*/()
|
||||
{
|
||||
return 0;
|
||||
inline int A::/*$*/function/*$$*/() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
public:
|
||||
int function();
|
||||
int function();
|
||||
|
||||
private:
|
||||
int a;
|
||||
int a;
|
||||
};
|
||||
|
||||
|
||||
|
@ -63,21 +63,19 @@ private:
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int A::function()
|
||||
{
|
||||
return 0;
|
||||
int A::function() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//!TestSimpleFunctionInImplementationToInClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -85,44 +83,42 @@ filename=A.cpp
|
|||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int A::/*$*/function/*$$*/()
|
||||
{
|
||||
return 0;
|
||||
int A::/*$*/function/*$$*/() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//@A.h
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
public:
|
||||
int function();
|
||||
int function();
|
||||
|
||||
private:
|
||||
int a;
|
||||
int a;
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
public:
|
||||
int function()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int function() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
int a;
|
||||
int a;
|
||||
};
|
||||
//!TestDifferentParameterNames
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -131,36 +127,35 @@ filename=MyClass.cpp
|
|||
//@MyClass.cpp
|
||||
#include "MyClass.h"
|
||||
|
||||
myClass::/*$*/myClass/*$$*/(int implname) : fVal(implname) {}
|
||||
myClass::/*$*/myClass/*$$*/(int implname) :
|
||||
fVal(implname) {
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "MyClass.h"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//@MyClass.h
|
||||
|
||||
struct myClass {
|
||||
int fVal;
|
||||
myClass(int headername);
|
||||
int fVal;
|
||||
myClass(int headername);
|
||||
};
|
||||
|
||||
//=
|
||||
|
||||
struct myClass {
|
||||
int fVal;
|
||||
myClass(int implname)
|
||||
:fVal(implname)
|
||||
{
|
||||
}
|
||||
int fVal;
|
||||
myClass(int implname) :
|
||||
fVal(implname) {
|
||||
}
|
||||
};
|
||||
|
||||
//!TestMissingParameterNames
|
||||
|
@ -170,35 +165,34 @@ filename=MyClass.cpp
|
|||
//@MyClass.cpp
|
||||
#include "MyClass.h"
|
||||
|
||||
myClass::/*$*/myClass/*$$*/(int implname) : fVal(implname) {}
|
||||
myClass::/*$*/myClass/*$$*/(int implname) :
|
||||
fVal(implname) {
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "MyClass.h"
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//@MyClass.h
|
||||
|
||||
struct myClass {
|
||||
int fVal;
|
||||
myClass(int);
|
||||
int fVal;
|
||||
myClass(int);
|
||||
};
|
||||
|
||||
//=
|
||||
|
||||
struct myClass {
|
||||
int fVal;
|
||||
myClass(int implname)
|
||||
:fVal(implname)
|
||||
{
|
||||
}
|
||||
int fVal;
|
||||
myClass(int implname) :
|
||||
fVal(implname) {
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -7,29 +7,27 @@ filename=A.h
|
|||
|
||||
template <typename T, typename U>
|
||||
class A {
|
||||
class B {
|
||||
T /*$*/member/*$$*/()
|
||||
{
|
||||
return T();
|
||||
}
|
||||
};
|
||||
class B {
|
||||
T /*$*/member/*$$*/() {
|
||||
return T();
|
||||
}
|
||||
};
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
template <typename T, typename U>
|
||||
class A {
|
||||
class B {
|
||||
T member();
|
||||
};
|
||||
class B {
|
||||
T member();
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T, typename U> inline T A<T,U>::B::member()
|
||||
{
|
||||
return T();
|
||||
template<typename T, typename U>
|
||||
inline T A<T, U>::B::member() {
|
||||
return T();
|
||||
}
|
||||
|
||||
|
||||
//!TestTemplateFunctionInHeaderToInClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -39,28 +37,25 @@ filename=A.h
|
|||
|
||||
template <typename T>
|
||||
class A {
|
||||
class B {
|
||||
T member();
|
||||
};
|
||||
|
||||
class B {
|
||||
T member();
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T> inline T A<T>::B::/*$*/member/*$$*/()
|
||||
{
|
||||
return T();
|
||||
template<typename T>
|
||||
inline T A<T>::B::/*$*/member/*$$*/() {
|
||||
return T();
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
template <typename T>
|
||||
class A {
|
||||
class B {
|
||||
T member()
|
||||
{
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
class B {
|
||||
T member() {
|
||||
return T();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
@ -70,85 +65,76 @@ class A {
|
|||
filename=A.h
|
||||
//@A.h
|
||||
class A {
|
||||
tem/*$*/plate/*$$*/<typename T>
|
||||
T foo() {
|
||||
return T();
|
||||
}
|
||||
tem/*$*/plate/*$$*/<typename T>
|
||||
T foo() {
|
||||
return T();
|
||||
}
|
||||
};
|
||||
//=
|
||||
class A {
|
||||
template<typename T>
|
||||
T foo();
|
||||
template<typename T>
|
||||
T foo();
|
||||
|
||||
};
|
||||
|
||||
template<typename T> inline T A::foo()
|
||||
{
|
||||
return T();
|
||||
template<typename T>
|
||||
inline T A::foo() {
|
||||
return T();
|
||||
}
|
||||
|
||||
|
||||
//!TestComplexTemplateFunctionFromInClassToInheader
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
template<typename T, typename S>
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
template<typename U, typename V>
|
||||
void /*$*/foo/*$$*/(const U & u, const V &v)
|
||||
{
|
||||
return;
|
||||
}
|
||||
template<typename U, typename V>
|
||||
void /*$*/foo/*$$*/(const U& u, const V& v) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
template<typename T, typename S>
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
template<typename U, typename V>
|
||||
void foo(const U & u, const V &v);
|
||||
template<typename U, typename V>
|
||||
void foo(const U& u, const V& v);
|
||||
|
||||
};
|
||||
|
||||
template<typename T, typename S> template<typename U, typename V> inline void A<T,S>::foo(const U & u, const V & v)
|
||||
{
|
||||
return;
|
||||
template<typename T, typename S>
|
||||
template<typename U, typename V>
|
||||
inline void A<T, S>::foo(const U& u, const V& v) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestComplexTemplateFunctionFromInHeaderToInClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
filename=A.h
|
||||
//@A.h
|
||||
template<typename T, typename S>
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
template<typename U, typename V>
|
||||
void /*$*/foo/*$$*/(const U & u, const V &v);
|
||||
|
||||
template<typename U, typename V>
|
||||
void /*$*/foo/*$$*/(const U& u, const V& v);
|
||||
};
|
||||
|
||||
template<typename T, typename S> template<typename U, typename V> inline void A<T,S>::foo(const U & u, const V & v)
|
||||
{
|
||||
return;
|
||||
template<typename T, typename S>
|
||||
template<typename U, typename V>
|
||||
inline void A<T,S>::foo(const U& u, const V& v) {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
template<typename T, typename S>
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
template<typename U, typename V>
|
||||
void foo(const U & u, const V &v)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
template<typename U, typename V>
|
||||
void foo(const U& u, const V& v) {
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -7,33 +7,30 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
class A {
|
||||
void /*$*/member/*$$*/(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
} catch (std::exception & e1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void /*$*/member/*$$*/(int a, int b)
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch (std::exception& e1){
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
class A {
|
||||
void member(int a, int b);
|
||||
void member(int a, int b);
|
||||
};
|
||||
|
||||
inline void A::member(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestTryCatchFromInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -43,23 +40,22 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
class A {
|
||||
void member(int a, int b);
|
||||
void member(int a, int b);
|
||||
};
|
||||
|
||||
inline void /*$*/A::member/*$$*/(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
class A {
|
||||
void member(int a, int b);
|
||||
void member(int a, int b);
|
||||
};
|
||||
|
||||
|
||||
|
@ -67,25 +63,23 @@ class A {
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void A::member(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestTryCatchFromInImplementationToClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -95,18 +89,15 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
void A::/*$*/member/*$$*/()
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1)
|
||||
{
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include <exception>
|
||||
|
@ -114,28 +105,26 @@ int main()
|
|||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//@A.h
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member()
|
||||
try
|
||||
{
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
}
|
||||
void member()
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//!TestMultipleTryCatchFromInClassToInHeader
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
|
@ -146,39 +135,36 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
class A {
|
||||
void /*$*/member/*$$*/(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
} catch (std::exception & e1)
|
||||
{
|
||||
return;
|
||||
} catch (std::exception & e2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void /*$*/member/*$$*/(int a, int b)
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
catch (std::exception& e2) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
class A {
|
||||
void member(int a, int b);
|
||||
void member(int a, int b);
|
||||
};
|
||||
|
||||
inline void A::member(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e2){
|
||||
return;
|
||||
catch (std::exception& e2) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestMultipleTryCatchFromInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -188,26 +174,25 @@ filename=A.h
|
|||
#include <exception>
|
||||
|
||||
class A {
|
||||
void member(int a, int b);
|
||||
void member(int a, int b);
|
||||
};
|
||||
|
||||
inline void /*$*/A::member/*$$*/(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e2){
|
||||
return;
|
||||
catch (std::exception& e2) {
|
||||
return;
|
||||
}
|
||||
//=
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
class A {
|
||||
void member(int a, int b);
|
||||
void member(int a, int b);
|
||||
};
|
||||
|
||||
|
||||
|
@ -215,28 +200,26 @@ class A {
|
|||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void A::member(int a, int b)
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e2){
|
||||
return;
|
||||
catch (std::exception& e2) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//!TestMultipleTryCatchFromInImplementationToClass
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -246,22 +229,18 @@ filename=A.cpp
|
|||
#include "A.h"
|
||||
|
||||
void A::/*$*/member/*$$*/()
|
||||
try
|
||||
{
|
||||
return;
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1)
|
||||
{
|
||||
return;
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e2)
|
||||
{
|
||||
return;
|
||||
catch (std::exception& e2) {
|
||||
return;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include <exception>
|
||||
|
@ -269,29 +248,27 @@ int main()
|
|||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//@A.h
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member();
|
||||
void member();
|
||||
};
|
||||
//=
|
||||
#include <iostream>
|
||||
|
||||
class A {
|
||||
void member()
|
||||
try
|
||||
{
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e1){
|
||||
return;
|
||||
}
|
||||
catch(std::exception & e2){
|
||||
return;
|
||||
}
|
||||
void member()
|
||||
try {
|
||||
return;
|
||||
}
|
||||
catch (std::exception& e1) {
|
||||
return;
|
||||
}
|
||||
catch (std::exception& e2) {
|
||||
return;
|
||||
}
|
||||
};
|
|
@ -5,23 +5,20 @@ filename=A.h
|
|||
//@A.h
|
||||
|
||||
class A {
|
||||
virtual int /*$*/foo/*$$*/()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int /*$*/foo/*$$*/() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
//=
|
||||
|
||||
class A {
|
||||
virtual int foo();
|
||||
virtual int foo();
|
||||
};
|
||||
|
||||
inline int A::foo()
|
||||
{
|
||||
return 0;
|
||||
inline int A::foo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//!TestVirtualSpecifierFromInHeaderToImplementation
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//%CPP
|
||||
|
@ -30,41 +27,36 @@ filename=A.h
|
|||
//@A.h
|
||||
|
||||
class A {
|
||||
virtual int /*$*/foo/*$$*/();
|
||||
virtual int /*$*/foo/*$$*/();
|
||||
};
|
||||
|
||||
inline int A::foo()
|
||||
{
|
||||
return 0;
|
||||
inline int A::foo() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
|
||||
class A {
|
||||
virtual int foo();
|
||||
virtual int foo();
|
||||
};
|
||||
|
||||
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return 0;
|
||||
int A::foo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//!TestVirtualSpecifierFromImplementationToHeader
|
||||
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
|
||||
//@.config
|
||||
|
@ -72,34 +64,30 @@ filename=A.h
|
|||
//@A.h
|
||||
|
||||
class A {
|
||||
virtual int /*$*/foo/*$$*/();
|
||||
virtual int /*$*/foo/*$$*/();
|
||||
};
|
||||
//=
|
||||
|
||||
class A {
|
||||
virtual int foo()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual int foo() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
//@A.cpp
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int A::foo()
|
||||
{
|
||||
return 0;
|
||||
int A::foo() {
|
||||
return 0;
|
||||
}
|
||||
//=
|
||||
#include "A.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ offset=27
|
|||
#ifndef A_H_
|
||||
#define A_H_
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
void foo();
|
||||
|
@ -25,8 +24,7 @@ offset=0
|
|||
//@A.h
|
||||
typedef int nummere;
|
||||
|
||||
class A
|
||||
{
|
||||
class A {
|
||||
public:
|
||||
A();
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ExtractFunctionTestSuite extends TestSuite {
|
|||
suite.addTest(RefactoringTester.suite("ExtractMethodPreprocessorRefactoringTests", "resources/refactoring/ExtractMethodPreprocessor.rts"));
|
||||
suite.addTest(RefactoringTester.suite("Extract Function Templates Tests", "resources/refactoring/ExtractFunctionTemplates.rts"));
|
||||
suite.addTest(RefactoringTester.suite("Extract Method History Test", "resources/refactoring/ExtractMethodHistory.rts"));
|
||||
suite.addTest(RefactoringTester.suite("Extract Function Dublicates Test", "resources/refactoring/ExtractMethodDuplicates.rts"));
|
||||
suite.addTest(RefactoringTester.suite("Extract Function Duplicates Test", "resources/refactoring/ExtractMethodDuplicates.rts"));
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -885,7 +885,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
|||
arguments.put(CRefactoringDescription.SELECTION, region.getOffset() + "," + region.getLength()); //$NON-NLS-1$
|
||||
arguments.put(ExtractFunctionRefactoringDescription.NAME, info.getMethodName());
|
||||
arguments.put(ExtractFunctionRefactoringDescription.VISIBILITY, info.getVisibility().toString());
|
||||
arguments.put(ExtractFunctionRefactoringDescription.REPLACE_DUBLICATES, Boolean.toString(info.isReplaceDuplicates()));
|
||||
arguments.put(ExtractFunctionRefactoringDescription.REPLACE_DUPLICATES, Boolean.toString(info.isReplaceDuplicates()));
|
||||
return arguments;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum;
|
|||
public class ExtractFunctionRefactoringDescription extends CRefactoringDescription {
|
||||
protected static final String NAME = "name"; //$NON-NLS-1$
|
||||
protected static final String VISIBILITY = "visibility"; //$NON-NLS-1$
|
||||
protected static final String REPLACE_DUBLICATES = "replaceDuplicates"; //$NON-NLS-1$
|
||||
protected static final String REPLACE_DUPLICATES = "replaceDuplicates"; //$NON-NLS-1$
|
||||
|
||||
public ExtractFunctionRefactoringDescription(String project, String description,
|
||||
String comment, Map<String, String> arguments) {
|
||||
|
@ -47,7 +47,7 @@ public class ExtractFunctionRefactoringDescription extends CRefactoringDescripti
|
|||
|
||||
info.setMethodName(arguments.get(NAME));
|
||||
info.setVisibility(VisibilityEnum.getEnumForStringRepresentation(arguments.get(VISIBILITY)));
|
||||
info.setReplaceDuplicates(Boolean.parseBoolean(arguments.get(REPLACE_DUBLICATES)));
|
||||
info.setReplaceDuplicates(Boolean.parseBoolean(arguments.get(REPLACE_DUPLICATES)));
|
||||
|
||||
proj = getCProject();
|
||||
file = getFile();
|
||||
|
|
Loading…
Add table
Reference in a new issue