mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 486036 - Toggle Function Definition does not work when comment is involved
Change-Id: I77a2c2fe0607ce098da4a4e7679fc3999ea7ebbf Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
This commit is contained in:
parent
dac83cdde6
commit
d537c6030c
2 changed files with 22 additions and 0 deletions
|
@ -3648,4 +3648,22 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
||||||
public void testToggleWithLambdaExpression_518271() throws Exception {
|
public void testToggleWithLambdaExpression_518271() throws Exception {
|
||||||
assertRefactoringSuccess();
|
assertRefactoringSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Test.cpp
|
||||||
|
//class MyClass {
|
||||||
|
// void MyMethod();
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//void MyClass::/*$*/MyMethod/*$$*/() {
|
||||||
|
//// A comment
|
||||||
|
//}
|
||||||
|
//====================
|
||||||
|
//class MyClass {
|
||||||
|
// void MyMethod() {
|
||||||
|
// // A comment
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
public void testToggleWithCommentsInSameFile_486036() throws Exception {
|
||||||
|
assertRefactoringSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,10 @@ public class ToggleFromImplementationToHeaderOrClassStrategy implements IToggleR
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyAllCommentsToNewLocation(IASTNode node, final ASTRewrite oldRw, final ASTRewrite newRw) {
|
private void copyAllCommentsToNewLocation(IASTNode node, final ASTRewrite oldRw, final ASTRewrite newRw) {
|
||||||
|
//Bug 486036: In case oldRw == newRw (same file), there's no need to copy anything, the comments will follow along.
|
||||||
|
if (oldRw == newRw) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
node.accept(new CPPASTAllVisitor() {
|
node.accept(new CPPASTAllVisitor() {
|
||||||
@Override
|
@Override
|
||||||
public int visitAll(IASTNode node){
|
public int visitAll(IASTNode node){
|
||||||
|
|
Loading…
Add table
Reference in a new issue