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:
parent
808f7e43d4
commit
119cb2cfde
2 changed files with 52 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue