1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

FIXED - bug 281564: Extract Function fails when catching an unnamed exception

https://bugs.eclipse.org/bugs/show_bug.cgi?id=281564
This commit is contained in:
Emanuel Graf 2009-06-29 11:33:35 +00:00
parent 808f7e43d4
commit 119cb2cfde
2 changed files with 52 additions and 3 deletions

View file

@ -2706,3 +2706,49 @@ int Test::calculateStuff() {
return result;
}
//!Bug#281564 Extract Function fails when catching an unnamed exception
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=main.cpp
methodname=exp
//@main.cpp
int myFunc() {
return 5;
}
int main() {
int a = 0;
/*$*/try {
a = myFunc();
}
catch(const int & ){
a = 3;
}/*$$*/
return a;
}
//=
int myFunc() {
return 5;
}
void exp(int & a)
{
try {
a = myFunc();
}
catch(const int & ){
a = 3;
}
}
int main() {
int a = 0;
exp(a);
return a;
}

View file

@ -207,9 +207,12 @@ public class NodeContainer {
}
public boolean isDeclarationInScope() {
int declOffset = declaration.getFileLocation().getNodeOffset();
return declOffset >= getStartOffset()
&& declOffset <= getEndOffset();
if(declaration.toCharArray().length > 0) {
int declOffset = declaration.getFileLocation().getNodeOffset();
return declOffset >= getStartOffset()
&& declOffset <= getEndOffset();
}
return true;
}
@Override