Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 1724: refactor rename misses occurrences
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SamHocevar
Junior Member

France
15 Posts

Posted - Jun 25 2009 :  06:51:33 AM  Show Profile  Reply with Quote
VAX doesn't seem to properly refactor the following code, where two loop variables have been mistakenly given the same name, causing no bug because their scopes are properly nested, but being still bad style:
#include <iostream>

int main(void)
{
    for(int i = 0; i < 10; i++)
    {
        std::cout << "Outer loop " << i << "\\n";

        for (int i = 0; i < 5; i++)
            std::cout << "  Inner loop " << i << "\\n";
    }
}


1) Renaming the first "i" by right-clicking on one of its occurrences in the first "for" loop causes it to miss the one in the following std::cout line.

2) Renaming the first "i" by right-clicking in the first std::cout line causes it to miss the ones in the first "for" block and attempt to rename the ones in the second "for" block, despite them having a different scope.

3) Renaming the second "i" (using any occurrence of it) causes it to wrongly suggest the occurrence in the first std::cout line.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 25 2009 :  4:35:42 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=3414
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000