mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +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:
parent
808f7e43d4
commit
119cb2cfde
2 changed files with 52 additions and 3 deletions
|
@ -2706,3 +2706,49 @@ int Test::calculateStuff() {
|
||||||
return result;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,9 +207,12 @@ public class NodeContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeclarationInScope() {
|
public boolean isDeclarationInScope() {
|
||||||
int declOffset = declaration.getFileLocation().getNodeOffset();
|
if(declaration.toCharArray().length > 0) {
|
||||||
return declOffset >= getStartOffset()
|
int declOffset = declaration.getFileLocation().getNodeOffset();
|
||||||
&& declOffset <= getEndOffset();
|
return declOffset >= getStartOffset()
|
||||||
|
&& declOffset <= getEndOffset();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue