For a similar example as in the demo
std::vector foo = {1,2,3,4,5};
// |
for (size_t i = 0; i < foo.size(); ++i) {
// \
int bar = 3;
std::cout << foo.at(i) + bar << std::endl;
// \
}
// |
If the region marked with // | is selected and the function is extracted the following correct function is generated:
void baz(std::vector foo) {
for (size_t i = 0; i < foo.size(); ++i) {
int bar = 3;
std::cout << foo.at(i) + bar << std::endl;
}
}
However when I want to extract the inner function (marked with // \) I get
void baz(int bar, std::vector foo) {
int bar = 3;
std::cout << foo.at(i) + bar << std::endl;
}
which includes bar as a parameter although it is defined in the function body.