Make global scope a class.

This commit is contained in:
Danila Fedorin 2020-09-15 19:45:05 -07:00
parent 127f51041b
commit a5597aeae0

View File

@ -40,19 +40,21 @@ struct global_constructor {
using global_constructor_ptr = std::unique_ptr<global_constructor>; using global_constructor_ptr = std::unique_ptr<global_constructor>;
struct global_scope { class global_scope {
std::vector<global_function_ptr> functions; private:
std::vector<global_constructor_ptr> constructors; std::vector<global_function_ptr> functions;
mangler* mng; std::vector<global_constructor_ptr> constructors;
mangler* mng;
global_scope(mangler& m) : mng(&m) {} public:
global_scope(mangler& m) : mng(&m) {}
global_function& add_function( global_function& add_function(
const std::string& n, const std::string& n,
std::vector<std::string> ps, std::vector<std::string> ps,
ast_ptr b); ast_ptr b);
global_constructor& add_constructor(const std::string& n, int8_t t, size_t a); global_constructor& add_constructor(const std::string& n, int8_t t, size_t a);
void compile(); void compile();
void generate_llvm(llvm_context& ctx); void generate_llvm(llvm_context& ctx);
}; };