Merge branch 'AddMoreWarningFlags' into develop
Conflicts: include/chaiscript/dispatchkit/boxed_number.hpp include/chaiscript/dispatchkit/proxy_functions.hpp include/chaiscript/language/chaiscript_eval.hpp
This commit is contained in:
@@ -112,6 +112,8 @@ namespace chaiscript
|
||||
reason(t_why)
|
||||
{}
|
||||
|
||||
eval_error(const eval_error &) = default;
|
||||
|
||||
std::string pretty_print() const
|
||||
{
|
||||
std::ostringstream ss;
|
||||
@@ -395,6 +397,7 @@ namespace chaiscript
|
||||
: std::runtime_error("File Not Found: " + t_filename)
|
||||
{ }
|
||||
|
||||
file_not_found_error(const file_not_found_error &) = default;
|
||||
virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT {}
|
||||
};
|
||||
|
||||
|
@@ -61,9 +61,8 @@ namespace chaiscript
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~load_module_error() CHAISCRIPT_NOEXCEPT
|
||||
{
|
||||
}
|
||||
load_module_error(const load_module_error &) = default;
|
||||
virtual ~load_module_error() CHAISCRIPT_NOEXCEPT {}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -371,10 +370,10 @@ namespace chaiscript
|
||||
m_engine.add(fun(&ChaiScript::internal_eval, this), "eval");
|
||||
m_engine.add(fun(&ChaiScript::internal_eval_ast, this), "eval");
|
||||
|
||||
m_engine.add(fun(&ChaiScript::version_major, this), "version_major");
|
||||
m_engine.add(fun(&ChaiScript::version_minor, this), "version_minor");
|
||||
m_engine.add(fun(&ChaiScript::version_patch, this), "version_patch");
|
||||
m_engine.add(fun(&ChaiScript::version, this), "version");
|
||||
m_engine.add(fun(&ChaiScript::version_major), "version_major");
|
||||
m_engine.add(fun(&ChaiScript::version_minor), "version_minor");
|
||||
m_engine.add(fun(&ChaiScript::version_patch), "version_patch");
|
||||
m_engine.add(fun(&ChaiScript::version), "version");
|
||||
|
||||
m_engine.add(fun(&ChaiScript::add_global_const, this), "add_global_const");
|
||||
m_engine.add(fun(&ChaiScript::add_global, this), "add_global");
|
||||
@@ -491,22 +490,22 @@ namespace chaiscript
|
||||
build_eval_system(ModulePtr());
|
||||
}
|
||||
|
||||
int version_major() const
|
||||
static int version_major()
|
||||
{
|
||||
return chaiscript::version_major;
|
||||
}
|
||||
|
||||
int version_minor() const
|
||||
static int version_minor()
|
||||
{
|
||||
return chaiscript::version_minor;
|
||||
}
|
||||
|
||||
int version_patch() const
|
||||
static int version_patch()
|
||||
{
|
||||
return chaiscript::version_patch;
|
||||
}
|
||||
|
||||
std::string version() const
|
||||
static std::string version()
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << version_major() << "." << version_minor() << "." << version_patch();
|
||||
@@ -605,7 +604,7 @@ namespace chaiscript
|
||||
/// chaiscript::ChaiScript chai;
|
||||
/// chaiscript::ChaiScript::State s = chai.get_state(); // represents bootstrapped initial state
|
||||
/// \endcode
|
||||
State get_state()
|
||||
State get_state() const
|
||||
{
|
||||
chaiscript::detail::threading::lock_guard<chaiscript::detail::threading::recursive_mutex> l(m_use_mutex);
|
||||
chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l2(m_mutex);
|
||||
|
@@ -1380,30 +1380,29 @@ namespace chaiscript
|
||||
|
||||
AST_NodePtr guardnode;
|
||||
|
||||
auto d = t_ss.get_parent_locals();
|
||||
auto itr = d.find("_current_class_name");
|
||||
int class_offset = 0;
|
||||
if (itr != d.end()) class_offset = -1;
|
||||
const auto d = t_ss.get_parent_locals();
|
||||
const auto itr = d.find("_current_class_name");
|
||||
const auto class_offset = (itr != d.end())?-1:0;
|
||||
const std::string & class_name = (itr != d.end())?std::string(boxed_cast<std::string>(itr->second)):this->children[0]->text;
|
||||
|
||||
//The first param of a method is always the implied this ptr.
|
||||
std::vector<std::string> t_param_names{"this"};
|
||||
dispatch::Param_Types param_types;
|
||||
|
||||
if ((this->children.size() > static_cast<size_t>(3 + class_offset)) && (this->children[(2 + class_offset)]->identifier == AST_Node_Type::Arg_List)) {
|
||||
auto args = Arg_List_AST_Node::get_arg_names(this->children[(2 + class_offset)]);
|
||||
if ((this->children.size() > static_cast<size_t>(3 + class_offset)) && (this->children[static_cast<size_t>(2 + class_offset)]->identifier == AST_Node_Type::Arg_List)) {
|
||||
auto args = Arg_List_AST_Node::get_arg_names(this->children[static_cast<size_t>(2 + class_offset)]);
|
||||
t_param_names.insert(t_param_names.end(), args.begin(), args.end());
|
||||
param_types = Arg_List_AST_Node::get_arg_types(this->children[(2 + class_offset)], t_ss);
|
||||
param_types = Arg_List_AST_Node::get_arg_types(this->children[static_cast<size_t>(2 + class_offset)], t_ss);
|
||||
|
||||
if (this->children.size() > static_cast<size_t>(4 + class_offset)) {
|
||||
guardnode = this->children[(3 + class_offset)];
|
||||
guardnode = this->children[static_cast<size_t>(3 + class_offset)];
|
||||
}
|
||||
}
|
||||
else {
|
||||
//no parameters
|
||||
|
||||
if (this->children.size() > static_cast<size_t>(3 + class_offset)) {
|
||||
guardnode = this->children[(2 + class_offset)];
|
||||
guardnode = this->children[static_cast<size_t>(2 + class_offset)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1420,7 +1419,7 @@ namespace chaiscript
|
||||
try {
|
||||
const std::string & l_annotation = this->annotation?this->annotation->text:"";
|
||||
|
||||
const std::string & function_name = this->children[(1 + class_offset)]->text;
|
||||
const std::string & function_name = this->children[static_cast<size_t>(1 + class_offset)]->text;
|
||||
|
||||
if (function_name == class_name) {
|
||||
param_types.push_front(class_name, Type_Info());
|
||||
@@ -1474,24 +1473,23 @@ namespace chaiscript
|
||||
{
|
||||
const auto &d = t_ss.get_parent_locals();
|
||||
const auto itr = d.find("_current_class_name");
|
||||
int class_offset = 0;
|
||||
if (itr != d.end()) class_offset = -1;
|
||||
const auto class_offset = (itr != d.end())?-1:0;
|
||||
std::string class_name = (itr != d.end())?std::string(boxed_cast<std::string>(itr->second)):this->children[0]->text;
|
||||
|
||||
try {
|
||||
t_ss.add(
|
||||
std::make_shared<dispatch::detail::Dynamic_Object_Function>(
|
||||
class_name,
|
||||
std::move(class_name),
|
||||
fun(std::function<Boxed_Value (dispatch::Dynamic_Object &)>(std::bind(&dispatch::Dynamic_Object::get_attr,
|
||||
std::placeholders::_1,
|
||||
this->children[(1 + class_offset)]->text
|
||||
this->children[static_cast<size_t>(1 + class_offset)]->text
|
||||
))
|
||||
)
|
||||
), this->children[(1 + class_offset)]->text);
|
||||
), this->children[static_cast<size_t>(1 + class_offset)]->text);
|
||||
|
||||
}
|
||||
catch (const exception::reserved_word_error &) {
|
||||
throw exception::eval_error("Reserved word used as attribute '" + this->children[(1 + class_offset)]->text + "'");
|
||||
throw exception::eval_error("Reserved word used as attribute '" + this->children[static_cast<size_t>(1 + class_offset)]->text + "'");
|
||||
} catch (const exception::name_conflict_error &e) {
|
||||
throw exception::eval_error("Attribute redefined '" + e.name() + "'");
|
||||
}
|
||||
|
@@ -223,8 +223,8 @@ namespace chaiscript
|
||||
t_t->end.column = pos_col_stop;
|
||||
|
||||
if (is_deep) {
|
||||
t_t->children.assign(m_match_stack.begin() + t_match_start, m_match_stack.end());
|
||||
m_match_stack.erase(m_match_stack.begin() + t_match_start, m_match_stack.end());
|
||||
t_t->children.assign(m_match_stack.begin() + static_cast<int>(t_match_start), m_match_stack.end());
|
||||
m_match_stack.erase(m_match_stack.begin() + static_cast<int>(t_match_start), m_match_stack.end());
|
||||
}
|
||||
|
||||
/// \todo fix the fact that a successful match that captured no ast_nodes doesn't have any real start position
|
||||
@@ -1956,6 +1956,7 @@ namespace chaiscript
|
||||
case(AST_Node_Type::Bitwise_Xor) :
|
||||
case(AST_Node_Type::Bitwise_Or) :
|
||||
case(AST_Node_Type::Comparison) :
|
||||
assert(m_match_stack.size() > 1);
|
||||
m_match_stack.erase(m_match_stack.begin() + m_match_stack.size() - 2, m_match_stack.begin() + m_match_stack.size() - 1);
|
||||
build_match(std::make_shared<eval::Binary_Operator_AST_Node>(oper->text), prev_stack_top);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user