Address some of the issues found by cppcheck
This commit is contained in:
@@ -309,12 +309,6 @@ namespace chaiscript
|
|||||||
throw bv;
|
throw bv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boost::shared_ptr<chaiscript::detail::Dispatch_Engine> bootstrap2(boost::shared_ptr<chaiscript::detail::Dispatch_Engine> e = boost::shared_ptr<chaiscript::detail::Dispatch_Engine> (new chaiscript::detail::Dispatch_Engine()))
|
|
||||||
{
|
|
||||||
e->add(user_type<void>(), "void");
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string what(const std::exception &e)
|
static std::string what(const std::exception &e)
|
||||||
{
|
{
|
||||||
return e.what();
|
return e.what();
|
||||||
|
@@ -307,7 +307,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Source>
|
template<typename Source>
|
||||||
std::string to_string_aux(const Boxed_Value &v) const
|
static std::string to_string_aux(const Boxed_Value &v)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << *static_cast<const Source *>(v.get_const_ptr());
|
oss << *static_cast<const Source *>(v.get_const_ptr());
|
||||||
@@ -520,7 +520,7 @@ namespace chaiscript
|
|||||||
return oper(Operators::assign_bitwise_and, this->bv, t_rhs.bv);
|
return oper(Operators::assign_bitwise_and, this->bv, t_rhs.bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
if (inp_ == typeid(bool))
|
if (inp_ == typeid(bool))
|
||||||
|
@@ -50,11 +50,11 @@ namespace chaiscript
|
|||||||
virtual Boxed_Value convert(const Boxed_Value &derived) const = 0;
|
virtual Boxed_Value convert(const Boxed_Value &derived) const = 0;
|
||||||
virtual Boxed_Value convert_down(const Boxed_Value &base) const = 0;
|
virtual Boxed_Value convert_down(const Boxed_Value &base) const = 0;
|
||||||
|
|
||||||
const Type_Info &base()
|
const Type_Info &base() const
|
||||||
{
|
{
|
||||||
return m_base;
|
return m_base;
|
||||||
}
|
}
|
||||||
const Type_Info &derived()
|
const Type_Info &derived() const
|
||||||
{
|
{
|
||||||
return m_derived;
|
return m_derived;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ namespace chaiscript
|
|||||||
return m_attrs[t_attr_name];
|
return m_attrs[t_attr_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, Boxed_Value> get_attrs()
|
std::map<std::string, Boxed_Value> get_attrs() const
|
||||||
{
|
{
|
||||||
return m_attrs;
|
return m_attrs;
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@ namespace chaiscript
|
|||||||
class Boxed_Number;
|
class Boxed_Number;
|
||||||
struct AST_Node;
|
struct AST_Node;
|
||||||
|
|
||||||
typedef boost::shared_ptr<struct AST_Node> AST_NodePtr;
|
typedef boost::shared_ptr<AST_Node> AST_NodePtr;
|
||||||
|
|
||||||
namespace dispatch
|
namespace dispatch
|
||||||
{
|
{
|
||||||
|
@@ -54,7 +54,7 @@ namespace chaiscript
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Typedef for pointers to AST_Node objects. Used in building of the AST_Node tree
|
/// \brief Typedef for pointers to AST_Node objects. Used in building of the AST_Node tree
|
||||||
typedef boost::shared_ptr<struct AST_Node> AST_NodePtr;
|
typedef boost::shared_ptr<AST_Node> AST_NodePtr;
|
||||||
|
|
||||||
|
|
||||||
/// \brief Classes which may be thrown during error cases when ChaiScript is executing.
|
/// \brief Classes which may be thrown during error cases when ChaiScript is executing.
|
||||||
@@ -435,7 +435,7 @@ namespace chaiscript
|
|||||||
return eval_internal(t_e);
|
return eval_internal(t_e);
|
||||||
} catch (exception::eval_error &ee) {
|
} catch (exception::eval_error &ee) {
|
||||||
ee.call_stack.push_back(shared_from_this());
|
ee.call_stack.push_back(shared_from_this());
|
||||||
throw ee;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -681,7 +681,7 @@ namespace chaiscript
|
|||||||
if (t_handler) {
|
if (t_handler) {
|
||||||
t_handler->handle(bv, m_engine);
|
t_handler->handle(bv, m_engine);
|
||||||
}
|
}
|
||||||
throw bv;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,7 +707,7 @@ namespace chaiscript
|
|||||||
if (t_handler) {
|
if (t_handler) {
|
||||||
t_handler->handle(bv, m_engine);
|
t_handler->handle(bv, m_engine);
|
||||||
}
|
}
|
||||||
throw bv;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,7 +737,7 @@ namespace chaiscript
|
|||||||
if (t_handler) {
|
if (t_handler) {
|
||||||
t_handler->handle(bv, m_engine);
|
t_handler->handle(bv, m_engine);
|
||||||
}
|
}
|
||||||
throw bv;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,7 +753,7 @@ namespace chaiscript
|
|||||||
if (t_handler) {
|
if (t_handler) {
|
||||||
t_handler->handle(bv, m_engine);
|
t_handler->handle(bv, m_engine);
|
||||||
}
|
}
|
||||||
throw bv;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,7 +773,7 @@ namespace chaiscript
|
|||||||
if (t_handler) {
|
if (t_handler) {
|
||||||
t_handler->handle(bv, m_engine);
|
t_handler->handle(bv, m_engine);
|
||||||
}
|
}
|
||||||
throw bv;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -56,7 +56,8 @@ namespace chaiscript
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ChaiScript_Parser()
|
ChaiScript_Parser()
|
||||||
: m_multiline_comment_begin("/*"),
|
: m_line(-1), m_col(-1),
|
||||||
|
m_multiline_comment_begin("/*"),
|
||||||
m_multiline_comment_end("*/"),
|
m_multiline_comment_end("*/"),
|
||||||
m_singleline_comment("//")
|
m_singleline_comment("//")
|
||||||
{
|
{
|
||||||
@@ -804,10 +805,9 @@ namespace chaiscript
|
|||||||
*/
|
*/
|
||||||
bool Quoted_String_() {
|
bool Quoted_String_() {
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
char prev_char = 0;
|
|
||||||
if (has_more_input() && (*m_input_pos == '\"')) {
|
if (has_more_input() && (*m_input_pos == '\"')) {
|
||||||
retval = true;
|
retval = true;
|
||||||
prev_char = *m_input_pos;
|
char prev_char = *m_input_pos;
|
||||||
++m_input_pos;
|
++m_input_pos;
|
||||||
++m_col;
|
++m_col;
|
||||||
|
|
||||||
@@ -981,10 +981,9 @@ namespace chaiscript
|
|||||||
*/
|
*/
|
||||||
bool Single_Quoted_String_() {
|
bool Single_Quoted_String_() {
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
char prev_char = 0;
|
|
||||||
if (has_more_input() && (*m_input_pos == '\'')) {
|
if (has_more_input() && (*m_input_pos == '\'')) {
|
||||||
retval = true;
|
retval = true;
|
||||||
prev_char = *m_input_pos;
|
char prev_char = *m_input_pos;
|
||||||
++m_input_pos;
|
++m_input_pos;
|
||||||
++m_col;
|
++m_col;
|
||||||
|
|
||||||
@@ -1350,7 +1349,6 @@ namespace chaiscript
|
|||||||
bool Def() {
|
bool Def() {
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
bool is_annotated = false;
|
bool is_annotated = false;
|
||||||
bool is_method = false;
|
|
||||||
AST_NodePtr annotation;
|
AST_NodePtr annotation;
|
||||||
|
|
||||||
if (Annotation()) {
|
if (Annotation()) {
|
||||||
@@ -1369,6 +1367,8 @@ namespace chaiscript
|
|||||||
throw exception::eval_error("Missing function name in definition", File_Position(m_line, m_col), *m_filename);
|
throw exception::eval_error("Missing function name in definition", File_Position(m_line, m_col), *m_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_method = false;
|
||||||
|
|
||||||
if (Symbol("::", false)) {
|
if (Symbol("::", false)) {
|
||||||
//We're now a method
|
//We're now a method
|
||||||
is_method = true;
|
is_method = true;
|
||||||
|
Reference in New Issue
Block a user