class
compiler::ResolveImports
sys::Obj compiler::CompilerSupport compiler::CompilerStep compiler::ResolveImports
ResolveImports maps every Using node in each CompilationUnit to a pod and ensures that it exists and that no imports are duplicated. Then we create a map for all the types which are imported into the CompilationUnit so that the Parser can quickly distinguish between a type identifier and other identifiers. The results of this step populate Using.resolvedXXX and CompilationUnit.importedTypes.
Slots
-
static private Void checkUsingPod(CompilerSupport cs, Str podName, Location loc)
Check that a pod name is in the dependency list.
- makeSource
-
new make(Compiler compiler)
Constructor takes the associated Compiler
-
private Void resolveImportedTypes(CompilationUnit unit)
Create a unified map of type names to CType[] for all the imports in the specified unit (this includes types within the pod being compilied itself). For example if foo::Thing and bar::Thing are imported, then importedTypes would contain
"Thing" : [foo::Thing, bar::Thing]
-
private Void resolveImports(CompilationUnit unit)
Resolve all the imports in the specified unit and ensure there are no duplicates.
- resolvePodSource
-
static CPod? resolvePod(CompilerSupport cs, Str podName, Location location)
Resolve a pod name into its CPod representation. If pod cannot be resolved then log an error and return null.
- resolveQualifiedSource
-
static CType? resolveQualified(CompilerSupport cs, Str podName, Str typeName, Location location)
Resolve a fully qualified type name into its CType representation. This may be a TypeDef within the compilation units or could be an imported type. If the type name cannot be resolved then we log an error and return null.
- resolveSymbolSource
-
static CSymbol? resolveSymbol(CompilerSupport cs, CompilationUnit unit, Str? podName, Str name, Location location)
Resolve a unqualified symbol name using the given unit's imported pod list. If the symbol cannot be resolved log an error and return null.
- resolvedSource
- runSource
-
override Void run()
Overrides compiler::CompilerStep.run
Run the step