mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::js: Add vector CallArgs related conversions.
This commit is contained in:
parent
8b0fe0318f
commit
f2340367be
3 changed files with 5 additions and 2 deletions
|
@ -28,6 +28,8 @@ namespace js {
|
|||
struct args
|
||||
:JS::CallArgs
|
||||
{
|
||||
operator vector<value>::handle() const { return { *this }; }
|
||||
|
||||
bool empty() const { return length() == 0; }
|
||||
size_t size() const { return length(); }
|
||||
bool has(const size_t &at) const { return size() > at; }
|
||||
|
|
|
@ -120,6 +120,6 @@ template<class... args>
|
|||
ircd::js::object
|
||||
ircd::js::trap::operator()(args&&... a)
|
||||
{
|
||||
vector<value> argv{{std::forward<args>(a)...}};
|
||||
vector<value> argv{std::forward<args>(a)...};
|
||||
return construct(argv);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ struct vector<value>
|
|||
:JS::HandleValueArray
|
||||
{
|
||||
using JS::HandleValueArray::HandleValueArray;
|
||||
handle(const JS::CallArgs &args): JS::HandleValueArray{args} {}
|
||||
handle(): JS::HandleValueArray{JS::HandleValueArray::empty()} {}
|
||||
};
|
||||
|
||||
|
@ -103,7 +104,7 @@ struct vector<value>
|
|||
infallibleAppend(value(t));
|
||||
}
|
||||
*/
|
||||
vector(const object &obj)
|
||||
explicit vector(const object &obj)
|
||||
:JS::AutoVectorRooter<jsapi_type>{*cx}
|
||||
{
|
||||
if(!is_array(obj))
|
||||
|
|
Loading…
Reference in a new issue