summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/AST.h
diff options
context:
space:
mode:
authordavidot <davidot@serenityos.org>2022-08-29 22:12:25 +0200
committerLinus Groh <mail@linusgroh.de>2022-09-02 02:07:37 +0100
commit3b1c3e574f51e1ca4efc725813a1b10bba19fc63 (patch)
tree14beb297141b6006ce97c232763a167e38c97f8a /Userland/Libraries/LibJS/AST.h
parentf75c51b09741901c6a59205fe2642de24662e4a9 (diff)
downloadserenity-3b1c3e574f51e1ca4efc725813a1b10bba19fc63.zip
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.
Diffstat (limited to 'Userland/Libraries/LibJS/AST.h')
-rw-r--r--Userland/Libraries/LibJS/AST.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/AST.h b/Userland/Libraries/LibJS/AST.h
index 13cf6f55d9..6debd070b8 100644
--- a/Userland/Libraries/LibJS/AST.h
+++ b/Userland/Libraries/LibJS/AST.h
@@ -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)