mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed reflection issue
This commit is contained in:
parent
2226e51977
commit
6e6487d951
4 changed files with 26 additions and 10 deletions
|
@ -2920,6 +2920,8 @@ void BeIRCodeGen::HandleNextCmd()
|
|||
CMD_PARAM(int, flags);
|
||||
CMD_PARAM(BeMDNode*, type);
|
||||
|
||||
BF_ASSERT(type != NULL);
|
||||
|
||||
auto dbgMember = mBeModule->mOwnedValues.Alloc<BeDbgStructMember>();
|
||||
dbgMember->mName = name;
|
||||
dbgMember->mType = (BeDbgType*)type;
|
||||
|
@ -2939,6 +2941,8 @@ void BeIRCodeGen::HandleNextCmd()
|
|||
CMD_PARAM(int, flags);
|
||||
CMD_PARAM(BeConstant*, val);
|
||||
|
||||
BF_ASSERT(type != NULL);
|
||||
|
||||
auto dbgMember = mBeModule->mOwnedValues.Alloc<BeDbgStructMember>();
|
||||
dbgMember->mName = name;
|
||||
dbgMember->mType = (BeDbgType*)type;
|
||||
|
|
|
@ -5829,7 +5829,11 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
|||
{
|
||||
auto refVal = ReferenceStaticField(fieldInstance);
|
||||
if (refVal.IsAddr())
|
||||
constValue = mBfIRBuilder->CreatePtrToInt(refVal.mValue, BfTypeCode_Int64);
|
||||
{
|
||||
constValue = mBfIRBuilder->CreatePtrToInt(refVal.mValue, BfTypeCode_IntPtr);
|
||||
if (mSystem->mPtrSize != 8)
|
||||
constValue = mBfIRBuilder->CreateNumericCast(constValue, false, BfTypeCode_Int64);
|
||||
}
|
||||
}
|
||||
|
||||
if (!constValue)
|
||||
|
|
|
@ -452,6 +452,7 @@ bool BfModule::InitType(BfType* resolvedTypeRef, BfPopulateType populateType)
|
|||
mContext->mSavedTypeData[savedTypeData->mTypeId] = NULL;
|
||||
|
||||
resolvedTypeRef->mTypeId = savedTypeData->mTypeId;
|
||||
|
||||
BfLogSysM("Using mSavedTypeData for %p %s\n", resolvedTypeRef, typeName.c_str());
|
||||
if (typeInst != NULL)
|
||||
{
|
||||
|
@ -5047,11 +5048,12 @@ BfTypeInstance* BfModule::CreateTupleType(const BfTypeVector& fieldTypes, const
|
|||
{
|
||||
auto baseType = (BfTypeInstance*)ResolveTypeDef(mContext->mCompiler->mValueTypeTypeDef);
|
||||
|
||||
BfTypeInstance* tupleType = NULL;
|
||||
BfTupleType* tupleType = NULL;
|
||||
|
||||
auto actualTupleType = mContext->mTupleTypePool.Get();
|
||||
actualTupleType->Init(baseType->mTypeDef->mProject, baseType);
|
||||
|
||||
bool isUnspecialzied = false;
|
||||
for (int fieldIdx = 0; fieldIdx < (int)fieldTypes.size(); fieldIdx++)
|
||||
{
|
||||
String fieldName;
|
||||
|
@ -5060,6 +5062,10 @@ BfTypeInstance* BfModule::CreateTupleType(const BfTypeVector& fieldTypes, const
|
|||
if (fieldName.empty())
|
||||
fieldName = StrFormat("%d", fieldIdx);
|
||||
BfFieldDef* fieldDef = actualTupleType->AddField(fieldName);
|
||||
|
||||
auto fieldType = fieldTypes[fieldIdx];
|
||||
if (fieldType->IsUnspecializedType())
|
||||
isUnspecialzied = true;
|
||||
}
|
||||
tupleType = actualTupleType;
|
||||
|
||||
|
@ -5073,6 +5079,14 @@ BfTypeInstance* BfModule::CreateTupleType(const BfTypeVector& fieldTypes, const
|
|||
fieldInstance->mOwner = tupleType;
|
||||
}
|
||||
|
||||
tupleType->mIsUnspecializedType = false;
|
||||
tupleType->mIsUnspecializedTypeVariation = false;
|
||||
if (isUnspecialzied)
|
||||
{
|
||||
tupleType->mIsUnspecializedType = true;
|
||||
tupleType->mIsUnspecializedTypeVariation = true;
|
||||
}
|
||||
|
||||
auto resolvedTupleType = ResolveType(tupleType);
|
||||
if (resolvedTupleType != tupleType)
|
||||
{
|
||||
|
@ -5859,12 +5873,6 @@ BfType* BfModule::ResolveGenericType(BfType* unspecializedType, BfTypeVector* ty
|
|||
actualTupleType->mGenericTypeInfo->mIsUnspecializedVariation = true;
|
||||
}
|
||||
|
||||
if (isUnspecialized)
|
||||
{
|
||||
actualTupleType->mGenericTypeInfo->mIsUnspecialized = true;
|
||||
actualTupleType->mGenericTypeInfo->mIsUnspecializedVariation = true;
|
||||
}
|
||||
|
||||
actualTupleType->mIsUnspecializedType = actualTupleType->mGenericTypeInfo->mIsUnspecialized;
|
||||
actualTupleType->mIsUnspecializedTypeVariation = actualTupleType->mGenericTypeInfo->mIsUnspecializedVariation;
|
||||
actualTupleType->Init(baseType->mTypeDef->mProject, baseType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue