module volta.postparse.importresolver
Post Parsing Passes

Module containing the ImportResolver class.

Code Map

//! Module containing the ImportResolver class.
module volta.postparse.importresolver;


alias GetMod = ir.Module delegate(ir.QualifiedName);

//! Resolves imports on a single module.
class ImportResolver : ScopeManager, Pass
{
public:
	this(errSink: ErrorSink, getMod: GetMod) { }
	fn transform(m: ir.Module) { }
	fn close() { }
	fn enter(i: ir.Import) Status { }
	//! Takes a import that maps the module to a symbol in the current scope.
	fn handleRebind(i: ir.Import) { }
	//! Handles a import with symbol aliases.
	fn handleAliases(i: ir.Import) { }
	//! Most common imports.
	fn handleRegularAndStatic(i: ir.Import) { }
	//! Used for adding in scopes from static imports
	fn buildOrReturnScope(parent: ir.Scope, node: ir.Node, name: string, lowPriority: bool) ir.Scope { }
}
class ImportResolver : ScopeManager, Pass

Resolves imports on a single module.

fn handleRebind(i: ir.Import)

Takes a import that maps the module to a symbol in the current scope.

import a = b;

fn handleAliases(i: ir.Import)

Handles a import with symbol aliases.

import a : b, c; import a = b : c, d;

fn handleRegularAndStatic(i: ir.Import)

Most common imports.

import a; static import a;

fn buildOrReturnScope(parent: ir.Scope, node: ir.Node, name: string, lowPriority: bool) ir.Scope

Used for adding in scopes from static imports

If scope of name exists in parent, that will be used. Otherwise one will be created, see the lowPriority parameter for behaviour when a non-scope store of name already exists in parent.

Parameters

parent

The scope to build in.

node

The node that introduces the new scope.

name

The name of the scope to add.

lowPriority

If true, the scope will not overwrite a non symbol scope that already exists. If false, such a scope existing will be an error.