Remove some unused code in Boxed_Value

This commit is contained in:
Jason Turner 2016-04-16 22:14:02 -06:00
parent 7d5a97aa2f
commit c68488388e
3 changed files with 12 additions and 183 deletions

View File

@ -645,71 +645,6 @@ namespace chaiscript
throw chaiscript::detail::exception::bad_any_cast(); throw chaiscript::detail::exception::bad_any_cast();
} }
bool operator==(const Boxed_Number &t_rhs) const
{
return boxed_cast<bool>(oper(Operators::Opers::equals, this->bv, t_rhs.bv));
}
bool operator<(const Boxed_Number &t_rhs) const
{
return boxed_cast<bool>(oper(Operators::Opers::less_than, this->bv, t_rhs.bv));
}
bool operator>(const Boxed_Number &t_rhs) const
{
return boxed_cast<bool>(oper(Operators::Opers::greater_than, this->bv, t_rhs.bv));
}
bool operator>=(const Boxed_Number &t_rhs) const
{
return boxed_cast<bool>(oper(Operators::Opers::greater_than_equal, this->bv, t_rhs.bv));
}
bool operator<=(const Boxed_Number &t_rhs) const
{
return boxed_cast<bool>(oper(Operators::Opers::less_than_equal, this->bv, t_rhs.bv));
}
bool operator!=(const Boxed_Number &t_rhs) const
{
return boxed_cast<bool>(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) static void validate_boxed_number(const Boxed_Value &v)
{ {
const Type_Info &inp_ = v.get_type_info(); 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) static bool equals(const Boxed_Number &t_lhs, const Boxed_Number &t_rhs)

View File

@ -376,7 +376,6 @@ namespace chaiscript
typedef std::vector<Scope> StackData; typedef std::vector<Scope> StackData;
Stack_Holder() Stack_Holder()
: call_depth(0)
{ {
stacks.reserve(2); stacks.reserve(2);
stacks.emplace_back(1); stacks.emplace_back(1);
@ -387,7 +386,7 @@ namespace chaiscript
std::vector<StackData> stacks; std::vector<StackData> stacks;
std::vector<std::vector<Boxed_Value>> call_params; std::vector<std::vector<Boxed_Value>> call_params;
int call_depth; int call_depth = 0;
}; };
/// Main class for the dispatchkit. Handles management /// Main class for the dispatchkit. Handles management
@ -1328,10 +1327,6 @@ namespace chaiscript
if (rt.bare_equal(boxed_type)) if (rt.bare_equal(boxed_type))
{ {
if (lt.bare_equal(boxed_pod_type))
{
return true;
}
return true; return true;
} }

View File

@ -570,17 +570,17 @@ namespace chaiscript
Scope_Push_Pop(const chaiscript::detail::Dispatch_State &t_ds) Scope_Push_Pop(const chaiscript::detail::Dispatch_State &t_ds)
: m_ds(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() ~Scope_Push_Pop()
{ {
m_ds.get()->pop_scope(m_ds.get().stack_holder()); m_ds->pop_scope(m_ds.stack_holder());
} }
private: private:
std::reference_wrapper<const chaiscript::detail::Dispatch_State> m_ds; const chaiscript::detail::Dispatch_State &m_ds;
}; };
/// Creates a new function call and pops it on destruction /// 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) Function_Push_Pop(const chaiscript::detail::Dispatch_State &t_ds)
: m_ds(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() ~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<Boxed_Value> &t_params) void save_params(const std::vector<Boxed_Value> &t_params)
{ {
m_ds.get()->save_function_params(t_params); m_ds->save_function_params(t_params);
} }
void save_params(std::initializer_list<Boxed_Value> t_params) void save_params(std::initializer_list<Boxed_Value> t_params)
{ {
m_ds.get()->save_function_params(std::move(t_params)); m_ds->save_function_params(std::move(t_params));
} }
private: private:
std::reference_wrapper<const chaiscript::detail::Dispatch_State> m_ds; const chaiscript::detail::Dispatch_State &m_ds;
}; };
/// Creates a new scope then pops it on destruction /// 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) Stack_Push_Pop(const chaiscript::detail::Dispatch_State &t_ds)
: m_ds(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() ~Stack_Push_Pop()
{ {
m_ds.get()->pop_stack(m_ds.get().stack_holder()); m_ds->pop_stack(m_ds.stack_holder());
} }
private: private:
std::reference_wrapper<const chaiscript::detail::Dispatch_State> m_ds; const chaiscript::detail::Dispatch_State &m_ds;
}; };
} }
} }