Scope to use flags rathers than booleans

This commit is contained in:
gingerBill
2018-06-17 22:22:30 +01:00
parent a4e3201113
commit 877400dd12
6 changed files with 70 additions and 68 deletions
+22 -16
View File
@@ -211,25 +211,31 @@ struct ProcInfo {
enum ScopeFlag {
ScopeFlag_Pkg = 1<<1,
ScopeFlag_Global = 1<<2,
ScopeFlag_File = 1<<3,
ScopeFlag_Init = 1<<4,
ScopeFlag_Proc = 1<<5,
ScopeFlag_Type = 1<<6,
ScopeFlag_HasBeenImported = 1<<10, // This is only applicable to file scopes
};
struct Scope {
Ast * node;
Scope * parent;
Scope * prev, *next;
Scope * first_child;
Scope * last_child;
Map<Entity *> elements; // Key: String
Ast * node;
Scope * parent;
Scope * prev, *next;
Scope * first_child;
Scope * last_child;
Map<Entity *> elements; // Key: String
Array<Ast *> delayed_directives;
Array<Ast *> delayed_imports;
PtrSet<Scope *> imported;
bool is_proc;
bool is_global;
bool is_pkg;
bool is_file;
bool is_init;
bool is_struct;
bool has_been_imported; // This is only applicable to file scopes
Array<Ast *> delayed_directives;
Array<Ast *> delayed_imports;
PtrSet<Scope *> imported;
i32 flags; // ScopeFlag
union {
AstPackage *pkg;
AstFile * file;