NameResolver class
Defined in module l0_name_resolver (l0_name_resolver.py).
Stage-1 name resolver for module-level symbols.
This resolver:
- Builds a ModuleEnv for each module in a CompilationUnit.
- Collects top-level symbols (functions, structs, enums, variants, aliases).
- Processes imports by injecting imported symbols into the importer's scope.
- Detects duplicate definitions and import conflicts.
Constructors, destructors, conversion operators
- __init__(self, CompilationUnit cu)
- Initialize the name resolver.
Public functions
Public attributes
Protected functions
- auto _collect_locals(self, ModuleEnv env) -> None
- Collect local symbols from module declarations.
- auto _define_local(self, ModuleEnv env, str name, Symbol sym) -> None
- Define a local symbol, checking for duplicates.
- auto _open_imports(self, ModuleEnv env) -> None
- Process imports for a module environment.
- auto _extern_signatures_compatible(self, Symbol local, Symbol imported) -> bool
- Check if two extern function signatures are compatible.
Function documentation
l0_name_resolver:: NameResolver:: __init__(self,
CompilationUnit cu)
Initialize the name resolver.
| Parameters | |
|---|---|
| cu | The compilation unit to process. |
None l0_name_resolver:: NameResolver:: _collect_locals(self,
ModuleEnv env) protected
Collect local symbols from module declarations.
| Parameters | |
|---|---|
| env | The module environment to populate. |
None l0_name_resolver:: NameResolver:: _define_local(self,
ModuleEnv env,
str name,
Symbol sym) protected
Define a local symbol, checking for duplicates.
| Parameters | |
|---|---|
| env | The environment to define the symbol in. |
| name | The name of the symbol. |
| sym | The Symbol object. |
None l0_name_resolver:: NameResolver:: _open_imports(self,
ModuleEnv env) protected
Process imports for a module environment.
| Parameters | |
|---|---|
| env | The module environment whose imports should be opened. |