some initialization and destructor cleanups
This commit is contained in:
parent
08a68f310a
commit
4bf619c80f
@ -418,11 +418,9 @@ namespace chaiscript
|
|||||||
std::vector<std::pair<std::string, Boxed_Value>> m_boxed_functions;
|
std::vector<std::pair<std::string, Boxed_Value>> m_boxed_functions;
|
||||||
std::map<std::string, Boxed_Value> m_global_objects;
|
std::map<std::string, Boxed_Value> m_global_objects;
|
||||||
Type_Name_Map m_types;
|
Type_Name_Map m_types;
|
||||||
std::set<std::string> m_reserved_words;
|
std::set<std::string> m_reserved_words
|
||||||
|
= {"def", "fun", "while", "for", "if", "else", "&&", "||", ",", "auto",
|
||||||
State &operator=(const State &) = default;
|
"return", "break", "true", "false", "class", "attr", "var", "global", "GLOBAL", "_"};
|
||||||
State() = default;
|
|
||||||
State(const State &) = default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Dispatch_Engine()
|
Dispatch_Engine()
|
||||||
@ -430,10 +428,6 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~Dispatch_Engine()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \brief casts an object while applying any Dynamic_Conversion available
|
/// \brief casts an object while applying any Dynamic_Conversion available
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
typename detail::Cast_Helper<Type>::Result_Type boxed_cast(const Boxed_Value &bv) const
|
typename detail::Cast_Helper<Type>::Result_Type boxed_cast(const Boxed_Value &bv) const
|
||||||
@ -892,12 +886,6 @@ namespace chaiscript
|
|||||||
return rets;
|
return rets;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_reserved_word(const std::string &name)
|
|
||||||
{
|
|
||||||
chaiscript::detail::threading::unique_lock<chaiscript::detail::threading::shared_mutex> l(m_mutex);
|
|
||||||
|
|
||||||
m_state.m_reserved_words.insert(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Type_Conversions &conversions() const
|
const Type_Conversions &conversions() const
|
||||||
{
|
{
|
||||||
|
@ -513,7 +513,10 @@ namespace chaiscript
|
|||||||
std::replace(children.begin(), children.end(), t_child, t_new_child);
|
std::replace(children.begin(), children.end(), t_child, t_new_child);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~AST_Node() {}
|
virtual ~AST_Node() = default;
|
||||||
|
AST_Node(AST_Node &&) = default;
|
||||||
|
AST_Node &operator=(AST_Node &&) = default;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AST_Node(std::string t_ast_node_text, AST_Node_Type t_id, Parse_Location t_loc,
|
AST_Node(std::string t_ast_node_text, AST_Node_Type t_id, Parse_Location t_loc,
|
||||||
@ -563,6 +566,8 @@ namespace chaiscript
|
|||||||
/// Creates a new scope then pops it on destruction
|
/// Creates a new scope then pops it on destruction
|
||||||
struct Scope_Push_Pop
|
struct Scope_Push_Pop
|
||||||
{
|
{
|
||||||
|
Scope_Push_Pop(Scope_Push_Pop &&) = default;
|
||||||
|
Scope_Push_Pop& operator=(Scope_Push_Pop &&) = default;
|
||||||
Scope_Push_Pop(const Scope_Push_Pop &) = delete;
|
Scope_Push_Pop(const Scope_Push_Pop &) = delete;
|
||||||
Scope_Push_Pop& operator=(const Scope_Push_Pop &) = delete;
|
Scope_Push_Pop& operator=(const Scope_Push_Pop &) = delete;
|
||||||
|
|
||||||
@ -585,6 +590,8 @@ namespace chaiscript
|
|||||||
/// Creates a new function call and pops it on destruction
|
/// Creates a new function call and pops it on destruction
|
||||||
struct Function_Push_Pop
|
struct Function_Push_Pop
|
||||||
{
|
{
|
||||||
|
Function_Push_Pop(Function_Push_Pop &&) = default;
|
||||||
|
Function_Push_Pop& operator=(Function_Push_Pop &&) = default;
|
||||||
Function_Push_Pop(const Function_Push_Pop &) = delete;
|
Function_Push_Pop(const Function_Push_Pop &) = delete;
|
||||||
Function_Push_Pop& operator=(const Function_Push_Pop &) = delete;
|
Function_Push_Pop& operator=(const Function_Push_Pop &) = delete;
|
||||||
|
|
||||||
@ -617,6 +624,8 @@ namespace chaiscript
|
|||||||
/// Creates a new scope then pops it on destruction
|
/// Creates a new scope then pops it on destruction
|
||||||
struct Stack_Push_Pop
|
struct Stack_Push_Pop
|
||||||
{
|
{
|
||||||
|
Stack_Push_Pop(Stack_Push_Pop &&) = default;
|
||||||
|
Stack_Push_Pop& operator=(Stack_Push_Pop &&) = default;
|
||||||
Stack_Push_Pop(const Stack_Push_Pop &) = delete;
|
Stack_Push_Pop(const Stack_Push_Pop &) = delete;
|
||||||
Stack_Push_Pop& operator=(const Stack_Push_Pop &) = delete;
|
Stack_Push_Pop& operator=(const Stack_Push_Pop &) = delete;
|
||||||
|
|
||||||
|
@ -128,27 +128,6 @@ namespace chaiscript
|
|||||||
|
|
||||||
/// Builds all the requirements for ChaiScript, including its evaluator and a run of its prelude.
|
/// Builds all the requirements for ChaiScript, including its evaluator and a run of its prelude.
|
||||||
void build_eval_system(const ModulePtr &t_lib) {
|
void build_eval_system(const ModulePtr &t_lib) {
|
||||||
m_engine.add_reserved_word("def");
|
|
||||||
m_engine.add_reserved_word("fun");
|
|
||||||
m_engine.add_reserved_word("while");
|
|
||||||
m_engine.add_reserved_word("for");
|
|
||||||
m_engine.add_reserved_word("if");
|
|
||||||
m_engine.add_reserved_word("else");
|
|
||||||
m_engine.add_reserved_word("&&");
|
|
||||||
m_engine.add_reserved_word("||");
|
|
||||||
m_engine.add_reserved_word(",");
|
|
||||||
m_engine.add_reserved_word("auto");
|
|
||||||
m_engine.add_reserved_word("return");
|
|
||||||
m_engine.add_reserved_word("break");
|
|
||||||
m_engine.add_reserved_word("true");
|
|
||||||
m_engine.add_reserved_word("false");
|
|
||||||
m_engine.add_reserved_word("class");
|
|
||||||
m_engine.add_reserved_word("attr");
|
|
||||||
m_engine.add_reserved_word("var");
|
|
||||||
m_engine.add_reserved_word("global");
|
|
||||||
m_engine.add_reserved_word("GLOBAL");
|
|
||||||
m_engine.add_reserved_word("_");
|
|
||||||
|
|
||||||
if (t_lib)
|
if (t_lib)
|
||||||
{
|
{
|
||||||
add(t_lib);
|
add(t_lib);
|
||||||
|
@ -24,8 +24,10 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DLModule(const DLModule &); // Explicitly unimplemented copy constructor
|
DLModule(DLModule &&) = default;
|
||||||
DLModule &operator=(const DLModule &); // Explicitly unimplemented assignment operator
|
DLModule &operator=(DLModule &&) = default;
|
||||||
|
DLModule(const DLModule &) = delete;
|
||||||
|
DLModule &operator=(const DLModule &) = delete;
|
||||||
|
|
||||||
~DLModule()
|
~DLModule()
|
||||||
{
|
{
|
||||||
|
@ -89,6 +89,11 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DLModule(DLModule &&) = default;
|
||||||
|
DLModule &operator=(DLModule &&) = default;
|
||||||
|
DLModule(const DLModule &) = delete;
|
||||||
|
DLModule &operator=(const DLModule &) = delete;
|
||||||
|
|
||||||
~DLModule()
|
~DLModule()
|
||||||
{
|
{
|
||||||
FreeLibrary(m_data);
|
FreeLibrary(m_data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user