Set variable declaration context
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "elna/source/ast.h"
|
||||
#include "elna/gcc/elna-tree.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
@ -21,8 +22,12 @@ namespace gcc
|
||||
tree current_expression{ NULL_TREE };
|
||||
std::unordered_map<std::string, tree> symbol_map;
|
||||
tree main_fndecl{ NULL_TREE };
|
||||
tree_chain variable_chain;
|
||||
|
||||
tree build_label_decl (const char *name, location_t loc);
|
||||
tree build_label_decl(const char *name, location_t loc);
|
||||
|
||||
void enter_scope();
|
||||
tree_symbol_mapping leave_scope();
|
||||
|
||||
public:
|
||||
void visit(source::program *program) override;
|
||||
|
@ -23,5 +23,36 @@ namespace gcc
|
||||
{
|
||||
void init_ttree();
|
||||
bool is_string_type(tree type);
|
||||
|
||||
class tree_chain_base
|
||||
{
|
||||
protected:
|
||||
tree first{};
|
||||
tree last{};
|
||||
|
||||
public:
|
||||
tree head();
|
||||
void append(tree t);
|
||||
|
||||
protected:
|
||||
virtual void chain(tree t) = 0;
|
||||
};
|
||||
|
||||
class tree_chain final : public tree_chain_base
|
||||
{
|
||||
void chain(tree t) override;
|
||||
};
|
||||
|
||||
class tree_symbol_mapping final
|
||||
{
|
||||
tree m_bind_expression;
|
||||
tree m_block;
|
||||
|
||||
public:
|
||||
tree_symbol_mapping(tree bind_expression, tree block);
|
||||
|
||||
tree bind_expression();
|
||||
tree block();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user