mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
[Tolk] Compilation pipeline, register global symbols in advance
Since I've implemented AST, now I can drop forward declarations. Instead, I traverse AST of all files and register global symbols (functions, constants, global vars) as a separate step, in advance. That's why, while converting AST to Expr/Op, all available symbols are already registered. This greatly simplifies "intermediate state" of yet unknown functions and checking them afterward. Redeclaration of local variables (inside the same scope) is now also prohibited.
This commit is contained in:
parent
80001d1756
commit
5a3e3595d6
28 changed files with 1266 additions and 1134 deletions
|
@ -74,12 +74,9 @@ struct CompilerState {
|
|||
std::vector<std::pair<int, SymDef>> symbol_stack;
|
||||
std::vector<SrcLocation> scope_opened_at;
|
||||
|
||||
std::vector<SymDef*> all_code_functions, all_global_vars, all_get_methods, all_constants;
|
||||
AllRegisteredSrcFiles all_src_files;
|
||||
|
||||
int glob_func_cnt = 0, glob_var_cnt = 0, const_cnt = 0;
|
||||
std::vector<SymDef*> glob_func, glob_vars, glob_get_methods;
|
||||
std::set<std::string> prohibited_var_names;
|
||||
|
||||
std::string generated_from;
|
||||
GlobalPragma pragma_allow_post_modification{"allow-post-modification"};
|
||||
GlobalPragma pragma_compute_asm_ltr{"compute-asm-ltr"};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue