1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

Fixed splat issue with opaque types

This commit is contained in:
Brian Fiete 2021-02-24 06:02:17 -08:00
parent 4e3442d437
commit a3c4c479fc
2 changed files with 11 additions and 1 deletions

View file

@ -4386,6 +4386,10 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
// handle embedded methodRefs // handle embedded methodRefs
hadNonSplattable = true; hadNonSplattable = true;
} }
else if (checkType->IsOpaque())
{
hadNonSplattable = true;
}
else if (checkType->IsStruct()) else if (checkType->IsStruct())
{ {
auto checkTypeInstance = checkType->ToTypeInstance(); auto checkTypeInstance = checkType->ToTypeInstance();
@ -4418,6 +4422,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
{ {
if (checkType->IsSizedArray()) if (checkType->IsSizedArray())
hadNonSplattable = true; hadNonSplattable = true;
dataCount += checkType->GetSplatCount(); dataCount += checkType->GetSplatCount();
} }
}; };
@ -4438,6 +4443,8 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
} }
if (typeInstance->IsTypedPrimitive()) if (typeInstance->IsTypedPrimitive())
typeInstance->mIsSplattable = true; typeInstance->mIsSplattable = true;
if (typeInstance->mTypeDef->mIsOpaque)
typeInstance->mIsSplattable = false;
BF_ASSERT(mContext->mCurTypeState == &typeState); BF_ASSERT(mContext->mCurTypeState == &typeState);
@ -8651,6 +8658,7 @@ void BfModule::TypeRefNotFound(BfTypeReference* typeRef, const char* appendName)
if (typeRef->IsTemporary()) if (typeRef->IsTemporary())
return; return;
if (PreFail())
Fail("Type could not be found (are you missing a using directive or library reference?)", typeRef); Fail("Type could not be found (are you missing a using directive or library reference?)", typeRef);
if (!mIgnoreErrors) if (!mIgnoreErrors)

View file

@ -554,6 +554,7 @@ public:
virtual bool IsFunctionFromTypeRef() { return false; } virtual bool IsFunctionFromTypeRef() { return false; }
virtual BfDelegateInfo* GetDelegateInfo() { return NULL; } virtual BfDelegateInfo* GetDelegateInfo() { return NULL; }
virtual bool IsValueType() { return false; } virtual bool IsValueType() { return false; }
virtual bool IsOpaque() { return false; }
virtual bool IsValueTypeOrValueTypePtr() { return false; } virtual bool IsValueTypeOrValueTypePtr() { return false; }
virtual bool IsWrappableType() { return false; } virtual bool IsWrappableType() { return false; }
virtual bool IsPrimitiveType() { return false; } virtual bool IsPrimitiveType() { return false; }
@ -1960,6 +1961,7 @@ public:
virtual bool IsTypeInstance() override { return true; } virtual bool IsTypeInstance() override { return true; }
virtual bool IsInterface() override { return mTypeDef->mTypeCode == BfTypeCode_Interface; } virtual bool IsInterface() override { return mTypeDef->mTypeCode == BfTypeCode_Interface; }
virtual bool IsValueType() override { return (mTypeDef->mTypeCode == BfTypeCode_Struct) || (mTypeDef->mTypeCode == BfTypeCode_Enum); } virtual bool IsValueType() override { return (mTypeDef->mTypeCode == BfTypeCode_Struct) || (mTypeDef->mTypeCode == BfTypeCode_Enum); }
virtual bool IsOpaque() override { return mTypeDef->mIsOpaque; }
virtual bool IsStruct() override { return ((mTypeDef->mTypeCode == BfTypeCode_Struct) || (mTypeDef->mTypeCode == BfTypeCode_Enum)) && (!mIsTypedPrimitive); } virtual bool IsStruct() override { return ((mTypeDef->mTypeCode == BfTypeCode_Struct) || (mTypeDef->mTypeCode == BfTypeCode_Enum)) && (!mIsTypedPrimitive); }
virtual bool IsUnion() override { return mIsUnion; } virtual bool IsUnion() override { return mIsUnion; }
virtual bool IsDelegate() override { return mTypeDef->mIsDelegate; } virtual bool IsDelegate() override { return mTypeDef->mIsDelegate; }