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

Editorial: Handle non-direct binding cases in ResolveExports #3488

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kimjg1119
Copy link
Contributor

In step 6.a.iv.3 of ResolveExport, the case where e.[[ImportName]] is ALL, indicating that the module does not provide a direct binding, is addressed. I’m uncertain but curious whether we should also handle other cases such as ALL-BUT-DEFAULT and null in this context.

c.f. This is problematic because the recursive call in step 6.a.iv.4 requires exportName to be a string. Therefore, the remaining cases should be explicitly handled in some way.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Nov 20, 2024

ALL-BUT-DEFAULT is only used for export * from "foo", which has [[ExportName]] set to null and thus can never happen here. I would prefer if we added an assertion after step 6.a.i saying that [[ImportName]] is not ALL-BUT-DEFAULT.

It might be helpful to look at Table 58: the only cases that can happen in this code path are those where the first two columns are not null.

@kimjg1119
Copy link
Contributor Author

kimjg1119 commented Nov 20, 2024

Thank you for clarifying! I replaced it with an assertion instead.

@@ -28211,6 +28211,7 @@ <h1>
1. For each ExportEntry Record _e_ of _module_.[[IndirectExportEntries]], do
1. If _e_.[[ExportName]] is _exportName_, then
1. Assert: _e_.[[ModuleRequest]] is not *null*.
1. Assert: _e_.[[ImportName]] is neither ~all-but-default~ nor *null*.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of ruling out two of the four possible states here, and then switching between the remaining two later, I would add another assert in the "else" case below (after the existing "imports a specific binding" assert):

                  1. Assert: _e_.[[ImportName]] is a String.

That seems clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants