14.3. Automated refactoring tools

The REFACTOR module implements automated code refactoring transformations. It provides tools for renaming symbols, extracting functions, and other structural code changes that preserve program semantics.

All functions and symbols are in “refactor” module, use require to get access to it.

require daslib/refactor

14.3.1. Function annotations

ExtractMethodMacro

Function annotation implementing extract-method refactoring.

ExtractVariableFunction

Function annotation for extract-variable target functions.

14.3.2. Call macros

extract_variable

Call macro implementing extract-variable refactoring.

14.3.3. Refactoring operations

extract_expression(method_name: string; expr: auto): auto

Marks an expression for expression extraction refactoring.

Arguments:
  • method_name : string

  • expr : auto

extract_method(method_name: string; blk: block<():void>)

Marks a block of code for method extraction refactoring.

Arguments:
  • method_name : string

  • blk : block<void>

extract_variable_nonref(method_name: string; expr: auto): auto

Marks an expression for variable extraction by value.

Arguments:
  • method_name : string

  • expr : auto

extract_variable_ref(method_name: string; expr: auto(TT)& ==const): TT&

Marks an expression for variable extraction by reference.

Arguments:
  • method_name : string

  • expr : auto(TT)&!