From bb66c77da8a4ada2615173d5c4173f8704975d31 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Tue, 3 Dec 2019 08:03:45 -0800 Subject: [PATCH] Fix for Win32 vdata reflection hot swap --- IDE/mintest/src/main3.bf | 31 +++++++++++++----------------- IDEHelper/Compiler/BfIRBuilder.cpp | 6 ++++-- IDEHelper/Compiler/BfIRBuilder.h | 4 ++-- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/IDE/mintest/src/main3.bf b/IDE/mintest/src/main3.bf index 389a54c8..1551f162 100644 --- a/IDE/mintest/src/main3.bf +++ b/IDE/mintest/src/main3.bf @@ -307,28 +307,23 @@ struct Blurg public static int32 Hey() { - Hey2(); - Test(); - Test2(11, 22, 33); - Test3(); - Test4(); - NoFrame.Test(); + while (true) + { + Type t = typeof(Yoofer); + for (let field in t.GetFields()) + { + StringView name = field.Name; + } + } + +#unwarn return (int32)123; } } - -class NoFrame +[Reflect] +struct Yoofer { - public static void Test() - { - //Test_Start - Blurg.Derived dr = .(); - Int iVal = (.)123; - - int q = 999; - - //Test_End - } + int mA; } \ No newline at end of file diff --git a/IDEHelper/Compiler/BfIRBuilder.cpp b/IDEHelper/Compiler/BfIRBuilder.cpp index 4738e082..9525dc71 100644 --- a/IDEHelper/Compiler/BfIRBuilder.cpp +++ b/IDEHelper/Compiler/BfIRBuilder.cpp @@ -1881,7 +1881,7 @@ public: }; #endif -void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine) +void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine) { bool wantDIData = DbgHasInfo() && (!type->IsUnspecializedType()); @@ -1892,6 +1892,8 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine) // wantsDIForwardDecl = false; if (mModule->mExtensionCount != 0) wantsDIForwardDecl = true; + if (forceDbgDefine) + wantsDIForwardDecl = false; bool isPrimEnum = (type->IsEnum()) && (type->IsTypedPrimitive()); @@ -2772,7 +2774,7 @@ bool BfIRBuilder::WantsDbgDefinition(BfType* type) return false; } -void BfIRBuilder::CreateTypeDefinition(BfType* type, bool forceDefine) +void BfIRBuilder::CreateTypeDefinition(BfType* type, bool forceDbgDefine) { // This PopulateType is generally NOT needed, but here is a scenario in which it is: // ClassB derives from ClassA. ClassC uses ClassB. A method inside ClassA gets modified, diff --git a/IDEHelper/Compiler/BfIRBuilder.h b/IDEHelper/Compiler/BfIRBuilder.h index 02da4ca0..e244445e 100644 --- a/IDEHelper/Compiler/BfIRBuilder.h +++ b/IDEHelper/Compiler/BfIRBuilder.h @@ -940,8 +940,8 @@ public: String GetDebugTypeName(BfTypeInstance* typeInstance, bool includeOuterTypeName); void CreateDbgTypeDefinition(BfType* type); bool WantsDbgDefinition(BfType * type); - void CreateTypeDeclaration(BfType* type, bool forceDefine); - void CreateTypeDefinition(BfType* type, bool forceDefine); + void CreateTypeDeclaration(BfType* type, bool forceDbgDefine); + void CreateTypeDefinition(BfType* type, bool forceDbgDefine); void ReplaceDITemporaryTypes(); void PushDbgLoc(BfTypeInstance* typeInst); BfIRPopulateType GetPopulateTypeState(BfType* type);