1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +00:00

LibJS: Split parsing program to script and module separately

This allows us to only perform checks like export bindings existing only
for modules. Also this makes it easier to set strict and other state
variables with TemporaryChanges.
This commit is contained in:
davidot 2021-11-27 00:01:23 +01:00 committed by Linus Groh
parent 22174d3b7b
commit b7c7d54167
3 changed files with 74 additions and 10 deletions

View file

@ -260,8 +260,8 @@ public:
ExportEntry(String export_name, String local_name)
: kind(LocalExport)
, export_name(export_name)
, local_or_import_name(local_name)
, export_name(move(export_name))
, local_or_import_name(move(local_name))
{
}
};
@ -279,6 +279,9 @@ public:
bool has_export(StringView export_name) const;
bool has_statement() const { return m_statement; }
Vector<ExportEntry> const& entries() const { return m_entries; }
private:
RefPtr<ASTNode> m_statement;
Vector<ExportEntry> m_entries;
@ -1218,6 +1221,8 @@ public:
virtual bool is_lexical_declaration() const override { return true; }
StringView name() const { return m_class_expression->name(); }
private:
NonnullRefPtr<ClassExpression> m_class_expression;
};