From 2e8306214338b0c8740d055d345258e68a3bd887 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 9 May 2020 07:24:34 -0700 Subject: [PATCH] Fixed an issue using global variables in method attributes --- IDEHelper/Compiler/BfExprEvaluator.cpp | 2 +- IDEHelper/Compiler/BfModule.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 3464a78d..9acc56bd 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -3148,7 +3148,7 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI } if (!thisValue.HasType()) - thisValue = BfTypedValue(mModule->mCurTypeInstance); + thisValue = BfTypedValue(mModule->mCurTypeInstance); BfTypedValue result = LookupField(identifierNode, thisValue, findName, BfLookupFieldFlag_IsImplicitThis); if (mPropDef != NULL) { diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 38c56291..dff826d0 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -18788,6 +18788,8 @@ void BfModule::GetMethodCustomAttributes(BfMethodInstance* methodInstance) auto propertyMethodDeclaration = methodDef->GetPropertyMethodDeclaration(); auto typeInstance = methodInstance->GetOwner(); + BfTypeState typeState(typeInstance); + SetAndRestoreValue prevTypeState(mContext->mCurTypeState, &typeState); SetAndRestoreValue prevTypeInstance(mCurTypeInstance, typeInstance); SetAndRestoreValue prevMethodInstance(mCurMethodInstance, methodInstance);