mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Removed sized array initialization from tuples
This commit is contained in:
parent
bb34a468bb
commit
5bed292e87
7 changed files with 24 additions and 40 deletions
|
@ -15554,16 +15554,7 @@ void BfExprEvaluator::InitializedSizedArray(BfSizedArrayType* arrayType, BfToken
|
|||
}
|
||||
|
||||
void BfExprEvaluator::Visit(BfTupleExpression* tupleExpr)
|
||||
{
|
||||
if (mExpectingType != NULL)
|
||||
{
|
||||
if (mExpectingType->IsSizedArray())
|
||||
{
|
||||
InitializedSizedArray((BfSizedArrayType*)mExpectingType, tupleExpr->mOpenParen, tupleExpr->mValues, tupleExpr->mCommas, tupleExpr->mCloseParen);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
BfTupleType* tupleType = NULL;
|
||||
bool hadFullMatch = false;
|
||||
if ((mExpectingType != NULL) && (mExpectingType->IsTuple()))
|
||||
|
|
|
@ -2415,7 +2415,7 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
|||
bool useIntConstant = false;
|
||||
|
||||
bool wasMadeAddr = false;
|
||||
|
||||
|
||||
String fieldName = fieldDef->mName;
|
||||
BfIRValue intConstant;
|
||||
if (constant != NULL)
|
||||
|
@ -2424,7 +2424,8 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
|||
if (isOptimized)
|
||||
continue;
|
||||
|
||||
if (constant->mConstType == BfConstType_Array)
|
||||
if ((constant->mConstType == BfConstType_Array) ||
|
||||
(constant->mConstType == BfConstType_AggZero))
|
||||
{
|
||||
staticValue = ConstToMemory(staticValue);
|
||||
wasMadeAddr = true;
|
||||
|
|
|
@ -2436,7 +2436,8 @@ int BfResolvedTypeSet::Hash(BfTypeReference* typeRef, LookupContext* ctx, BfHash
|
|||
{
|
||||
if ((arrayType->mDimensions == 1) && (arrayType->mParams.size() != 0))
|
||||
{
|
||||
int elemHash = Hash(arrayType->mElementType, ctx) ^ HASH_SIZED_ARRAY;
|
||||
int rawElemHash = Hash(arrayType->mElementType, ctx);
|
||||
int elemHash = rawElemHash ^ HASH_SIZED_ARRAY;
|
||||
int hashVal = (elemHash << 5) - elemHash;
|
||||
|
||||
// Sized array
|
||||
|
@ -2460,25 +2461,15 @@ int BfResolvedTypeSet::Hash(BfTypeReference* typeRef, LookupContext* ctx, BfHash
|
|||
if (typedVal.mKind == BfTypedValueKind_GenericConstValue)
|
||||
{
|
||||
int elemHash = Hash(typedVal.mType, ctx);
|
||||
|
||||
/*BF_ASSERT(typedVal.mType->IsGenericParam());
|
||||
auto genericParamInstance = ctx->mModule->GetGenericParamInstance((BfGenericParamType*)typedVal.mType);
|
||||
if ((genericParamInstance->mTypeConstraint == NULL) ||
|
||||
(!ctx->mModule->CanCast(BfTypedValue(ctx->mModule->mBfIRBuilder->GetFakeVal(), genericParamInstance->mTypeConstraint),
|
||||
ctx->mModule->GetPrimitiveType(BfTypeCode_IntPtr))))
|
||||
{
|
||||
ctx->mModule->Fail(StrFormat("Generic constraint '%s' is not convertible to 'int'", ctx->mModule->TypeToString(typedVal.mType).c_str()), sizeExpr);
|
||||
}*/
|
||||
|
||||
hashVal = ((hashVal ^ elemHash) << 5) - hashVal;
|
||||
return hashVal;
|
||||
}
|
||||
if (!typedVal)
|
||||
ctx->mFailed = true;
|
||||
ctx->mFailed = true;
|
||||
if (typedVal)
|
||||
typedVal = ctx->mModule->Cast(sizeExpr, typedVal, intType);
|
||||
if (typedVal)
|
||||
{
|
||||
{
|
||||
auto constant = ctx->mModule->mBfIRBuilder->GetConstant(typedVal.mValue);
|
||||
if (constant->mConstType == BfConstType_Undef)
|
||||
{
|
||||
|
@ -3133,6 +3124,8 @@ bool BfResolvedTypeSet::Equals(BfType* lhs, BfTypeReference* rhs, LookupContext*
|
|||
auto rhsArrayTypeRef = BfNodeDynCastExact<BfArrayTypeRef>(rhs);
|
||||
if (rhsArrayTypeRef == NULL)
|
||||
return false;
|
||||
if (!rhsArrayTypeRef->mParams.IsEmpty())
|
||||
return false;
|
||||
BfArrayType* lhsArrayType = (BfArrayType*) lhs;
|
||||
if (lhsArrayType->mDimensions != rhsArrayTypeRef->mDimensions)
|
||||
return false;
|
||||
|
|
|
@ -2247,15 +2247,15 @@ public:
|
|||
BfHashFlag_AllowRef = 1,
|
||||
BfHashFlag_AllowGenericParamConstValue = 2
|
||||
};
|
||||
|
||||
|
||||
class LookupContext
|
||||
{
|
||||
{
|
||||
public:
|
||||
BfModule* mModule;
|
||||
BfTypeReference* mRootTypeRef;
|
||||
BfTypeDef* mRootTypeDef;
|
||||
BfType* mResolvedType;
|
||||
bool mFailed;
|
||||
bool mFailed;
|
||||
|
||||
public:
|
||||
LookupContext()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue