mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 13:00:28 +00:00
Minimize Ast flags usage
This commit is contained in:
@@ -3012,8 +3012,8 @@ void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<Ast *> *attr
|
||||
}
|
||||
|
||||
void check_collect_value_decl(CheckerContext *c, Ast *decl) {
|
||||
if (decl->been_handled) return;
|
||||
decl->been_handled = true;
|
||||
if (decl->state_flags & StateFlag_BeenHandled) return;
|
||||
decl->state_flags |= StateFlag_BeenHandled;
|
||||
|
||||
ast_node(vd, ValueDecl, decl);
|
||||
|
||||
@@ -3231,8 +3231,8 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
|
||||
}
|
||||
|
||||
void check_add_foreign_block_decl(CheckerContext *ctx, Ast *decl) {
|
||||
if (decl->been_handled) return;
|
||||
decl->been_handled = true;
|
||||
if (decl->state_flags & StateFlag_BeenHandled) return;
|
||||
decl->state_flags |= StateFlag_BeenHandled;
|
||||
|
||||
ast_node(fb, ForeignBlockDecl, decl);
|
||||
Ast *foreign_library = fb->foreign_library;
|
||||
@@ -3616,8 +3616,8 @@ Array<ImportPathItem> find_import_path(Checker *c, AstPackage *start, AstPackage
|
||||
}
|
||||
#endif
|
||||
void check_add_import_decl(CheckerContext *ctx, Ast *decl) {
|
||||
if (decl->been_handled) return;
|
||||
decl->been_handled = true;
|
||||
if (decl->state_flags & StateFlag_BeenHandled) return;
|
||||
decl->state_flags |= StateFlag_BeenHandled;
|
||||
|
||||
ast_node(id, ImportDecl, decl);
|
||||
Token token = id->relpath;
|
||||
@@ -3731,8 +3731,8 @@ DECL_ATTRIBUTE_PROC(foreign_import_decl_attribute) {
|
||||
}
|
||||
|
||||
void check_add_foreign_import_decl(CheckerContext *ctx, Ast *decl) {
|
||||
if (decl->been_handled) return;
|
||||
decl->been_handled = true;
|
||||
if (decl->state_flags & StateFlag_BeenHandled) return;
|
||||
decl->state_flags |= StateFlag_BeenHandled;
|
||||
|
||||
ast_node(fl, ForeignImportDecl, decl);
|
||||
|
||||
|
||||
@@ -217,14 +217,16 @@ enum ProcCallingConvention {
|
||||
ProcCC_ForeignBlockDefault = -1,
|
||||
};
|
||||
|
||||
enum StateFlag {
|
||||
enum StateFlag : u16 {
|
||||
StateFlag_bounds_check = 1<<0,
|
||||
StateFlag_no_bounds_check = 1<<1,
|
||||
|
||||
StateFlag_no_deferred = 1<<5,
|
||||
|
||||
StateFlag_BeenHandled = 1<<15,
|
||||
};
|
||||
|
||||
enum ViralStateFlag {
|
||||
enum ViralStateFlag : u16 {
|
||||
ViralStateFlag_ContainsDeferredProcedure = 1<<0,
|
||||
};
|
||||
|
||||
@@ -638,9 +640,8 @@ isize const ast_variant_sizes[] = {
|
||||
|
||||
struct AstCommonStuff {
|
||||
AstKind kind;
|
||||
u32 state_flags;
|
||||
u32 viral_state_flags;
|
||||
bool been_handled;
|
||||
u16 state_flags;
|
||||
u16 viral_state_flags;
|
||||
AstFile * file;
|
||||
Scope * scope;
|
||||
TypeAndValue tav;
|
||||
@@ -648,9 +649,8 @@ struct AstCommonStuff {
|
||||
|
||||
struct Ast {
|
||||
AstKind kind;
|
||||
u32 state_flags;
|
||||
u32 viral_state_flags;
|
||||
bool been_handled;
|
||||
u16 state_flags;
|
||||
u16 viral_state_flags;
|
||||
AstFile * file;
|
||||
Scope * scope;
|
||||
TypeAndValue tav;
|
||||
|
||||
Reference in New Issue
Block a user