MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / clone_if_necessary

Function clone_if_necessary

include/chaiscript/language/chaiscript_eval.hpp:92–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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>

Callers 4

eval_internalMethod · 0.85
eval_internalMethod · 0.85
eval_internalMethod · 0.85
eval_internalMethod · 0.85

Calls 7

is_return_valueMethod · 0.80
is_arithmeticMethod · 0.80
bare_equal_type_infoMethod · 0.80
get_const_ptrMethod · 0.80
call_functionMethod · 0.80
reset_return_valueMethod · 0.80
Boxed_ValueClass · 0.50

Tested by

no test coverage detected