mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:07:44 +00:00
LibJS: Implement the import assertions proposal
The hard part of parsing them in import statements and calls was already done so this is just removing some check which threw before on assertions. And filtering the assertions based on the result of a new host hook.
This commit is contained in:
parent
e0e4ead2c8
commit
f568939568
11 changed files with 270 additions and 83 deletions
|
@ -257,6 +257,8 @@ struct ModuleRequest {
|
|||
{
|
||||
}
|
||||
|
||||
ModuleRequest(FlyString module_specifier, Vector<Assertion> assertions);
|
||||
|
||||
void add_assertion(String key, String value)
|
||||
{
|
||||
assertions.empend(move(key), move(value));
|
||||
|
@ -309,6 +311,7 @@ public:
|
|||
bool has_bound_name(FlyString const& name) const;
|
||||
Vector<ImportEntry> const& entries() const { return m_entries; }
|
||||
ModuleRequest const& module_request() const { return m_module_request; }
|
||||
ModuleRequest& module_request() { return m_module_request; }
|
||||
|
||||
private:
|
||||
ModuleRequest m_module_request;
|
||||
|
@ -406,6 +409,12 @@ public:
|
|||
return *m_statement;
|
||||
}
|
||||
|
||||
ModuleRequest& module_request()
|
||||
{
|
||||
VERIFY(!m_module_request.module_specifier.is_null());
|
||||
return m_module_request;
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<ASTNode> m_statement;
|
||||
Vector<ExportEntry> m_entries;
|
||||
|
@ -448,6 +457,9 @@ public:
|
|||
NonnullRefPtrVector<ImportStatement> const& imports() const { return m_imports; }
|
||||
NonnullRefPtrVector<ExportStatement> const& exports() const { return m_exports; }
|
||||
|
||||
NonnullRefPtrVector<ImportStatement>& imports() { return m_imports; }
|
||||
NonnullRefPtrVector<ExportStatement>& exports() { return m_exports; }
|
||||
|
||||
bool has_top_level_await() const { return m_has_top_level_await; }
|
||||
void set_has_top_level_await() { m_has_top_level_await = true; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue