Get mutlifile compilation working again and add a test for it
This commit is contained in:
parent
bff5b8bce0
commit
67bad374a9
@ -136,6 +136,11 @@ IF(BUILD_TESTING)
|
||||
target_link_libraries(boxed_cast_test ${LIBS})
|
||||
add_test(NAME Boxed_Cast_Test COMMAND boxed_cast_test)
|
||||
|
||||
add_executable(multifile_test unittests/multifile_test_main.cpp unittests/multifile_test_chai.cpp
|
||||
unittests/multifile_test_module.cpp)
|
||||
target_link_libraries(multifile_test ${LIBS})
|
||||
add_test(NAME MultiFile_Test COMMAND multifile_test)
|
||||
|
||||
add_library(test_module MODULE src/test_module.cpp)
|
||||
target_link_libraries(test_module ${LIBS})
|
||||
|
||||
|
@ -251,7 +251,7 @@ namespace chaiscript
|
||||
return dynamic_cast_converts(user_type<Base>(), user_type<Derived>());
|
||||
}
|
||||
|
||||
bool dynamic_cast_converts(const Type_Info &base, const Type_Info &derived)
|
||||
static bool dynamic_cast_converts(const Type_Info &base, const Type_Info &derived)
|
||||
{
|
||||
return detail::Dynamic_Conversions::get().has_conversion(base, derived);
|
||||
}
|
||||
|
@ -117,332 +117,8 @@ namespace chaiscript
|
||||
}
|
||||
};
|
||||
|
||||
struct Binary_Operator_AST_Node : public AST_Node {
|
||||
public:
|
||||
Binary_Operator_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Xor, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Binary_Operator_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
|
||||
struct Error_AST_Node : public AST_Node {
|
||||
public:
|
||||
Error_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Error, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
|
||||
virtual ~Error_AST_Node() {}
|
||||
};
|
||||
struct Int_AST_Node : public AST_Node {
|
||||
public:
|
||||
Int_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Int, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Int_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Float_AST_Node : public AST_Node {
|
||||
public:
|
||||
Float_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Float, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Float_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Id_AST_Node : public AST_Node {
|
||||
public:
|
||||
Id_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Id, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Id_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Char_AST_Node : public AST_Node {
|
||||
public:
|
||||
Char_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Char, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Char_AST_Node() {}
|
||||
};
|
||||
struct Str_AST_Node : public AST_Node {
|
||||
public:
|
||||
Str_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Str, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Str_AST_Node() {}
|
||||
};
|
||||
struct Eol_AST_Node : public AST_Node {
|
||||
public:
|
||||
Eol_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Eol, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Eol_AST_Node() {}
|
||||
};
|
||||
struct Fun_Call_AST_Node : public AST_Node {
|
||||
public:
|
||||
Fun_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Fun_Call, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Fun_Call_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Inplace_Fun_Call_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inplace_Fun_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inplace_Fun_Call, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Inplace_Fun_Call_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Arg_List_AST_Node : public AST_Node {
|
||||
public:
|
||||
Arg_List_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Arg_List, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Arg_List_AST_Node() {}
|
||||
};
|
||||
struct Variable_AST_Node : public AST_Node {
|
||||
public:
|
||||
Variable_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Variable, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Variable_AST_Node() {}
|
||||
};
|
||||
struct Equation_AST_Node : public AST_Node {
|
||||
public:
|
||||
Equation_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Equation, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Equation_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Var_Decl_AST_Node : public AST_Node {
|
||||
public:
|
||||
Var_Decl_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Var_Decl, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Var_Decl_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Comparison_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Comparison_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Comparison, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Comparison_AST_Node() {}
|
||||
};
|
||||
struct Additive_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Additive_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Additive, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Additive_AST_Node() {}
|
||||
};
|
||||
struct Multiplicative_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Multiplicative_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Multiplicative, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Multiplicative_AST_Node() {}
|
||||
};
|
||||
struct Array_Call_AST_Node : public AST_Node {
|
||||
public:
|
||||
Array_Call_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Array_Call, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Array_Call_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Dot_Access_AST_Node : public AST_Node {
|
||||
public:
|
||||
Dot_Access_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Dot_Access, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Dot_Access_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Quoted_String_AST_Node : public AST_Node {
|
||||
public:
|
||||
Quoted_String_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Quoted_String, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Quoted_String_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Single_Quoted_String_AST_Node : public AST_Node {
|
||||
public:
|
||||
Single_Quoted_String_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Single_Quoted_String, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Single_Quoted_String_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Lambda_AST_Node : public AST_Node {
|
||||
public:
|
||||
Lambda_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Lambda, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Lambda_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Block_AST_Node : public AST_Node {
|
||||
public:
|
||||
Block_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Block, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Block_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Def_AST_Node : public AST_Node {
|
||||
public:
|
||||
Def_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Def, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Def_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct While_AST_Node : public AST_Node {
|
||||
public:
|
||||
While_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::While, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~While_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct If_AST_Node : public AST_Node {
|
||||
public:
|
||||
If_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::If, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~If_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct For_AST_Node : public AST_Node {
|
||||
public:
|
||||
For_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::For, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~For_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Inline_Array_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inline_Array_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Array, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Inline_Array_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Inline_Map_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inline_Map_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Map, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Inline_Map_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Return_AST_Node : public AST_Node {
|
||||
public:
|
||||
Return_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Return, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Return_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct File_AST_Node : public AST_Node {
|
||||
public:
|
||||
File_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::File, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~File_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Prefix_AST_Node : public AST_Node {
|
||||
public:
|
||||
Prefix_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Prefix, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Prefix_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Break_AST_Node : public AST_Node {
|
||||
public:
|
||||
Break_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Break, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Break_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Map_Pair_AST_Node : public AST_Node {
|
||||
public:
|
||||
Map_Pair_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Map_Pair, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Map_Pair_AST_Node() {}
|
||||
};
|
||||
struct Value_Range_AST_Node : public AST_Node {
|
||||
public:
|
||||
Value_Range_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Value_Range, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Value_Range_AST_Node() {}
|
||||
};
|
||||
struct Inline_Range_AST_Node : public AST_Node {
|
||||
public:
|
||||
Inline_Range_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Inline_Range, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Inline_Range_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Annotation_AST_Node : public AST_Node {
|
||||
public:
|
||||
Annotation_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Annotation, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Annotation_AST_Node() {}
|
||||
};
|
||||
struct Try_AST_Node : public AST_Node {
|
||||
public:
|
||||
Try_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Try, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Try_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Catch_AST_Node : public AST_Node {
|
||||
public:
|
||||
Catch_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Catch, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Catch_AST_Node() {}
|
||||
};
|
||||
struct Finally_AST_Node : public AST_Node {
|
||||
public:
|
||||
Finally_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Finally, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Finally_AST_Node() {}
|
||||
};
|
||||
struct Method_AST_Node : public AST_Node {
|
||||
public:
|
||||
Method_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Method, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Method_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Attr_Decl_AST_Node : public AST_Node {
|
||||
public:
|
||||
Attr_Decl_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Attr_Decl, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Attr_Decl_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Shift_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Shift_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Shift, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Shift_AST_Node() {}
|
||||
};
|
||||
struct Equality_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Equality_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Equality, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Equality_AST_Node() {}
|
||||
};
|
||||
struct Bitwise_And_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Bitwise_And_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_And, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Bitwise_And_AST_Node() {}
|
||||
};
|
||||
struct Bitwise_Xor_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Bitwise_Xor_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Xor, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Bitwise_Xor_AST_Node() {}
|
||||
};
|
||||
struct Bitwise_Or_AST_Node : public Binary_Operator_AST_Node {
|
||||
public:
|
||||
Bitwise_Or_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Bitwise_Or, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
Binary_Operator_AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Bitwise_Or_AST_Node() {}
|
||||
};
|
||||
struct Logical_And_AST_Node : public AST_Node {
|
||||
public:
|
||||
Logical_And_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Logical_And, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Logical_And_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
struct Logical_Or_AST_Node : public AST_Node {
|
||||
public:
|
||||
Logical_Or_AST_Node(const std::string &ast_node_text = "", int id = AST_Node_Type::Logical_Or, const char *fname = NULL, int start_line = 0, int start_col = 0, int end_line = 0, int end_col = 0) :
|
||||
AST_Node(ast_node_text, id, fname, start_line, start_col, end_line, end_col) { }
|
||||
virtual ~Logical_Or_AST_Node() {}
|
||||
virtual Boxed_Value eval(Dispatch_Engine &ss);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Errors generated during parsing or evaluation
|
||||
|
File diff suppressed because it is too large
Load Diff
12
unittests/multifile_test_chai.cpp
Normal file
12
unittests/multifile_test_chai.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "multifile_test_chai.hpp"
|
||||
|
||||
Multi_Test_Chai::Multi_Test_Chai()
|
||||
: m_chai(new chaiscript::ChaiScript())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
boost::shared_ptr<chaiscript::ChaiScript> Multi_Test_Chai::get_chai()
|
||||
{
|
||||
return m_chai;
|
||||
}
|
14
unittests/multifile_test_chai.hpp
Normal file
14
unittests/multifile_test_chai.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <chaiscript/chaiscript.hpp>
|
||||
|
||||
class Multi_Test_Chai
|
||||
{
|
||||
public:
|
||||
Multi_Test_Chai();
|
||||
|
||||
boost::shared_ptr<chaiscript::ChaiScript> get_chai();
|
||||
|
||||
private:
|
||||
boost::shared_ptr<chaiscript::ChaiScript> m_chai;
|
||||
};
|
||||
|
||||
|
14
unittests/multifile_test_main.cpp
Normal file
14
unittests/multifile_test_main.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "multifile_test_chai.hpp"
|
||||
#include "multifile_test_module.hpp"
|
||||
|
||||
#include <chaiscript/chaiscript.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
Multi_Test_Chai chaitest;
|
||||
Multi_Test_Module chaimodule;
|
||||
|
||||
boost::shared_ptr<chaiscript::ChaiScript> chai = chaitest.get_chai();
|
||||
chai->add(chaimodule.get_module());
|
||||
return chai->eval<int>("get_module_value()");
|
||||
}
|
21
unittests/multifile_test_module.cpp
Normal file
21
unittests/multifile_test_module.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <chaiscript/chaiscript.hpp>
|
||||
|
||||
#include "multifile_test_module.hpp"
|
||||
|
||||
Multi_Test_Module::Multi_Test_Module()
|
||||
{
|
||||
}
|
||||
|
||||
int Multi_Test_Module::get_module_value()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
chaiscript::ModulePtr Multi_Test_Module::get_module()
|
||||
{
|
||||
chaiscript::ModulePtr module(new chaiscript::Module());
|
||||
|
||||
module->add(chaiscript::fun(&Multi_Test_Module::get_module_value), "get_module_value");
|
||||
|
||||
return module;
|
||||
}
|
11
unittests/multifile_test_module.hpp
Normal file
11
unittests/multifile_test_module.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <chaiscript/chaiscript.hpp>
|
||||
|
||||
class Multi_Test_Module
|
||||
{
|
||||
public:
|
||||
static int get_module_value();
|
||||
|
||||
Multi_Test_Module();
|
||||
|
||||
chaiscript::ModulePtr get_module();
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user