ModuleManager

Manages loaded modules in various tables.

Constructors

this
this(CompilationContext cc)

Constructs a ModuleManager object.

Members

Functions

addModule
void addModule(Module newModule)

Inserts the given module into the tables.

error
void error(Module modul, MID mid, ...)

Reports an error.

error
void error(Token* locTok, Module modul, MID mid, ...)

Reports an error.

errorModuleNotFound
void errorModuleNotFound(cstring modulePath, Location loc = null)

Reports the error that the module was not found.

findModuleFile
cstring findModuleFile(cstring moduleFQNPath)

Searches for a module in the file system looking in importPaths.

getPackage
Package getPackage(cstring pckgFQN)

Returns the package given a f.q. package name. Returns the root package for an empty string.

insertOrdered
void insertOrdered(Module newModule)

Insert a module into the ordered list.

loadModule
Module loadModule(cstring moduleFQNPath)

Loads a module given an FQN path. Searches import paths.

loadModuleFile
Module loadModuleFile(cstring moduleFilePath)

Loads and parses a module given a file path.

moduleByFQN
Module moduleByFQN(cstring moduleFQNPath)

Looks up a module by its f.q.n. path. E.g.: "dil/ModuleManager"

moduleByPath
Module moduleByPath(cstring moduleFilePath)

Looks up a module by its file path. E.g.: "src/dil/ModuleManager.d" Relative paths are made absolute.

sortPackageTree
void sortPackageTree(Package pckg)

Sorts the the subpackages and submodules of pckg.

sortPackageTree
void sortPackageTree()

Calls sortPackageTree() with this.rootPackage.

splitPackageFQN
void splitPackageFQN(cstring pckgFQN, out cstring prevFQN, out cstring lastName)

Splits e.g. 'dil.ast.xyz' into 'dil.ast' and 'xyz'.

Static functions

absolutePath
cstring absolutePath(cstring path)

Returns a normalized, absolute path.

compareImports
bool compareImports(Module a, Module b)

Compares the number of imports of two modules.

compareSymbolNames
bool compareSymbolNames(Symbol a, Symbol b)

A predicate for sorting symbols in ascending order. Compares symbol names ignoring case.

findModuleFile
cstring findModuleFile(cstring moduleFQNPath, cstring[] importPaths)

Searches for a module in the file system looking in importPaths.

getPackageFQN
char[] getPackageFQN(cstring moduleFQNPath)

Returns e.g. 'dil.ast' for 'dil/ast/Node'.

Variables

absFilePathTable
Module[hash_t] absFilePathTable;

Maps absolute file paths to modules. E.g.: /home/user/dil/src/main.d

cc
CompilationContext cc;

Provides tables and compiler variables.

loadedModules
Module[] loadedModules;

Loaded modules in sequential order.

moduleFQNPathTable
Module[hash_t] moduleFQNPathTable;

Maps FQN paths to modules. E.g.: dil/ast/Node

orderedModules
Module[] orderedModules;

Loaded modules which are ordered according to the number of import statements in each module (ascending order.)

packageTable
Package[hash_t] packageTable;

Maps full package names to packages. E.g.: dil.ast

rootPackage
Package rootPackage;

The root package. Contains all other modules and packages.

Meta