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

Sized array .InitAll elemented initializer

This commit is contained in:
Brian Fiete 2022-08-23 12:07:02 -07:00
parent 05e002d8f5
commit 77a99bdacc
3 changed files with 45 additions and 7 deletions

View file

@ -5709,14 +5709,22 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
if (matchedProp != NULL)
{
if (mModule->PreFail())
if ((matchedProp->mDeclaringType->IsExtension()) && (!prop->mDeclaringType->IsExtension()))
{
auto error = mModule->Fail(StrFormat("Ambiguous reference to property '%s.%s'", mModule->TypeToString(curCheckType).c_str(), fieldName.c_str()), targetSrc);
if (error != NULL)
// Prefer non-extension
continue;
}
else
{
if (mModule->PreFail())
{
mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("See property declaration in project '%s'", matchedProp->mDeclaringType->mProject->mName.c_str()), matchedProp->mFieldDeclaration);
mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("See property declaration in project '%s'", prop->mDeclaringType->mProject->mName.c_str()), prop->mFieldDeclaration);
break;
auto error = mModule->Fail(StrFormat("Ambiguous reference to property '%s.%s'", mModule->TypeToString(curCheckType).c_str(), fieldName.c_str()), targetSrc);
if (error != NULL)
{
mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("See property declaration in project '%s'", matchedProp->mDeclaringType->mProject->mName.c_str()), matchedProp->mFieldDeclaration);
mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("See property declaration in project '%s'", prop->mDeclaringType->mProject->mName.c_str()), prop->mFieldDeclaration);
break;
}
}
}
}
@ -21406,6 +21414,11 @@ void BfExprEvaluator::DoMemberReference(BfMemberReferenceExpression* memberRefEx
return;
}
if (mExpectingType->IsSizedArray())
{
expectingTypeInst = mModule->GetWrappedStructType(mExpectingType);
}
if (expectingTypeInst == NULL)
{
if (mModule->PreFail())

View file

@ -941,7 +941,8 @@ void BfModule::CheckMemberNames(BfTypeInstance* typeInst)
MemberRef* prevMemberRef = NULL;
if (memberMap.TryGetValue(memberRef.mName, &prevMemberRef))
{
//auto& prevMemberRef = itr->second;
if ((prevMemberRef->mDeclaringType->IsExtension()) && (!memberRef.mDeclaringType->IsExtension()))
continue;
MemberRef* firstMemberRef = &memberRef;
MemberRef* secondMemberRef = prevMemberRef;