Просмотр исходного кода

Disallow `proc "odin"` procedures to be called in the global scope in variable declarations

gingerBill 1 месяц назад
Родитель
Сommit
b86932c03c
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      src/check_decl.cpp

+ 6 - 0
src/check_decl.cpp

@@ -1851,6 +1851,12 @@ gb_internal void check_entity_decl(CheckerContext *ctx, Entity *e, DeclInfo *d,
 		c.scope = d->scope;
 		c.decl  = d;
 		c.type_level = 0;
+		c.curr_proc_calling_convention = ProcCC_Contextless;
+
+		auto prev_flags = c.scope->flags;
+		defer (c.scope->flags = prev_flags);
+		c.scope->flags &= ~ScopeFlag_ContextDefined;
+
 
 		e->parent_proc_decl = c.curr_proc_decl;
 		e->state = EntityState_InProgress;