0
0
Fork 0
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:
Jason Volk 2016-10-23 18:16:24 -07:00
parent c704c67aa5
commit 8f9465764d
2 changed files with 17 additions and 1 deletions

View file

@ -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;

View file

@ -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}
{
}