Expand description
Inline-function recipe: replace a single-use function’s call site with its body.
Steps:
- Locate the function definition at the given position (line:col may point to the function name in the definition or in a call site)
- Find all call sites of this function within the same file (name-match)
- Verify the function is called exactly once (or
--forceto override) - Substitute arguments for parameters throughout the body
- Replace the call expression with the inlined body
- Remove the function definition
Supported languages: JavaScript, TypeScript (function declarations,
arrow-function const bindings). Python (def) and Rust (fn) are
structurally similar but less tested.
Conservative: aborts rather than generating broken code.
- Multiple
returnstatements → error - Non-trivial control flow → error
- Grammar unavailable → error
Structs§
- Inline
Function Outcome - Outcome details for a planned inline-function operation.
Functions§
- plan_
inline_ function - Build an inline-function plan without touching the filesystem.