Browse Source

Make global scope a class.

search
Danila Fedorin 1 year ago
parent
commit
5e13047846
  1. 32
      code/compiler/13/global_scope.hpp

32
code/compiler/13/global_scope.hpp

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

Loading…
Cancel
Save