According to the RubberDuck refactoriings page, the definition of the Introduce Parameter refactoring is:
Introduce Parameter
Select a local variable to promote to a parameter. Call sites for the containing procedure will be updated with a
Refactorings · rubberduck-vba/Rubberduck Wiki · GitHubTODO
argument, which must then be specified for all call sites.
I’m a little unsure based on the definition exactly what to expect, but let’s see if we can try it out. I’ll start with a local variable and see if I get a dialog or something.
Putting a variable at the global scope of the class didn’t do anything, so I did some more searching and found a blog article with a definition that is a little more descriptive.
Introduce Parameter/Field
Pretty much the antagonist of move closer to usage, this refactoring promotes a local variable to a parameter or a field, or a parameter to a field; if a new parameter is created, call sites will be updated with a “TODO” bogus argument that leaves the code uncompilable until an argument is supplied for the new parameter at all call sites.
introduce parameter – Rubberduck News (rubberduckvba.blog)
Ok, I have a better idea now. I’ll create a variable in a method scope and try the refactoring on that. We will start with this class module code:
HAL_BasicEncryption
And after doing the refactoring on Dim PassString As String we get:
RubberDuck did not do the TODO comment addition it mentions in it’s documentation, but doing a Debug > Compile will quickly show us the function calls that are not using the new parameter. Let’s see what Introduce Field does instead. I’ll revert the code and we will see what that does.
Introduce Parameter will move a variable local to a method into the method’s parameter list.
Introduce Field will move a variable local to a method into the global scope of the class.