pub struct Reference {
pub name: String,
pub kind: ReferenceKind,
}Expand description
A reference to a name, and what kind of name it is.
The kind is the point. canonical::ExpressionKind distinguishes a local, a
top-level, an imported name and a constructor, and those are four different things to
emit — a parameter, a binding in this module’s scope, a named import, an object with
a $ field. The spelling left behind once they are flattened to a string is
qualified for some of them and not others, so the distinction cannot be recovered
afterwards.
Fields§
§name: StringThe spelling inference looks the name up by.
The typer’s environment is a HashMap<String, Type> keyed bare for a local and,
for everything else, by the declaration’s package and qualified name —
test-project:Test.echo — so this is that key and not a display name. A backend
reads kind, which says what the name is.
kind: ReferenceKind