1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Handled some missing system types better

This commit is contained in:
Brian Fiete 2021-02-16 15:16:32 -08:00
parent a9c82d4125
commit 9163312712
2 changed files with 14 additions and 3 deletions

View file

@ -13833,6 +13833,9 @@ void BfExprEvaluator::CreateObject(BfObjectCreateExpression* objCreateExpr, BfAs
mModule->Fail("Too many array dimensions, consider using a jagged array.", objCreateExpr);
}
if (arrayType == NULL)
return;
if (isAppendAlloc)
arrayValue = BfTypedValue(mModule->AppendAllocFromType(resultType, BfIRValue(), 0, arraySize, (int)dimLengthVals.size(), isRawArrayAlloc, zeroMemory), arrayType);
else

View file

@ -10339,7 +10339,11 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
if ((mCurTypeInstance == NULL) || (!mCurTypeInstance->IsGenericTypeInstance()))
wantGeneric = false;
auto baseDelegateType = ResolveTypeDef(mCompiler->mDelegateTypeDef)->ToTypeInstance();
BfTypeInstance* baseDelegateType = NULL;
if (mCompiler->mDelegateTypeDef != NULL)
baseDelegateType = ResolveTypeDef(mCompiler->mDelegateTypeDef)->ToTypeInstance();
else
failed = true;
BfDelegateInfo* delegateInfo = NULL;
BfTypeInstance* delegateType = NULL;
@ -10386,7 +10390,8 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
Val128 hashContext;
BfTypeDef* typeDef = new BfTypeDef();
typeDef->mProject = baseDelegateType->mTypeDef->mProject;
if (baseDelegateType != NULL)
typeDef->mProject = baseDelegateType->mTypeDef->mProject;
typeDef->mSystem = mCompiler->mSystem;
typeDef->mName = mSystem->mEmptyAtom;
if (delegateTypeRef->mTypeToken->GetToken() == BfToken_Delegate)
@ -10418,9 +10423,12 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
delegateInfo->mDirectAllocNodes.push_back(directTypeRef);
if (typeDef->mIsDelegate)
directTypeRef->Init(delegateType);
else if (mCompiler->mFunctionTypeDef == NULL)
failed = true;
else
directTypeRef->Init(ResolveTypeDef(mCompiler->mFunctionTypeDef));
typeDef->mBaseTypes.push_back(directTypeRef);
if (!failed)
typeDef->mBaseTypes.push_back(directTypeRef);
directTypeRef = BfAstNode::ZeroedAlloc<BfDirectTypeReference>();
delegateInfo->mDirectAllocNodes.push_back(directTypeRef);