1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed AddStackMarkableObject with base append fields

This commit is contained in:
Brian Fiete 2025-01-28 17:17:24 -08:00
parent 9baf0ead21
commit d9ce23ac8e
3 changed files with 18 additions and 9 deletions

View file

@ -16739,14 +16739,8 @@ void BfExprEvaluator::CreateObject(BfObjectCreateExpression* objCreateExpr, BfAs
if (!needsCall) if (!needsCall)
{ {
for (auto& fieldInst : typeInstance->mFieldInstances) if (typeInstance->HasAppendedField(true))
{ needsCall = true;
if (fieldInst.IsAppendedObject())
{
needsCall = true;
break;
}
}
} }
if (needsCall) if (needsCall)

View file

@ -2483,6 +2483,20 @@ bool BfTypeInstance::BaseHasAppendCtor()
return false; return false;
} }
bool BfTypeInstance::HasAppendedField(bool checkBase)
{
for (auto& fieldInstance : mFieldInstances)
{
if (fieldInstance.IsAppendedObject())
return true;
}
if ((checkBase) && (mBaseType != NULL))
return mBaseType->HasAppendedField(checkBase);
return false;
}
void BfTypeInstance::ReportMemory(MemReporter* memReporter) void BfTypeInstance::ReportMemory(MemReporter* memReporter)
{ {
if (mGenericTypeInfo != NULL) if (mGenericTypeInfo != NULL)

View file

@ -1020,7 +1020,7 @@ public:
BfExpression* GetParamInitializer(int paramIdx); BfExpression* GetParamInitializer(int paramIdx);
BfTypeReference* GetParamTypeRef(int paramIdx); BfTypeReference* GetParamTypeRef(int paramIdx);
BfIdentifierNode* GetParamNameNode(int paramIdx); BfIdentifierNode* GetParamNameNode(int paramIdx);
int DbgGetVirtualMethodNum(); int DbgGetVirtualMethodNum();
void GetIRFunctionInfo(BfModule* module, BfIRType& returnType, SizedArrayImpl<BfIRType>& paramTypes, bool forceStatic = false); void GetIRFunctionInfo(BfModule* module, BfIRType& returnType, SizedArrayImpl<BfIRType>& paramTypes, bool forceStatic = false);
int GetIRFunctionParamCount(BfModule* module); int GetIRFunctionParamCount(BfModule* module);
@ -2219,6 +2219,7 @@ public:
bool IsAnonymousInitializerType(); bool IsAnonymousInitializerType();
bool HasAppendCtor(); bool HasAppendCtor();
bool BaseHasAppendCtor(); bool BaseHasAppendCtor();
bool HasAppendedField(bool checkBase);
virtual void ReportMemory(MemReporter* memReporter) override; virtual void ReportMemory(MemReporter* memReporter) override;
}; };