Change Method Signature

The change method signature refactoring allows you to add, reorder or remove the arguments of a method. All updates to existing method calls will be automatically performed.

Place the cursor on the desired method, right-click and go to Refactor > Change Method Signature or simply press Shift+Alt+C.

../../_images/vlogdt-right-click-change_method_signature.png

In the Change Method Signature dialog you can modify the method’s name and arguments.

../../_images/vlogdt-dialog-change_method_signature.png

Method name changes are equivalent with Rename Refactoring.

The list of arguments can be manipulated by using the buttons on the right side of the table.

Add: Add a new argument at the end of the list. You will be prompted to provide:
  • the argument type

  • the argument name

  • the actual argument to be used in existing function calls

../../_images/vlogdt-dialog-add-change_method_signature.png

Remove: Remove the selected argument. The selected argument will not be part of the list anymore and will be erased from function calls as well.

Up/Down: Change the position of the selected argument.

Note

The dialog status area presents validation information, such as duplicate parameters, invalid identifier names and duplicate methods.

Click OK to perform the refactoring, or Preview to see the changes that are about to be performed in the source code. In the Preview page you can select the changes that should be performed. After you click Finish the changes are performed, and the project is rebuilt.

../../_images/vlogdt-dialog-preview-change_method_signature.png

Note

This functionality works only for ANSI style methods.

../../_images/vlogdt-dialog-non-ansi-change_method_signature.png

Note

In specific preprocessing scenarios - for example when a method declaration or a method call lies within a macro expansion - the refactoring cannot be automatically carried out. A FIXME comment will be inserted in the relevant code location and will show up in the Tasks View. See Track Tasks using TODO Markers.