slightly optimize and refactor

This commit is contained in:
2024-10-23 09:25:13 +00:00
parent c6e529ec0f
commit 77719e07e7
7 changed files with 11 additions and 30 deletions

View File

@ -88,10 +88,7 @@ struct FunctionSchema {
std::vector<std::pair<ExprTypeInfo, std::string>> arguments;
};
class FunctionScope : public ScopeBase {
friend std::shared_ptr<class Program_ASTNode> CheckAndDecorate(std::shared_ptr<class Program_ASTNode> src);
friend class Visitor;
friend class ASTSemanticCheckVisitor;
friend class GlobalScope;
public:
FunctionSchema schema;
bool add_variable([[maybe_unused]] const std::string &name, [[maybe_unused]] const ExprTypeInfo &type) override {
throw std::runtime_error("FunctionScope does not support add_variable");
@ -132,9 +129,7 @@ class FunctionScope : public ScopeBase {
}
};
class ClassDefScope : public ScopeBase {
friend class Visitor;
friend class GlobalScope;
friend std::shared_ptr<Program_ASTNode> CheckAndDecorate(std::shared_ptr<Program_ASTNode> src);
public:
std::unordered_map<std::string, ExprTypeInfo> member_variables;
std::unordered_map<std::string, std::shared_ptr<FunctionScope>> member_functions;
IRClassInfo llvm_class_info;