Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DUX-2340] Make ModuleSet a set #295

Closed
9999years opened this issue Jun 13, 2024 · 0 comments
Closed

[DUX-2340] Make ModuleSet a set #295

9999years opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels
linear Created by Linear-GitHub Sync

Comments

@9999years
Copy link
Member

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 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

@github-actions github-actions bot added the linear Created by Linear-GitHub Sync label Jun 13, 2024
@9999years 9999years self-assigned this Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

1 participant