diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index ad2775b..2cc06c7 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -645,71 +645,6 @@ namespace chaiscript throw chaiscript::detail::exception::bad_any_cast(); } - bool operator==(const Boxed_Number &t_rhs) const - { - return boxed_cast(oper(Operators::Opers::equals, this->bv, t_rhs.bv)); - } - - bool operator<(const Boxed_Number &t_rhs) const - { - return boxed_cast(oper(Operators::Opers::less_than, this->bv, t_rhs.bv)); - } - - bool operator>(const Boxed_Number &t_rhs) const - { - return boxed_cast(oper(Operators::Opers::greater_than, this->bv, t_rhs.bv)); - } - - bool operator>=(const Boxed_Number &t_rhs) const - { - return boxed_cast(oper(Operators::Opers::greater_than_equal, this->bv, t_rhs.bv)); - } - - bool operator<=(const Boxed_Number &t_rhs) const - { - return boxed_cast(oper(Operators::Opers::less_than_equal, this->bv, t_rhs.bv)); - } - - bool operator!=(const Boxed_Number &t_rhs) const - { - return boxed_cast(oper(Operators::Opers::not_equal, this->bv, t_rhs.bv)); - } - - Boxed_Number operator--() - { - return oper(Operators::Opers::pre_decrement, this->bv); - } - - Boxed_Number operator++() - { - return oper(Operators::Opers::pre_increment, this->bv); - } - - Boxed_Number operator+(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::sum, this->bv, t_rhs.bv); - } - - Boxed_Number operator+() const - { - return oper(Operators::Opers::unary_plus, this->bv); - } - - Boxed_Number operator-() const - { - return oper(Operators::Opers::unary_minus, this->bv); - } - - Boxed_Number operator-(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::difference, this->bv, t_rhs.bv); - } - - Boxed_Number operator&=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_bitwise_and, this->bv, t_rhs.bv); - } - static void validate_boxed_number(const Boxed_Value &v) { const Type_Info &inp_ = v.get_type_info(); @@ -724,107 +659,6 @@ namespace chaiscript } } - // cppcheck-suppress operatorEq - Boxed_Number operator=(const Boxed_Value &v) - { - validate_boxed_number(v); - bv = v; - return *this; - } - - // cppcheck-suppress operatorEq - Boxed_Number operator=(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::assign, this->bv, t_rhs.bv); - } - - Boxed_Number operator|=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_bitwise_or, this->bv, t_rhs.bv); - } - - Boxed_Number operator^=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_bitwise_xor, this->bv, t_rhs.bv); - } - - Boxed_Number operator%=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_remainder, this->bv, t_rhs.bv); - } - - Boxed_Number operator<<=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_shift_left, this->bv, t_rhs.bv); - } - - Boxed_Number operator>>=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_shift_right, this->bv, t_rhs.bv); - } - - Boxed_Number operator&(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::bitwise_and, this->bv, t_rhs.bv); - } - - Boxed_Number operator~() const - { - return oper(Operators::Opers::bitwise_complement, this->bv); - } - - Boxed_Number operator^(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::bitwise_xor, this->bv, t_rhs.bv); - } - - Boxed_Number operator|(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::bitwise_or, this->bv, t_rhs.bv); - } - - Boxed_Number operator*=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_product, this->bv, t_rhs.bv); - } - Boxed_Number operator/=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_quotient, this->bv, t_rhs.bv); - } - Boxed_Number operator+=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_sum, this->bv, t_rhs.bv); - } - Boxed_Number operator-=(const Boxed_Number &t_rhs) - { - return oper(Operators::Opers::assign_difference, this->bv, t_rhs.bv); - } - - Boxed_Number operator/(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::quotient, this->bv, t_rhs.bv); - } - - Boxed_Number operator<<(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::shift_left, this->bv, t_rhs.bv); - } - - Boxed_Number operator*(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::product, this->bv, t_rhs.bv); - } - - Boxed_Number operator%(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::remainder, this->bv, t_rhs.bv); - } - - Boxed_Number operator>>(const Boxed_Number &t_rhs) const - { - return oper(Operators::Opers::shift_right, this->bv, t_rhs.bv); - } - static bool equals(const Boxed_Number &t_lhs, const Boxed_Number &t_rhs) diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index ec47d50..a5c46e4 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -376,7 +376,6 @@ namespace chaiscript typedef std::vector StackData; Stack_Holder() - : call_depth(0) { stacks.reserve(2); stacks.emplace_back(1); @@ -387,7 +386,7 @@ namespace chaiscript std::vector stacks; std::vector> call_params; - int call_depth; + int call_depth = 0; }; /// Main class for the dispatchkit. Handles management @@ -1328,10 +1327,6 @@ namespace chaiscript if (rt.bare_equal(boxed_type)) { - if (lt.bare_equal(boxed_pod_type)) - { - return true; - } return true; } diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index cda7671..9816f36 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -570,17 +570,17 @@ namespace chaiscript Scope_Push_Pop(const chaiscript::detail::Dispatch_State &t_ds) : m_ds(t_ds) { - m_ds.get()->new_scope(m_ds.get().stack_holder()); + m_ds->new_scope(m_ds.stack_holder()); } ~Scope_Push_Pop() { - m_ds.get()->pop_scope(m_ds.get().stack_holder()); + m_ds->pop_scope(m_ds.stack_holder()); } private: - std::reference_wrapper m_ds; + const chaiscript::detail::Dispatch_State &m_ds; }; /// Creates a new function call and pops it on destruction @@ -594,27 +594,27 @@ namespace chaiscript Function_Push_Pop(const chaiscript::detail::Dispatch_State &t_ds) : m_ds(t_ds) { - m_ds.get()->new_function_call(m_ds.get().stack_holder(), m_ds.get().conversion_saves()); + m_ds->new_function_call(m_ds.stack_holder(), m_ds.conversion_saves()); } ~Function_Push_Pop() { - m_ds.get()->pop_function_call(m_ds.get().stack_holder(), m_ds.get().conversion_saves()); + m_ds->pop_function_call(m_ds.stack_holder(), m_ds.conversion_saves()); } void save_params(const std::vector &t_params) { - m_ds.get()->save_function_params(t_params); + m_ds->save_function_params(t_params); } void save_params(std::initializer_list t_params) { - m_ds.get()->save_function_params(std::move(t_params)); + m_ds->save_function_params(std::move(t_params)); } private: - std::reference_wrapper m_ds; + const chaiscript::detail::Dispatch_State &m_ds; }; /// Creates a new scope then pops it on destruction @@ -628,17 +628,17 @@ namespace chaiscript Stack_Push_Pop(const chaiscript::detail::Dispatch_State &t_ds) : m_ds(t_ds) { - m_ds.get()->new_stack(m_ds.get().stack_holder()); + m_ds->new_stack(m_ds.stack_holder()); } ~Stack_Push_Pop() { - m_ds.get()->pop_stack(m_ds.get().stack_holder()); + m_ds->pop_stack(m_ds.stack_holder()); } private: - std::reference_wrapper m_ds; + const chaiscript::detail::Dispatch_State &m_ds; }; } }