Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Extract method refactoring could be smarter

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
TomatoUser Posted - Nov 29 2011 : 10:13:13 PM
The extract method refactoring isn't as smart as I think it should be. Specifically, it tends to make variables as parameters that are only used within the code of the extraction and therefore should be automatically made local variables to the extracted method.
3   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Dec 02 2011 : 6:44:27 PM
Yes, indeed we have to be careful implementing this. e.g. initialization may use an other local variable that is used outside the selection...
TomatoUser Posted - Dec 01 2011 : 6:02:35 PM
Basically. Though, after posting this, I did think of something. And that is, I've done a lot more Delphi (Pascal) over the last few years. In Pascal, the variable declarations have to be at the top, like old-style C. So, basically, the Pascal refactor engine knows where to look for the variable declaration and if the variable isn't used anywhere outside of the extraction, it moves the variable declaration. In C++, variables don't have to be declared at the top, and could include an initialization in the declaration. So, the equivalent C++ refactor engine, to do the same, would have to be a bit smarter. But presumably could be done.
accord Posted - Nov 30 2011 : 5:43:02 PM
Sensible suggestion! I have put in an enhancement request to see what the developers make of it:

case=63055

Just to double check did you mean the following case? (extremely simplified snippet)


© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000