ek9_inline_function

Replaces every call to a FUNCTION or METHOD with its parameter-substituted body and deletes the declaration; answers status, edits[] (one REPLACE per call site + the DELETE) and conflicts[] (kind 'variable-clash' with {name, suggestedName}).

Category: Editor · Compare: Refactor → Inline Function (IntelliJ) / LSP Inline Function

When to use it

'Inline the function formatLabel everywhere' is one call with symbol:'formatLabel' - no file or line needed. Use it on a trivial FUNCTION or METHOD ('Type.method') whose name no longer earns its abstraction.

When not to use it

Details

scope: all-call-sites (default; inline everywhere then delete decl) | single-call-site (requires callSiteFile/Line, callSiteColumn defaults to 1; decl kept). An expression-bodied function (name() <- rtn as T: EXPR) inlines at any call context; a multi-statement body inlines only where the call is the whole statement (bare, or RHS of <- / :=), its rtn mapping to the assignment target. A donor-local clash returns conflicts kind 'variable-clash' with clashes[] of {name, suggestedName} — rename via ek9_rename_symbol then re-run (the tool never auto-renames); recursion, dispatcher/override, this/field capture, named arguments and discarded return refuse cleanly as other conflict kinds, and anything subtler (e.g. an E08130 purity violation) surfaces as would-fail — never silent broken source.

Arguments

ArgumentTypeRequiredWhat it is
callSiteobjectsingle-call-site only: {file, line} of the ONE call to inline - the function's name on that line is found for you; column (0-based, an IDE cursor) is optional. The flat callSiteFile / callSiteLine / callSiteColumn (1-based) are the IDE form of the same thing.
callSiteColumnintegerIDE form - column (1-based) on the call name; the name is found on the line when omitted.
callSiteFilestringIDE form of callSite.file - workspace-relative file of the target call.
callSiteLineintegerIDE form of callSite.line - line (1-based) of the target call.
filestringThe EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site.
lineinteger1-based line of the declaration or a reference - OMIT it and pass symbol:'<name>' to let the tool find the line (a model counting lines in a file miscounts); if you do count, use ek9_read_file(lineNumbers:true).
scopestring: all-call-sites | single-call-siteall-call-sites (default): inline every call (via the Phase-5 call graph, across files) and remove the declaration. single-call-site: inline just the call at callSite:{file, line} and keep the declaration.
symbolstringA construct NAME alone ('Shape', 'sample.deps.core::Validator') - no file needed, the tool finds it workspace-wide; or, with file (+ line), the identifier you mean there.

It also takes the arguments every tool takes.

See also