1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fix new ObsoleteAttribute constructors

This commit is contained in:
disarray2077 2023-01-13 18:39:29 -03:00 committed by GitHub
parent 3e210999ce
commit 33fc0be429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3414,7 +3414,7 @@ void BfModule::CheckErrorAttributes(BfTypeInstance* typeInstance, BfMethodInstan
BfIRConstHolder* constHolder = typeInstance->mConstHolder; BfIRConstHolder* constHolder = typeInstance->mConstHolder;
auto customAttribute = customAttributes->Get(mCompiler->mObsoleteAttributeTypeDef); auto customAttribute = customAttributes->Get(mCompiler->mObsoleteAttributeTypeDef);
if ((customAttribute != NULL) && (!customAttribute->mCtorArgs.IsEmpty()) && (targetSrc != NULL)) if ((customAttribute != NULL) && (targetSrc != NULL))
{ {
String err; String err;
if (fieldInstance != NULL) if (fieldInstance != NULL)
@ -3426,23 +3426,29 @@ void BfModule::CheckErrorAttributes(BfTypeInstance* typeInstance, BfMethodInstan
bool isError = false; bool isError = false;
auto constant = constHolder->GetConstant(customAttribute->mCtorArgs[0]); if (customAttribute->mCtorArgs.size() >= 1)
if (constant->mTypeCode == BfTypeCode_Boolean)
{ {
isError = constant->mBool; auto constant = constHolder->GetConstant(customAttribute->mCtorArgs[0]);
} if (constant->mTypeCode == BfTypeCode_Boolean)
else if (customAttribute->mCtorArgs.size() >= 2)
{
String* str = GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
if (str != NULL)
{ {
err += ":\n '"; isError = constant->mBool;
err += *str;
err += "'";
} }
else if (constant->mTypeCode == BfTypeCode_StringId)
{
String* str = GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
if (str != NULL)
{
err += ":\n '";
err += *str;
err += "'";
}
constant = constHolder->GetConstant(customAttribute->mCtorArgs[1]); if (customAttribute->mCtorArgs.size() >= 2)
isError = constant->mBool; {
constant = constHolder->GetConstant(customAttribute->mCtorArgs[1]);
isError = constant->mBool;
}
}
} }
BfError* error = NULL; BfError* error = NULL;
@ -26196,4 +26202,4 @@ void BfModule::ClearModule()
} }
if (mNextAltModule != NULL) if (mNextAltModule != NULL)
mNextAltModule->ClearModule(); mNextAltModule->ClearModule();
} }