From 4ee40c8a065f6c47216a99b488b94abf29a01aab Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 25 Dec 2020 12:13:22 -0800 Subject: [PATCH] Disallowed 'self' usage in static section --- IDEHelper/Compiler/BfModuleTypeUtils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index ecf92fa6..906209f3 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -8047,6 +8047,13 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula if ((selfType->IsSpecializedType()) || (selfType->IsUnspecializedTypeVariation())) selfType = ResolveTypeDef(selfType->ToTypeInstance()->mTypeDef, populateType); } + if (selfType != NULL) + { + auto selfTypeInst = selfType->ToTypeInstance(); + if ((selfTypeInst != NULL) && (selfTypeInst->mTypeDef->IsGlobalsContainer())) + selfType = NULL; + } + if (selfType == NULL) { Fail("'Self' type is not usable here", typeRef);