Promoting a Local Variable to be a Parameter of the Current Method

When editing a JADE method, you can promote a local variable to be a parameter of the method.

To promote a local variable to a method parameter

  1. Position the cursor on the name of a local variable (in logic or in the vars section).

  2. Right-click and then select the Promote to Parameter command from the Refactor submenu of the Edit menu.

The local variable is then removed from the local variables (vars) section and added as the last parameter of the method. Any usages of the method must be edited to include the parameter. The signature change does not take effect until you compile the method. To undo the change, press Ctrl+Z.

If you attempt to promote a user identifier to be a method parameter and the identifier is not a local method variable, an error message of the following form is displayed.

Identifier identifier-name is a type-name not a local variable.

For example, if you attempt to promote an existing method parameter called saleItem, the following error message would be displayed.

Identifier saleItem is a method parameter not a local variable.