Version 1.3

Top  Previous  Next

New Features

Additional parameterization options in Extract method

Gen-Extract Method

 

Bugs Fixed in Extract Method

if selection contained a variable which was a variant array parameter, passed with parentheses, extract method did not produce desirable (or compilable) results. Now it does.
if the selection was part of a function, and the selection contained an assignment to the function name, extract method formerly produced incorrect results. Now it behaves properly, as shown in this example, which utilizes the well-known function factorial, which is typically used to demonstrate recursion. I show the function written below, with the line that really does the work selected (indicated by the green highlighting).

 

recursion1

 

Not that there's a reason to do so in this case, but suppose you wanted to separate out the line that does the work from the rest of the code, which are just guard conditions, really. So you select the code, and attempt to use Extract Method to refactor it into a subroutine called innerCalculation. The results are shown below:

 

innerCalculation

 

Note that innerCalculation correctly calls factorial recursively, not itself (which would result in an infinite loop), and that the refactoring will indeed preserve the behavior of the function correctly.