Skip to main content

Crate wolf_resolve

Crate wolf_resolve 

Source
Expand description

Name resolution (spec chapter 6): modules, imports, visibility, scopes.

Resolution runs in two passes over all modules of a project, together with the std modules:

  1. Collect: the top-level names of every module, the members of types (enum variants and the functions of inherent impl blocks), then the imports and the import graph.
  2. Resolve: every name in types, expressions and patterns, with local scopes.

Section order is layout, not visibility (chapter 2, rule 2.6), which is why the first pass sees the whole project before anything is resolved. The result is a table from syntax nodes to what they name, for the type checker (M4), plus the diagnostics of chapter 6.

Structs§

Def
A declaration.
DefId
Identifies a declaration.
Local
A local variable.
LocalId
Identifies a local variable, parameter or pattern binding.
ModuleId
Identifies a module.
ModuleInfo
Facts about a module after resolution.
ModuleInput
One parsed module given to the resolver.
ProjectInfo
Facts about the project that resolution needs.
Resolved
The result of name resolution.

Enums§

DefKind
The kinds of declarations.
Payload
The payload form of a variant.
Res
What a name in the source refers to.
Role
What a module is for.

Constants§

UNREADABLE
The key of NativeNames for a native module whose file could not be read (E0714): its names are not reported one by one.

Functions§

check_target
E0704 for every module of a build for target that is not available for it. built says which modules the build contains; std modules are always available.
check_vm
E0807 for every module reachable from the modules that root selects that has an extern section or is a native module: the VM runs no code of the targets (spec chapter 10, section 3). help says how to run the program on a target instead.
is_pascal_case
[A-Z][A-Za-z0-9]*
is_snake_case
[a-z][a-z0-9]*(_[a-z0-9]+)*
resolve
Resolves a project. modules must contain the std modules (wolf_std::MODULES, parsed by the caller, with roles Role::Prelude and Role::Std) and every module of the project.
suggest
The closest candidate to name, if it is close enough. Ties go to the alphabetically first. The candidate closest to name, if one is close enough to be a likely typo.

Type Aliases§

NativeNames
The names of native modules that the compiler could not map, with the reason (E0713): by module path (native.slug), then by name.