From 9030d86562e25ee4b931687f5a0af8fc0d2724fc Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 1 Nov 2021 07:56:45 -0700 Subject: [PATCH] Fixed issues with some decltype statements in type alias decl --- IDEHelper/Compiler/BfModule.cpp | 6 ++++-- IDEHelper/Compiler/BfModuleTypeUtils.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 0c2259cf..a6e4197b 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -2197,7 +2197,7 @@ void BfModule::LocalVariableDone(BfLocalVariable* localVar, bool isMethodExit) bool deferFullAnalysis = mCurMethodState->GetRootMethodState()->mLocalMethodCache.size() != 0; // We may have init blocks that we aren't processing here... - if ((mCurMethodInstance->mIsAutocompleteMethod) && (mCurMethodInstance->mMethodDef->mMethodType == BfMethodType_Ctor)) + if ((mCurMethodInstance != NULL) && (mCurMethodInstance->mIsAutocompleteMethod) && (mCurMethodInstance->mMethodDef->mMethodType == BfMethodType_Ctor)) deferFullAnalysis = true; //bool deferFullAnalysis = true; @@ -14571,6 +14571,8 @@ BfTypeOptions* BfModule::GetTypeOptions() { if ((mCurMethodState != NULL) && (mCurMethodState->mMethodTypeOptions != NULL)) return mCurMethodState->mMethodTypeOptions; + if (mCurMethodInstance == NULL) + return NULL; return mSystem->GetTypeOptions(mCurTypeInstance->mTypeOptionsIdx); } @@ -15123,7 +15125,7 @@ void BfModule::EmitDefaultReturn() } else { - if (mCurMethodInstance->mReturnType->IsVar()) + if ((mCurMethodInstance == NULL) || (mCurMethodInstance->mReturnType->IsVar())) { // Ignore } diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index 43ac2c71..5974b6f8 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -2523,6 +2523,9 @@ void BfModule::DoPopulateType_TypeAlias(BfTypeInstance* typeAlias) auto typeAliasDecl = (BfTypeAliasDeclaration*)typeDef->mTypeDeclaration; BfType* aliasToType = NULL; + if (typeAlias->mBaseType == NULL) + typeAlias->mBaseType = ResolveTypeDef(mCompiler->mValueTypeTypeDef)->ToTypeInstance(); + typeAlias->mDefineState = BfTypeDefineState_ResolvingBaseType; BfTypeState typeState(mCurTypeInstance, mContext->mCurTypeState); typeState.mPopulateType = BfPopulateType_Data;