ek9_query_name_clashes
Answers first: status, name, fullyQualifiedName, clashFree, donorLocals, renames (one globally-safe fresh name per clashing local), callSiteCount, then callSites[] with per-site clashes and the summary line.
When to use it
'Which of this callable's locals would collide if it were inlined at its call sites' is one call with symbol:'Type.method' - no file or line needed.
When not to use it
- performing the inline itself (use
ek9_inline_function) - applying a reported rename (use
ek9_rename_symbolon each donor local's declaration, then inline) - renaming a symbol and all its references generally, not a capture pre-check (use
ek9_rename_symbol)
Details
Reports name/kind/fullyQualifiedName, donorLocals (names the body declares), per-site clashes each with a suggestedName, an aggregated 'renames' union whose one rename per donor local is safe at every clashing site at once, and a clashFree flag. Expression-bodied operations declare no locals and are always clashFree; recursive targets report self-call sites as skipped under 'notes'. scope is inferred: callSiteFile+callSiteLine present = single-call-site, else all-call-sites (via the Phase-5 call graph, across files). Shares the NameClashDetector primitive that raises ek9_inline_function's variable-clash conflict.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
callSiteColumn | integer | single-call-site only — 1-based column on the call name (an IDE cursor); omit it and the first call on the line is taken. | |
callSiteFile | string | single-call-site only — workspace-relative file of the target call. | |
callSiteLine | integer | single-call-site only — line (1-based) of the target call. | |
file | string | The EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site. | |
line | integer | 1-based line of the declaration header - OMIT it and pass symbol:'Type.method' to let the tool find the line (a model counting lines miscounts). | |
scope | string: all-call-sites | single-call-site | Optional - inferred from the arguments: callSiteFile+callSiteLine present = single-call-site (just that call, no call graph needed), else all-call-sites (every call site via the Phase-5 call graph, across files). | |
symbol | string | A 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.
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it. 3 of the 5 recorded are shown.
Uncalled no call sites
Request
{
"file" : "main.ek9",
"line" : 13
}
Response
{
"callSiteCount" : 0,
"callSites" : [ ],
"clashFree" : true,
"donorLocals" : [ ],
"fullyQualifiedName" : "test.clash::unused",
"kind" : "function",
"meta" : {
"serverMs" : "<timing>"
},
"name" : "unused",
"renames" : [ ],
"scope" : "all-call-sites",
"status" : "ok",
"summary" : "'unused' has no call sites — nothing to splice, no clashes possible."
}
Expression bodied clash free
Request
{
"file" : "main.ek9",
"line" : 5
}
Response
{
"callSiteCount" : 1,
"callSites" : [ {
"clashes" : [ ],
"column" : 12,
"file" : "main.ek9",
"inConstruct" : "Main",
"line" : 20
} ],
"clashFree" : true,
"donorLocals" : [ ],
"fullyQualifiedName" : "test.clash::twice",
"kind" : "function",
"meta" : {
"serverMs" : "<timing>"
},
"name" : "twice",
"renames" : [ ],
"scope" : "all-call-sites",
"status" : "ok",
"summary" : "No name clashes — 'twice' can be inlined at 1 call site without renaming."
}
Single call site
Request
{
"callSiteFile" : "main.ek9",
"callSiteLine" : 21,
"file" : "main.ek9",
"line" : 8,
"scope" : "single-call-site"
}
Response
{
"callSiteCount" : 1,
"callSites" : [ {
"clashes" : [ {
"name" : "doubled",
"suggestedName" : "doubled2"
} ],
"column" : 1,
"file" : "main.ek9",
"inConstruct" : "Main",
"line" : 21
} ],
"clashFree" : false,
"donorLocals" : [ "doubled" ],
"fullyQualifiedName" : "test.clash::calc",
"kind" : "function",
"meta" : {
"serverMs" : "<timing>"
},
"name" : "calc",
"renames" : [ {
"name" : "doubled",
"suggestedName" : "doubled2"
} ],
...
Cut short here: 4 more lines. The whole recorded call.