aboutsummaryrefslogtreecommitdiff
path: root/src/entity.cpp
diff options
context:
space:
mode:
authorRilleP <rikkypikki@hotmail.com>2024-04-10 19:10:33 +0200
committerGitHub <noreply@github.com>2024-04-10 19:10:33 +0200
commit95a38d5a96322cd9adbb03bd5b7425b93469e62f (patch)
tree8cdc3b962506ddc4b7b1883f0e2ecb9dce54e2f9 /src/entity.cpp
parent239d4e10762a12e96280bd91003acbf2170cadf2 (diff)
parent13e459980b0143b49762cdfd04dd5cf1bbf83daa (diff)
Merge branch 'master' into parsing-package-fixes
Diffstat (limited to 'src/entity.cpp')
-rw-r--r--src/entity.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/entity.cpp b/src/entity.cpp
index e6c46d37e..6cea0930f 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -43,6 +43,7 @@ enum EntityFlag : u64 {
EntityFlag_NoAlias = 1ull<<9,
EntityFlag_TypeField = 1ull<<10,
EntityFlag_Value = 1ull<<11,
+ EntityFlag_BitFieldField = 1ull<<12,
@@ -59,7 +60,7 @@ enum EntityFlag : u64 {
EntityFlag_ProcBodyChecked = 1ull<<21,
EntityFlag_CVarArg = 1ull<<22,
-
+ EntityFlag_NoBroadcast = 1ull<<23,
EntityFlag_AnyInt = 1ull<<24,
EntityFlag_Disabled = 1ull<<25,
@@ -212,6 +213,7 @@ struct Entity {
Ast *init_expr; // only used for some variables within procedure bodies
i32 field_index;
i32 field_group_index;
+ u8 bit_field_bit_size;
ParameterValue param_value;
@@ -227,6 +229,7 @@ struct Entity {
CommentGroup *comment;
bool is_foreign;
bool is_export;
+ bool is_global;
} Variable;
struct {
Type * type_parameter_specialization;
@@ -478,3 +481,25 @@ gb_internal Entity *strip_entity_wrapping(Ast *expr) {
Entity *e = entity_from_expr(expr);
return strip_entity_wrapping(e);
}
+
+
+gb_internal bool is_entity_local_variable(Entity *e) {
+ if (e == nullptr) {
+ return false;
+ }
+ if (e->kind != Entity_Variable) {
+ return false;
+ }
+ if (e->Variable.is_global) {
+ return false;
+ }
+ if (e->scope == nullptr) {
+ return true;
+ }
+ if (e->flags & (EntityFlag_ForValue|EntityFlag_SwitchValue)) {
+ return false;
+ }
+
+ return ((e->scope->flags &~ ScopeFlag_ContextDefined) == 0) ||
+ (e->scope->flags & ScopeFlag_Proc) != 0;
+} \ No newline at end of file