1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +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

@ -4497,6 +4497,9 @@ void ImportStatement::dump(int indent) const
bool ExportStatement::has_export(FlyString const& export_name) const
{
return any_of(m_entries.begin(), m_entries.end(), [&](auto& entry) {
// Make sure that empty exported names does not overlap with anything
if (entry.kind == ExportEntry::Kind::EmptyNamedExport)
return false;
return entry.export_name == export_name;
});
}