pub struct Reference {
pub name: String,
pub from: Option<String>,
pub line: usize,
pub kind: RefKind,
pub qualifier: Option<String>,
pub from_scope: FromScope,
}Expand description
A name-based reference (e.g. a call) from within from (the enclosing
function symbol, if any) to name. References are unresolved: they match
by name, not by a resolved definition. This is a heuristic call graph,
suitable for navigation; true name resolution is a later milestone.
Path-agnostic like Symbol; the path comes from assembly.
Fields§
§name: String§from: Option<String>§line: usize§kind: RefKindHow the callee was written at the call site. Defaults to
RefKind::Free and is omitted from the serialized slice when free, so
a file of plain calls keeps the byte-identical slice — and therefore the
same content hash — it had before this field existed.
qualifier: Option<String>The path segment immediately before the callee name at the call site —
Language for Language::from_extension(), b for a::b::c().
Recorded only for path-shaped calls. A method call’s receiver is a
value, not a type, so it is deliberately left None: x says nothing
about which helper is meant, and storing it here would assert
something the graph does not know (#248).
Omitted from the serialized slice when absent, like kind.
from_scope: FromScopeWhat from names — a function, or a module-level binding.
Before #268 from was always a function, and a call at module level
simply had none. A great deal of modern TypeScript lives in module-level
builder objects (a Zod schema, a tRPC router), so those calls reached
neither callers nor impact.
Attributing them to the binding widens what from means, so the scope
travels with it rather than the meaning changing silently: “who calls
this” and “which module-level declaration mentions this” are different
questions and a consumer must be able to tell them apart. Defaults to
Function and is omitted from the serialized
slice then, so a file with no module-level attribution keeps a
byte-identical slice.