Previously, a ModuleSet wrapped a HashMap<NormalPath, TargetKind>. This had a number of undesirable consequences:
The data about a module's name (as its path) and how it was loaded (as its TargetKind) were split from each other and difficult to reference.
The module's import name wasn't explicitly stored anywhere, so we needed to convert between paths and dotted names when those were needed, which required hitting the disk.
There wasn't a type for the module's import name, so when we (e.g.) :unadded modules we needed to format them as strings.
Now, a ModuleSet wraps a HashSet<LoadedModule>.
A LoadedModule wraps a path but optionally contains the module's dotted name, if the module is loaded by name (and needs to be referred to by name to avoid the "module defined in multiple files" error).
The LoadedModuleDisplay instance formats the module's import name correctly (with a dotted name if needed) and avoids hitting the disk or any string processing.
Previously, a
ModuleSet
wrapped aHashMap<NormalPath, TargetKind>
. This had a number of undesirable consequences:TargetKind
) were split from each other and difficult to reference.:unadd
ed modules we needed to format them as strings.Now, a
ModuleSet
wraps aHashSet<LoadedModule>
.LoadedModule
wraps a path but optionally contains the module's dotted name, if the module is loaded by name (and needs to be referred to by name to avoid the "module defined in multiple files" error).LoadedModule
Display
instance formats the module's import name correctly (with a dotted name if needed) and avoids hitting the disk or any string processing.From SyncLinear.com | DUX-2340