mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Added error for attempting to instantiate opaque attributes
This commit is contained in:
parent
9a9e12ea37
commit
6d474b31d9
1 changed files with 6 additions and 2 deletions
|
@ -12817,6 +12817,7 @@ void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttri
|
|||
|
||||
bool success = true;
|
||||
|
||||
int methodCheckCount = 0;
|
||||
bool isFailurePass = false;
|
||||
for (int pass = 0; pass < 2; pass++)
|
||||
{
|
||||
|
@ -12828,11 +12829,12 @@ void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttri
|
|||
continue; // Don't match private default ctor if there's a user-defined one
|
||||
|
||||
if ((checkMethod->mIsStatic) || (checkMethod->mMethodType != BfMethodType_Ctor))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if ((!isFailurePass) && (!CheckProtection(checkMethod->mProtection, attrTypeInst->mTypeDef, false, false)))
|
||||
continue;
|
||||
|
||||
methodCheckCount++;
|
||||
methodMatcher.CheckMethod(NULL, attrTypeInst, checkMethod, isFailurePass);
|
||||
}
|
||||
|
||||
|
@ -12856,6 +12858,8 @@ void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttri
|
|||
|
||||
if (methodMatcher.mBestMethodDef == NULL)
|
||||
{
|
||||
if (methodCheckCount == 0)
|
||||
Fail(StrFormat("No attribute constructors found for type '%s'", TypeToString(attrTypeInst).c_str()), attributesDirective);
|
||||
AssertErrorState();
|
||||
continue;
|
||||
}
|
||||
|
@ -13351,7 +13355,7 @@ BfTypedValue BfModule::LoadValue(BfTypedValue typedValue, BfAstNode* refNode, bo
|
|||
return typedValue;
|
||||
|
||||
PopulateType(typedValue.mType);
|
||||
if ((typedValue.mType->IsValuelessNonOpaqueType()) || (typedValue.mType->IsVar()))
|
||||
if ((typedValue.mType->IsValuelessType()) || (typedValue.mType->IsVar()))
|
||||
return BfTypedValue(mBfIRBuilder->GetFakeVal(), typedValue.mType, false);
|
||||
|
||||
if (typedValue.mValue.IsConst())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue