SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: flethuseo on October 12, 2016, 04:05:42 pm

Title: refactoring method to take an expression and extract it to a variable
Post by: flethuseo on October 12, 2016, 04:05:42 pm
I am not sure if there's already a command in Slickedit to do this or not, but I've seen it in other IDEs. It takes an expression determines what it returns and replaces it with a variable. I find this command pretty useful, even if it only does simple expressions like capturing the returned value from a function. As an example:

I have this expression highlighted, and countRows returns an integer I want to replace it with a variable:
return [entity->countRows(constraint);] (highlighted area between brackets)

like so:
int var1 = entity->countRows(constraint);
return var1;