summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/AST.cpp2
-rw-r--r--Userland/Libraries/LibJS/SourceTextModule.cpp2
-rw-r--r--Userland/Libraries/LibJS/Tests/modules/basic-modules.js4
-rw-r--r--Userland/Libraries/LibJS/Tests/modules/multiple-star-imports.mjs4
4 files changed, 9 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp
index 461281f1b1..183fd8d2a7 100644
--- a/Userland/Libraries/LibJS/AST.cpp
+++ b/Userland/Libraries/LibJS/AST.cpp
@@ -4498,7 +4498,7 @@ 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)
+ if (entry.kind != ExportEntry::Kind::NamedExport)
return false;
return entry.export_name == export_name;
});
diff --git a/Userland/Libraries/LibJS/SourceTextModule.cpp b/Userland/Libraries/LibJS/SourceTextModule.cpp
index b86340312a..bac774498c 100644
--- a/Userland/Libraries/LibJS/SourceTextModule.cpp
+++ b/Userland/Libraries/LibJS/SourceTextModule.cpp
@@ -202,8 +202,6 @@ Result<NonnullRefPtr<SourceTextModule>, Vector<Parser::Error>> SourceTextModule:
// 2. If ie.[[ImportName]] is namespace-object, then
if (import_entry.is_namespace) {
// a. NOTE: This is a re-export of an imported module namespace object.
- VERIFY(export_entry.is_module_request() && export_entry.kind != ExportStatement::ExportEntry::Kind::NamedExport);
-
// b. Append ee to localExportEntries.
local_export_entries.empend(export_entry);
}
diff --git a/Userland/Libraries/LibJS/Tests/modules/basic-modules.js b/Userland/Libraries/LibJS/Tests/modules/basic-modules.js
index a9bd153b2c..2dad8a834b 100644
--- a/Userland/Libraries/LibJS/Tests/modules/basic-modules.js
+++ b/Userland/Libraries/LibJS/Tests/modules/basic-modules.js
@@ -186,6 +186,10 @@ describe("in- and exports", () => {
test("namespace has expected ordering", () => {
expectModulePassed("./namespace-order.mjs");
});
+
+ test("can have multiple star imports even from the same file", () => {
+ expectModulePassed("./multiple-star-imports.mjs");
+ });
});
describe("loops", () => {
diff --git a/Userland/Libraries/LibJS/Tests/modules/multiple-star-imports.mjs b/Userland/Libraries/LibJS/Tests/modules/multiple-star-imports.mjs
new file mode 100644
index 0000000000..3c04eeb88f
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/modules/multiple-star-imports.mjs
@@ -0,0 +1,4 @@
+import * as ns1 from "./default-and-star-export.mjs";
+import * as ns2 from "./default-and-star-export.mjs";
+
+export const passed = ns1 === ns2;