mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::js: Template the string type passed to overloaded JS::CompileFunction()
This commit is contained in:
parent
2846f80a8d
commit
d5abc39e49
1 changed files with 8 additions and 6 deletions
|
@ -45,11 +45,12 @@ struct function
|
||||||
template<class... args> js::value operator()(const js::object &, args&&...) const;
|
template<class... args> js::value operator()(const js::object &, args&&...) const;
|
||||||
|
|
||||||
// new function
|
// new function
|
||||||
|
template<class string_t>
|
||||||
function(JS::AutoObjectVector &stack,
|
function(JS::AutoObjectVector &stack,
|
||||||
const JS::CompileOptions &opts,
|
const JS::CompileOptions &opts,
|
||||||
const char *const &name,
|
const char *const &name,
|
||||||
const std::vector<std::string> &args,
|
const std::vector<string_t> &args,
|
||||||
const std::string &src);
|
const string_t &src);
|
||||||
|
|
||||||
using root<JSFunction *, L>::root;
|
using root<JSFunction *, L>::root;
|
||||||
explicit function(const value<L> &);
|
explicit function(const value<L> &);
|
||||||
|
@ -93,16 +94,17 @@ function<L>::function(const value<L> &val)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<lifetime L>
|
template<lifetime L>
|
||||||
|
template<class string_t>
|
||||||
function<L>::function(JS::AutoObjectVector &stack,
|
function<L>::function(JS::AutoObjectVector &stack,
|
||||||
const JS::CompileOptions &opts,
|
const JS::CompileOptions &opts,
|
||||||
const char *const &name,
|
const char *const &name,
|
||||||
const std::vector<std::string> &args,
|
const std::vector<string_t> &args,
|
||||||
const std::string &src)
|
const string_t &src)
|
||||||
:function<L>::root::type{}
|
:function<L>::root::type{}
|
||||||
{
|
{
|
||||||
std::vector<const char *> argp(args.size());
|
std::vector<const typename string_t::value_type *> argp(args.size());
|
||||||
std::transform(begin(args), end(args), begin(argp), []
|
std::transform(begin(args), end(args), begin(argp), []
|
||||||
(const std::string &arg)
|
(const string_t &arg)
|
||||||
{
|
{
|
||||||
return arg.data();
|
return arg.data();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue