mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Added const expr reflection type
This commit is contained in:
parent
674f0f6a56
commit
0eb19245eb
6 changed files with 214 additions and 23 deletions
|
@ -5333,6 +5333,8 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
|||
typeDataSource = ResolveTypeDef(mCompiler->mReflectRefType)->ToTypeInstance();
|
||||
else if (type->IsSizedArray())
|
||||
typeDataSource = ResolveTypeDef(mCompiler->mReflectSizedArrayType)->ToTypeInstance();
|
||||
else if (type->IsConstExprValue())
|
||||
typeDataSource = ResolveTypeDef(mCompiler->mReflectConstExprType)->ToTypeInstance();
|
||||
else
|
||||
typeDataSource = mContext->mBfTypeType;
|
||||
|
||||
|
@ -5430,6 +5432,8 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
|||
typeFlags |= BfTypeFlags_Nullable;
|
||||
if (type->IsSizedArray())
|
||||
typeFlags |= BfTypeFlags_SizedArray;
|
||||
if (type->IsConstExprValue())
|
||||
typeFlags |= BfTypeFlags_ConstExpr;
|
||||
if (type->IsSplattable())
|
||||
typeFlags |= BfTypeFlags_Splattable;
|
||||
if (type->IsUnion())
|
||||
|
@ -5545,6 +5549,23 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
|||
mBfIRBuilder->GlobalVar_SetAlignment(typeDataVar, mSystem->mPtrSize);
|
||||
typeDataVar = mBfIRBuilder->CreateBitCast(typeDataVar, mBfIRBuilder->MapType(mContext->mBfTypeType));
|
||||
}
|
||||
else if (type->IsConstExprValue())
|
||||
{
|
||||
auto constExprType = (BfConstExprValueType*)type;
|
||||
SizedArray<BfIRValue, 3> constExprTypeDataParms =
|
||||
{
|
||||
typeData,
|
||||
GetConstValue(constExprType->mType->mTypeId, typeIdType),
|
||||
GetConstValue(constExprType->mValue.mInt64, longType)
|
||||
};
|
||||
|
||||
auto reflectConstExprType = ResolveTypeDef(mCompiler->mReflectConstExprType)->ToTypeInstance();
|
||||
auto ConstExprTypeData = mBfIRBuilder->CreateConstAgg_Value(mBfIRBuilder->MapTypeInst(reflectConstExprType, BfIRPopulateType_Full), constExprTypeDataParms);
|
||||
typeDataVar = mBfIRBuilder->CreateGlobalVariable(mBfIRBuilder->MapTypeInst(reflectConstExprType), true,
|
||||
BfIRLinkageType_External, ConstExprTypeData, typeDataName);
|
||||
mBfIRBuilder->GlobalVar_SetAlignment(typeDataVar, mSystem->mPtrSize);
|
||||
typeDataVar = mBfIRBuilder->CreateBitCast(typeDataVar, mBfIRBuilder->MapType(mContext->mBfTypeType));
|
||||
}
|
||||
else
|
||||
{
|
||||
typeDataVar = mBfIRBuilder->CreateGlobalVariable(mBfIRBuilder->MapTypeInst(mContext->mBfTypeType), true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue