mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-02-07 18:26:49 +08:00
Fix compile errors on VS2019 (C++17) with Function_Params
- needed to disambiguate between chaiscript::Function_Params and chaiscript::dispatch::detail::Function_Params in several places.
This commit is contained in:
parent
4993e4773b
commit
350acbf254
@ -39,7 +39,7 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret call(const Function_Params ¶ms, const Type_Conversions_State &t_state)
|
Ret call(const chaiscript::Function_Params ¶ms, const Type_Conversions_State &t_state)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_arithmetic_v<Ret>) {
|
if constexpr (std::is_arithmetic_v<Ret>) {
|
||||||
return Boxed_Number(dispatch::dispatch(m_funcs, params, t_state)).get_as<Ret>();
|
return Boxed_Number(dispatch::dispatch(m_funcs, params, t_state)).get_as<Ret>();
|
||||||
@ -57,11 +57,11 @@ namespace chaiscript
|
|||||||
|
|
||||||
if (m_conversions) {
|
if (m_conversions) {
|
||||||
Type_Conversions_State state(*m_conversions, m_conversions->conversion_saves());
|
Type_Conversions_State state(*m_conversions, m_conversions->conversion_saves());
|
||||||
return call(Function_Params{params}, state);
|
return call(chaiscript::Function_Params{params}, state);
|
||||||
} else {
|
} else {
|
||||||
Type_Conversions conv;
|
Type_Conversions conv;
|
||||||
Type_Conversions_State state(conv, conv.conversion_saves());
|
Type_Conversions_State state(conv, conv.conversion_saves());
|
||||||
return call(Function_Params{params}, state);
|
return call(chaiscript::Function_Params{params}, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -844,7 +844,7 @@ namespace chaiscript
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template<typename FuncType>
|
template<typename FuncType>
|
||||||
bool types_match_except_for_arithmetic(const FuncType &t_func, const Function_Params &plist,
|
bool types_match_except_for_arithmetic(const FuncType &t_func, const chaiscript::Function_Params &plist,
|
||||||
const Type_Conversions_State &t_conversions) noexcept
|
const Type_Conversions_State &t_conversions) noexcept
|
||||||
{
|
{
|
||||||
const std::vector<Type_Info> &types = t_func->get_param_types();
|
const std::vector<Type_Info> &types = t_func->get_param_types();
|
||||||
@ -863,7 +863,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename InItr, typename Funcs>
|
template<typename InItr, typename Funcs>
|
||||||
Boxed_Value dispatch_with_conversions(InItr begin, const InItr &end, const Function_Params &plist,
|
Boxed_Value dispatch_with_conversions(InItr begin, const InItr &end, const chaiscript::Function_Params &plist,
|
||||||
const Type_Conversions_State &t_conversions, const Funcs &t_funcs)
|
const Type_Conversions_State &t_conversions, const Funcs &t_funcs)
|
||||||
{
|
{
|
||||||
InItr matching_func(end);
|
InItr matching_func(end);
|
||||||
@ -919,7 +919,7 @@ namespace chaiscript
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return (*(matching_func->second))(Function_Params{newplist}, t_conversions);
|
return (*(matching_func->second))(chaiscript::Function_Params{newplist}, t_conversions);
|
||||||
} catch (const exception::bad_boxed_cast &) {
|
} catch (const exception::bad_boxed_cast &) {
|
||||||
//parameter failed to cast
|
//parameter failed to cast
|
||||||
} catch (const exception::arity_error &) {
|
} catch (const exception::arity_error &) {
|
||||||
|
|||||||
@ -78,7 +78,7 @@ namespace chaiscript
|
|||||||
*/
|
*/
|
||||||
template<typename Ret, typename ... Params>
|
template<typename Ret, typename ... Params>
|
||||||
bool compare_types_cast(Ret (*)(Params...),
|
bool compare_types_cast(Ret (*)(Params...),
|
||||||
const Function_Params ¶ms, const Type_Conversions_State &t_conversions) noexcept
|
const chaiscript::Function_Params ¶ms, const Type_Conversions_State &t_conversions) noexcept
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
std::vector<Boxed_Value>::size_type i = 0;
|
std::vector<Boxed_Value>::size_type i = 0;
|
||||||
@ -93,7 +93,7 @@ namespace chaiscript
|
|||||||
template<typename Callable, typename Ret, typename ... Params, size_t ... I>
|
template<typename Callable, typename Ret, typename ... Params, size_t ... I>
|
||||||
Ret call_func(Ret (*)(Params...),
|
Ret call_func(Ret (*)(Params...),
|
||||||
std::index_sequence<I...>, const Callable &f,
|
std::index_sequence<I...>, const Callable &f,
|
||||||
[[maybe_unused]] const Function_Params ¶ms,
|
[[maybe_unused]] const chaiscript::Function_Params ¶ms,
|
||||||
[[maybe_unused]] const Type_Conversions_State &t_conversions)
|
[[maybe_unused]] const Type_Conversions_State &t_conversions)
|
||||||
{
|
{
|
||||||
return f(boxed_cast<Params>(params[I], &t_conversions)...);
|
return f(boxed_cast<Params>(params[I], &t_conversions)...);
|
||||||
@ -106,7 +106,7 @@ namespace chaiscript
|
|||||||
/// the bad_boxed_cast is passed up to the caller.
|
/// the bad_boxed_cast is passed up to the caller.
|
||||||
template<typename Callable, typename Ret, typename ... Params>
|
template<typename Callable, typename Ret, typename ... Params>
|
||||||
Boxed_Value call_func(Ret (*sig)(Params...), const Callable &f,
|
Boxed_Value call_func(Ret (*sig)(Params...), const Callable &f,
|
||||||
const Function_Params ¶ms, const Type_Conversions_State &t_conversions)
|
const chaiscript::Function_Params ¶ms, const Type_Conversions_State &t_conversions)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<Ret, void>) {
|
if constexpr (std::is_same_v<Ret, void>) {
|
||||||
call_func(sig, std::index_sequence_for<Params...>{}, f, params, t_conversions);
|
call_func(sig, std::index_sequence_for<Params...>{}, f, params, t_conversions);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user