mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
ircd::js: Construct compartment from more implicit information.
This commit is contained in:
parent
c704c67aa5
commit
8f9465764d
2 changed files with 17 additions and 1 deletions
|
@ -49,6 +49,8 @@ struct compartment
|
|||
|
||||
compartment(JSObject *const &, context &);
|
||||
compartment(JSObject *const &);
|
||||
compartment(context &);
|
||||
compartment();
|
||||
compartment(compartment &&) noexcept;
|
||||
compartment(const compartment &) = delete;
|
||||
~compartment() noexcept;
|
||||
|
|
16
ircd/js.cc
16
ircd/js.cc
|
@ -1210,8 +1210,22 @@ ircd::js::reflect(const JSExnType &e)
|
|||
// ircd/js/compartment.h
|
||||
//
|
||||
|
||||
ircd::js::compartment::compartment()
|
||||
:compartment{*cx}
|
||||
{
|
||||
}
|
||||
|
||||
ircd::js::compartment::compartment(context &c)
|
||||
:compartment
|
||||
{
|
||||
current_global(c)?: throw error("Cannot enter compartment without global"),
|
||||
c
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
ircd::js::compartment::compartment(JSObject *const &obj)
|
||||
:compartment(obj, *cx)
|
||||
:compartment{obj, *cx}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue