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

LibJS: Add [[HostDefined]] field to Modules

This patch adds the [[HostDefined]] field defined in
https://tc39.es/ecma262/#table-module-record-fields to module records.

Co-authored-by: davidot <davidot@serenityos.org>
This commit is contained in:
networkException 2022-10-02 21:18:33 +02:00 committed by Andreas Kling
parent cfa0c9bf9f
commit fb6de442c6
6 changed files with 21 additions and 13 deletions

View file

@ -11,8 +11,9 @@
namespace JS {
Module::Module(Realm& realm, String filename)
Module::Module(Realm& realm, String filename, Script::HostDefined* host_defined)
: m_realm(realm)
, m_host_defined(host_defined)
, m_filename(move(filename))
{
}
@ -25,6 +26,8 @@ void Module::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_realm);
visitor.visit(m_environment);
visitor.visit(m_namespace);
if (m_host_defined)
m_host_defined->visit_host_defined_self(visitor);
}
// 16.2.1.5.1.1 InnerModuleLinking ( module, stack, index ), https://tc39.es/ecma262/#sec-InnerModuleLinking