mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-25 08:18:43 +00:00
abstract type graph added to symbol table
This commit is contained in:
parent
25355974a2
commit
3c643d2759
8 changed files with 845 additions and 16 deletions
|
|
@ -47,9 +47,9 @@ void FindSymbolsVisitor::Visit(Namespace* node) {
|
|||
name = node->name.value().name;
|
||||
}
|
||||
|
||||
global_info_.AddEnterNamespace(node->type, modifier, name);
|
||||
namespace_visitor_.AddEnterNamespace(node->type, modifier, name);
|
||||
Visit(node->scope.get());
|
||||
global_info_.ExitNamespace();
|
||||
namespace_visitor_.ExitNamespace();
|
||||
}
|
||||
|
||||
// Definitions -----------------
|
||||
|
|
@ -60,7 +60,7 @@ void FindSymbolsVisitor::Visit(ImportStatement* node) {
|
|||
info::ImportInfo info;
|
||||
info.module_name = node->module_name;
|
||||
info.symbols = node->symbols;
|
||||
global_info_.AddImport(std::move(info), node->name);
|
||||
namespace_visitor_.AddImport(std::move(info), node->name);
|
||||
|
||||
is_in_statement = false;
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ void FindSymbolsVisitor::Visit(AliasDefinitionStatement* node) {
|
|||
|
||||
info.type = std::move(alias_info);
|
||||
|
||||
global_info_.AddType(node->type, std::move(info));
|
||||
node->type_id_ = namespace_visitor_.AddType(node->type, std::move(info));
|
||||
|
||||
is_in_statement = false;
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ void FindSymbolsVisitor::Visit(FunctionDeclaration* node) {
|
|||
if (was_in_statement) {
|
||||
current_info_ = std::move(info);
|
||||
} else {
|
||||
global_info_.AddFunctionDeclaration(node->name, std::move(info));
|
||||
node->function_id_ = namespace_visitor_.AddFunctionDeclaration(node->name, std::move(info));
|
||||
is_in_statement = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ void FindSymbolsVisitor::Visit(FunctionDefinitionStatement* node) {
|
|||
|
||||
info.expression = &node->value;
|
||||
|
||||
global_info_.AddFunctionDefinition(definition->name, std::move(info));
|
||||
node->function_id_ = namespace_visitor_.AddFunctionDefinition(definition->name, std::move(info));
|
||||
|
||||
is_in_statement = false;
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ void FindSymbolsVisitor::Visit(TypeDefinitionStatement* node) {
|
|||
|
||||
info.type = std::move(any_type_info);
|
||||
|
||||
global_info_.AddType(type, std::move(info));
|
||||
node->type_id_ = namespace_visitor_.AddType(type, std::move(info));
|
||||
|
||||
is_in_statement = false;
|
||||
}
|
||||
|
|
@ -202,7 +202,7 @@ void FindSymbolsVisitor::Visit(AbstractTypeDefinitionStatement* node) {
|
|||
|
||||
info.type = std::move(abstract_type_info);
|
||||
|
||||
global_info_.AddType(type, std::move(info));
|
||||
node->type_id_ = namespace_visitor_.AddType(type, std::move(info));
|
||||
|
||||
is_in_statement = false;
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ void FindSymbolsVisitor::Visit(TypeclassDefinitionStatement* node) {
|
|||
current_info_.reset();
|
||||
}
|
||||
|
||||
global_info_.AddTypeclass(definition->type.get()->type, std::move(info));
|
||||
node->typeclass_id_ = namespace_visitor_.AddTypeclass(definition->type.get()->type, std::move(info));
|
||||
|
||||
is_in_statement = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue