1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added typeof_comptime const type

This commit is contained in:
Brian Fiete 2025-01-19 12:40:50 -08:00
parent a82cc0534d
commit c511773dad
10 changed files with 111 additions and 10 deletions

View file

@ -5620,7 +5620,7 @@ BfIRValue BfModule::CreateClassVDataExtGlobal(BfTypeInstance* declTypeInst, BfTy
return globalVariable;
}
BfIRValue BfModule::CreateTypeDataRef(BfType* type)
BfIRValue BfModule::CreateTypeDataRef(BfType* type, bool forceConstant)
{
if (mBfIRBuilder->mIgnoreWrites)
{
@ -5629,6 +5629,9 @@ BfIRValue BfModule::CreateTypeDataRef(BfType* type)
if (mIsComptimeModule)
{
if (forceConstant)
return mBfIRBuilder->CreateTypeOfComptime(type);
auto typeTypeDef = ResolveTypeDef(mCompiler->mTypeTypeDef);
auto typeTypeInst = typeTypeDef->ToTypeInstance();
return mBfIRBuilder->Comptime_GetReflectType(type->mTypeId, mBfIRBuilder->MapType(typeTypeInst));
@ -12119,7 +12122,7 @@ BfIRValue BfModule::ConstantToCurrent(BfConstant* constant, BfIRConstHolder* con
auto constTypeOf = (BfTypeOf_Const*)constant;
if (mCurTypeInstance != NULL)
AddDependency(constTypeOf->mType, mCurTypeInstance, BfDependencyMap::DependencyFlag_ExprTypeReference);
return CreateTypeDataRef(constTypeOf->mType);
return CreateTypeDataRef(constTypeOf->mType, true);
}
if (constant->mConstType == BfConstType_PtrToInt)