| 90 | } |
| 91 | |
| 92 | inline Boxed_Value clone_if_necessary(Boxed_Value incoming, std::atomic_uint_fast32_t &t_loc, const chaiscript::detail::Dispatch_State &t_ss) |
| 93 | { |
| 94 | if (!incoming.is_return_value()) |
| 95 | { |
| 96 | if (incoming.get_type_info().is_arithmetic()) { |
| 97 | return Boxed_Number::clone(incoming); |
| 98 | } else if (incoming.get_type_info().bare_equal_type_info(typeid(bool))) { |
| 99 | return Boxed_Value(*static_cast<const bool*>(incoming.get_const_ptr())); |
| 100 | } else { |
| 101 | return t_ss->call_function("clone", t_loc, {incoming}, t_ss.conversions()); |
| 102 | } |
| 103 | } else { |
| 104 | incoming.reset_return_value(); |
| 105 | return incoming; |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | template<typename T> |
no test coverage detected