mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
LibJS: Add LoadedModules to Script and CyclicModule
This commit is contained in:
parent
d60e8c9df5
commit
33b40eaeed
Notes:
sideshowbarker
2024-07-17 22:09:47 +09:00
Author: https://github.com/networkException Commit: https://github.com/SerenityOS/serenity/commit/33b40eaeed Pull-request: https://github.com/SerenityOS/serenity/pull/21700 Issue: https://github.com/SerenityOS/serenity/issues/21009 Reviewed-by: https://github.com/awesomekling
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2022, David Tuin <davidot@serenityos.org>
|
||||
* Copyright (c) 2023, networkException <networkexception@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -28,6 +29,8 @@ void CyclicModule::visit_edges(Cell::Visitor& visitor)
|
||||
visitor.visit(m_top_level_capability);
|
||||
for (auto const& module : m_async_parent_modules)
|
||||
visitor.visit(module);
|
||||
for (auto const& loaded_module : m_loaded_modules)
|
||||
visitor.visit(loaded_module.module);
|
||||
}
|
||||
|
||||
// 16.2.1.5.1 Link ( ), https://tc39.es/ecma262/#sec-moduledeclarationlinking
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
virtual ThrowCompletionOr<Promise*> evaluate(VM& vm) override final;
|
||||
|
||||
Vector<ModuleRequest> const& requested_modules() const { return m_requested_modules; }
|
||||
Vector<ModuleWithSpecifier> const& loaded_modules() const { return m_loaded_modules; }
|
||||
|
||||
protected:
|
||||
CyclicModule(Realm& realm, StringView filename, bool has_top_level_await, Vector<ModuleRequest> requested_modules, Script::HostDefined* host_defined);
|
||||
@ -55,6 +56,7 @@ protected:
|
||||
Optional<u32> m_dfs_index; // [[DFSIndex]]
|
||||
Optional<u32> m_dfs_ancestor_index; // [[DFSAncestorIndex]]
|
||||
Vector<ModuleRequest> m_requested_modules; // [[RequestedModules]]
|
||||
Vector<ModuleWithSpecifier> m_loaded_modules; // [[LoadedModules]]
|
||||
GCPtr<CyclicModule> m_cycle_root; // [[CycleRoot]]
|
||||
bool m_has_top_level_await { false }; // [[HasTLA]]
|
||||
bool m_async_evaluation { false }; // [[AsyncEvaluation]]
|
||||
|
@ -45,6 +45,8 @@ void Script::visit_edges(Cell::Visitor& visitor)
|
||||
visitor.visit(m_realm);
|
||||
if (m_host_defined)
|
||||
m_host_defined->visit_host_defined_self(visitor);
|
||||
for (auto const& loaded_module : m_loaded_modules)
|
||||
visitor.visit(loaded_module.module);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
|
||||
Realm& realm() { return *m_realm; }
|
||||
Program const& parse_node() const { return *m_parse_node; }
|
||||
Vector<ModuleWithSpecifier> const& loaded_modules() const { return m_loaded_modules; }
|
||||
|
||||
HostDefined* host_defined() const { return m_host_defined; }
|
||||
StringView filename() const { return m_filename; }
|
||||
@ -39,8 +40,9 @@ private:
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
GCPtr<Realm> m_realm; // [[Realm]]
|
||||
NonnullRefPtr<Program> m_parse_node; // [[ECMAScriptCode]]
|
||||
GCPtr<Realm> m_realm; // [[Realm]]
|
||||
NonnullRefPtr<Program> m_parse_node; // [[ECMAScriptCode]]
|
||||
Vector<ModuleWithSpecifier> m_loaded_modules; // [[LoadedModules]]
|
||||
|
||||
// Needed for potential lookups of modules.
|
||||
DeprecatedString m_filename;
|
||||
|
Loading…
Reference in New Issue
Block a user