Document symbol bag class and methods
This commit is contained in:
@@ -238,6 +238,17 @@ namespace elna::gcc
|
||||
DECL_EXTERNAL(fndecl) = info.symbols == nullptr;
|
||||
}
|
||||
|
||||
tree declare_variable(const std::string& name, const boot::variable_info& info,
|
||||
std::shared_ptr<symbol_table> symbols)
|
||||
{
|
||||
auto variable_type = get_inner_alias(info.symbol, symbols);
|
||||
tree declaration_tree = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier(name.c_str()), variable_type);
|
||||
|
||||
symbols->enter(name, declaration_tree);
|
||||
|
||||
return declaration_tree;
|
||||
}
|
||||
|
||||
void rewrite_symbol_table(std::shared_ptr<boot::symbol_table> info_table, std::shared_ptr<symbol_table> symbols)
|
||||
{
|
||||
for (auto& [symbol_name, symbol_info] : *info_table)
|
||||
@@ -250,6 +261,10 @@ namespace elna::gcc
|
||||
handle_symbol(symbol_name, alias_type, symbols);
|
||||
}
|
||||
}
|
||||
else if (auto variable_info = symbol_info->is_variable())
|
||||
{
|
||||
declare_variable(symbol_name, *variable_info, symbols);
|
||||
}
|
||||
else if (auto procedure_info = symbol_info->is_procedure())
|
||||
{
|
||||
declare_procedure(symbol_name, *procedure_info, symbols);
|
||||
|
Reference in New Issue
Block a user