mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Hardening against errors during build fails
This commit is contained in:
parent
ac7f66c1f1
commit
9444a0d936
2 changed files with 28 additions and 12 deletions
|
@ -10353,6 +10353,10 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
||||||
emitParser->GetLineCharAtIdx(kv.mValue.mSrcStart, startLine, startLineChar);
|
emitParser->GetLineCharAtIdx(kv.mValue.mSrcStart, startLine, startLineChar);
|
||||||
|
|
||||||
int srcEnd = kv.mValue.mSrcEnd - 1;
|
int srcEnd = kv.mValue.mSrcEnd - 1;
|
||||||
|
|
||||||
|
if (srcEnd >= emitParser->mOrigSrcLength)
|
||||||
|
continue;
|
||||||
|
|
||||||
while (srcEnd >= kv.mValue.mSrcStart)
|
while (srcEnd >= kv.mValue.mSrcStart)
|
||||||
{
|
{
|
||||||
char c = emitParser->mSrc[srcEnd];
|
char c = emitParser->mSrc[srcEnd];
|
||||||
|
|
|
@ -4235,6 +4235,8 @@ void BfModule::CreateStaticField(BfFieldInstance* fieldInstance, bool isThreadLo
|
||||||
else
|
else
|
||||||
irType = mBfIRBuilder->MapType(fieldType, BfIRPopulateType_Eventually_Full);
|
irType = mBfIRBuilder->MapType(fieldType, BfIRPopulateType_Eventually_Full);
|
||||||
|
|
||||||
|
if (fieldType->mSize > 0)
|
||||||
|
{
|
||||||
BfIRValue globalVar = mBfIRBuilder->CreateGlobalVariable(
|
BfIRValue globalVar = mBfIRBuilder->CreateGlobalVariable(
|
||||||
irType,
|
irType,
|
||||||
false,
|
false,
|
||||||
|
@ -4250,6 +4252,7 @@ void BfModule::CreateStaticField(BfFieldInstance* fieldInstance, bool isThreadLo
|
||||||
mStaticFieldRefs[fieldInstance] = globalVar;
|
mStaticFieldRefs[fieldInstance] = globalVar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance* fieldInstance, BfFieldDef* fieldDef, bool forceResolve)
|
void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance* fieldInstance, BfFieldDef* fieldDef, bool forceResolve)
|
||||||
|
@ -14755,6 +14758,15 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (methodDef->mIdx >= typeInst->mMethodInstanceGroups.mSize)
|
||||||
|
PopulateType(typeInst, BfPopulateType_DataAndMethods);
|
||||||
|
|
||||||
|
if (methodDef->mIdx >= typeInst->mMethodInstanceGroups.mSize)
|
||||||
|
{
|
||||||
|
InternalError("GetMethodInstance OOB error", methodDef->GetRefNode());
|
||||||
|
return BfModuleMethodInstance();
|
||||||
|
}
|
||||||
|
|
||||||
methodInstGroup = &typeInst->mMethodInstanceGroups[methodDef->mIdx];
|
methodInstGroup = &typeInst->mMethodInstanceGroups[methodDef->mIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue