1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:17:44 +00:00

LibJS: Handle empty named export

This is an export which looks like `export {} from "module"`, and
although it doesn't have any real export entries it should still add
"module" to the required modules to load.
This commit is contained in:
davidot 2022-08-29 22:12:25 +02:00 committed by Linus Groh
parent f75c51b097
commit 3b1c3e574f
10 changed files with 60 additions and 2 deletions

View file

@ -360,6 +360,11 @@ public:
NamedExport,
ModuleRequestAll,
ModuleRequestAllButDefault,
// EmptyNamedExport is a special type for export {} from "module",
// which should import the module without getting any of the exports
// however we don't want give it a fake export name which may get
// duplicates
EmptyNamedExport,
} kind;
FlyString export_name; // [[ExportName]]
@ -409,6 +414,11 @@ public:
{
return ExportEntry { Kind::ModuleRequestAll, move(export_name), {} };
}
static ExportEntry empty_named_export()
{
return ExportEntry { Kind::EmptyNamedExport, {}, {} };
}
};
ExportStatement(SourceRange source_range, RefPtr<ASTNode> statement, Vector<ExportEntry> entries, bool is_default_export, ModuleRequest module_request)