Skip to content

Weird handling of import * as ns from "..."; export { ns } #3710

@nicolo-ribaudo

Description

@nicolo-ribaudo

In ParseModule we have some logic to make sure that import { foo } from "mod"; export { foo } is equivalent to export { foo } from "mod"

See Table 59 for how export { foo } from "mod" is represented: ExportEntry Record { [[ExportName]]: "foo", [[ModuleRequest]]: "mod", [[ImportName]]: "foo", [[LocalName]]: null }. Step 10.a.ii.3 makes sure that we build the same ExportEntry Record for import { foo } from "mod"; export { foo }.

For some reason, we are not doing the same in step 10.a.ii.2, which handles import * as foo from "mod"; export { foo }. export * as foo from "mod" is represented as ExportEntry Record { [[ExportName]]: "foo", [[ModuleRequest]]: "mod", [[ImportName]]: ~all~, [[LocalName]]: null }, but in the import+export case we'll keep it as ExportEntry Record { [[ExportName]]: "foo", [[ModuleRequest]]: null, [[ImportName]]: null, [[LocalName]]: "foo" }, as if we were exporting a local binding.

I am not sure yet whether this has any observable consequence or not. export * as ns from "mod" was introduced after ES6 (in #1174, by @spectranaut), and it seems like this was never brought up.

I'm manly opening this issue as a reminder for myself to check if it matters or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions