diff --git a/src/checker.cpp b/src/checker.cpp index ef8e39ed9..380872f24 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3012,8 +3012,8 @@ void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array *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 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); diff --git a/src/parser.hpp b/src/parser.hpp index 0804652a3..9a7ddd4b9 100644 --- a/src/parser.hpp +++ b/src/parser.hpp @@ -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;